Agda-2.4.2.5/0000755000000000000000000000000012635075266010720 5ustar0000000000000000Agda-2.4.2.5/LICENSE0000644000000000000000000001140512635075266011726 0ustar0000000000000000Copyright (c) 2005-2015 Ulf Norell, Andreas Abel, Nils Anders Danielsson, Andrés Sicard-Ramírez, Dominique Devriese, Péter Divianszki, Francesco Mazzoli, Stevan Andjelkovic, Daniel Gustafsson, Alan Jeffrey, Makoto Takeyama, Andrea Vezzosi, Nicolas Pouillard, James Chapman, Jean-Philippe Bernardy, Fredrik Lindblad, Nobuo Yamashita, Fredrik Nordvall Forsberg, Patrik Jansson, Guilhem Moulin, Stefan Monnier, Marcin Benke, Olle Fredriksson, Darin Morrison, Jesper Cockx, Wolfram Kahl, Catarina Coquand Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -------------------------------------------------------------------------------- The file src/full/Agda/Utils/ReadP.hs is Copyright (c) The University of Glasgow 2002 and is licensed under a BSD-like license as follows: Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: - Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. - Neither name of the University nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY COURT OF THE UNIVERSITY OF GLASGOW AND THE CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE UNIVERSITY COURT OF THE UNIVERSITY OF GLASGOW OR THE CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -------------------------------------------------------------------------------- The file src/full/Agda/Utils/Maybe/Strict.hs (and the following license text?) uses the following license: Copyright (c) Roman Leshchinskiy 2006-2007 Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. Neither the name of the author nor the names of his contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. Agda-2.4.2.5/README.md0000644000000000000000000001314312635075266012201 0ustar0000000000000000[![Build Status](https://travis-ci.org/agda/agda.svg?branch=maint-2.4)](https://travis-ci.org/agda/agda) Agda 2 ====== Table of contents: * [Prerequisites](#prerequisites) * [Installing Agda](#installing-agda) * [Configuring the Emacs mode](#configuring-the-emacs-mode) * [Installing Emacs under Windows](#installing-emacs-under-windows) Note that this README only discusses installation of Agda, not its standard library. See the [Agda Wiki][agdawiki] for information about the library. Prerequisites ------------- You need recent versions of the following programs/libraries: * GHC: http://www.haskell.org/ghc/ * cabal-install: http://www.haskell.org/cabal/ * Alex: http://www.haskell.org/alex/ * Happy: http://www.haskell.org/happy/ * cpphs: http://projects.haskell.org/cpphs/ * GNU Emacs: http://www.gnu.org/software/emacs/ You should also make sure that programs installed by cabal-install are on your shell's search path. For instructions on installing a suitable version of Emacs under Windows, see [below]((#installing-emacs-under-windows). Non-Windows users need to ensure that the development files for the C libraries zlib and ncurses are installed (see http://zlib.net and http://www.gnu.org/software/ncurses/). Your package manager may be able to install these files for you. For instance, on Debian or Ubuntu it should suffice to run apt-get install zlib1g-dev libncurses5-dev as root to get the correct files installed. ### Note on GHC's CPP language extension Recent versions of Clang's preprocessor don't work well with Haskell. In order to get some dependencies to build, you may need to set up Cabal to have GHC use cpphs by default. You can do this by adding program-default-options ghc-options: -pgmPcpphs -optP--cpp to your .cabal/config file. (You must be using cabal >= 1.18. Note that some packages may not compile with this option set.) You don't need to set this option to install *Agda* from the current development source; Agda.cabal now uses cpphs. Installing Agda --------------- There are several ways to install Agda: ### Using a binary package prepared for your platform Recommended if such a package exists. See the [Agda Wiki][agdawiki]. ### Using a released source package from Hackage Install the prerequisites mentioned below, then run the following commands: cabal update cabal install Agda agda-mode setup The last command tries to set up Emacs for use with Agda. As an alternative you can copy the following text to your .emacs file: (load-file (let ((coding-system-for-read 'utf-8)) (shell-command-to-string "agda-mode locate"))) It is also possible (but not necessary) to compile the Emacs mode's files: agda-mode compile This can, in some cases, give a noticeable speedup. **WARNING**: If you reinstall the Agda mode without recompiling the Emacs Lisp files, then Emacs may continue using the old, compiled files. ### Using the development version of the code You can obtain tarballs of the development version from the [Agda Wiki][agdawiki], or clone the repository. Install the prerequisites discussed in [Prerequisites](#prerequisites). Then, either: *(1a)* Run the following commands in the top-level directory of the Agda source tree to install Agda: cabal update cabal install *(1b)* Run `agda-mode setup` to set up Emacs for use with Agda. Alternatively, add the following text to your .emacs file: (load-file (let ((coding-system-for-read 'utf-8)) (shell-command-to-string "agda-mode locate"))) It is also possible (but not necessary) to compile the Emacs mode's files: agda-mode compile This can, in some cases, give a noticeable speedup. **WARNING**: If you reinstall the Agda mode without recompiling the Emacs Lisp files, then Emacs may continue using the old compiled files. *(2)* Or, you can try to install Agda (including a compiled Emacs mode) by running the following command: make install Configuring the Emacs mode -------------------------- If you want to you can customise the Emacs mode. Just start Emacs and type the following: M-x load-library RET agda2-mode RET M-x customize-group RET agda2 RET This is useful if you want to change the Agda search path, in which case you should change the agda2-include-dirs variable. If you want some specific settings for the Emacs mode you can add them to agda2-mode-hook. For instance, if you do not want to use the Agda input method (for writing various symbols like ∀≥ℕ→π⟦⟧) you can add the following to your .emacs: (add-hook 'agda2-mode-hook '(lambda () ; If you do not want to use any input method: (deactivate-input-method) ; (In some versions of Emacs you should use ; inactivate-input-method instead of ; deactivate-input-method.) ; If you want to use the X input method: (set-input-method "X"))) Note that, on some systems, the Emacs mode changes the default font of the current frame in order to enable many Unicode symbols to be displayed. This only works if the right fonts are available, though. If you want to turn off this feature, then you should customise the agda2-fontset-name variable. ------------------------------------------------------------------------ Installing Emacs under Windows ------------------------------------------------------------------------ A precompiled version of Emacs 24.3, with the necessary mathematical fonts, is available at http://homepage.cs.uiowa.edu/~astump/agda/ [agdawiki]: http://wiki.portal.chalmers.se/agda/pmwiki.php Agda-2.4.2.5/CHANGELOG0000644000000000000000000047504112635075266012145 0ustar0000000000000000------------------------------------------------------------------------ -- Release notes for Agda version 2.4.2.5 ------------------------------------------------------------------------ Important changes since 2.4.2.4: Installation and infrastructure =============================== * Added support for GHC 7.10.3. * Added `cpphs` Cabal flag Turn on/off this flag to choose cpphs/cpp as the C preprocessor. This flag is turn on by default. (This flag was added in Agda 2.4.2.1 but it was not documented) Pragmas and options =================== * Termination pragmas are not allowed inside `where` clauses [Issue 1137]. Type checking ============= * `with`-abstraction is more agressive, abstracts also in types of variables that are used in the `with`-expressions, unless they are also used in the types of the `with`-expressions. [Issue 1692] Example: ```agda test : (f : (x : A) → a ≡ x) (b : A) → b ≡ a test f b with a | f b test f b | .b | refl = f b ``` Previously, `with` would not abstract in types of variables that appear in the `with`-expressions, in this case, both `f` and `b`, leaving their types unchanged. Now, it tries to abstract in `f`, as only `b` appears in the types of the `with`-expressions which are `A` (of `a`) and `a ≡ b` (of `f b`). As a result, the type of `f` changes to `(x : A) → b ≡ x` and the type of the goal to `b ≡ b` (as previously). This also affects `rewrite`, which is implemented in terms of `with`. ```agda test : (f : (x : A) → a ≡ x) (b : A) → b ≡ a test f b rewrite f b = f b ``` As the new `with` is not fully backwards-compatible, some parts of your Agda developments using `with` or `rewrite` might need maintenance. Fixed issues ============ See https://github.com/agda/agda/issues * 1407 * 1518 * 1670 * 1677 * 1698 * 1701 * 1710 * 1718 ------------------------------------------------------------------------ -- Release notes for Agda version 2.4.2.4 ------------------------------------------------------------------------ Important changes since 2.4.2.3: Installation and infrastructure =============================== * Removed support for GHC 7.4.2. Pragmas and options =================== * Option --copatterns is now on by default. To switch off parsing of copatterns, use: {-# OPTIONS --no-copatterns #-} * Option --rewriting is now needed to use REWRITE pragmas and rewriting during reduction. Rewriting is not --safe. To use rewriting, first specify a relation symbol `R` that will later be used to add rewrite rules. A canonical candidate would be propositional equality {-# BUILTIN REWRITE _≡_ #-} but any symbol `R` of type `Δ → A → A → Set i` for some `A` and `i` is accepted. Then symbols `q` can be added to rewriting provided their type is of the form `Γ → R ds l r`. This will add a rewrite rule Γ ⊢ l ↦ r : A[ds/Δ] to the signature, which fires whenever a term is an instance of `l`. For example, if plus0 : ∀ x → x + 0 ≡ x (ideally, there is a proof for `plus0`, but it could be a postulate), then {-# REWRITE plus0 #-} will prompt Agda to rewrite any well-typed term of the form `t + 0` to `t`. Some caveats: Agda accepts and applies rewrite rules naively, it is very easy to break consistency and termination of type checking. Some examples of rewrite rules that should /not/ be added: refl : ∀ x → x ≡ x -- Agda loops plus-sym : ∀ x y → x + y ≡ y + x -- Agda loops absurd : true ≡ false -- Breaks consistency Adding only proven equations should at least preserve consistency, but this is only a conjecture, so know what you are doing! Using rewriting, you are entering into the wilderness, where you are on your own! Language ======== * forall / ∀ now parses like λ, i.e., the following parses now [Issue 1583]: ⊤ × ∀ (B : Set) → B → B * The underscore pattern _ can now also stand for an inaccessible pattern (dot pattern). This alleviates the need for writing `._'. [Issue 1605] Instead of transVOld : ∀{A : Set} (a b c : A) → a ≡ b → b ≡ c → a ≡ c transVOld _ ._ ._ refl refl = refl one can now write transVNew : ∀{A : Set} (a b c : A) → a ≡ b → b ≡ c → a ≡ c transVNew _ _ _ refl refl = refl and let Agda decide where to put the dots. This was always possible by using hidden arguments transH : ∀{A : Set}{a b c : A} → a ≡ b → b ≡ c → a ≡ c transH refl refl = refl which is now equivalent to transHNew : ∀{A : Set}{a b c : A} → a ≡ b → b ≡ c → a ≡ c transHNew {a = _}{b = _}{c = _} refl refl = refl Before, underscore _ stood for an unnamed variable that could not be instantiated by an inaccessible pattern. If one no wants to prevent Agda from instantiating, one needs to use a variable name other than underscore (however, in practice this situation seems unlikely). Type checking ============= * Polarity of phantom arguments to data and record types has changed. [Issue 1596] Polarity of size arguments is Nonvariant (both monotone and antitone). Polarity of other arguments is Covariant (monotone). Both were Invariant before (neither monotone nor antitone). The following example type-checks now: open import Common.Size -- List should be monotone in both arguments -- (even when `cons' is missing). data List (i : Size) (A : Set) : Set where [] : List i A castLL : ∀{i A} → List i (List i A) → List ∞ (List ∞ A) castLL x = x -- Stream should be antitone in the first and monotone in the second argument -- (even with field `tail' missing). record Stream (i : Size) (A : Set) : Set where coinductive field head : A castSS : ∀{i A} → Stream ∞ (Stream ∞ A) → Stream i (Stream i A) castSS x = x * SIZELT lambdas must be consistent [Issue 1523, see Abel and Pientka, ICFP 2013]. When lambda-abstracting over type (Size< size) then size must be non-zero, for any valid instantiation of size variables. The good: data Nat (i : Size) : Set where zero : ∀ (j : Size< i) → Nat i suc : ∀ (j : Size< i) → Nat j → Nat i {-# TERMINATING #-} -- This definition is fine, the termination checker is too strict at the moment. fix : ∀ {C : Size → Set} → (∀ i → (∀ (j : Size< i) → Nat j -> C j) → Nat i → C i) → ∀ i → Nat i → C i fix t i (zero j) = t i (λ (k : Size< i) → fix t k) (zero j) fix t i (suc j n) = t i (λ (k : Size< i) → fix t k) (suc j n) The λ (k : Size< i) is fine in both cases, as context i : Size, j : Size< i guarantees that i is non-zero. The bad: record Stream {i : Size} (A : Set) : Set where coinductive constructor _∷ˢ_ field head : A tail : ∀ {j : Size< i} → Stream {j} A open Stream public _++ˢ_ : ∀ {i A} → List A → Stream {i} A → Stream {i} A [] ++ˢ s = s (a ∷ as) ++ˢ s = a ∷ˢ (as ++ˢ s) This fails, maybe unjustified, at i : Size, s : Stream {i} A ⊢ a ∷ˢ (λ {j : Size< i} → as ++ˢ s) Fixed by defining the constructor by copattern matching: record Stream {i : Size} (A : Set) : Set where coinductive field head : A tail : ∀ {j : Size< i} → Stream {j} A open Stream public _∷ˢ_ : ∀ {i A} → A → Stream {i} A → Stream {↑ i} A head (a ∷ˢ as) = a tail (a ∷ˢ as) = as _++ˢ_ : ∀ {i A} → List A → Stream {i} A → Stream {i} A [] ++ˢ s = s (a ∷ as) ++ˢ s = a ∷ˢ (as ++ˢ s) The ugly: fix : ∀ {C : Size → Set} → (∀ i → (∀ (j : Size< i) → C j) → C i) → ∀ i → C i fix t i = t i λ (j : Size< i) → fix t j For i=0, there is no such j at runtime, leading to looping behavior. Interaction =========== * Issue 635 has been fixed. Case splitting does not spit out implicit record patterns any more. record Cont : Set₁ where constructor _◃_ field Sh : Set Pos : Sh → Set open Cont data W (C : Cont) : Set where sup : (s : Sh C) (k : Pos C s → W C) → W C bogus : {C : Cont} → W C → Set bogus w = {!w!} Case splitting on w yielded, since the fix of issue 473, bogus {Sh ◃ Pos} (sup s k) = ? Now it gives, as expected, bogus (sup s k) = ? Performance =========== * As one result of the 21st Agda Implementor's Meeting (AIM XXI), serialization of the standard library is 50% faster (time reduced by a third), without using additional disk space for the interface files. Bug fixes ========= * Issues fixed ( see https://github.com/agda/agda/issues ): 1546 (copattern matching and with-clauses) 1560 (positivity checker inefficiency) 1584 (let pattern with trailing implicit) ------------------------------------------------------------------------ -- Release notes for Agda version 2.4.2.3 ------------------------------------------------------------------------ Important changes since 2.4.2.2: Installation and infrastructure =============================== * Added support for GHC 7.10.1. * Removed support for GHC 7.0.4. Language ======== * _ is no longer a valid name for a definition. The following fails now: [Issue 1465] postulate _ : Set * Typed bindings can now contain hiding information [Issue 1391]. This means you can now write assoc : (xs {ys zs} : List A) → ((xs ++ ys) ++ zs) ≡ (xs ++ (ys ++ zs)) instead of the longer assoc : (xs : List A) {ys zs : List A} → ... It also works with irrelevance .(xs {ys zs} : List A) → ... but of course does not make sense if there is hiding information already. Thus, this is (still) a parse error: {xs {ys zs} : List A} → ... * The builtins for sized types no longer need accompanying postulates. The BUILTIN pragmas for size stuff now also declare the identifiers they bind to. {-# BUILTIN SIZEUNIV SizeUniv #-} -- SizeUniv : SizeUniv {-# BUILTIN SIZE Size #-} -- Size : SizeUniv {-# BUILTIN SIZELT Size<_ #-} -- Size<_ : ..Size → SizeUniv {-# BUILTIN SIZESUC ↑_ #-} -- ↑_ : Size → Size {-# BUILTIN SIZEINF ∞ #-} -- ∞ : Size Size and Size< now live in the new universe SizeUniv. It is forbidden to build function spaces in this universe, in order to prevent the malicious assumption of a size predecessor pred : (i : Size) → Size< i [Issue 1428]. * Unambiguous notations (coming from syntax declarations) that resolve to ambiguous names are now parsed unambiguously [Issue 1194]. * If only some instances of an overloaded name have a given associated notation (coming from syntax declarations), then this name can only be resolved to the given instances of the name, not to other instances [Issue 1194]. Previously, if different instances of an overloaded name had /different/ associated notations, then none of the notations could be used. Now all of them can be used. Note that notation identity does not only involve the right-hand side of the syntax declaration. For instance, the following notations are not seen as identical, because the implicit argument names are different: module A where data D : Set where c : {x y : D} → D syntax c {x = a} {y = b} = a ∙ b module B where data D : Set where c : {y x : D} → D syntax c {y = a} {x = b} = a ∙ b * If an overloaded operator is in scope with at least two distinct fixities, then it gets the default fixity [Issue 1436]. Similarly, if two or more identical notations for a given overloaded name are in scope, and these notations do not all have the same fixity, then they get the default fixity. Type checking ============= * Functions of varying arity can now have with-clauses and use rewrite. Example: NPred : Nat → Set NPred 0 = Bool NPred (suc n) = Nat → NPred n const : Bool → ∀{n} → NPred n const b {0} = b const b {suc n} m = const b {n} allOdd : ∀ n → NPred n allOdd 0 = true allOdd (suc n) m with even m ... | true = const false ... | false = allOdd n * Function defined by copattern matching can now have with-clauses and use rewrite. Example: {-# OPTIONS --copatterns #-} record Stream (A : Set) : Set where coinductive constructor delay field force : A × Stream A open Stream map : ∀{A B} → (A → B) → Stream A → Stream B force (map f s) with force s ... | a , as = f a , map f as record Bisim {A B} (R : A → B → Set) (s : Stream A) (t : Stream B) : Set where coinductive constructor ~delay field ~force : let a , as = force s b , bs = force t in R a b × Bisim R as bs open Bisim SEq : ∀{A} (s t : Stream A) → Set SEq = Bisim (_≡_) -- Slightly weird definition of symmetry to demonstrate rewrite. ~sym' : ∀{A} {s t : Stream A} → SEq s t → SEq t s ~force (~sym' {s = s} {t} p) with force s | force t | ~force p ... | a , as | b , bs | r , q rewrite r = refl , ~sym' q * Instances can now be defined by copattern matching. [Issue 1413] The following example extends the one in [Abel, Pientka, Thibodeau, Setzer, POPL 2013, Section 2.2]: {-# OPTIONS --copatterns #-} -- The Monad type class record Monad (M : Set → Set) : Set1 where field return : {A : Set} → A → M A _>>=_ : {A B : Set} → M A → (A → M B) → M B open Monad {{...}} -- The State newtype record State (S A : Set) : Set where field runState : S → A × S open State -- State is an instance of Monad instance stateMonad : {S : Set} → Monad (State S) runState (return {{stateMonad}} a ) s = a , s -- NEW runState (_>>=_ {{stateMonad}} m k) s₀ = -- NEW let a , s₁ = runState m s₀ in runState (k a) s₁ -- stateMonad fulfills the monad laws leftId : {A B S : Set}(a : A)(k : A → State S B) → (return a >>= k) ≡ k a leftId a k = refl rightId : {A B S : Set}(m : State S A) → (m >>= return) ≡ m rightId m = refl assoc : {A B C S : Set}(m : State S A)(k : A → State S B)(l : B → State S C) → ((m >>= k) >>= l) ≡ (m >>= λ a → k a >>= l) assoc m k l = refl Emacs mode ========== * The new menu option "Switch to another version of Agda" tries to do what it says. * Changed feature: Interactively split result. [ This is as before: ] Make-case (C-c C-c) with no variables given tries to split on the result to introduce projection patterns. The hole needs to be of record type, of course. test : {A B : Set} (a : A) (b : B) → A × B test a b = ? Result-splitting ? will produce the new clauses: proj₁ (test a b) = ? proj₂ (test a b) = ? [ This has changed: ] If hole is of function type, make-case will introduce only pattern variables (as much as it can). testFun : {A B : Set} (a : A) (b : B) → A × B testFun = ? Result-splitting ? will produce the new clause: testFun a b = ? A second invocation of make-case will then introduce projection patterns. Error messages ============== * Agda now suggests corrections of misspelled options, e.g. {-# OPTIONS --dont-termination-check --without-k --senf-gurke #-} Unrecognized options: --dont-termination-check (did you mean --no-termination-check ?) --without-k (did you mean --without-K ?) --senf-gurke Nothing close to --senf-gurke, I am afraid. Compiler backends ================= * The Epic backend has been removed [Issue 1481]. Bug fixes ========= * Fixed bug with unquoteDecl not working in instance blocks [Issue 1491]. * Other issues fixed ( see https://code.google.com/p/agda/issues ) 1497 1500 ------------------------------------------------------------------------ -- Release notes for Agda version 2.4.2.2 ------------------------------------------------------------------------ Important changes since 2.4.2.1: Bug fixes ========= * Compilation on Windows fixed. * Other issues fixed ( see https://code.google.com/p/agda/issues ) 1332 1353 1360 1366 1369 ------------------------------------------------------------------------ -- Release notes for Agda version 2.4.2.1 ------------------------------------------------------------------------ Important changes since 2.4.2: Pragmas and options =================== * New pragma {-# TERMINATING #-} replacing {-# NO_TERMINATION_CHECK #-} Complements the existing pragma {-# NON_TERMINATING #-}. Skips termination check for the associated definitions and marks them as terminating. Thus, it is a replacement for {-# NO_TERMINATION_CHECK #-} with the same semantics. You can no longer use pragma {-# NO_TERMINATION_CHECK #-} to skip the termination check, but must label your definitions as either {-# TERMINATING #-} or {-# NON_TERMINATING #-} instead. Note: {-# OPTION --no-termination-check #-} labels all your definitions as {-# TERMINATING #-}, putting you in the danger zone of a loop in the type checker. Language ======== * Referring to a local variable shadowed by module opening is now an error. Previous behavior was preferring the local over the imported definitions. [Issue 1266] Note that module parameters are locals as well as variables bound by λ, dependent function type, patterns, and let. Example: module M where A = Set1 test : (A : Set) → let open M in A The last A produces an error, since it could refer to the local variable A or to the definition imported from module M. * `with` on a variable bound by a module telescope or a pattern of a parent function is now forbidden. [Issue 1342] data Unit : Set where unit : Unit id : (A : Set) → A → A id A a = a module M (x : Unit) where dx : Unit → Unit dx unit = x g : ∀ u → x ≡ dx u g with x g | unit = id (∀ u → unit ≡ dx u) ? Even though this code looks right, Agda complains about the type expression `∀ u → unit ≡ dx u`. If you ask Agda what should go there instead, it happily tells you that it wants `∀ u → unit ≡ dx u`. In fact what you do not see and Agda will never show you is that the two expressions actually differ in the invisible first argument to `dx`, which is visible only outside module `M`. What Agda wants is an invisible `unit` after `dx`, but all you can write is an invisible `x` (which is inserted behind the scenes). To avoid those kinds of paradoxes, `with` is now outlawed on module parameters. This should ensure that the invisible arguments are always exactly the module parameters. Since a `where` block is desugared as module with pattern variables of the parent clause as module parameters, the same strikes you for uses of `with` on pattern variables of the parent function. f : Unit → Unit f x = unit where dx : Unit → Unit dx unit = x g : ∀ u → x ≡ dx u g with x g | unit = id ((u : Unit) → unit ≡ dx u) ? The `with` on pattern variable `x` of the parent clause `f x = unit` is outlawed now. Type checking ============= * Termination check failure is now a proper error. We no longer continue type checking after termination check failures. Use pragmas {-# NON_TERMINATING #-} and {-# NO_TERMINATION_CHECK #-} near the offending definitions if you want to do so. Or switch off the termination checker altogether with {-# OPTIONS --no-termination-check #-} (at your own risk!). * (Since Agda 2.4.2:) Termination checking --without-K restricts structural descent to arguments ending in data types or `Size`. Likewise, guardedness is only tracked when result type is data or record type. mutual data WOne : Set where wrap : FOne → WOne FOne = ⊥ → WOne noo : (X : Set) → (WOne ≡ X) → X → ⊥ noo .WOne refl (wrap f) = noo FOne iso f `noo` is rejected since at type `X` the structural descent `f < wrap f` is discounted --without-K. data Pandora : Set where C : ∞ ⊥ → Pandora loop : (A : Set) → A ≡ Pandora → A loop .Pandora refl = C (♯ (loop ⊥ foo)) `loop` is rejected since guardedness is not tracked at type `A` --without-K. See issues 1023, 1264, 1292. Termination checking ==================== * The termination checker can now recognize simple subterms in dot patterns. data Subst : (d : Nat) → Set where c₁ : ∀ {d} → Subst d → Subst d c₂ : ∀ {d₁ d₂} → Subst d₁ → Subst d₂ → Subst (suc d₁ + d₂) postulate comp : ∀ {d₁ d₂} → Subst d₁ → Subst d₂ → Subst (d₁ + d₂) lookup : ∀ d → Nat → Subst d → Set₁ lookup d zero (c₁ ρ) = Set lookup d (suc v) (c₁ ρ) = lookup d v ρ lookup .(suc d₁ + d₂) v (c₂ {d₁} {d₂} ρ σ) = lookup (d₁ + d₂) v (comp ρ σ) The dot pattern here is actually normalized, so it is suc (d₁ + d₂) and the corresponding recursive call argument is (d₁ + d₂). In such simple cases, Agda can now recognize that the pattern is constructor applied to call argument, which is valid descent. Note however, that Agda only looks for syntactic equality when identifying subterms, since it is not allowed to normalize terms on the rhs during termination checking. Actually writing the dot pattern has no effect, this works as well, and looks pretty magical... ;-) hidden : ∀{d} → Nat → Subst d → Set₁ hidden zero (c₁ ρ) = Set hidden (suc v) (c₁ ρ) = hidden v ρ hidden v (c₂ ρ σ) = hidden v (comp ρ σ) Tools ===== LaTeX-backend ------------- * Fixed the issue of identifiers containing operators being typeset with excessive math spacing. Bug fixes ========= * Issue 1194 * Issue 836: Fields and constructors can be qualified by the record/data *type* as well as by their record/data module. This now works also for record/data type imported from parametrized modules: module M (_ : Set₁) where record R : Set₁ where field X : Set open M Set using (R) -- rather than using (module R) X : R → Set X = R.X ------------------------------------------------------------------------ -- Release notes for Agda version 2.4.2 ------------------------------------------------------------------------ Important changes since 2.4.0.2: Pragmas and options =================== * New option: --with-K. This can be used to override a global --without-K in a file, by adding a pragma {-# OPTIONS --with-K #-}. * New pragma {-# NON_TERMINATING #-} This is a safer version of NO_TERMINATION_CHECK which doesn't treat the affected functions as terminating. This means that NON_TERMINATING functions do not reduce during type checking. They do reduce at run-time and when invoking C-c C-n at top-level (but not in a hole). Language ======== * Instance search is now more efficient and recursive (see issue 938) (but without termination check yet). A new keyword `instance' has been introduced (in the style of `abstract' and `private') which must now be used for every definition/postulate that has to be taken into account during instance resolution. For example: record RawMonoid (A : Set) : Set where field nil : A _++_ : A -> A -> A open RawMonoid {{...}} instance rawMonoidList : {A : Set} -> RawMonoid (List A) rawMonoidList = record { nil = []; _++_ = List._++_ } rawMonoidMaybe : {A : Set} {{m : RawMonoid A}} -> RawMonoid (Maybe A) rawMonoidMaybe {A} = record { nil = nothing ; _++_ = catMaybe } where catMaybe : Maybe A -> Maybe A -> Maybe A catMaybe nothing mb = mb catMaybe ma nothing = ma catMaybe (just a) (just b) = just (a ++ b) Moreover, each type of an instance must end in (something that reduces to) a named type (e.g. a record, a datatype or a postulate). This allows us to build a simple index structure data/record name --> possible instances that speeds up instance search. Instance search takes into account all local bindings and all global 'instance' bindings and the search is recursive. For instance, searching for ? : RawMonoid (Maybe (List A)) will consider the candidates {rawMonoidList, rawMonoidMaybe}, fail to unify the first one, succeeding with the second one ? = rawMonoidMaybe {A = List A} {{m = ?m}} : RawMonoid (Maybe (List A)) and continue with goal ?m : RawMonoid (List A) This will then find ?m = rawMonoidList {A = A} and putting together we have the solution. Be careful that there is no termination check for now, you can easily make Agda loop by declaring the identity function as an instance. But it shouldn’t be possible to make Agda loop by only declaring structurally recursive instances (whatever that means). Additionally: * Uniqueness of instances is up to definitional equality (see issue 899). * Instances of the following form are allowed: EqSigma : {A : Set} {B : A → Set} {{EqA : Eq A}} {{EqB : {a : A} → Eq (B a)}} → Eq (Σ A B) When searching recursively for an instance of type `{a : A} → Eq (B a)', a lambda will automatically be introduced and instance search will search for something of type `Eq (B a)' in the context extended by `a : A'. When searching for an instance, the `a' argument does not have to be implicit, but in the definition of EqSigma, instance search will only be able to use EqB if `a' is implicit. * There is no longer any attempt to solve irrelevant metas by instance search. * Constructors of records and datatypes are automatically added to the instance table. * You can now use 'quote' in patterns. For instance, here is a function that unquotes a (closed) natural number term. unquoteNat : Term → Maybe Nat unquoteNat (con (quote Nat.zero) []) = just zero unquoteNat (con (quote Nat.suc) (arg _ n ∷ [])) = fmap suc (unquoteNat n) unquoteNat _ = nothing * The builtin constructors AGDATERMUNSUPPORTED and AGDASORTUNSUPPORTED are now translated to meta variables when unquoting. * New syntactic sugar 'tactic e' and 'tactic e | e1 | .. | en'. It desugars as follows and makes it less unwieldy to call reflection-based tactics. tactic e --> quoteGoal g in unquote (e g) tactic e | e1 | .. | en --> quoteGoal g in unquote (e g) e1 .. en Note that in the second form the tactic function should generate a function from a number of new subgoals to the original goal. The type of e should be Term -> Term in both cases. * New reflection builtins for literals. The Term data type AGDATERM now needs an additional constructor AGDATERMLIT taking a reflected literal defined as follows (with appropriate builtin bindings for the types Nat, Float, etc). data Literal : Set where nat : Nat → Literal float : Float → Literal char : Char → Literal string : String → Literal qname : QName → Literal {-# BUILTIN AGDALITERAL Literal #-} {-# BUILTIN AGDALITNAT nat #-} {-# BUILTIN AGDALITFLOAT float #-} {-# BUILTIN AGDALITCHAR char #-} {-# BUILTIN AGDALITSTRING string #-} {-# BUILTIN AGDALITQNAME qname #-} When quoting (quoteGoal or quoteTerm) literals will be mapped to the AGDATERMLIT constructor. Previously natural number literals were quoted to suc/zero application and other literals were quoted to AGDATERMUNSUPPORTED. * New reflection builtins for function definitions. AGDAFUNDEF should now map to a data type defined as follows (with {-# BUILTIN QNAME QName #-} {-# BUILTIN ARG Arg #-} {-# BUILTIN AGDATERM Term #-} {-# BUILTIN AGDATYPE Type #-} {-# BUILTIN AGDALITERAL Literal #-}). data Pattern : Set where con : QName → List (Arg Pattern) → Pattern dot : Pattern var : Pattern lit : Literal → Pattern proj : QName → Pattern absurd : Pattern {-# BUILTIN AGDAPATTERN Pattern #-} {-# BUILTIN AGDAPATCON con #-} {-# BUILTIN AGDAPATDOT dot #-} {-# BUILTIN AGDAPATVAR var #-} {-# BUILTIN AGDAPATLIT lit #-} {-# BUILTIN AGDAPATPROJ proj #-} {-# BUILTIN AGDAPATABSURD absurd #-} data Clause : Set where clause : List (Arg Pattern) → Term → Clause absurd-clause : List (Arg Pattern) → Clause {-# BUILTIN AGDACLAUSE Clause #-} {-# BUILTIN AGDACLAUSECLAUSE clause #-} {-# BUILTIN AGDACLAUSEABSURD absurd-clause #-} data FunDef : Set where fun-def : Type → List Clause → FunDef {-# BUILTIN AGDAFUNDEF FunDef #-} {-# BUILTIN AGDAFUNDEFCON fun-def #-} * New reflection builtins for extended (pattern-matching) lambda. The AGDATERM data type has been augmented with a constructor AGDATERMEXTLAM : List AGDACLAUSE → List (ARG AGDATERM) → AGDATERM Absurd lambdas (λ ()) are quoted to extended lambdas with an absurd clause. * Unquoting declarations. You can now define (recursive) functions by reflection using the new unquoteDecl declaration unquoteDecl x = e Here e should have type AGDAFUNDEF and evaluate to a closed value. This value is then spliced in as the definition of x. In the body e, x has type QNAME which lets you splice in recursive definitions. Standard modifiers, such as fixity declarations, can be applied to x as expected. * Quoted levels Universe levels are now quoted properly instead of being quoted to AGDASORTUNSUPPORTED. Setω still gets an unsupported sort, however. * Module applicants can now be operator applications. Example: postulate [_] : A -> B module M (b : B) where module N (a : A) = M [ a ] [See Issue 1245.] * Minor change in module application semantics. [Issue 892] Previously re-exported functions were not redefined when instantiating a module. For instance module A where f = ... module B (X : Set) where open A public module C = B Nat In this example C.f would be an alias for A.f, so if both A and C were opened f would not be ambiguous. However, this behaviour is not correct when A and B share some module parameters (issue 892). To fix this C now defines its own copy of f (which evaluates to A.f), which means that opening A and C results in an ambiguous f. Type checking ============= * Recursive records need to be declared as either inductive or coinductive. 'inductive' is no longer default for recursive records. Examples: record _×_ (A B : Set) : Set where constructor _,_ field fst : A snd : B record Tree (A : Set) : Set where inductive constructor tree field elem : A subtrees : List (Tree A) record Stream (A : Set) : Set where coinductive constructor _::_ field head : A tail : Stream A If you are using old-style (musical) coinduction, a record may have to be declared as inductive, paradoxically. record Stream (A : Set) : Set where inductive -- YES, THIS IS INTENDED ! constructor _∷_ field head : A tail : ∞ (Stream A) This is because the ``coinduction'' happens in the use of `∞' and not in the use of `record'. Tools ===== Emacs mode ---------- * A new menu option "Display" can be used to display the version of the running Agda process. LaTeX-backend ------------- * New experimental option ``references'' has been added. When specified, i.e.: \usepackage[references]{agda} a new command called \AgdaRef is provided, which lets you reference previously typeset commands, e.g.: Let us postulate \AgdaRef{apa}. \begin{code} postulate apa : Set \end{code} Above ``apa'' will be typeset (highlighted) the same in the text as in the code, provided that the LaTeX output is post-processed using src/data/postprocess-latex.pl, e.g.: cp $(dirname $(dirname $(agda-mode locate)))/postprocess-latex.pl . agda -i. --latex Example.lagda cd latex/ perl ../postprocess-latex.pl Example.tex > Example.processed mv Example.processed Example.tex xelatex Example.tex Mix-fix and unicode should work as expected (unicode requires XeLaTeX/LuaLaTeX), but there are limitations: + Overloading identifiers should be avoided, if multiples exist \AgdaRef will typeset according to the first it finds. + Only the current module is used, should you need to reference identifiers in other modules then you need to specify which other module manually, i.e. \AgdaRef[module]{identifier}. ------------------------------------------------------------------------ -- Release notes for Agda 2 version 2.4.0.2 ------------------------------------------------------------------------ Important changes since 2.4.0.1: * The Agda input mode now supports alphabetical super and subscripts, in addition to the numerical ones that were already present. [Issue 1240] * New feature: Interactively split result. Make case (C-c C-c) with no variables given tries to split on the result to introduce projection patterns. The hole needs to be of record type, of course. test : {A B : Set} (a : A) (b : B) → A × B test a b = ? Result-splitting ? will produce the new clauses: proj₁ (test a b) = ? proj₂ (test a b) = ? If hole is of function type ending in a record type, the necessary pattern variables will be introduced before the split. Thus, the same result can be obtained by starting from: test : {A B : Set} (a : A) (b : B) → A × B test = ? * The so far undocumented ETA pragma now throws an error if applied to definitions that are not records. ETA can be used to force eta-equality at recursive record types, for which eta is not enabled automatically by Agda. Here is such an example: mutual data Colist (A : Set) : Set where [] : Colist A _∷_ : A → ∞Colist A → Colist A record ∞Colist (A : Set) : Set where coinductive constructor delay field force : Colist A open ∞Colist {-# ETA ∞Colist #-} test : {A : Set} (x : ∞Colist A) → x ≡ delay (force x) test x = refl Note: Unsafe use of ETA can make Agda loop, e.g. by triggering infinite eta expansion! * Bugs fixed (see https://code.google.com/p/agda/issues): 1203 1205 1209 1213 1214 1216 1225 1226 1231 1233 1239 1241 1243 ------------------------------------------------------------------------ -- Release notes for Agda 2 version 2.4.0.1 ------------------------------------------------------------------------ Important changes since 2.4.0: * The option --compile-no-main has been renamed to --no-main. * COMPILED_DATA pragmas can now be given for records. * Various bug fixes. ------------------------------------------------------------------------ -- Release notes for Agda 2 version 2.4.0 ------------------------------------------------------------------------ Important changes since 2.3.2.2: Installation and infrastructure =============================== * A new module called Agda.Primitive has been introduced. This module is available to all users, even if the standard library is not used. Currently the module contains level primitives and their representation in Haskell when compiling with MAlonzo: infixl 6 _⊔_ postulate Level : Set lzero : Level lsuc : (ℓ : Level) → Level _⊔_ : (ℓ₁ ℓ₂ : Level) → Level {-# COMPILED_TYPE Level () #-} {-# COMPILED lzero () #-} {-# COMPILED lsuc (\_ -> ()) #-} {-# COMPILED _⊔_ (\_ _ -> ()) #-} {-# BUILTIN LEVEL Level #-} {-# BUILTIN LEVELZERO lzero #-} {-# BUILTIN LEVELSUC lsuc #-} {-# BUILTIN LEVELMAX _⊔_ #-} To bring these declarations into scope you can use a declaration like the following one: open import Agda.Primitive using (Level; lzero; lsuc; _⊔_) The standard library reexports these primitives (using the names zero and suc instead of lzero and lsuc) from the Level module. Existing developments using universe polymorphism might now trigger the following error message: Duplicate binding for built-in thing LEVEL, previous binding to .Agda.Primitive.Level To fix this problem, please remove the duplicate bindings. Technical details (perhaps relevant to those who build Agda packages): The include path now always contains a directory /lib/prim, and this directory is supposed to contain a subdirectory Agda containing a file Primitive.agda. The standard location of is system- and installation-specific. E.g., in a cabal --user installation of Agda-2.3.4 on a standard single-ghc Linux system it would be $HOME/.cabal/share/Agda-2.3.4 or something similar. The location of the directory can be configured at compile-time using Cabal flags (--datadir and --datasubdir). The location can also be set at run-time, using the Agda_datadir environment variable. Pragmas and options =================== * Pragma NO_TERMINATION_CHECK placed within a mutual block is now applied to the whole mutual block (rather than being discarded silently). Adding to the uses 1.-4. outlined in the release notes for 2.3.2 we allow: 3a. Skipping an old-style mutual block: Somewhere within 'mutual' block before a type signature or first function clause. mutual {-# NO_TERMINATION_CHECK #-} c : A c = d d : A d = c * New option --no-pattern-matching Disables all forms of pattern matching (for the current file). You can still import files that use pattern matching. * New option -v profile:7 Prints some stats on which phases Agda spends how much time. (Number might not be very reliable, due to garbage collection interruptions, and maybe due to laziness of Haskell.) * New option --no-sized-types Option --sized-types is now default. --no-sized-types will turn off an extra (inexpensive) analysis on data types used for subtyping of sized types. Language ======== * Experimental feature: quoteContext There is a new keyword 'quoteContext' that gives users access to the list of names in the current local context. For instance: open import Data.Nat open import Data.List open import Reflection foo : ℕ → ℕ → ℕ foo 0 m = 0 foo (suc n) m = quoteContext xs in ? In the remaining goal, the list xs will consist of two names, n and m, corresponding to the two local variables. At the moment it is not possible to access let bound variables -- this feature may be added in the future. * Experimental feature: Varying arity. Function clauses may now have different arity, e.g., Sum : ℕ → Set Sum 0 = ℕ Sum (suc n) = ℕ → Sum n sum : (n : ℕ) → ℕ → Sum n sum 0 acc = acc sum (suc n) acc m = sum n (m + acc) or, T : Bool → Set T true = Bool T false = Bool → Bool f : (b : Bool) → T b f false true = false f false false = true f true = true This feature is experimental. Yet unsupported: * Varying arity and 'with'. * Compilation of functions with varying arity to Haskell, JS, or Epic. * Experimental feature: copatterns. (Activated with option --copatterns) We can now define a record by explaining what happens if you project the record. For instance: {-# OPTIONS --copatterns #-} record _×_ (A B : Set) : Set where constructor _,_ field fst : A snd : B open _×_ pair : {A B : Set} → A → B → A × B fst (pair a b) = a snd (pair a b) = b swap : {A B : Set} → A × B → B × A fst (swap p) = snd p snd (swap p) = fst p swap3 : {A B C : Set} → A × (B × C) → C × (B × A) fst (swap3 t) = snd (snd t) fst (snd (swap3 t)) = fst (snd t) snd (snd (swap3 t)) = fst t Taking a projection on the left hand side (lhs) is called a projection pattern, applying to a pattern is called an application pattern. (Alternative terms: projection/application copattern.) In the first example, the symbol 'pair', if applied to variable patterns a and b and then projected via fst, reduces to a. 'pair' by itself does not reduce. A typical application are coinductive records such as streams: record Stream (A : Set) : Set where coinductive field head : A tail : Stream A open Stream repeat : {A : Set} (a : A) -> Stream A head (repeat a) = a tail (repeat a) = repeat a Again, 'repeat a' by itself will not reduce, but you can take a projection (head or tail) and then it will reduce to the respective rhs. This way, we get the lazy reduction behavior necessary to avoid looping corecursive programs. Application patterns do not need to be trivial (i.e., variable patterns), if we mix with projection patterns. E.g., we can have nats : Nat -> Stream Nat head (nats zero) = zero tail (nats zero) = nats zero head (nats (suc x)) = x tail (nats (suc x)) = nats x Here is an example (not involving coinduction) which demostrates records with fields of function type: -- The State monad record State (S A : Set) : Set where constructor state field runState : S → A × S open State -- The Monad type class record Monad (M : Set → Set) : Set1 where constructor monad field return : {A : Set} → A → M A _>>=_ : {A B : Set} → M A → (A → M B) → M B -- State is an instance of Monad -- Demonstrates the interleaving of projection and application patterns stateMonad : {S : Set} → Monad (State S) runState (Monad.return stateMonad a ) s = a , s runState (Monad._>>=_ stateMonad m k) s₀ = let a , s₁ = runState m s₀ in runState (k a) s₁ module MonadLawsForState {S : Set} where open Monad (stateMonad {S}) leftId : {A B : Set}(a : A)(k : A → State S B) → (return a >>= k) ≡ k a leftId a k = refl rightId : {A B : Set}(m : State S A) → (m >>= return) ≡ m rightId m = refl assoc : {A B C : Set}(m : State S A)(k : A → State S B)(l : B → State S C) → ((m >>= k) >>= l) ≡ (m >>= λ a → (k a >>= l)) assoc m k l = refl Copatterns are yet experimental and the following does not work: * Copatterns and 'with' clauses. * Compilation of copatterns to Haskell, JS, or Epic. * Projections generated by open R {{...}} are not handled properly on lhss yet. * Conversion checking is slower in the presence of copatterns, since stuck definitions of record type do no longer count as neutral, since they can become unstuck by applying a projection. Thus, comparing two neutrals currently requires comparing all they projections, which repeats a lot of work. * Top-level module no longer required. The top-level module can be omitted from an Agda file. The module name is then inferred from the file name by dropping the path and the .agda extension. So, a module defined in /A/B/C.agda would get the name C. You can also suppress only the module name of the top-level module by writing module _ where This works also for parameterised modules. * Module parameters are now always hidden arguments in projections. For instance: module M (A : Set) where record Prod (B : Set) : Set where constructor _,_ field fst : A snd : B open Prod public open M Now, the types of fst and snd are fst : {A : Set}{B : Set} → Prod A B → A snd : {A : Set}{B : Set} → Prod A B → B Until 2.3.2, they were fst : (A : Set){B : Set} → Prod A B → A snd : (A : Set){B : Set} → Prod A B → B This change is a step towards symmetry of constructors and projections. (Constructors always took the module parameters as hidden arguments). * Telescoping lets: Local bindings are now accepted in telescopes of modules, function types, and lambda-abstractions. The syntax of telescopes as been extended to support 'let': id : (let ★ = Set) (A : ★) → A → A id A x = x In particular one can now 'open' modules inside telescopes: module Star where ★ : Set₁ ★ = Set module MEndo (let open Star) (A : ★) where Endo : ★ Endo = A → A Finally a shortcut is provided for opening modules: module N (open Star) (A : ★) (open MEndo A) (f : Endo) where ... The semantics of the latter is module _ where open Star module _ (A : ★) where open MEndo A module N (f : Endo) where ... The semantics of telescoping lets in function types and lambda abstractions is just expanding them into ordinary lets. * More liberal left-hand sides in lets [Issue 1028]: You can now write left-hand sides with arguments also for let bindings without a type signature. For instance, let f x = suc x in f zero Let bound functions still can't do pattern matching though. * Ambiguous names in patterns are now optimistically resolved in favor of constructors. [Issue 822] In particular, the following succeeds now: module M where data D : Set₁ where [_] : Set → D postulate [_] : Set → Set open M Foo : _ → Set Foo [ A ] = A * Anonymous where-modules are opened public. [Issue 848] f args = rhs module _ telescope where body means the following (not proper Agda code, since you cannot put a module in-between clauses) module _ {arg-telescope} telescope where body f args = rhs Example: A : Set1 A = B module _ where B : Set1 B = Set C : Set1 C = B * Builtin ZERO and SUC have been merged with NATURAL. When binding the NATURAL builtin, ZERO and SUC are bound to the appropriate constructors automatically. This means that instead of writing {-# BUILTIN NATURAL Nat #-} {-# BUILTIN ZERO zero #-} {-# BUILTIN SUC suc #-} you just write {-# BUILTIN NATURAL Nat #-} * Pattern synonym can now have implicit arguments. [Issue 860] For example, pattern tail=_ {x} xs = x ∷ xs len : ∀ {A} → List A → Nat len [] = 0 len (tail= xs) = 1 + len xs * Syntax declarations can now have implicit arguments. [Issue 400] For example id : ∀ {a}{A : Set a} -> A -> A id x = x syntax id {A} x = x ∈ A * Minor syntax changes * -} is now parsed as end-comment even if no comment was begun. As a consequence, the following definition gives a parse error f : {A- : Set} -> Set f {A-} = A- because Agda now sees ID(f) LBRACE ID(A) END-COMMENT, and no longer ID(f) LBRACE ID(A-) RBRACE. The rational is that the previous lexing was to context-sensitive, attempting to comment-out f using {- and -} lead to a parse error. * Fixities (binding strengths) can now be negative numbers as well. [Issue 1109] infix -1 _myop_ * Postulates are now allowed in mutual blocks. [Issue 977] * Empty where blocks are now allowed. [Issue 947] * Pattern synonyms are now allowed in parameterised modules. [Issue 941] * Empty hiding and renaming lists in module directives are now allowed. * Module directives using, hiding, renaming and public can now appear in arbitrary order. Multiple using/hiding/renaming directives are allowed, but you still cannot have both using and hiding (because that doesn't make sense). [Issue 493] Goal and error display ====================== * The error message "Refuse to construct infinite term" has been removed, instead one gets unsolved meta variables. Reason: the error was thrown over-eagerly. [Issue 795] * If an interactive case split fails with message Since goal is solved, further case distinction is not supported; try `Solve constraints' instead then the associated interaction meta is assigned to a solution. Press C-c C-= (Show constraints) to view the solution and C-c C-s (Solve constraints) to apply it. [Issue 289] Type checking ============= * [ issue 376 ] Implemented expansion of bound record variables during meta assignment. Now Agda can solve for metas X that are applied to projected variables, e.g.: X (fst z) (snd z) = z X (fst z) = fst z Technically, this is realized by substituting (x , y) for z with fresh bound variables x and y. Here the full code for the examples: record Sigma (A : Set)(B : A -> Set) : Set where constructor _,_ field fst : A snd : B fst open Sigma test : (A : Set) (B : A -> Set) -> let X : (x : A) (y : B x) -> Sigma A B X = _ in (z : Sigma A B) -> X (fst z) (snd z) ≡ z test A B z = refl test' : (A : Set) (B : A -> Set) -> let X : A -> A X = _ in (z : Sigma A B) -> X (fst z) ≡ fst z test' A B z = refl The fresh bound variables are named fst(z) and snd(z) and can appear in error messages, e.g.: fail : (A : Set) (B : A -> Set) -> let X : A -> Sigma A B X = _ in (z : Sigma A B) -> X (fst z) ≡ z fail A B z = refl results in error: Cannot instantiate the metavariable _7 to solution fst(z) , snd(z) since it contains the variable snd(z) which is not in scope of the metavariable or irrelevant in the metavariable but relevant in the solution when checking that the expression refl has type _7 A B (fst z) ≡ z * Dependent record types and definitions by copatterns require reduction with previous function clauses while checking the current clause. [Issue 907] For a simple example, consider test : ∀ {A} → Σ Nat λ n → Vec A n proj₁ test = zero proj₂ test = [] For the second clause, the lhs and rhs are typed as proj₂ test : Vec A (proj₁ test) [] : Vec A zero In order for these types to match, we have to reduce the lhs type with the first function clause. Note that termination checking comes after type checking, so be careful to avoid non-termination! Otherwise, the type checker might get into an infinite loop. * The implementation of the primitive primTrustMe has changed. It now only reduces to REFL if the two arguments x and y have the same computational normal form. Before, it reduced when x and y were definitionally equal, which included type-directed equality laws such as eta-equality. Yet because reduction is untyped, calling conversion from reduction lead to Agda crashes [Issue 882]. The amended description of primTrustMe is (cf. release notes for 2.2.6): primTrustMe : {A : Set} {x y : A} → x ≡ y Here _≡_ is the builtin equality (see BUILTIN hooks for equality, above). If x and y have the same computational normal form, then primTrustMe {x = x} {y = y} reduces to refl. A note on primTrustMe's runtime behavior: The MAlonzo compiler replaces all uses of primTrustMe with the REFL builtin, without any check for definitional equality. Incorrect uses of primTrustMe can potentially lead to segfaults or similar problems of the compiled code. * Implicit patterns of record type are now only eta-expanded if there is a record constructor. [Issues 473, 635] data D : Set where d : D data P : D → Set where p : P d record Rc : Set where constructor c field f : D works : {r : Rc} → P (Rc.f r) → Set works p = D This works since the implicit pattern {r} is eta-expanded to {c x} which allows the type of p to reduce to P x and x to be unified with d. The corresponding explicit version is: works' : (r : Rc) → P (Rc.f r) → Set works' (c .d) p = D However, if the record constructor is removed, the same example will fail: record R : Set where field f : D fails : {r : R} → P (R.f r) → Set fails p = D -- d != R.f r of type D -- when checking that the pattern p has type P (R.f r) The error is justified since there is no pattern we could write down for r. It would have to look like record { f = .d } but anonymous record patterns are not part of the language. * Absurd lambdas at different source locations are no longer different. [Issue 857] In particular, the following code type-checks now: absurd-equality : _≡_ {A = ⊥ → ⊥} (λ()) λ() absurd-equality = refl Which is a good thing! * Printing of named implicit function types. When printing terms in a context with bound variables Agda renames new bindings to avoid clashes with the previously bound names. For instance, if A is in scope, the type (A : Set) → A is printed as (A₁ : Set) → A₁. However, for implicit function types the name of the binding matters, since it can be used when giving implicit arguments. For this situation, the following new syntax has been introduced: {x = y : A} → B is an implicit function type whose bound variable (in scope in B) is y, but where the name of the argument is x for the purposes of giving it explicitly. For instance, with A in scope, the type {A : Set} → A is now printed as {A = A₁ : Set} → A₁. This syntax is only used when printing and is currently not being parsed. * Changed the semantics of --without-K. [Issue 712, Issue 865, Issue 1025] New specification of --without-K: When --without-K is enabled, the unification of indices for pattern matching is restricted in two ways: 1. Reflexive equations of the form x == x are no longer solved, instead Agda gives an error when such an equation is encountered. 2. When unifying two same-headed constructor forms 'c us' and 'c vs' of type 'D pars ixs', the datatype indices ixs (but not the parameters) have to be *self-unifiable*, i.e. unification of ixs with itself should succeed positively. This is a nontrivial requirement because of point 1. Examples: * The J rule is accepted. J : {A : Set} (P : {x y : A} → x ≡ y → Set) → (∀ x → P (refl x)) → ∀ {x y} (x≡y : x ≡ y) → P x≡y J P p (refl x) = p x This definition is accepted since unification of x with y doesn't require deletion or injectivity. * The K rule is rejected. K : {A : Set} (P : {x : A} → x ≡ x → Set) → (∀ x → P (refl {x = x})) → ∀ {x} (x≡x : x ≡ x) → P x≡x K P p refl = p _ Definition is rejected with the following error: Cannot eliminate reflexive equation x = x of type A because K has been disabled. when checking that the pattern refl has type x ≡ x * Symmetry of the new criterion. test₁ : {k l m : ℕ} → k + l ≡ m → ℕ test₁ refl = zero test₂ : {k l m : ℕ} → k ≡ l + m → ℕ test₂ refl = zero Both versions are now accepted (previously only the first one was). * Handling of parameters. cons-injective : {A : Set} (x y : A) → (x ∷ []) ≡ (y ∷ []) → x ≡ y cons-injective x .x refl = refl Parameters are not unified, so they are ignored by the new criterion. * A larger example: antisymmetry of ≤. data _≤_ : ℕ → ℕ → Set where lz : (n : ℕ) → zero ≤ n ls : (m n : ℕ) → m ≤ n → suc m ≤ suc n ≤-antisym : (m n : ℕ) → m ≤ n → n ≤ m → m ≡ n ≤-antisym .zero .zero (lz .zero) (lz .zero) = refl ≤-antisym .(suc m) .(suc n) (ls m n p) (ls .n .m q) = cong suc (≤-antisym m n p q) * [ Issue 1025 ] postulate mySpace : Set postulate myPoint : mySpace data Foo : myPoint ≡ myPoint → Set where foo : Foo refl test : (i : foo ≡ foo) → i ≡ refl test refl = {!!} When applying injectivity to the equation "foo ≡ foo" of type "Foo refl", it is checked that the index refl of type "myPoint ≡ myPoint" is self-unifiable. The equation "refl ≡ refl" again requires injectivity, so now the index myPoint is checked for self-unifiability, hence the error: Cannot eliminate reflexive equation myPoint = myPoint of type mySpace because K has been disabled. when checking that the pattern refl has type foo ≡ foo Termination checking ==================== * A buggy facility coined "matrix-shaped orders" that supported uncurried functions (which take tuples of arguments instead of one argument after another) has been removed from the termination checker. [Issue 787] * Definitions which fail the termination checker are not unfolded any longer to avoid loops or stack overflows in Agda. However, the termination checker for a mutual block is only invoked after type-checking, so there can still be loops if you define a non-terminating function. But termination checking now happens before the other supplementary checks: positivity, polarity, injectivity and projection-likeness. Note that with the pragma {-# NO_TERMINATION_CHECK #-} you can make Agda treat any function as terminating. * Termination checking of functions defined by 'with' has been improved. Cases which previously required --termination-depth to pass the termination checker (due to use of 'with') no longer need the flag. For example merge : List A → List A → List A merge [] ys = ys merge xs [] = xs merge (x ∷ xs) (y ∷ ys) with x ≤ y merge (x ∷ xs) (y ∷ ys) | false = y ∷ merge (x ∷ xs) ys merge (x ∷ xs) (y ∷ ys) | true = x ∷ merge xs (y ∷ ys) This failed to termination check previously, since the 'with' expands to an auxiliary function merge-aux: merge-aux x y xs ys false = y ∷ merge (x ∷ xs) ys merge-aux x y xs ys true = x ∷ merge xs (y ∷ ys) This function makes a call to merge in which the size of one of the arguments is increasing. To make this pass the termination checker now inlines the definition of merge-aux before checking, thus effectively termination checking the original source program. As a result of this transformation doing 'with' on a variable no longer preserves termination. For instance, this does not termination check: bad : Nat → Nat bad n with n ... | zero = zero ... | suc m = bad m * The performance of the termination checker has been improved. For higher --termination-depth the improvement is significant. While the default --termination-depth is still 1, checking with higher --termination-depth should now be feasible. Compiler backends ================= * The MAlonzo compiler backend now has support for compiling modules that are not full programs (i.e. don't have a main function). The goal is that you can write part of a program in Agda and the rest in Haskell, and invoke the Agda functions from the Haskell code. The following features were added for this reason: * A new command-line option --compile-no-main: the command agda --compile-no-main Test.agda will compile Test.agda and all its dependencies to Haskell and compile the resulting Haskell files with --make, but (unlike --compile) not tell GHC to treat Test.hs as the main module. This type of compilation can be invoked from emacs by customizing the agda2-backend variable to value MAlonzoNoMain and then calling "C-c C-x C-c" as before. * A new pragma COMPILED_EXPORT was added as part of the MAlonzo FFI. If we have an Agda file containing the following: module A.B where test : SomeType test = someImplementation {-# COMPILED_EXPORT test someHaskellId #-} then test will be compiled to a Haskell function called someHaskellId in module MAlonzo.Code.A.B that can be invoked from other Haskell code. Its type will be translated according to the normal MAlonzo rules. Tools ===== Emacs mode ---------- * A new goal command "Helper Function Type" (C-c C-h) has been added. If you write an application of an undefined function in a goal, the Helper Function Type command will print the type that the function needs to have in order for it to fit the goal. The type is also added to the Emacs kill-ring and can be pasted into the buffer using C-y. The application must be of the form "f args" where f is the name of the helper function you want to create. The arguments can use all the normal features like named implicits or instance arguments. Example: Here's a start on a naive reverse on vectors: reverse : ∀ {A n} → Vec A n → Vec A n reverse [] = [] reverse (x ∷ xs) = {!snoc (reverse xs) x!} Calling C-c C-h in the goal prints snoc : ∀ {A} {n} → Vec A n → A → Vec A (suc n) * A new command "Explain why a particular name is in scope" (C-c C-w) has been added. [Issue207] This command can be called from a goal or from the top-level and will as the name suggests explain why a particular name is in scope. For each definition or module that the given name can refer to a trace is printed of all open statements and module applications leading back to the original definition of the name. For example, given module A (X : Set₁) where data Foo : Set where mkFoo : Foo module B (Y : Set₁) where open A Y public module C = B Set open C Calling C-c C-w on mkFoo at the top-level prints mkFoo is in scope as * a constructor Issue207.C._.Foo.mkFoo brought into scope by - the opening of C at Issue207.agda:13,6-7 - the application of B at Issue207.agda:11,12-13 - the application of A at Issue207.agda:9,8-9 - its definition at Issue207.agda:6,5-10 This command is useful if Agda complains about an ambiguous name and you need to figure out how to hide the undesired interpretations. * Improvements to the "make case" command (C-c C-c) - One can now also split on hidden variables, using the name (starting with .) with which they are printed. Use C-c C-, to see all variables in context. - Concerning the printing of generated clauses: * Uses named implicit arguments to improve readability. * Picks explicit occurrences over implicit ones when there is a choice of binding site for a variable. * Avoids binding variables in implicit positions by replacing dot patterns that uses them by wildcards (._). * Key bindings for lots of "mathematical" characters (examples: 𝐴𝑨𝒜𝓐𝔄) have been added to the Agda input method. Example: type \MiA\MIA\McA\MCA\MfA to get 𝐴𝑨𝒜𝓐𝔄. Note: \McB does not exist in unicode (as well as others in that style), but the \MC (bold) alphabet is complete. * Key bindings for "blackboard bold" B (𝔹) and 0-9 (𝟘-𝟡) have been added to the Agda input method (\bb and \b[0-9]). * Key bindings for controlling simplification/normalisation: [TODO: Simplification should be explained somewhere.] Commands like "Goal type and context" (C-c C-,) could previously be invoked in two ways. By default the output was normalised, but if a prefix argument was used (for instance via C-u C-c C-,), then no explicit normalisation was performed. Now there are three options: * By default (C-c C-,) the output is simplified. * If C-u is used exactly once (C-u C-c C-,), then the result is neither (explicitly) normalised nor simplified. * If C-u is used twice (C-u C-u C-c C-,), then the result is normalised. [TODO: As part of the release of Agda 2.3.4 the key binding page on the wiki should be updated.] LaTeX-backend ------------- * Two new color scheme options were added to agda.sty: \usepackage[bw]{agda}, which highlights in black and white; \usepackage[conor]{agda}, which highlights using Conor's colors. The default (no options passed) is to use the standard colors. * If agda.sty cannot be found by the latex environment, it is now copied into the latex output directory ('latex' by default) instead of the working directory. This means that the commands needed to produce a PDF now is agda --latex -i . .lagda cd latex pdflatex .tex * The LaTeX-backend has been made more tool agnostic, in particular XeLaTeX and LuaLaTeX should now work. Here is a small example (test/latex-backend/succeed/UnicodeInput.lagda): \documentclass{article} \usepackage{agda} \begin{document} \begin{code} data αβγδεζθικλμνξρστυφχψω : Set₁ where postulate →⇒⇛⇉⇄↦⇨↠⇀⇁ : Set \end{code} \[ ∀X [ ∅ ∉ X ⇒ ∃f:X ⟶ ⋃ X\ ∀A ∈ X (f(A) ∈ A) ] \] \end{document} Compiled as follows, it should produce a nice looking PDF (tested with TeX Live 2012): agda --latex .lagda cd latex xelatex .tex (or lualatex .tex) If symbols are missing or xelatex/lualatex complains about the font missing, try setting a different font using: \setmathfont{} Use the fc-list tool to list available fonts. * Add experimental support for hyperlinks to identifiers If the hyperref latex package is loaded before the agda package and the links option is passed to the agda package, then the agda package provides a function called \AgdaTarget. Identifiers which have been declared targets, by the user, will become clickable hyperlinks in the rest of the document. Here is a small example (test/latex-backend/succeed/Links.lagda): \documentclass{article} \usepackage{hyperref} \usepackage[links]{agda} \begin{document} \AgdaTarget{ℕ} \AgdaTarget{zero} \begin{code} data ℕ : Set where zero : ℕ suc : ℕ → ℕ \end{code} See next page for how to define \AgdaFunction{two} (doesn't turn into a link because the target hasn't been defined yet). We could do it manually though; \hyperlink{two}{\AgdaDatatype{two}}. \newpage \AgdaTarget{two} \hypertarget{two}{} \begin{code} two : ℕ two = suc (suc zero) \end{code} \AgdaInductiveConstructor{zero} is of type \AgdaDatatype{ℕ}. \AgdaInductiveConstructor{suc} has not been defined to be a target so it doesn't turn into a link. \newpage Now that the target for \AgdaFunction{two} has been defined the link works automatically. \begin{code} data Bool : Set where true false : Bool \end{code} The AgdaTarget command takes a list as input, enabling several targets to be specified as follows: \AgdaTarget{if, then, else, if\_then\_else\_} \begin{code} if_then_else_ : {A : Set} → Bool → A → A → A if true then t else f = t if false then t else f = f \end{code} \newpage Mixfix identifier need their underscores escaped: \AgdaFunction{if\_then\_else\_}. \end{document} The boarders around the links can be suppressed using hyperref's hidelinks option: \usepackage[hidelinks]{hyperref} Note that the current approach to links does not keep track of scoping or types, and hence overloaded names might create links which point to the wrong place. Therefore it is recommended to not overload names when using the links option at the moment, this might get fixed in the future. ------------------------------------------------------------------------ -- Release notes for Agda 2 version 2.3.2.2 ------------------------------------------------------------------------ Important changes since 2.3.2.1: * Fixed a bug that sometimes made it tricky to use the Emacs mode on Windows [issue 757]. * Made Agda build with newer versions of some libraries. * Fixed a bug that caused ambiguous parse error messages [issue 147]. ------------------------------------------------------------------------ -- Release notes for Agda 2 version 2.3.2.1 ------------------------------------------------------------------------ Important changes since 2.3.2: Installation ============ * Made it possible to compile Agda with more recent versions of hashable, QuickCheck and Win32. * Excluded mtl-2.1. Type checking ============= * Fixed bug in the termination checker (issue 754). ------------------------------------------------------------------------ -- Release notes for Agda 2 version 2.3.2 ------------------------------------------------------------------------ Important changes since 2.3.0: Installation ============ * The Agda-executable package has been removed. The executable is now provided as part of the Agda package. * The Emacs mode no longer depends on haskell-mode or GHCi. * Compilation of Emacs mode Lisp files. You can now compile the Emacs mode Lisp files by running "agda-mode compile". This command is run by "make install". Compilation can, in some cases, give a noticeable speedup. WARNING: If you reinstall the Agda mode without recompiling the Emacs Lisp files, then Emacs may continue using the old, compiled files. Pragmas and options =================== * The --without-K check now reconstructs constructor parameters. New specification of --without-K: If the flag is activated, then Agda only accepts certain case-splits. If the type of the variable to be split is D pars ixs, where D is a data (or record) type, pars stands for the parameters, and ixs the indices, then the following requirements must be satisfied: * The indices ixs must be applications of constructors (or literals) to distinct variables. Constructors are usually not applied to parameters, but for the purposes of this check constructor parameters are treated as other arguments. * These distinct variables must not be free in pars. * Irrelevant arguments are printed as _ by default now. To turn on printing of irrelevant arguments, use option --show-irrelevant * New: Pragma NO_TERMINATION_CHECK to switch off termination checker for individual function definitions and mutual blocks. The pragma must precede a function definition or a mutual block. Examples (see test/succeed/NoTerminationCheck.agda): 1. Skipping a single definition: before type signature. {-# NO_TERMINATION_CHECK #-} a : A a = a 2. Skipping a single definition: before first clause. b : A {-# NO_TERMINATION_CHECK #-} b = b 3. Skipping an old-style mutual block: Before 'mutual' keyword. {-# NO_TERMINATION_CHECK #-} mutual c : A c = d d : A d = c 4. Skipping a new-style mutual block: Anywhere before a type signature or first function clause in the block i : A j : A i = j {-# NO_TERMINATION_CHECK #-} j = i The pragma cannot be used in --safe mode. Language ======== * Let binding record patterns record _×_ (A B : Set) : Set where constructor _,_ field fst : A snd : B open _×_ let (x , (y , z)) = t in u will now be interpreted as let x = fst t y = fst (snd t) z = snd (snd t) in u Note that the type of t needs to be inferable. If you need to provide a type signature, you can write the following: let a : ... a = t (x , (y , z)) = a in u * Pattern synonyms A pattern synonym is a declaration that can be used on the left hand side (when pattern matching) as well as the right hand side (in expressions). For example: pattern z = zero pattern ss x = suc (suc x) f : ℕ -> ℕ f z = z f (suc z) = ss z f (ss n) = n Pattern synonyms are implemented by substitution on the abstract syntax, so definitions are scope-checked but not type-checked. They are particularly useful for universe constructions. * Qualified mixfix operators It is now possible to use a qualified mixfix operator by qualifying the first part of the name. For instance import Data.Nat as Nat import Data.Bool as Bool two = Bool.if true then 1 Nat.+ 1 else 0 * Sections [Issue 735]. Agda now parses anonymous modules as sections: module _ {a} (A : Set a) where data List : Set a where [] : List _∷_ : (x : A) (xs : List) → List module _ {a} {A : Set a} where _++_ : List A → List A → List A [] ++ ys = ys (x ∷ xs) ++ ys = x ∷ (xs ++ ys) test : List Nat test = (5 ∷ []) ++ (3 ∷ []) In general, now the syntax module _ parameters where declarations is accepted and has the same effect as private module M parameters where declarations open M public for a fresh name M. * Instantiating a module in an open import statement [Issue 481]. Now accepted: open import Path.Module args [using/hiding/renaming (...)] This only brings the imported identifiers from Path.Module into scope, not the module itself! Consequently, the following is pointless, and raises an error: import Path.Module args [using/hiding/renaming (...)] You can give a private name M to the instantiated module via import Path.Module args as M [using/hiding/renaming (...)] open import Path.Module args as M [using/hiding/renaming (...)] Try to avoid 'as' as part of the arguments. 'as' is not a keyword; the following can be legal, although slightly obfuscated Agda code: open import as as as as as as * Implicit module parameters can be given by name. E.g. open M {namedArg = bla} This feature has been introduced in Agda 2.3.0 already. * Multiple type signatures sharing a same type can now be written as a single type signature. one two : ℕ one = suc zero two = suc one Goal and error display ====================== * Meta-variables that were introduced by hidden argument `arg' are now printed as _arg_number instead of just _number. [Issue 526] * Agda expands identifiers in anonymous modules when printing. Should make some goals nicer to read. [Issue 721] * When a module identifier is ambiguous, Agda tells you if one of them is a data type module. [Issues 318, 705] Type checking ============= * Improved coverage checker. The coverage checker splits on arguments that have constructor or literal pattern, committing to the left-most split that makes progress. Consider the lookup function for vectors: data Fin : Nat → Set where zero : {n : Nat} → Fin (suc n) suc : {n : Nat} → Fin n → Fin (suc n) data Vec (A : Set) : Nat → Set where [] : Vec A zero _∷_ : {n : Nat} → A → Vec A n → Vec A (suc n) _!!_ : {A : Set}{n : Nat} → Vec A n → Fin n → A (x ∷ xs) !! zero = x (x ∷ xs) !! suc i = xs !! i In Agda up to 2.3.0, this definition is rejected unless we add an absurd clause [] !! () This is because the coverage checker committed on splitting on the vector argument, even though this inevitably lead to failed coverage, because a case for the empty vector [] is missing. The improvement to the coverage checker consists on committing only on splits that have a chance of covering, since all possible constructor patterns are present. Thus, Agda will now split first on the Fin argument, since cases for both zero and suc are present. Then, it can split on the Vec argument, since the empty vector is already ruled out by instantiating n to a suc _. * Instance arguments resolution will now consider candidates which still expect hidden arguments. For example: record Eq (A : Set) : Set where field eq : A → A → Bool open Eq {{...}} eqFin : {n : ℕ} → Eq (Fin n) eqFin = record { eq = primEqFin } testFin : Bool testFin = eq fin1 fin2 The type-checker will now resolve the instance argument of the eq function to eqFin {_}. This is only done for hidden arguments, not instance arguments, so that the instance search stays non-recursive. * Constraint solving: Upgraded Miller patterns to record patterns. [Issue 456] Agda now solves meta-variables that are applied to record patterns. A typical (but here, artificial) case is: record Sigma (A : Set)(B : A -> Set) : Set where constructor _,_ field fst : A snd : B fst test : (A : Set)(B : A -> Set) -> let X : Sigma A B -> Sigma A B X = _ in (x : A)(y : B x) -> X (x , y) ≡ (x , y) test A B x y = refl This yields a constraint of the form _X A B (x , y) := t[x,y] (with t[x,y] = (x, y)) which is not a Miller pattern. However, Agda now solves this as _X A B z := t[fst z,snd z]. * Changed: solving recursive constraints. [Issue 585] Until 2.3.0, Agda sometimes inferred values that did not pass the termination checker later, or would even make Agda loop. To prevent this, the occurs check now also looks into the definitions of the current mutual block, to avoid constructing recursive solutions. As a consequence, also terminating recursive solutions are no longer found automatically. This effects a programming pattern where the recursively computed type of a recursive function is left to Agda to solve. mutual T : D -> Set T pattern1 = _ T pattern2 = _ f : (d : D) -> T d f pattern1 = rhs1 f pattern2 = rhs2 This might no longer work from now on. See examples test/fail/Issue585*.agda * Less eager introduction of implicit parameters. [Issue 679] Until Agda 2.3.0, trailing hidden parameters were introduced eagerly on the left hand side of a definition. For instance, one could not write test : {A : Set} -> Set test = \ {A} -> A because internally, the hidden argument {A : Set} was added to the left-hand side, yielding test {_} = \ {A} -> A which raised a type error. Now, Agda only introduces the trailing implicit parameters it has to, in order to maintain uniform function arity. For instance, in test : Bool -> {A B C : Set} -> Set test true {A} = A test false {B = B} = B Agda will introduce parameters A and B in all clauses, but not C, resulting in test : Bool -> {A B C : Set} -> Set test true {A} {_} = A test false {_} {B = B} = B Note that for checking where-clauses, still all hidden trailing parameters are in scope. For instance: id : {i : Level}{A : Set i} -> A -> A id = myId where myId : forall {A} -> A -> A myId x = x To be able to fill in the meta variable _1 in myId : {A : Set _1} -> A -> A the hidden parameter {i : Level} needs to be in scope. As a result of this more lazy introduction of implicit parameters, the following code now passes. data Unit : Set where unit : Unit T : Unit → Set T unit = {u : Unit} → Unit test : (u : Unit) → T u test unit with unit ... | _ = λ {v} → v Before, Agda would eagerly introduce the hidden parameter {v} as unnamed left-hand side parameter, leaving no way to refer to it. The related issue 655 has also been addressed. It is now possible to make `synonym' definitions name = expression even when the type of expression begins with a hidden quantifier. Simple example: id2 = id That resulted in unsolved metas until 2.3.0. * Agda detects unused arguments and ignores them during equality checking. [Issue 691, solves also issue 44.] Agda's polarity checker now assigns 'Nonvariant' to arguments that are not actually used (except for absurd matches). If f's first argument is Nonvariant, then f x is definitionally equal to f y regardless of x and y. It is similar to irrelevance, but does not require user annotation. For instance, unused module parameters do no longer get in the way: module M (x : Bool) where not : Bool → Bool not true = false not false = true open M true open M false renaming (not to not′) test : (y : Bool) → not y ≡ not′ y test y = refl Matching against record or absurd patterns does not count as `use', so we get some form of proof irrelevance: data ⊥ : Set where record ⊤ : Set where constructor trivial data Bool : Set where true false : Bool True : Bool → Set True true = ⊤ True false = ⊥ fun : (b : Bool) → True b → Bool fun true trivial = true fun false () test : (b : Bool) → (x y : True b) → fun b x ≡ fun b y test b x y = refl More examples in test/succeed/NonvariantPolarity.agda. Phantom arguments: Parameters of record and data types are considered `used' even if they are not actually used. Consider: False : Nat → Set False zero = ⊥ False (suc n) = False n module Invariant where record Bla (n : Nat)(p : False n) : Set where module Nonvariant where Bla : (n : Nat) → False n → Set Bla n p = ⊤ Even though record `Bla' does not use its parameters n and p, they are considered as used, allowing "phantom type" techniques. In contrast, the arguments of function `Bla' are recognized as unused. The following code type-checks if we open Invariant but leaves unsolved metas if we open Nonvariant. drop-suc : {n : Nat}{p : False n} → Bla (suc n) p → Bla n p drop-suc _ = _ bla : (n : Nat) → {p : False n} → Bla n p → ⊥ bla zero {()} b bla (suc n) b = bla n (drop-suc b) If `Bla' is considered invariant, the hidden argument in the recursive call can be inferred to be `p'. If it is considered non-variant, then `Bla n X = Bla n p' does not entail `X = p' and the hidden argument remains unsolved. Since `bla' does not actually use its hidden argument, its value is not important and it could be searched for. Unfortunately, polarity analysis of `bla' happens only after type checking, thus, the information that `bla' is non-variant in `p' is not available yet when meta-variables are solved. (See test/fail/BrokenInferenceDueToNonvariantPolarity.agda) * Agda now expands simple definitions (one clause, terminating) to check whether a function is constructor headed. [Issue 747] For instance, the following now also works: MyPair : Set -> Set -> Set MyPair A B = Pair A B Vec : Set -> Nat -> Set Vec A zero = Unit Vec A (suc n) = MyPair A (Vec A n) Here, Unit and Pair are data or record types. Compiler backends ================= * -Werror is now overridable. To enable compilation of Haskell modules containing warnings, the -Werror flag for the MAlonzo backend has been made overridable. If, for example, --ghc-flag=-Wwarn is passed when compiling, one can get away with things like: data PartialBool : Set where true : PartialBool {-# COMPILED_DATA PartialBool Bool True #-} The default behavior remains as it used to be and rejects the above program. Tools ===== Emacs mode ---------- * Asynchronous Emacs mode. One can now use Emacs while a buffer is type-checked. If the buffer is edited while the type-checker runs, then syntax highlighting will not be updated when type-checking is complete. * Interactive syntax highlighting. The syntax highlighting is updated while a buffer is type-checked: • At first the buffer is highlighted in a somewhat crude way (without go-to-definition information for overloaded constructors). • If the highlighting level is "interactive", then the piece of code that is currently being type-checked is highlighted as such. (The default is "non-interactive".) • When a mutual block has been type-checked it is highlighted properly (this highlighting includes warnings for potential non-termination). The highlighting level can be controlled via the new configuration variable agda2-highlight-level. * Multiple case-splits can now be performed in one go. Consider the following example: _==_ : Bool → Bool → Bool b₁ == b₂ = {!!} If you split on "b₁ b₂", then you get the following code: _==_ : Bool → Bool → Bool true == true = {!!} true == false = {!!} false == true = {!!} false == false = {!!} The order of the variables matters. Consider the following code: lookup : ∀ {a n} {A : Set a} → Vec A n → Fin n → A lookup xs i = {!!} If you split on "xs i", then you get the following code: lookup : ∀ {a n} {A : Set a} → Vec A n → Fin n → A lookup [] () lookup (x ∷ xs) zero = {!!} lookup (x ∷ xs) (suc i) = {!!} However, if you split on "i xs", then you get the following code instead: lookup : ∀ {a n} {A : Set a} → Vec A n → Fin n → A lookup (x ∷ xs) zero = ? lookup (x ∷ xs) (suc i) = ? This code is rejected by Agda 2.3.0, but accepted by 2.3.2 thanks to improved coverage checking (see above). * The Emacs mode now presents information about which module is currently being type-checked. * New global menu entry: Information about the character at point. If this entry is selected, then information about the character at point is displayed, including (in many cases) information about how to type the character. * Commenting/uncommenting the rest of the buffer. One can now comment or uncomment the rest of the buffer by typing C-c C-x M-; or by selecting the menu entry "Comment/uncomment the rest of the buffer". * The Emacs mode now uses the Agda executable instead of GHCi. The *ghci* buffer has been renamed to *agda2*. A new configuration variable has been introduced: agda2-program-name, the name of the Agda executable (by default agda). The variable agda2-ghci-options has been replaced by agda2-program-args: extra arguments given to the Agda executable (by default none). If you want to limit Agda's memory consumption you can add some arguments to agda2-program-args, for instance +RTS -M1.5G -RTS. * The Emacs mode no longer depends on haskell-mode. Users who have customised certain haskell-mode variables (such as haskell-ghci-program-args) may want to update their configuration. LaTeX-backend ------------- An experimental LaTeX-backend which does precise highlighting a la the HTML-backend and code alignment a la lhs2TeX has been added. Here is a sample input literate Agda file: \documentclass{article} \usepackage{agda} \begin{document} The following module declaration will be hidden in the output. \AgdaHide{ \begin{code} module M where \end{code} } Two or more spaces can be used to make the backend align stuff. \begin{code} data ℕ : Set where zero : ℕ suc : ℕ → ℕ _+_ : ℕ → ℕ → ℕ zero + n = n suc m + n = suc (m + n) \end{code} \end{document} To produce an output PDF issue the following commands: agda --latex -i . .lagda pdflatex latex/.tex Only the top-most module is processed, like with lhs2tex and unlike with the HTML-backend. If you want to process imported modules you have to call agda --latex manually on each of those modules. There are still issues related to formatting, see the bug tracker for more information: https://code.google.com/p/agda/issues/detail?id=697 The default agda.sty might therefore change in backwards-incompatible ways, as work proceeds in trying to resolve those problems. Implemented features: * Two or more spaces can be used to force alignment of things, like with lhs2tex. See example above. * The highlighting information produced by the type checker is used to generate the output. For example, the data declaration in the example above, produces: \AgdaKeyword{data} \AgdaDatatype{ℕ} \AgdaSymbol{:} \AgdaPrimitiveType{Set} \AgdaKeyword{where} These latex commands are defined in agda.sty (which is imported by \usepackage{agda}) and cause the highlighting. * The latex-backend checks if agda.sty is found by the latex environment, if it isn't a default agda.sty is copied from Agda's data-dir into the working directory (and thus made available to the latex environment). If the default agda.sty isn't satisfactory (colors, fonts, spacing, etc) then the user can modify it and make put it somewhere where the latex environment can find it. Hopefully most aspects should be modifiable via agda.sty rather than having to tweak the implementation. * --latex-dir can be used to change the default output directory. ------------------------------------------------------------------------ -- Release notes for Agda 2 version 2.3.0 ------------------------------------------------------------------------ Important changes since 2.2.10: Language ======== * New more liberal syntax for mutually recursive definitions. It is no longer necessary to use the 'mutual' keyword to define mutually recursive functions or datatypes. Instead, it is enough to declare things before they are used. Instead of mutual f : A f = a[f, g] g : B[f] g = b[f, g] you can now write f : A g : B[f] f = a[f, g] g = b[f, g]. With the new style you have more freedom in choosing the order in which things are type checked (previously type signatures were always checked before definitions). Furthermore you can mix arbitrary declarations, such as modules and postulates, with mutually recursive definitions. For data types and records the following new syntax is used to separate the declaration from the definition: -- Declaration. data Vec (A : Set) : Nat → Set -- Note the absence of 'where'. -- Definition. data Vec A where [] : Vec A zero _::_ : {n : Nat} → A → Vec A n → Vec A (suc n) -- Declaration. record Sigma (A : Set) (B : A → Set) : Set -- Definition. record Sigma A B where constructor _,_ field fst : A snd : B fst When making separated declarations/definitions private or abstract you should attach the 'private' keyword to the declaration and the 'abstract' keyword to the definition. For instance, a private, abstract function can be defined as private f : A abstract f = e Finally it may be worth noting that the old style of mutually recursive definitions is still supported (it basically desugars into the new style). * Pattern matching lambdas. Anonymous pattern matching functions can be defined using the syntax \ { p11 .. p1n -> e1 ; ... ; pm1 .. pmn -> em } (where, as usual, \ and -> can be replaced by λ and →). Internally this is translated into a function definition of the following form: .extlam p11 .. p1n = e1 ... .extlam pm1 .. pmn = em This means that anonymous pattern matching functions are generative. For instance, refl will not be accepted as an inhabitant of the type (λ { true → true ; false → false }) ≡ (λ { true → true ; false → false }), because this is equivalent to extlam1 ≡ extlam2 for some distinct fresh names extlam1 and extlam2. Currently the 'where' and 'with' constructions are not allowed in (the top-level clauses of) anonymous pattern matching functions. Examples: and : Bool → Bool → Bool and = λ { true x → x ; false _ → false } xor : Bool → Bool → Bool xor = λ { true true → false ; false false → false ; _ _ → true } fst : {A : Set} {B : A → Set} → Σ A B → A fst = λ { (a , b) → a } snd : {A : Set} {B : A → Set} (p : Σ A B) → B (fst p) snd = λ { (a , b) → b } * Record update syntax. Assume that we have a record type and a corresponding value: record MyRecord : Set where field a b c : ℕ old : MyRecord old = record { a = 1; b = 2; c = 3 } Then we can update (some of) the record value's fields in the following way: new : MyRecord new = record old { a = 0; c = 5 } Here new normalises to record { a = 0; b = 2; c = 5 }. Any expression yielding a value of type MyRecord can be used instead of old. Record updating is not allowed to change types: the resulting value must have the same type as the original one, including the record parameters. Thus, the type of a record update can be inferred if the type of the original record can be inferred. The record update syntax is expanded before type checking. When the expression record old { upd-fields } is checked against a record type R, it is expanded to let r = old in record { new-fields }, where old is required to have type R and new-fields is defined as follows: for each field x in R, - if x = e is contained in upd-fields then x = e is included in new-fields, and otherwise - if x is an explicit field then x = R.x r is included in new-fields, and - if x is an implicit or instance field, then it is omitted from new-fields. (Instance arguments are explained below.) The reason for treating implicit and instance fields specially is to allow code like the following: record R : Set where field {length} : ℕ vec : Vec ℕ length -- More fields… xs : R xs = record { vec = 0 ∷ 1 ∷ 2 ∷ [] } ys = record xs { vec = 0 ∷ [] } Without the special treatment the last expression would need to include a new binding for length (for instance "length = _"). * Record patterns which do not contain data type patterns, but which do contain dot patterns, are no longer rejected. * When the --without-K flag is used literals are now treated as constructors. * Under-applied functions can now reduce. Consider the following definition: id : {A : Set} → A → A id x = x Previously the expression id would not reduce. This has been changed so that it now reduces to λ x → x. Usually this makes little difference, but it can be important in conjunction with 'with'. See issue 365 for an example. * Unused AgdaLight legacy syntax (x y : A; z v : B) for telescopes has been removed. Universe polymorphism --------------------- * Universe polymorphism is now enabled by default. Use --no-universe-polymorphism to disable it. * Universe levels are no longer defined as a data type. The basic level combinators can be introduced in the following way: postulate Level : Set zero : Level suc : Level → Level max : Level → Level → Level {-# BUILTIN LEVEL Level #-} {-# BUILTIN LEVELZERO zero #-} {-# BUILTIN LEVELSUC suc #-} {-# BUILTIN LEVELMAX max #-} * The BUILTIN equality is now required to be universe-polymorphic. * trustMe is now universe-polymorphic. Meta-variables and unification ------------------------------ * Unsolved meta-variables are now frozen after every mutual block. This means that they cannot be instantiated by subsequent code. For instance, one : Nat one = _ bla : one ≡ suc zero bla = refl leads to an error now, whereas previously it lead to the instantiation of _ with "suc zero". If you want to make use of the old behaviour, put the two definitions in a mutual block. All meta-variables are unfrozen during interactive editing, so that the user can fill holes interactively. Note that type-checking of interactively given terms is not perfect: Agda sometimes refuses to load a file, even though no complaints were raised during the interactive construction of the file. This is because certain checks (for instance, positivity) are only invoked when a file is loaded. * Record types can now be inferred. If there is a unique known record type with fields matching the fields in a record expression, then the type of the expression will be inferred to be the record type applied to unknown parameters. If there is no known record type with the given fields the type checker will give an error instead of producing lots of unsolved meta-variables. Note that "known record type" refers to any record type in any imported module, not just types which are in scope. * The occurrence checker distinguishes rigid and strongly rigid occurrences [Reed, LFMTP 2009; Abel & Pientka, TLCA 2011]. The completeness checker now accepts the following code: h : (n : Nat) → n ≡ suc n → Nat h n () Internally this generates a constraint _n = suc _n where the meta-variable _n occurs strongly rigidly, i.e. on a constructor path from the root, in its own defining term tree. This is never solvable. Weakly rigid recursive occurrences may have a solution [Jason Reed's PhD thesis, page 106]: test : (k : Nat) → let X : (Nat → Nat) → Nat X = _ in (f : Nat → Nat) → X f ≡ suc (f (X (λ x → k))) test k f = refl The constraint _X k f = suc (f (_X k (λ x → k))) has the solution _X k f = suc (f (suc k)), despite the recursive occurrence of _X. Here _X is not strongly rigid, because it occurs under the bound variable f. Previously Agda rejected this code; now it instead complains about an unsolved meta-variable. * Equation constraints involving the same meta-variable in the head now trigger pruning [Pientka, PhD, Sec. 3.1.2; Abel & Pientka, TLCA 2011]. Example: same : let X : A → A → A → A × A X = _ in {x y z : A} → X x y y ≡ (x , y) × X x x y ≡ X x y y same = refl , refl The second equation implies that X cannot depend on its second argument. After pruning the first equation is linear and can be solved. * Instance arguments. A new type of hidden function arguments has been added: instance arguments. This new feature is based on influences from Scala's implicits and Agda's existing implicit arguments. Plain implicit arguments are marked by single braces: {…}. Instance arguments are instead marked by double braces: {{…}}. Example: postulate A : Set B : A → Set a : A f : {{a : A}} → B a Instead of the double braces you can use the symbols ⦃ and ⦄, but these symbols must in many cases be surrounded by whitespace. (If you are using Emacs and the Agda input method, then you can conjure up the symbols by typing "\{{" and "\}}", respectively.) Instance arguments behave as ordinary implicit arguments, except for one important aspect: resolution of arguments which are not provided explicitly. For instance, consider the following code: test = f Here Agda will notice that f's instance argument was not provided explicitly, and try to infer it. All definitions in scope at f's call site, as well as all variables in the context, are considered. If exactly one of these names has the required type (A), then the instance argument will be instantiated to this name. This feature can be used as an alternative to Haskell type classes. If we define record Eq (A : Set) : Set where field equal : A → A → Bool, then we can define the following projection: equal : {A : Set} {{eq : Eq A}} → A → A → Bool equal {{eq}} = Eq.equal eq Now consider the following expression: equal false false ∨ equal 3 4 If the following Eq "instances" for Bool and ℕ are in scope, and no others, then the expression is accepted: eq-Bool : Eq Bool eq-Bool = record { equal = … } eq-ℕ : Eq ℕ eq-ℕ = record { equal = … } A shorthand notation is provided to avoid the need to define projection functions manually: module Eq-with-implicits = Eq {{...}} This notation creates a variant of Eq's record module, where the main Eq argument is an instance argument instead of an explicit one. It is equivalent to the following definition: module Eq-with-implicits {A : Set} {{eq : Eq A}} = Eq eq Note that the short-hand notation allows you to avoid naming the "-with-implicits" module: open Eq {{...}} Instance argument resolution is not recursive. As an example, consider the following "parametrised instance": eq-List : {A : Set} → Eq A → Eq (List A) eq-List {A} eq = record { equal = eq-List-A } where eq-List-A : List A → List A → Bool eq-List-A [] [] = true eq-List-A (a ∷ as) (b ∷ bs) = equal a b ∧ eq-List-A as bs eq-List-A _ _ = false Assume that the only Eq instances in scope are eq-List and eq-ℕ. Then the following code does not type-check: test = equal (1 ∷ 2 ∷ []) (3 ∷ 4 ∷ []) However, we can make the code work by constructing a suitable instance manually: test′ = equal (1 ∷ 2 ∷ []) (3 ∷ 4 ∷ []) where eq-List-ℕ = eq-List eq-ℕ By restricting the "instance search" to be non-recursive we avoid introducing a new, compile-time-only evaluation model to Agda. For more information about instance arguments, see Devriese & Piessens [ICFP 2011]. Some examples are also available in the examples/instance-arguments subdirectory of the Agda distribution. Irrelevance ----------- * Dependent irrelevant function types. Some examples illustrating the syntax of dependent irrelevant function types: .(x y : A) → B .{x y z : A} → B ∀ x .y → B ∀ x .{y} {z} .v → B The declaration f : .(x : A) → B[x] f x = t[x] requires that x is irrelevant both in t[x] and in B[x]. This is possible if, for instance, B[x] = B′ x, with B′ : .A → Set. Dependent irrelevance allows us to define the eliminator for the Squash type: record Squash (A : Set) : Set where constructor squash field .proof : A elim-Squash : {A : Set} (P : Squash A → Set) (ih : .(a : A) → P (squash a)) → (a⁻ : Squash A) → P a⁻ elim-Squash P ih (squash a) = ih a Note that this would not type-check with (ih : (a : A) -> P (squash a)). * Records with only irrelevant fields. The following now works: record IsEquivalence {A : Set} (_≈_ : A → A → Set) : Set where field .refl : Reflexive _≈_ .sym : Symmetric _≈_ .trans : Transitive _≈_ record Setoid : Set₁ where infix 4 _≈_ field Carrier : Set _≈_ : Carrier → Carrier → Set .isEquivalence : IsEquivalence _≈_ open IsEquivalence isEquivalence public Previously Agda complained about the application IsEquivalence isEquivalence, because isEquivalence is irrelevant and the IsEquivalence module expected a relevant argument. Now, when record modules are generated for records consisting solely of irrelevant arguments, the record parameter is made irrelevant: module IsEquivalence {A : Set} {_≈_ : A → A → Set} .(r : IsEquivalence {A = A} _≈_) where … * Irrelevant things are no longer erased internally. This means that they are printed as ordinary terms, not as "_" as before. * The new flag --experimental-irrelevance enables irrelevant universe levels and matching on irrelevant data when only one constructor is available. These features are very experimental and likely to change or disappear. Reflection ---------- * The reflection API has been extended to mirror features like irrelevance, instance arguments and universe polymorphism, and to give (limited) access to definitions. For completeness all the builtins and primitives are listed below: -- Names. postulate Name : Set {-# BUILTIN QNAME Name #-} primitive -- Equality of names. primQNameEquality : Name → Name → Bool -- Is the argument visible (explicit), hidden (implicit), or an -- instance argument? data Visibility : Set where visible hidden instance : Visibility {-# BUILTIN HIDING Visibility #-} {-# BUILTIN VISIBLE visible #-} {-# BUILTIN HIDDEN hidden #-} {-# BUILTIN INSTANCE instance #-} -- Arguments can be relevant or irrelevant. data Relevance : Set where relevant irrelevant : Relevance {-# BUILTIN RELEVANCE Relevance #-} {-# BUILTIN RELEVANT relevant #-} {-# BUILTIN IRRELEVANT irrelevant #-} -- Arguments. data Arg A : Set where arg : (v : Visibility) (r : Relevance) (x : A) → Arg A {-# BUILTIN ARG Arg #-} {-# BUILTIN ARGARG arg #-} -- Terms. mutual data Term : Set where -- Variable applied to arguments. var : (x : ℕ) (args : List (Arg Term)) → Term -- Constructor applied to arguments. con : (c : Name) (args : List (Arg Term)) → Term -- Identifier applied to arguments. def : (f : Name) (args : List (Arg Term)) → Term -- Different kinds of λ-abstraction. lam : (v : Visibility) (t : Term) → Term -- Pi-type. pi : (t₁ : Arg Type) (t₂ : Type) → Term -- A sort. sort : Sort → Term -- Anything else. unknown : Term data Type : Set where el : (s : Sort) (t : Term) → Type data Sort : Set where -- A Set of a given (possibly neutral) level. set : (t : Term) → Sort -- A Set of a given concrete level. lit : (n : ℕ) → Sort -- Anything else. unknown : Sort {-# BUILTIN AGDASORT Sort #-} {-# BUILTIN AGDATYPE Type #-} {-# BUILTIN AGDATERM Term #-} {-# BUILTIN AGDATERMVAR var #-} {-# BUILTIN AGDATERMCON con #-} {-# BUILTIN AGDATERMDEF def #-} {-# BUILTIN AGDATERMLAM lam #-} {-# BUILTIN AGDATERMPI pi #-} {-# BUILTIN AGDATERMSORT sort #-} {-# BUILTIN AGDATERMUNSUPPORTED unknown #-} {-# BUILTIN AGDATYPEEL el #-} {-# BUILTIN AGDASORTSET set #-} {-# BUILTIN AGDASORTLIT lit #-} {-# BUILTIN AGDASORTUNSUPPORTED unknown #-} postulate -- Function definition. Function : Set -- Data type definition. Data-type : Set -- Record type definition. Record : Set {-# BUILTIN AGDAFUNDEF Function #-} {-# BUILTIN AGDADATADEF Data-type #-} {-# BUILTIN AGDARECORDDEF Record #-} -- Definitions. data Definition : Set where function : Function → Definition data-type : Data-type → Definition record′ : Record → Definition constructor′ : Definition axiom : Definition primitive′ : Definition {-# BUILTIN AGDADEFINITION Definition #-} {-# BUILTIN AGDADEFINITIONFUNDEF function #-} {-# BUILTIN AGDADEFINITIONDATADEF data-type #-} {-# BUILTIN AGDADEFINITIONRECORDDEF record′ #-} {-# BUILTIN AGDADEFINITIONDATACONSTRUCTOR constructor′ #-} {-# BUILTIN AGDADEFINITIONPOSTULATE axiom #-} {-# BUILTIN AGDADEFINITIONPRIMITIVE primitive′ #-} primitive -- The type of the thing with the given name. primQNameType : Name → Type -- The definition of the thing with the given name. primQNameDefinition : Name → Definition -- The constructors of the given data type. primDataConstructors : Data-type → List Name As an example the expression primQNameType (quote zero) is definitionally equal to el (lit 0) (def (quote ℕ) []) (if zero is a constructor of the data type ℕ). * New keyword: unquote. The construction "unquote t" converts a representation of an Agda term to actual Agda code in the following way: 1. The argument t must have type Term (see the reflection API above). 2. The argument is normalised. 3. The entire construction is replaced by the normal form, which is treated as syntax written by the user and type-checked in the usual way. Examples: test : unquote (def (quote ℕ) []) ≡ ℕ test = refl id : (A : Set) → A → A id = unquote (lam visible (lam visible (var 0 []))) id-ok : id ≡ (λ A (x : A) → x) id-ok = refl * New keyword: quoteTerm. The construction "quoteTerm t" is similar to "quote n", but whereas quote is restricted to names n, quoteTerm accepts terms t. The construction is handled in the following way: 1. The type of t is inferred. The term t must be type-correct. 2. The term t is normalised. 3. The construction is replaced by the Term representation (see the reflection API above) of the normal form. Any unsolved metavariables in the term are represented by the "unknown" term constructor. Examples: test₁ : quoteTerm (λ {A : Set} (x : A) → x) ≡ lam hidden (lam visible (var 0 [])) test₁ = refl -- Local variables are represented as de Bruijn indices. test₂ : (λ {A : Set} (x : A) → quoteTerm x) ≡ (λ x → var 0 []) test₂ = refl -- Terms are normalised before being quoted. test₃ : quoteTerm (0 + 0) ≡ con (quote zero) [] test₃ = refl Compiler backends ================= MAlonzo ------- * The MAlonzo backend's FFI now handles universe polymorphism in a better way. The translation of Agda types and kinds into Haskell now supports universe-polymorphic postulates. The core changes are that the translation of function types has been changed from T[[ Pi (x : A) B ]] = if A has a Haskell kind then forall x. () -> T[[ B ]] else if x in fv B then undef else T[[ A ]] -> T[[ B ]] into T[[ Pi (x : A) B ]] = if x in fv B then forall x. T[[ A ]] -> T[[ B ]] -- Note: T[[A]] not Unit. else T[[ A ]] -> T[[ B ]], and that the translation of constants (postulates, constructors and literals) has been changed from T[[ k As ]] = if COMPILED_TYPE k T then T T[[ As ]] else undef into T[[ k As ]] = if COMPILED_TYPE k T then T T[[ As ]] else if COMPILED k E then () else undef. For instance, assuming a Haskell definition type AgdaIO a b = IO b, we can set up universe-polymorphic IO in the following way: postulate IO : ∀ {ℓ} → Set ℓ → Set ℓ return : ∀ {a} {A : Set a} → A → IO A _>>=_ : ∀ {a b} {A : Set a} {B : Set b} → IO A → (A → IO B) → IO B {-# COMPILED_TYPE IO AgdaIO #-} {-# COMPILED return (\_ _ -> return) #-} {-# COMPILED _>>=_ (\_ _ _ _ -> (>>=)) #-} This is accepted because (assuming that the universe level type is translated to the Haskell unit type "()") (\_ _ -> return) : forall a. () -> forall b. () -> b -> AgdaIO a b = T [[ ∀ {a} {A : Set a} → A → IO A ]] and (\_ _ _ _ -> (>>=)) : forall a. () -> forall b. () -> forall c. () -> forall d. () -> AgdaIO a c -> (c -> AgdaIO b d) -> AgdaIO b d = T [[ ∀ {a b} {A : Set a} {B : Set b} → IO A → (A → IO B) → IO B ]]. Epic ---- * New Epic backend pragma: STATIC. In the Epic backend, functions marked with the STATIC pragma will be normalised before compilation. Example usage: {-# STATIC power #-} power : ℕ → ℕ → ℕ power 0 x = 1 power 1 x = x power (suc n) x = power n x * x Occurrences of "power 4 x" will be replaced by "((x * x) * x) * x". * Some new optimisations have been implemented in the Epic backend: - Removal of unused arguments. A worker/wrapper transformation is performed so that unused arguments can be removed by Epic's inliner. For instance, the map function is transformed in the following way: map_wrap : (A B : Set) → (A → B) → List A → List B map_wrap A B f xs = map_work f xs map_work f [] = [] map_work f (x ∷ xs) = f x ∷ map_work f xs If map_wrap is inlined (which it will be in any saturated call), then A and B disappear in the generated code. Unused arguments are found using abstract interpretation. The bodies of all functions in a module are inspected to decide which variables are used. The behaviour of postulates is approximated based on their types. Consider return, for instance: postulate return : {A : Set} → A → IO A The first argument of return can be removed, because it is of type Set and thus cannot affect the outcome of a program at runtime. - Injection detection. At runtime many functions may turn out to be inefficient variants of the identity function. This is especially true after forcing. Injection detection replaces some of these functions with more efficient versions. Example: inject : {n : ℕ} → Fin n → Fin (1 + n) inject {suc n} zero = zero inject {suc n} (suc i) = suc (inject {n} i) Forcing removes the Fin constructors' ℕ arguments, so this function is an inefficient identity function that can be replaced by the following one: inject {_} x = x To actually find this function, we make the induction hypothesis that inject is an identity function in its second argument and look at the branches of the function to decide if this holds. Injection detection also works over data type barriers. Example: forget : {A : Set} {n : ℕ} → Vec A n → List A forget [] = [] forget (x ∷ xs) = x ∷ forget xs Given that the constructor tags (in the compiled Epic code) for Vec.[] and List.[] are the same, and that the tags for Vec._∷_ and List._∷_ are also the same, this is also an identity function. We can hence replace the definition with the following one: forget {_} xs = xs To get this to apply as often as possible, constructor tags are chosen /after/ injection detection has been run, in a way to make as many functions as possible injections. Constructor tags are chosen once per source file, so it may be advantageous to define conversion functions like forget in the same module as one of the data types. For instance, if Vec.agda imports List.agda, then the forget function should be put in Vec.agda to ensure that vectors and lists get the same tags (unless some other injection function, which puts different constraints on the tags, is prioritised). - Smashing. This optimisation finds types whose values are inferable at runtime: * A data type with only one constructor where all fields are inferable is itself inferable. * Set ℓ is inferable (as it has no runtime representation). A function returning an inferable data type can be smashed, which means that it is replaced by a function which simply returns the inferred value. An important example of an inferable type is the usual propositional equality type (_≡_). Any function returning a propositional equality can simply return the reflexivity constructor directly without computing anything. This optimisation makes more arguments unused. It also makes the Epic code size smaller, which in turn speeds up compilation. JavaScript ---------- * ECMAScript compiler backend. A new compiler backend is being implemented, targetting ECMAScript (also known as JavaScript), with the goal of allowing Agda programs to be run in browsers or other ECMAScript environments. The backend is still at an experimental stage: the core language is implemented, but many features are still missing. The ECMAScript compiler can be invoked from the command line using the flag --js: agda --js --compile-dir= .agda Each source .agda is compiled into an ECMAScript target /jAgda..js. The compiler can also be invoked using the Emacs mode (the variable agda2-backend controls which backend is used). Note that ECMAScript is a strict rather than lazy language. Since Agda programs are total, this should not impact program semantics, but it may impact their space or time usage. ECMAScript does not support algebraic datatypes or pattern-matching. These features are translated to a use of the visitor pattern. For instance, the standard library's List data type and null function are translated into the following code: exports["List"] = {}; exports["List"]["[]"] = function (x0) { return x0["[]"](); }; exports["List"]["_∷_"] = function (x0) { return function (x1) { return function (x2) { return x2["_∷_"](x0, x1); }; }; }; exports["null"] = function (x0) { return function (x1) { return function (x2) { return x2({ "[]": function () { return jAgda_Data_Bool["Bool"]["true"]; }, "_∷_": function (x3, x4) { return jAgda_Data_Bool["Bool"]["false"]; } }); }; }; }; Agda records are translated to ECMAScript objects, preserving field names. Top-level Agda modules are translated to ECMAScript modules, following the common.js module specification. A top-level Agda module "Foo.Bar" is translated to an ECMAScript module "jAgda.Foo.Bar". The ECMAScript compiler does not compile to Haskell, so the pragmas related to the Haskell FFI (IMPORT, COMPILED_DATA and COMPILED) are not used by the ECMAScript backend. Instead, there is a COMPILED_JS pragma which may be applied to any declaration. For postulates, primitives, functions and values, it gives the ECMAScript code to be emitted by the compiler. For data types, it gives a function which is applied to a value of that type, and a visitor object. For instance, a binding of natural numbers to ECMAScript integers (ignoring overflow errors) is: data ℕ : Set where zero : ℕ suc : ℕ → ℕ {-# COMPILED_JS ℕ function (x,v) { if (x < 1) { return v.zero(); } else { return v.suc(x-1); } } #-} {-# COMPILED_JS zero 0 #-} {-# COMPILED_JS suc function (x) { return x+1; } #-} _+_ : ℕ → ℕ → ℕ zero + n = n suc m + n = suc (m + n) {-# COMPILED_JS _+_ function (x) { return function (y) { return x+y; }; } #-} To allow FFI code to be optimised, the ECMAScript in a COMPILED_JS declaration is parsed, using a simple parser that recognises a pure functional subset of ECMAScript, consisting of functions, function applications, return, if-statements, if-expressions, side-effect-free binary operators (no precedence, left associative), side-effect-free prefix operators, objects (where all member names are quoted), field accesses, and string and integer literals. Modules may be imported using the require("") syntax: any impure code, or code outside the supported fragment, can be placed in a module and imported. Tools ===== * New flag --safe, which can be used to type-check untrusted code. This flag disables postulates, primTrustMe, and "unsafe" OPTION pragmas, some of which are known to make Agda inconsistent. Rejected pragmas: --allow-unsolved-metas --experimental-irrelevance --guardedness-preserving-type-construtors --injective-type-constructors --no-coverage-check --no-positivity-check --no-termination-check --sized-types --type-in-type Note that, at the moment, it is not possible to define the universe level or coinduction primitives when --safe is used (because they must be introduced as postulates). This can be worked around by type-checking trusted files in a first pass, without using --safe, and then using --safe in a second pass. Modules which have already been type-checked are not re-type-checked just because --safe is used. * Dependency graphs. The new flag --dependency-graph=FILE can be used to generate a DOT file containing a module dependency graph. The generated file (FILE) can be rendered using a tool like dot. * The --no-unreachable-check flag has been removed. * Projection functions are highlighted as functions instead of as fields. Field names (in record definitions and record values) are still highlighted as fields. * Support for jumping to positions mentioned in the information buffer has been added. * The "make install" command no longer installs Agda globally (by default). ------------------------------------------------------------------------ -- Release notes for Agda 2 version 2.2.10 ------------------------------------------------------------------------ Important changes since 2.2.8: Language -------- * New flag: --without-K. This flag makes pattern matching more restricted. If the flag is activated, then Agda only accepts certain case-splits. If the type of the variable to be split is D pars ixs, where D is a data (or record) type, pars stands for the parameters, and ixs the indices, then the following requirements must be satisfied: * The indices ixs must be applications of constructors to distinct variables. * These variables must not be free in pars. The intended purpose of --without-K is to enable experiments with a propositional equality without the K rule. Let us define propositional equality as follows: data _≡_ {A : Set} : A → A → Set where refl : ∀ x → x ≡ x Then the obvious implementation of the J rule is accepted: J : {A : Set} (P : {x y : A} → x ≡ y → Set) → (∀ x → P (refl x)) → ∀ {x y} (x≡y : x ≡ y) → P x≡y J P p (refl x) = p x The same applies to Christine Paulin-Mohring's version of the J rule: J′ : {A : Set} {x : A} (P : {y : A} → x ≡ y → Set) → P (refl x) → ∀ {y} (x≡y : x ≡ y) → P x≡y J′ P p (refl x) = p On the other hand, the obvious implementation of the K rule is not accepted: K : {A : Set} (P : {x : A} → x ≡ x → Set) → (∀ x → P (refl x)) → ∀ {x} (x≡x : x ≡ x) → P x≡x K P p (refl x) = p x However, we have /not/ proved that activation of --without-K ensures that the K rule cannot be proved in some other way. * Irrelevant declarations. Postulates and functions can be marked as irrelevant by prefixing the name with a dot when the name is declared. Example: postulate .irrelevant : {A : Set} → .A → A Irrelevant names may only be used in irrelevant positions or in definitions of things which have been declared irrelevant. The axiom irrelevant above can be used to define a projection from an irrelevant record field: data Subset (A : Set) (P : A → Set) : Set where _#_ : (a : A) → .(P a) → Subset A P elem : ∀ {A P} → Subset A P → A elem (a # p) = a .certificate : ∀ {A P} (x : Subset A P) → P (elem x) certificate (a # p) = irrelevant p The right-hand side of certificate is relevant, so we cannot define certificate (a # p) = p (because p is irrelevant). However, certificate is declared to be irrelevant, so it can use the axiom irrelevant. Furthermore the first argument of the axiom is irrelevant, which means that irrelevant p is well-formed. As shown above the axiom irrelevant justifies irrelevant projections. Previously no projections were generated for irrelevant record fields, such as the field certificate in the following record type: record Subset (A : Set) (P : A → Set) : Set where constructor _#_ field elem : A .certificate : P elem Now projections are generated automatically for irrelevant fields (unless the flag --no-irrelevant-projections is used). Note that irrelevant projections are highly experimental. * Termination checker recognises projections. Projections now preserve sizes, both in patterns and expressions. Example: record Wrap (A : Set) : Set where constructor wrap field unwrap : A open Wrap public data WNat : Set where zero : WNat suc : Wrap WNat → WNat id : WNat → WNat id zero = zero id (suc w) = suc (wrap (id (unwrap w))) In the structural ordering unwrap w ≤ w. This means that unwrap w ≤ w < suc w, and hence the recursive call to id is accepted. Projections also preserve guardedness. Tools ----- * Hyperlinks for top-level module names now point to the start of the module rather than to the declaration of the module name. This applies both to the Emacs mode and to the output of agda --html. * Most occurrences of record field names are now highlighted as "fields". Previously many occurrences were highlighted as "functions". * Emacs mode: It is no longer possible to change the behaviour of the TAB key by customising agda2-indentation. * Epic compiler backend. A new compiler backend is being implemented. This backend makes use of Edwin Brady's language Epic (http://www.cs.st-andrews.ac.uk/~eb/epic.php) and its compiler. The backend should handle most Agda code, but is still at an experimental stage: more testing is needed, and some things written below may not be entirely true. The Epic compiler can be invoked from the command line using the flag --epic: agda --epic --epic-flag= --compile-dir= .agda The --epic-flag flag can be given multiple times; each flag is given verbatim to the Epic compiler (in the given order). The resulting executable is named after the main module and placed in the directory specified by the --compile-dir flag (default: the project root). Intermediate files are placed in a subdirectory called Epic. The backend requires that there is a definition named main. This definition should be a value of type IO Unit, but at the moment this is not checked (so it is easy to produce a program which segfaults). Currently the backend represents actions of type IO A as functions from Unit to A, and main is applied to the unit value. The Epic compiler compiles via C, not Haskell, so the pragmas related to the Haskell FFI (IMPORT, COMPILED_DATA and COMPILED) are not used by the Epic backend. Instead there is a new pragma COMPILED_EPIC. This pragma is used to give Epic code for postulated definitions (Epic code can in turn call C code). The form of the pragma is {-# COMPILED_EPIC def code #-}, where def is the name of an Agda postulate and code is some Epic code which should include the function arguments, return type and function body. As an example the IO monad can be defined as follows: postulate IO : Set → Set return : ∀ {A} → A → IO A _>>=_ : ∀ {A B} → IO A → (A → IO B) → IO B {-# COMPILED_EPIC return (u : Unit, a : Any) -> Any = ioreturn(a) #-} {-# COMPILED_EPIC _>>=_ (u1 : Unit, u2 : Unit, x : Any, f : Any) -> Any = iobind(x,f) #-} Here ioreturn and iobind are Epic functions which are defined in the file AgdaPrelude.e which is always included. By default the backend will remove so-called forced constructor arguments (and case-splitting on forced variables will be rewritten). This optimisation can be disabled by using the flag --no-forcing. All data types which look like unary natural numbers after forced constructor arguments have been removed (i.e. types with two constructors, one nullary and one with a single recursive argument) will be represented as "BigInts". This applies to the standard Fin type, for instance. The backend supports Agda's primitive functions and the BUILTIN pragmas. If the BUILTIN pragmas for unary natural numbers are used, then some operations, like addition and multiplication, will use more efficient "BigInt" operations. If you want to make use of the Epic backend you need to install some dependencies, see the README. * The Emacs mode can compile using either the MAlonzo or the Epic backend. The variable agda2-backend controls which backend is used. ------------------------------------------------------------------------ -- Release notes for Agda 2 version 2.2.8 ------------------------------------------------------------------------ Important changes since 2.2.6: Language -------- * Record pattern matching. It is now possible to pattern match on named record constructors. Example: record Σ (A : Set) (B : A → Set) : Set where constructor _,_ field proj₁ : A proj₂ : B proj₁ map : {A B : Set} {P : A → Set} {Q : B → Set} (f : A → B) → (∀ {x} → P x → Q (f x)) → Σ A P → Σ B Q map f g (x , y) = (f x , g y) The clause above is internally translated into the following one: map f g p = (f (Σ.proj₁ p) , g (Σ.proj₂ p)) Record patterns containing data type patterns are not translated. Example: add : ℕ × ℕ → ℕ add (zero , n) = n add (suc m , n) = suc (add (m , n)) Record patterns which do not contain data type patterns, but which do contain dot patterns, are currently rejected. Example: Foo : {A : Set} (p₁ p₂ : A × A) → proj₁ p₁ ≡ proj₁ p₂ → Set₁ Foo (x , y) (.x , y′) refl = Set * Proof irrelevant function types. Agda now supports irrelevant non-dependent function types: f : .A → B This type implies that f does not depend computationally on its argument. One intended use case is data structures with embedded proofs, like sorted lists: postulate _≤_ : ℕ → ℕ → Set p₁ : 0 ≤ 1 p₂ : 0 ≤ 1 data SList (bound : ℕ) : Set where [] : SList bound scons : (head : ℕ) → .(head ≤ bound) → (tail : SList head) → SList bound The effect of the irrelevant type in the signature of scons is that scons's second argument is never inspected after Agda has ensured that it has the right type. It is even thrown away, leading to smaller term sizes and hopefully some gain in efficiency. The type-checker ignores irrelevant arguments when checking equality, so two lists can be equal even if they contain different proofs: l₁ : SList 1 l₁ = scons 0 p₁ [] l₂ : SList 1 l₂ = scons 0 p₂ [] l₁≡l₂ : l₁ ≡ l₂ l₁≡l₂ = refl Irrelevant arguments can only be used in irrelevant contexts. Consider the following subset type: data Subset (A : Set) (P : A → Set) : Set where _#_ : (elem : A) → .(P elem) → Subset A P The following two uses are fine: elimSubset : ∀ {A C : Set} {P} → Subset A P → ((a : A) → .(P a) → C) → C elimSubset (a # p) k = k a p elem : {A : Set} {P : A → Set} → Subset A P → A elem (x # p) = x However, if we try to project out the proof component, then Agda complains that "variable p is declared irrelevant, so it cannot be used here": prjProof : ∀ {A P} (x : Subset A P) → P (elem x) prjProof (a # p) = p Matching against irrelevant arguments is also forbidden, except in the case of irrefutable matches (record constructor patterns which have been translated away). For instance, the match against the pattern (p , q) here is accepted: elim₂ : ∀ {A C : Set} {P Q : A → Set} → Subset A (λ x → Σ (P x) (λ _ → Q x)) → ((a : A) → .(P a) → .(Q a) → C) → C elim₂ (a # (p , q)) k = k a p q Absurd matches () are also allowed. Note that record fields can also be irrelevant. Example: record Subset (A : Set) (P : A → Set) : Set where constructor _#_ field elem : A .proof : P elem Irrelevant fields are never in scope, neither inside nor outside the record. This means that no record field can depend on an irrelevant field, and furthermore projections are not defined for such fields. Irrelevant fields can only be accessed using pattern matching, as in elimSubset above. Irrelevant function types were added very recently, and have not been subjected to much experimentation yet, so do not be surprised if something is changed before the next release. For instance, dependent irrelevant function spaces (.(x : A) → B) might be added in the future. * Mixfix binders. It is now possible to declare user-defined syntax that binds identifiers. Example: postulate State : Set → Set → Set put : ∀ {S} → S → State S ⊤ get : ∀ {S} → State S S return : ∀ {A S} → A → State S A bind : ∀ {A B S} → State S B → (B → State S A) → State S A syntax bind e₁ (λ x → e₂) = x ← e₁ , e₂ increment : State ℕ ⊤ increment = x ← get , put (1 + x) The syntax declaration for bind implies that x is in scope in e₂, but not in e₁. You can give fixity declarations along with syntax declarations: infixr 40 bind syntax bind e₁ (λ x → e₂) = x ← e₁ , e₂ The fixity applies to the syntax, not the name; syntax declarations are also restricted to ordinary, non-operator names. The following declaration is disallowed: syntax _==_ x y = x === y Syntax declarations must also be linear; the following declaration is disallowed: syntax wrong x = x + x Syntax declarations were added very recently, and have not been subjected to much experimentation yet, so do not be surprised if something is changed before the next release. * Prop has been removed from the language. The experimental sort Prop has been disabled. Any program using Prop should typecheck if Prop is replaced by Set₀. Note that Prop is still a keyword. * Injective type constructors off by default. Automatic injectivity of type constructors has been disabled (by default). To enable it, use the flag --injective-type-constructors, either on the command line or in an OPTIONS pragma. Note that this flag makes Agda anti-classical and possibly inconsistent: Agda with excluded middle is inconsistent http://thread.gmane.org/gmane.comp.lang.agda/1367 See test/succeed/InjectiveTypeConstructors.agda for an example. * Termination checker can count. There is a new flag --termination-depth=N accepting values N >= 1 (with N = 1 being the default) which influences the behavior of the termination checker. So far, the termination checker has only distinguished three cases when comparing the argument of a recursive call with the formal parameter of the callee. < : the argument is structurally smaller than the parameter = : they are equal ? : the argument is bigger or unrelated to the parameter This behavior, which is still the default (N = 1), will not recognise the following functions as terminating. mutual f : ℕ → ℕ f zero = zero f (suc zero) = zero f (suc (suc n)) = aux n aux : ℕ → ℕ aux m = f (suc m) The call graph f --(<)--> aux --(?)--> f yields a recursive call from f to f via aux where the relation of call argument to callee parameter is computed as "unrelated" (composition of < and ?). Setting N >= 2 allows a finer analysis: n has two constructors less than suc (suc n), and suc m has one more than m, so we get the call graph: f --(-2)--> aux --(+1)--> f The indirect call f --> f is now labeled with (-1), and the termination checker can recognise that the call argument is decreasing on this path. Setting the termination depth to N means that the termination checker counts decrease up to N and increase up to N-1. The default, N=1, means that no increase is counted, every increase turns to "unrelated". In practice, examples like the one above sometimes arise when "with" is used. As an example, the program f : ℕ → ℕ f zero = zero f (suc zero) = zero f (suc (suc n)) with zero ... | _ = f (suc n) is internally represented as mutual f : ℕ → ℕ f zero = zero f (suc zero) = zero f (suc (suc n)) = aux n zero aux : ℕ → ℕ → ℕ aux m k = f (suc m) Thus, by default, the definition of f using "with" is not accepted by the termination checker, even though it looks structural (suc n is a subterm of suc suc n). Now, the termination checker is satisfied if the option "--termination-depth=2" is used. Caveats: - This is an experimental feature, hopefully being replaced by something smarter in the near future. - Increasing the termination depth will quickly lead to very long termination checking times. So, use with care. Setting termination depth to 100 by habit, just to be on the safe side, is not a good idea! - Increasing termination depth only makes sense for linear data types such as ℕ and Size. For other types, increase cannot be recognised. For instance, consider a similar example with lists. data List : Set where nil : List cons : ℕ → List → List mutual f : List → List f nil = nil f (cons x nil) = nil f (cons x (cons y ys)) = aux y ys aux : ℕ → List → List aux z zs = f (cons z zs) Here the termination checker compares cons z zs to z and also to zs. In both cases, the result will be "unrelated", no matter how high we set the termination depth. This is because when comparing cons z zs to zs, for instance, z is unrelated to zs, thus, cons z zs is also unrelated to zs. We cannot say it is just "one larger" since z could be a very large term. Note that this points to a weakness of untyped termination checking. To regain the benefit of increased termination depth, we need to index our lists by a linear type such as ℕ or Size. With termination depth 2, the above example is accepted for vectors instead of lists. * The codata keyword has been removed. To use coinduction, use the following new builtins: INFINITY, SHARP and FLAT. Example: {-# OPTIONS --universe-polymorphism #-} module Coinduction where open import Level infix 1000 ♯_ postulate ∞ : ∀ {a} (A : Set a) → Set a ♯_ : ∀ {a} {A : Set a} → A → ∞ A ♭ : ∀ {a} {A : Set a} → ∞ A → A {-# BUILTIN INFINITY ∞ #-} {-# BUILTIN SHARP ♯_ #-} {-# BUILTIN FLAT ♭ #-} Note that (non-dependent) pattern matching on SHARP is no longer allowed. Note also that strange things might happen if you try to combine the pragmas above with COMPILED_TYPE, COMPILED_DATA or COMPILED pragmas, or if the pragmas do not occur right after the postulates. The compiler compiles the INFINITY builtin to nothing (more or less), so that the use of coinduction does not get in the way of FFI declarations: data Colist (A : Set) : Set where [] : Colist A _∷_ : (x : A) (xs : ∞ (Colist A)) → Colist A {-# COMPILED_DATA Colist [] [] (:) #-} * Infinite types. If the new flag --guardedness-preserving-type-constructors is used, then type constructors are treated as inductive constructors when we check productivity (but only in parameters, and only if they are used strictly positively or not at all). This makes examples such as the following possible: data Rec (A : ∞ Set) : Set where fold : ♭ A → Rec A -- Σ cannot be a record type below. data Σ (A : Set) (B : A → Set) : Set where _,_ : (x : A) → B x → Σ A B syntax Σ A (λ x → B) = Σ[ x ∶ A ] B -- Corecursive definition of the W-type. W : (A : Set) → (A → Set) → Set W A B = Rec (♯ (Σ[ x ∶ A ] (B x → W A B))) syntax W A (λ x → B) = W[ x ∶ A ] B sup : {A : Set} {B : A → Set} (x : A) (f : B x → W A B) → W A B sup x f = fold (x , f) W-rec : {A : Set} {B : A → Set} (P : W A B → Set) → (∀ {x} {f : B x → W A B} → (∀ y → P (f y)) → P (sup x f)) → ∀ x → P x W-rec P h (fold (x , f)) = h (λ y → W-rec P h (f y)) -- Induction-recursion encoded as corecursion-recursion. data Label : Set where ′0 ′1 ′2 ′σ ′π ′w : Label mutual U : Set U = Σ Label U′ U′ : Label → Set U′ ′0 = ⊤ U′ ′1 = ⊤ U′ ′2 = ⊤ U′ ′σ = Rec (♯ (Σ[ a ∶ U ] (El a → U))) U′ ′π = Rec (♯ (Σ[ a ∶ U ] (El a → U))) U′ ′w = Rec (♯ (Σ[ a ∶ U ] (El a → U))) El : U → Set El (′0 , _) = ⊥ El (′1 , _) = ⊤ El (′2 , _) = Bool El (′σ , fold (a , b)) = Σ[ x ∶ El a ] El (b x) El (′π , fold (a , b)) = (x : El a) → El (b x) El (′w , fold (a , b)) = W[ x ∶ El a ] El (b x) U-rec : (P : ∀ u → El u → Set) → P (′1 , _) tt → P (′2 , _) true → P (′2 , _) false → (∀ {a b x y} → P a x → P (b x) y → P (′σ , fold (a , b)) (x , y)) → (∀ {a b f} → (∀ x → P (b x) (f x)) → P (′π , fold (a , b)) f) → (∀ {a b x f} → (∀ y → P (′w , fold (a , b)) (f y)) → P (′w , fold (a , b)) (sup x f)) → ∀ u (x : El u) → P u x U-rec P P1 P2t P2f Pσ Pπ Pw = rec where rec : ∀ u (x : El u) → P u x rec (′0 , _) () rec (′1 , _) _ = P1 rec (′2 , _) true = P2t rec (′2 , _) false = P2f rec (′σ , fold (a , b)) (x , y) = Pσ (rec _ x) (rec _ y) rec (′π , fold (a , b)) f = Pπ (λ x → rec _ (f x)) rec (′w , fold (a , b)) (fold (x , f)) = Pw (λ y → rec _ (f y)) The --guardedness-preserving-type-constructors extension is based on a rather operational understanding of ∞/♯_; it's not yet clear if this extension is consistent. * Qualified constructors. Constructors can now be referred to qualified by their data type. For instance, given data Nat : Set where zero : Nat suc : Nat → Nat data Fin : Nat → Set where zero : ∀ {n} → Fin (suc n) suc : ∀ {n} → Fin n → Fin (suc n) you can refer to the constructors unambiguously as Nat.zero, Nat.suc, Fin.zero, and Fin.suc (Nat and Fin are modules containing the respective constructors). Example: inj : (n m : Nat) → Nat.suc n ≡ suc m → n ≡ m inj .m m refl = refl Previously you had to write something like inj : (n m : Nat) → _≡_ {Nat} (suc n) (suc m) → n ≡ m to make the type checker able to figure out that you wanted the natural number suc in this case. * Reflection. There are two new constructs for reflection: - quoteGoal x in e In e the value of x will be a representation of the goal type (the type expected of the whole expression) as an element in a datatype of Agda terms (see below). For instance, example : ℕ example = quoteGoal x in {! at this point x = def (quote ℕ) [] !} - quote x : Name If x is the name of a definition (function, datatype, record, or a constructor), quote x gives you the representation of x as a value in the primitive type Name (see below). Quoted terms use the following BUILTINs and primitives (available from the standard library module Reflection): -- The type of Agda names. postulate Name : Set {-# BUILTIN QNAME Name #-} primitive primQNameEquality : Name → Name → Bool -- Arguments. Explicit? = Bool data Arg A : Set where arg : Explicit? → A → Arg A {-# BUILTIN ARG Arg #-} {-# BUILTIN ARGARG arg #-} -- The type of Agda terms. data Term : Set where var : ℕ → List (Arg Term) → Term con : Name → List (Arg Term) → Term def : Name → List (Arg Term) → Term lam : Explicit? → Term → Term pi : Arg Term → Term → Term sort : Term unknown : Term {-# BUILTIN AGDATERM Term #-} {-# BUILTIN AGDATERMVAR var #-} {-# BUILTIN AGDATERMCON con #-} {-# BUILTIN AGDATERMDEF def #-} {-# BUILTIN AGDATERMLAM lam #-} {-# BUILTIN AGDATERMPI pi #-} {-# BUILTIN AGDATERMSORT sort #-} {-# BUILTIN AGDATERMUNSUPPORTED unknown #-} Reflection may be useful when working with internal decision procedures, such as the standard library's ring solver. * Minor record definition improvement. The definition of a record type is now available when type checking record module definitions. This means that you can define things like the following: record Cat : Set₁ where field Obj : Set _=>_ : Obj → Obj → Set -- ... -- not possible before: op : Cat op = record { Obj = Obj; _=>_ = λ A B → B => A } Tools ----- * The "Goal type and context" command now shows the goal type before the context, and the context is shown in reverse order. The "Goal type, context and inferred type" command has been modified in a similar way. * Show module contents command. Given a module name M the Emacs mode can now display all the top-level modules and names inside M, along with types for the names. The command is activated using C-c C-o or the menus. * Auto command. A command which searches for type inhabitants has been added. The command is invoked by pressing C-C C-a (or using the goal menu). There are several flags and parameters, e.g. '-c' which enables case-splitting in the search. For further information, see the Agda wiki: http://wiki.portal.chalmers.se/agda/pmwiki.php?n=Main.Auto * HTML generation is now possible for a module with unsolved meta-variables, provided that the --allow-unsolved-metas flag is used. ------------------------------------------------------------------------ -- Release notes for Agda 2 version 2.2.6 ------------------------------------------------------------------------ Important changes since 2.2.4: Language -------- * Universe polymorphism (experimental extension). To enable universe polymorphism give the flag --universe-polymorphism on the command line or (recommended) as an OPTIONS pragma. When universe polymorphism is enabled Set takes an argument which is the universe level. For instance, the type of universe polymorphic identity is id : {a : Level} {A : Set a} → A → A. The type Level is isomorphic to the unary natural numbers and should be specified using the BUILTINs LEVEL, LEVELZERO, and LEVELSUC: data Level : Set where zero : Level suc : Level → Level {-# BUILTIN LEVEL Level #-} {-# BUILTIN LEVELZERO zero #-} {-# BUILTIN LEVELSUC suc #-} There is an additional BUILTIN LEVELMAX for taking the maximum of two levels: max : Level → Level → Level max zero m = m max (suc n) zero = suc n max (suc n) (suc m) = suc (max n m) {-# BUILTIN LEVELMAX max #-} The non-polymorphic universe levels Set, Set₁ and so on are sugar for Set zero, Set (suc zero), etc. At present there is no automatic lifting of types from one level to another. It can still be done (rather clumsily) by defining types like the following one: data Lifted {a} (A : Set a) : Set (suc a) where lift : A → Lifted A However, it is likely that automatic lifting is introduced at some point in the future. * Multiple constructors, record fields, postulates or primitives can be declared using a single type signature: data Bool : Set where false true : Bool postulate A B : Set * Record fields can be implicit: record R : Set₁ where field {A} : Set f : A → A {B C} D {E} : Set g : B → C → E By default implicit fields are not printed. * Record constructors can be defined: record Σ (A : Set) (B : A → Set) : Set where constructor _,_ field proj₁ : A proj₂ : B proj₁ In this example _,_ gets the type (proj₁ : A) → B proj₁ → Σ A B. For implicit fields the corresponding constructor arguments become implicit. Note that the constructor is defined in the /outer/ scope, so any fixity declaration has to be given outside the record definition. The constructor is not in scope inside the record module. Note also that pattern matching for records has not been implemented yet. * BUILTIN hooks for equality. The data type data _≡_ {A : Set} (x : A) : A → Set where refl : x ≡ x can be specified as the builtin equality type using the following pragmas: {-# BUILTIN EQUALITY _≡_ #-} {-# BUILTIN REFL refl #-} The builtin equality is used for the new rewrite construct and the primTrustMe primitive described below. * New rewrite construct. If eqn : a ≡ b, where _≡_ is the builtin equality (see above) you can now write f ps rewrite eqn = rhs instead of f ps with a | eqn ... | ._ | refl = rhs The rewrite construct has the effect of rewriting the goal and the context by the given equation (left to right). You can rewrite using several equations (in sequence) by separating them with vertical bars (|): f ps rewrite eqn₁ | eqn₂ | … = rhs It is also possible to add with clauses after rewriting: f ps rewrite eqns with e ... | p = rhs Note that pattern matching happens before rewriting—if you want to rewrite and then do pattern matching you can use a with after the rewrite. See test/succeed/Rewrite.agda for some examples. * A new primitive, primTrustMe, has been added: primTrustMe : {A : Set} {x y : A} → x ≡ y Here _≡_ is the builtin equality (see BUILTIN hooks for equality, above). If x and y are definitionally equal, then primTrustMe {x = x} {y = y} reduces to refl. Note that the compiler replaces all uses of primTrustMe with the REFL builtin, without any check for definitional equality. Incorrect uses of primTrustMe can potentially lead to segfaults or similar problems. For an example of the use of primTrustMe, see Data.String in version 0.3 of the standard library, where it is used to implement decidable equality on strings using the primitive boolean equality. * Changes to the syntax and semantics of IMPORT pragmas, which are used by the Haskell FFI. Such pragmas must now have the following form: {-# IMPORT #-} These pragmas are interpreted as /qualified/ imports, so Haskell names need to be given qualified (unless they come from the Haskell prelude). * The horizontal tab character (U+0009) is no longer treated as white space. * Line pragmas are no longer supported. * The --include-path flag can no longer be used as a pragma. * The experimental and incomplete support for proof irrelevance has been disabled. Tools ----- * New "intro" command in the Emacs mode. When there is a canonical way of building something of the goal type (for instance, if the goal type is a pair), the goal can be refined in this way. The command works for the following goal types: - A data type where only one of its constructors can be used to construct an element of the goal type. (For instance, if the goal is a non-empty vector, a "cons" will be introduced.) - A record type. A record value will be introduced. Implicit fields will not be included unless showing of implicit arguments is switched on. - A function type. A lambda binding as many variables as possible will be introduced. The variable names will be chosen from the goal type if its normal form is a dependent function type, otherwise they will be variations on "x". Implicit lambdas will only be inserted if showing of implicit arguments is switched on. This command can be invoked by using the refine command (C-c C-r) when the goal is empty. (The old behaviour of the refine command in this situation was to ask for an expression using the minibuffer.) * The Emacs mode displays "Checked" in the mode line if the current file type checked successfully without any warnings. * If a file F is loaded, and this file defines the module M, it is an error if F is not the file which defines M according to the include path. Note that the command-line tool and the Emacs mode define the meaning of relative include paths differently: the command-line tool interprets them relative to the current working directory, whereas the Emacs mode interprets them relative to the root directory of the current project. (As an example, if the module A.B.C is loaded from the file /A/B/C.agda, then the root directory is .) * It is an error if there are several files on the include path which match a given module name. * Interface files are relocatable. You can move around source trees as long as the include path is updated in a corresponding way. Note that a module M may be re-typechecked if its time stamp is strictly newer than that of the corresponding interface file (M.agdai). * Type-checking is no longer done when an up-to-date interface exists. (Previously the initial module was always type-checked.) * Syntax highlighting files for Emacs (.agda.el) are no longer used. The --emacs flag has been removed. (Syntax highlighting information is cached in the interface files.) * The Agate and Alonzo compilers have been retired. The options --agate, --alonzo and --malonzo have been removed. * The default directory for MAlonzo output is the project's root directory. The --malonzo-dir flag has been renamed to --compile-dir. * Emacs mode: C-c C-x C-d no longer resets the type checking state. C-c C-x C-r can be used for a more complete reset. C-c C-x C-s (which used to reload the syntax highlighting information) has been removed. C-c C-l can be used instead. * The Emacs mode used to define some "abbrevs", unless the user explicitly turned this feature off. The new default is /not/ to add any abbrevs. The old default can be obtained by customising agda2-mode-abbrevs-use-defaults (a customisation buffer can be obtained by typing M-x customize-group agda2 RET after an Agda file has been loaded). ------------------------------------------------------------------------ -- Release notes for Agda 2 version 2.2.4 ------------------------------------------------------------------------ Important changes since 2.2.2: * Change to the semantics of "open import" and "open module". The declaration open import M now translates to import A open A instead of import A open A. The same translation is used for "open module M = E …". Declarations involving the keywords as or public are changed in a corresponding way ("as" always goes with import, and "public" always with open). This change means that import directives do not affect the qualified names when open import/module is used. To get the old behaviour you can use the expanded version above. * Names opened publicly in parameterised modules no longer inherit the module parameters. Example: module A where postulate X : Set module B (Y : Set) where open A public In Agda 2.2.2 B.X has type (Y : Set) → Set, whereas in Agda 2.2.4 B.X has type Set. * Previously it was not possible to export a given constructor name through two different "open public" statements in the same module. This is now possible. * Unicode subscript digits are now allowed for the hierarchy of universes (Set₀, Set₁, …): Set₁ is equivalent to Set1. ------------------------------------------------------------------------ -- Release notes for Agda 2 version 2.2.2 ------------------------------------------------------------------------ Important changes since 2.2.0: Tools ----- * The --malonzodir option has been renamed to --malonzo-dir. * The output of agda --html is by default placed in a directory called "html". Infrastructure -------------- * The Emacs mode is included in the Agda Cabal package, and installed by cabal install. The recommended way to enable the Emacs mode is to include the following code in .emacs: (load-file (let ((coding-system-for-read 'utf-8)) (shell-command-to-string "agda-mode locate"))) ------------------------------------------------------------------------ -- Release notes for Agda 2 version 2.2.0 ------------------------------------------------------------------------ Important changes since 2.1.2 (which was released 2007-08-16): Language -------- * Exhaustive pattern checking. Agda complains if there are missing clauses in a function definition. * Coinductive types are supported. This feature is under development/evaluation, and may change. http://wiki.portal.chalmers.se/agda/agda.php?n=ReferenceManual.Codatatypes * Another experimental feature: Sized types, which can make it easier to explain why your code is terminating. * Improved constraint solving for functions with constructor headed right hand sides. http://wiki.portal.chalmers.se/agda/agda.php?n=ReferenceManual.FindingTheValuesOfImplicitArguments * A simple, well-typed foreign function interface, which allows use of Haskell functions in Agda code. http://wiki.portal.chalmers.se/agda/pmwiki.php?n=Docs.FFI * The tokens forall, -> and \ can be written as ∀, → and λ. * Absurd lambdas: λ () and λ {}. http://thread.gmane.org/gmane.comp.lang.agda/440 * Record fields whose values can be inferred can be omitted. * Agda complains if it spots an unreachable clause, or if a pattern variable "shadows" a hidden constructor of matching type. http://thread.gmane.org/gmane.comp.lang.agda/720 Tools ----- * Case-split: The user interface can replace a pattern variable with the corresponding constructor patterns. You get one new left-hand side for every possible constructor. http://wiki.portal.chalmers.se/agda/pmwiki.php?n=Main.QuickGuideToEditingTypeCheckingAndCompilingAgdaCode * The MAlonzo compiler. http://wiki.portal.chalmers.se/agda/pmwiki.php?n=Docs.MAlonzo * A new Emacs input method, which contains bindings for many Unicode symbols, is by default activated in the Emacs mode. http://wiki.portal.chalmers.se/agda/pmwiki.php?n=Docs.UnicodeInput * Highlighted, hyperlinked HTML can be generated from Agda source code. http://wiki.portal.chalmers.se/agda/pmwiki.php?n=Main.HowToGenerateWebPagesFromSourceCode * The command-line interactive mode (agda -I) is no longer supported, but should still work. http://thread.gmane.org/gmane.comp.lang.agda/245 * Reload times when working on large projects are now considerably better. http://thread.gmane.org/gmane.comp.lang.agda/551 Libraries --------- * A standard library is under development. http://wiki.portal.chalmers.se/agda/pmwiki.php?n=Libraries.StandardLibrary Documentation ------------- * The Agda wiki is better organised. It should be easier for a newcomer to find relevant information now. http://wiki.portal.chalmers.se/agda/ Infrastructure -------------- * Easy-to-install packages for Windows and Debian/Ubuntu have been prepared. http://wiki.portal.chalmers.se/agda/pmwiki.php?n=Main.Download * Agda 2.2.0 is available from Hackage. http://hackage.haskell.org/ Agda-2.4.2.5/Agda.cabal0000644000000000000000000005003512635075266012543 0ustar0000000000000000name: Agda version: 2.4.2.5 cabal-version: >= 1.8 build-type: Custom license: OtherLicense license-file: LICENSE author: Ulf Norell, Andreas Abel, Nils Anders Danielsson, Makoto Takeyama, Catarina Coquand, with contributions by Stevan Andjelkovic, Marcin Benke, Jean-Philippe Bernardy, James Chapman, Jesper Cockx, Dominique Devriese, Peter Divanski, Fredrik Nordvall Forsberg, Olle Fredriksson, Daniel Gustafsson, Philipp Hausmann, Patrik Jansson, Alan Jeffrey, Wolfram Kahl, Fredrik Lindblad, Francesco Mazzoli, Stefan Monnier, Darin Morrison, Guilhem Moulin, Nicolas Pouillard, Andrés Sicard-Ramírez, Andrea Vezzosi and many more. maintainer: Ulf Norell homepage: http://wiki.portal.chalmers.se/agda/ bug-reports: http://code.google.com/p/agda/issues/list category: Dependent types synopsis: A dependently typed functional programming language and proof assistant description: Agda is a dependently typed functional programming language: It has inductive families, which are similar to Haskell's GADTs, but they can be indexed by values and not just types. It also has parameterised modules, mixfix operators, Unicode characters, and an interactive Emacs interface (the type checker can assist in the development of your code). . Agda is also a proof assistant: It is an interactive system for writing and checking proofs. Agda is based on intuitionistic type theory, a foundational system for constructive mathematics developed by the Swedish logician Per Martin-Löf. It has many similarities with other proof assistants based on dependent types, such as Coq, Epigram and NuPRL. . This package includes both a command-line program (agda) and an Emacs mode. If you want to use the Emacs mode you can set it up by running @agda-mode setup@ (see the README). . Note that the Agda library does not follow the package versioning policy, because it is not intended to be used by third-party packages. tested-with: GHC == 7.6.3 GHC == 7.8.4 GHC == 7.10.3 extra-source-files: src/full/undefined.h README.md CHANGELOG data-dir: src/data data-files: Agda.css emacs-mode/*.el -- EpicInclude/AgdaPrelude.e -- EpicInclude/stdagda.c -- EpicInclude/stdagda.h agda.sty postprocess-latex.pl lib/prim/Agda/Primitive.agda source-repository head type: git location: https://github.com/agda/agda.git source-repository this type: git location: https://github.com/agda/agda tag: 2.4.2.5 flag cpphs default: True manual: True description: Use cpphs instead of cpp. library hs-source-dirs: src/full include-dirs: src/full if flag(cpphs) build-tools: cpphs >= 1.19 && < 1.20 ghc-options: -pgmP cpphs -optP --cpp if os(windows) build-depends: Win32 >= 2.2 && < 2.4 build-depends: array >= 0.4.0.1 && < 0.6 , base >= 4.6.0.1 && < 4.9 , binary >= 0.7.2.1 && < 0.8 , boxes >= 0.1.3 && < 0.2 , bytestring >= 0.10.0.2 && < 0.11 , containers >= 0.5.0.0 && < 0.6 , data-hash >= 0.2.0.0 && < 0.3 , deepseq >= 1.3.0.1 && < 1.5 , directory >= 1.2.0.1 && < 1.3 , edit-distance >= 0.2.1.2 && < 0.3 , equivalence >= 0.2.5 && < 0.4 , filepath >= 1.3.0.1 && < 1.5 , geniplate-mirror >= 0.6.0.6 && < 0.8 -- hashable 1.2.0.10 makes library-test 10x slower. The issue was -- fixed in hashable 1.2.1.0. -- https://github.com/tibbe/hashable/issues/57. , hashable >= 1.2.1.0 && < 1.3 -- There is a "serious bug" -- (https://hackage.haskell.org/package/hashtables-1.2.0.2/changelog) -- in hashtables 1.2.0.0/1.2.0.1. This bug seems to have made Agda -- much slower (infinitely slower?) in some cases. , hashtables >= 1.0.1.8 && < 1.2 || >= 1.2.0.2 && < 1.3 , haskeline >= 0.7.1.3 && < 0.8 , haskell-src-exts >= 1.16.0.1 && < 1.18 -- mtl-2.1 contains a severe bug. -- -- mtl >= 2.2 && < 2.2.1 doesn't export Control.Monad.Except. , mtl >= 2.1.1 && <= 2.1.3.1 || >= 2.2.1 && < 2.3 , QuickCheck >= 2.8 && < 2.9 , parallel >= 3.2.0.4 && < 3.3 -- , parsec >= 3.1 && < 3.2, -- only for Agda.TypeChecking.SizedTypes.Parser, which is not included -- pretty 1.1.1.2 and 1.1.1.3 do not follow the package versioning -- policy. , pretty >= 1.1.1.0 && < 1.1.1.2 || >= 1.1.2 && < 1.2 , process >= 1.1.0.2 && < 1.3 , strict >= 0.3.2 && < 0.4 , template-haskell >= 2.8.0.0 && < 2.11 , text >= 0.11.3.1 && < 1.3 , time >= 1.4.0.1 && < 1.6 -- transformers 0.4.0.0 was deprecated. , transformers >= 0.3 && < 0.4 || >= 0.4.1.0 && < 0.5 , transformers-compat >= 0.3.3.3 && < 0.5 , unordered-containers >= 0.2.5.0 && < 0.3 , xhtml >= 3000.2.1 && < 3000.3 if impl(ghc < 7.8) build-depends: base-orphans >= 0.3.1 && < 0.5 if impl(ghc < 7.10) build-depends: void >= 0.5.4 && < 0.9 -- zlib >= 0.6.1 is broken with GHC < 7.10.3. See Issue 1518. if impl(ghc < 7.10.3) build-depends: zlib >= 0.4.0.1 && < 0.6.1 else build-depends: zlib >= 0.4.0.1 && < 0.7 build-tools: alex >= 3.1.0 && < 3.2 , happy >= 1.19.4 && < 2 exposed-modules: Agda.Auto.Auto Agda.Auto.CaseSplit Agda.Auto.Convert Agda.Auto.NarrowingSearch Agda.Auto.SearchControl Agda.Auto.Syntax Agda.Auto.Typecheck Agda.Benchmarking Agda.Compiler.CallCompiler Agda.Compiler.Epic.AuxAST Agda.Compiler.Epic.CaseOpts Agda.Compiler.Epic.Compiler Agda.Compiler.Epic.CompileState Agda.Compiler.Epic.Epic Agda.Compiler.Epic.Erasure Agda.Compiler.Epic.ForceConstrs Agda.Compiler.Epic.Forcing Agda.Compiler.Epic.FromAgda Agda.Compiler.Epic.Injection Agda.Compiler.Epic.Interface Agda.Compiler.Epic.NatDetection Agda.Compiler.Epic.Primitive Agda.Compiler.Epic.Smashing Agda.Compiler.Epic.Static Agda.Compiler.HaskellTypes Agda.Compiler.JS.Case Agda.Compiler.JS.Compiler Agda.Compiler.JS.Syntax Agda.Compiler.JS.Substitution Agda.Compiler.JS.Parser Agda.Compiler.JS.Pretty Agda.Compiler.MAlonzo.Compiler Agda.Compiler.MAlonzo.Encode Agda.Compiler.MAlonzo.Misc Agda.Compiler.MAlonzo.Pretty Agda.Compiler.MAlonzo.Primitives Agda.ImpossibleTest Agda.Interaction.BasicOps Agda.Interaction.CommandLine Agda.Interaction.EmacsCommand Agda.Interaction.EmacsTop Agda.Interaction.Exceptions Agda.Interaction.FindFile Agda.Interaction.Highlighting.Dot Agda.Interaction.Highlighting.Emacs Agda.Interaction.Highlighting.Generate Agda.Interaction.Highlighting.HTML Agda.Interaction.Highlighting.Precise Agda.Interaction.Highlighting.Range Agda.Interaction.Highlighting.Vim Agda.Interaction.Highlighting.LaTeX Agda.Interaction.Imports Agda.Interaction.InteractionTop Agda.Interaction.Response Agda.Interaction.MakeCase Agda.Interaction.Monad Agda.Interaction.Options Agda.Interaction.Options.Lenses Agda.Main Agda.Syntax.Abstract.Copatterns Agda.Syntax.Abstract.Name Agda.Syntax.Abstract.Pretty Agda.Syntax.Abstract.Views Agda.Syntax.Abstract Agda.Syntax.Common Agda.Syntax.Concrete.Definitions Agda.Syntax.Concrete.Generic Agda.Syntax.Concrete.Name Agda.Syntax.Concrete.Operators.Parser Agda.Syntax.Concrete.Operators Agda.Syntax.Concrete.Pretty Agda.Syntax.Concrete Agda.Syntax.Fixity Agda.Syntax.Info Agda.Syntax.Internal Agda.Syntax.Internal.Defs Agda.Syntax.Internal.Generic Agda.Syntax.Internal.Pattern Agda.Syntax.Literal Agda.Syntax.Notation Agda.Syntax.Parser.Alex Agda.Syntax.Parser.Comments Agda.Syntax.Parser.Layout Agda.Syntax.Parser.LexActions Agda.Syntax.Parser.Lexer Agda.Syntax.Parser.LookAhead Agda.Syntax.Parser.Monad Agda.Syntax.Parser.Parser Agda.Syntax.Parser.StringLiterals Agda.Syntax.Parser.Tokens Agda.Syntax.Parser Agda.Syntax.Position Agda.Syntax.Scope.Base Agda.Syntax.Scope.Monad Agda.Syntax.Translation.AbstractToConcrete Agda.Syntax.Translation.ConcreteToAbstract Agda.Syntax.Translation.InternalToAbstract Agda.Termination.CallGraph Agda.Termination.CallMatrix Agda.Termination.CutOff Agda.Termination.Inlining -- Agda.Termination.Lexicographic -- RETIRED -- Agda.Termination.Matrix -- RETIRED Agda.Termination.Monad Agda.Termination.Order Agda.Termination.RecCheck Agda.Termination.SparseMatrix Agda.Termination.Semiring Agda.Termination.TermCheck Agda.Termination.Termination Agda.Tests Agda.TheTypeChecker Agda.TypeChecking.Abstract Agda.TypeChecking.CheckInternal Agda.TypeChecking.CompiledClause Agda.TypeChecking.CompiledClause.Compile Agda.TypeChecking.CompiledClause.Match Agda.TypeChecking.Constraints Agda.TypeChecking.Conversion Agda.TypeChecking.Coverage Agda.TypeChecking.Coverage.Match Agda.TypeChecking.Coverage.SplitTree Agda.TypeChecking.Datatypes Agda.TypeChecking.DisplayForm Agda.TypeChecking.DropArgs -- Agda.TypeChecking.Eliminators -- RETIRED Agda.TypeChecking.Empty Agda.TypeChecking.EtaContract Agda.TypeChecking.Errors Agda.TypeChecking.Free Agda.TypeChecking.Free.Lazy Agda.TypeChecking.Free.Old Agda.TypeChecking.Free.Tests Agda.TypeChecking.Forcing Agda.TypeChecking.Implicit Agda.TypeChecking.Injectivity Agda.TypeChecking.InstanceArguments Agda.TypeChecking.Irrelevance Agda.TypeChecking.Level Agda.TypeChecking.LevelConstraints Agda.TypeChecking.MetaVars Agda.TypeChecking.MetaVars.Mention Agda.TypeChecking.MetaVars.Occurs Agda.TypeChecking.Monad.Base Agda.TypeChecking.Monad.Benchmark Agda.TypeChecking.Monad.Builtin Agda.TypeChecking.Monad.Closure Agda.TypeChecking.Monad.Constraints Agda.TypeChecking.Monad.Context Agda.TypeChecking.Monad.Env Agda.TypeChecking.Monad.Exception Agda.TypeChecking.Monad.Imports Agda.TypeChecking.Monad.MetaVars Agda.TypeChecking.Monad.Mutual Agda.TypeChecking.Monad.Open Agda.TypeChecking.Monad.Options Agda.TypeChecking.Monad.Sharing Agda.TypeChecking.Monad.Signature Agda.TypeChecking.Monad.SizedTypes Agda.TypeChecking.Monad.State Agda.TypeChecking.Monad.Statistics Agda.TypeChecking.Monad.Trace Agda.TypeChecking.Monad -- Agda.TypeChecking.Patterns -- RETIRED Agda.TypeChecking.Patterns.Abstract Agda.TypeChecking.Patterns.Match Agda.TypeChecking.Polarity Agda.TypeChecking.Positivity Agda.TypeChecking.Positivity.Occurrence Agda.TypeChecking.Positivity.Tests Agda.TypeChecking.Pretty Agda.TypeChecking.Primitive Agda.TypeChecking.ProjectionLike Agda.TypeChecking.Quote -- Agda.TypeChecking.Rebind -- DEAD Agda.TypeChecking.RecordPatterns Agda.TypeChecking.Records Agda.TypeChecking.Reduce Agda.TypeChecking.Reduce.Monad Agda.TypeChecking.Rewriting Agda.TypeChecking.Rewriting.NonLinMatch Agda.TypeChecking.Rules.Builtin Agda.TypeChecking.Rules.Builtin.Coinduction Agda.TypeChecking.Rules.Data Agda.TypeChecking.Rules.Decl Agda.TypeChecking.Rules.Def Agda.TypeChecking.Rules.LHS Agda.TypeChecking.Rules.LHS.Implicit Agda.TypeChecking.Rules.LHS.Instantiate Agda.TypeChecking.Rules.LHS.Problem Agda.TypeChecking.Rules.LHS.ProblemRest Agda.TypeChecking.Rules.LHS.Split Agda.TypeChecking.Rules.LHS.Unify Agda.TypeChecking.Rules.Record Agda.TypeChecking.Rules.Term Agda.TypeChecking.Serialise Agda.TypeChecking.Serialise.Base Agda.TypeChecking.Serialise.Instances Agda.TypeChecking.Serialise.Instances.Abstract Agda.TypeChecking.Serialise.Instances.Common Agda.TypeChecking.Serialise.Instances.Compilers Agda.TypeChecking.Serialise.Instances.Highlighting Agda.TypeChecking.Serialise.Instances.Internal Agda.TypeChecking.SizedTypes Agda.TypeChecking.SizedTypes.Solve Agda.TypeChecking.SizedTypes.Syntax Agda.TypeChecking.SizedTypes.Tests Agda.TypeChecking.SizedTypes.Utils Agda.TypeChecking.SizedTypes.WarshallSolver Agda.TypeChecking.Substitute Agda.TypeChecking.SyntacticEquality Agda.TypeChecking.Telescope Agda.TypeChecking.Test.Generators Agda.TypeChecking.Tests -- Agda.TypeChecking.UniversePolymorphism -- RETIRED Agda.TypeChecking.Unquote Agda.TypeChecking.With Agda.Utils.AssocList Agda.Utils.Bag Agda.Utils.Benchmark Agda.Utils.BiMap Agda.Utils.Char Agda.Utils.Cluster Agda.Utils.Empty Agda.Utils.Except Agda.Utils.Either Agda.Utils.Favorites Agda.Utils.FileName Agda.Utils.Functor Agda.Utils.Function Agda.Utils.Geniplate Agda.Utils.Graph.AdjacencyMap.Unidirectional Agda.Utils.Graph.AdjacencyMap.Unidirectional.Tests Agda.Utils.Hash Agda.Utils.HashMap Agda.Utils.Impossible Agda.Utils.IO.Binary Agda.Utils.IO.UTF8 Agda.Utils.IORef Agda.Utils.Lens Agda.Utils.Lens.Examples Agda.Utils.List Agda.Utils.ListT Agda.Utils.ListT.Tests Agda.Utils.Map Agda.Utils.Maybe Agda.Utils.Maybe.Strict Agda.Utils.Monad Agda.Utils.Null Agda.Utils.PartialOrd Agda.Utils.Permutation Agda.Utils.Permutation.Tests Agda.Utils.Pointer Agda.Utils.Pretty Agda.Utils.QuickCheck Agda.Utils.ReadP Agda.Utils.SemiRing Agda.Utils.Singleton Agda.Utils.Size Agda.Utils.String Agda.Utils.Suffix Agda.Utils.TestHelpers Agda.Utils.Time Agda.Utils.Trie Agda.Utils.Tuple Agda.Utils.Update Agda.Utils.VarSet Agda.Utils.Warshall Agda.Version other-modules: Paths_Agda if impl(ghc >= 7.6.3) ghc-options: -w -fwarn-deprecated-flags -fwarn-dodgy-exports -fwarn-dodgy-foreign-imports -fwarn-dodgy-imports -fwarn-duplicate-exports -fwarn-hi-shadowing -fwarn-identities -fwarn-incomplete-patterns -fwarn-missing-fields -fwarn-missing-methods -fwarn-missing-signatures -fwarn-monomorphism-restriction -fwarn-orphans -fwarn-pointless-pragmas -fwarn-tabs -fwarn-overlapping-patterns -fwarn-unrecognised-pragmas -fwarn-unused-do-bind -fwarn-warnings-deprecations -fwarn-wrong-do-bind if impl(ghc >= 7.8) ghc-options: -fwarn-duplicate-constraints -fwarn-empty-enumerations -fwarn-overflowed-literals -fwarn-typed-holes -fwarn-inline-rule-shadowing if impl(ghc >= 7.10) ghc-options: -fwarn-context-quantification -fwarn-unticked-promoted-constructors -- The -fwarn-amp flag is deprected in GHC 7.10.1. if impl(ghc >= 7.8) && impl(ghc < 7.10) ghc-options: -fwarn-amp executable agda hs-source-dirs: src/main main-is: Main.hs build-depends: Agda == 2.4.2.5 -- Nothing is used from the following package, except for the -- prelude. , base >= 4.6.0.1 && < 6 if impl(ghc >= 7) -- If someone installs Agda with the setuid bit set, then the -- presence of +RTS may be a security problem (see GHC bug #3910). -- However, we sometimes recommend people to use +RTS to control -- Agda's memory usage, so we want this functionality enabled by -- default. ghc-options: -rtsopts executable agda-mode hs-source-dirs: src/agda-mode main-is: Main.hs other-modules: Paths_Agda build-depends: base >= 4.6.0.1 && < 4.9 , directory >= 1.2.0.1 && < 1.3 , filepath >= 1.3.0.1 && < 1.5 , process >= 1.1.0.2 && < 1.3 Agda-2.4.2.5/Setup.hs0000644000000000000000000000161512635075266012357 0ustar0000000000000000 import Distribution.Simple import Distribution.Simple.LocalBuildInfo import Distribution.Simple.Setup import Distribution.Simple.BuildPaths (exeExtension) import Distribution.PackageDescription import System.FilePath import System.Process import System.Exit main = defaultMainWithHooks hooks hooks = simpleUserHooks { postInst = checkAgdaPrimitive } checkAgdaPrimitive :: Args -> InstallFlags -> PackageDescription -> LocalBuildInfo -> IO () checkAgdaPrimitive args flags pkg info = do let dirs = absoluteInstallDirs pkg info NoCopyDest agda = buildDir info "agda" "agda" <.> exeExtension prim = datadir dirs "lib" "prim" "Agda" "Primitive" <.> "agda" putStrLn "Generating Agda library interface files..." ok <- rawSystem agda [prim, "-v0"] case ok of ExitSuccess -> return () ExitFailure _ -> putStrLn "WARNING: Failed to typecheck Agda.Primitive!" Agda-2.4.2.5/dist/0000755000000000000000000000000012635075264011661 5ustar0000000000000000Agda-2.4.2.5/dist/build/0000755000000000000000000000000012635075264012760 5ustar0000000000000000Agda-2.4.2.5/dist/build/Agda/0000755000000000000000000000000012635075264013614 5ustar0000000000000000Agda-2.4.2.5/dist/build/Agda/Syntax/0000755000000000000000000000000012635075264015102 5ustar0000000000000000Agda-2.4.2.5/dist/build/Agda/Syntax/Parser/0000755000000000000000000000000012635075266016340 5ustar0000000000000000Agda-2.4.2.5/dist/build/Agda/Syntax/Parser/Parser.hs0000644000000000000000000110006112635075266020127 0ustar0000000000000000{-# OPTIONS_GHC -w #-} {-# OPTIONS -fglasgow-exts -cpp #-} {-# LANGUAGE TupleSections #-} {-| The parser is generated by Happy (). - - Ideally, ranges should be as precise as possible, to get messages that - emphasize precisely the faulting term(s) upon error. - - However, interactive highlighting is only applied at the end of each - mutual block, keywords are only highlighted once (see - `TypeChecking.Rules.Decl'). So if the ranges of two declarations - interleave, one must ensure that keyword ranges are not included in - the intersection. (Otherwise they are uncolored by the interactive - highlighting.) - -} module Agda.Syntax.Parser.Parser ( moduleParser , moduleNameParser , exprParser , tokensParser , tests ) where import Control.Monad import Data.Char import Data.Functor import Data.List import Data.Maybe import qualified Data.Traversable as T import Debug.Trace import Agda.Syntax.Position hiding (tests) import Agda.Syntax.Parser.Monad import Agda.Syntax.Parser.Lexer import Agda.Syntax.Parser.Tokens import Agda.Syntax.Concrete as C import Agda.Syntax.Concrete.Pretty () import Agda.Syntax.Common hiding (Arg, Dom, NamedArg) import qualified Agda.Syntax.Common as Common import Agda.Syntax.Fixity import Agda.Syntax.Notation import Agda.Syntax.Literal import Agda.Utils.Hash import Agda.Utils.List (spanJust) import Agda.Utils.Monad import Agda.Utils.Pretty import Agda.Utils.QuickCheck import Agda.Utils.Singleton import Agda.Utils.TestHelpers import Agda.Utils.Tuple import qualified Data.Array as Happy_Data_Array import qualified GHC.Exts as Happy_GHC_Exts import Control.Applicative(Applicative(..)) import Control.Monad (ap) -- parser produced by Happy Version 1.19.5 newtype HappyAbsSyn t11 t12 t13 t34 t37 t40 t41 t42 t46 t47 t75 = HappyAbsSyn HappyAny #if __GLASGOW_HASKELL__ >= 607 type HappyAny = Happy_GHC_Exts.Any #else type HappyAny = forall a . a #endif happyIn7 :: ([Token]) -> (HappyAbsSyn t11 t12 t13 t34 t37 t40 t41 t42 t46 t47 t75) happyIn7 x = Happy_GHC_Exts.unsafeCoerce# x {-# INLINE happyIn7 #-} happyOut7 :: (HappyAbsSyn t11 t12 t13 t34 t37 t40 t41 t42 t46 t47 t75) -> ([Token]) happyOut7 x = Happy_GHC_Exts.unsafeCoerce# x {-# INLINE happyOut7 #-} happyIn8 :: ([Token]) -> (HappyAbsSyn t11 t12 t13 t34 t37 t40 t41 t42 t46 t47 t75) happyIn8 x = Happy_GHC_Exts.unsafeCoerce# x {-# INLINE happyIn8 #-} happyOut8 :: (HappyAbsSyn t11 t12 t13 t34 t37 t40 t41 t42 t46 t47 t75) -> ([Token]) happyOut8 x = Happy_GHC_Exts.unsafeCoerce# x {-# INLINE happyOut8 #-} happyIn9 :: (Token) -> (HappyAbsSyn t11 t12 t13 t34 t37 t40 t41 t42 t46 t47 t75) happyIn9 x = Happy_GHC_Exts.unsafeCoerce# x {-# INLINE happyIn9 #-} happyOut9 :: (HappyAbsSyn t11 t12 t13 t34 t37 t40 t41 t42 t46 t47 t75) -> (Token) happyOut9 x = Happy_GHC_Exts.unsafeCoerce# x {-# INLINE happyOut9 #-} happyIn10 :: (([Pragma], [Declaration])) -> (HappyAbsSyn t11 t12 t13 t34 t37 t40 t41 t42 t46 t47 t75) happyIn10 x = Happy_GHC_Exts.unsafeCoerce# x {-# INLINE happyIn10 #-} happyOut10 :: (HappyAbsSyn t11 t12 t13 t34 t37 t40 t41 t42 t46 t47 t75) -> (([Pragma], [Declaration])) happyOut10 x = Happy_GHC_Exts.unsafeCoerce# x {-# INLINE happyOut10 #-} happyIn11 :: t11 -> (HappyAbsSyn t11 t12 t13 t34 t37 t40 t41 t42 t46 t47 t75) happyIn11 x = Happy_GHC_Exts.unsafeCoerce# x {-# INLINE happyIn11 #-} happyOut11 :: (HappyAbsSyn t11 t12 t13 t34 t37 t40 t41 t42 t46 t47 t75) -> t11 happyOut11 x = Happy_GHC_Exts.unsafeCoerce# x {-# INLINE happyOut11 #-} happyIn12 :: t12 -> (HappyAbsSyn t11 t12 t13 t34 t37 t40 t41 t42 t46 t47 t75) happyIn12 x = Happy_GHC_Exts.unsafeCoerce# x {-# INLINE happyIn12 #-} happyOut12 :: (HappyAbsSyn t11 t12 t13 t34 t37 t40 t41 t42 t46 t47 t75) -> t12 happyOut12 x = Happy_GHC_Exts.unsafeCoerce# x {-# INLINE happyOut12 #-} happyIn13 :: t13 -> (HappyAbsSyn t11 t12 t13 t34 t37 t40 t41 t42 t46 t47 t75) happyIn13 x = Happy_GHC_Exts.unsafeCoerce# x {-# INLINE happyIn13 #-} happyOut13 :: (HappyAbsSyn t11 t12 t13 t34 t37 t40 t41 t42 t46 t47 t75) -> t13 happyOut13 x = Happy_GHC_Exts.unsafeCoerce# x {-# INLINE happyOut13 #-} happyIn14 :: (()) -> (HappyAbsSyn t11 t12 t13 t34 t37 t40 t41 t42 t46 t47 t75) happyIn14 x = Happy_GHC_Exts.unsafeCoerce# x {-# INLINE happyIn14 #-} happyOut14 :: (HappyAbsSyn t11 t12 t13 t34 t37 t40 t41 t42 t46 t47 t75) -> (()) happyOut14 x = Happy_GHC_Exts.unsafeCoerce# x {-# INLINE happyOut14 #-} happyIn15 :: (Integer) -> (HappyAbsSyn t11 t12 t13 t34 t37 t40 t41 t42 t46 t47 t75) happyIn15 x = Happy_GHC_Exts.unsafeCoerce# x {-# INLINE happyIn15 #-} happyOut15 :: (HappyAbsSyn t11 t12 t13 t34 t37 t40 t41 t42 t46 t47 t75) -> (Integer) happyOut15 x = Happy_GHC_Exts.unsafeCoerce# x {-# INLINE happyOut15 #-} happyIn16 :: (Name) -> (HappyAbsSyn t11 t12 t13 t34 t37 t40 t41 t42 t46 t47 t75) happyIn16 x = Happy_GHC_Exts.unsafeCoerce# x {-# INLINE happyIn16 #-} happyOut16 :: (HappyAbsSyn t11 t12 t13 t34 t37 t40 t41 t42 t46 t47 t75) -> (Name) happyOut16 x = Happy_GHC_Exts.unsafeCoerce# x {-# INLINE happyOut16 #-} happyIn17 :: ([Name]) -> (HappyAbsSyn t11 t12 t13 t34 t37 t40 t41 t42 t46 t47 t75) happyIn17 x = Happy_GHC_Exts.unsafeCoerce# x {-# INLINE happyIn17 #-} happyOut17 :: (HappyAbsSyn t11 t12 t13 t34 t37 t40 t41 t42 t46 t47 t75) -> ([Name]) happyOut17 x = Happy_GHC_Exts.unsafeCoerce# x {-# INLINE happyOut17 #-} happyIn18 :: (Range) -> (HappyAbsSyn t11 t12 t13 t34 t37 t40 t41 t42 t46 t47 t75) happyIn18 x = Happy_GHC_Exts.unsafeCoerce# x {-# INLINE happyIn18 #-} happyOut18 :: (HappyAbsSyn t11 t12 t13 t34 t37 t40 t41 t42 t46 t47 t75) -> (Range) happyOut18 x = Happy_GHC_Exts.unsafeCoerce# x {-# INLINE happyOut18 #-} happyIn19 :: (Arg Name) -> (HappyAbsSyn t11 t12 t13 t34 t37 t40 t41 t42 t46 t47 t75) happyIn19 x = Happy_GHC_Exts.unsafeCoerce# x {-# INLINE happyIn19 #-} happyOut19 :: (HappyAbsSyn t11 t12 t13 t34 t37 t40 t41 t42 t46 t47 t75) -> (Arg Name) happyOut19 x = Happy_GHC_Exts.unsafeCoerce# x {-# INLINE happyOut19 #-} happyIn20 :: ([Arg Name]) -> (HappyAbsSyn t11 t12 t13 t34 t37 t40 t41 t42 t46 t47 t75) happyIn20 x = Happy_GHC_Exts.unsafeCoerce# x {-# INLINE happyIn20 #-} happyOut20 :: (HappyAbsSyn t11 t12 t13 t34 t37 t40 t41 t42 t46 t47 t75) -> ([Arg Name]) happyOut20 x = Happy_GHC_Exts.unsafeCoerce# x {-# INLINE happyOut20 #-} happyIn21 :: ([Arg Name]) -> (HappyAbsSyn t11 t12 t13 t34 t37 t40 t41 t42 t46 t47 t75) happyIn21 x = Happy_GHC_Exts.unsafeCoerce# x {-# INLINE happyIn21 #-} happyOut21 :: (HappyAbsSyn t11 t12 t13 t34 t37 t40 t41 t42 t46 t47 t75) -> ([Arg Name]) happyOut21 x = Happy_GHC_Exts.unsafeCoerce# x {-# INLINE happyOut21 #-} happyIn22 :: (QName) -> (HappyAbsSyn t11 t12 t13 t34 t37 t40 t41 t42 t46 t47 t75) happyIn22 x = Happy_GHC_Exts.unsafeCoerce# x {-# INLINE happyIn22 #-} happyOut22 :: (HappyAbsSyn t11 t12 t13 t34 t37 t40 t41 t42 t46 t47 t75) -> (QName) happyOut22 x = Happy_GHC_Exts.unsafeCoerce# x {-# INLINE happyOut22 #-} happyIn23 :: (QName) -> (HappyAbsSyn t11 t12 t13 t34 t37 t40 t41 t42 t46 t47 t75) happyIn23 x = Happy_GHC_Exts.unsafeCoerce# x {-# INLINE happyIn23 #-} happyOut23 :: (HappyAbsSyn t11 t12 t13 t34 t37 t40 t41 t42 t46 t47 t75) -> (QName) happyOut23 x = Happy_GHC_Exts.unsafeCoerce# x {-# INLINE happyOut23 #-} happyIn24 :: (Name) -> (HappyAbsSyn t11 t12 t13 t34 t37 t40 t41 t42 t46 t47 t75) happyIn24 x = Happy_GHC_Exts.unsafeCoerce# x {-# INLINE happyIn24 #-} happyOut24 :: (HappyAbsSyn t11 t12 t13 t34 t37 t40 t41 t42 t46 t47 t75) -> (Name) happyOut24 x = Happy_GHC_Exts.unsafeCoerce# x {-# INLINE happyOut24 #-} happyIn25 :: ([Name]) -> (HappyAbsSyn t11 t12 t13 t34 t37 t40 t41 t42 t46 t47 t75) happyIn25 x = Happy_GHC_Exts.unsafeCoerce# x {-# INLINE happyIn25 #-} happyOut25 :: (HappyAbsSyn t11 t12 t13 t34 t37 t40 t41 t42 t46 t47 t75) -> ([Name]) happyOut25 x = Happy_GHC_Exts.unsafeCoerce# x {-# INLINE happyOut25 #-} happyIn26 :: ([Name]) -> (HappyAbsSyn t11 t12 t13 t34 t37 t40 t41 t42 t46 t47 t75) happyIn26 x = Happy_GHC_Exts.unsafeCoerce# x {-# INLINE happyIn26 #-} happyOut26 :: (HappyAbsSyn t11 t12 t13 t34 t37 t40 t41 t42 t46 t47 t75) -> ([Name]) happyOut26 x = Happy_GHC_Exts.unsafeCoerce# x {-# INLINE happyOut26 #-} happyIn27 :: (Either [Name] [Expr]) -> (HappyAbsSyn t11 t12 t13 t34 t37 t40 t41 t42 t46 t47 t75) happyIn27 x = Happy_GHC_Exts.unsafeCoerce# x {-# INLINE happyIn27 #-} happyOut27 :: (HappyAbsSyn t11 t12 t13 t34 t37 t40 t41 t42 t46 t47 t75) -> (Either [Name] [Expr]) happyOut27 x = Happy_GHC_Exts.unsafeCoerce# x {-# INLINE happyOut27 #-} happyIn28 :: ([WithHiding Name]) -> (HappyAbsSyn t11 t12 t13 t34 t37 t40 t41 t42 t46 t47 t75) happyIn28 x = Happy_GHC_Exts.unsafeCoerce# x {-# INLINE happyIn28 #-} happyOut28 :: (HappyAbsSyn t11 t12 t13 t34 t37 t40 t41 t42 t46 t47 t75) -> ([WithHiding Name]) happyOut28 x = Happy_GHC_Exts.unsafeCoerce# x {-# INLINE happyOut28 #-} happyIn29 :: ([String]) -> (HappyAbsSyn t11 t12 t13 t34 t37 t40 t41 t42 t46 t47 t75) happyIn29 x = Happy_GHC_Exts.unsafeCoerce# x {-# INLINE happyIn29 #-} happyOut29 :: (HappyAbsSyn t11 t12 t13 t34 t37 t40 t41 t42 t46 t47 t75) -> ([String]) happyOut29 x = Happy_GHC_Exts.unsafeCoerce# x {-# INLINE happyOut29 #-} happyIn30 :: (String) -> (HappyAbsSyn t11 t12 t13 t34 t37 t40 t41 t42 t46 t47 t75) happyIn30 x = Happy_GHC_Exts.unsafeCoerce# x {-# INLINE happyIn30 #-} happyOut30 :: (HappyAbsSyn t11 t12 t13 t34 t37 t40 t41 t42 t46 t47 t75) -> (String) happyOut30 x = Happy_GHC_Exts.unsafeCoerce# x {-# INLINE happyOut30 #-} happyIn31 :: (Name) -> (HappyAbsSyn t11 t12 t13 t34 t37 t40 t41 t42 t46 t47 t75) happyIn31 x = Happy_GHC_Exts.unsafeCoerce# x {-# INLINE happyIn31 #-} happyOut31 :: (HappyAbsSyn t11 t12 t13 t34 t37 t40 t41 t42 t46 t47 t75) -> (Name) happyOut31 x = Happy_GHC_Exts.unsafeCoerce# x {-# INLINE happyOut31 #-} happyIn32 :: (QName) -> (HappyAbsSyn t11 t12 t13 t34 t37 t40 t41 t42 t46 t47 t75) happyIn32 x = Happy_GHC_Exts.unsafeCoerce# x {-# INLINE happyIn32 #-} happyOut32 :: (HappyAbsSyn t11 t12 t13 t34 t37 t40 t41 t42 t46 t47 t75) -> (QName) happyOut32 x = Happy_GHC_Exts.unsafeCoerce# x {-# INLINE happyOut32 #-} happyIn33 :: (Expr) -> (HappyAbsSyn t11 t12 t13 t34 t37 t40 t41 t42 t46 t47 t75) happyIn33 x = Happy_GHC_Exts.unsafeCoerce# x {-# INLINE happyIn33 #-} happyOut33 :: (HappyAbsSyn t11 t12 t13 t34 t37 t40 t41 t42 t46 t47 t75) -> (Expr) happyOut33 x = Happy_GHC_Exts.unsafeCoerce# x {-# INLINE happyOut33 #-} happyIn34 :: t34 -> (HappyAbsSyn t11 t12 t13 t34 t37 t40 t41 t42 t46 t47 t75) happyIn34 x = Happy_GHC_Exts.unsafeCoerce# x {-# INLINE happyIn34 #-} happyOut34 :: (HappyAbsSyn t11 t12 t13 t34 t37 t40 t41 t42 t46 t47 t75) -> t34 happyOut34 x = Happy_GHC_Exts.unsafeCoerce# x {-# INLINE happyOut34 #-} happyIn35 :: ([Expr]) -> (HappyAbsSyn t11 t12 t13 t34 t37 t40 t41 t42 t46 t47 t75) happyIn35 x = Happy_GHC_Exts.unsafeCoerce# x {-# INLINE happyIn35 #-} happyOut35 :: (HappyAbsSyn t11 t12 t13 t34 t37 t40 t41 t42 t46 t47 t75) -> ([Expr]) happyOut35 x = Happy_GHC_Exts.unsafeCoerce# x {-# INLINE happyOut35 #-} happyIn36 :: ([Expr]) -> (HappyAbsSyn t11 t12 t13 t34 t37 t40 t41 t42 t46 t47 t75) happyIn36 x = Happy_GHC_Exts.unsafeCoerce# x {-# INLINE happyIn36 #-} happyOut36 :: (HappyAbsSyn t11 t12 t13 t34 t37 t40 t41 t42 t46 t47 t75) -> ([Expr]) happyOut36 x = Happy_GHC_Exts.unsafeCoerce# x {-# INLINE happyOut36 #-} happyIn37 :: t37 -> (HappyAbsSyn t11 t12 t13 t34 t37 t40 t41 t42 t46 t47 t75) happyIn37 x = Happy_GHC_Exts.unsafeCoerce# x {-# INLINE happyIn37 #-} happyOut37 :: (HappyAbsSyn t11 t12 t13 t34 t37 t40 t41 t42 t46 t47 t75) -> t37 happyOut37 x = Happy_GHC_Exts.unsafeCoerce# x {-# INLINE happyOut37 #-} happyIn38 :: (Expr) -> (HappyAbsSyn t11 t12 t13 t34 t37 t40 t41 t42 t46 t47 t75) happyIn38 x = Happy_GHC_Exts.unsafeCoerce# x {-# INLINE happyIn38 #-} happyOut38 :: (HappyAbsSyn t11 t12 t13 t34 t37 t40 t41 t42 t46 t47 t75) -> (Expr) happyOut38 x = Happy_GHC_Exts.unsafeCoerce# x {-# INLINE happyOut38 #-} happyIn39 :: ([Expr]) -> (HappyAbsSyn t11 t12 t13 t34 t37 t40 t41 t42 t46 t47 t75) happyIn39 x = Happy_GHC_Exts.unsafeCoerce# x {-# INLINE happyIn39 #-} happyOut39 :: (HappyAbsSyn t11 t12 t13 t34 t37 t40 t41 t42 t46 t47 t75) -> ([Expr]) happyOut39 x = Happy_GHC_Exts.unsafeCoerce# x {-# INLINE happyOut39 #-} happyIn40 :: t40 -> (HappyAbsSyn t11 t12 t13 t34 t37 t40 t41 t42 t46 t47 t75) happyIn40 x = Happy_GHC_Exts.unsafeCoerce# x {-# INLINE happyIn40 #-} happyOut40 :: (HappyAbsSyn t11 t12 t13 t34 t37 t40 t41 t42 t46 t47 t75) -> t40 happyOut40 x = Happy_GHC_Exts.unsafeCoerce# x {-# INLINE happyOut40 #-} happyIn41 :: t41 -> (HappyAbsSyn t11 t12 t13 t34 t37 t40 t41 t42 t46 t47 t75) happyIn41 x = Happy_GHC_Exts.unsafeCoerce# x {-# INLINE happyIn41 #-} happyOut41 :: (HappyAbsSyn t11 t12 t13 t34 t37 t40 t41 t42 t46 t47 t75) -> t41 happyOut41 x = Happy_GHC_Exts.unsafeCoerce# x {-# INLINE happyOut41 #-} happyIn42 :: t42 -> (HappyAbsSyn t11 t12 t13 t34 t37 t40 t41 t42 t46 t47 t75) happyIn42 x = Happy_GHC_Exts.unsafeCoerce# x {-# INLINE happyIn42 #-} happyOut42 :: (HappyAbsSyn t11 t12 t13 t34 t37 t40 t41 t42 t46 t47 t75) -> t42 happyOut42 x = Happy_GHC_Exts.unsafeCoerce# x {-# INLINE happyOut42 #-} happyIn43 :: ([(Name, Expr)]) -> (HappyAbsSyn t11 t12 t13 t34 t37 t40 t41 t42 t46 t47 t75) happyIn43 x = Happy_GHC_Exts.unsafeCoerce# x {-# INLINE happyIn43 #-} happyOut43 :: (HappyAbsSyn t11 t12 t13 t34 t37 t40 t41 t42 t46 t47 t75) -> ([(Name, Expr)]) happyOut43 x = Happy_GHC_Exts.unsafeCoerce# x {-# INLINE happyOut43 #-} happyIn44 :: ([(Name, Expr)]) -> (HappyAbsSyn t11 t12 t13 t34 t37 t40 t41 t42 t46 t47 t75) happyIn44 x = Happy_GHC_Exts.unsafeCoerce# x {-# INLINE happyIn44 #-} happyOut44 :: (HappyAbsSyn t11 t12 t13 t34 t37 t40 t41 t42 t46 t47 t75) -> ([(Name, Expr)]) happyOut44 x = Happy_GHC_Exts.unsafeCoerce# x {-# INLINE happyOut44 #-} happyIn45 :: ((Name, Expr)) -> (HappyAbsSyn t11 t12 t13 t34 t37 t40 t41 t42 t46 t47 t75) happyIn45 x = Happy_GHC_Exts.unsafeCoerce# x {-# INLINE happyIn45 #-} happyOut45 :: (HappyAbsSyn t11 t12 t13 t34 t37 t40 t41 t42 t46 t47 t75) -> ((Name, Expr)) happyOut45 x = Happy_GHC_Exts.unsafeCoerce# x {-# INLINE happyOut45 #-} happyIn46 :: t46 -> (HappyAbsSyn t11 t12 t13 t34 t37 t40 t41 t42 t46 t47 t75) happyIn46 x = Happy_GHC_Exts.unsafeCoerce# x {-# INLINE happyIn46 #-} happyOut46 :: (HappyAbsSyn t11 t12 t13 t34 t37 t40 t41 t42 t46 t47 t75) -> t46 happyOut46 x = Happy_GHC_Exts.unsafeCoerce# x {-# INLINE happyOut46 #-} happyIn47 :: t47 -> (HappyAbsSyn t11 t12 t13 t34 t37 t40 t41 t42 t46 t47 t75) happyIn47 x = Happy_GHC_Exts.unsafeCoerce# x {-# INLINE happyIn47 #-} happyOut47 :: (HappyAbsSyn t11 t12 t13 t34 t37 t40 t41 t42 t46 t47 t75) -> t47 happyOut47 x = Happy_GHC_Exts.unsafeCoerce# x {-# INLINE happyOut47 #-} happyIn48 :: ([TypedBindings]) -> (HappyAbsSyn t11 t12 t13 t34 t37 t40 t41 t42 t46 t47 t75) happyIn48 x = Happy_GHC_Exts.unsafeCoerce# x {-# INLINE happyIn48 #-} happyOut48 :: (HappyAbsSyn t11 t12 t13 t34 t37 t40 t41 t42 t46 t47 t75) -> ([TypedBindings]) happyOut48 x = Happy_GHC_Exts.unsafeCoerce# x {-# INLINE happyOut48 #-} happyIn49 :: (TypedBindings) -> (HappyAbsSyn t11 t12 t13 t34 t37 t40 t41 t42 t46 t47 t75) happyIn49 x = Happy_GHC_Exts.unsafeCoerce# x {-# INLINE happyIn49 #-} happyOut49 :: (HappyAbsSyn t11 t12 t13 t34 t37 t40 t41 t42 t46 t47 t75) -> (TypedBindings) happyOut49 x = Happy_GHC_Exts.unsafeCoerce# x {-# INLINE happyOut49 #-} happyIn50 :: (TypedBindings) -> (HappyAbsSyn t11 t12 t13 t34 t37 t40 t41 t42 t46 t47 t75) happyIn50 x = Happy_GHC_Exts.unsafeCoerce# x {-# INLINE happyIn50 #-} happyOut50 :: (HappyAbsSyn t11 t12 t13 t34 t37 t40 t41 t42 t46 t47 t75) -> (TypedBindings) happyOut50 x = Happy_GHC_Exts.unsafeCoerce# x {-# INLINE happyOut50 #-} happyIn51 :: (TypedBindings) -> (HappyAbsSyn t11 t12 t13 t34 t37 t40 t41 t42 t46 t47 t75) happyIn51 x = Happy_GHC_Exts.unsafeCoerce# x {-# INLINE happyIn51 #-} happyOut51 :: (HappyAbsSyn t11 t12 t13 t34 t37 t40 t41 t42 t46 t47 t75) -> (TypedBindings) happyOut51 x = Happy_GHC_Exts.unsafeCoerce# x {-# INLINE happyOut51 #-} happyIn52 :: ([LamBinding]) -> (HappyAbsSyn t11 t12 t13 t34 t37 t40 t41 t42 t46 t47 t75) happyIn52 x = Happy_GHC_Exts.unsafeCoerce# x {-# INLINE happyIn52 #-} happyOut52 :: (HappyAbsSyn t11 t12 t13 t34 t37 t40 t41 t42 t46 t47 t75) -> ([LamBinding]) happyOut52 x = Happy_GHC_Exts.unsafeCoerce# x {-# INLINE happyOut52 #-} happyIn53 :: (Either ([LamBinding], Hiding) [Expr]) -> (HappyAbsSyn t11 t12 t13 t34 t37 t40 t41 t42 t46 t47 t75) happyIn53 x = Happy_GHC_Exts.unsafeCoerce# x {-# INLINE happyIn53 #-} happyOut53 :: (HappyAbsSyn t11 t12 t13 t34 t37 t40 t41 t42 t46 t47 t75) -> (Either ([LamBinding], Hiding) [Expr]) happyOut53 x = Happy_GHC_Exts.unsafeCoerce# x {-# INLINE happyOut53 #-} happyIn54 :: ([Either Hiding LamBinding]) -> (HappyAbsSyn t11 t12 t13 t34 t37 t40 t41 t42 t46 t47 t75) happyIn54 x = Happy_GHC_Exts.unsafeCoerce# x {-# INLINE happyIn54 #-} happyOut54 :: (HappyAbsSyn t11 t12 t13 t34 t37 t40 t41 t42 t46 t47 t75) -> ([Either Hiding LamBinding]) happyOut54 x = Happy_GHC_Exts.unsafeCoerce# x {-# INLINE happyOut54 #-} happyIn55 :: (Either [Either Hiding LamBinding] [Expr]) -> (HappyAbsSyn t11 t12 t13 t34 t37 t40 t41 t42 t46 t47 t75) happyIn55 x = Happy_GHC_Exts.unsafeCoerce# x {-# INLINE happyIn55 #-} happyOut55 :: (HappyAbsSyn t11 t12 t13 t34 t37 t40 t41 t42 t46 t47 t75) -> (Either [Either Hiding LamBinding] [Expr]) happyOut55 x = Happy_GHC_Exts.unsafeCoerce# x {-# INLINE happyOut55 #-} happyIn56 :: ((LHS,RHS,WhereClause)) -> (HappyAbsSyn t11 t12 t13 t34 t37 t40 t41 t42 t46 t47 t75) happyIn56 x = Happy_GHC_Exts.unsafeCoerce# x {-# INLINE happyIn56 #-} happyOut56 :: (HappyAbsSyn t11 t12 t13 t34 t37 t40 t41 t42 t46 t47 t75) -> ((LHS,RHS,WhereClause)) happyOut56 x = Happy_GHC_Exts.unsafeCoerce# x {-# INLINE happyOut56 #-} happyIn57 :: ((LHS,RHS,WhereClause)) -> (HappyAbsSyn t11 t12 t13 t34 t37 t40 t41 t42 t46 t47 t75) happyIn57 x = Happy_GHC_Exts.unsafeCoerce# x {-# INLINE happyIn57 #-} happyOut57 :: (HappyAbsSyn t11 t12 t13 t34 t37 t40 t41 t42 t46 t47 t75) -> ((LHS,RHS,WhereClause)) happyOut57 x = Happy_GHC_Exts.unsafeCoerce# x {-# INLINE happyOut57 #-} happyIn58 :: ((LHS,RHS,WhereClause)) -> (HappyAbsSyn t11 t12 t13 t34 t37 t40 t41 t42 t46 t47 t75) happyIn58 x = Happy_GHC_Exts.unsafeCoerce# x {-# INLINE happyIn58 #-} happyOut58 :: (HappyAbsSyn t11 t12 t13 t34 t37 t40 t41 t42 t46 t47 t75) -> ((LHS,RHS,WhereClause)) happyOut58 x = Happy_GHC_Exts.unsafeCoerce# x {-# INLINE happyOut58 #-} happyIn59 :: ([(LHS,RHS,WhereClause)]) -> (HappyAbsSyn t11 t12 t13 t34 t37 t40 t41 t42 t46 t47 t75) happyIn59 x = Happy_GHC_Exts.unsafeCoerce# x {-# INLINE happyIn59 #-} happyOut59 :: (HappyAbsSyn t11 t12 t13 t34 t37 t40 t41 t42 t46 t47 t75) -> ([(LHS,RHS,WhereClause)]) happyOut59 x = Happy_GHC_Exts.unsafeCoerce# x {-# INLINE happyOut59 #-} happyIn60 :: ([LamBinding]) -> (HappyAbsSyn t11 t12 t13 t34 t37 t40 t41 t42 t46 t47 t75) happyIn60 x = Happy_GHC_Exts.unsafeCoerce# x {-# INLINE happyIn60 #-} happyOut60 :: (HappyAbsSyn t11 t12 t13 t34 t37 t40 t41 t42 t46 t47 t75) -> ([LamBinding]) happyOut60 x = Happy_GHC_Exts.unsafeCoerce# x {-# INLINE happyOut60 #-} happyIn61 :: ([LamBinding]) -> (HappyAbsSyn t11 t12 t13 t34 t37 t40 t41 t42 t46 t47 t75) happyIn61 x = Happy_GHC_Exts.unsafeCoerce# x {-# INLINE happyIn61 #-} happyOut61 :: (HappyAbsSyn t11 t12 t13 t34 t37 t40 t41 t42 t46 t47 t75) -> ([LamBinding]) happyOut61 x = Happy_GHC_Exts.unsafeCoerce# x {-# INLINE happyOut61 #-} happyIn62 :: ([LamBinding]) -> (HappyAbsSyn t11 t12 t13 t34 t37 t40 t41 t42 t46 t47 t75) happyIn62 x = Happy_GHC_Exts.unsafeCoerce# x {-# INLINE happyIn62 #-} happyOut62 :: (HappyAbsSyn t11 t12 t13 t34 t37 t40 t41 t42 t46 t47 t75) -> ([LamBinding]) happyOut62 x = Happy_GHC_Exts.unsafeCoerce# x {-# INLINE happyOut62 #-} happyIn63 :: ([LamBinding]) -> (HappyAbsSyn t11 t12 t13 t34 t37 t40 t41 t42 t46 t47 t75) happyIn63 x = Happy_GHC_Exts.unsafeCoerce# x {-# INLINE happyIn63 #-} happyOut63 :: (HappyAbsSyn t11 t12 t13 t34 t37 t40 t41 t42 t46 t47 t75) -> ([LamBinding]) happyOut63 x = Happy_GHC_Exts.unsafeCoerce# x {-# INLINE happyOut63 #-} happyIn64 :: (Either [LamBinding] [Expr]) -> (HappyAbsSyn t11 t12 t13 t34 t37 t40 t41 t42 t46 t47 t75) happyIn64 x = Happy_GHC_Exts.unsafeCoerce# x {-# INLINE happyIn64 #-} happyOut64 :: (HappyAbsSyn t11 t12 t13 t34 t37 t40 t41 t42 t46 t47 t75) -> (Either [LamBinding] [Expr]) happyOut64 x = Happy_GHC_Exts.unsafeCoerce# x {-# INLINE happyOut64 #-} happyIn65 :: (ImportDirective) -> (HappyAbsSyn t11 t12 t13 t34 t37 t40 t41 t42 t46 t47 t75) happyIn65 x = Happy_GHC_Exts.unsafeCoerce# x {-# INLINE happyIn65 #-} happyOut65 :: (HappyAbsSyn t11 t12 t13 t34 t37 t40 t41 t42 t46 t47 t75) -> (ImportDirective) happyOut65 x = Happy_GHC_Exts.unsafeCoerce# x {-# INLINE happyOut65 #-} happyIn66 :: ([ImportDirective]) -> (HappyAbsSyn t11 t12 t13 t34 t37 t40 t41 t42 t46 t47 t75) happyIn66 x = Happy_GHC_Exts.unsafeCoerce# x {-# INLINE happyIn66 #-} happyOut66 :: (HappyAbsSyn t11 t12 t13 t34 t37 t40 t41 t42 t46 t47 t75) -> ([ImportDirective]) happyOut66 x = Happy_GHC_Exts.unsafeCoerce# x {-# INLINE happyOut66 #-} happyIn67 :: (ImportDirective) -> (HappyAbsSyn t11 t12 t13 t34 t37 t40 t41 t42 t46 t47 t75) happyIn67 x = Happy_GHC_Exts.unsafeCoerce# x {-# INLINE happyIn67 #-} happyOut67 :: (HappyAbsSyn t11 t12 t13 t34 t37 t40 t41 t42 t46 t47 t75) -> (ImportDirective) happyOut67 x = Happy_GHC_Exts.unsafeCoerce# x {-# INLINE happyOut67 #-} happyIn68 :: ((UsingOrHiding , Range)) -> (HappyAbsSyn t11 t12 t13 t34 t37 t40 t41 t42 t46 t47 t75) happyIn68 x = Happy_GHC_Exts.unsafeCoerce# x {-# INLINE happyIn68 #-} happyOut68 :: (HappyAbsSyn t11 t12 t13 t34 t37 t40 t41 t42 t46 t47 t75) -> ((UsingOrHiding , Range)) happyOut68 x = Happy_GHC_Exts.unsafeCoerce# x {-# INLINE happyOut68 #-} happyIn69 :: (([Renaming] , Range)) -> (HappyAbsSyn t11 t12 t13 t34 t37 t40 t41 t42 t46 t47 t75) happyIn69 x = Happy_GHC_Exts.unsafeCoerce# x {-# INLINE happyIn69 #-} happyOut69 :: (HappyAbsSyn t11 t12 t13 t34 t37 t40 t41 t42 t46 t47 t75) -> (([Renaming] , Range)) happyOut69 x = Happy_GHC_Exts.unsafeCoerce# x {-# INLINE happyOut69 #-} happyIn70 :: ([Renaming]) -> (HappyAbsSyn t11 t12 t13 t34 t37 t40 t41 t42 t46 t47 t75) happyIn70 x = Happy_GHC_Exts.unsafeCoerce# x {-# INLINE happyIn70 #-} happyOut70 :: (HappyAbsSyn t11 t12 t13 t34 t37 t40 t41 t42 t46 t47 t75) -> ([Renaming]) happyOut70 x = Happy_GHC_Exts.unsafeCoerce# x {-# INLINE happyOut70 #-} happyIn71 :: (Renaming) -> (HappyAbsSyn t11 t12 t13 t34 t37 t40 t41 t42 t46 t47 t75) happyIn71 x = Happy_GHC_Exts.unsafeCoerce# x {-# INLINE happyIn71 #-} happyOut71 :: (HappyAbsSyn t11 t12 t13 t34 t37 t40 t41 t42 t46 t47 t75) -> (Renaming) happyOut71 x = Happy_GHC_Exts.unsafeCoerce# x {-# INLINE happyOut71 #-} happyIn72 :: (ImportedName) -> (HappyAbsSyn t11 t12 t13 t34 t37 t40 t41 t42 t46 t47 t75) happyIn72 x = Happy_GHC_Exts.unsafeCoerce# x {-# INLINE happyIn72 #-} happyOut72 :: (HappyAbsSyn t11 t12 t13 t34 t37 t40 t41 t42 t46 t47 t75) -> (ImportedName) happyOut72 x = Happy_GHC_Exts.unsafeCoerce# x {-# INLINE happyOut72 #-} happyIn73 :: (ImportedName) -> (HappyAbsSyn t11 t12 t13 t34 t37 t40 t41 t42 t46 t47 t75) happyIn73 x = Happy_GHC_Exts.unsafeCoerce# x {-# INLINE happyIn73 #-} happyOut73 :: (HappyAbsSyn t11 t12 t13 t34 t37 t40 t41 t42 t46 t47 t75) -> (ImportedName) happyOut73 x = Happy_GHC_Exts.unsafeCoerce# x {-# INLINE happyOut73 #-} happyIn74 :: ([ImportedName]) -> (HappyAbsSyn t11 t12 t13 t34 t37 t40 t41 t42 t46 t47 t75) happyIn74 x = Happy_GHC_Exts.unsafeCoerce# x {-# INLINE happyIn74 #-} happyOut74 :: (HappyAbsSyn t11 t12 t13 t34 t37 t40 t41 t42 t46 t47 t75) -> ([ImportedName]) happyOut74 x = Happy_GHC_Exts.unsafeCoerce# x {-# INLINE happyOut74 #-} happyIn75 :: t75 -> (HappyAbsSyn t11 t12 t13 t34 t37 t40 t41 t42 t46 t47 t75) happyIn75 x = Happy_GHC_Exts.unsafeCoerce# x {-# INLINE happyIn75 #-} happyOut75 :: (HappyAbsSyn t11 t12 t13 t34 t37 t40 t41 t42 t46 t47 t75) -> t75 happyOut75 x = Happy_GHC_Exts.unsafeCoerce# x {-# INLINE happyOut75 #-} happyIn76 :: (LHS) -> (HappyAbsSyn t11 t12 t13 t34 t37 t40 t41 t42 t46 t47 t75) happyIn76 x = Happy_GHC_Exts.unsafeCoerce# x {-# INLINE happyIn76 #-} happyOut76 :: (HappyAbsSyn t11 t12 t13 t34 t37 t40 t41 t42 t46 t47 t75) -> (LHS) happyOut76 x = Happy_GHC_Exts.unsafeCoerce# x {-# INLINE happyOut76 #-} happyIn77 :: ([Pattern]) -> (HappyAbsSyn t11 t12 t13 t34 t37 t40 t41 t42 t46 t47 t75) happyIn77 x = Happy_GHC_Exts.unsafeCoerce# x {-# INLINE happyIn77 #-} happyOut77 :: (HappyAbsSyn t11 t12 t13 t34 t37 t40 t41 t42 t46 t47 t75) -> ([Pattern]) happyOut77 x = Happy_GHC_Exts.unsafeCoerce# x {-# INLINE happyOut77 #-} happyIn78 :: ([Expr]) -> (HappyAbsSyn t11 t12 t13 t34 t37 t40 t41 t42 t46 t47 t75) happyIn78 x = Happy_GHC_Exts.unsafeCoerce# x {-# INLINE happyIn78 #-} happyOut78 :: (HappyAbsSyn t11 t12 t13 t34 t37 t40 t41 t42 t46 t47 t75) -> ([Expr]) happyOut78 x = Happy_GHC_Exts.unsafeCoerce# x {-# INLINE happyOut78 #-} happyIn79 :: ([Expr]) -> (HappyAbsSyn t11 t12 t13 t34 t37 t40 t41 t42 t46 t47 t75) happyIn79 x = Happy_GHC_Exts.unsafeCoerce# x {-# INLINE happyIn79 #-} happyOut79 :: (HappyAbsSyn t11 t12 t13 t34 t37 t40 t41 t42 t46 t47 t75) -> ([Expr]) happyOut79 x = Happy_GHC_Exts.unsafeCoerce# x {-# INLINE happyOut79 #-} happyIn80 :: (WhereClause) -> (HappyAbsSyn t11 t12 t13 t34 t37 t40 t41 t42 t46 t47 t75) happyIn80 x = Happy_GHC_Exts.unsafeCoerce# x {-# INLINE happyIn80 #-} happyOut80 :: (HappyAbsSyn t11 t12 t13 t34 t37 t40 t41 t42 t46 t47 t75) -> (WhereClause) happyOut80 x = Happy_GHC_Exts.unsafeCoerce# x {-# INLINE happyOut80 #-} happyIn81 :: ([Declaration]) -> (HappyAbsSyn t11 t12 t13 t34 t37 t40 t41 t42 t46 t47 t75) happyIn81 x = Happy_GHC_Exts.unsafeCoerce# x {-# INLINE happyIn81 #-} happyOut81 :: (HappyAbsSyn t11 t12 t13 t34 t37 t40 t41 t42 t46 t47 t75) -> ([Declaration]) happyOut81 x = Happy_GHC_Exts.unsafeCoerce# x {-# INLINE happyOut81 #-} happyIn82 :: ([Declaration]) -> (HappyAbsSyn t11 t12 t13 t34 t37 t40 t41 t42 t46 t47 t75) happyIn82 x = Happy_GHC_Exts.unsafeCoerce# x {-# INLINE happyIn82 #-} happyOut82 :: (HappyAbsSyn t11 t12 t13 t34 t37 t40 t41 t42 t46 t47 t75) -> ([Declaration]) happyOut82 x = Happy_GHC_Exts.unsafeCoerce# x {-# INLINE happyOut82 #-} happyIn83 :: ([Arg Declaration]) -> (HappyAbsSyn t11 t12 t13 t34 t37 t40 t41 t42 t46 t47 t75) happyIn83 x = Happy_GHC_Exts.unsafeCoerce# x {-# INLINE happyIn83 #-} happyOut83 :: (HappyAbsSyn t11 t12 t13 t34 t37 t40 t41 t42 t46 t47 t75) -> ([Arg Declaration]) happyOut83 x = Happy_GHC_Exts.unsafeCoerce# x {-# INLINE happyOut83 #-} happyIn84 :: ([Declaration]) -> (HappyAbsSyn t11 t12 t13 t34 t37 t40 t41 t42 t46 t47 t75) happyIn84 x = Happy_GHC_Exts.unsafeCoerce# x {-# INLINE happyIn84 #-} happyOut84 :: (HappyAbsSyn t11 t12 t13 t34 t37 t40 t41 t42 t46 t47 t75) -> ([Declaration]) happyOut84 x = Happy_GHC_Exts.unsafeCoerce# x {-# INLINE happyOut84 #-} happyIn85 :: (RHSOrTypeSigs) -> (HappyAbsSyn t11 t12 t13 t34 t37 t40 t41 t42 t46 t47 t75) happyIn85 x = Happy_GHC_Exts.unsafeCoerce# x {-# INLINE happyIn85 #-} happyOut85 :: (HappyAbsSyn t11 t12 t13 t34 t37 t40 t41 t42 t46 t47 t75) -> (RHSOrTypeSigs) happyOut85 x = Happy_GHC_Exts.unsafeCoerce# x {-# INLINE happyOut85 #-} happyIn86 :: (Declaration) -> (HappyAbsSyn t11 t12 t13 t34 t37 t40 t41 t42 t46 t47 t75) happyIn86 x = Happy_GHC_Exts.unsafeCoerce# x {-# INLINE happyIn86 #-} happyOut86 :: (HappyAbsSyn t11 t12 t13 t34 t37 t40 t41 t42 t46 t47 t75) -> (Declaration) happyOut86 x = Happy_GHC_Exts.unsafeCoerce# x {-# INLINE happyOut86 #-} happyIn87 :: (Declaration) -> (HappyAbsSyn t11 t12 t13 t34 t37 t40 t41 t42 t46 t47 t75) happyIn87 x = Happy_GHC_Exts.unsafeCoerce# x {-# INLINE happyIn87 #-} happyOut87 :: (HappyAbsSyn t11 t12 t13 t34 t37 t40 t41 t42 t46 t47 t75) -> (Declaration) happyOut87 x = Happy_GHC_Exts.unsafeCoerce# x {-# INLINE happyOut87 #-} happyIn88 :: (Declaration) -> (HappyAbsSyn t11 t12 t13 t34 t37 t40 t41 t42 t46 t47 t75) happyIn88 x = Happy_GHC_Exts.unsafeCoerce# x {-# INLINE happyIn88 #-} happyOut88 :: (HappyAbsSyn t11 t12 t13 t34 t37 t40 t41 t42 t46 t47 t75) -> (Declaration) happyOut88 x = Happy_GHC_Exts.unsafeCoerce# x {-# INLINE happyOut88 #-} happyIn89 :: (Declaration) -> (HappyAbsSyn t11 t12 t13 t34 t37 t40 t41 t42 t46 t47 t75) happyIn89 x = Happy_GHC_Exts.unsafeCoerce# x {-# INLINE happyIn89 #-} happyOut89 :: (HappyAbsSyn t11 t12 t13 t34 t37 t40 t41 t42 t46 t47 t75) -> (Declaration) happyOut89 x = Happy_GHC_Exts.unsafeCoerce# x {-# INLINE happyOut89 #-} happyIn90 :: (Name) -> (HappyAbsSyn t11 t12 t13 t34 t37 t40 t41 t42 t46 t47 t75) happyIn90 x = Happy_GHC_Exts.unsafeCoerce# x {-# INLINE happyIn90 #-} happyOut90 :: (HappyAbsSyn t11 t12 t13 t34 t37 t40 t41 t42 t46 t47 t75) -> (Name) happyOut90 x = Happy_GHC_Exts.unsafeCoerce# x {-# INLINE happyOut90 #-} happyIn91 :: (Declaration) -> (HappyAbsSyn t11 t12 t13 t34 t37 t40 t41 t42 t46 t47 t75) happyIn91 x = Happy_GHC_Exts.unsafeCoerce# x {-# INLINE happyIn91 #-} happyOut91 :: (HappyAbsSyn t11 t12 t13 t34 t37 t40 t41 t42 t46 t47 t75) -> (Declaration) happyOut91 x = Happy_GHC_Exts.unsafeCoerce# x {-# INLINE happyOut91 #-} happyIn92 :: ([Declaration]) -> (HappyAbsSyn t11 t12 t13 t34 t37 t40 t41 t42 t46 t47 t75) happyIn92 x = Happy_GHC_Exts.unsafeCoerce# x {-# INLINE happyIn92 #-} happyOut92 :: (HappyAbsSyn t11 t12 t13 t34 t37 t40 t41 t42 t46 t47 t75) -> ([Declaration]) happyOut92 x = Happy_GHC_Exts.unsafeCoerce# x {-# INLINE happyOut92 #-} happyIn93 :: (Declaration) -> (HappyAbsSyn t11 t12 t13 t34 t37 t40 t41 t42 t46 t47 t75) happyIn93 x = Happy_GHC_Exts.unsafeCoerce# x {-# INLINE happyIn93 #-} happyOut93 :: (HappyAbsSyn t11 t12 t13 t34 t37 t40 t41 t42 t46 t47 t75) -> (Declaration) happyOut93 x = Happy_GHC_Exts.unsafeCoerce# x {-# INLINE happyOut93 #-} happyIn94 :: (Declaration) -> (HappyAbsSyn t11 t12 t13 t34 t37 t40 t41 t42 t46 t47 t75) happyIn94 x = Happy_GHC_Exts.unsafeCoerce# x {-# INLINE happyIn94 #-} happyOut94 :: (HappyAbsSyn t11 t12 t13 t34 t37 t40 t41 t42 t46 t47 t75) -> (Declaration) happyOut94 x = Happy_GHC_Exts.unsafeCoerce# x {-# INLINE happyOut94 #-} happyIn95 :: (Declaration) -> (HappyAbsSyn t11 t12 t13 t34 t37 t40 t41 t42 t46 t47 t75) happyIn95 x = Happy_GHC_Exts.unsafeCoerce# x {-# INLINE happyIn95 #-} happyOut95 :: (HappyAbsSyn t11 t12 t13 t34 t37 t40 t41 t42 t46 t47 t75) -> (Declaration) happyOut95 x = Happy_GHC_Exts.unsafeCoerce# x {-# INLINE happyOut95 #-} happyIn96 :: (Declaration) -> (HappyAbsSyn t11 t12 t13 t34 t37 t40 t41 t42 t46 t47 t75) happyIn96 x = Happy_GHC_Exts.unsafeCoerce# x {-# INLINE happyIn96 #-} happyOut96 :: (HappyAbsSyn t11 t12 t13 t34 t37 t40 t41 t42 t46 t47 t75) -> (Declaration) happyOut96 x = Happy_GHC_Exts.unsafeCoerce# x {-# INLINE happyOut96 #-} happyIn97 :: (Declaration) -> (HappyAbsSyn t11 t12 t13 t34 t37 t40 t41 t42 t46 t47 t75) happyIn97 x = Happy_GHC_Exts.unsafeCoerce# x {-# INLINE happyIn97 #-} happyOut97 :: (HappyAbsSyn t11 t12 t13 t34 t37 t40 t41 t42 t46 t47 t75) -> (Declaration) happyOut97 x = Happy_GHC_Exts.unsafeCoerce# x {-# INLINE happyOut97 #-} happyIn98 :: (Declaration) -> (HappyAbsSyn t11 t12 t13 t34 t37 t40 t41 t42 t46 t47 t75) happyIn98 x = Happy_GHC_Exts.unsafeCoerce# x {-# INLINE happyIn98 #-} happyOut98 :: (HappyAbsSyn t11 t12 t13 t34 t37 t40 t41 t42 t46 t47 t75) -> (Declaration) happyOut98 x = Happy_GHC_Exts.unsafeCoerce# x {-# INLINE happyOut98 #-} happyIn99 :: (Declaration) -> (HappyAbsSyn t11 t12 t13 t34 t37 t40 t41 t42 t46 t47 t75) happyIn99 x = Happy_GHC_Exts.unsafeCoerce# x {-# INLINE happyIn99 #-} happyOut99 :: (HappyAbsSyn t11 t12 t13 t34 t37 t40 t41 t42 t46 t47 t75) -> (Declaration) happyOut99 x = Happy_GHC_Exts.unsafeCoerce# x {-# INLINE happyOut99 #-} happyIn100 :: (Declaration) -> (HappyAbsSyn t11 t12 t13 t34 t37 t40 t41 t42 t46 t47 t75) happyIn100 x = Happy_GHC_Exts.unsafeCoerce# x {-# INLINE happyIn100 #-} happyOut100 :: (HappyAbsSyn t11 t12 t13 t34 t37 t40 t41 t42 t46 t47 t75) -> (Declaration) happyOut100 x = Happy_GHC_Exts.unsafeCoerce# x {-# INLINE happyOut100 #-} happyIn101 :: (Declaration) -> (HappyAbsSyn t11 t12 t13 t34 t37 t40 t41 t42 t46 t47 t75) happyIn101 x = Happy_GHC_Exts.unsafeCoerce# x {-# INLINE happyIn101 #-} happyOut101 :: (HappyAbsSyn t11 t12 t13 t34 t37 t40 t41 t42 t46 t47 t75) -> (Declaration) happyOut101 x = Happy_GHC_Exts.unsafeCoerce# x {-# INLINE happyOut101 #-} happyIn102 :: ([Arg Name]) -> (HappyAbsSyn t11 t12 t13 t34 t37 t40 t41 t42 t46 t47 t75) happyIn102 x = Happy_GHC_Exts.unsafeCoerce# x {-# INLINE happyIn102 #-} happyOut102 :: (HappyAbsSyn t11 t12 t13 t34 t37 t40 t41 t42 t46 t47 t75) -> ([Arg Name]) happyOut102 x = Happy_GHC_Exts.unsafeCoerce# x {-# INLINE happyOut102 #-} happyIn103 :: ([RString]) -> (HappyAbsSyn t11 t12 t13 t34 t37 t40 t41 t42 t46 t47 t75) happyIn103 x = Happy_GHC_Exts.unsafeCoerce# x {-# INLINE happyIn103 #-} happyOut103 :: (HappyAbsSyn t11 t12 t13 t34 t37 t40 t41 t42 t46 t47 t75) -> ([RString]) happyOut103 x = Happy_GHC_Exts.unsafeCoerce# x {-# INLINE happyOut103 #-} happyIn104 :: ([NamedArg HoleName]) -> (HappyAbsSyn t11 t12 t13 t34 t37 t40 t41 t42 t46 t47 t75) happyIn104 x = Happy_GHC_Exts.unsafeCoerce# x {-# INLINE happyIn104 #-} happyOut104 :: (HappyAbsSyn t11 t12 t13 t34 t37 t40 t41 t42 t46 t47 t75) -> ([NamedArg HoleName]) happyOut104 x = Happy_GHC_Exts.unsafeCoerce# x {-# INLINE happyOut104 #-} happyIn105 :: (NamedArg HoleName) -> (HappyAbsSyn t11 t12 t13 t34 t37 t40 t41 t42 t46 t47 t75) happyIn105 x = Happy_GHC_Exts.unsafeCoerce# x {-# INLINE happyIn105 #-} happyOut105 :: (HappyAbsSyn t11 t12 t13 t34 t37 t40 t41 t42 t46 t47 t75) -> (NamedArg HoleName) happyOut105 x = Happy_GHC_Exts.unsafeCoerce# x {-# INLINE happyOut105 #-} happyIn106 :: (HoleName) -> (HappyAbsSyn t11 t12 t13 t34 t37 t40 t41 t42 t46 t47 t75) happyIn106 x = Happy_GHC_Exts.unsafeCoerce# x {-# INLINE happyIn106 #-} happyOut106 :: (HappyAbsSyn t11 t12 t13 t34 t37 t40 t41 t42 t46 t47 t75) -> (HoleName) happyOut106 x = Happy_GHC_Exts.unsafeCoerce# x {-# INLINE happyOut106 #-} happyIn107 :: (HoleName) -> (HappyAbsSyn t11 t12 t13 t34 t37 t40 t41 t42 t46 t47 t75) happyIn107 x = Happy_GHC_Exts.unsafeCoerce# x {-# INLINE happyIn107 #-} happyOut107 :: (HappyAbsSyn t11 t12 t13 t34 t37 t40 t41 t42 t46 t47 t75) -> (HoleName) happyOut107 x = Happy_GHC_Exts.unsafeCoerce# x {-# INLINE happyOut107 #-} happyIn108 :: (RString) -> (HappyAbsSyn t11 t12 t13 t34 t37 t40 t41 t42 t46 t47 t75) happyIn108 x = Happy_GHC_Exts.unsafeCoerce# x {-# INLINE happyIn108 #-} happyOut108 :: (HappyAbsSyn t11 t12 t13 t34 t37 t40 t41 t42 t46 t47 t75) -> (RString) happyOut108 x = Happy_GHC_Exts.unsafeCoerce# x {-# INLINE happyOut108 #-} happyIn109 :: (Maybe Range) -> (HappyAbsSyn t11 t12 t13 t34 t37 t40 t41 t42 t46 t47 t75) happyIn109 x = Happy_GHC_Exts.unsafeCoerce# x {-# INLINE happyIn109 #-} happyOut109 :: (HappyAbsSyn t11 t12 t13 t34 t37 t40 t41 t42 t46 t47 t75) -> (Maybe Range) happyOut109 x = Happy_GHC_Exts.unsafeCoerce# x {-# INLINE happyOut109 #-} happyIn110 :: ([Declaration]) -> (HappyAbsSyn t11 t12 t13 t34 t37 t40 t41 t42 t46 t47 t75) happyIn110 x = Happy_GHC_Exts.unsafeCoerce# x {-# INLINE happyIn110 #-} happyOut110 :: (HappyAbsSyn t11 t12 t13 t34 t37 t40 t41 t42 t46 t47 t75) -> ([Declaration]) happyOut110 x = Happy_GHC_Exts.unsafeCoerce# x {-# INLINE happyOut110 #-} happyIn111 :: ([Expr]) -> (HappyAbsSyn t11 t12 t13 t34 t37 t40 t41 t42 t46 t47 t75) happyIn111 x = Happy_GHC_Exts.unsafeCoerce# x {-# INLINE happyIn111 #-} happyOut111 :: (HappyAbsSyn t11 t12 t13 t34 t37 t40 t41 t42 t46 t47 t75) -> ([Expr]) happyOut111 x = Happy_GHC_Exts.unsafeCoerce# x {-# INLINE happyOut111 #-} happyIn112 :: ([TypedBindings] -> Parser ModuleApplication) -> (HappyAbsSyn t11 t12 t13 t34 t37 t40 t41 t42 t46 t47 t75) happyIn112 x = Happy_GHC_Exts.unsafeCoerce# x {-# INLINE happyIn112 #-} happyOut112 :: (HappyAbsSyn t11 t12 t13 t34 t37 t40 t41 t42 t46 t47 t75) -> ([TypedBindings] -> Parser ModuleApplication) happyOut112 x = Happy_GHC_Exts.unsafeCoerce# x {-# INLINE happyOut112 #-} happyIn113 :: (Declaration) -> (HappyAbsSyn t11 t12 t13 t34 t37 t40 t41 t42 t46 t47 t75) happyIn113 x = Happy_GHC_Exts.unsafeCoerce# x {-# INLINE happyIn113 #-} happyOut113 :: (HappyAbsSyn t11 t12 t13 t34 t37 t40 t41 t42 t46 t47 t75) -> (Declaration) happyOut113 x = Happy_GHC_Exts.unsafeCoerce# x {-# INLINE happyOut113 #-} happyIn114 :: (Declaration) -> (HappyAbsSyn t11 t12 t13 t34 t37 t40 t41 t42 t46 t47 t75) happyIn114 x = Happy_GHC_Exts.unsafeCoerce# x {-# INLINE happyIn114 #-} happyOut114 :: (HappyAbsSyn t11 t12 t13 t34 t37 t40 t41 t42 t46 t47 t75) -> (Declaration) happyOut114 x = Happy_GHC_Exts.unsafeCoerce# x {-# INLINE happyOut114 #-} happyIn115 :: (Name) -> (HappyAbsSyn t11 t12 t13 t34 t37 t40 t41 t42 t46 t47 t75) happyIn115 x = Happy_GHC_Exts.unsafeCoerce# x {-# INLINE happyIn115 #-} happyOut115 :: (HappyAbsSyn t11 t12 t13 t34 t37 t40 t41 t42 t46 t47 t75) -> (Name) happyOut115 x = Happy_GHC_Exts.unsafeCoerce# x {-# INLINE happyOut115 #-} happyIn116 :: ([Declaration]) -> (HappyAbsSyn t11 t12 t13 t34 t37 t40 t41 t42 t46 t47 t75) happyIn116 x = Happy_GHC_Exts.unsafeCoerce# x {-# INLINE happyIn116 #-} happyOut116 :: (HappyAbsSyn t11 t12 t13 t34 t37 t40 t41 t42 t46 t47 t75) -> ([Declaration]) happyOut116 x = Happy_GHC_Exts.unsafeCoerce# x {-# INLINE happyOut116 #-} happyIn117 :: (Declaration) -> (HappyAbsSyn t11 t12 t13 t34 t37 t40 t41 t42 t46 t47 t75) happyIn117 x = Happy_GHC_Exts.unsafeCoerce# x {-# INLINE happyIn117 #-} happyOut117 :: (HappyAbsSyn t11 t12 t13 t34 t37 t40 t41 t42 t46 t47 t75) -> (Declaration) happyOut117 x = Happy_GHC_Exts.unsafeCoerce# x {-# INLINE happyOut117 #-} happyIn118 :: (Pragma) -> (HappyAbsSyn t11 t12 t13 t34 t37 t40 t41 t42 t46 t47 t75) happyIn118 x = Happy_GHC_Exts.unsafeCoerce# x {-# INLINE happyIn118 #-} happyOut118 :: (HappyAbsSyn t11 t12 t13 t34 t37 t40 t41 t42 t46 t47 t75) -> (Pragma) happyOut118 x = Happy_GHC_Exts.unsafeCoerce# x {-# INLINE happyOut118 #-} happyIn119 :: (Pragma) -> (HappyAbsSyn t11 t12 t13 t34 t37 t40 t41 t42 t46 t47 t75) happyIn119 x = Happy_GHC_Exts.unsafeCoerce# x {-# INLINE happyIn119 #-} happyOut119 :: (HappyAbsSyn t11 t12 t13 t34 t37 t40 t41 t42 t46 t47 t75) -> (Pragma) happyOut119 x = Happy_GHC_Exts.unsafeCoerce# x {-# INLINE happyOut119 #-} happyIn120 :: (Pragma) -> (HappyAbsSyn t11 t12 t13 t34 t37 t40 t41 t42 t46 t47 t75) happyIn120 x = Happy_GHC_Exts.unsafeCoerce# x {-# INLINE happyIn120 #-} happyOut120 :: (HappyAbsSyn t11 t12 t13 t34 t37 t40 t41 t42 t46 t47 t75) -> (Pragma) happyOut120 x = Happy_GHC_Exts.unsafeCoerce# x {-# INLINE happyOut120 #-} happyIn121 :: (Pragma) -> (HappyAbsSyn t11 t12 t13 t34 t37 t40 t41 t42 t46 t47 t75) happyIn121 x = Happy_GHC_Exts.unsafeCoerce# x {-# INLINE happyIn121 #-} happyOut121 :: (HappyAbsSyn t11 t12 t13 t34 t37 t40 t41 t42 t46 t47 t75) -> (Pragma) happyOut121 x = Happy_GHC_Exts.unsafeCoerce# x {-# INLINE happyOut121 #-} happyIn122 :: (Pragma) -> (HappyAbsSyn t11 t12 t13 t34 t37 t40 t41 t42 t46 t47 t75) happyIn122 x = Happy_GHC_Exts.unsafeCoerce# x {-# INLINE happyIn122 #-} happyOut122 :: (HappyAbsSyn t11 t12 t13 t34 t37 t40 t41 t42 t46 t47 t75) -> (Pragma) happyOut122 x = Happy_GHC_Exts.unsafeCoerce# x {-# INLINE happyOut122 #-} happyIn123 :: (Pragma) -> (HappyAbsSyn t11 t12 t13 t34 t37 t40 t41 t42 t46 t47 t75) happyIn123 x = Happy_GHC_Exts.unsafeCoerce# x {-# INLINE happyIn123 #-} happyOut123 :: (HappyAbsSyn t11 t12 t13 t34 t37 t40 t41 t42 t46 t47 t75) -> (Pragma) happyOut123 x = Happy_GHC_Exts.unsafeCoerce# x {-# INLINE happyOut123 #-} happyIn124 :: (Pragma) -> (HappyAbsSyn t11 t12 t13 t34 t37 t40 t41 t42 t46 t47 t75) happyIn124 x = Happy_GHC_Exts.unsafeCoerce# x {-# INLINE happyIn124 #-} happyOut124 :: (HappyAbsSyn t11 t12 t13 t34 t37 t40 t41 t42 t46 t47 t75) -> (Pragma) happyOut124 x = Happy_GHC_Exts.unsafeCoerce# x {-# INLINE happyOut124 #-} happyIn125 :: (Pragma) -> (HappyAbsSyn t11 t12 t13 t34 t37 t40 t41 t42 t46 t47 t75) happyIn125 x = Happy_GHC_Exts.unsafeCoerce# x {-# INLINE happyIn125 #-} happyOut125 :: (HappyAbsSyn t11 t12 t13 t34 t37 t40 t41 t42 t46 t47 t75) -> (Pragma) happyOut125 x = Happy_GHC_Exts.unsafeCoerce# x {-# INLINE happyOut125 #-} happyIn126 :: (Pragma) -> (HappyAbsSyn t11 t12 t13 t34 t37 t40 t41 t42 t46 t47 t75) happyIn126 x = Happy_GHC_Exts.unsafeCoerce# x {-# INLINE happyIn126 #-} happyOut126 :: (HappyAbsSyn t11 t12 t13 t34 t37 t40 t41 t42 t46 t47 t75) -> (Pragma) happyOut126 x = Happy_GHC_Exts.unsafeCoerce# x {-# INLINE happyOut126 #-} happyIn127 :: (Pragma) -> (HappyAbsSyn t11 t12 t13 t34 t37 t40 t41 t42 t46 t47 t75) happyIn127 x = Happy_GHC_Exts.unsafeCoerce# x {-# INLINE happyIn127 #-} happyOut127 :: (HappyAbsSyn t11 t12 t13 t34 t37 t40 t41 t42 t46 t47 t75) -> (Pragma) happyOut127 x = Happy_GHC_Exts.unsafeCoerce# x {-# INLINE happyOut127 #-} happyIn128 :: (Pragma) -> (HappyAbsSyn t11 t12 t13 t34 t37 t40 t41 t42 t46 t47 t75) happyIn128 x = Happy_GHC_Exts.unsafeCoerce# x {-# INLINE happyIn128 #-} happyOut128 :: (HappyAbsSyn t11 t12 t13 t34 t37 t40 t41 t42 t46 t47 t75) -> (Pragma) happyOut128 x = Happy_GHC_Exts.unsafeCoerce# x {-# INLINE happyOut128 #-} happyIn129 :: (Pragma) -> (HappyAbsSyn t11 t12 t13 t34 t37 t40 t41 t42 t46 t47 t75) happyIn129 x = Happy_GHC_Exts.unsafeCoerce# x {-# INLINE happyIn129 #-} happyOut129 :: (HappyAbsSyn t11 t12 t13 t34 t37 t40 t41 t42 t46 t47 t75) -> (Pragma) happyOut129 x = Happy_GHC_Exts.unsafeCoerce# x {-# INLINE happyOut129 #-} happyIn130 :: (Pragma) -> (HappyAbsSyn t11 t12 t13 t34 t37 t40 t41 t42 t46 t47 t75) happyIn130 x = Happy_GHC_Exts.unsafeCoerce# x {-# INLINE happyIn130 #-} happyOut130 :: (HappyAbsSyn t11 t12 t13 t34 t37 t40 t41 t42 t46 t47 t75) -> (Pragma) happyOut130 x = Happy_GHC_Exts.unsafeCoerce# x {-# INLINE happyOut130 #-} happyIn131 :: (Pragma) -> (HappyAbsSyn t11 t12 t13 t34 t37 t40 t41 t42 t46 t47 t75) happyIn131 x = Happy_GHC_Exts.unsafeCoerce# x {-# INLINE happyIn131 #-} happyOut131 :: (HappyAbsSyn t11 t12 t13 t34 t37 t40 t41 t42 t46 t47 t75) -> (Pragma) happyOut131 x = Happy_GHC_Exts.unsafeCoerce# x {-# INLINE happyOut131 #-} happyIn132 :: (Pragma) -> (HappyAbsSyn t11 t12 t13 t34 t37 t40 t41 t42 t46 t47 t75) happyIn132 x = Happy_GHC_Exts.unsafeCoerce# x {-# INLINE happyIn132 #-} happyOut132 :: (HappyAbsSyn t11 t12 t13 t34 t37 t40 t41 t42 t46 t47 t75) -> (Pragma) happyOut132 x = Happy_GHC_Exts.unsafeCoerce# x {-# INLINE happyOut132 #-} happyIn133 :: (Pragma) -> (HappyAbsSyn t11 t12 t13 t34 t37 t40 t41 t42 t46 t47 t75) happyIn133 x = Happy_GHC_Exts.unsafeCoerce# x {-# INLINE happyIn133 #-} happyOut133 :: (HappyAbsSyn t11 t12 t13 t34 t37 t40 t41 t42 t46 t47 t75) -> (Pragma) happyOut133 x = Happy_GHC_Exts.unsafeCoerce# x {-# INLINE happyOut133 #-} happyIn134 :: (Pragma) -> (HappyAbsSyn t11 t12 t13 t34 t37 t40 t41 t42 t46 t47 t75) happyIn134 x = Happy_GHC_Exts.unsafeCoerce# x {-# INLINE happyIn134 #-} happyOut134 :: (HappyAbsSyn t11 t12 t13 t34 t37 t40 t41 t42 t46 t47 t75) -> (Pragma) happyOut134 x = Happy_GHC_Exts.unsafeCoerce# x {-# INLINE happyOut134 #-} happyIn135 :: (Pragma) -> (HappyAbsSyn t11 t12 t13 t34 t37 t40 t41 t42 t46 t47 t75) happyIn135 x = Happy_GHC_Exts.unsafeCoerce# x {-# INLINE happyIn135 #-} happyOut135 :: (HappyAbsSyn t11 t12 t13 t34 t37 t40 t41 t42 t46 t47 t75) -> (Pragma) happyOut135 x = Happy_GHC_Exts.unsafeCoerce# x {-# INLINE happyOut135 #-} happyIn136 :: ([TypeSignature]) -> (HappyAbsSyn t11 t12 t13 t34 t37 t40 t41 t42 t46 t47 t75) happyIn136 x = Happy_GHC_Exts.unsafeCoerce# x {-# INLINE happyIn136 #-} happyOut136 :: (HappyAbsSyn t11 t12 t13 t34 t37 t40 t41 t42 t46 t47 t75) -> ([TypeSignature]) happyOut136 x = Happy_GHC_Exts.unsafeCoerce# x {-# INLINE happyOut136 #-} happyIn137 :: ([TypeSignature]) -> (HappyAbsSyn t11 t12 t13 t34 t37 t40 t41 t42 t46 t47 t75) happyIn137 x = Happy_GHC_Exts.unsafeCoerce# x {-# INLINE happyIn137 #-} happyOut137 :: (HappyAbsSyn t11 t12 t13 t34 t37 t40 t41 t42 t46 t47 t75) -> ([TypeSignature]) happyOut137 x = Happy_GHC_Exts.unsafeCoerce# x {-# INLINE happyOut137 #-} happyIn138 :: ([Arg TypeSignature]) -> (HappyAbsSyn t11 t12 t13 t34 t37 t40 t41 t42 t46 t47 t75) happyIn138 x = Happy_GHC_Exts.unsafeCoerce# x {-# INLINE happyIn138 #-} happyOut138 :: (HappyAbsSyn t11 t12 t13 t34 t37 t40 t41 t42 t46 t47 t75) -> ([Arg TypeSignature]) happyOut138 x = Happy_GHC_Exts.unsafeCoerce# x {-# INLINE happyOut138 #-} happyIn139 :: ([Arg TypeSignature]) -> (HappyAbsSyn t11 t12 t13 t34 t37 t40 t41 t42 t46 t47 t75) happyIn139 x = Happy_GHC_Exts.unsafeCoerce# x {-# INLINE happyIn139 #-} happyOut139 :: (HappyAbsSyn t11 t12 t13 t34 t37 t40 t41 t42 t46 t47 t75) -> ([Arg TypeSignature]) happyOut139 x = Happy_GHC_Exts.unsafeCoerce# x {-# INLINE happyOut139 #-} happyIn140 :: ([Constructor]) -> (HappyAbsSyn t11 t12 t13 t34 t37 t40 t41 t42 t46 t47 t75) happyIn140 x = Happy_GHC_Exts.unsafeCoerce# x {-# INLINE happyIn140 #-} happyOut140 :: (HappyAbsSyn t11 t12 t13 t34 t37 t40 t41 t42 t46 t47 t75) -> ([Constructor]) happyOut140 x = Happy_GHC_Exts.unsafeCoerce# x {-# INLINE happyOut140 #-} happyIn141 :: ((Maybe (Ranged Induction), Maybe Name, [Declaration])) -> (HappyAbsSyn t11 t12 t13 t34 t37 t40 t41 t42 t46 t47 t75) happyIn141 x = Happy_GHC_Exts.unsafeCoerce# x {-# INLINE happyIn141 #-} happyOut141 :: (HappyAbsSyn t11 t12 t13 t34 t37 t40 t41 t42 t46 t47 t75) -> ((Maybe (Ranged Induction), Maybe Name, [Declaration])) happyOut141 x = Happy_GHC_Exts.unsafeCoerce# x {-# INLINE happyOut141 #-} happyIn142 :: (Ranged Induction) -> (HappyAbsSyn t11 t12 t13 t34 t37 t40 t41 t42 t46 t47 t75) happyIn142 x = Happy_GHC_Exts.unsafeCoerce# x {-# INLINE happyIn142 #-} happyOut142 :: (HappyAbsSyn t11 t12 t13 t34 t37 t40 t41 t42 t46 t47 t75) -> (Ranged Induction) happyOut142 x = Happy_GHC_Exts.unsafeCoerce# x {-# INLINE happyOut142 #-} happyIn143 :: ([Declaration]) -> (HappyAbsSyn t11 t12 t13 t34 t37 t40 t41 t42 t46 t47 t75) happyIn143 x = Happy_GHC_Exts.unsafeCoerce# x {-# INLINE happyIn143 #-} happyOut143 :: (HappyAbsSyn t11 t12 t13 t34 t37 t40 t41 t42 t46 t47 t75) -> ([Declaration]) happyOut143 x = Happy_GHC_Exts.unsafeCoerce# x {-# INLINE happyOut143 #-} happyIn144 :: ([Declaration]) -> (HappyAbsSyn t11 t12 t13 t34 t37 t40 t41 t42 t46 t47 t75) happyIn144 x = Happy_GHC_Exts.unsafeCoerce# x {-# INLINE happyIn144 #-} happyOut144 :: (HappyAbsSyn t11 t12 t13 t34 t37 t40 t41 t42 t46 t47 t75) -> ([Declaration]) happyOut144 x = Happy_GHC_Exts.unsafeCoerce# x {-# INLINE happyOut144 #-} happyIn145 :: ([Declaration]) -> (HappyAbsSyn t11 t12 t13 t34 t37 t40 t41 t42 t46 t47 t75) happyIn145 x = Happy_GHC_Exts.unsafeCoerce# x {-# INLINE happyIn145 #-} happyOut145 :: (HappyAbsSyn t11 t12 t13 t34 t37 t40 t41 t42 t46 t47 t75) -> ([Declaration]) happyOut145 x = Happy_GHC_Exts.unsafeCoerce# x {-# INLINE happyOut145 #-} happyIn146 :: ([Declaration]) -> (HappyAbsSyn t11 t12 t13 t34 t37 t40 t41 t42 t46 t47 t75) happyIn146 x = Happy_GHC_Exts.unsafeCoerce# x {-# INLINE happyIn146 #-} happyOut146 :: (HappyAbsSyn t11 t12 t13 t34 t37 t40 t41 t42 t46 t47 t75) -> ([Declaration]) happyOut146 x = Happy_GHC_Exts.unsafeCoerce# x {-# INLINE happyOut146 #-} happyInTok :: (Token) -> (HappyAbsSyn t11 t12 t13 t34 t37 t40 t41 t42 t46 t47 t75) happyInTok x = Happy_GHC_Exts.unsafeCoerce# x {-# INLINE happyInTok #-} happyOutTok :: (HappyAbsSyn t11 t12 t13 t34 t37 t40 t41 t42 t46 t47 t75) -> (Token) happyOutTok x = Happy_GHC_Exts.unsafeCoerce# x {-# INLINE happyOutTok #-} happyActOffsets :: HappyAddr happyActOffsets = HappyA# "\x00\x00\xdf\x09\xa6\x06\x0a\x04\x00\x00\xd4\x04\x00\x00\x00\x00\x98\x06\x00\x00\x00\x00\x98\x06\x7b\x04\x9d\x06\x00\x00\x96\x06\xa7\x06\x00\x00\x00\x00\x00\x00\x00\x00\xfb\x01\x00\x00\x00\x00\x92\x08\xdf\x09\xa2\x06\x00\x00\x0f\x04\x6b\x0f\x92\x06\x00\x00\x00\x00\x8c\x06\x8c\x06\x00\x00\xfa\x0a\x00\x00\xe3\x0a\x00\x00\x00\x00\x50\x02\xa4\x0a\x00\x00\x00\x00\x68\x0f\x86\x06\x45\x06\x79\x08\x00\x00\x7e\x06\x97\x06\x00\x00\x91\x06\xc9\x01\x8e\x06\x00\x00\x00\x00\x44\x02\x44\x02\x00\x00\x89\x06\x94\x06\x8a\x06\x59\x01\x88\x06\xc5\x06\x84\x06\x7c\x06\x0a\x04\x00\x00\x00\x00\x00\x00\x16\x05\xdf\x09\x00\x00\x83\x06\x00\x00\xe2\x0a\x65\x04\x3a\x03\xc2\x02\x00\x00\x3a\x08\xf9\x07\x9e\x09\x00\x00\x8d\x0a\xe0\x07\x45\x06\x9f\x07\xf8\x09\xf8\x09\xf8\x09\x7f\x06\x8d\x0a\x60\x07\x45\x06\x1f\x07\x79\x06\x6e\x06\xb5\x06\xb4\x06\xae\x06\x84\x05\xc7\x0a\x85\x09\x70\x06\xc7\x0a\x00\x00\x46\x09\xf8\x09\xf8\x09\x00\x00\x18\x02\xf8\x09\xf8\x09\x00\x00\x00\x00\x00\x00\x00\x00\x2d\x09\xf8\x09\x2d\x09\x8d\x0a\x95\x06\x68\x06\x64\x04\x3c\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x54\x06\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x64\x06\x5e\x06\x5e\x06\x62\x06\x5e\x01\x5e\x01\x5e\x01\x60\x06\x5b\x00\x60\x06\xb2\x00\x59\x06\x5d\x06\x5a\x06\x58\x06\x4e\x0a\x57\x06\x57\x06\x53\x06\x97\x0f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xda\xff\x48\x06\x48\x06\x48\x06\x48\x06\x48\x06\x48\x06\x48\x06\x41\x06\x43\x06\x3e\x06\x3c\x06\x3a\x06\x34\x06\x2c\x06\x2c\x06\x2e\x06\x61\x06\x37\x0a\x38\x06\x7f\x01\x8c\x0a\x00\x00\x00\x00\x25\x06\x00\x00\x71\x0a\x3b\x03\x25\x06\x00\x00\x36\x0a\x36\x0a\x00\x00\x00\x00\xff\x00\x00\x00\x00\x00\xff\x00\xff\x00\x00\x00\xc7\x03\x36\x0a\x36\x0a\x00\x00\x00\x00\x00\x00\x84\x05\x00\x00\x00\x00\x0f\x00\x2d\x09\x2d\x09\x50\x06\xf8\x09\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xf8\x09\xf8\x09\xf8\x09\xf8\x09\x22\x06\x31\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x10\x00\x2d\x09\x2d\x09\x2d\x09\x2d\x06\x1a\x06\x00\x00\x26\x06\x03\x06\xf8\x09\x0c\x06\x44\x02\x0b\x06\x08\x06\x44\x02\xff\x05\x30\x01\x0e\x06\x00\x00\xe2\x00\xd3\x00\x09\x06\x07\x06\xfb\x05\x00\x00\xf8\x09\xf8\x09\x00\x00\xf8\x09\xf8\x09\x1b\x0a\xfa\x05\x1b\x0a\xe0\x06\x9f\x06\xec\x08\x00\x00\x00\x00\xf4\x05\xfa\xff\x00\x00\x02\x04\x00\x00\x00\x00\xd3\x08\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xd3\x08\x00\x00\x00\x00\xc3\x02\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x66\x00\x31\x01\x4e\x00\x31\x01\xf8\x09\x00\x00\xf8\x09\xd3\x08\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xea\x05\xe3\x05\x00\x00\xd3\x08\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xd3\x08\x00\x00\x00\x00\x00\x00\xd2\x00\xe0\x05\x00\x00\x2d\x08\xb9\x00\x2d\x08\xa3\x00\x00\x00\xc7\x03\xe6\x05\x00\x00\x3d\x00\x7e\x01\x07\x01\xd5\xff\xd5\xff\xd1\x00\x00\x00\x00\x00\x00\x00\xfe\x05\xeb\xff\x2d\x08\xc3\x02\x1b\x00\x04\x06\x00\x00\xd7\x05\xc2\x05\xd4\x05\x00\x00\x3d\x00\x69\x00\xf8\x09\x4a\x02\x00\x00\x00\x00\x00\x00\xce\x05\xb5\x00\xb5\x00\x00\x00\xd3\x08\xca\x05\xaf\x05\x00\x00\xba\x05\x00\x00\xb8\x05\xb5\x05\xad\x05\x00\x00\x00\x00\xb1\x05\x00\x00\x00\x00\xac\x05\xab\x05\xa3\x05\xa3\x05\x9f\x05\x9e\x05\x90\x05\x8e\x05\x8b\x05\x8b\x05\x82\x05\x81\x05\x80\x05\x7a\x05\x7b\x05\x79\x05\x00\x00\x78\x05\x6f\x05\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x72\x05\x7d\x05\x69\x05\x6b\x05\x71\x05\x57\x05\x00\x00\x57\x05\x1d\x00\x5b\x05\xd3\x08\x00\x00\x4f\x05\xd3\x08\x00\x00\xd3\x08\xef\x00\x00\x00\x00\x00\x1b\x00\x00\x00\x00\x00\x59\x05\x00\x00\x53\x05\x44\x05\x00\x00\x4a\x05\x3c\x05\x02\x04\x3c\x05\x00\x00\xd5\xff\x39\x05\x2e\x05\xef\x00\x00\x00\x2e\x05\x2e\x05\x2e\x05\x2e\x05\x00\x00\xc7\x03\xd3\x08\x00\x00\x30\x05\xd3\x08\x00\x00\x30\x05\xd3\x08\x00\x00\x00\x00\x00\x00\x23\x04\x56\x05\x55\x05\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x1b\x00\x00\x00\x29\x05\x29\x05\x00\x00\x4d\x05\x00\x00\x00\x00\x0a\x00\x47\x05\x00\x00\x00\x00\x00\x00\x28\x05\xef\x00\x25\x05\xef\x00\xc7\x03\xc7\x03\x00\x00\x00\x00\x4b\x02\x1b\x00\x00\x00\x02\x04\xf2\xff\xf8\xff\xf2\xff\x00\x00\x1b\x00\x00\x00\x00\x00\x00\x00\x41\x05\x00\x00\xca\x03\x19\x05\x00\x00\x22\x05\xb5\x00\x00\x00\x20\x05\xb5\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x11\x05\x00\x00\x00\x00\x00\x00\x00\x00\x14\x05\x00\x00\x0c\x05\x0e\x05\x04\x05\x00\x00\x00\x00\x3d\x00\x3d\x00\x10\x00\x00\x00\x03\x05\x00\x00\x07\x05\x00\x00\x00\x00\x12\x05\x00\x05\x00\x00\xf0\x04\xf0\x04\xeb\x04\xf4\x04\x10\x05\x00\x00\x00\x00\x87\x04\x1b\x00\x00\x00\x00\x00\xc3\x05\x00\x00\x00\x00\xc7\x03\xc7\x03\xc7\x03\xc7\x03\x7d\x04\x00\x00\x7d\x04\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xef\x00\x00\x00\x00\x00\x7a\x04\x7a\x04\xb5\x04\x00\x00\x00\x00\x00\x00\x00\x00\xf2\xff\x00\x00\x00\x00\x00\x00\x00\x00\x2c\x05\x00\x00\x84\x05\x78\x04\x00\x00\x00\x00\x00\x00\x00\x00\x10\x00\x3d\x00\x10\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x84\x05\x00\x00\x10\x00\x00\x00\x00\x00"# happyGotoOffsets :: HappyAddr happyGotoOffsets = HappyA# "\x52\x04\x7c\x0f\xc1\x04\x41\x04\xc0\x04\xbc\x04\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xf0\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x52\x03\x60\x0f\x00\x00\x00\x00\xe3\x03\x03\x00\x35\x04\x00\x00\x00\x00\xaf\x04\xae\x04\x00\x00\xa5\x01\x00\x00\xf0\x06\x00\x00\x00\x00\x00\x00\xa4\x05\x00\x00\x00\x00\x70\x01\x0f\x01\x98\x0b\xd2\x0b\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xaa\x04\xa9\x04\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x2a\x04\x39\x02\x00\x00\x00\x00\x00\x00\x43\x05\x44\x0f\x00\x00\x00\x00\x00\x00\x4b\x04\x00\x00\x17\x01\xf5\x00\x00\x00\x84\x01\x77\x07\x38\x0b\x00\x00\xa4\x05\x53\x0b\x75\x0b\xb5\x0b\xf7\x06\xc1\x0c\xa4\x0c\x00\x00\x5c\x06\x28\x0f\xdc\x0c\x0c\x0f\x00\x00\xb3\x00\x00\x00\x00\x00\x00\x00\x48\x03\x92\x04\xf0\x0e\x00\x00\x3a\x04\x00\x00\x84\x01\x9d\x0c\x80\x0c\x00\x00\x00\x00\x79\x0c\x5c\x0c\x00\x00\x00\x00\x00\x00\x00\x00\xd4\x0e\xda\x02\xb8\x0e\x73\x01\x68\x04\x00\x00\x5c\x04\xa2\x04\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x9e\x04\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x12\x04\x8b\x04\x7c\x04\xfc\x03\x6f\x04\x66\x04\x5a\x04\xe4\x03\x1c\x00\xdd\x03\x39\x02\x51\x04\xc5\x03\xc1\x03\xa5\x03\xfa\x00\x22\x04\x1e\x04\xf6\x03\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x08\x04\x05\x04\xfe\x03\xf9\x03\xf0\x03\xe7\x03\xbb\x03\x00\x00\x00\x00\xb1\x03\x00\x00\x00\x00\x97\x03\x8e\x03\x7d\x03\x00\x00\x4c\x03\x1b\x06\x00\x00\xb1\x02\x7e\x05\x00\x00\x00\x00\x1e\x00\x00\x00\x7b\x00\x9d\x00\x81\x03\x00\x00\x26\x05\x75\x04\x00\x00\x00\x00\xe4\x01\x00\x00\x00\x00\xbf\x01\x86\x01\x00\x00\x18\x00\x71\x03\xf9\x02\x00\x00\x00\x00\x00\x00\xd0\x02\x00\x00\x00\x00\x38\x03\x9c\x0e\x80\x0e\x3c\x03\x62\x02\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x05\x02\xda\x05\x55\x0c\x38\x0c\x00\x00\x6e\x03\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x69\x03\x64\x0e\x48\x0e\x2c\x0e\x00\x00\x00\x00\x00\x00\x00\x00\x89\x00\xe8\x01\x00\x00\x57\x03\x00\x00\x00\x00\x54\x03\x00\x00\x00\x00\x00\x00\x00\x00\x50\x03\x4e\x03\x00\x00\x00\x00\x00\x00\x00\x00\x31\x0c\x14\x0c\x00\x00\x0d\x0c\x51\x08\x1d\x04\x00\x00\xe1\x03\x84\x01\x36\x07\xb6\x07\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xea\x01\x00\x00\x00\x00\x10\x0e\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xf4\x0d\x00\x00\x00\x00\x98\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x47\x03\x00\x00\x11\x03\x55\x06\x00\x00\x14\x06\xd8\x0d\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x0d\x00\x00\x00\xbc\x0d\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xa0\x0d\x00\x00\x00\x00\x00\x00\x19\x00\x76\x03\x00\x00\x81\x02\x00\x00\xe7\x01\x00\x00\x00\x00\x5d\x04\x00\x00\x00\x00\xaf\x03\x00\x00\x26\x03\x2c\x03\xf8\x02\x79\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xe3\x01\x95\x00\xf1\x05\xdc\x0c\x00\x00\x00\x00\xa7\x03\x00\x00\x00\x00\xa6\x03\x00\x00\xef\x0b\x29\x03\x00\x00\x00\x00\x00\x00\x00\x00\x18\x03\x13\x03\x00\x00\x84\x0d\xc5\x02\xd7\x02\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xf3\x02\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xd4\x02\xd1\x02\xc7\x02\xc6\x02\x00\x00\xc4\x02\x9e\x02\x8d\x02\x00\x00\x00\x00\x00\x00\x8e\x02\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x36\x02\x00\x00\x00\x00\x08\x02\x00\x00\xb2\x01\x00\x00\xf6\x01\x68\x0d\x00\x00\x35\x00\x4c\x0d\x00\x00\x30\x0d\x64\x02\x00\x00\x00\x00\x31\x06\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xe4\x02\x20\x00\xd5\x02\x00\x00\xb4\x02\x00\x00\x22\x02\x34\x02\x00\x00\x33\x03\x2a\x03\xf6\x02\xeb\x02\x00\x00\xb8\x00\x14\x0d\x00\x00\xed\x01\xf8\x0c\x00\x00\x98\x01\xda\x03\x00\x00\x00\x00\x00\x00\x78\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xb6\x05\x00\x00\x5d\x02\x3c\x02\x00\x00\x00\x00\x00\x00\x00\x00\xfd\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x28\x02\x00\x00\xca\x01\xe5\x03\x80\x02\x00\x00\x00\x00\x3b\x00\xb0\x05\x00\x00\xff\xff\xd7\x00\x51\x01\x99\x00\x00\x00\x7f\x05\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xfc\xff\xbc\x01\x00\x00\x00\x00\x57\x02\x00\x00\x00\x00\x46\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xaa\x01\x00\x00\x89\x01\x00\x00\x00\x00\x82\x02\x47\x02\x96\x01\x00\x00\x50\x01\x00\x00\x06\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x49\x01\x2a\x01\x00\x00\x00\x00\x00\x00\x1a\x01\x00\x00\x00\x00\x74\x05\x00\x00\x00\x00\xdc\x0c\x00\x00\x00\x00\x37\x02\x20\x02\x07\x02\xa3\x01\xf3\x00\x00\x00\x8c\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xf6\x00\x00\x00\x00\x00\xf1\x00\x37\x00\x10\x01\x00\x00\x00\x00\x00\x00\x00\x00\xdb\x00\x00\x00\x00\x00\x00\x00\x00\x00\x68\x01\x00\x00\x58\x02\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xad\x00\x30\x00\xa4\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xe0\x01\x00\x00\x88\x00\x00\x00\x00\x00"# happyDefActions :: HappyAddr happyDefActions = HappyA# "\xf9\xff\x00\x00\x00\x00\x00\x00\x00\x00\xfb\xff\x7e\xff\x7d\xff\x00\x00\x96\xff\x7f\xff\x00\x00\xa3\xfe\x7e\xff\x58\xff\x00\x00\x6d\xff\x6c\xff\x6a\xff\x69\xff\x66\xff\x00\x00\x46\xff\x45\xff\x63\xff\x00\x00\x00\x00\x3e\xff\x3c\xff\x00\x00\x00\x00\x54\xff\x52\xff\x00\x00\x00\x00\x51\xff\x00\x00\x53\xff\x00\x00\x50\xff\x4f\xff\x00\x00\x00\x00\x55\xff\x56\xff\x00\x00\xa3\xfe\x00\x00\x00\x00\x57\xff\x00\x00\x00\x00\x78\xff\x00\x00\x77\xff\x00\x00\x59\xff\x4b\xff\x00\x00\x00\x00\x93\xff\x00\x00\x00\x00\x00\x00\x76\xff\x00\x00\x00\x00\x00\x00\x00\x00\xa4\xfe\x4c\xff\x7c\xff\x0e\xff\x22\xff\x00\x00\x5d\xff\x00\x00\x2d\xff\x2a\xff\x23\xff\x00\x00\x00\x00\x7b\xff\xa3\xfe\x00\x00\x00\x00\x49\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x60\xff\x5c\xff\x00\x00\x00\x00\x00\x00\x00\x00\x44\xff\x00\x00\x00\x00\x00\x00\xa3\xfe\x13\xff\x00\x00\x00\x00\x14\xff\x0f\xff\xa3\xfe\x00\x00\x00\x00\x3d\xff\x00\x00\x00\x00\x00\x00\x3f\xff\x70\xff\x68\xff\x5b\xff\x00\x00\x00\x00\x00\x00\x00\x00\xea\xfe\x00\x00\xcb\xfe\x5b\xfe\xe3\xfe\xe2\xfe\xe1\xfe\xe0\xfe\xdf\xfe\xde\xfe\xe4\xfe\xdd\xfe\xdc\xfe\xdb\xfe\xda\xfe\xd9\xfe\xd8\xfe\xd1\xfe\xd3\xfe\xd2\xfe\xd7\xfe\xd6\xfe\xd5\xfe\x9f\xff\xd4\xfe\x95\xfe\x84\xfe\x94\xfe\x93\xfe\x92\xfe\x91\xfe\x8f\xfe\x90\xfe\x8e\xfe\x8d\xfe\x8c\xfe\x89\xfe\x86\xfe\x87\xfe\x88\xfe\x85\xfe\x8b\xfe\x8a\xfe\x59\xfe\x96\xfe\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xa4\xfe\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xee\xfe\x00\x00\xfa\xff\xf8\xff\xf7\xff\xf6\xff\xf5\xff\xf4\xff\xf3\xff\xf2\xff\xf1\xff\xf0\xff\xef\xff\xee\xff\xed\xff\xec\xff\xeb\xff\xea\xff\xe9\xff\xe8\xff\xe7\xff\xe6\xff\xe5\xff\xe4\xff\xe3\xff\xe2\xff\xe1\xff\xe0\xff\xdf\xff\xde\xff\xdd\xff\xdc\xff\xdb\xff\xda\xff\xd9\xff\xd8\xff\xd7\xff\xd6\xff\xd5\xff\xd4\xff\xd3\xff\xd2\xff\xd1\xff\xd0\xff\xcf\xff\xce\xff\xcd\xff\xcc\xff\xcb\xff\xca\xff\xc9\xff\xc8\xff\xc7\xff\xc6\xff\xc5\xff\xc4\xff\xc3\xff\xc2\xff\xc1\xff\xc0\xff\xbf\xff\xbe\xff\xbd\xff\xbc\xff\xbb\xff\xba\xff\xb9\xff\xb8\xff\xb7\xff\xb6\xff\xb5\xff\xb4\xff\xb3\xff\xb2\xff\xb1\xff\xb0\xff\xaf\xff\xae\xff\xad\xff\xac\xff\xab\xff\xaa\xff\xa9\xff\xa8\xff\xa7\xff\xa6\xff\xa5\xff\xa4\xff\xa3\xff\xa2\xff\xa1\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x75\xff\x00\x00\x00\x00\x00\x00\xea\xfe\x00\x00\x00\x00\x00\x00\x10\xff\xbb\xfe\xb8\xfe\x00\x00\xb9\xfe\xb4\xfe\x9f\xfe\x00\x00\xbd\xfe\x10\xff\x10\xff\x97\xfe\xba\xfe\x00\x00\x97\xff\x98\xff\x00\x00\x00\x00\xbe\xfe\x00\x00\x10\xff\x10\xff\xbc\xfe\xa0\xff\x9e\xff\xa3\xfe\x9b\xff\x9a\xff\xe8\xfe\x00\x00\x00\x00\xec\xfe\x00\x00\x4a\xff\x6e\xff\x6b\xff\x6f\xff\x77\xff\x63\xff\x00\x00\x00\x00\x00\x00\x78\xff\x00\x00\x76\xff\x16\xff\x17\xff\x65\xff\x15\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x43\xff\x42\xff\x44\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x1d\xff\x00\x00\x18\xff\x00\x00\x00\x00\x20\xff\x1f\xff\x21\xff\x0d\xff\x00\x00\x00\x00\x0c\xff\x00\x00\x00\x00\x29\xff\x25\xff\x2a\xff\xa3\xfe\x00\x00\x00\x00\x2e\xff\x67\xff\x24\xff\x00\x00\x32\xff\x00\x00\x35\xff\x4d\xff\x00\x00\x92\xff\x34\xff\x4e\xff\x33\xff\x5a\xff\x00\x00\x30\xff\x2f\xff\x9f\xfe\x31\xff\x27\xff\x26\xff\x28\xff\x2c\xff\x2b\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x5e\xff\x00\x00\x00\x00\x3b\xff\x39\xff\x3a\xff\x38\xff\x36\xff\x37\xff\x5f\xff\x00\x00\x00\x00\x48\xff\x00\x00\x62\xff\x61\xff\x64\xff\x5f\xfe\x9c\xff\x9d\xff\x0a\xff\x0b\xff\xe9\xfe\xf0\xfe\x00\x00\xcd\xfe\xcc\xfe\xce\xfe\x00\x00\x00\x00\x5c\xfe\x10\xff\x00\x00\x10\xff\x00\x00\x90\xff\x8c\xff\x00\x00\x6c\xfe\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x79\xff\xc1\xfe\xc0\xfe\xbf\xfe\x00\x00\x00\x00\x10\xff\x9f\xfe\x03\xff\x00\x00\xb3\xfe\x00\x00\x94\xff\x00\x00\x6f\xfe\x00\x00\x00\x00\x44\xff\x00\x00\xb0\xfe\xae\xfe\xa9\xfe\x00\x00\x00\x00\x00\x00\xa5\xfe\x00\x00\xee\xfe\xec\xfe\x75\xfe\x00\x00\x71\xff\x00\x00\x00\x00\x75\xff\x76\xfe\x77\xfe\x00\x00\x72\xff\x72\xfe\x00\x00\x00\x00\x75\xff\x75\xff\x00\x00\x75\xff\x00\x00\x75\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x75\xff\x00\x00\x00\x00\x73\xff\x00\x00\x00\x00\x78\xfe\x73\xfe\x74\xfe\x74\xff\x83\xfe\x80\xfe\x79\xfe\xef\xfe\xed\xfe\xb7\xfe\x00\x00\xa7\xfe\x00\x00\x00\x00\xa7\xfe\x00\x00\xaf\xfe\x00\x00\x7e\xff\x00\x00\x00\x00\x71\xfe\x00\x00\x00\x00\x95\xff\x00\x00\x00\x00\xa1\xfe\x05\xff\x03\xff\x01\xff\x00\xff\x00\x00\x02\xff\x00\x00\x00\x00\x9e\xfe\x00\x00\x00\x00\x00\x00\x00\x00\x7a\xff\x8e\xff\x00\x00\x00\x00\x00\x00\x91\xff\x00\x00\x00\x00\x00\x00\x00\x00\x6e\xfe\x00\x00\x00\x00\x8d\xff\x00\x00\x00\x00\x12\xff\x00\x00\x00\x00\x11\xff\x5d\xfe\xe7\xfe\x00\x00\x00\x00\x00\x00\xeb\xfe\x40\xff\x41\xff\x47\xff\x1e\xff\x1d\xff\x1c\xff\x1b\xff\x19\xff\x1a\xff\x08\xff\x09\xff\x06\xff\x07\xff\x03\xff\xa2\xfe\x00\x00\x00\x00\x5e\xfe\x00\x00\x6a\xfe\xc7\xfe\x00\x00\xc6\xfe\xc8\xfe\xcf\xfe\x6d\xfe\x00\x00\x00\x00\x00\x00\x00\x00\x8a\xff\x88\xff\x8f\xff\x98\xfe\x9f\xfe\x03\xff\x99\xfe\x00\x00\xf4\xfe\x99\xff\xf4\xfe\x04\xff\x03\xff\xb5\xfe\xd0\xfe\x70\xfe\xc3\xfe\xc4\xfe\x00\x00\xb6\xfe\xb2\xfe\x00\x00\x00\x00\xac\xfe\x00\x00\x00\x00\xad\xfe\x7d\xfe\x7a\xfe\x7e\xfe\x7b\xfe\x00\x00\x7f\xfe\x81\xfe\x82\xfe\x7c\xfe\x00\x00\xa7\xfe\x00\x00\x00\x00\x00\x00\xb1\xfe\x69\xfe\x00\x00\x00\x00\x00\x00\x60\xfe\x00\x00\x61\xfe\x00\x00\xa0\xfe\xf6\xfe\xf2\xfe\x00\x00\xf3\xfe\x00\x00\x00\x00\x00\x00\xfa\xfe\x00\x00\x99\xff\xfc\xfe\x00\x00\x03\xff\x9b\xfe\x9c\xfe\x00\x00\x89\xff\x8b\xff\x84\xff\x86\xff\x80\xff\x82\xff\x00\x00\x6b\xfe\x00\x00\xe6\xfe\xe5\xfe\xc9\xfe\xca\xfe\x83\xff\x81\xff\x87\xff\x85\xff\x00\x00\x9a\xfe\xff\xfe\x00\x00\x00\x00\x99\xff\xfd\xfe\xf8\xfe\xf5\xfe\xfe\xfe\x00\x00\xc5\xfe\xc2\xfe\x66\xfe\x65\xfe\xa3\xfe\x68\xfe\xa3\xfe\x00\x00\xaa\xfe\xa6\xfe\xab\xfe\xa8\xfe\x00\x00\x00\x00\x00\x00\xf1\xfe\xfb\xfe\xf9\xfe\xf7\xfe\x9d\xfe\x62\xfe\x64\xfe\xa3\xfe\x67\xfe\x00\x00\x63\xfe"# happyCheck :: HappyAddr happyCheck = HappyA# "\xff\xff\x05\x00\x05\x00\x11\x00\x0a\x00\x09\x00\x09\x00\x0a\x00\x09\x00\x11\x00\x00\x00\x0f\x00\x09\x00\x81\x00\x0f\x00\x10\x00\x00\x00\x85\x00\x38\x00\x28\x00\x11\x00\x40\x00\x09\x00\x1b\x00\x1c\x00\x1d\x00\x1e\x00\x1f\x00\x20\x00\x21\x00\x22\x00\x23\x00\x11\x00\x09\x00\x09\x00\x08\x00\x0c\x00\x09\x00\x0e\x00\x09\x00\x0a\x00\x09\x00\x55\x00\x0f\x00\x10\x00\x2a\x00\x43\x00\x0f\x00\x10\x00\x57\x00\x25\x00\x26\x00\x19\x00\x05\x00\x06\x00\x28\x00\x35\x00\x36\x00\x1f\x00\x38\x00\x39\x00\x00\x00\x09\x00\x0a\x00\x09\x00\x45\x00\x27\x00\x4b\x00\x09\x00\x4b\x00\x4a\x00\x55\x00\x4b\x00\x4d\x00\x0f\x00\x4f\x00\x50\x00\x51\x00\x52\x00\x53\x00\x54\x00\x55\x00\x56\x00\x57\x00\x58\x00\x59\x00\x5a\x00\x5b\x00\x5c\x00\x5d\x00\x5e\x00\x51\x00\x21\x00\x22\x00\x23\x00\x55\x00\x43\x00\x51\x00\x66\x00\x67\x00\x4c\x00\x48\x00\x6a\x00\x6b\x00\x69\x00\x4b\x00\x6e\x00\x6f\x00\x70\x00\x71\x00\x72\x00\x73\x00\x74\x00\x75\x00\x76\x00\x77\x00\x78\x00\x79\x00\x7a\x00\x7b\x00\x7c\x00\x7d\x00\x7e\x00\x7f\x00\x80\x00\x05\x00\x41\x00\x82\x00\x4b\x00\x09\x00\x09\x00\x87\x00\x09\x00\x6c\x00\x8a\x00\x0f\x00\x6c\x00\x69\x00\x11\x00\x12\x00\x11\x00\x05\x00\x51\x00\x52\x00\x42\x00\x28\x00\x09\x00\x1b\x00\x1c\x00\x1d\x00\x1e\x00\x1f\x00\x20\x00\x21\x00\x22\x00\x23\x00\x84\x00\x4f\x00\x09\x00\x44\x00\x82\x00\x09\x00\x09\x00\x68\x00\x0f\x00\x2a\x00\x09\x00\x0f\x00\x42\x00\x05\x00\x2f\x00\x42\x00\x0f\x00\x24\x00\x25\x00\x26\x00\x55\x00\x56\x00\x05\x00\x38\x00\x39\x00\x4f\x00\x21\x00\x22\x00\x23\x00\x21\x00\x22\x00\x23\x00\x09\x00\x45\x00\x21\x00\x22\x00\x23\x00\x09\x00\x4a\x00\x11\x00\x0c\x00\x4d\x00\x0e\x00\x4f\x00\x50\x00\x51\x00\x52\x00\x28\x00\x54\x00\x55\x00\x56\x00\x57\x00\x58\x00\x59\x00\x5a\x00\x5b\x00\x5c\x00\x5d\x00\x5e\x00\x24\x00\x25\x00\x26\x00\x5f\x00\x42\x00\x43\x00\x44\x00\x66\x00\x67\x00\x09\x00\x28\x00\x6a\x00\x6b\x00\x09\x00\x42\x00\x6e\x00\x6f\x00\x70\x00\x71\x00\x72\x00\x73\x00\x74\x00\x75\x00\x76\x00\x77\x00\x78\x00\x79\x00\x7a\x00\x7b\x00\x7c\x00\x7d\x00\x7e\x00\x7f\x00\x80\x00\x09\x00\x09\x00\x42\x00\x47\x00\x68\x00\x09\x00\x0f\x00\x68\x00\x0b\x00\x8a\x00\x09\x00\x4c\x00\x68\x00\x11\x00\x55\x00\x56\x00\x0f\x00\x55\x00\x1b\x00\x1c\x00\x1d\x00\x1e\x00\x1f\x00\x20\x00\x21\x00\x22\x00\x23\x00\x41\x00\x44\x00\x44\x00\x07\x00\x09\x00\x42\x00\x43\x00\x44\x00\x22\x00\x42\x00\x0f\x00\x44\x00\x09\x00\x07\x00\x4f\x00\x41\x00\x15\x00\x52\x00\x55\x00\x55\x00\x11\x00\x1a\x00\x1b\x00\x1c\x00\x1d\x00\x1e\x00\x1f\x00\x20\x00\x21\x00\x22\x00\x23\x00\x09\x00\x52\x00\x45\x00\x27\x00\x28\x00\x29\x00\x2a\x00\x4a\x00\x2c\x00\x4d\x00\x4d\x00\x4f\x00\x4f\x00\x50\x00\x51\x00\x52\x00\x44\x00\x54\x00\x55\x00\x56\x00\x57\x00\x58\x00\x59\x00\x5a\x00\x5b\x00\x5c\x00\x5d\x00\x5e\x00\x3f\x00\x40\x00\x41\x00\x09\x00\x4c\x00\x55\x00\x4e\x00\x66\x00\x67\x00\x07\x00\x09\x00\x6a\x00\x6b\x00\x55\x00\x6d\x00\x6e\x00\x6f\x00\x70\x00\x71\x00\x72\x00\x73\x00\x74\x00\x75\x00\x76\x00\x77\x00\x78\x00\x79\x00\x7a\x00\x7b\x00\x7c\x00\x7d\x00\x7e\x00\x7f\x00\x80\x00\x09\x00\x42\x00\x42\x00\x81\x00\x66\x00\x67\x00\x0f\x00\x85\x00\x09\x00\x8a\x00\x8b\x00\x09\x00\x41\x00\x4d\x00\x4f\x00\x4f\x00\x11\x00\x0f\x00\x1b\x00\x1c\x00\x1d\x00\x1e\x00\x1f\x00\x20\x00\x21\x00\x22\x00\x23\x00\x86\x00\x09\x00\x52\x00\x09\x00\x3f\x00\x40\x00\x41\x00\x0f\x00\x21\x00\x22\x00\x23\x00\x11\x00\x12\x00\x15\x00\x2a\x00\x05\x00\x43\x00\x2d\x00\x2e\x00\x2f\x00\x30\x00\x1d\x00\x1e\x00\x1f\x00\x4b\x00\x21\x00\x22\x00\x23\x00\x38\x00\x39\x00\x64\x00\x65\x00\x09\x00\x45\x00\x09\x00\x0c\x00\x2c\x00\x0e\x00\x4a\x00\x55\x00\x0f\x00\x4d\x00\x58\x00\x4f\x00\x50\x00\x51\x00\x52\x00\x53\x00\x54\x00\x55\x00\x56\x00\x57\x00\x58\x00\x59\x00\x5a\x00\x5b\x00\x5c\x00\x5d\x00\x5e\x00\x22\x00\x09\x00\x4a\x00\x4c\x00\x4c\x00\x4e\x00\x4e\x00\x66\x00\x67\x00\x11\x00\x12\x00\x6a\x00\x6b\x00\x55\x00\x0b\x00\x6e\x00\x6f\x00\x70\x00\x71\x00\x72\x00\x73\x00\x74\x00\x75\x00\x76\x00\x77\x00\x78\x00\x79\x00\x7a\x00\x7b\x00\x7c\x00\x7d\x00\x7e\x00\x7f\x00\x80\x00\x09\x00\x66\x00\x67\x00\x09\x00\x09\x00\x65\x00\x0f\x00\x09\x00\x09\x00\x8a\x00\x09\x00\x11\x00\x11\x00\x12\x00\x0f\x00\x11\x00\x0f\x00\x10\x00\x1b\x00\x1c\x00\x1d\x00\x1e\x00\x1f\x00\x20\x00\x21\x00\x22\x00\x23\x00\x1c\x00\x1d\x00\x1e\x00\x1f\x00\x20\x00\x21\x00\x22\x00\x23\x00\x43\x00\x2a\x00\x09\x00\x65\x00\x09\x00\x2a\x00\x60\x00\x0c\x00\x0f\x00\x0e\x00\x4d\x00\x65\x00\x4f\x00\x81\x00\x37\x00\x38\x00\x39\x00\x85\x00\x37\x00\x38\x00\x39\x00\x65\x00\x1d\x00\x1e\x00\x1f\x00\x45\x00\x21\x00\x22\x00\x23\x00\x09\x00\x4a\x00\x09\x00\x0c\x00\x4d\x00\x0e\x00\x4f\x00\x50\x00\x51\x00\x52\x00\x0b\x00\x54\x00\x55\x00\x56\x00\x57\x00\x58\x00\x59\x00\x5a\x00\x5b\x00\x5c\x00\x5d\x00\x5e\x00\x0b\x00\x09\x00\x46\x00\x09\x00\x0c\x00\x49\x00\x0e\x00\x66\x00\x67\x00\x0f\x00\x10\x00\x6a\x00\x6b\x00\x05\x00\x06\x00\x6e\x00\x6f\x00\x70\x00\x71\x00\x72\x00\x73\x00\x74\x00\x75\x00\x76\x00\x77\x00\x78\x00\x79\x00\x7a\x00\x7b\x00\x7c\x00\x7d\x00\x7e\x00\x7f\x00\x80\x00\x09\x00\x4a\x00\x18\x00\x4c\x00\x1a\x00\x4e\x00\x0f\x00\x1d\x00\x1e\x00\x8a\x00\x09\x00\x21\x00\x65\x00\x81\x00\x0b\x00\x25\x00\x0f\x00\x85\x00\x1b\x00\x1c\x00\x1d\x00\x1e\x00\x1f\x00\x20\x00\x21\x00\x22\x00\x23\x00\x86\x00\x1b\x00\x1c\x00\x1d\x00\x1e\x00\x1f\x00\x20\x00\x21\x00\x22\x00\x23\x00\x3b\x00\x05\x00\x06\x00\x09\x00\x09\x00\x40\x00\x0c\x00\x43\x00\x0e\x00\x44\x00\x45\x00\x4d\x00\x11\x00\x4f\x00\x4a\x00\x4a\x00\x4c\x00\x4c\x00\x4e\x00\x4e\x00\x4a\x00\x65\x00\x4c\x00\x45\x00\x4e\x00\x55\x00\x55\x00\x56\x00\x4a\x00\x58\x00\x16\x00\x4d\x00\x19\x00\x4f\x00\x50\x00\x51\x00\x52\x00\x2a\x00\x54\x00\x55\x00\x56\x00\x57\x00\x58\x00\x59\x00\x5a\x00\x5b\x00\x5c\x00\x5d\x00\x5e\x00\x19\x00\x37\x00\x38\x00\x39\x00\x64\x00\x65\x00\x09\x00\x66\x00\x67\x00\x0c\x00\x0d\x00\x6a\x00\x6b\x00\x88\x00\x89\x00\x6e\x00\x6f\x00\x70\x00\x71\x00\x72\x00\x73\x00\x74\x00\x75\x00\x76\x00\x77\x00\x78\x00\x79\x00\x7a\x00\x7b\x00\x7c\x00\x7d\x00\x7e\x00\x7f\x00\x80\x00\x09\x00\x16\x00\x18\x00\x16\x00\x1a\x00\x17\x00\x0f\x00\x1d\x00\x1e\x00\x8a\x00\x09\x00\x21\x00\x88\x00\x89\x00\x16\x00\x25\x00\x0f\x00\x16\x00\x1b\x00\x1c\x00\x1d\x00\x1e\x00\x1f\x00\x20\x00\x21\x00\x22\x00\x23\x00\x09\x00\x0a\x00\x1c\x00\x1d\x00\x1e\x00\x1f\x00\x20\x00\x21\x00\x22\x00\x23\x00\x3b\x00\x09\x00\x0a\x00\x09\x00\x09\x00\x40\x00\x0c\x00\x0d\x00\x44\x00\x44\x00\x45\x00\x16\x00\x11\x00\x46\x00\x4a\x00\x4a\x00\x4c\x00\x4c\x00\x4e\x00\x4e\x00\x61\x00\x62\x00\x63\x00\x45\x00\x65\x00\x55\x00\x55\x00\x56\x00\x4a\x00\x58\x00\x0b\x00\x4d\x00\x47\x00\x4f\x00\x50\x00\x51\x00\x52\x00\x2a\x00\x54\x00\x55\x00\x56\x00\x57\x00\x58\x00\x59\x00\x5a\x00\x5b\x00\x5c\x00\x5d\x00\x5e\x00\x09\x00\x37\x00\x38\x00\x39\x00\x09\x00\x0a\x00\x09\x00\x66\x00\x67\x00\x0c\x00\x0d\x00\x6a\x00\x6b\x00\x09\x00\x0a\x00\x6e\x00\x6f\x00\x70\x00\x71\x00\x72\x00\x73\x00\x74\x00\x75\x00\x76\x00\x77\x00\x78\x00\x79\x00\x7a\x00\x7b\x00\x7c\x00\x7d\x00\x7e\x00\x7f\x00\x80\x00\x09\x00\x0b\x00\x18\x00\x06\x00\x1a\x00\x06\x00\x0f\x00\x1d\x00\x1e\x00\x8a\x00\x09\x00\x21\x00\x88\x00\x89\x00\x0b\x00\x25\x00\x0f\x00\x0b\x00\x1b\x00\x1c\x00\x1d\x00\x1e\x00\x1f\x00\x20\x00\x21\x00\x22\x00\x23\x00\x88\x00\x89\x00\x05\x00\x1d\x00\x1e\x00\x1f\x00\x20\x00\x21\x00\x22\x00\x23\x00\x3b\x00\x64\x00\x65\x00\x0b\x00\x09\x00\x40\x00\x64\x00\x65\x00\x44\x00\x44\x00\x45\x00\x49\x00\x11\x00\x47\x00\x4a\x00\x4a\x00\x4c\x00\x4c\x00\x4e\x00\x4e\x00\x09\x00\x62\x00\x63\x00\x45\x00\x65\x00\x55\x00\x55\x00\x56\x00\x4a\x00\x58\x00\x48\x00\x4d\x00\x19\x00\x4f\x00\x50\x00\x51\x00\x52\x00\x2a\x00\x54\x00\x55\x00\x56\x00\x57\x00\x58\x00\x59\x00\x5a\x00\x5b\x00\x5c\x00\x5d\x00\x5e\x00\x19\x00\x37\x00\x38\x00\x39\x00\x05\x00\x06\x00\x16\x00\x66\x00\x67\x00\x09\x00\x0a\x00\x6a\x00\x6b\x00\x05\x00\x06\x00\x6e\x00\x6f\x00\x70\x00\x71\x00\x72\x00\x73\x00\x74\x00\x75\x00\x76\x00\x77\x00\x78\x00\x79\x00\x7a\x00\x7b\x00\x7c\x00\x7d\x00\x7e\x00\x7f\x00\x80\x00\x18\x00\x00\x00\x01\x00\x02\x00\x03\x00\x04\x00\x05\x00\x06\x00\x07\x00\x8a\x00\x09\x00\x19\x00\x0b\x00\x0c\x00\x0d\x00\x0e\x00\x0f\x00\x10\x00\x11\x00\x12\x00\x13\x00\x14\x00\x15\x00\x16\x00\x17\x00\x18\x00\x09\x00\x1a\x00\x1b\x00\x1c\x00\x1d\x00\x1e\x00\x0f\x00\x09\x00\x21\x00\x22\x00\x23\x00\x09\x00\x25\x00\x26\x00\x0c\x00\x11\x00\x0e\x00\x1a\x00\x1b\x00\x1c\x00\x1d\x00\x1e\x00\x1f\x00\x20\x00\x21\x00\x22\x00\x23\x00\x88\x00\x89\x00\x19\x00\x27\x00\x28\x00\x29\x00\x2a\x00\x3b\x00\x3f\x00\x40\x00\x3e\x00\x19\x00\x40\x00\x2a\x00\x29\x00\x2a\x00\x44\x00\x45\x00\x2f\x00\x47\x00\x19\x00\x4c\x00\x4a\x00\x4e\x00\x4c\x00\x19\x00\x4e\x00\x38\x00\x39\x00\x51\x00\x55\x00\x53\x00\x19\x00\x55\x00\x56\x00\x19\x00\x58\x00\x00\x00\x01\x00\x02\x00\x09\x00\x09\x00\x05\x00\x06\x00\x07\x00\x09\x00\x09\x00\x88\x00\x11\x00\x0c\x00\x0d\x00\x0e\x00\x0f\x00\x10\x00\x11\x00\x12\x00\x13\x00\x14\x00\x15\x00\x16\x00\x17\x00\x18\x00\x46\x00\x1a\x00\x1b\x00\x1c\x00\x1d\x00\x1e\x00\x81\x00\x09\x00\x21\x00\x22\x00\x23\x00\x2a\x00\x25\x00\x26\x00\x09\x00\x11\x00\x2f\x00\x88\x00\x3f\x00\x40\x00\x0f\x00\x10\x00\x00\x00\x01\x00\x09\x00\x38\x00\x39\x00\x55\x00\x56\x00\x4a\x00\x09\x00\x4c\x00\x11\x00\x4e\x00\x3b\x00\x55\x00\x56\x00\x3e\x00\x08\x00\x40\x00\x2a\x00\x88\x00\x09\x00\x44\x00\x45\x00\x0c\x00\x47\x00\x0e\x00\x88\x00\x4a\x00\x08\x00\x4c\x00\x36\x00\x4e\x00\x38\x00\x39\x00\x51\x00\x2a\x00\x53\x00\x08\x00\x55\x00\x56\x00\x2f\x00\x58\x00\x01\x00\x02\x00\x09\x00\x83\x00\x05\x00\x06\x00\x07\x00\x38\x00\x39\x00\x09\x00\x11\x00\x0c\x00\x0d\x00\x0e\x00\x0f\x00\x10\x00\x11\x00\x12\x00\x13\x00\x14\x00\x15\x00\x16\x00\x17\x00\x18\x00\x09\x00\x1a\x00\x1b\x00\x1c\x00\x1d\x00\x1e\x00\x88\x00\x09\x00\x21\x00\x22\x00\x23\x00\x2a\x00\x25\x00\x26\x00\x04\x00\x11\x00\x3f\x00\x40\x00\x42\x00\x43\x00\x06\x00\x44\x00\x4e\x00\x46\x00\x37\x00\x38\x00\x39\x00\x4a\x00\x48\x00\x4c\x00\x88\x00\x4e\x00\x0b\x00\x0b\x00\x3b\x00\x09\x00\x09\x00\x3e\x00\x55\x00\x40\x00\x2a\x00\x88\x00\x02\x00\x44\x00\x45\x00\x01\x00\x47\x00\x4b\x00\x03\x00\x4a\x00\x11\x00\x4c\x00\x36\x00\x4e\x00\x38\x00\x39\x00\x51\x00\x50\x00\x53\x00\x55\x00\x55\x00\x56\x00\x4b\x00\x58\x00\x59\x00\x01\x00\x02\x00\x03\x00\x04\x00\x05\x00\x06\x00\x07\x00\x08\x00\x09\x00\x0a\x00\x0b\x00\x0c\x00\x0d\x00\x0e\x00\x0f\x00\x10\x00\x11\x00\x12\x00\x13\x00\x14\x00\x15\x00\x16\x00\x17\x00\x18\x00\x19\x00\x1a\x00\x1b\x00\x1c\x00\x1d\x00\x1e\x00\x1f\x00\x20\x00\x21\x00\x22\x00\x23\x00\x24\x00\x25\x00\x26\x00\x27\x00\x28\x00\x29\x00\x2a\x00\x2b\x00\x2c\x00\x2d\x00\x2e\x00\x2f\x00\x30\x00\x31\x00\x32\x00\x33\x00\x34\x00\x35\x00\x36\x00\x37\x00\x38\x00\x39\x00\x3a\x00\x3b\x00\x3c\x00\x3d\x00\x3e\x00\x3f\x00\x40\x00\x41\x00\x42\x00\x43\x00\x44\x00\x45\x00\x46\x00\x47\x00\x48\x00\x49\x00\x4a\x00\x4b\x00\x4c\x00\x4d\x00\x4e\x00\x4f\x00\x50\x00\x51\x00\x52\x00\x53\x00\x54\x00\x55\x00\x56\x00\x57\x00\x58\x00\x01\x00\x02\x00\x09\x00\x04\x00\x05\x00\x06\x00\x07\x00\x24\x00\x41\x00\x4b\x00\x11\x00\x0c\x00\x0d\x00\x0e\x00\x0f\x00\x10\x00\x11\x00\x12\x00\x13\x00\x14\x00\x15\x00\x16\x00\x17\x00\x18\x00\x55\x00\x1a\x00\x1b\x00\x1c\x00\x1d\x00\x1e\x00\x4b\x00\x09\x00\x21\x00\x22\x00\x23\x00\x2a\x00\x25\x00\x26\x00\x41\x00\x11\x00\x3f\x00\x40\x00\x50\x00\x55\x00\x55\x00\x44\x00\x4d\x00\x46\x00\x37\x00\x38\x00\x39\x00\x4a\x00\x55\x00\x4c\x00\x4f\x00\x4e\x00\x54\x00\x46\x00\x3b\x00\x46\x00\x28\x00\x3e\x00\x55\x00\x40\x00\x2a\x00\x55\x00\x28\x00\x44\x00\x45\x00\x2f\x00\x47\x00\x4f\x00\x28\x00\x4a\x00\x4f\x00\x4c\x00\x50\x00\x4e\x00\x38\x00\x39\x00\x28\x00\x28\x00\x53\x00\x50\x00\x55\x00\x56\x00\x55\x00\x58\x00\x01\x00\x02\x00\x09\x00\x4f\x00\x05\x00\x06\x00\x07\x00\x50\x00\x43\x00\x4a\x00\x11\x00\x0c\x00\x0d\x00\x0e\x00\x0f\x00\x10\x00\x11\x00\x12\x00\x13\x00\x14\x00\x15\x00\x16\x00\x17\x00\x18\x00\x4a\x00\x1a\x00\x1b\x00\x1c\x00\x1d\x00\x1e\x00\x4a\x00\x55\x00\x21\x00\x22\x00\x23\x00\x2a\x00\x25\x00\x26\x00\x50\x00\x55\x00\x09\x00\x3a\x00\x3b\x00\x3c\x00\x3d\x00\x3e\x00\x0f\x00\x43\x00\x37\x00\x38\x00\x39\x00\x4d\x00\x3a\x00\x3b\x00\x3c\x00\x3d\x00\x3e\x00\x55\x00\x3b\x00\x43\x00\x4f\x00\x3e\x00\x54\x00\x40\x00\x21\x00\x22\x00\x23\x00\x44\x00\x45\x00\x07\x00\x47\x00\x54\x00\x54\x00\x4a\x00\x54\x00\x4c\x00\x57\x00\x4e\x00\x10\x00\x54\x00\x54\x00\x54\x00\x53\x00\x29\x00\x55\x00\x56\x00\x18\x00\x58\x00\x1a\x00\x1b\x00\x1c\x00\x1d\x00\x1e\x00\x57\x00\x09\x00\x21\x00\x57\x00\x23\x00\x57\x00\x25\x00\x0f\x00\x3a\x00\x3b\x00\x3c\x00\x3d\x00\x3e\x00\x15\x00\x3a\x00\x3b\x00\x3c\x00\x3d\x00\x3e\x00\x57\x00\x57\x00\x1d\x00\x1e\x00\x1f\x00\x57\x00\x21\x00\x22\x00\x23\x00\x3b\x00\x54\x00\x54\x00\x3e\x00\x3f\x00\x40\x00\x57\x00\x54\x00\x2c\x00\x44\x00\x45\x00\x54\x00\x47\x00\x07\x00\x54\x00\x4a\x00\x54\x00\x4c\x00\x4d\x00\x4e\x00\x4f\x00\x49\x00\x10\x00\x47\x00\x42\x00\x55\x00\x55\x00\x56\x00\x43\x00\x58\x00\x18\x00\x09\x00\x1a\x00\x1b\x00\x1c\x00\x1d\x00\x1e\x00\x0f\x00\x09\x00\x21\x00\x28\x00\x23\x00\x42\x00\x25\x00\x0f\x00\x3a\x00\x3b\x00\x3c\x00\x3d\x00\x3e\x00\x50\x00\x1d\x00\x1e\x00\x1f\x00\x20\x00\x21\x00\x22\x00\x23\x00\x55\x00\x4f\x00\x46\x00\x20\x00\x21\x00\x22\x00\x23\x00\x3b\x00\x46\x00\x46\x00\x3e\x00\x3f\x00\x40\x00\x31\x00\x32\x00\x33\x00\x44\x00\x45\x00\x4b\x00\x47\x00\x07\x00\x46\x00\x4a\x00\x46\x00\x4c\x00\x4d\x00\x4e\x00\x4f\x00\x46\x00\x10\x00\x4b\x00\x4f\x00\x55\x00\x55\x00\x56\x00\x4f\x00\x58\x00\x18\x00\x09\x00\x1a\x00\x1b\x00\x1c\x00\x1d\x00\x1e\x00\x0f\x00\x09\x00\x21\x00\x41\x00\x23\x00\x4f\x00\x25\x00\x0f\x00\x3b\x00\x3c\x00\x3d\x00\x3e\x00\x43\x00\x4f\x00\x1d\x00\x1e\x00\x1f\x00\x20\x00\x21\x00\x22\x00\x23\x00\x29\x00\x55\x00\x43\x00\x20\x00\x21\x00\x22\x00\x23\x00\x3b\x00\x20\x00\x54\x00\x57\x00\x3f\x00\x40\x00\x31\x00\x32\x00\x33\x00\x44\x00\x45\x00\x57\x00\x47\x00\x07\x00\x54\x00\x4a\x00\x54\x00\x4c\x00\x4d\x00\x4e\x00\x4f\x00\x57\x00\x10\x00\x54\x00\x57\x00\x13\x00\x55\x00\x56\x00\x49\x00\x58\x00\x18\x00\x57\x00\x1a\x00\x1b\x00\x1c\x00\x1d\x00\x1e\x00\x51\x00\x07\x00\x21\x00\x50\x00\x23\x00\x50\x00\x25\x00\x55\x00\x50\x00\x55\x00\x10\x00\x50\x00\x49\x00\x50\x00\x55\x00\x50\x00\x20\x00\x46\x00\x18\x00\x0a\x00\x1a\x00\x1b\x00\x1c\x00\x1d\x00\x1e\x00\x0a\x00\x0a\x00\x21\x00\x3b\x00\x23\x00\x55\x00\x25\x00\x3f\x00\x40\x00\x4e\x00\x49\x00\x46\x00\x44\x00\x45\x00\x50\x00\x47\x00\x09\x00\x4b\x00\x4a\x00\x4b\x00\x4c\x00\x4b\x00\x4e\x00\x4b\x00\x42\x00\x59\x00\x4f\x00\x42\x00\x3b\x00\x55\x00\x56\x00\x4f\x00\x58\x00\x40\x00\x4f\x00\x55\x00\x50\x00\x44\x00\x45\x00\x48\x00\x47\x00\x07\x00\x46\x00\x4a\x00\x43\x00\x4c\x00\x4d\x00\x4e\x00\x4f\x00\x59\x00\x10\x00\x59\x00\xff\xff\x13\x00\x55\x00\x56\x00\x50\x00\x58\x00\x18\x00\x09\x00\x1a\x00\x1b\x00\x1c\x00\x1d\x00\x1e\x00\x0f\x00\x09\x00\x21\x00\xff\xff\x23\x00\xff\xff\x25\x00\x0f\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x15\x00\xff\xff\xff\xff\xff\xff\x20\x00\x21\x00\x22\x00\x23\x00\x1d\x00\x1e\x00\x1f\x00\xff\xff\x21\x00\x22\x00\x23\x00\x3b\x00\xff\xff\xff\xff\xff\xff\xff\xff\x40\x00\xff\xff\xff\xff\x2c\x00\x44\x00\x45\x00\x07\x00\x47\x00\xff\xff\xff\xff\x4a\x00\x4b\x00\x4c\x00\xff\xff\x4e\x00\x10\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x55\x00\x56\x00\x18\x00\x58\x00\x1a\x00\x1b\x00\x1c\x00\x1d\x00\x1e\x00\xff\xff\x09\x00\x21\x00\x0b\x00\x23\x00\xff\xff\x25\x00\x0f\x00\xff\xff\xff\xff\xff\xff\x13\x00\x14\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x1d\x00\x1e\x00\x1f\x00\xff\xff\x21\x00\x22\x00\x23\x00\x3b\x00\xff\xff\xff\xff\xff\xff\x3f\x00\x40\x00\xff\xff\x2b\x00\xff\xff\x44\x00\x45\x00\xff\xff\x47\x00\x07\x00\xff\xff\x4a\x00\xff\xff\x4c\x00\xff\xff\x4e\x00\x4f\x00\xff\xff\x10\x00\xff\xff\xff\xff\xff\xff\x55\x00\x56\x00\xff\xff\x58\x00\x18\x00\xff\xff\x1a\x00\x1b\x00\x1c\x00\x1d\x00\x1e\x00\xff\xff\x09\x00\x21\x00\x0b\x00\x23\x00\xff\xff\x25\x00\x0f\x00\xff\xff\xff\xff\xff\xff\x13\x00\x14\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x1d\x00\x1e\x00\x1f\x00\xff\xff\x21\x00\x22\x00\x23\x00\x3b\x00\xff\xff\xff\xff\xff\xff\x3f\x00\x40\x00\xff\xff\x2b\x00\xff\xff\x44\x00\x45\x00\x07\x00\x47\x00\xff\xff\xff\xff\x4a\x00\x4b\x00\x4c\x00\xff\xff\x4e\x00\x10\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x55\x00\x56\x00\x18\x00\x58\x00\x1a\x00\x1b\x00\x1c\x00\x1d\x00\x1e\x00\xff\xff\x09\x00\x21\x00\xff\xff\x23\x00\xff\xff\x25\x00\x0f\x00\xff\xff\xff\xff\xff\xff\x13\x00\x14\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x1d\x00\x1e\x00\x1f\x00\xff\xff\x21\x00\x22\x00\x23\x00\x3b\x00\xff\xff\xff\xff\xff\xff\x3f\x00\x40\x00\xff\xff\x2b\x00\xff\xff\x44\x00\x45\x00\xff\xff\x47\x00\x07\x00\xff\xff\x4a\x00\xff\xff\x4c\x00\xff\xff\x4e\x00\x4f\x00\xff\xff\x10\x00\xff\xff\xff\xff\xff\xff\x55\x00\x56\x00\xff\xff\x58\x00\x18\x00\xff\xff\x1a\x00\x1b\x00\x1c\x00\x1d\x00\x1e\x00\xff\xff\x07\x00\x21\x00\xff\xff\x23\x00\xff\xff\x25\x00\xff\xff\xff\xff\xff\xff\x10\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x18\x00\xff\xff\x1a\x00\x1b\x00\x1c\x00\x1d\x00\x1e\x00\xff\xff\xff\xff\x21\x00\x3b\x00\x23\x00\xff\xff\x25\x00\x3f\x00\x40\x00\xff\xff\xff\xff\xff\xff\x44\x00\x45\x00\xff\xff\x47\x00\xff\xff\xff\xff\x4a\x00\x4b\x00\x4c\x00\xff\xff\x4e\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x3b\x00\x55\x00\x56\x00\xff\xff\x58\x00\x40\x00\xff\xff\xff\xff\xff\xff\x44\x00\x45\x00\xff\xff\x47\x00\x07\x00\xff\xff\x4a\x00\xff\xff\x4c\x00\x4d\x00\x4e\x00\x4f\x00\xff\xff\x10\x00\xff\xff\xff\xff\x13\x00\x55\x00\x56\x00\xff\xff\x58\x00\x18\x00\xff\xff\x1a\x00\x1b\x00\x1c\x00\x1d\x00\x1e\x00\xff\xff\x09\x00\x21\x00\xff\xff\x23\x00\xff\xff\x25\x00\x0f\x00\xff\xff\xff\xff\xff\xff\x13\x00\x14\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x3f\x00\x40\x00\x1d\x00\x1e\x00\x1f\x00\x44\x00\x21\x00\x22\x00\x23\x00\x3b\x00\xff\xff\x4a\x00\xff\xff\x4c\x00\x40\x00\x4e\x00\x2b\x00\xff\xff\x44\x00\x45\x00\x07\x00\x47\x00\x55\x00\xff\xff\x4a\x00\x4b\x00\x4c\x00\xff\xff\x4e\x00\x10\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x55\x00\x56\x00\x18\x00\x58\x00\x1a\x00\x1b\x00\x1c\x00\x1d\x00\x1e\x00\xff\xff\x07\x00\x21\x00\xff\xff\x23\x00\xff\xff\x25\x00\xff\xff\xff\xff\xff\xff\x10\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x18\x00\xff\xff\x1a\x00\x1b\x00\x1c\x00\x1d\x00\x1e\x00\xff\xff\xff\xff\x21\x00\x3b\x00\x23\x00\xff\xff\x25\x00\x3f\x00\x40\x00\xff\xff\xff\xff\xff\xff\x44\x00\x45\x00\xff\xff\x47\x00\xff\xff\xff\xff\x4a\x00\xff\xff\x4c\x00\xff\xff\x4e\x00\x4f\x00\xff\xff\xff\xff\xff\xff\xff\xff\x3b\x00\x55\x00\x56\x00\xff\xff\x58\x00\x40\x00\xff\xff\xff\xff\xff\xff\x44\x00\x45\x00\x46\x00\x47\x00\x07\x00\x49\x00\x4a\x00\xff\xff\x4c\x00\xff\xff\x4e\x00\xff\xff\xff\xff\x10\x00\xff\xff\xff\xff\xff\xff\x55\x00\x56\x00\xff\xff\x58\x00\x18\x00\xff\xff\x1a\x00\x1b\x00\x1c\x00\x1d\x00\x1e\x00\xff\xff\x07\x00\x21\x00\xff\xff\x23\x00\xff\xff\x25\x00\xff\xff\xff\xff\xff\xff\x10\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x18\x00\xff\xff\x1a\x00\x1b\x00\x1c\x00\x1d\x00\x1e\x00\xff\xff\xff\xff\x21\x00\x3b\x00\x23\x00\xff\xff\x25\x00\x3f\x00\x40\x00\xff\xff\xff\xff\xff\xff\x44\x00\x45\x00\xff\xff\x47\x00\xff\xff\xff\xff\x4a\x00\xff\xff\x4c\x00\xff\xff\x4e\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x3b\x00\x55\x00\x56\x00\xff\xff\x58\x00\x40\x00\xff\xff\xff\xff\xff\xff\x44\x00\x45\x00\xff\xff\x47\x00\x07\x00\xff\xff\x4a\x00\xff\xff\x4c\x00\xff\xff\x4e\x00\x4f\x00\xff\xff\x10\x00\xff\xff\xff\xff\xff\xff\x55\x00\x56\x00\xff\xff\x58\x00\x18\x00\xff\xff\x1a\x00\x1b\x00\x1c\x00\x1d\x00\x1e\x00\xff\xff\x07\x00\x21\x00\xff\xff\x23\x00\xff\xff\x25\x00\xff\xff\xff\xff\xff\xff\x10\x00\xff\xff\xff\xff\x13\x00\xff\xff\xff\xff\xff\xff\xff\xff\x18\x00\xff\xff\x1a\x00\x1b\x00\x1c\x00\x1d\x00\x1e\x00\xff\xff\xff\xff\x21\x00\x3b\x00\x23\x00\xff\xff\x25\x00\x3f\x00\x40\x00\xff\xff\xff\xff\xff\xff\x44\x00\x45\x00\xff\xff\x47\x00\xff\xff\xff\xff\x4a\x00\xff\xff\x4c\x00\xff\xff\x4e\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x3b\x00\x55\x00\x56\x00\xff\xff\x58\x00\x40\x00\xff\xff\xff\xff\xff\xff\x44\x00\x45\x00\x07\x00\x47\x00\xff\xff\xff\xff\x4a\x00\xff\xff\x4c\x00\xff\xff\x4e\x00\x10\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x55\x00\x56\x00\x18\x00\x58\x00\x1a\x00\x1b\x00\x1c\x00\x1d\x00\x1e\x00\xff\xff\x07\x00\x21\x00\xff\xff\x23\x00\xff\xff\x25\x00\xff\xff\xff\xff\xff\xff\x10\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x18\x00\xff\xff\x1a\x00\x1b\x00\x1c\x00\x1d\x00\x1e\x00\xff\xff\xff\xff\x21\x00\x3b\x00\x23\x00\xff\xff\x25\x00\x3f\x00\x40\x00\xff\xff\xff\xff\xff\xff\x44\x00\x45\x00\xff\xff\x47\x00\xff\xff\xff\xff\x4a\x00\xff\xff\x4c\x00\xff\xff\x4e\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x3b\x00\x55\x00\x56\x00\xff\xff\x58\x00\x40\x00\xff\xff\xff\xff\xff\xff\x44\x00\x45\x00\xff\xff\x47\x00\x07\x00\xff\xff\x4a\x00\xff\xff\x4c\x00\xff\xff\x4e\x00\x4f\x00\xff\xff\x10\x00\xff\xff\xff\xff\xff\xff\x55\x00\x56\x00\xff\xff\x58\x00\x18\x00\xff\xff\x1a\x00\x1b\x00\x1c\x00\x1d\x00\x1e\x00\xff\xff\x07\x00\x21\x00\xff\xff\x23\x00\xff\xff\x25\x00\xff\xff\xff\xff\xff\xff\x10\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x18\x00\xff\xff\x1a\x00\x1b\x00\x1c\x00\x1d\x00\x1e\x00\xff\xff\xff\xff\x21\x00\x3b\x00\x23\x00\xff\xff\x25\x00\x3f\x00\x40\x00\xff\xff\xff\xff\xff\xff\x44\x00\x45\x00\xff\xff\x47\x00\xff\xff\xff\xff\x4a\x00\xff\xff\x4c\x00\xff\xff\x4e\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x3b\x00\x55\x00\x56\x00\xff\xff\x58\x00\x40\x00\xff\xff\xff\xff\xff\xff\x44\x00\x45\x00\xff\xff\x47\x00\xff\xff\xff\xff\x4a\x00\xff\xff\x4c\x00\xff\xff\x4e\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x55\x00\x56\x00\x18\x00\x58\x00\x1a\x00\xff\xff\xff\xff\x1d\x00\x1e\x00\xff\xff\xff\xff\x21\x00\xff\xff\x3f\x00\x40\x00\x25\x00\xff\xff\xff\xff\x44\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x4a\x00\x18\x00\x4c\x00\x1a\x00\x4e\x00\xff\xff\x1d\x00\x1e\x00\xff\xff\xff\xff\x21\x00\x55\x00\xff\xff\x3b\x00\x25\x00\xff\xff\x3f\x00\x40\x00\x40\x00\xff\xff\xff\xff\x44\x00\x44\x00\x45\x00\xff\xff\xff\xff\xff\xff\x4a\x00\x4a\x00\x4c\x00\x4c\x00\x4e\x00\x4e\x00\xff\xff\xff\xff\xff\xff\x3b\x00\xff\xff\x55\x00\x55\x00\x56\x00\x40\x00\x58\x00\xff\xff\xff\xff\x44\x00\x45\x00\xff\xff\xff\xff\xff\xff\xff\xff\x4a\x00\xff\xff\x4c\x00\xff\xff\x4e\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x55\x00\x56\x00\x18\x00\x58\x00\x1a\x00\xff\xff\xff\xff\x1d\x00\x1e\x00\xff\xff\xff\xff\x21\x00\xff\xff\x3f\x00\x40\x00\x25\x00\xff\xff\xff\xff\x44\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x4a\x00\x18\x00\x4c\x00\x1a\x00\x4e\x00\xff\xff\x1d\x00\x1e\x00\xff\xff\xff\xff\x21\x00\x55\x00\xff\xff\x3b\x00\x25\x00\xff\xff\x3f\x00\x40\x00\x40\x00\xff\xff\xff\xff\x44\x00\x44\x00\x45\x00\xff\xff\xff\xff\xff\xff\x4a\x00\x4a\x00\x4c\x00\x4c\x00\x4e\x00\x4e\x00\xff\xff\xff\xff\xff\xff\x3b\x00\xff\xff\x55\x00\x55\x00\x56\x00\x40\x00\x58\x00\xff\xff\xff\xff\x44\x00\x45\x00\xff\xff\xff\xff\xff\xff\xff\xff\x4a\x00\xff\xff\x4c\x00\xff\xff\x4e\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x55\x00\x56\x00\x18\x00\x58\x00\x1a\x00\xff\xff\xff\xff\x1d\x00\x1e\x00\xff\xff\xff\xff\x21\x00\xff\xff\x3f\x00\x40\x00\x25\x00\xff\xff\xff\xff\x44\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x4a\x00\x18\x00\x4c\x00\x1a\x00\x4e\x00\xff\xff\x1d\x00\x1e\x00\xff\xff\xff\xff\x21\x00\x55\x00\xff\xff\x3b\x00\x25\x00\xff\xff\x3f\x00\x40\x00\x40\x00\xff\xff\xff\xff\x44\x00\x44\x00\x45\x00\xff\xff\xff\xff\xff\xff\x4a\x00\x4a\x00\x4c\x00\x4c\x00\x4e\x00\x4e\x00\xff\xff\xff\xff\xff\xff\x3b\x00\xff\xff\x55\x00\x55\x00\x56\x00\x40\x00\x58\x00\xff\xff\xff\xff\x44\x00\x45\x00\xff\xff\x09\x00\xff\xff\xff\xff\x4a\x00\xff\xff\x4c\x00\x0f\x00\x4e\x00\xff\xff\xff\xff\x13\x00\x14\x00\xff\xff\xff\xff\x55\x00\x56\x00\xff\xff\x58\x00\xff\xff\xff\xff\x1d\x00\x1e\x00\x1f\x00\x20\x00\x21\x00\x22\x00\x23\x00\x09\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x0f\x00\x2b\x00\xff\xff\xff\xff\xff\xff\xff\xff\x15\x00\x31\x00\x32\x00\xff\xff\x34\x00\x1a\x00\x1b\x00\x1c\x00\x1d\x00\x1e\x00\x1f\x00\x20\x00\x21\x00\x22\x00\x23\x00\xff\xff\xff\xff\xff\xff\x27\x00\x28\x00\x29\x00\x2a\x00\x09\x00\x2c\x00\x0b\x00\xff\xff\xff\xff\xff\xff\x0f\x00\xff\xff\xff\xff\xff\xff\x13\x00\x14\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x1a\x00\x1b\x00\x1c\x00\x1d\x00\x1e\x00\x1f\x00\x20\x00\x21\x00\x22\x00\x23\x00\xff\xff\xff\xff\xff\xff\x27\x00\x28\x00\x29\x00\x2a\x00\x2b\x00\x09\x00\xff\xff\x0b\x00\xff\xff\xff\xff\xff\xff\x0f\x00\xff\xff\xff\xff\xff\xff\x13\x00\x14\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x1a\x00\x1b\x00\x1c\x00\x1d\x00\x1e\x00\x1f\x00\x20\x00\x21\x00\x22\x00\x23\x00\xff\xff\xff\xff\x09\x00\x27\x00\x28\x00\x29\x00\x2a\x00\x2b\x00\x0f\x00\xff\xff\xff\xff\xff\xff\x13\x00\x14\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x1a\x00\x1b\x00\x1c\x00\x1d\x00\x1e\x00\x1f\x00\x20\x00\x21\x00\x22\x00\x23\x00\xff\xff\xff\xff\x09\x00\x27\x00\x28\x00\x29\x00\x2a\x00\x2b\x00\x0f\x00\xff\xff\xff\xff\xff\xff\x13\x00\x14\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x1a\x00\x1b\x00\x1c\x00\x1d\x00\x1e\x00\x1f\x00\x20\x00\x21\x00\x22\x00\x23\x00\xff\xff\xff\xff\x09\x00\x27\x00\x28\x00\x29\x00\x2a\x00\x2b\x00\x0f\x00\xff\xff\xff\xff\xff\xff\x13\x00\x14\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x1d\x00\x1e\x00\x1f\x00\xff\xff\x21\x00\x22\x00\x23\x00\x24\x00\x25\x00\x26\x00\x09\x00\xff\xff\xff\xff\xff\xff\x2b\x00\xff\xff\x0f\x00\x09\x00\xff\xff\xff\xff\x13\x00\x14\x00\xff\xff\x0f\x00\xff\xff\xff\xff\xff\xff\x13\x00\x14\x00\xff\xff\x1d\x00\x1e\x00\x1f\x00\xff\xff\x21\x00\x22\x00\x23\x00\x1d\x00\x1e\x00\x1f\x00\xff\xff\x21\x00\x22\x00\x23\x00\x2b\x00\xff\xff\x09\x00\xff\xff\xff\xff\xff\xff\xff\xff\x2b\x00\x0f\x00\x09\x00\xff\xff\xff\xff\x13\x00\x14\x00\xff\xff\x0f\x00\xff\xff\xff\xff\xff\xff\x13\x00\x14\x00\xff\xff\x1d\x00\x1e\x00\x1f\x00\xff\xff\x21\x00\x22\x00\x23\x00\x1d\x00\x1e\x00\x1f\x00\xff\xff\x21\x00\x22\x00\x23\x00\x2b\x00\xff\xff\x09\x00\xff\xff\xff\xff\xff\xff\xff\xff\x2b\x00\x0f\x00\x09\x00\xff\xff\xff\xff\x13\x00\x14\x00\xff\xff\x0f\x00\xff\xff\xff\xff\xff\xff\x13\x00\x14\x00\xff\xff\x1d\x00\x1e\x00\x1f\x00\xff\xff\x21\x00\x22\x00\x23\x00\x1d\x00\x1e\x00\x1f\x00\xff\xff\x21\x00\x22\x00\x23\x00\x2b\x00\xff\xff\x09\x00\xff\xff\xff\xff\xff\xff\xff\xff\x2b\x00\x0f\x00\x09\x00\xff\xff\xff\xff\x13\x00\x14\x00\xff\xff\x0f\x00\xff\xff\xff\xff\xff\xff\x13\x00\x14\x00\xff\xff\x1d\x00\x1e\x00\x1f\x00\xff\xff\x21\x00\x22\x00\x23\x00\x1d\x00\x1e\x00\x1f\x00\xff\xff\x21\x00\x22\x00\x23\x00\x2b\x00\xff\xff\x09\x00\xff\xff\xff\xff\xff\xff\xff\xff\x2b\x00\x0f\x00\x09\x00\xff\xff\xff\xff\x13\x00\x14\x00\xff\xff\x0f\x00\xff\xff\xff\xff\xff\xff\x13\x00\x14\x00\xff\xff\x1d\x00\x1e\x00\x1f\x00\xff\xff\x21\x00\x22\x00\x23\x00\x1d\x00\x1e\x00\x1f\x00\xff\xff\x21\x00\x22\x00\x23\x00\x2b\x00\xff\xff\x09\x00\xff\xff\xff\xff\xff\xff\xff\xff\x2b\x00\x0f\x00\xff\xff\xff\xff\xff\xff\x13\x00\x14\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x1d\x00\x1e\x00\x1f\x00\xff\xff\x21\x00\x22\x00\x23\x00\x09\x00\xff\xff\x0b\x00\xff\xff\xff\xff\xff\xff\x0f\x00\x2b\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x1a\x00\x1b\x00\x1c\x00\x1d\x00\x1e\x00\x1f\x00\x20\x00\x21\x00\x22\x00\x23\x00\xff\xff\x09\x00\xff\xff\x27\x00\x28\x00\x29\x00\x2a\x00\x0f\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x1a\x00\x1b\x00\x1c\x00\x1d\x00\x1e\x00\x1f\x00\x20\x00\x21\x00\x22\x00\x23\x00\xff\xff\x09\x00\xff\xff\x27\x00\x28\x00\x29\x00\x2a\x00\x0f\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x1a\x00\x1b\x00\x1c\x00\x1d\x00\x1e\x00\x1f\x00\x20\x00\x21\x00\x22\x00\x23\x00\xff\xff\x09\x00\xff\xff\x27\x00\x28\x00\x29\x00\x2a\x00\x0f\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x1a\x00\x1b\x00\x1c\x00\x1d\x00\x1e\x00\x1f\x00\x20\x00\x21\x00\x22\x00\x23\x00\xff\xff\x09\x00\xff\xff\x27\x00\x28\x00\x29\x00\x2a\x00\x0f\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x1a\x00\x1b\x00\x1c\x00\x1d\x00\x1e\x00\x1f\x00\x20\x00\x21\x00\x22\x00\x23\x00\xff\xff\x09\x00\xff\xff\x27\x00\x28\x00\x29\x00\x2a\x00\x0f\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x1a\x00\x1b\x00\x1c\x00\x1d\x00\x1e\x00\x1f\x00\x20\x00\x21\x00\x22\x00\x23\x00\xff\xff\x09\x00\xff\xff\x27\x00\x28\x00\x29\x00\x2a\x00\x0f\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x1a\x00\x1b\x00\x1c\x00\x1d\x00\x1e\x00\x1f\x00\x20\x00\x21\x00\x22\x00\x23\x00\xff\xff\x09\x00\xff\xff\x27\x00\x28\x00\x29\x00\x2a\x00\x0f\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x1a\x00\x1b\x00\x1c\x00\x1d\x00\x1e\x00\x1f\x00\x20\x00\x21\x00\x22\x00\x23\x00\xff\xff\x09\x00\xff\xff\x27\x00\x28\x00\x29\x00\x2a\x00\x0f\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x1a\x00\x1b\x00\x1c\x00\x1d\x00\x1e\x00\x1f\x00\x20\x00\x21\x00\x22\x00\x23\x00\xff\xff\x09\x00\xff\xff\x27\x00\x28\x00\x29\x00\x2a\x00\x0f\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x1a\x00\x1b\x00\x1c\x00\x1d\x00\x1e\x00\x1f\x00\x20\x00\x21\x00\x22\x00\x23\x00\xff\xff\x09\x00\xff\xff\x27\x00\x28\x00\x29\x00\x2a\x00\x0f\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x1a\x00\x1b\x00\x1c\x00\x1d\x00\x1e\x00\x1f\x00\x20\x00\x21\x00\x22\x00\x23\x00\xff\xff\x09\x00\xff\xff\x27\x00\x28\x00\x29\x00\x2a\x00\x0f\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x1a\x00\x1b\x00\x1c\x00\x1d\x00\x1e\x00\x1f\x00\x20\x00\x21\x00\x22\x00\x23\x00\xff\xff\x09\x00\xff\xff\x27\x00\x28\x00\x29\x00\x2a\x00\x0f\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x1a\x00\x1b\x00\x1c\x00\x1d\x00\x1e\x00\x1f\x00\x20\x00\x21\x00\x22\x00\x23\x00\xff\xff\x09\x00\xff\xff\x27\x00\x28\x00\x29\x00\x2a\x00\x0f\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x1a\x00\x1b\x00\x1c\x00\x1d\x00\x1e\x00\x1f\x00\x20\x00\x21\x00\x22\x00\x23\x00\xff\xff\x09\x00\xff\xff\x27\x00\x28\x00\x29\x00\x2a\x00\x0f\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x1a\x00\x1b\x00\x1c\x00\x1d\x00\x1e\x00\x1f\x00\x20\x00\x21\x00\x22\x00\x23\x00\xff\xff\x09\x00\xff\xff\x27\x00\x28\x00\x29\x00\x2a\x00\x0f\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x1a\x00\x1b\x00\x1c\x00\x1d\x00\x1e\x00\x1f\x00\x20\x00\x21\x00\x22\x00\x23\x00\xff\xff\x09\x00\xff\xff\x27\x00\x28\x00\x29\x00\x2a\x00\x0f\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x1a\x00\x1b\x00\x1c\x00\x1d\x00\x1e\x00\x1f\x00\x20\x00\x21\x00\x22\x00\x23\x00\xff\xff\x09\x00\xff\xff\x27\x00\x28\x00\x29\x00\x2a\x00\x0f\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x1a\x00\x1b\x00\x1c\x00\x1d\x00\x1e\x00\x1f\x00\x20\x00\x21\x00\x22\x00\x23\x00\xff\xff\x09\x00\xff\xff\x27\x00\x28\x00\x29\x00\x2a\x00\x0f\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x1a\x00\x1b\x00\x1c\x00\x1d\x00\x1e\x00\x1f\x00\x20\x00\x21\x00\x22\x00\x23\x00\xff\xff\x09\x00\xff\xff\x27\x00\x28\x00\x29\x00\x2a\x00\x0f\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x1a\x00\x1b\x00\x1c\x00\x1d\x00\x1e\x00\x1f\x00\x20\x00\x21\x00\x22\x00\x23\x00\xff\xff\x09\x00\xff\xff\x27\x00\x28\x00\x29\x00\x2a\x00\x0f\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x1a\x00\x1b\x00\x1c\x00\x1d\x00\x1e\x00\x1f\x00\x20\x00\x21\x00\x22\x00\x23\x00\xff\xff\x09\x00\xff\xff\x27\x00\x28\x00\x29\x00\x2a\x00\x0f\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x1a\x00\x1b\x00\x1c\x00\x1d\x00\x1e\x00\x1f\x00\x20\x00\x21\x00\x22\x00\x23\x00\xff\xff\x09\x00\xff\xff\x27\x00\x28\x00\x29\x00\x2a\x00\x0f\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x1a\x00\x1b\x00\x1c\x00\x1d\x00\x1e\x00\x1f\x00\x20\x00\x21\x00\x22\x00\x23\x00\xff\xff\x09\x00\xff\xff\x27\x00\x28\x00\x29\x00\x2a\x00\x0f\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x1a\x00\x1b\x00\x1c\x00\x1d\x00\x1e\x00\x1f\x00\x20\x00\x21\x00\x22\x00\x23\x00\xff\xff\x09\x00\xff\xff\x27\x00\x28\x00\x29\x00\x2a\x00\x0f\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x1a\x00\x1b\x00\x1c\x00\x1d\x00\x1e\x00\x1f\x00\x20\x00\x21\x00\x22\x00\x23\x00\xff\xff\xff\xff\xff\xff\x27\x00\x28\x00\x29\x00\x2a\x00\x3f\x00\x40\x00\xff\xff\x3f\x00\x40\x00\x44\x00\xff\xff\xff\xff\x44\x00\xff\xff\xff\xff\x4a\x00\xff\xff\x4c\x00\x4a\x00\x4e\x00\x4c\x00\xff\xff\x4e\x00\xff\xff\xff\xff\xff\xff\x55\x00\xff\xff\xff\xff\x55\x00\x2a\x00\x2b\x00\x2c\x00\x2d\x00\x2e\x00\x2f\x00\x30\x00\x31\x00\x32\x00\x33\x00\x34\x00\x35\x00\x36\x00\x37\x00\x38\x00\x39\x00\x3a\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff"# happyTable :: HappyAddr happyTable = HappyA# "\x00\x00\x90\x02\xb0\x02\x9e\x02\x5f\x01\x0d\x00\xd6\x01\xd7\x01\x06\x00\xa3\x02\xb1\x01\x0e\x00\x47\x00\x5b\x02\x07\x00\x6a\x02\xb1\x01\xb4\x02\xfb\x01\x2c\x02\x48\x00\x32\x02\x61\x01\x7d\x00\x11\x00\x12\x00\x13\x00\x14\x00\x7e\x00\x16\x00\x17\x00\x18\x00\xbb\x01\xc1\x01\x45\x02\x26\x02\xc2\x01\x06\x00\xc3\x01\xd6\x01\xd7\x01\x06\x00\x0a\x00\x07\x00\x35\x01\x69\x00\x2d\x02\x07\x00\x6a\x02\xfc\x01\x49\x02\x64\x01\x27\x02\xda\x02\xdb\x02\xbc\x01\x6a\x00\x6b\x00\x28\x02\x6c\x00\x6d\x00\xb1\x01\xd6\x01\xd7\x01\xd6\x02\x7f\x00\x29\x02\xa4\x02\x0d\x00\x94\x01\x80\x00\x0a\x00\xd8\x01\x81\x00\x0e\x00\x82\x00\x83\x00\x84\x00\x85\x00\x91\x02\x86\x00\x87\x00\x88\x00\x89\x00\x8a\x00\x8b\x00\x8c\x00\x8d\x00\x8e\x00\x8f\x00\x90\x00\xb2\x01\x16\x00\x17\x00\xd1\x01\x0a\x00\xac\x01\xb2\x01\x42\x00\x91\x00\xc4\x01\x7d\x00\x92\x00\x93\x00\xa5\x02\xd8\x01\x95\x00\x96\x00\x97\x00\x98\x00\x99\x00\x9a\x00\x9b\x00\x9c\x00\x9d\x00\x9e\x00\x9f\x00\xa0\x00\xa1\x00\xa2\x00\xa3\x00\xa4\x00\xa5\x00\xa6\x00\xa7\x00\x59\x02\x47\x01\xd9\x01\x75\x02\x0d\x00\x47\x00\x92\x02\x47\x00\x46\x02\x93\x02\x0e\x00\x36\x01\x6b\x02\xca\x01\x2e\x02\x48\x00\xde\x02\xb2\x01\x48\x01\x90\x01\x19\x02\x61\x01\x7d\x00\x11\x00\x12\x00\x13\x00\x14\x00\x7e\x00\x16\x00\x17\x00\x18\x00\xc5\x01\x53\x02\x0d\x00\x38\x01\xd9\x01\x0d\x00\x99\x02\xa7\x02\x0e\x00\x7b\x01\x0d\x00\x0e\x00\x90\x01\xd9\x02\xd4\x01\x1a\x02\x0e\x00\xa8\x01\x63\x01\x64\x01\x0a\x00\x0b\x00\xdc\x02\x7d\x01\x6d\x00\x55\x02\x16\x00\x17\x00\xd1\x01\x16\x00\x17\x00\xd1\x01\x61\x01\x7f\x00\x16\x00\x17\x00\xd1\x01\xc1\x01\x80\x00\x34\x01\xc2\x01\x81\x00\xc3\x01\x82\x00\x83\x00\x84\x00\x85\x00\x3d\x02\x86\x00\x87\x00\x88\x00\x89\x00\x8a\x00\x8b\x00\x8c\x00\x8d\x00\x8e\x00\x8f\x00\x90\x00\x62\x01\x63\x01\x64\x01\xd5\x01\x9a\x02\x9b\x02\x9c\x02\x42\x00\x91\x00\x99\x02\x40\x02\x92\x00\x93\x00\x99\x02\x3e\x02\x95\x00\x96\x00\x97\x00\x98\x00\x99\x00\x9a\x00\x9b\x00\x9c\x00\x9d\x00\x9e\x00\x9f\x00\xa0\x00\xa1\x00\xa2\x00\xa3\x00\xa4\x00\xa5\x00\xa6\x00\xa7\x00\x0d\x00\xd7\x02\x41\x02\x12\x02\x29\x02\x47\x00\x0e\x00\x55\x02\xd8\x02\x5d\x01\x0d\x00\x61\x02\xd2\x01\x75\x01\x0a\x00\x0b\x00\x0e\x00\xe4\x01\x7d\x00\x11\x00\x12\x00\x13\x00\x14\x00\x7e\x00\x16\x00\x17\x00\x18\x00\x47\x01\x53\x00\x38\x01\x9e\x02\x0d\x00\x9a\x02\xa4\x02\x9c\x02\x2c\x01\x9a\x02\x0e\x00\xd4\x02\x47\x00\xbd\x02\x9f\x01\x47\x01\x3e\x00\x48\x01\x0a\x00\x0a\x00\x78\x01\x3f\x00\x10\x00\x11\x00\x40\x00\x13\x00\x14\x00\x15\x00\x16\x00\x17\x00\x18\x00\xc1\x02\x48\x01\x7f\x00\x19\x00\x1a\x00\x1b\x00\x1c\x00\x80\x00\x41\x00\x3d\x00\x81\x00\x3e\x00\x82\x00\x83\x00\x84\x00\x85\x00\x53\x00\x86\x00\x87\x00\x88\x00\x89\x00\x8a\x00\x8b\x00\x8c\x00\x8d\x00\x8e\x00\x8f\x00\x90\x00\xd5\x02\xa0\x02\xa1\x02\xc2\x02\x35\x02\x0a\x00\x36\x02\x42\x00\x91\x00\x9e\x02\xc6\x02\x92\x00\x93\x00\x0a\x00\x94\x00\x95\x00\x96\x00\x97\x00\x98\x00\x99\x00\x9a\x00\x9b\x00\x9c\x00\x9d\x00\x9e\x00\x9f\x00\xa0\x00\xa1\x00\xa2\x00\xa3\x00\xa4\x00\xa5\x00\xa6\x00\xa7\x00\x0d\x00\x77\xff\x90\x01\x5b\x02\x42\x00\x43\x00\x0e\x00\xb5\x02\x47\x00\xa8\x00\xa9\x00\x0d\x00\x47\x01\x3d\x00\x77\xff\x3e\x00\x48\x00\x0e\x00\x7d\x00\x11\x00\x12\x00\x13\x00\x14\x00\x7e\x00\x16\x00\x17\x00\x18\x00\xc5\x02\x0d\x00\x48\x01\x47\x00\x9f\x02\xa0\x02\xa1\x02\x0e\x00\x16\x00\x17\x00\x4d\x01\xca\x01\xcb\x01\x3e\x00\x49\x00\xc7\x02\x6a\xff\x4a\x00\x4b\x00\x4c\x00\x4d\x00\x58\x01\x13\x00\x14\x00\x6a\xff\x16\x00\x17\x00\x52\x01\x4e\x00\x4f\x00\x8a\x02\x8b\x02\xc1\x01\x7f\x00\x0d\x00\xc2\x01\x41\x00\xb6\x02\x80\x00\x3b\x01\x0e\x00\x81\x00\x3c\x01\x82\x00\x83\x00\x84\x00\x85\x00\xd2\x02\x86\x00\x87\x00\x88\x00\x89\x00\x8a\x00\x8b\x00\x8c\x00\x8d\x00\x8e\x00\x8f\x00\x90\x00\x63\x00\x47\x00\xe1\x01\x37\x02\xe2\x01\x38\x02\xe3\x01\x42\x00\x91\x00\xca\x01\xcc\x01\x92\x00\x93\x00\xe4\x01\xab\x02\x95\x00\x96\x00\x97\x00\x98\x00\x99\x00\x9a\x00\x9b\x00\x9c\x00\x9d\x00\x9e\x00\x9f\x00\xa0\x00\xa1\x00\xa2\x00\xa3\x00\xa4\x00\xa5\x00\xa6\x00\xa7\x00\x0d\x00\x42\x00\x43\x00\x47\x00\x47\x00\xcc\x02\x0e\x00\x47\x00\x0d\x00\xd3\x02\x06\x00\x48\x00\xca\x01\xcd\x01\x0e\x00\x48\x00\x07\x00\x92\x01\x7d\x00\x11\x00\x12\x00\x13\x00\x14\x00\x7e\x00\x16\x00\x17\x00\x18\x00\xa7\x01\x12\x00\x13\x00\x14\x00\x7e\x00\x16\x00\x17\x00\x18\x00\x6a\xff\xbd\x01\x0d\x00\xce\x02\xc1\x01\xbd\x01\x79\x02\xc2\x01\x0e\x00\xb7\x02\x6a\xff\x7a\x02\x6a\xff\x5b\x02\x2a\x02\xbf\x01\x6d\x00\x5c\x02\x3e\x02\xbf\x01\x6d\x00\x8f\x02\x77\x00\x13\x00\x14\x00\x7f\x00\x16\x00\x17\x00\x52\x01\xc1\x01\x80\x00\x33\x02\xc2\x01\x81\x00\xb8\x02\x82\x00\x83\x00\x84\x00\x85\x00\xad\x02\x86\x00\x87\x00\x88\x00\x89\x00\x8a\x00\x8b\x00\x8c\x00\x8d\x00\x8e\x00\x8f\x00\x90\x00\x66\x02\xc1\x01\x7a\x00\x06\x00\xc2\x01\x7b\x00\xb9\x02\x42\x00\x91\x00\x07\x00\x32\x01\x92\x00\x93\x00\xc8\x02\xc9\x02\x95\x00\x96\x00\x97\x00\x98\x00\x99\x00\x9a\x00\x9b\x00\x9c\x00\x9d\x00\x9e\x00\x9f\x00\xa0\x00\xa1\x00\xa2\x00\xa3\x00\xa4\x00\xa5\x00\xa6\x00\xa7\x00\x0d\x00\x54\x01\x20\x00\x55\x01\x21\x00\x56\x01\x0e\x00\x24\x00\x25\x00\xdd\x02\x0d\x00\x26\x00\x7b\x02\x5b\x02\x72\x02\x28\x00\x0e\x00\x5f\x02\x7d\x00\x11\x00\x12\x00\x13\x00\x14\x00\x7e\x00\x16\x00\x17\x00\x18\x00\x77\x02\xb4\x01\x11\x00\x12\x00\x13\x00\x14\x00\x7e\x00\x16\x00\x17\x00\x18\x00\x29\x00\xca\x02\xcb\x02\xc1\x01\x47\x00\x58\x00\xc2\x01\x17\x02\xa9\x02\x2c\x00\x2d\x00\x3d\x00\x48\x00\x3e\x00\xe1\x01\x61\x00\xe2\x01\xa9\x02\xe3\x01\x63\x00\x5c\x00\x7e\x02\x5d\x00\x7f\x00\x5e\x00\xe4\x01\x0a\x00\x0b\x00\x80\x00\x32\x00\x85\x02\x81\x00\xfc\x01\x82\x00\x83\x00\x84\x00\x85\x00\xbd\x01\x86\x00\x87\x00\x88\x00\x89\x00\x8a\x00\x8b\x00\x8c\x00\x8d\x00\x8e\x00\x8f\x00\x90\x00\xfd\x01\x41\x02\xbf\x01\x6d\x00\x8d\x02\x8b\x02\xc1\x01\x42\x00\x91\x00\x2f\x02\x68\x02\x92\x00\x93\x00\x42\x02\xb2\x02\x95\x00\x96\x00\x97\x00\x98\x00\x99\x00\x9a\x00\x9b\x00\x9c\x00\x9d\x00\x9e\x00\x9f\x00\xa0\x00\xa1\x00\xa2\x00\xa3\x00\xa4\x00\xa5\x00\xa6\x00\xa7\x00\x0d\x00\xfe\x01\x20\x00\x00\x02\x21\x00\x01\x02\x0e\x00\x24\x00\x25\x00\xd1\x02\x0d\x00\x26\x00\x42\x02\xb3\x02\x03\x02\x28\x00\x0e\x00\x04\x02\x7d\x00\x11\x00\x12\x00\x13\x00\x14\x00\x7e\x00\x16\x00\x17\x00\x18\x00\xd6\x01\x62\x02\x4f\x01\x12\x00\x13\x00\x14\x00\x7e\x00\x16\x00\x17\x00\x18\x00\x29\x00\xd6\x01\x63\x02\xc1\x01\x47\x00\x58\x00\x2f\x02\x30\x02\x53\x00\x2c\x00\x2d\x00\x08\x02\x48\x00\x0d\x02\x54\x01\x61\x00\x77\x01\x62\x00\x78\x01\x63\x00\xdc\x01\xdd\x01\xde\x01\x7f\x00\xdf\x01\x0a\x00\x0a\x00\x0b\x00\x80\x00\x32\x00\x51\x02\x81\x00\x0c\x02\x82\x00\x83\x00\x84\x00\x85\x00\xbd\x01\x86\x00\x87\x00\x88\x00\x89\x00\x8a\x00\x8b\x00\x8c\x00\x8d\x00\x8e\x00\x8f\x00\x90\x00\x33\x02\xbe\x01\xbf\x01\x6d\x00\xd6\x01\x64\x02\xc1\x01\x42\x00\x91\x00\x2f\x02\x32\x02\x92\x00\x93\x00\xd6\x01\x65\x02\x95\x00\x96\x00\x97\x00\x98\x00\x99\x00\x9a\x00\x9b\x00\x9c\x00\x9d\x00\x9e\x00\x9f\x00\xa0\x00\xa1\x00\xa2\x00\xa3\x00\xa4\x00\xa5\x00\xa6\x00\xa7\x00\x0d\x00\x53\x02\x20\x00\x9d\x01\x21\x00\x9f\x01\x0e\x00\x24\x00\x25\x00\xbc\x01\x0d\x00\x26\x00\x42\x02\x69\x02\xa2\x01\x28\x00\x0e\x00\xa5\x01\x7d\x00\x11\x00\x12\x00\x13\x00\x14\x00\x7e\x00\x16\x00\x17\x00\x18\x00\x42\x02\x6c\x02\xaf\x01\x77\x00\x13\x00\x14\x00\x78\x00\x16\x00\x17\x00\x18\x00\x29\x00\x0f\x02\x10\x02\xb2\x01\x47\x00\x58\x00\x12\x02\x13\x02\x53\x00\x2c\x00\x2d\x00\xb9\x01\x48\x00\xb5\x01\x5c\x00\x61\x00\x7a\x01\xd4\x01\x7b\x01\x63\x00\xd0\x01\x15\x02\xde\x01\x7f\x00\xdf\x01\x0a\x00\x0a\x00\x0b\x00\x80\x00\x32\x00\xe6\x01\x81\x00\xe8\x01\x82\x00\x83\x00\x84\x00\x85\x00\xbd\x01\x86\x00\x87\x00\x88\x00\x89\x00\x8a\x00\x8b\x00\x8c\x00\x8d\x00\x8e\x00\x8f\x00\x90\x00\xea\x01\xc0\x01\xbf\x01\x6d\x00\x1a\x02\x1b\x02\xeb\x01\x42\x00\x91\x00\xd6\x01\x1d\x02\x92\x00\x93\x00\x38\x02\x39\x02\x95\x00\x96\x00\x97\x00\x98\x00\x99\x00\x9a\x00\x9b\x00\x9c\x00\x9d\x00\x9e\x00\x9f\x00\xa0\x00\xa1\x00\xa2\x00\xa3\x00\xa4\x00\xa5\x00\xa6\x00\xa7\x00\xef\x01\xb1\x01\xab\x00\xac\x00\x95\x02\x96\x02\xad\x00\xae\x00\x1e\x00\x5d\x01\xa3\xfe\xf3\x01\x97\x02\xaf\x00\xb0\x00\xb1\x00\xb2\x00\x1f\x00\xb3\x00\xb4\x00\xb5\x00\xb6\x00\xb7\x00\xb8\x00\xb9\x00\x20\x00\x0d\x00\x21\x00\x22\x00\x23\x00\x24\x00\xba\x00\x0e\x00\x47\x00\x26\x00\xbb\x00\x27\x00\xc1\x01\x28\x00\xbc\x00\xc2\x01\x48\x00\xaa\x02\x5a\x02\x10\x00\x11\x00\x12\x00\x13\x00\x14\x00\x15\x00\x16\x00\x17\x00\x18\x00\x42\x02\x43\x02\xf4\x01\x19\x00\x1a\x00\x1b\x00\x1c\x00\x29\x00\xc7\x01\xc8\x01\xbd\x00\xf5\x01\x58\x00\x7b\x01\x71\x00\x1c\x00\x2c\x00\x2d\x00\x97\x01\x2e\x00\xf6\x01\xc9\x01\x61\x00\xca\x01\x62\x00\xf7\x01\x63\x00\x7d\x01\x6d\x00\xb2\x01\x0a\x00\xbe\x00\xf8\x01\x0a\x00\x0b\x00\xf9\x01\x32\x00\xb1\x01\xab\x00\xac\x00\x47\x00\x2a\x01\xad\x00\xae\x00\x1e\x00\x2b\x01\xa3\xfe\x2d\x01\x48\x00\xaf\x00\xb0\x00\xb1\x00\xb2\x00\x1f\x00\xb3\x00\xb4\x00\xb5\x00\xb6\x00\xb7\x00\xb8\x00\xb9\x00\x20\x00\x28\x01\x21\x00\x22\x00\x23\x00\x24\x00\xba\x00\x2e\x01\x47\x00\x26\x00\xbb\x00\x27\x00\x7b\x01\x28\x00\xbc\x00\x06\x00\x48\x00\x98\x01\x30\x01\x2a\x00\x73\x00\x07\x00\x08\x00\x32\x00\x05\x00\x47\x00\x7d\x01\x6d\x00\x0a\x00\x0b\x00\x6f\x00\x31\x01\x74\x00\x48\x00\x75\x00\x29\x00\x0a\x00\x0b\x00\xbd\x00\x39\x01\x58\x00\x69\x00\x34\x01\xc1\x01\x2c\x00\x2d\x00\xc2\x01\x2e\x00\x3b\x02\x38\x01\x61\x00\x3c\x01\x62\x00\x59\x01\x63\x00\x6c\x00\x6d\x00\xb2\x01\x7b\x01\xbe\x00\x3d\x01\x0a\x00\x0b\x00\x7c\x01\x32\x00\xab\x00\xac\x00\x47\x00\x3e\x01\xad\x00\xae\x00\x1e\x00\x7d\x01\x6d\x00\x40\x01\x48\x00\xaf\x00\xb0\x00\xb1\x00\xb2\x00\x1f\x00\xb3\x00\xb4\x00\xb5\x00\xb6\x00\xb7\x00\xb8\x00\xb9\x00\x20\x00\x41\x01\x21\x00\x22\x00\x23\x00\x24\x00\xba\x00\x42\x01\x47\x00\x26\x00\xbb\x00\x27\x00\xbd\x01\x28\x00\xbc\x00\x43\x01\x48\x00\x0f\xff\x0f\xff\x4a\x01\x4b\x01\x45\x01\x0f\xff\x48\x01\x0f\xff\xce\x01\xbf\x01\x6d\x00\x0f\xff\x4b\x01\x0f\xff\x84\x01\x0f\xff\x8b\x01\x8c\x01\x29\x00\x65\x00\x66\x00\xbd\x00\x0f\xff\x58\x00\x69\x00\x67\x00\xbe\x00\x2c\x00\x2d\x00\x05\x00\x2e\x00\xd1\x02\x0b\x00\x61\x00\xa3\x02\x62\x00\x5c\x01\x63\x00\x6c\x00\x6d\x00\x5a\xfe\x5e\x02\xbe\x00\x0a\x00\x0a\x00\x0b\x00\xbd\x02\x32\x00\x5a\xfe\xc0\x00\xc1\x00\xc2\x00\xc3\x00\xc4\x00\xc5\x00\xc6\x00\xc7\x00\xc8\x00\xc9\x00\xca\x00\xcb\x00\xcc\x00\xcd\x00\xce\x00\xcf\x00\xd0\x00\xd1\x00\xd2\x00\xd3\x00\xd4\x00\xd5\x00\xd6\x00\xd7\x00\xd8\x00\xd9\x00\xda\x00\xdb\x00\xdc\x00\xdd\x00\xde\x00\xdf\x00\xe0\x00\xe1\x00\xe2\x00\xe3\x00\xe4\x00\xe5\x00\xe6\x00\xe7\x00\xe8\x00\xe9\x00\xea\x00\xeb\x00\xec\x00\xed\x00\xee\x00\xef\x00\xf0\x00\xf1\x00\xf2\x00\xf3\x00\xf4\x00\xf5\x00\xf6\x00\xf7\x00\xf8\x00\xf9\x00\xfa\x00\xfb\x00\xfc\x00\xfd\x00\xfe\x00\xff\x00\x00\x01\x01\x01\x02\x01\x03\x01\x04\x01\x05\x01\x06\x01\x07\x01\x08\x01\x09\x01\x0a\x01\x0b\x01\x0c\x01\x0d\x01\x0e\x01\x0f\x01\x10\x01\x11\x01\x12\x01\x13\x01\x14\x01\x15\x01\x16\x01\x17\x01\xab\x00\xac\x00\x47\x00\x96\x02\xad\x00\xae\x00\x1e\x00\xbf\x02\xc0\x02\xc1\x02\x48\x00\xaf\x00\xb0\x00\xb1\x00\xb2\x00\x1f\x00\xb3\x00\xb4\x00\xb5\x00\xb6\x00\xb7\x00\xb8\x00\xb9\x00\x20\x00\x0a\x00\x21\x00\x22\x00\x23\x00\x24\x00\xba\x00\xc4\x02\x47\x00\x26\x00\xbb\x00\x27\x00\xbd\x01\x28\x00\xbc\x00\xc5\x02\x48\x00\x51\x00\x52\x00\x79\x02\x0a\x00\xe4\x01\x53\x00\xce\x02\x29\xff\xcf\x01\xbf\x01\x6d\x00\x7f\x01\xe4\x01\x80\x01\xd0\x02\x81\x01\x8a\x02\x8d\x02\x29\x00\x8f\x02\x98\x02\xbd\x00\x0a\x00\x58\x00\x7b\x01\xe4\x01\xb0\x02\x2c\x00\x2d\x00\x83\x01\x2e\x00\xad\x02\xb2\x02\x61\x00\xaf\x02\x62\x00\x45\x02\x63\x00\x7d\x01\x6d\x00\x58\x02\x59\x02\xbe\x00\x5e\x02\x0a\x00\x0b\x00\x0a\x00\x32\x00\xab\x00\xac\x00\x47\x00\x68\x02\xad\x00\xae\x00\x1e\x00\x45\x02\x6e\x02\x6f\x02\x48\x00\xaf\x00\xb0\x00\xb1\x00\xb2\x00\x1f\x00\xb3\x00\xb4\x00\xb5\x00\xb6\x00\xb7\x00\xb8\x00\xb9\x00\x20\x00\x70\x02\x21\x00\x22\x00\x23\x00\x24\x00\xba\x00\x71\x02\x0a\x00\x26\x00\xbb\x00\x27\x00\xbd\x01\x28\x00\xbc\x00\x79\x02\xe4\x01\x0d\x00\xbb\x02\x21\x02\x22\x02\x23\x02\x24\x02\x0e\x00\x7d\x02\xda\x01\xbf\x01\x6d\x00\x7e\x02\x98\x02\x21\x02\x22\x02\x23\x02\x24\x02\xe4\x01\x29\x00\x80\x02\x81\x02\xbd\x00\x82\x02\x58\x00\x16\x00\x17\x00\x56\x00\x2c\x00\x2d\x00\x1e\x00\x2e\x00\x83\x02\x84\x02\x61\x00\x85\x02\x62\x00\xed\x01\x63\x00\x1f\x00\x87\x02\x88\x02\x89\x02\xbe\x00\xb7\x01\x0a\x00\x0b\x00\x20\x00\x32\x00\x21\x00\x22\x00\x23\x00\x24\x00\x25\x00\xea\x01\x0d\x00\x26\x00\xed\x01\x27\x00\x00\x02\x28\x00\x0e\x00\xa6\x02\x21\x02\x22\x02\x23\x02\x24\x02\x3e\x00\x56\x02\x21\x02\x22\x02\x23\x02\x24\x02\xed\x01\x03\x02\x58\x01\x13\x00\x14\x00\xed\x01\x16\x00\x17\x00\x52\x01\x29\x00\x06\x02\x07\x02\xbb\x02\x2a\x00\x2b\x00\xed\x01\x08\x02\x6c\x01\x2c\x00\x2d\x00\x0a\x02\x2e\x00\x1e\x00\x0b\x02\x2f\x00\x0c\x02\x30\x00\x3d\x00\x31\x00\x3e\x00\x2a\x01\x1f\x00\x15\x02\x1d\x02\x0a\x00\x0a\x00\x0b\x00\x1f\x02\x32\x00\x20\x00\x0d\x00\x21\x00\x22\x00\x23\x00\x24\x00\x25\x00\x0e\x00\x0d\x00\x26\x00\x2e\x02\x27\x00\x3b\x02\x28\x00\x0e\x00\x20\x02\x21\x02\x22\x02\x23\x02\x24\x02\x45\x02\x4c\x02\x13\x00\x14\x00\x6e\x01\x16\x00\x17\x00\x18\x00\x0a\x00\x4b\x02\x2b\xff\xe5\x01\x16\x00\x17\x00\x5f\x00\x29\x00\x2c\xff\x28\xff\x20\x02\x2a\x00\x2b\x00\x4d\x02\x4e\x02\x4f\x02\x2c\x00\x2d\x00\xa2\x01\x2e\x00\x1e\x00\x26\xff\x2f\x00\x27\xff\x30\x00\x3d\x00\x31\x00\x3e\x00\xa1\x01\x1f\x00\xa5\x01\xa4\x01\x0a\x00\x0a\x00\x0b\x00\xa7\x01\x32\x00\x20\x00\x0d\x00\x21\x00\x22\x00\x23\x00\x24\x00\x25\x00\x0e\x00\x0d\x00\x26\x00\xaa\x01\x27\x00\xab\x01\x28\x00\x0e\x00\x71\x02\x22\x02\x23\x02\x24\x02\xac\x01\xb4\x01\x4c\x02\x13\x00\x14\x00\x6e\x01\x16\x00\x17\x00\x18\x00\xb7\x01\x0a\x00\xe5\x01\x78\x00\x16\x00\x17\x00\x5f\x00\x29\x00\x4d\x01\xe8\x01\xea\x01\x2a\x00\x2b\x00\x4d\x02\x4e\x02\x50\x02\x2c\x00\x2d\x00\xed\x01\x2e\x00\x1e\x00\xee\x01\x2f\x00\xef\x01\x30\x00\x3d\x00\x31\x00\x3e\x00\xf1\x01\x45\x00\xf2\x01\xf3\x01\x46\x00\x0a\x00\x0b\x00\x2a\x01\x32\x00\x20\x00\xea\x01\x21\x00\x22\x00\x23\x00\x24\x00\x25\x00\x45\x01\x1e\x00\x26\x00\x69\x00\x27\x00\x30\x01\x28\x00\x0a\x00\x69\x00\x0a\x00\x1f\x00\x69\x00\x7b\x00\x40\x01\x0a\x00\x69\x00\x4d\x01\x5b\x01\x20\x00\x5f\x01\x21\x00\x22\x00\x23\x00\x24\x00\x25\x00\x60\x01\x61\x01\x26\x00\x29\x00\x27\x00\x0a\x00\x28\x00\x2a\x00\x2b\x00\x66\x01\x67\x01\x82\x01\x2c\x00\x2d\x00\x69\x00\x2e\x00\x87\x01\x86\x01\x2f\x00\x47\x00\x30\x00\x88\x01\x31\x00\x89\x01\x8a\x01\xff\xff\x8b\x01\x90\x01\x29\x00\x0a\x00\x0b\x00\x8e\x01\x32\x00\x58\x00\x8f\x01\x0a\x00\x69\x00\x2c\x00\x2d\x00\x7d\x00\x2e\x00\x1e\x00\x76\x00\x61\x00\x7c\x00\x62\x00\x3d\x00\x63\x00\x3e\x00\xff\xff\x45\x00\xff\xff\x00\x00\x46\x00\x0a\x00\x0b\x00\x0d\x00\x32\x00\x20\x00\x0d\x00\x21\x00\x22\x00\x23\x00\x24\x00\x25\x00\x0e\x00\x0d\x00\x26\x00\x00\x00\x27\x00\x00\x00\x28\x00\x0e\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x3e\x00\x00\x00\x00\x00\x00\x00\x5e\x00\x16\x00\x17\x00\x5f\x00\x58\x01\x13\x00\x14\x00\x00\x00\x16\x00\x17\x00\x52\x01\x29\x00\x00\x00\x00\x00\x00\x00\x00\x00\x58\x00\x00\x00\x00\x00\x69\x01\x2c\x00\x2d\x00\x1e\x00\x2e\x00\x00\x00\x00\x00\x61\x00\x97\x01\x62\x00\x00\x00\x63\x00\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x0a\x00\x0b\x00\x20\x00\x32\x00\x21\x00\x22\x00\x23\x00\x24\x00\x25\x00\x00\x00\x0d\x00\x26\x00\x95\x01\x27\x00\x00\x00\x28\x00\x0e\x00\x00\x00\x00\x00\x00\x00\x57\x01\x34\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x51\x01\x13\x00\x14\x00\x00\x00\x16\x00\x17\x00\x52\x01\x29\x00\x00\x00\x00\x00\x00\x00\x2a\x00\x2b\x00\x00\x00\x3b\x00\x00\x00\x2c\x00\x2d\x00\x00\x00\x2e\x00\x1e\x00\x00\x00\x2f\x00\x00\x00\x30\x00\x00\x00\x31\x00\x39\x00\x00\x00\x1f\x00\x00\x00\x00\x00\x00\x00\x0a\x00\x0b\x00\x00\x00\x32\x00\x20\x00\x00\x00\x21\x00\x22\x00\x23\x00\x24\x00\x25\x00\x00\x00\x0d\x00\x26\x00\x73\x01\x27\x00\x00\x00\x28\x00\x0e\x00\x00\x00\x00\x00\x00\x00\x57\x01\x34\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x51\x01\x13\x00\x14\x00\x00\x00\x16\x00\x17\x00\x52\x01\x29\x00\x00\x00\x00\x00\x00\x00\x2a\x00\x2b\x00\x00\x00\x3b\x00\x00\x00\x2c\x00\x2d\x00\x1e\x00\x2e\x00\x00\x00\x00\x00\x2f\x00\x47\x00\x30\x00\x00\x00\x31\x00\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x0a\x00\x0b\x00\x20\x00\x32\x00\x21\x00\x22\x00\x23\x00\x24\x00\x25\x00\x00\x00\x0d\x00\x26\x00\x00\x00\x27\x00\x00\x00\x28\x00\x0e\x00\x00\x00\x00\x00\x00\x00\x33\x00\x56\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x51\x01\x13\x00\x14\x00\x00\x00\x16\x00\x17\x00\x52\x01\x29\x00\x00\x00\x00\x00\x00\x00\x2a\x00\x2b\x00\x00\x00\x37\x00\x00\x00\x2c\x00\x2d\x00\x00\x00\x2e\x00\x1e\x00\x00\x00\x2f\x00\x00\x00\x30\x00\x00\x00\x31\x00\x39\x00\x00\x00\x1f\x00\x00\x00\x00\x00\x00\x00\x0a\x00\x0b\x00\x00\x00\x32\x00\x20\x00\x00\x00\x21\x00\x22\x00\x23\x00\x24\x00\x25\x00\x00\x00\x1e\x00\x26\x00\x00\x00\x27\x00\x00\x00\x28\x00\x00\x00\x00\x00\x00\x00\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x20\x00\x00\x00\x21\x00\x22\x00\x23\x00\x24\x00\x25\x00\x00\x00\x00\x00\x26\x00\x29\x00\x27\x00\x00\x00\x28\x00\x2a\x00\x2b\x00\x00\x00\x00\x00\x00\x00\x2c\x00\x2d\x00\x00\x00\x2e\x00\x00\x00\x00\x00\x2f\x00\x47\x00\x30\x00\x00\x00\x31\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x29\x00\x0a\x00\x0b\x00\x00\x00\x32\x00\x58\x00\x00\x00\x00\x00\x00\x00\x2c\x00\x2d\x00\x00\x00\x2e\x00\x1e\x00\x00\x00\x61\x00\x00\x00\x62\x00\x3d\x00\x63\x00\x3e\x00\x00\x00\x45\x00\x00\x00\x00\x00\x46\x00\x0a\x00\x0b\x00\x00\x00\x32\x00\x20\x00\x00\x00\x21\x00\x22\x00\x23\x00\x24\x00\x25\x00\x00\x00\x0d\x00\x26\x00\x00\x00\x27\x00\x00\x00\x28\x00\x0e\x00\x00\x00\x00\x00\x00\x00\x99\x01\x34\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x51\x00\x52\x00\x51\x01\x13\x00\x14\x00\x53\x00\x16\x00\x17\x00\x52\x01\x29\x00\x00\x00\x6f\x00\x00\x00\x70\x00\x58\x00\x71\x00\x67\x01\x00\x00\x2c\x00\x2d\x00\x1e\x00\x2e\x00\x0a\x00\x00\x00\x61\x00\x75\x01\x62\x00\x00\x00\x63\x00\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x0a\x00\x0b\x00\x20\x00\x32\x00\x21\x00\x22\x00\x23\x00\x24\x00\x25\x00\x00\x00\x1e\x00\x26\x00\x00\x00\x27\x00\x00\x00\x28\x00\x00\x00\x00\x00\x00\x00\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x20\x00\x00\x00\x21\x00\x22\x00\x23\x00\x24\x00\x25\x00\x00\x00\x00\x00\x26\x00\x29\x00\x27\x00\x00\x00\x28\x00\x2a\x00\x2b\x00\x00\x00\x00\x00\x00\x00\x2c\x00\x2d\x00\x00\x00\x2e\x00\x00\x00\x00\x00\x2f\x00\x00\x00\x30\x00\x00\x00\x31\x00\x39\x00\x00\x00\x00\x00\x00\x00\x00\x00\x29\x00\x0a\x00\x0b\x00\x00\x00\x32\x00\x58\x00\x00\x00\x00\x00\x00\x00\x2c\x00\x2d\x00\x5c\xff\x2e\x00\x1e\x00\x5c\xff\x61\x00\x00\x00\x62\x00\x00\x00\x63\x00\x00\x00\x00\x00\x1f\x00\x00\x00\x00\x00\x00\x00\x0a\x00\x0b\x00\x00\x00\x32\x00\x20\x00\x00\x00\x21\x00\x22\x00\x23\x00\x24\x00\x25\x00\x00\x00\x1e\x00\x26\x00\x00\x00\x27\x00\x00\x00\x28\x00\x00\x00\x00\x00\x00\x00\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x20\x00\x00\x00\x21\x00\x22\x00\x23\x00\x24\x00\x25\x00\x00\x00\x00\x00\x26\x00\x29\x00\x27\x00\x00\x00\x28\x00\x2a\x00\x2b\x00\x00\x00\x00\x00\x00\x00\x2c\x00\x2d\x00\x00\x00\x2e\x00\x00\x00\x00\x00\x2f\x00\x00\x00\x30\x00\x00\x00\x31\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x29\x00\x0a\x00\x0b\x00\x00\x00\x32\x00\x58\x00\x00\x00\x00\x00\x00\x00\x2c\x00\x2d\x00\x00\x00\x2e\x00\x1e\x00\x00\x00\x61\x00\x00\x00\x62\x00\x00\x00\x63\x00\x95\x01\x00\x00\x1f\x00\x00\x00\x00\x00\x00\x00\x0a\x00\x0b\x00\x00\x00\x32\x00\x20\x00\x00\x00\x21\x00\x22\x00\x23\x00\x24\x00\x25\x00\x00\x00\x1e\x00\x26\x00\x00\x00\x27\x00\x00\x00\x28\x00\x00\x00\x00\x00\x00\x00\x45\x00\x00\x00\x00\x00\x46\x00\x00\x00\x00\x00\x00\x00\x00\x00\x20\x00\x00\x00\x21\x00\x22\x00\x23\x00\x24\x00\x25\x00\x00\x00\x00\x00\x26\x00\x29\x00\x27\x00\x00\x00\x28\x00\x2a\x00\x2b\x00\x00\x00\x00\x00\x00\x00\x2c\x00\x2d\x00\x00\x00\x2e\x00\x00\x00\x00\x00\x2f\x00\x00\x00\x30\x00\x00\x00\x31\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x29\x00\x0a\x00\x0b\x00\x00\x00\x32\x00\x58\x00\x00\x00\x00\x00\x00\x00\x2c\x00\x2d\x00\x1e\x00\x2e\x00\x00\x00\x00\x00\x61\x00\x00\x00\x62\x00\x00\x00\x63\x00\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x0a\x00\x0b\x00\x20\x00\x32\x00\x21\x00\x22\x00\x23\x00\x24\x00\x25\x00\x00\x00\x1e\x00\x26\x00\x00\x00\x27\x00\x00\x00\x28\x00\x00\x00\x00\x00\x00\x00\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x20\x00\x00\x00\x21\x00\x22\x00\x23\x00\x24\x00\x25\x00\x00\x00\x00\x00\x26\x00\x29\x00\x27\x00\x00\x00\x28\x00\x2a\x00\x2b\x00\x00\x00\x00\x00\x00\x00\x2c\x00\x2d\x00\x00\x00\x2e\x00\x00\x00\x00\x00\x2f\x00\x00\x00\x30\x00\x00\x00\x31\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x29\x00\x0a\x00\x0b\x00\x00\x00\x32\x00\x58\x00\x00\x00\x00\x00\x00\x00\x2c\x00\x2d\x00\x00\x00\x2e\x00\x1e\x00\x00\x00\x61\x00\x00\x00\x62\x00\x00\x00\x63\x00\x73\x01\x00\x00\x1f\x00\x00\x00\x00\x00\x00\x00\x0a\x00\x0b\x00\x00\x00\x32\x00\x20\x00\x00\x00\x21\x00\x22\x00\x23\x00\x24\x00\x25\x00\x00\x00\x1e\x00\x26\x00\x00\x00\x27\x00\x00\x00\x28\x00\x00\x00\x00\x00\x00\x00\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x20\x00\x00\x00\x21\x00\x22\x00\x23\x00\x24\x00\x25\x00\x00\x00\x00\x00\x26\x00\x29\x00\x27\x00\x00\x00\x28\x00\x2a\x00\x2b\x00\x00\x00\x00\x00\x00\x00\x2c\x00\x2d\x00\x00\x00\x2e\x00\x00\x00\x00\x00\x2f\x00\x00\x00\x30\x00\x00\x00\x31\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x29\x00\x0a\x00\x0b\x00\x00\x00\x32\x00\x58\x00\x00\x00\x00\x00\x00\x00\x2c\x00\x2d\x00\x00\x00\x2e\x00\x00\x00\x00\x00\x61\x00\x00\x00\x62\x00\x00\x00\x63\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x0a\x00\x0b\x00\x20\x00\x32\x00\x21\x00\x00\x00\x00\x00\x24\x00\x25\x00\x00\x00\x00\x00\x26\x00\x00\x00\x51\x00\x52\x00\x28\x00\x00\x00\x00\x00\x53\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x7f\x01\x20\x00\x80\x01\x21\x00\x81\x01\x00\x00\x24\x00\x25\x00\x00\x00\x00\x00\x26\x00\x0a\x00\x00\x00\x29\x00\x28\x00\x00\x00\x51\x00\x52\x00\x58\x00\x00\x00\x00\x00\x53\x00\x2c\x00\x2d\x00\x00\x00\x00\x00\x00\x00\x6f\x00\x61\x00\x70\x00\x62\x00\x71\x00\x63\x00\x00\x00\x00\x00\x00\x00\x29\x00\x00\x00\x0a\x00\x0a\x00\x0b\x00\x58\x00\x32\x00\x00\x00\x00\x00\x2c\x00\x2d\x00\x00\x00\x00\x00\x00\x00\x00\x00\x61\x00\x00\x00\x62\x00\x00\x00\x65\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x0a\x00\x0b\x00\x20\x00\x32\x00\x21\x00\x00\x00\x00\x00\x24\x00\x25\x00\x00\x00\x00\x00\x26\x00\x00\x00\x51\x00\x52\x00\x28\x00\x00\x00\x00\x00\x53\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x7f\x01\x20\x00\x80\x01\x21\x00\x81\x01\x00\x00\x24\x00\x25\x00\x00\x00\x00\x00\x26\x00\x0a\x00\x00\x00\x29\x00\x28\x00\x00\x00\x51\x00\x52\x00\x58\x00\x00\x00\x00\x00\x53\x00\x2c\x00\x2d\x00\x00\x00\x00\x00\x00\x00\x6f\x00\x61\x00\x70\x00\x62\x00\xdc\x01\x63\x00\x00\x00\x00\x00\x00\x00\x29\x00\x00\x00\x0a\x00\x0a\x00\x0b\x00\x58\x00\x32\x00\x00\x00\x00\x00\x2c\x00\x2d\x00\x00\x00\x00\x00\x00\x00\x00\x00\x59\x00\x00\x00\x5a\x00\x00\x00\x5b\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x0a\x00\x0b\x00\x20\x00\x32\x00\x21\x00\x00\x00\x00\x00\x24\x00\x25\x00\x00\x00\x00\x00\x26\x00\x00\x00\x51\x00\x52\x00\x28\x00\x00\x00\x00\x00\x53\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x6f\x00\x20\x00\x70\x00\x21\x00\x71\x00\x00\x00\x24\x00\x25\x00\x00\x00\x00\x00\x26\x00\x0a\x00\x00\x00\x29\x00\x28\x00\x00\x00\x51\x00\x52\x00\x58\x00\x00\x00\x00\x00\x53\x00\x2c\x00\x2d\x00\x00\x00\x00\x00\x00\x00\x7f\x01\x61\x00\x80\x01\x62\x00\x81\x01\x63\x00\x00\x00\x00\x00\x00\x00\x29\x00\x00\x00\x0a\x00\x0a\x00\x0b\x00\x58\x00\x32\x00\x00\x00\x00\x00\x2c\x00\x2d\x00\x00\x00\x0d\x00\x00\x00\x00\x00\x61\x00\x00\x00\x62\x00\x0e\x00\x65\x00\x00\x00\x00\x00\x33\x00\x56\x01\x00\x00\x00\x00\x0a\x00\x0b\x00\x00\x00\x32\x00\x00\x00\x00\x00\x6d\x01\x13\x00\x14\x00\x6e\x01\x16\x00\x17\x00\x18\x00\x0d\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x0e\x00\x37\x00\x00\x00\x00\x00\x00\x00\x00\x00\x3e\x00\x6f\x01\x70\x01\x00\x00\x71\x01\x3f\x00\x10\x00\x11\x00\x40\x00\x13\x00\x14\x00\x15\x00\x16\x00\x17\x00\x18\x00\x00\x00\x00\x00\x00\x00\x19\x00\x1a\x00\x1b\x00\x1c\x00\x0d\x00\x6c\x01\x39\x00\x00\x00\x00\x00\x00\x00\x0e\x00\x00\x00\x00\x00\x00\x00\x33\x00\x34\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x3a\x00\x10\x00\x11\x00\x36\x00\x13\x00\x14\x00\x15\x00\x16\x00\x17\x00\x18\x00\x00\x00\x00\x00\x00\x00\x19\x00\x1a\x00\x1b\x00\x1c\x00\x6b\x01\x0d\x00\x00\x00\x39\x00\x00\x00\x00\x00\x00\x00\x0e\x00\x00\x00\x00\x00\x00\x00\x33\x00\x34\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x3a\x00\x10\x00\x11\x00\x36\x00\x13\x00\x14\x00\x15\x00\x16\x00\x17\x00\x18\x00\x00\x00\x00\x00\x0d\x00\x19\x00\x1a\x00\x1b\x00\x1c\x00\x3b\x00\x0e\x00\x00\x00\x00\x00\x00\x00\x33\x00\x34\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x35\x00\x10\x00\x11\x00\x36\x00\x13\x00\x14\x00\x15\x00\x16\x00\x17\x00\x18\x00\x00\x00\x00\x00\x0d\x00\x19\x00\x1a\x00\x1b\x00\x1c\x00\x6a\x01\x0e\x00\x00\x00\x00\x00\x00\x00\x33\x00\x34\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x35\x00\x10\x00\x11\x00\x36\x00\x13\x00\x14\x00\x15\x00\x16\x00\x17\x00\x18\x00\x00\x00\x00\x00\x17\x02\x19\x00\x1a\x00\x1b\x00\x1c\x00\x37\x00\x0e\x00\x00\x00\x00\x00\x00\x00\x33\x00\x56\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x51\x01\x13\x00\x14\x00\x00\x00\x16\x00\x17\x00\x52\x01\xa8\x01\x63\x01\x64\x01\x0d\x00\x00\x00\x00\x00\x00\x00\x37\x00\x00\x00\x0e\x00\x0d\x00\x00\x00\x00\x00\x9a\x01\x34\x00\x00\x00\x0e\x00\x00\x00\x00\x00\x00\x00\x9b\x01\x34\x00\x00\x00\x51\x01\x13\x00\x14\x00\x00\x00\x16\x00\x17\x00\x52\x01\x51\x01\x13\x00\x14\x00\x00\x00\x16\x00\x17\x00\x52\x01\x68\x01\x00\x00\x0d\x00\x00\x00\x00\x00\x00\x00\x00\x00\x6a\x01\x0e\x00\x0d\x00\x00\x00\x00\x00\x9c\x01\x34\x00\x00\x00\x0e\x00\x00\x00\x00\x00\x00\x00\x33\x00\x34\x00\x00\x00\x51\x01\x13\x00\x14\x00\x00\x00\x16\x00\x17\x00\x52\x01\x51\x01\x13\x00\x14\x00\x00\x00\x16\x00\x17\x00\x52\x01\x6b\x01\x00\x00\x0d\x00\x00\x00\x00\x00\x00\x00\x00\x00\x6a\x01\x0e\x00\x0d\x00\x00\x00\x00\x00\x33\x00\x34\x00\x00\x00\x0e\x00\x00\x00\x00\x00\x00\x00\x33\x00\x34\x00\x00\x00\x51\x01\x13\x00\x14\x00\x00\x00\x16\x00\x17\x00\x52\x01\x51\x01\x13\x00\x14\x00\x00\x00\x16\x00\x17\x00\x52\x01\x6b\x01\x00\x00\x0d\x00\x00\x00\x00\x00\x00\x00\x00\x00\x37\x00\x0e\x00\x0d\x00\x00\x00\x00\x00\x33\x00\x34\x00\x00\x00\x0e\x00\x00\x00\x00\x00\x00\x00\x33\x00\x56\x01\x00\x00\x51\x01\x13\x00\x14\x00\x00\x00\x16\x00\x17\x00\x52\x01\x51\x01\x13\x00\x14\x00\x00\x00\x16\x00\x17\x00\x52\x01\x3b\x00\x00\x00\x0d\x00\x00\x00\x00\x00\x00\x00\x00\x00\x37\x00\x0e\x00\x0d\x00\x00\x00\x00\x00\x57\x01\x34\x00\x00\x00\x0e\x00\x00\x00\x00\x00\x00\x00\x33\x00\x34\x00\x00\x00\x51\x01\x13\x00\x14\x00\x00\x00\x16\x00\x17\x00\x52\x01\x51\x01\x13\x00\x14\x00\x00\x00\x16\x00\x17\x00\x52\x01\x3b\x00\x00\x00\x0d\x00\x00\x00\x00\x00\x00\x00\x00\x00\x67\x01\x0e\x00\x00\x00\x00\x00\x00\x00\x33\x00\x34\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x51\x01\x13\x00\x14\x00\x00\x00\x16\x00\x17\x00\x52\x01\x0d\x00\x00\x00\x39\x00\x00\x00\x00\x00\x00\x00\x0e\x00\x68\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x3a\x00\x10\x00\x11\x00\x12\x00\x13\x00\x14\x00\x15\x00\x16\x00\x17\x00\x18\x00\x00\x00\x0d\x00\x00\x00\x19\x00\x1a\x00\x1b\x00\x1c\x00\x0e\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x5e\x02\x10\x00\x11\x00\x12\x00\x13\x00\x14\x00\x15\x00\x16\x00\x17\x00\x18\x00\x00\x00\x0d\x00\x00\x00\x19\x00\x1a\x00\x1b\x00\x1c\x00\x0e\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x60\x02\x10\x00\x11\x00\x12\x00\x13\x00\x14\x00\x15\x00\x16\x00\x17\x00\x18\x00\x00\x00\x0d\x00\x00\x00\x19\x00\x1a\x00\x1b\x00\x1c\x00\x0e\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x73\x02\x10\x00\x11\x00\x12\x00\x13\x00\x14\x00\x15\x00\x16\x00\x17\x00\x18\x00\x00\x00\x0d\x00\x00\x00\x19\x00\x1a\x00\x1b\x00\x1c\x00\x0e\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x74\x02\x10\x00\x11\x00\x12\x00\x13\x00\x14\x00\x15\x00\x16\x00\x17\x00\x18\x00\x00\x00\x0d\x00\x00\x00\x19\x00\x1a\x00\x1b\x00\x1c\x00\x0e\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x76\x02\x10\x00\x11\x00\x12\x00\x13\x00\x14\x00\x15\x00\x16\x00\x17\x00\x18\x00\x00\x00\x0d\x00\x00\x00\x19\x00\x1a\x00\x1b\x00\x1c\x00\x0e\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x0e\x02\x10\x00\x11\x00\x12\x00\x13\x00\x14\x00\x15\x00\x16\x00\x17\x00\x18\x00\x00\x00\x0d\x00\x00\x00\x19\x00\x1a\x00\x1b\x00\x1c\x00\x0e\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x47\x02\x10\x00\x11\x00\x12\x00\x13\x00\x14\x00\x15\x00\x16\x00\x17\x00\x18\x00\x00\x00\x0d\x00\x00\x00\x19\x00\x1a\x00\x1b\x00\x1c\x00\x0e\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x48\x02\x10\x00\x11\x00\x12\x00\x13\x00\x14\x00\x15\x00\x16\x00\x17\x00\x18\x00\x00\x00\x0d\x00\x00\x00\x19\x00\x1a\x00\x1b\x00\x1c\x00\x0e\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x4b\x02\x10\x00\x11\x00\x12\x00\x13\x00\x14\x00\x15\x00\x16\x00\x17\x00\x18\x00\x00\x00\x0d\x00\x00\x00\x19\x00\x1a\x00\x1b\x00\x1c\x00\x0e\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x90\x01\x10\x00\x11\x00\x12\x00\x13\x00\x14\x00\x15\x00\x16\x00\x17\x00\x18\x00\x00\x00\x0d\x00\x00\x00\x19\x00\x1a\x00\x1b\x00\x1c\x00\x0e\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x91\x01\x10\x00\x11\x00\x12\x00\x13\x00\x14\x00\x15\x00\x16\x00\x17\x00\x18\x00\x00\x00\x0d\x00\x00\x00\x19\x00\x1a\x00\x1b\x00\x1c\x00\x0e\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xac\x01\x10\x00\x11\x00\x12\x00\x13\x00\x14\x00\x15\x00\x16\x00\x17\x00\x18\x00\x00\x00\x0d\x00\x00\x00\x19\x00\x1a\x00\x1b\x00\x1c\x00\x0e\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xad\x01\x10\x00\x11\x00\x12\x00\x13\x00\x14\x00\x15\x00\x16\x00\x17\x00\x18\x00\x00\x00\x0d\x00\x00\x00\x19\x00\x1a\x00\x1b\x00\x1c\x00\x0e\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xae\x01\x10\x00\x11\x00\x12\x00\x13\x00\x14\x00\x15\x00\x16\x00\x17\x00\x18\x00\x00\x00\x0d\x00\x00\x00\x19\x00\x1a\x00\x1b\x00\x1c\x00\x0e\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xb7\x01\x10\x00\x11\x00\x12\x00\x13\x00\x14\x00\x15\x00\x16\x00\x17\x00\x18\x00\x00\x00\x0d\x00\x00\x00\x19\x00\x1a\x00\x1b\x00\x1c\x00\x0e\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xb8\x01\x10\x00\x11\x00\x12\x00\x13\x00\x14\x00\x15\x00\x16\x00\x17\x00\x18\x00\x00\x00\x0d\x00\x00\x00\x19\x00\x1a\x00\x1b\x00\x1c\x00\x0e\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x4e\x01\x10\x00\x11\x00\x12\x00\x13\x00\x14\x00\x15\x00\x16\x00\x17\x00\x18\x00\x00\x00\x0d\x00\x00\x00\x19\x00\x1a\x00\x1b\x00\x1c\x00\x0e\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x50\x01\x10\x00\x11\x00\x12\x00\x13\x00\x14\x00\x15\x00\x16\x00\x17\x00\x18\x00\x00\x00\x0d\x00\x00\x00\x19\x00\x1a\x00\x1b\x00\x1c\x00\x0e\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x5b\x01\x10\x00\x11\x00\x12\x00\x13\x00\x14\x00\x15\x00\x16\x00\x17\x00\x18\x00\x00\x00\x0d\x00\x00\x00\x19\x00\x1a\x00\x1b\x00\x1c\x00\x0e\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x35\x00\x10\x00\x11\x00\x12\x00\x13\x00\x14\x00\x15\x00\x16\x00\x17\x00\x18\x00\x00\x00\x0d\x00\x00\x00\x19\x00\x1a\x00\x1b\x00\x1c\x00\x0e\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x3f\x00\x10\x00\x11\x00\x12\x00\x13\x00\x14\x00\x15\x00\x16\x00\x17\x00\x18\x00\x00\x00\x0d\x00\x00\x00\x19\x00\x1a\x00\x1b\x00\x1c\x00\x0e\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x82\x01\x10\x00\x11\x00\x12\x00\x13\x00\x14\x00\x15\x00\x16\x00\x17\x00\x18\x00\x00\x00\x0d\x00\x00\x00\x19\x00\x1a\x00\x1b\x00\x1c\x00\x0e\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x76\x00\x10\x00\x11\x00\x12\x00\x13\x00\x14\x00\x15\x00\x16\x00\x17\x00\x18\x00\x00\x00\x0d\x00\x00\x00\x19\x00\x1a\x00\x1b\x00\x1c\x00\x0e\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x0f\x00\x10\x00\x11\x00\x12\x00\x13\x00\x14\x00\x15\x00\x16\x00\x17\x00\x18\x00\x00\x00\x00\x00\x00\x00\x19\x00\x1a\x00\x1b\x00\x1c\x00\x51\x00\x52\x00\x00\x00\x51\x00\x52\x00\x53\x00\x00\x00\x00\x00\x53\x00\x00\x00\x00\x00\x54\x00\x00\x00\x55\x00\x6f\x00\x56\x00\x70\x00\x00\x00\x71\x00\x00\x00\x00\x00\x00\x00\x0a\x00\x00\x00\x00\x00\x0a\x00\x18\x01\x19\x01\x1a\x01\x1b\x01\x1c\x01\x1d\x01\x1e\x01\x1f\x01\x20\x01\x21\x01\x22\x01\x23\x01\x24\x01\x25\x01\x26\x01\x27\x01\x28\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"# happyReduceArr = Happy_Data_Array.array (4, 422) [ (4 , happyReduce_4), (5 , happyReduce_5), (6 , happyReduce_6), (7 , happyReduce_7), (8 , happyReduce_8), (9 , happyReduce_9), (10 , happyReduce_10), (11 , happyReduce_11), (12 , happyReduce_12), (13 , happyReduce_13), (14 , happyReduce_14), (15 , happyReduce_15), (16 , happyReduce_16), (17 , happyReduce_17), (18 , happyReduce_18), (19 , happyReduce_19), (20 , happyReduce_20), (21 , happyReduce_21), (22 , happyReduce_22), (23 , happyReduce_23), (24 , happyReduce_24), (25 , happyReduce_25), (26 , happyReduce_26), (27 , happyReduce_27), (28 , happyReduce_28), (29 , happyReduce_29), (30 , happyReduce_30), (31 , happyReduce_31), (32 , happyReduce_32), (33 , happyReduce_33), (34 , happyReduce_34), (35 , happyReduce_35), (36 , happyReduce_36), (37 , happyReduce_37), (38 , happyReduce_38), (39 , happyReduce_39), (40 , happyReduce_40), (41 , happyReduce_41), (42 , happyReduce_42), (43 , happyReduce_43), (44 , happyReduce_44), (45 , happyReduce_45), (46 , happyReduce_46), (47 , happyReduce_47), (48 , happyReduce_48), (49 , happyReduce_49), (50 , happyReduce_50), (51 , happyReduce_51), (52 , happyReduce_52), (53 , happyReduce_53), (54 , happyReduce_54), (55 , happyReduce_55), (56 , happyReduce_56), (57 , happyReduce_57), (58 , happyReduce_58), (59 , happyReduce_59), (60 , happyReduce_60), (61 , happyReduce_61), (62 , happyReduce_62), (63 , happyReduce_63), (64 , happyReduce_64), (65 , happyReduce_65), (66 , happyReduce_66), (67 , happyReduce_67), (68 , happyReduce_68), (69 , happyReduce_69), (70 , happyReduce_70), (71 , happyReduce_71), (72 , happyReduce_72), (73 , happyReduce_73), (74 , happyReduce_74), (75 , happyReduce_75), (76 , happyReduce_76), (77 , happyReduce_77), (78 , happyReduce_78), (79 , happyReduce_79), (80 , happyReduce_80), (81 , happyReduce_81), (82 , happyReduce_82), (83 , happyReduce_83), (84 , happyReduce_84), (85 , happyReduce_85), (86 , happyReduce_86), (87 , happyReduce_87), (88 , happyReduce_88), (89 , happyReduce_89), (90 , happyReduce_90), (91 , happyReduce_91), (92 , happyReduce_92), (93 , happyReduce_93), (94 , happyReduce_94), (95 , happyReduce_95), (96 , happyReduce_96), (97 , happyReduce_97), (98 , happyReduce_98), (99 , happyReduce_99), (100 , happyReduce_100), (101 , happyReduce_101), (102 , happyReduce_102), (103 , happyReduce_103), (104 , happyReduce_104), (105 , happyReduce_105), (106 , happyReduce_106), (107 , happyReduce_107), (108 , happyReduce_108), (109 , happyReduce_109), (110 , happyReduce_110), (111 , happyReduce_111), (112 , happyReduce_112), (113 , happyReduce_113), (114 , happyReduce_114), (115 , happyReduce_115), (116 , happyReduce_116), (117 , happyReduce_117), (118 , happyReduce_118), (119 , happyReduce_119), (120 , happyReduce_120), (121 , happyReduce_121), (122 , happyReduce_122), (123 , happyReduce_123), (124 , happyReduce_124), (125 , happyReduce_125), (126 , happyReduce_126), (127 , happyReduce_127), (128 , happyReduce_128), (129 , happyReduce_129), (130 , happyReduce_130), (131 , happyReduce_131), (132 , happyReduce_132), (133 , happyReduce_133), (134 , happyReduce_134), (135 , happyReduce_135), (136 , happyReduce_136), (137 , happyReduce_137), (138 , happyReduce_138), (139 , happyReduce_139), (140 , happyReduce_140), (141 , happyReduce_141), (142 , happyReduce_142), (143 , happyReduce_143), (144 , happyReduce_144), (145 , happyReduce_145), (146 , happyReduce_146), (147 , happyReduce_147), (148 , happyReduce_148), (149 , happyReduce_149), (150 , happyReduce_150), (151 , happyReduce_151), (152 , happyReduce_152), (153 , happyReduce_153), (154 , happyReduce_154), (155 , happyReduce_155), (156 , happyReduce_156), (157 , happyReduce_157), (158 , happyReduce_158), (159 , happyReduce_159), (160 , happyReduce_160), (161 , happyReduce_161), (162 , happyReduce_162), (163 , happyReduce_163), (164 , happyReduce_164), (165 , happyReduce_165), (166 , happyReduce_166), (167 , happyReduce_167), (168 , happyReduce_168), (169 , happyReduce_169), (170 , happyReduce_170), (171 , happyReduce_171), (172 , happyReduce_172), (173 , happyReduce_173), (174 , happyReduce_174), (175 , happyReduce_175), (176 , happyReduce_176), (177 , happyReduce_177), (178 , happyReduce_178), (179 , happyReduce_179), (180 , happyReduce_180), (181 , happyReduce_181), (182 , happyReduce_182), (183 , happyReduce_183), (184 , happyReduce_184), (185 , happyReduce_185), (186 , happyReduce_186), (187 , happyReduce_187), (188 , happyReduce_188), (189 , happyReduce_189), (190 , happyReduce_190), (191 , happyReduce_191), (192 , happyReduce_192), (193 , happyReduce_193), (194 , happyReduce_194), (195 , happyReduce_195), (196 , happyReduce_196), (197 , happyReduce_197), (198 , happyReduce_198), (199 , happyReduce_199), (200 , happyReduce_200), (201 , happyReduce_201), (202 , happyReduce_202), (203 , happyReduce_203), (204 , happyReduce_204), (205 , happyReduce_205), (206 , happyReduce_206), (207 , happyReduce_207), (208 , happyReduce_208), (209 , happyReduce_209), (210 , happyReduce_210), (211 , happyReduce_211), (212 , happyReduce_212), (213 , happyReduce_213), (214 , happyReduce_214), (215 , happyReduce_215), (216 , happyReduce_216), (217 , happyReduce_217), (218 , happyReduce_218), (219 , happyReduce_219), (220 , happyReduce_220), (221 , happyReduce_221), (222 , happyReduce_222), (223 , happyReduce_223), (224 , happyReduce_224), (225 , happyReduce_225), (226 , happyReduce_226), (227 , happyReduce_227), (228 , happyReduce_228), (229 , happyReduce_229), (230 , happyReduce_230), (231 , happyReduce_231), (232 , happyReduce_232), (233 , happyReduce_233), (234 , happyReduce_234), (235 , happyReduce_235), (236 , happyReduce_236), (237 , happyReduce_237), (238 , happyReduce_238), (239 , happyReduce_239), (240 , happyReduce_240), (241 , happyReduce_241), (242 , happyReduce_242), (243 , happyReduce_243), (244 , happyReduce_244), (245 , happyReduce_245), (246 , happyReduce_246), (247 , happyReduce_247), (248 , happyReduce_248), (249 , happyReduce_249), (250 , happyReduce_250), (251 , happyReduce_251), (252 , happyReduce_252), (253 , happyReduce_253), (254 , happyReduce_254), (255 , happyReduce_255), (256 , happyReduce_256), (257 , happyReduce_257), (258 , happyReduce_258), (259 , happyReduce_259), (260 , happyReduce_260), (261 , happyReduce_261), (262 , happyReduce_262), (263 , happyReduce_263), (264 , happyReduce_264), (265 , happyReduce_265), (266 , happyReduce_266), (267 , happyReduce_267), (268 , happyReduce_268), (269 , happyReduce_269), (270 , happyReduce_270), (271 , happyReduce_271), (272 , happyReduce_272), (273 , happyReduce_273), (274 , happyReduce_274), (275 , happyReduce_275), (276 , happyReduce_276), (277 , happyReduce_277), (278 , happyReduce_278), (279 , happyReduce_279), (280 , happyReduce_280), (281 , happyReduce_281), (282 , happyReduce_282), (283 , happyReduce_283), (284 , happyReduce_284), (285 , happyReduce_285), (286 , happyReduce_286), (287 , happyReduce_287), (288 , happyReduce_288), (289 , happyReduce_289), (290 , happyReduce_290), (291 , happyReduce_291), (292 , happyReduce_292), (293 , happyReduce_293), (294 , happyReduce_294), (295 , happyReduce_295), (296 , happyReduce_296), (297 , happyReduce_297), (298 , happyReduce_298), (299 , happyReduce_299), (300 , happyReduce_300), (301 , happyReduce_301), (302 , happyReduce_302), (303 , happyReduce_303), (304 , happyReduce_304), (305 , happyReduce_305), (306 , happyReduce_306), (307 , happyReduce_307), (308 , happyReduce_308), (309 , happyReduce_309), (310 , happyReduce_310), (311 , happyReduce_311), (312 , happyReduce_312), (313 , happyReduce_313), (314 , happyReduce_314), (315 , happyReduce_315), (316 , happyReduce_316), (317 , happyReduce_317), (318 , happyReduce_318), (319 , happyReduce_319), (320 , happyReduce_320), (321 , happyReduce_321), (322 , happyReduce_322), (323 , happyReduce_323), (324 , happyReduce_324), (325 , happyReduce_325), (326 , happyReduce_326), (327 , happyReduce_327), (328 , happyReduce_328), (329 , happyReduce_329), (330 , happyReduce_330), (331 , happyReduce_331), (332 , happyReduce_332), (333 , happyReduce_333), (334 , happyReduce_334), (335 , happyReduce_335), (336 , happyReduce_336), (337 , happyReduce_337), (338 , happyReduce_338), (339 , happyReduce_339), (340 , happyReduce_340), (341 , happyReduce_341), (342 , happyReduce_342), (343 , happyReduce_343), (344 , happyReduce_344), (345 , happyReduce_345), (346 , happyReduce_346), (347 , happyReduce_347), (348 , happyReduce_348), (349 , happyReduce_349), (350 , happyReduce_350), (351 , happyReduce_351), (352 , happyReduce_352), (353 , happyReduce_353), (354 , happyReduce_354), (355 , happyReduce_355), (356 , happyReduce_356), (357 , happyReduce_357), (358 , happyReduce_358), (359 , happyReduce_359), (360 , happyReduce_360), (361 , happyReduce_361), (362 , happyReduce_362), (363 , happyReduce_363), (364 , happyReduce_364), (365 , happyReduce_365), (366 , happyReduce_366), (367 , happyReduce_367), (368 , happyReduce_368), (369 , happyReduce_369), (370 , happyReduce_370), (371 , happyReduce_371), (372 , happyReduce_372), (373 , happyReduce_373), (374 , happyReduce_374), (375 , happyReduce_375), (376 , happyReduce_376), (377 , happyReduce_377), (378 , happyReduce_378), (379 , happyReduce_379), (380 , happyReduce_380), (381 , happyReduce_381), (382 , happyReduce_382), (383 , happyReduce_383), (384 , happyReduce_384), (385 , happyReduce_385), (386 , happyReduce_386), (387 , happyReduce_387), (388 , happyReduce_388), (389 , happyReduce_389), (390 , happyReduce_390), (391 , happyReduce_391), (392 , happyReduce_392), (393 , happyReduce_393), (394 , happyReduce_394), (395 , happyReduce_395), (396 , happyReduce_396), (397 , happyReduce_397), (398 , happyReduce_398), (399 , happyReduce_399), (400 , happyReduce_400), (401 , happyReduce_401), (402 , happyReduce_402), (403 , happyReduce_403), (404 , happyReduce_404), (405 , happyReduce_405), (406 , happyReduce_406), (407 , happyReduce_407), (408 , happyReduce_408), (409 , happyReduce_409), (410 , happyReduce_410), (411 , happyReduce_411), (412 , happyReduce_412), (413 , happyReduce_413), (414 , happyReduce_414), (415 , happyReduce_415), (416 , happyReduce_416), (417 , happyReduce_417), (418 , happyReduce_418), (419 , happyReduce_419), (420 , happyReduce_420), (421 , happyReduce_421), (422 , happyReduce_422) ] happy_n_terms = 90 :: Int happy_n_nonterms = 140 :: Int happyReduce_4 = happySpecReduce_1 0# happyReduction_4 happyReduction_4 happy_x_1 = case happyOut8 happy_x_1 of { happy_var_1 -> happyIn7 (reverse happy_var_1 )} happyReduce_5 = happySpecReduce_2 1# happyReduction_5 happyReduction_5 happy_x_2 happy_x_1 = case happyOut8 happy_x_1 of { happy_var_1 -> case happyOut9 happy_x_2 of { happy_var_2 -> happyIn8 (happy_var_2 : happy_var_1 )}} happyReduce_6 = happySpecReduce_0 1# happyReduction_6 happyReduction_6 = happyIn8 ([] ) happyReduce_7 = happySpecReduce_1 2# happyReduction_7 happyReduction_7 happy_x_1 = case happyOutTok happy_x_1 of { (TokKeyword KwAbstract happy_var_1) -> happyIn9 (TokKeyword KwAbstract happy_var_1 )} happyReduce_8 = happySpecReduce_1 2# happyReduction_8 happyReduction_8 happy_x_1 = case happyOutTok happy_x_1 of { (TokKeyword KwCoData happy_var_1) -> happyIn9 (TokKeyword KwCoData happy_var_1 )} happyReduce_9 = happySpecReduce_1 2# happyReduction_9 happyReduction_9 happy_x_1 = case happyOutTok happy_x_1 of { (TokKeyword KwCoInductive happy_var_1) -> happyIn9 (TokKeyword KwCoInductive happy_var_1 )} happyReduce_10 = happySpecReduce_1 2# happyReduction_10 happyReduction_10 happy_x_1 = case happyOutTok happy_x_1 of { (TokKeyword KwConstructor happy_var_1) -> happyIn9 (TokKeyword KwConstructor happy_var_1 )} happyReduce_11 = happySpecReduce_1 2# happyReduction_11 happyReduction_11 happy_x_1 = case happyOutTok happy_x_1 of { (TokKeyword KwData happy_var_1) -> happyIn9 (TokKeyword KwData happy_var_1 )} happyReduce_12 = happySpecReduce_1 2# happyReduction_12 happyReduction_12 happy_x_1 = case happyOutTok happy_x_1 of { (TokKeyword KwField happy_var_1) -> happyIn9 (TokKeyword KwField happy_var_1 )} happyReduce_13 = happySpecReduce_1 2# happyReduction_13 happyReduction_13 happy_x_1 = case happyOutTok happy_x_1 of { (TokKeyword KwForall happy_var_1) -> happyIn9 (TokKeyword KwForall happy_var_1 )} happyReduce_14 = happySpecReduce_1 2# happyReduction_14 happyReduction_14 happy_x_1 = case happyOutTok happy_x_1 of { (TokKeyword KwHiding happy_var_1) -> happyIn9 (TokKeyword KwHiding happy_var_1 )} happyReduce_15 = happySpecReduce_1 2# happyReduction_15 happyReduction_15 happy_x_1 = case happyOutTok happy_x_1 of { (TokKeyword KwImport happy_var_1) -> happyIn9 (TokKeyword KwImport happy_var_1 )} happyReduce_16 = happySpecReduce_1 2# happyReduction_16 happyReduction_16 happy_x_1 = case happyOutTok happy_x_1 of { (TokKeyword KwIn happy_var_1) -> happyIn9 (TokKeyword KwIn happy_var_1 )} happyReduce_17 = happySpecReduce_1 2# happyReduction_17 happyReduction_17 happy_x_1 = case happyOutTok happy_x_1 of { (TokKeyword KwInductive happy_var_1) -> happyIn9 (TokKeyword KwInductive happy_var_1 )} happyReduce_18 = happySpecReduce_1 2# happyReduction_18 happyReduction_18 happy_x_1 = case happyOutTok happy_x_1 of { (TokKeyword KwInfix happy_var_1) -> happyIn9 (TokKeyword KwInfix happy_var_1 )} happyReduce_19 = happySpecReduce_1 2# happyReduction_19 happyReduction_19 happy_x_1 = case happyOutTok happy_x_1 of { (TokKeyword KwInfixL happy_var_1) -> happyIn9 (TokKeyword KwInfixL happy_var_1 )} happyReduce_20 = happySpecReduce_1 2# happyReduction_20 happyReduction_20 happy_x_1 = case happyOutTok happy_x_1 of { (TokKeyword KwInfixR happy_var_1) -> happyIn9 (TokKeyword KwInfixR happy_var_1 )} happyReduce_21 = happySpecReduce_1 2# happyReduction_21 happyReduction_21 happy_x_1 = case happyOutTok happy_x_1 of { (TokKeyword KwInstance happy_var_1) -> happyIn9 (TokKeyword KwInstance happy_var_1 )} happyReduce_22 = happySpecReduce_1 2# happyReduction_22 happyReduction_22 happy_x_1 = case happyOutTok happy_x_1 of { (TokKeyword KwLet happy_var_1) -> happyIn9 (TokKeyword KwLet happy_var_1 )} happyReduce_23 = happySpecReduce_1 2# happyReduction_23 happyReduction_23 happy_x_1 = case happyOutTok happy_x_1 of { (TokKeyword KwModule happy_var_1) -> happyIn9 (TokKeyword KwModule happy_var_1 )} happyReduce_24 = happySpecReduce_1 2# happyReduction_24 happyReduction_24 happy_x_1 = case happyOutTok happy_x_1 of { (TokKeyword KwMutual happy_var_1) -> happyIn9 (TokKeyword KwMutual happy_var_1 )} happyReduce_25 = happySpecReduce_1 2# happyReduction_25 happyReduction_25 happy_x_1 = case happyOutTok happy_x_1 of { (TokKeyword KwOpen happy_var_1) -> happyIn9 (TokKeyword KwOpen happy_var_1 )} happyReduce_26 = happySpecReduce_1 2# happyReduction_26 happyReduction_26 happy_x_1 = case happyOutTok happy_x_1 of { (TokKeyword KwPatternSyn happy_var_1) -> happyIn9 (TokKeyword KwPatternSyn happy_var_1 )} happyReduce_27 = happySpecReduce_1 2# happyReduction_27 happyReduction_27 happy_x_1 = case happyOutTok happy_x_1 of { (TokKeyword KwPostulate happy_var_1) -> happyIn9 (TokKeyword KwPostulate happy_var_1 )} happyReduce_28 = happySpecReduce_1 2# happyReduction_28 happyReduction_28 happy_x_1 = case happyOutTok happy_x_1 of { (TokKeyword KwPrimitive happy_var_1) -> happyIn9 (TokKeyword KwPrimitive happy_var_1 )} happyReduce_29 = happySpecReduce_1 2# happyReduction_29 happyReduction_29 happy_x_1 = case happyOutTok happy_x_1 of { (TokKeyword KwPrivate happy_var_1) -> happyIn9 (TokKeyword KwPrivate happy_var_1 )} happyReduce_30 = happySpecReduce_1 2# happyReduction_30 happyReduction_30 happy_x_1 = case happyOutTok happy_x_1 of { (TokKeyword KwProp happy_var_1) -> happyIn9 (TokKeyword KwProp happy_var_1 )} happyReduce_31 = happySpecReduce_1 2# happyReduction_31 happyReduction_31 happy_x_1 = case happyOutTok happy_x_1 of { (TokKeyword KwPublic happy_var_1) -> happyIn9 (TokKeyword KwPublic happy_var_1 )} happyReduce_32 = happySpecReduce_1 2# happyReduction_32 happyReduction_32 happy_x_1 = case happyOutTok happy_x_1 of { (TokKeyword KwQuote happy_var_1) -> happyIn9 (TokKeyword KwQuote happy_var_1 )} happyReduce_33 = happySpecReduce_1 2# happyReduction_33 happyReduction_33 happy_x_1 = case happyOutTok happy_x_1 of { (TokKeyword KwQuoteContext happy_var_1) -> happyIn9 (TokKeyword KwQuoteContext happy_var_1 )} happyReduce_34 = happySpecReduce_1 2# happyReduction_34 happyReduction_34 happy_x_1 = case happyOutTok happy_x_1 of { (TokKeyword KwQuoteGoal happy_var_1) -> happyIn9 (TokKeyword KwQuoteGoal happy_var_1 )} happyReduce_35 = happySpecReduce_1 2# happyReduction_35 happyReduction_35 happy_x_1 = case happyOutTok happy_x_1 of { (TokKeyword KwQuoteTerm happy_var_1) -> happyIn9 (TokKeyword KwQuoteTerm happy_var_1 )} happyReduce_36 = happySpecReduce_1 2# happyReduction_36 happyReduction_36 happy_x_1 = case happyOutTok happy_x_1 of { (TokKeyword KwRecord happy_var_1) -> happyIn9 (TokKeyword KwRecord happy_var_1 )} happyReduce_37 = happySpecReduce_1 2# happyReduction_37 happyReduction_37 happy_x_1 = case happyOutTok happy_x_1 of { (TokKeyword KwRenaming happy_var_1) -> happyIn9 (TokKeyword KwRenaming happy_var_1 )} happyReduce_38 = happySpecReduce_1 2# happyReduction_38 happyReduction_38 happy_x_1 = case happyOutTok happy_x_1 of { (TokKeyword KwRewrite happy_var_1) -> happyIn9 (TokKeyword KwRewrite happy_var_1 )} happyReduce_39 = happySpecReduce_1 2# happyReduction_39 happyReduction_39 happy_x_1 = case happyOutTok happy_x_1 of { (TokKeyword KwSet happy_var_1) -> happyIn9 (TokKeyword KwSet happy_var_1 )} happyReduce_40 = happySpecReduce_1 2# happyReduction_40 happyReduction_40 happy_x_1 = case happyOutTok happy_x_1 of { (TokKeyword KwSyntax happy_var_1) -> happyIn9 (TokKeyword KwSyntax happy_var_1 )} happyReduce_41 = happySpecReduce_1 2# happyReduction_41 happyReduction_41 happy_x_1 = case happyOutTok happy_x_1 of { (TokKeyword KwTactic happy_var_1) -> happyIn9 (TokKeyword KwTactic happy_var_1 )} happyReduce_42 = happySpecReduce_1 2# happyReduction_42 happyReduction_42 happy_x_1 = case happyOutTok happy_x_1 of { (TokKeyword KwTo happy_var_1) -> happyIn9 (TokKeyword KwTo happy_var_1 )} happyReduce_43 = happySpecReduce_1 2# happyReduction_43 happyReduction_43 happy_x_1 = case happyOutTok happy_x_1 of { (TokKeyword KwUnquote happy_var_1) -> happyIn9 (TokKeyword KwUnquote happy_var_1 )} happyReduce_44 = happySpecReduce_1 2# happyReduction_44 happyReduction_44 happy_x_1 = case happyOutTok happy_x_1 of { (TokKeyword KwUnquoteDecl happy_var_1) -> happyIn9 (TokKeyword KwUnquoteDecl happy_var_1 )} happyReduce_45 = happySpecReduce_1 2# happyReduction_45 happyReduction_45 happy_x_1 = case happyOutTok happy_x_1 of { (TokKeyword KwUsing happy_var_1) -> happyIn9 (TokKeyword KwUsing happy_var_1 )} happyReduce_46 = happySpecReduce_1 2# happyReduction_46 happyReduction_46 happy_x_1 = case happyOutTok happy_x_1 of { (TokKeyword KwWhere happy_var_1) -> happyIn9 (TokKeyword KwWhere happy_var_1 )} happyReduce_47 = happySpecReduce_1 2# happyReduction_47 happyReduction_47 happy_x_1 = case happyOutTok happy_x_1 of { (TokKeyword KwWith happy_var_1) -> happyIn9 (TokKeyword KwWith happy_var_1 )} happyReduce_48 = happySpecReduce_1 2# happyReduction_48 happyReduction_48 happy_x_1 = case happyOutTok happy_x_1 of { (TokKeyword KwBUILTIN happy_var_1) -> happyIn9 (TokKeyword KwBUILTIN happy_var_1 )} happyReduce_49 = happySpecReduce_1 2# happyReduction_49 happyReduction_49 happy_x_1 = case happyOutTok happy_x_1 of { (TokKeyword KwCOMPILED happy_var_1) -> happyIn9 (TokKeyword KwCOMPILED happy_var_1 )} happyReduce_50 = happySpecReduce_1 2# happyReduction_50 happyReduction_50 happy_x_1 = case happyOutTok happy_x_1 of { (TokKeyword KwCOMPILED_DATA happy_var_1) -> happyIn9 (TokKeyword KwCOMPILED_DATA happy_var_1 )} happyReduce_51 = happySpecReduce_1 2# happyReduction_51 happyReduction_51 happy_x_1 = case happyOutTok happy_x_1 of { (TokKeyword KwCOMPILED_EPIC happy_var_1) -> happyIn9 (TokKeyword KwCOMPILED_EPIC happy_var_1 )} happyReduce_52 = happySpecReduce_1 2# happyReduction_52 happyReduction_52 happy_x_1 = case happyOutTok happy_x_1 of { (TokKeyword KwCOMPILED_EXPORT happy_var_1) -> happyIn9 (TokKeyword KwCOMPILED_EXPORT happy_var_1 )} happyReduce_53 = happySpecReduce_1 2# happyReduction_53 happyReduction_53 happy_x_1 = case happyOutTok happy_x_1 of { (TokKeyword KwCOMPILED_JS happy_var_1) -> happyIn9 (TokKeyword KwCOMPILED_JS happy_var_1 )} happyReduce_54 = happySpecReduce_1 2# happyReduction_54 happyReduction_54 happy_x_1 = case happyOutTok happy_x_1 of { (TokKeyword KwCOMPILED_TYPE happy_var_1) -> happyIn9 (TokKeyword KwCOMPILED_TYPE happy_var_1 )} happyReduce_55 = happySpecReduce_1 2# happyReduction_55 happyReduction_55 happy_x_1 = case happyOutTok happy_x_1 of { (TokKeyword KwETA happy_var_1) -> happyIn9 (TokKeyword KwETA happy_var_1 )} happyReduce_56 = happySpecReduce_1 2# happyReduction_56 happyReduction_56 happy_x_1 = case happyOutTok happy_x_1 of { (TokKeyword KwIMPORT happy_var_1) -> happyIn9 (TokKeyword KwIMPORT happy_var_1 )} happyReduce_57 = happySpecReduce_1 2# happyReduction_57 happyReduction_57 happy_x_1 = case happyOutTok happy_x_1 of { (TokKeyword KwIMPOSSIBLE happy_var_1) -> happyIn9 (TokKeyword KwIMPOSSIBLE happy_var_1 )} happyReduce_58 = happySpecReduce_1 2# happyReduction_58 happyReduction_58 happy_x_1 = case happyOutTok happy_x_1 of { (TokKeyword KwMEASURE happy_var_1) -> happyIn9 (TokKeyword KwMEASURE happy_var_1 )} happyReduce_59 = happySpecReduce_1 2# happyReduction_59 happyReduction_59 happy_x_1 = case happyOutTok happy_x_1 of { (TokKeyword KwNO_TERMINATION_CHECK happy_var_1) -> happyIn9 (TokKeyword KwNO_TERMINATION_CHECK happy_var_1 )} happyReduce_60 = happySpecReduce_1 2# happyReduction_60 happyReduction_60 happy_x_1 = case happyOutTok happy_x_1 of { (TokKeyword KwNON_TERMINATING happy_var_1) -> happyIn9 (TokKeyword KwNON_TERMINATING happy_var_1 )} happyReduce_61 = happySpecReduce_1 2# happyReduction_61 happyReduction_61 happy_x_1 = case happyOutTok happy_x_1 of { (TokKeyword KwOPTIONS happy_var_1) -> happyIn9 (TokKeyword KwOPTIONS happy_var_1 )} happyReduce_62 = happySpecReduce_1 2# happyReduction_62 happyReduction_62 happy_x_1 = case happyOutTok happy_x_1 of { (TokKeyword KwREWRITE happy_var_1) -> happyIn9 (TokKeyword KwREWRITE happy_var_1 )} happyReduce_63 = happySpecReduce_1 2# happyReduction_63 happyReduction_63 happy_x_1 = case happyOutTok happy_x_1 of { (TokKeyword KwSTATIC happy_var_1) -> happyIn9 (TokKeyword KwSTATIC happy_var_1 )} happyReduce_64 = happySpecReduce_1 2# happyReduction_64 happyReduction_64 happy_x_1 = case happyOutTok happy_x_1 of { (TokKeyword KwTERMINATING happy_var_1) -> happyIn9 (TokKeyword KwTERMINATING happy_var_1 )} happyReduce_65 = happySpecReduce_1 2# happyReduction_65 happyReduction_65 happy_x_1 = case happyOutTok happy_x_1 of { (TokSetN happy_var_1) -> happyIn9 (TokSetN happy_var_1 )} happyReduce_66 = happySpecReduce_1 2# happyReduction_66 happyReduction_66 happy_x_1 = case happyOutTok happy_x_1 of { (TokTeX happy_var_1) -> happyIn9 (TokTeX happy_var_1 )} happyReduce_67 = happySpecReduce_1 2# happyReduction_67 happyReduction_67 happy_x_1 = case happyOutTok happy_x_1 of { (TokComment happy_var_1) -> happyIn9 (TokComment happy_var_1 )} happyReduce_68 = happySpecReduce_1 2# happyReduction_68 happyReduction_68 happy_x_1 = case happyOutTok happy_x_1 of { (TokSymbol SymEllipsis happy_var_1) -> happyIn9 (TokSymbol SymEllipsis happy_var_1 )} happyReduce_69 = happySpecReduce_1 2# happyReduction_69 happyReduction_69 happy_x_1 = case happyOutTok happy_x_1 of { (TokSymbol SymDotDot happy_var_1) -> happyIn9 (TokSymbol SymDotDot happy_var_1 )} happyReduce_70 = happySpecReduce_1 2# happyReduction_70 happyReduction_70 happy_x_1 = case happyOutTok happy_x_1 of { (TokSymbol SymDot happy_var_1) -> happyIn9 (TokSymbol SymDot happy_var_1 )} happyReduce_71 = happySpecReduce_1 2# happyReduction_71 happyReduction_71 happy_x_1 = case happyOutTok happy_x_1 of { (TokSymbol SymSemi happy_var_1) -> happyIn9 (TokSymbol SymSemi happy_var_1 )} happyReduce_72 = happySpecReduce_1 2# happyReduction_72 happyReduction_72 happy_x_1 = case happyOutTok happy_x_1 of { (TokSymbol SymColon happy_var_1) -> happyIn9 (TokSymbol SymColon happy_var_1 )} happyReduce_73 = happySpecReduce_1 2# happyReduction_73 happyReduction_73 happy_x_1 = case happyOutTok happy_x_1 of { (TokSymbol SymEqual happy_var_1) -> happyIn9 (TokSymbol SymEqual happy_var_1 )} happyReduce_74 = happySpecReduce_1 2# happyReduction_74 happyReduction_74 happy_x_1 = case happyOutTok happy_x_1 of { (TokSymbol SymUnderscore happy_var_1) -> happyIn9 (TokSymbol SymUnderscore happy_var_1 )} happyReduce_75 = happySpecReduce_1 2# happyReduction_75 happyReduction_75 happy_x_1 = case happyOutTok happy_x_1 of { (TokSymbol SymQuestionMark happy_var_1) -> happyIn9 (TokSymbol SymQuestionMark happy_var_1 )} happyReduce_76 = happySpecReduce_1 2# happyReduction_76 happyReduction_76 happy_x_1 = case happyOutTok happy_x_1 of { (TokSymbol SymArrow happy_var_1) -> happyIn9 (TokSymbol SymArrow happy_var_1 )} happyReduce_77 = happySpecReduce_1 2# happyReduction_77 happyReduction_77 happy_x_1 = case happyOutTok happy_x_1 of { (TokSymbol SymLambda happy_var_1) -> happyIn9 (TokSymbol SymLambda happy_var_1 )} happyReduce_78 = happySpecReduce_1 2# happyReduction_78 happyReduction_78 happy_x_1 = case happyOutTok happy_x_1 of { (TokSymbol SymAs happy_var_1) -> happyIn9 (TokSymbol SymAs happy_var_1 )} happyReduce_79 = happySpecReduce_1 2# happyReduction_79 happyReduction_79 happy_x_1 = case happyOutTok happy_x_1 of { (TokSymbol SymBar happy_var_1) -> happyIn9 (TokSymbol SymBar happy_var_1 )} happyReduce_80 = happySpecReduce_1 2# happyReduction_80 happyReduction_80 happy_x_1 = case happyOutTok happy_x_1 of { (TokSymbol SymOpenParen happy_var_1) -> happyIn9 (TokSymbol SymOpenParen happy_var_1 )} happyReduce_81 = happySpecReduce_1 2# happyReduction_81 happyReduction_81 happy_x_1 = case happyOutTok happy_x_1 of { (TokSymbol SymCloseParen happy_var_1) -> happyIn9 (TokSymbol SymCloseParen happy_var_1 )} happyReduce_82 = happySpecReduce_1 2# happyReduction_82 happyReduction_82 happy_x_1 = case happyOutTok happy_x_1 of { (TokSymbol SymDoubleOpenBrace happy_var_1) -> happyIn9 (TokSymbol SymDoubleOpenBrace happy_var_1 )} happyReduce_83 = happySpecReduce_1 2# happyReduction_83 happyReduction_83 happy_x_1 = case happyOutTok happy_x_1 of { (TokSymbol SymDoubleCloseBrace happy_var_1) -> happyIn9 (TokSymbol SymDoubleCloseBrace happy_var_1 )} happyReduce_84 = happySpecReduce_1 2# happyReduction_84 happyReduction_84 happy_x_1 = case happyOutTok happy_x_1 of { (TokSymbol SymOpenBrace happy_var_1) -> happyIn9 (TokSymbol SymOpenBrace happy_var_1 )} happyReduce_85 = happySpecReduce_1 2# happyReduction_85 happyReduction_85 happy_x_1 = case happyOutTok happy_x_1 of { (TokSymbol SymCloseBrace happy_var_1) -> happyIn9 (TokSymbol SymCloseBrace happy_var_1 )} happyReduce_86 = happySpecReduce_1 2# happyReduction_86 happyReduction_86 happy_x_1 = case happyOutTok happy_x_1 of { (TokSymbol SymOpenVirtualBrace happy_var_1) -> happyIn9 (TokSymbol SymOpenVirtualBrace happy_var_1 )} happyReduce_87 = happySpecReduce_1 2# happyReduction_87 happyReduction_87 happy_x_1 = case happyOutTok happy_x_1 of { (TokSymbol SymCloseVirtualBrace happy_var_1) -> happyIn9 (TokSymbol SymCloseVirtualBrace happy_var_1 )} happyReduce_88 = happySpecReduce_1 2# happyReduction_88 happyReduction_88 happy_x_1 = case happyOutTok happy_x_1 of { (TokSymbol SymVirtualSemi happy_var_1) -> happyIn9 (TokSymbol SymVirtualSemi happy_var_1 )} happyReduce_89 = happySpecReduce_1 2# happyReduction_89 happyReduction_89 happy_x_1 = case happyOutTok happy_x_1 of { (TokSymbol SymOpenPragma happy_var_1) -> happyIn9 (TokSymbol SymOpenPragma happy_var_1 )} happyReduce_90 = happySpecReduce_1 2# happyReduction_90 happyReduction_90 happy_x_1 = case happyOutTok happy_x_1 of { (TokSymbol SymClosePragma happy_var_1) -> happyIn9 (TokSymbol SymClosePragma happy_var_1 )} happyReduce_91 = happySpecReduce_1 2# happyReduction_91 happyReduction_91 happy_x_1 = case happyOutTok happy_x_1 of { (TokId happy_var_1) -> happyIn9 (TokId happy_var_1 )} happyReduce_92 = happySpecReduce_1 2# happyReduction_92 happyReduction_92 happy_x_1 = case happyOutTok happy_x_1 of { (TokQId happy_var_1) -> happyIn9 (TokQId happy_var_1 )} happyReduce_93 = happySpecReduce_1 2# happyReduction_93 happyReduction_93 happy_x_1 = case happyOutTok happy_x_1 of { (TokString happy_var_1) -> happyIn9 (TokString happy_var_1 )} happyReduce_94 = happySpecReduce_1 2# happyReduction_94 happyReduction_94 happy_x_1 = case happyOutTok happy_x_1 of { (TokLiteral happy_var_1) -> happyIn9 (TokLiteral happy_var_1 )} happyReduce_95 = happySpecReduce_3 3# happyReduction_95 happyReduction_95 happy_x_3 happy_x_2 happy_x_1 = case happyOut116 happy_x_2 of { happy_var_2 -> happyIn10 (takeOptionsPragmas happy_var_2 )} happyReduce_96 = happySpecReduce_0 4# happyReduction_96 happyReduction_96 = happyIn11 (() ) happyReduce_97 = happySpecReduce_1 4# happyReduction_97 happyReduction_97 happy_x_1 = happyIn11 (() ) happyReduce_98 = happySpecReduce_1 5# happyReduction_98 happyReduction_98 happy_x_1 = happyIn12 (() ) happyReduce_99 = happyMonadReduce 1# 5# happyReduction_99 happyReduction_99 (happy_x_1 `HappyStk` happyRest) tk = happyThen (( popContext) ) (\r -> happyReturn (happyIn12 r)) happyReduce_100 = happySpecReduce_1 6# happyReduction_100 happyReduction_100 happy_x_1 = case happyOutTok happy_x_1 of { (TokSymbol SymSemi happy_var_1) -> happyIn13 (happy_var_1 )} happyReduce_101 = happySpecReduce_1 6# happyReduction_101 happyReduction_101 happy_x_1 = case happyOutTok happy_x_1 of { (TokSymbol SymVirtualSemi happy_var_1) -> happyIn13 (happy_var_1 )} happyReduce_102 = happyMonadReduce 0# 7# happyReduction_102 happyReduction_102 (happyRest) tk = happyThen (( pushLexState imp_dir) ) (\r -> happyReturn (happyIn14 r)) happyReduce_103 = happyMonadReduce 1# 8# happyReduction_103 happyReduction_103 (happy_x_1 `HappyStk` happyRest) tk = happyThen (case happyOutTok happy_x_1 of { (TokLiteral happy_var_1) -> ( case happy_var_1 of { LitInt _ i -> return i; _ -> fail $ "Expected integer" })} ) (\r -> happyReturn (happyIn15 r)) happyReduce_104 = happyMonadReduce 1# 8# happyReduction_104 happyReduction_104 (happy_x_1 `HappyStk` happyRest) tk = happyThen (case happyOutTok happy_x_1 of { (TokId happy_var_1) -> ( case happy_var_1 of { (_, s) -> case readM s of { Right i -> return i; Left (err :: String) -> fail $ "Expected integer" } })} ) (\r -> happyReturn (happyIn15 r)) happyReduce_105 = happyMonadReduce 1# 9# happyReduction_105 happyReduction_105 (happy_x_1 `HappyStk` happyRest) tk = happyThen (case happyOutTok happy_x_1 of { (TokId happy_var_1) -> ( mkName happy_var_1)} ) (\r -> happyReturn (happyIn16 r)) happyReduce_106 = happySpecReduce_2 10# happyReduction_106 happyReduction_106 happy_x_2 happy_x_1 = case happyOut16 happy_x_1 of { happy_var_1 -> case happyOut17 happy_x_2 of { happy_var_2 -> happyIn17 (happy_var_1 : happy_var_2 )}} happyReduce_107 = happySpecReduce_1 10# happyReduction_107 happyReduction_107 happy_x_1 = case happyOut16 happy_x_1 of { happy_var_1 -> happyIn17 ([happy_var_1] )} happyReduce_108 = happySpecReduce_1 11# happyReduction_108 happyReduction_108 happy_x_1 = case happyOutTok happy_x_1 of { (TokSymbol SymDoubleCloseBrace happy_var_1) -> happyIn18 (getRange happy_var_1 )} happyReduce_109 = happyMonadReduce 2# 11# happyReduction_109 happyReduction_109 (happy_x_2 `HappyStk` happy_x_1 `HappyStk` happyRest) tk = happyThen (case happyOutTok happy_x_1 of { (TokSymbol SymCloseBrace happy_var_1) -> case happyOutTok happy_x_2 of { (TokSymbol SymCloseBrace happy_var_2) -> ( if posPos (fromJust (rEnd (getRange happy_var_2))) - posPos (fromJust (rStart (getRange happy_var_1))) > 2 then parseErrorAt (fromJust (rStart (getRange happy_var_2))) "Expecting '}}', found separated '}'s." else return $ getRange (happy_var_1, happy_var_2))}} ) (\r -> happyReturn (happyIn18 r)) happyReduce_110 = happySpecReduce_2 12# happyReduction_110 happyReduction_110 happy_x_2 happy_x_1 = case happyOut16 happy_x_2 of { happy_var_2 -> happyIn19 (setRelevance Irrelevant $ defaultArg happy_var_2 )} happyReduce_111 = happySpecReduce_1 12# happyReduction_111 happyReduction_111 happy_x_1 = case happyOut16 happy_x_1 of { happy_var_1 -> happyIn19 (defaultArg happy_var_1 )} happyReduce_112 = happySpecReduce_2 13# happyReduction_112 happyReduction_112 happy_x_2 happy_x_1 = case happyOut19 happy_x_1 of { happy_var_1 -> case happyOut20 happy_x_2 of { happy_var_2 -> happyIn20 (happy_var_1 : happy_var_2 )}} happyReduce_113 = happySpecReduce_1 13# happyReduction_113 happyReduction_113 happy_x_1 = case happyOut19 happy_x_1 of { happy_var_1 -> happyIn20 ([happy_var_1] )} happyReduce_114 = happySpecReduce_2 14# happyReduction_114 happyReduction_114 happy_x_2 happy_x_1 = case happyOut19 happy_x_1 of { happy_var_1 -> case happyOut21 happy_x_2 of { happy_var_2 -> happyIn21 (happy_var_1 : happy_var_2 )}} happyReduce_115 = happySpecReduce_1 14# happyReduction_115 happyReduction_115 happy_x_1 = case happyOut19 happy_x_1 of { happy_var_1 -> happyIn21 ([happy_var_1] )} happyReduce_116 = happyReduce 4# 14# happyReduction_116 happyReduction_116 (happy_x_4 `HappyStk` happy_x_3 `HappyStk` happy_x_2 `HappyStk` happy_x_1 `HappyStk` happyRest) = case happyOut20 happy_x_2 of { happy_var_2 -> case happyOut21 happy_x_4 of { happy_var_4 -> happyIn21 (map makeInstance happy_var_2 ++ happy_var_4 ) `HappyStk` happyRest}} happyReduce_117 = happySpecReduce_3 14# happyReduction_117 happyReduction_117 happy_x_3 happy_x_2 happy_x_1 = case happyOut20 happy_x_2 of { happy_var_2 -> happyIn21 (map makeInstance happy_var_2 )} happyReduce_118 = happyReduce 4# 14# happyReduction_118 happyReduction_118 (happy_x_4 `HappyStk` happy_x_3 `HappyStk` happy_x_2 `HappyStk` happy_x_1 `HappyStk` happyRest) = case happyOut20 happy_x_2 of { happy_var_2 -> case happyOut21 happy_x_4 of { happy_var_4 -> happyIn21 (map hide happy_var_2 ++ happy_var_4 ) `HappyStk` happyRest}} happyReduce_119 = happySpecReduce_3 14# happyReduction_119 happyReduction_119 happy_x_3 happy_x_2 happy_x_1 = case happyOut20 happy_x_2 of { happy_var_2 -> happyIn21 (map hide happy_var_2 )} happyReduce_120 = happyReduce 5# 14# happyReduction_120 happyReduction_120 (happy_x_5 `HappyStk` happy_x_4 `HappyStk` happy_x_3 `HappyStk` happy_x_2 `HappyStk` happy_x_1 `HappyStk` happyRest) = case happyOut17 happy_x_3 of { happy_var_3 -> case happyOut21 happy_x_5 of { happy_var_5 -> happyIn21 (map (hide . setRelevance Irrelevant . defaultArg) happy_var_3 ++ happy_var_5 ) `HappyStk` happyRest}} happyReduce_121 = happyReduce 4# 14# happyReduction_121 happyReduction_121 (happy_x_4 `HappyStk` happy_x_3 `HappyStk` happy_x_2 `HappyStk` happy_x_1 `HappyStk` happyRest) = case happyOut17 happy_x_3 of { happy_var_3 -> happyIn21 (map (hide . setRelevance Irrelevant . defaultArg) happy_var_3 ) `HappyStk` happyRest} happyReduce_122 = happyReduce 5# 14# happyReduction_122 happyReduction_122 (happy_x_5 `HappyStk` happy_x_4 `HappyStk` happy_x_3 `HappyStk` happy_x_2 `HappyStk` happy_x_1 `HappyStk` happyRest) = case happyOut17 happy_x_3 of { happy_var_3 -> case happyOut21 happy_x_5 of { happy_var_5 -> happyIn21 (map (makeInstance . setRelevance Irrelevant . defaultArg) happy_var_3 ++ happy_var_5 ) `HappyStk` happyRest}} happyReduce_123 = happyReduce 4# 14# happyReduction_123 happyReduction_123 (happy_x_4 `HappyStk` happy_x_3 `HappyStk` happy_x_2 `HappyStk` happy_x_1 `HappyStk` happyRest) = case happyOut17 happy_x_3 of { happy_var_3 -> happyIn21 (map (makeInstance . setRelevance Irrelevant . defaultArg) happy_var_3 ) `HappyStk` happyRest} happyReduce_124 = happyReduce 5# 14# happyReduction_124 happyReduction_124 (happy_x_5 `HappyStk` happy_x_4 `HappyStk` happy_x_3 `HappyStk` happy_x_2 `HappyStk` happy_x_1 `HappyStk` happyRest) = case happyOut17 happy_x_3 of { happy_var_3 -> case happyOut21 happy_x_5 of { happy_var_5 -> happyIn21 (map (hide . setRelevance NonStrict . defaultArg) happy_var_3 ++ happy_var_5 ) `HappyStk` happyRest}} happyReduce_125 = happyReduce 4# 14# happyReduction_125 happyReduction_125 (happy_x_4 `HappyStk` happy_x_3 `HappyStk` happy_x_2 `HappyStk` happy_x_1 `HappyStk` happyRest) = case happyOut17 happy_x_3 of { happy_var_3 -> happyIn21 (map (hide . setRelevance NonStrict . defaultArg) happy_var_3 ) `HappyStk` happyRest} happyReduce_126 = happyReduce 5# 14# happyReduction_126 happyReduction_126 (happy_x_5 `HappyStk` happy_x_4 `HappyStk` happy_x_3 `HappyStk` happy_x_2 `HappyStk` happy_x_1 `HappyStk` happyRest) = case happyOut17 happy_x_3 of { happy_var_3 -> case happyOut21 happy_x_5 of { happy_var_5 -> happyIn21 (map (makeInstance . setRelevance NonStrict . defaultArg) happy_var_3 ++ happy_var_5 ) `HappyStk` happyRest}} happyReduce_127 = happyReduce 4# 14# happyReduction_127 happyReduction_127 (happy_x_4 `HappyStk` happy_x_3 `HappyStk` happy_x_2 `HappyStk` happy_x_1 `HappyStk` happyRest) = case happyOut17 happy_x_3 of { happy_var_3 -> happyIn21 (map (makeInstance . setRelevance NonStrict . defaultArg) happy_var_3 ) `HappyStk` happyRest} happyReduce_128 = happyMonadReduce 1# 15# happyReduction_128 happyReduction_128 (happy_x_1 `HappyStk` happyRest) tk = happyThen (case happyOutTok happy_x_1 of { (TokQId happy_var_1) -> ( mkQName happy_var_1)} ) (\r -> happyReturn (happyIn22 r)) happyReduce_129 = happySpecReduce_1 15# happyReduction_129 happyReduction_129 happy_x_1 = case happyOut16 happy_x_1 of { happy_var_1 -> happyIn22 (QName happy_var_1 )} happyReduce_130 = happySpecReduce_1 16# happyReduction_130 happyReduction_130 happy_x_1 = case happyOut22 happy_x_1 of { happy_var_1 -> happyIn23 (happy_var_1 )} happyReduce_131 = happySpecReduce_1 17# happyReduction_131 happyReduction_131 happy_x_1 = case happyOut16 happy_x_1 of { happy_var_1 -> happyIn24 (happy_var_1 )} happyReduce_132 = happySpecReduce_1 17# happyReduction_132 happyReduction_132 happy_x_1 = case happyOutTok happy_x_1 of { (TokSymbol SymUnderscore happy_var_1) -> happyIn24 (Name (getRange happy_var_1) [Hole] )} happyReduce_133 = happySpecReduce_2 18# happyReduction_133 happyReduction_133 happy_x_2 happy_x_1 = case happyOut24 happy_x_1 of { happy_var_1 -> case happyOut25 happy_x_2 of { happy_var_2 -> happyIn25 (happy_var_1 : happy_var_2 )}} happyReduce_134 = happySpecReduce_1 18# happyReduction_134 happyReduction_134 happy_x_1 = case happyOut24 happy_x_1 of { happy_var_1 -> happyIn25 ([happy_var_1] )} happyReduce_135 = happySpecReduce_1 19# happyReduction_135 happyReduction_135 happy_x_1 = case happyOut27 happy_x_1 of { happy_var_1 -> happyIn26 (case happy_var_1 of Left ns -> ns Right _ -> fail $ "expected sequence of bound identifiers, not absurd pattern" )} happyReduce_136 = happyMonadReduce 1# 20# happyReduction_136 happyReduction_136 (happy_x_1 `HappyStk` happyRest) tk = happyThen (case happyOut36 happy_x_1 of { happy_var_1 -> ( let getName :: Expr -> Maybe Name getName (Ident (QName x)) = Just x getName (Underscore r _) = Just (Name r [Hole]) getName _ = Nothing isAbsurd :: Expr -> Bool isAbsurd (Absurd _) = True isAbsurd (HiddenArg _ (Named _ e)) = isAbsurd e isAbsurd (InstanceArg _ (Named _ e)) = isAbsurd e isAbsurd (Paren _ expr) = isAbsurd expr isAbsurd (RawApp _ exprs) = any isAbsurd exprs isAbsurd _ = False in if any isAbsurd happy_var_1 then return $ Right happy_var_1 else case mapM getName happy_var_1 of Just good -> return $ Left good Nothing -> fail $ "expected sequence of bound identifiers")} ) (\r -> happyReturn (happyIn27 r)) happyReduce_137 = happyMonadReduce 1# 21# happyReduction_137 happyReduction_137 (happy_x_1 `HappyStk` happyRest) tk = happyThen (case happyOut36 happy_x_1 of { happy_var_1 -> ( let -- interpret an expression as name getName :: Expr -> Maybe Name getName (Ident (QName x)) = Just x getName (Underscore r _) = Just (Name r [Hole]) getName _ = Nothing getNames :: Expr -> Maybe [Name] getNames (RawApp _ es) = mapM getName es getNames e = singleton `fmap` getName e -- interpret an expression as name or list of hidden names getName1 :: Expr -> Maybe [WithHiding Name] getName1 (Ident (QName x)) = Just [WithHiding NotHidden x] getName1 (Underscore r _) = Just [WithHiding NotHidden $ Name r [Hole]] getName1 (HiddenArg _ (Named Nothing e)) = map (WithHiding Hidden) `fmap` getNames e getName1 _ = Nothing in case mapM getName1 happy_var_1 of Just good -> return $ concat good Nothing -> fail $ "expected sequence of possibly hidden bound identifiers")} ) (\r -> happyReturn (happyIn28 r)) happyReduce_138 = happySpecReduce_0 22# happyReduction_138 happyReduction_138 = happyIn29 ([] ) happyReduce_139 = happySpecReduce_2 22# happyReduction_139 happyReduction_139 happy_x_2 happy_x_1 = case happyOutTok happy_x_1 of { (TokString happy_var_1) -> case happyOut29 happy_x_2 of { happy_var_2 -> happyIn29 (snd happy_var_1 : happy_var_2 )}} happyReduce_140 = happySpecReduce_1 23# happyReduction_140 happyReduction_140 happy_x_1 = case happyOutTok happy_x_1 of { (TokString happy_var_1) -> happyIn30 (snd happy_var_1 )} happyReduce_141 = happyMonadReduce 1# 24# happyReduction_141 happyReduction_141 (happy_x_1 `HappyStk` happyRest) tk = happyThen (case happyOutTok happy_x_1 of { (TokString happy_var_1) -> ( mkName happy_var_1)} ) (\r -> happyReturn (happyIn31 r)) happyReduce_142 = happyMonadReduce 1# 25# happyReduction_142 happyReduction_142 (happy_x_1 `HappyStk` happyRest) tk = happyThen (case happyOutTok happy_x_1 of { (TokString happy_var_1) -> ( fmap QName (mkName happy_var_1))} ) (\r -> happyReturn (happyIn32 r)) happyReduce_143 = happySpecReduce_2 26# happyReduction_143 happyReduction_143 happy_x_2 happy_x_1 = case happyOut46 happy_x_1 of { happy_var_1 -> case happyOut33 happy_x_2 of { happy_var_2 -> happyIn33 (Pi happy_var_1 happy_var_2 )}} happyReduce_144 = happySpecReduce_3 26# happyReduction_144 happyReduction_144 happy_x_3 happy_x_2 happy_x_1 = case happyOut39 happy_x_1 of { happy_var_1 -> case happyOutTok happy_x_2 of { (TokSymbol SymArrow happy_var_2) -> case happyOut33 happy_x_3 of { happy_var_3 -> happyIn33 (Fun (getRange (happy_var_1,happy_var_2,happy_var_3)) (RawApp (getRange happy_var_1) happy_var_1) happy_var_3 )}}} happyReduce_145 = happySpecReduce_3 26# happyReduction_145 happyReduction_145 happy_x_3 happy_x_2 happy_x_1 = case happyOut34 happy_x_1 of { happy_var_1 -> case happyOutTok happy_x_2 of { (TokSymbol SymEqual happy_var_2) -> case happyOut33 happy_x_3 of { happy_var_3 -> happyIn33 (Equal (getRange (happy_var_1, happy_var_2, happy_var_3)) happy_var_1 happy_var_3 )}}} happyReduce_146 = happySpecReduce_1 26# happyReduction_146 happyReduction_146 happy_x_1 = case happyOut34 happy_x_1 of { happy_var_1 -> happyIn33 (happy_var_1 )} happyReduce_147 = happyMonadReduce 1# 27# happyReduction_147 happyReduction_147 (happy_x_1 `HappyStk` happyRest) tk = happyThen (case happyOut35 happy_x_1 of { happy_var_1 -> ( case happy_var_1 of { [e] -> return e ; e : es -> return $ WithApp (fuseRange e es) e es ; [] -> fail "impossible: empty with expressions" })} ) (\r -> happyReturn (happyIn34 r)) happyReduce_148 = happySpecReduce_3 28# happyReduction_148 happyReduction_148 happy_x_3 happy_x_2 happy_x_1 = case happyOut39 happy_x_1 of { happy_var_1 -> case happyOut35 happy_x_3 of { happy_var_3 -> happyIn35 (RawApp (getRange happy_var_1) happy_var_1 : happy_var_3 )}} happyReduce_149 = happySpecReduce_1 28# happyReduction_149 happyReduction_149 happy_x_1 = case happyOut36 happy_x_1 of { happy_var_1 -> happyIn35 ([RawApp (getRange happy_var_1) happy_var_1] )} happyReduce_150 = happySpecReduce_1 29# happyReduction_150 happyReduction_150 happy_x_1 = case happyOut37 happy_x_1 of { happy_var_1 -> happyIn36 ([happy_var_1] )} happyReduce_151 = happySpecReduce_2 29# happyReduction_151 happyReduction_151 happy_x_2 happy_x_1 = case happyOut42 happy_x_1 of { happy_var_1 -> case happyOut36 happy_x_2 of { happy_var_2 -> happyIn36 (happy_var_1 : happy_var_2 )}} happyReduce_152 = happySpecReduce_3 30# happyReduction_152 happyReduction_152 happy_x_3 happy_x_2 happy_x_1 = case happyOutTok happy_x_1 of { (TokSymbol SymLambda happy_var_1) -> case happyOut52 happy_x_2 of { happy_var_2 -> case happyOut33 happy_x_3 of { happy_var_3 -> happyIn37 (Lam (getRange (happy_var_1,happy_var_2,happy_var_3)) happy_var_2 happy_var_3 )}}} happyReduce_153 = happySpecReduce_1 30# happyReduction_153 happyReduction_153 happy_x_1 = case happyOut38 happy_x_1 of { happy_var_1 -> happyIn37 (happy_var_1 )} happyReduce_154 = happySpecReduce_3 30# happyReduction_154 happyReduction_154 happy_x_3 happy_x_2 happy_x_1 = case happyOut60 happy_x_2 of { happy_var_2 -> case happyOut33 happy_x_3 of { happy_var_3 -> happyIn37 (forallPi happy_var_2 happy_var_3 )}} happyReduce_155 = happyReduce 4# 30# happyReduction_155 happyReduction_155 (happy_x_4 `HappyStk` happy_x_3 `HappyStk` happy_x_2 `HappyStk` happy_x_1 `HappyStk` happyRest) = case happyOutTok happy_x_1 of { (TokKeyword KwLet happy_var_1) -> case happyOut143 happy_x_2 of { happy_var_2 -> case happyOutTok happy_x_3 of { (TokKeyword KwIn happy_var_3) -> case happyOut33 happy_x_4 of { happy_var_4 -> happyIn37 (Let (getRange (happy_var_1,happy_var_2,happy_var_3,happy_var_4)) happy_var_2 happy_var_4 ) `HappyStk` happyRest}}}} happyReduce_156 = happySpecReduce_1 30# happyReduction_156 happyReduction_156 happy_x_1 = case happyOut42 happy_x_1 of { happy_var_1 -> happyIn37 (happy_var_1 )} happyReduce_157 = happyReduce 4# 30# happyReduction_157 happyReduction_157 (happy_x_4 `HappyStk` happy_x_3 `HappyStk` happy_x_2 `HappyStk` happy_x_1 `HappyStk` happyRest) = case happyOutTok happy_x_1 of { (TokKeyword KwQuoteGoal happy_var_1) -> case happyOut16 happy_x_2 of { happy_var_2 -> case happyOutTok happy_x_3 of { (TokKeyword KwIn happy_var_3) -> case happyOut33 happy_x_4 of { happy_var_4 -> happyIn37 (QuoteGoal (getRange (happy_var_1,happy_var_2,happy_var_3,happy_var_4)) happy_var_2 happy_var_4 ) `HappyStk` happyRest}}}} happyReduce_158 = happyReduce 4# 30# happyReduction_158 happyReduction_158 (happy_x_4 `HappyStk` happy_x_3 `HappyStk` happy_x_2 `HappyStk` happy_x_1 `HappyStk` happyRest) = case happyOutTok happy_x_1 of { (TokKeyword KwQuoteContext happy_var_1) -> case happyOut16 happy_x_2 of { happy_var_2 -> case happyOutTok happy_x_3 of { (TokKeyword KwIn happy_var_3) -> case happyOut33 happy_x_4 of { happy_var_4 -> happyIn37 (QuoteContext (getRange (happy_var_1,happy_var_2,happy_var_3,happy_var_4)) happy_var_2 happy_var_4 ) `HappyStk` happyRest}}}} happyReduce_159 = happySpecReduce_2 30# happyReduction_159 happyReduction_159 happy_x_2 happy_x_1 = case happyOutTok happy_x_1 of { (TokKeyword KwTactic happy_var_1) -> case happyOut39 happy_x_2 of { happy_var_2 -> happyIn37 (Tactic (getRange (happy_var_1, happy_var_2)) (RawApp (getRange happy_var_2) happy_var_2) [] )}} happyReduce_160 = happyReduce 4# 30# happyReduction_160 happyReduction_160 (happy_x_4 `HappyStk` happy_x_3 `HappyStk` happy_x_2 `HappyStk` happy_x_1 `HappyStk` happyRest) = case happyOutTok happy_x_1 of { (TokKeyword KwTactic happy_var_1) -> case happyOut39 happy_x_2 of { happy_var_2 -> case happyOutTok happy_x_3 of { (TokSymbol SymBar happy_var_3) -> case happyOut35 happy_x_4 of { happy_var_4 -> happyIn37 (Tactic (getRange (happy_var_1, happy_var_2, happy_var_3, happy_var_4)) (RawApp (getRange happy_var_2) happy_var_2) happy_var_4 ) `HappyStk` happyRest}}}} happyReduce_161 = happyReduce 4# 31# happyReduction_161 happyReduction_161 (happy_x_4 `HappyStk` happy_x_3 `HappyStk` happy_x_2 `HappyStk` happy_x_1 `HappyStk` happyRest) = case happyOutTok happy_x_1 of { (TokSymbol SymLambda happy_var_1) -> case happyOutTok happy_x_2 of { (TokSymbol SymOpenBrace happy_var_2) -> case happyOut59 happy_x_3 of { happy_var_3 -> case happyOutTok happy_x_4 of { (TokSymbol SymCloseBrace happy_var_4) -> happyIn38 (ExtendedLam (getRange (happy_var_1,happy_var_2,happy_var_3,happy_var_4)) (reverse happy_var_3) ) `HappyStk` happyRest}}}} happyReduce_162 = happyMonadReduce 2# 31# happyReduction_162 happyReduction_162 (happy_x_2 `HappyStk` happy_x_1 `HappyStk` happyRest) tk = happyThen (case happyOutTok happy_x_1 of { (TokSymbol SymLambda happy_var_1) -> case happyOut53 happy_x_2 of { happy_var_2 -> ( case happy_var_2 of Left (bs, h) -> if null bs then return $ AbsurdLam r h else return $ Lam r bs (AbsurdLam r h) where r = fuseRange happy_var_1 bs Right es -> do -- it is of the form @\ { p1 ... () }@ p <- exprToLHS (RawApp (getRange es) es); return $ ExtendedLam (fuseRange happy_var_1 es) [(p [] [], AbsurdRHS, NoWhere)])}} ) (\r -> happyReturn (happyIn38 r)) happyReduce_163 = happySpecReduce_1 32# happyReduction_163 happyReduction_163 happy_x_1 = case happyOut42 happy_x_1 of { happy_var_1 -> happyIn39 ([happy_var_1] )} happyReduce_164 = happySpecReduce_2 32# happyReduction_164 happyReduction_164 happy_x_2 happy_x_1 = case happyOut42 happy_x_1 of { happy_var_1 -> case happyOut39 happy_x_2 of { happy_var_2 -> happyIn39 (happy_var_1 : happy_var_2 )}} happyReduce_165 = happySpecReduce_3 33# happyReduction_165 happyReduction_165 happy_x_3 happy_x_2 happy_x_1 = case happyOutTok happy_x_1 of { (TokSymbol SymOpenBrace happy_var_1) -> case happyOut33 happy_x_2 of { happy_var_2 -> case happyOutTok happy_x_3 of { (TokSymbol SymCloseBrace happy_var_3) -> happyIn40 (HiddenArg (getRange (happy_var_1,happy_var_2,happy_var_3)) (maybeNamed happy_var_2) )}}} happyReduce_166 = happySpecReduce_2 33# happyReduction_166 happyReduction_166 happy_x_2 happy_x_1 = case happyOutTok happy_x_1 of { (TokSymbol SymOpenBrace happy_var_1) -> case happyOutTok happy_x_2 of { (TokSymbol SymCloseBrace happy_var_2) -> happyIn40 (let r = fuseRange happy_var_1 happy_var_2 in HiddenArg r $ unnamed $ Absurd r )}} happyReduce_167 = happySpecReduce_1 34# happyReduction_167 happyReduction_167 happy_x_1 = case happyOut22 happy_x_1 of { happy_var_1 -> happyIn41 (Ident happy_var_1 )} happyReduce_168 = happySpecReduce_1 34# happyReduction_168 happyReduction_168 happy_x_1 = case happyOutTok happy_x_1 of { (TokLiteral happy_var_1) -> happyIn41 (Lit happy_var_1 )} happyReduce_169 = happySpecReduce_1 34# happyReduction_169 happyReduction_169 happy_x_1 = case happyOutTok happy_x_1 of { (TokSymbol SymQuestionMark happy_var_1) -> happyIn41 (QuestionMark (getRange happy_var_1) Nothing )} happyReduce_170 = happySpecReduce_1 34# happyReduction_170 happyReduction_170 happy_x_1 = case happyOutTok happy_x_1 of { (TokSymbol SymUnderscore happy_var_1) -> happyIn41 (Underscore (getRange happy_var_1) Nothing )} happyReduce_171 = happySpecReduce_1 34# happyReduction_171 happyReduction_171 happy_x_1 = case happyOutTok happy_x_1 of { (TokKeyword KwProp happy_var_1) -> happyIn41 (Prop (getRange happy_var_1) )} happyReduce_172 = happySpecReduce_1 34# happyReduction_172 happyReduction_172 happy_x_1 = case happyOutTok happy_x_1 of { (TokKeyword KwSet happy_var_1) -> happyIn41 (Set (getRange happy_var_1) )} happyReduce_173 = happySpecReduce_1 34# happyReduction_173 happyReduction_173 happy_x_1 = case happyOutTok happy_x_1 of { (TokKeyword KwQuote happy_var_1) -> happyIn41 (Quote (getRange happy_var_1) )} happyReduce_174 = happySpecReduce_1 34# happyReduction_174 happyReduction_174 happy_x_1 = case happyOutTok happy_x_1 of { (TokKeyword KwQuoteTerm happy_var_1) -> happyIn41 (QuoteTerm (getRange happy_var_1) )} happyReduce_175 = happySpecReduce_1 34# happyReduction_175 happyReduction_175 happy_x_1 = case happyOutTok happy_x_1 of { (TokKeyword KwUnquote happy_var_1) -> happyIn41 (Unquote (getRange happy_var_1) )} happyReduce_176 = happySpecReduce_1 34# happyReduction_176 happyReduction_176 happy_x_1 = case happyOutTok happy_x_1 of { (TokSetN happy_var_1) -> happyIn41 (SetN (getRange (fst happy_var_1)) (snd happy_var_1) )} happyReduce_177 = happySpecReduce_3 34# happyReduction_177 happyReduction_177 happy_x_3 happy_x_2 happy_x_1 = case happyOutTok happy_x_1 of { (TokSymbol SymDoubleOpenBrace happy_var_1) -> case happyOut33 happy_x_2 of { happy_var_2 -> case happyOut18 happy_x_3 of { happy_var_3 -> happyIn41 (InstanceArg (getRange (happy_var_1,happy_var_2,happy_var_3)) (maybeNamed happy_var_2) )}}} happyReduce_178 = happySpecReduce_3 34# happyReduction_178 happyReduction_178 happy_x_3 happy_x_2 happy_x_1 = case happyOutTok happy_x_1 of { (TokSymbol SymOpenParen happy_var_1) -> case happyOut33 happy_x_2 of { happy_var_2 -> case happyOutTok happy_x_3 of { (TokSymbol SymCloseParen happy_var_3) -> happyIn41 (Paren (getRange (happy_var_1,happy_var_2,happy_var_3)) happy_var_2 )}}} happyReduce_179 = happySpecReduce_2 34# happyReduction_179 happyReduction_179 happy_x_2 happy_x_1 = case happyOutTok happy_x_1 of { (TokSymbol SymOpenParen happy_var_1) -> case happyOutTok happy_x_2 of { (TokSymbol SymCloseParen happy_var_2) -> happyIn41 (Absurd (fuseRange happy_var_1 happy_var_2) )}} happyReduce_180 = happySpecReduce_2 34# happyReduction_180 happyReduction_180 happy_x_2 happy_x_1 = case happyOutTok happy_x_1 of { (TokSymbol SymDoubleOpenBrace happy_var_1) -> case happyOut18 happy_x_2 of { happy_var_2 -> happyIn41 (let r = fuseRange happy_var_1 happy_var_2 in InstanceArg r $ unnamed $ Absurd r )}} happyReduce_181 = happySpecReduce_3 34# happyReduction_181 happyReduction_181 happy_x_3 happy_x_2 happy_x_1 = case happyOut16 happy_x_1 of { happy_var_1 -> case happyOutTok happy_x_2 of { (TokSymbol SymAs happy_var_2) -> case happyOut42 happy_x_3 of { happy_var_3 -> happyIn41 (As (getRange (happy_var_1,happy_var_2,happy_var_3)) happy_var_1 happy_var_3 )}}} happyReduce_182 = happySpecReduce_2 34# happyReduction_182 happyReduction_182 happy_x_2 happy_x_1 = case happyOutTok happy_x_1 of { (TokSymbol SymDot happy_var_1) -> case happyOut42 happy_x_2 of { happy_var_2 -> happyIn41 (Dot (fuseRange happy_var_1 happy_var_2) happy_var_2 )}} happyReduce_183 = happyReduce 4# 34# happyReduction_183 happyReduction_183 (happy_x_4 `HappyStk` happy_x_3 `HappyStk` happy_x_2 `HappyStk` happy_x_1 `HappyStk` happyRest) = case happyOutTok happy_x_1 of { (TokKeyword KwRecord happy_var_1) -> case happyOutTok happy_x_2 of { (TokSymbol SymOpenBrace happy_var_2) -> case happyOut43 happy_x_3 of { happy_var_3 -> case happyOutTok happy_x_4 of { (TokSymbol SymCloseBrace happy_var_4) -> happyIn41 (Rec (getRange (happy_var_1,happy_var_2,happy_var_3,happy_var_4)) happy_var_3 ) `HappyStk` happyRest}}}} happyReduce_184 = happyReduce 5# 34# happyReduction_184 happyReduction_184 (happy_x_5 `HappyStk` happy_x_4 `HappyStk` happy_x_3 `HappyStk` happy_x_2 `HappyStk` happy_x_1 `HappyStk` happyRest) = case happyOutTok happy_x_1 of { (TokKeyword KwRecord happy_var_1) -> case happyOut41 happy_x_2 of { happy_var_2 -> case happyOutTok happy_x_3 of { (TokSymbol SymOpenBrace happy_var_3) -> case happyOut43 happy_x_4 of { happy_var_4 -> case happyOutTok happy_x_5 of { (TokSymbol SymCloseBrace happy_var_5) -> happyIn41 (RecUpdate (getRange (happy_var_1,happy_var_2,happy_var_3,happy_var_4,happy_var_5)) happy_var_2 happy_var_4 ) `HappyStk` happyRest}}}}} happyReduce_185 = happySpecReduce_1 35# happyReduction_185 happyReduction_185 happy_x_1 = case happyOut40 happy_x_1 of { happy_var_1 -> happyIn42 (happy_var_1 )} happyReduce_186 = happySpecReduce_1 35# happyReduction_186 happyReduction_186 happy_x_1 = case happyOut41 happy_x_1 of { happy_var_1 -> happyIn42 (happy_var_1 )} happyReduce_187 = happySpecReduce_0 36# happyReduction_187 happyReduction_187 = happyIn43 ([] ) happyReduce_188 = happySpecReduce_1 36# happyReduction_188 happyReduction_188 happy_x_1 = case happyOut44 happy_x_1 of { happy_var_1 -> happyIn43 (happy_var_1 )} happyReduce_189 = happySpecReduce_1 37# happyReduction_189 happyReduction_189 happy_x_1 = case happyOut45 happy_x_1 of { happy_var_1 -> happyIn44 ([happy_var_1] )} happyReduce_190 = happySpecReduce_3 37# happyReduction_190 happyReduction_190 happy_x_3 happy_x_2 happy_x_1 = case happyOut45 happy_x_1 of { happy_var_1 -> case happyOut44 happy_x_3 of { happy_var_3 -> happyIn44 (happy_var_1 : happy_var_3 )}} happyReduce_191 = happySpecReduce_3 38# happyReduction_191 happyReduction_191 happy_x_3 happy_x_2 happy_x_1 = case happyOut16 happy_x_1 of { happy_var_1 -> case happyOut33 happy_x_3 of { happy_var_3 -> happyIn45 ((happy_var_1, happy_var_3) )}} happyReduce_192 = happySpecReduce_2 39# happyReduction_192 happyReduction_192 happy_x_2 happy_x_1 = case happyOut47 happy_x_1 of { happy_var_1 -> happyIn46 (happy_var_1 )} happyReduce_193 = happySpecReduce_1 40# happyReduction_193 happyReduction_193 happy_x_1 = case happyOut48 happy_x_1 of { happy_var_1 -> happyIn47 ({-TeleBind-} happy_var_1 )} happyReduce_194 = happySpecReduce_2 41# happyReduction_194 happyReduction_194 happy_x_2 happy_x_1 = case happyOut49 happy_x_1 of { happy_var_1 -> case happyOut48 happy_x_2 of { happy_var_2 -> happyIn48 (happy_var_1 : happy_var_2 )}} happyReduce_195 = happySpecReduce_1 41# happyReduction_195 happyReduction_195 happy_x_1 = case happyOut49 happy_x_1 of { happy_var_1 -> happyIn48 ([happy_var_1] )} happyReduce_196 = happyReduce 4# 42# happyReduction_196 happyReduction_196 (happy_x_4 `HappyStk` happy_x_3 `HappyStk` happy_x_2 `HappyStk` happy_x_1 `HappyStk` happyRest) = case happyOutTok happy_x_2 of { (TokSymbol SymOpenParen happy_var_2) -> case happyOut51 happy_x_3 of { happy_var_3 -> case happyOutTok happy_x_4 of { (TokSymbol SymCloseParen happy_var_4) -> happyIn49 (setRange (getRange (happy_var_2,happy_var_3,happy_var_4)) $ setRelevance Irrelevant happy_var_3 ) `HappyStk` happyRest}}} happyReduce_197 = happyReduce 4# 42# happyReduction_197 happyReduction_197 (happy_x_4 `HappyStk` happy_x_3 `HappyStk` happy_x_2 `HappyStk` happy_x_1 `HappyStk` happyRest) = case happyOutTok happy_x_2 of { (TokSymbol SymOpenBrace happy_var_2) -> case happyOut50 happy_x_3 of { happy_var_3 -> case happyOutTok happy_x_4 of { (TokSymbol SymCloseBrace happy_var_4) -> happyIn49 (setRange (getRange (happy_var_2,happy_var_3,happy_var_4)) $ setHiding Hidden $ setRelevance Irrelevant happy_var_3 ) `HappyStk` happyRest}}} happyReduce_198 = happyReduce 4# 42# happyReduction_198 happyReduction_198 (happy_x_4 `HappyStk` happy_x_3 `HappyStk` happy_x_2 `HappyStk` happy_x_1 `HappyStk` happyRest) = case happyOutTok happy_x_2 of { (TokSymbol SymDoubleOpenBrace happy_var_2) -> case happyOut50 happy_x_3 of { happy_var_3 -> case happyOut18 happy_x_4 of { happy_var_4 -> happyIn49 (setRange (getRange (happy_var_2,happy_var_3,happy_var_4)) $ setHiding Instance $ setRelevance Irrelevant happy_var_3 ) `HappyStk` happyRest}}} happyReduce_199 = happyReduce 4# 42# happyReduction_199 happyReduction_199 (happy_x_4 `HappyStk` happy_x_3 `HappyStk` happy_x_2 `HappyStk` happy_x_1 `HappyStk` happyRest) = case happyOutTok happy_x_2 of { (TokSymbol SymOpenParen happy_var_2) -> case happyOut51 happy_x_3 of { happy_var_3 -> case happyOutTok happy_x_4 of { (TokSymbol SymCloseParen happy_var_4) -> happyIn49 (setRange (getRange (happy_var_2,happy_var_3,happy_var_4)) $ setRelevance NonStrict happy_var_3 ) `HappyStk` happyRest}}} happyReduce_200 = happyReduce 4# 42# happyReduction_200 happyReduction_200 (happy_x_4 `HappyStk` happy_x_3 `HappyStk` happy_x_2 `HappyStk` happy_x_1 `HappyStk` happyRest) = case happyOutTok happy_x_2 of { (TokSymbol SymOpenBrace happy_var_2) -> case happyOut50 happy_x_3 of { happy_var_3 -> case happyOutTok happy_x_4 of { (TokSymbol SymCloseBrace happy_var_4) -> happyIn49 (setRange (getRange (happy_var_2,happy_var_3,happy_var_4)) $ setHiding Hidden $ setRelevance NonStrict happy_var_3 ) `HappyStk` happyRest}}} happyReduce_201 = happyReduce 4# 42# happyReduction_201 happyReduction_201 (happy_x_4 `HappyStk` happy_x_3 `HappyStk` happy_x_2 `HappyStk` happy_x_1 `HappyStk` happyRest) = case happyOutTok happy_x_2 of { (TokSymbol SymDoubleOpenBrace happy_var_2) -> case happyOut50 happy_x_3 of { happy_var_3 -> case happyOut18 happy_x_4 of { happy_var_4 -> happyIn49 (setRange (getRange (happy_var_2,happy_var_3,happy_var_4)) $ setHiding Instance $ setRelevance NonStrict happy_var_3 ) `HappyStk` happyRest}}} happyReduce_202 = happySpecReduce_3 42# happyReduction_202 happyReduction_202 happy_x_3 happy_x_2 happy_x_1 = case happyOutTok happy_x_1 of { (TokSymbol SymOpenParen happy_var_1) -> case happyOut51 happy_x_2 of { happy_var_2 -> case happyOutTok happy_x_3 of { (TokSymbol SymCloseParen happy_var_3) -> happyIn49 (setRange (getRange (happy_var_1,happy_var_2,happy_var_3)) happy_var_2 )}}} happyReduce_203 = happySpecReduce_3 42# happyReduction_203 happyReduction_203 happy_x_3 happy_x_2 happy_x_1 = case happyOutTok happy_x_1 of { (TokSymbol SymDoubleOpenBrace happy_var_1) -> case happyOut50 happy_x_2 of { happy_var_2 -> case happyOut18 happy_x_3 of { happy_var_3 -> happyIn49 (setRange (getRange (happy_var_1,happy_var_2,happy_var_3)) $ setHiding Instance happy_var_2 )}}} happyReduce_204 = happySpecReduce_3 42# happyReduction_204 happyReduction_204 happy_x_3 happy_x_2 happy_x_1 = case happyOutTok happy_x_1 of { (TokSymbol SymOpenBrace happy_var_1) -> case happyOut50 happy_x_2 of { happy_var_2 -> case happyOutTok happy_x_3 of { (TokSymbol SymCloseBrace happy_var_3) -> happyIn49 (setRange (getRange (happy_var_1,happy_var_2,happy_var_3)) $ setHiding Hidden happy_var_2 )}}} happyReduce_205 = happySpecReduce_3 42# happyReduction_205 happyReduction_205 happy_x_3 happy_x_2 happy_x_1 = case happyOutTok happy_x_1 of { (TokSymbol SymOpenParen happy_var_1) -> case happyOut110 happy_x_2 of { happy_var_2 -> case happyOutTok happy_x_3 of { (TokSymbol SymCloseParen happy_var_3) -> happyIn49 (tLet (getRange (happy_var_1,happy_var_3)) happy_var_2 )}}} happyReduce_206 = happyReduce 4# 42# happyReduction_206 happyReduction_206 (happy_x_4 `HappyStk` happy_x_3 `HappyStk` happy_x_2 `HappyStk` happy_x_1 `HappyStk` happyRest) = case happyOutTok happy_x_1 of { (TokSymbol SymOpenParen happy_var_1) -> case happyOut143 happy_x_3 of { happy_var_3 -> case happyOutTok happy_x_4 of { (TokSymbol SymCloseParen happy_var_4) -> happyIn49 (tLet (getRange (happy_var_1,happy_var_4)) happy_var_3 ) `HappyStk` happyRest}}} happyReduce_207 = happySpecReduce_3 43# happyReduction_207 happyReduction_207 happy_x_3 happy_x_2 happy_x_1 = case happyOut26 happy_x_1 of { happy_var_1 -> case happyOutTok happy_x_2 of { (TokSymbol SymColon happy_var_2) -> case happyOut33 happy_x_3 of { happy_var_3 -> happyIn50 (let r = getRange (happy_var_1,happy_var_2,happy_var_3) -- the range is approximate only for TypedBindings in TypedBindings r $ defaultArg $ TBind r (map (pure . mkBoundName_) happy_var_1) happy_var_3 )}}} happyReduce_208 = happySpecReduce_3 44# happyReduction_208 happyReduction_208 happy_x_3 happy_x_2 happy_x_1 = case happyOut28 happy_x_1 of { happy_var_1 -> case happyOutTok happy_x_2 of { (TokSymbol SymColon happy_var_2) -> case happyOut33 happy_x_3 of { happy_var_3 -> happyIn51 (let r = getRange (happy_var_1,happy_var_2,happy_var_3) -- the range is approximate only for TypedBindings in TypedBindings r $ defaultArg $ TBind r (map (fmap mkBoundName_) happy_var_1) happy_var_3 )}}} happyReduce_209 = happyMonadReduce 2# 45# happyReduction_209 happyReduction_209 (happy_x_2 `HappyStk` happy_x_1 `HappyStk` happyRest) tk = happyThen (case happyOut54 happy_x_1 of { happy_var_1 -> ( case reverse happy_var_1 of Left _ : _ -> parseError "Absurd lambda cannot have a body." _ : _ -> return [ b | Right b <- happy_var_1 ] [] -> parsePanic "Empty LamBinds")} ) (\r -> happyReturn (happyIn52 r)) happyReduce_210 = happyMonadReduce 1# 46# happyReduction_210 happyReduction_210 (happy_x_1 `HappyStk` happyRest) tk = happyThen (case happyOut55 happy_x_1 of { happy_var_1 -> ( case happy_var_1 of Left lb -> case reverse lb of Right _ : _ -> parseError "Missing body for lambda" Left h : _ -> return $ Left ([ b | Right b <- init lb], h) _ -> parseError "Unsupported variant of lambda" Right es -> return $ Right es)} ) (\r -> happyReturn (happyIn53 r)) happyReduce_211 = happySpecReduce_2 47# happyReduction_211 happyReduction_211 happy_x_2 happy_x_1 = case happyOut63 happy_x_1 of { happy_var_1 -> case happyOut54 happy_x_2 of { happy_var_2 -> happyIn54 (map Right happy_var_1 ++ happy_var_2 )}} happyReduce_212 = happySpecReduce_2 47# happyReduction_212 happyReduction_212 happy_x_2 happy_x_1 = case happyOut49 happy_x_1 of { happy_var_1 -> case happyOut54 happy_x_2 of { happy_var_2 -> happyIn54 (Right (DomainFull happy_var_1) : happy_var_2 )}} happyReduce_213 = happySpecReduce_1 47# happyReduction_213 happyReduction_213 happy_x_1 = case happyOut63 happy_x_1 of { happy_var_1 -> happyIn54 (map Right happy_var_1 )} happyReduce_214 = happySpecReduce_1 47# happyReduction_214 happyReduction_214 happy_x_1 = case happyOut49 happy_x_1 of { happy_var_1 -> happyIn54 ([Right $ DomainFull happy_var_1] )} happyReduce_215 = happySpecReduce_2 47# happyReduction_215 happyReduction_215 happy_x_2 happy_x_1 = happyIn54 ([Left NotHidden] ) happyReduce_216 = happySpecReduce_2 47# happyReduction_216 happyReduction_216 happy_x_2 happy_x_1 = happyIn54 ([Left Hidden] ) happyReduce_217 = happySpecReduce_2 47# happyReduction_217 happyReduction_217 happy_x_2 happy_x_1 = happyIn54 ([Left Instance] ) happyReduce_218 = happySpecReduce_2 48# happyReduction_218 happyReduction_218 happy_x_2 happy_x_1 = case happyOut63 happy_x_1 of { happy_var_1 -> case happyOut54 happy_x_2 of { happy_var_2 -> happyIn55 (Left $ map Right happy_var_1 ++ happy_var_2 )}} happyReduce_219 = happySpecReduce_2 48# happyReduction_219 happyReduction_219 happy_x_2 happy_x_1 = case happyOut49 happy_x_1 of { happy_var_1 -> case happyOut54 happy_x_2 of { happy_var_2 -> happyIn55 (Left $ Right (DomainFull happy_var_1) : happy_var_2 )}} happyReduce_220 = happySpecReduce_1 48# happyReduction_220 happyReduction_220 happy_x_1 = case happyOut64 happy_x_1 of { happy_var_1 -> happyIn55 (case happy_var_1 of Left lb -> Left $ map Right lb Right es -> Right es )} happyReduce_221 = happySpecReduce_1 48# happyReduction_221 happyReduction_221 happy_x_1 = case happyOut49 happy_x_1 of { happy_var_1 -> happyIn55 (Left [Right $ DomainFull happy_var_1] )} happyReduce_222 = happySpecReduce_2 48# happyReduction_222 happyReduction_222 happy_x_2 happy_x_1 = happyIn55 (Left [Left NotHidden] ) happyReduce_223 = happySpecReduce_2 48# happyReduction_223 happyReduction_223 happy_x_2 happy_x_1 = happyIn55 (Left [Left Hidden] ) happyReduce_224 = happySpecReduce_2 48# happyReduction_224 happyReduction_224 happy_x_2 happy_x_1 = happyIn55 (Left [Left Instance] ) happyReduce_225 = happyMonadReduce 3# 49# happyReduction_225 happyReduction_225 (happy_x_3 `HappyStk` happy_x_2 `HappyStk` happy_x_1 `HappyStk` happyRest) tk = happyThen (case happyOut39 happy_x_1 of { happy_var_1 -> case happyOut33 happy_x_3 of { happy_var_3 -> ( do p <- exprToLHS (RawApp (getRange happy_var_1) happy_var_1) ; return (p [] [], RHS happy_var_3, NoWhere))}} ) (\r -> happyReturn (happyIn56 r)) happyReduce_226 = happyMonadReduce 1# 50# happyReduction_226 happyReduction_226 (happy_x_1 `HappyStk` happyRest) tk = happyThen (case happyOut36 happy_x_1 of { happy_var_1 -> ( do p <- exprToLHS (RawApp (getRange happy_var_1) happy_var_1); return (p [] [], AbsurdRHS, NoWhere))} ) (\r -> happyReturn (happyIn57 r)) happyReduce_227 = happySpecReduce_1 51# happyReduction_227 happyReduction_227 happy_x_1 = case happyOut56 happy_x_1 of { happy_var_1 -> happyIn58 (happy_var_1 )} happyReduce_228 = happySpecReduce_1 51# happyReduction_228 happyReduction_228 happy_x_1 = case happyOut57 happy_x_1 of { happy_var_1 -> happyIn58 (happy_var_1 )} happyReduce_229 = happySpecReduce_3 52# happyReduction_229 happyReduction_229 happy_x_3 happy_x_2 happy_x_1 = case happyOut59 happy_x_1 of { happy_var_1 -> case happyOut58 happy_x_3 of { happy_var_3 -> happyIn59 (happy_var_3 : happy_var_1 )}} happyReduce_230 = happySpecReduce_3 52# happyReduction_230 happyReduction_230 happy_x_3 happy_x_2 happy_x_1 = case happyOut57 happy_x_1 of { happy_var_1 -> case happyOut58 happy_x_3 of { happy_var_3 -> happyIn59 ([happy_var_3, happy_var_1] )}} happyReduce_231 = happySpecReduce_1 52# happyReduction_231 happyReduction_231 happy_x_1 = case happyOut56 happy_x_1 of { happy_var_1 -> happyIn59 ([happy_var_1] )} happyReduce_232 = happySpecReduce_2 53# happyReduction_232 happyReduction_232 happy_x_2 happy_x_1 = case happyOut61 happy_x_1 of { happy_var_1 -> happyIn60 (happy_var_1 )} happyReduce_233 = happySpecReduce_2 54# happyReduction_233 happyReduction_233 happy_x_2 happy_x_1 = case happyOut63 happy_x_1 of { happy_var_1 -> case happyOut61 happy_x_2 of { happy_var_2 -> happyIn61 (happy_var_1 ++ happy_var_2 )}} happyReduce_234 = happySpecReduce_2 54# happyReduction_234 happyReduction_234 happy_x_2 happy_x_1 = case happyOut49 happy_x_1 of { happy_var_1 -> case happyOut61 happy_x_2 of { happy_var_2 -> happyIn61 (DomainFull happy_var_1 : happy_var_2 )}} happyReduce_235 = happySpecReduce_1 54# happyReduction_235 happyReduction_235 happy_x_1 = case happyOut63 happy_x_1 of { happy_var_1 -> happyIn61 (happy_var_1 )} happyReduce_236 = happySpecReduce_1 54# happyReduction_236 happyReduction_236 happy_x_1 = case happyOut49 happy_x_1 of { happy_var_1 -> happyIn61 ([DomainFull happy_var_1] )} happyReduce_237 = happySpecReduce_2 55# happyReduction_237 happyReduction_237 happy_x_2 happy_x_1 = case happyOut63 happy_x_1 of { happy_var_1 -> case happyOut62 happy_x_2 of { happy_var_2 -> happyIn62 (happy_var_1 ++ happy_var_2 )}} happyReduce_238 = happySpecReduce_2 55# happyReduction_238 happyReduction_238 happy_x_2 happy_x_1 = case happyOut49 happy_x_1 of { happy_var_1 -> case happyOut62 happy_x_2 of { happy_var_2 -> happyIn62 (DomainFull happy_var_1 : happy_var_2 )}} happyReduce_239 = happySpecReduce_0 55# happyReduction_239 happyReduction_239 = happyIn62 ([] ) happyReduce_240 = happySpecReduce_1 56# happyReduction_240 happyReduction_240 happy_x_1 = case happyOut64 happy_x_1 of { happy_var_1 -> happyIn63 (case happy_var_1 of Left lbs -> lbs Right _ -> fail "expected sequence of bound identifiers, not absurd pattern" )} happyReduce_241 = happySpecReduce_1 57# happyReduction_241 happyReduction_241 happy_x_1 = case happyOut24 happy_x_1 of { happy_var_1 -> happyIn64 (Left [DomainFree defaultArgInfo $ mkBoundName_ happy_var_1] )} happyReduce_242 = happySpecReduce_2 57# happyReduction_242 happyReduction_242 happy_x_2 happy_x_1 = case happyOut24 happy_x_2 of { happy_var_2 -> happyIn64 (Left [DomainFree (setRelevance Irrelevant $ defaultArgInfo) $ mkBoundName_ happy_var_2] )} happyReduce_243 = happySpecReduce_2 57# happyReduction_243 happyReduction_243 happy_x_2 happy_x_1 = case happyOut24 happy_x_2 of { happy_var_2 -> happyIn64 (Left [DomainFree (setRelevance NonStrict $ defaultArgInfo) $ mkBoundName_ happy_var_2] )} happyReduce_244 = happySpecReduce_3 57# happyReduction_244 happyReduction_244 happy_x_3 happy_x_2 happy_x_1 = case happyOut27 happy_x_2 of { happy_var_2 -> happyIn64 (either (Left . map (DomainFree (setHiding Hidden $ defaultArgInfo) . mkBoundName_)) Right happy_var_2 )} happyReduce_245 = happySpecReduce_3 57# happyReduction_245 happyReduction_245 happy_x_3 happy_x_2 happy_x_1 = case happyOut26 happy_x_2 of { happy_var_2 -> happyIn64 (Left $ map (DomainFree (setHiding Instance $ defaultArgInfo) . mkBoundName_) happy_var_2 )} happyReduce_246 = happyReduce 4# 57# happyReduction_246 happyReduction_246 (happy_x_4 `HappyStk` happy_x_3 `HappyStk` happy_x_2 `HappyStk` happy_x_1 `HappyStk` happyRest) = case happyOut26 happy_x_3 of { happy_var_3 -> happyIn64 (Left $ map (DomainFree (setHiding Hidden $ setRelevance Irrelevant $ defaultArgInfo) . mkBoundName_) happy_var_3 ) `HappyStk` happyRest} happyReduce_247 = happyReduce 4# 57# happyReduction_247 happyReduction_247 (happy_x_4 `HappyStk` happy_x_3 `HappyStk` happy_x_2 `HappyStk` happy_x_1 `HappyStk` happyRest) = case happyOut26 happy_x_3 of { happy_var_3 -> happyIn64 (Left $ map (DomainFree (setHiding Instance $ setRelevance Irrelevant $ defaultArgInfo) . mkBoundName_) happy_var_3 ) `HappyStk` happyRest} happyReduce_248 = happyReduce 4# 57# happyReduction_248 happyReduction_248 (happy_x_4 `HappyStk` happy_x_3 `HappyStk` happy_x_2 `HappyStk` happy_x_1 `HappyStk` happyRest) = case happyOut26 happy_x_3 of { happy_var_3 -> happyIn64 (Left $ map (DomainFree (setHiding Hidden $ setRelevance NonStrict $ defaultArgInfo) . mkBoundName_) happy_var_3 ) `HappyStk` happyRest} happyReduce_249 = happyReduce 4# 57# happyReduction_249 happyReduction_249 (happy_x_4 `HappyStk` happy_x_3 `HappyStk` happy_x_2 `HappyStk` happy_x_1 `HappyStk` happyRest) = case happyOut26 happy_x_3 of { happy_var_3 -> happyIn64 (Left $ map (DomainFree (setHiding Instance $ setRelevance NonStrict $ defaultArgInfo) . mkBoundName_) happy_var_3 ) `HappyStk` happyRest} happyReduce_250 = happyMonadReduce 1# 58# happyReduction_250 happyReduction_250 (happy_x_1 `HappyStk` happyRest) tk = happyThen (case happyOut66 happy_x_1 of { happy_var_1 -> ( mergeImportDirectives happy_var_1)} ) (\r -> happyReturn (happyIn65 r)) happyReduce_251 = happySpecReduce_2 59# happyReduction_251 happyReduction_251 happy_x_2 happy_x_1 = case happyOut67 happy_x_1 of { happy_var_1 -> case happyOut66 happy_x_2 of { happy_var_2 -> happyIn66 (happy_var_1 : happy_var_2 )}} happyReduce_252 = happySpecReduce_0 59# happyReduction_252 happyReduction_252 = happyIn66 ([] ) happyReduce_253 = happySpecReduce_1 60# happyReduction_253 happyReduction_253 happy_x_1 = case happyOutTok happy_x_1 of { (TokKeyword KwPublic happy_var_1) -> happyIn67 (defaultImportDir { importDirRange = getRange happy_var_1, publicOpen = True } )} happyReduce_254 = happySpecReduce_1 60# happyReduction_254 happyReduction_254 happy_x_1 = case happyOut68 happy_x_1 of { happy_var_1 -> happyIn67 (defaultImportDir { importDirRange = snd happy_var_1, usingOrHiding = fst happy_var_1 } )} happyReduce_255 = happySpecReduce_1 60# happyReduction_255 happyReduction_255 happy_x_1 = case happyOut69 happy_x_1 of { happy_var_1 -> happyIn67 (defaultImportDir { importDirRange = snd happy_var_1, renaming = fst happy_var_1 } )} happyReduce_256 = happyReduce 4# 61# happyReduction_256 happyReduction_256 (happy_x_4 `HappyStk` happy_x_3 `HappyStk` happy_x_2 `HappyStk` happy_x_1 `HappyStk` happyRest) = case happyOutTok happy_x_1 of { (TokKeyword KwUsing happy_var_1) -> case happyOutTok happy_x_2 of { (TokSymbol SymOpenParen happy_var_2) -> case happyOut74 happy_x_3 of { happy_var_3 -> case happyOutTok happy_x_4 of { (TokSymbol SymCloseParen happy_var_4) -> happyIn68 ((Using happy_var_3 , getRange (happy_var_1,happy_var_2,happy_var_3,happy_var_4)) ) `HappyStk` happyRest}}}} happyReduce_257 = happyReduce 4# 61# happyReduction_257 happyReduction_257 (happy_x_4 `HappyStk` happy_x_3 `HappyStk` happy_x_2 `HappyStk` happy_x_1 `HappyStk` happyRest) = case happyOutTok happy_x_1 of { (TokKeyword KwHiding happy_var_1) -> case happyOutTok happy_x_2 of { (TokSymbol SymOpenParen happy_var_2) -> case happyOut74 happy_x_3 of { happy_var_3 -> case happyOutTok happy_x_4 of { (TokSymbol SymCloseParen happy_var_4) -> happyIn68 ((Hiding happy_var_3 , getRange (happy_var_1,happy_var_2,happy_var_3,happy_var_4)) ) `HappyStk` happyRest}}}} happyReduce_258 = happyReduce 4# 62# happyReduction_258 happyReduction_258 (happy_x_4 `HappyStk` happy_x_3 `HappyStk` happy_x_2 `HappyStk` happy_x_1 `HappyStk` happyRest) = case happyOutTok happy_x_1 of { (TokKeyword KwRenaming happy_var_1) -> case happyOutTok happy_x_2 of { (TokSymbol SymOpenParen happy_var_2) -> case happyOut70 happy_x_3 of { happy_var_3 -> case happyOutTok happy_x_4 of { (TokSymbol SymCloseParen happy_var_4) -> happyIn69 ((happy_var_3 , getRange (happy_var_1,happy_var_2,happy_var_3,happy_var_4)) ) `HappyStk` happyRest}}}} happyReduce_259 = happySpecReduce_3 62# happyReduction_259 happyReduction_259 happy_x_3 happy_x_2 happy_x_1 = case happyOutTok happy_x_1 of { (TokKeyword KwRenaming happy_var_1) -> case happyOutTok happy_x_2 of { (TokSymbol SymOpenParen happy_var_2) -> case happyOutTok happy_x_3 of { (TokSymbol SymCloseParen happy_var_3) -> happyIn69 (([] , getRange (happy_var_1,happy_var_2,happy_var_3)) )}}} happyReduce_260 = happySpecReduce_3 63# happyReduction_260 happyReduction_260 happy_x_3 happy_x_2 happy_x_1 = case happyOut71 happy_x_1 of { happy_var_1 -> case happyOut70 happy_x_3 of { happy_var_3 -> happyIn70 (happy_var_1 : happy_var_3 )}} happyReduce_261 = happySpecReduce_1 63# happyReduction_261 happyReduction_261 happy_x_1 = case happyOut71 happy_x_1 of { happy_var_1 -> happyIn70 ([happy_var_1] )} happyReduce_262 = happySpecReduce_3 64# happyReduction_262 happyReduction_262 happy_x_3 happy_x_2 happy_x_1 = case happyOut72 happy_x_1 of { happy_var_1 -> case happyOutTok happy_x_2 of { (TokKeyword KwTo happy_var_2) -> case happyOut16 happy_x_3 of { happy_var_3 -> happyIn71 (Renaming happy_var_1 happy_var_3 (getRange happy_var_2) )}}} happyReduce_263 = happySpecReduce_2 65# happyReduction_263 happyReduction_263 happy_x_2 happy_x_1 = case happyOut16 happy_x_2 of { happy_var_2 -> happyIn72 (ImportedName happy_var_2 )} happyReduce_264 = happySpecReduce_3 65# happyReduction_264 happyReduction_264 happy_x_3 happy_x_2 happy_x_1 = case happyOut16 happy_x_3 of { happy_var_3 -> happyIn72 (ImportedModule happy_var_3 )} happyReduce_265 = happySpecReduce_1 66# happyReduction_265 happyReduction_265 happy_x_1 = case happyOut16 happy_x_1 of { happy_var_1 -> happyIn73 (ImportedName happy_var_1 )} happyReduce_266 = happySpecReduce_2 66# happyReduction_266 happyReduction_266 happy_x_2 happy_x_1 = case happyOut16 happy_x_2 of { happy_var_2 -> happyIn73 (ImportedModule happy_var_2 )} happyReduce_267 = happySpecReduce_0 67# happyReduction_267 happyReduction_267 = happyIn74 ([] ) happyReduce_268 = happySpecReduce_1 67# happyReduction_268 happyReduction_268 happy_x_1 = case happyOut75 happy_x_1 of { happy_var_1 -> happyIn74 (happy_var_1 )} happyReduce_269 = happySpecReduce_1 68# happyReduction_269 happyReduction_269 happy_x_1 = case happyOut73 happy_x_1 of { happy_var_1 -> happyIn75 ([happy_var_1] )} happyReduce_270 = happySpecReduce_3 68# happyReduction_270 happyReduction_270 happy_x_3 happy_x_2 happy_x_1 = case happyOut73 happy_x_1 of { happy_var_1 -> case happyOut75 happy_x_3 of { happy_var_3 -> happyIn75 (happy_var_1 : happy_var_3 )}} happyReduce_271 = happyMonadReduce 3# 69# happyReduction_271 happyReduction_271 (happy_x_3 `HappyStk` happy_x_2 `HappyStk` happy_x_1 `HappyStk` happyRest) tk = happyThen (case happyOut34 happy_x_1 of { happy_var_1 -> case happyOut79 happy_x_2 of { happy_var_2 -> case happyOut78 happy_x_3 of { happy_var_3 -> ( exprToLHS happy_var_1 >>= \p -> return (p happy_var_2 happy_var_3))}}} ) (\r -> happyReturn (happyIn76 r)) happyReduce_272 = happyReduce 4# 69# happyReduction_272 happyReduction_272 (happy_x_4 `HappyStk` happy_x_3 `HappyStk` happy_x_2 `HappyStk` happy_x_1 `HappyStk` happyRest) = case happyOutTok happy_x_1 of { (TokSymbol SymEllipsis happy_var_1) -> case happyOut77 happy_x_2 of { happy_var_2 -> case happyOut79 happy_x_3 of { happy_var_3 -> case happyOut78 happy_x_4 of { happy_var_4 -> happyIn76 (Ellipsis (getRange (happy_var_1,happy_var_2,happy_var_3,happy_var_4)) happy_var_2 happy_var_3 happy_var_4 ) `HappyStk` happyRest}}}} happyReduce_273 = happySpecReduce_0 70# happyReduction_273 happyReduction_273 = happyIn77 ([] ) happyReduce_274 = happyMonadReduce 3# 70# happyReduction_274 happyReduction_274 (happy_x_3 `HappyStk` happy_x_2 `HappyStk` happy_x_1 `HappyStk` happyRest) tk = happyThen (case happyOut39 happy_x_2 of { happy_var_2 -> case happyOut77 happy_x_3 of { happy_var_3 -> ( exprToPattern (RawApp (getRange happy_var_2) happy_var_2) >>= \p -> return (p : happy_var_3))}} ) (\r -> happyReturn (happyIn77 r)) happyReduce_275 = happySpecReduce_0 71# happyReduction_275 happyReduction_275 = happyIn78 ([] ) happyReduce_276 = happySpecReduce_2 71# happyReduction_276 happyReduction_276 happy_x_2 happy_x_1 = case happyOut33 happy_x_2 of { happy_var_2 -> happyIn78 (case happy_var_2 of { WithApp _ e es -> e : es; e -> [e] } )} happyReduce_277 = happySpecReduce_0 72# happyReduction_277 happyReduction_277 = happyIn79 ([] ) happyReduce_278 = happySpecReduce_2 72# happyReduction_278 happyReduction_278 happy_x_2 happy_x_1 = case happyOut34 happy_x_2 of { happy_var_2 -> happyIn79 (case happy_var_2 of { WithApp _ e es -> e : es; e -> [e] } )} happyReduce_279 = happySpecReduce_0 73# happyReduction_279 happyReduction_279 = happyIn80 (NoWhere ) happyReduce_280 = happySpecReduce_2 73# happyReduction_280 happyReduction_280 happy_x_2 happy_x_1 = case happyOut144 happy_x_2 of { happy_var_2 -> happyIn80 (AnyWhere happy_var_2 )} happyReduce_281 = happyReduce 4# 73# happyReduction_281 happyReduction_281 (happy_x_4 `HappyStk` happy_x_3 `HappyStk` happy_x_2 `HappyStk` happy_x_1 `HappyStk` happyRest) = case happyOut16 happy_x_2 of { happy_var_2 -> case happyOut144 happy_x_4 of { happy_var_4 -> happyIn80 (SomeWhere happy_var_2 happy_var_4 ) `HappyStk` happyRest}} happyReduce_282 = happyReduce 4# 73# happyReduction_282 happyReduction_282 (happy_x_4 `HappyStk` happy_x_3 `HappyStk` happy_x_2 `HappyStk` happy_x_1 `HappyStk` happyRest) = case happyOut115 happy_x_2 of { happy_var_2 -> case happyOut144 happy_x_4 of { happy_var_4 -> happyIn80 (SomeWhere happy_var_2 happy_var_4 ) `HappyStk` happyRest}} happyReduce_283 = happySpecReduce_1 74# happyReduction_283 happyReduction_283 happy_x_1 = case happyOut92 happy_x_1 of { happy_var_1 -> happyIn81 (happy_var_1 )} happyReduce_284 = happySpecReduce_1 74# happyReduction_284 happyReduction_284 happy_x_1 = case happyOut84 happy_x_1 of { happy_var_1 -> happyIn81 (happy_var_1 )} happyReduce_285 = happySpecReduce_1 74# happyReduction_285 happyReduction_285 happy_x_1 = case happyOut86 happy_x_1 of { happy_var_1 -> happyIn81 ([happy_var_1] )} happyReduce_286 = happySpecReduce_1 74# happyReduction_286 happyReduction_286 happy_x_1 = case happyOut87 happy_x_1 of { happy_var_1 -> happyIn81 ([happy_var_1] )} happyReduce_287 = happySpecReduce_1 74# happyReduction_287 happyReduction_287 happy_x_1 = case happyOut88 happy_x_1 of { happy_var_1 -> happyIn81 ([happy_var_1] )} happyReduce_288 = happySpecReduce_1 74# happyReduction_288 happyReduction_288 happy_x_1 = case happyOut89 happy_x_1 of { happy_var_1 -> happyIn81 ([happy_var_1] )} happyReduce_289 = happySpecReduce_1 74# happyReduction_289 happyReduction_289 happy_x_1 = case happyOut91 happy_x_1 of { happy_var_1 -> happyIn81 ([happy_var_1] )} happyReduce_290 = happySpecReduce_1 74# happyReduction_290 happyReduction_290 happy_x_1 = case happyOut93 happy_x_1 of { happy_var_1 -> happyIn81 ([happy_var_1] )} happyReduce_291 = happySpecReduce_1 74# happyReduction_291 happyReduction_291 happy_x_1 = case happyOut94 happy_x_1 of { happy_var_1 -> happyIn81 ([happy_var_1] )} happyReduce_292 = happySpecReduce_1 74# happyReduction_292 happyReduction_292 happy_x_1 = case happyOut95 happy_x_1 of { happy_var_1 -> happyIn81 ([happy_var_1] )} happyReduce_293 = happySpecReduce_1 74# happyReduction_293 happyReduction_293 happy_x_1 = case happyOut96 happy_x_1 of { happy_var_1 -> happyIn81 ([happy_var_1] )} happyReduce_294 = happySpecReduce_1 74# happyReduction_294 happyReduction_294 happy_x_1 = case happyOut97 happy_x_1 of { happy_var_1 -> happyIn81 ([happy_var_1] )} happyReduce_295 = happySpecReduce_1 74# happyReduction_295 happyReduction_295 happy_x_1 = case happyOut98 happy_x_1 of { happy_var_1 -> happyIn81 ([happy_var_1] )} happyReduce_296 = happySpecReduce_1 74# happyReduction_296 happyReduction_296 happy_x_1 = case happyOut110 happy_x_1 of { happy_var_1 -> happyIn81 (happy_var_1 )} happyReduce_297 = happySpecReduce_1 74# happyReduction_297 happyReduction_297 happy_x_1 = case happyOut113 happy_x_1 of { happy_var_1 -> happyIn81 ([happy_var_1] )} happyReduce_298 = happySpecReduce_1 74# happyReduction_298 happyReduction_298 happy_x_1 = case happyOut114 happy_x_1 of { happy_var_1 -> happyIn81 ([happy_var_1] )} happyReduce_299 = happySpecReduce_1 74# happyReduction_299 happyReduction_299 happy_x_1 = case happyOut117 happy_x_1 of { happy_var_1 -> happyIn81 ([happy_var_1] )} happyReduce_300 = happySpecReduce_1 74# happyReduction_300 happyReduction_300 happy_x_1 = case happyOut100 happy_x_1 of { happy_var_1 -> happyIn81 ([happy_var_1] )} happyReduce_301 = happySpecReduce_1 74# happyReduction_301 happyReduction_301 happy_x_1 = case happyOut101 happy_x_1 of { happy_var_1 -> happyIn81 ([happy_var_1] )} happyReduce_302 = happySpecReduce_1 74# happyReduction_302 happyReduction_302 happy_x_1 = case happyOut99 happy_x_1 of { happy_var_1 -> happyIn81 ([happy_var_1] )} happyReduce_303 = happySpecReduce_3 75# happyReduction_303 happyReduction_303 happy_x_3 happy_x_2 happy_x_1 = case happyOut17 happy_x_1 of { happy_var_1 -> case happyOut33 happy_x_3 of { happy_var_3 -> happyIn82 (map (\ x -> TypeSig defaultArgInfo x happy_var_3) happy_var_1 )}} happyReduce_304 = happySpecReduce_3 76# happyReduction_304 happyReduction_304 happy_x_3 happy_x_2 happy_x_1 = case happyOut21 happy_x_1 of { happy_var_1 -> case happyOut33 happy_x_3 of { happy_var_3 -> happyIn83 (map (fmap (\ x -> TypeSig defaultArgInfo x happy_var_3)) happy_var_1 )}} happyReduce_305 = happyMonadReduce 3# 77# happyReduction_305 happyReduction_305 (happy_x_3 `HappyStk` happy_x_2 `HappyStk` happy_x_1 `HappyStk` happyRest) tk = happyThen (case happyOut76 happy_x_1 of { happy_var_1 -> case happyOut85 happy_x_2 of { happy_var_2 -> case happyOut80 happy_x_3 of { happy_var_3 -> ( funClauseOrTypeSigs happy_var_1 happy_var_2 happy_var_3)}}} ) (\r -> happyReturn (happyIn84 r)) happyReduce_306 = happySpecReduce_2 78# happyReduction_306 happyReduction_306 happy_x_2 happy_x_1 = case happyOut33 happy_x_2 of { happy_var_2 -> happyIn85 (JustRHS (RHS happy_var_2) )} happyReduce_307 = happySpecReduce_2 78# happyReduction_307 happyReduction_307 happy_x_2 happy_x_1 = case happyOut33 happy_x_2 of { happy_var_2 -> happyIn85 (TypeSigsRHS happy_var_2 )} happyReduce_308 = happySpecReduce_0 78# happyReduction_308 happyReduction_308 = happyIn85 (JustRHS AbsurdRHS ) happyReduce_309 = happyReduce 7# 79# happyReduction_309 happyReduction_309 (happy_x_7 `HappyStk` happy_x_6 `HappyStk` happy_x_5 `HappyStk` happy_x_4 `HappyStk` happy_x_3 `HappyStk` happy_x_2 `HappyStk` happy_x_1 `HappyStk` happyRest) = case happyOutTok happy_x_1 of { (TokKeyword KwData happy_var_1) -> case happyOut16 happy_x_2 of { happy_var_2 -> case happyOut62 happy_x_3 of { happy_var_3 -> case happyOutTok happy_x_4 of { (TokSymbol SymColon happy_var_4) -> case happyOut33 happy_x_5 of { happy_var_5 -> case happyOutTok happy_x_6 of { (TokKeyword KwWhere happy_var_6) -> case happyOut140 happy_x_7 of { happy_var_7 -> happyIn86 (Data (getRange (happy_var_1,happy_var_2,happy_var_3,happy_var_4,happy_var_5,happy_var_6,happy_var_7)) Inductive happy_var_2 happy_var_3 (Just happy_var_5) happy_var_7 ) `HappyStk` happyRest}}}}}}} happyReduce_310 = happyReduce 7# 79# happyReduction_310 happyReduction_310 (happy_x_7 `HappyStk` happy_x_6 `HappyStk` happy_x_5 `HappyStk` happy_x_4 `HappyStk` happy_x_3 `HappyStk` happy_x_2 `HappyStk` happy_x_1 `HappyStk` happyRest) = case happyOutTok happy_x_1 of { (TokKeyword KwCoData happy_var_1) -> case happyOut16 happy_x_2 of { happy_var_2 -> case happyOut62 happy_x_3 of { happy_var_3 -> case happyOutTok happy_x_4 of { (TokSymbol SymColon happy_var_4) -> case happyOut33 happy_x_5 of { happy_var_5 -> case happyOutTok happy_x_6 of { (TokKeyword KwWhere happy_var_6) -> case happyOut140 happy_x_7 of { happy_var_7 -> happyIn86 (Data (getRange (happy_var_1,happy_var_2,happy_var_3,happy_var_4,happy_var_5,happy_var_6,happy_var_7)) CoInductive happy_var_2 happy_var_3 (Just happy_var_5) happy_var_7 ) `HappyStk` happyRest}}}}}}} happyReduce_311 = happyReduce 5# 79# happyReduction_311 happyReduction_311 (happy_x_5 `HappyStk` happy_x_4 `HappyStk` happy_x_3 `HappyStk` happy_x_2 `HappyStk` happy_x_1 `HappyStk` happyRest) = case happyOutTok happy_x_1 of { (TokKeyword KwData happy_var_1) -> case happyOut16 happy_x_2 of { happy_var_2 -> case happyOut62 happy_x_3 of { happy_var_3 -> case happyOutTok happy_x_4 of { (TokKeyword KwWhere happy_var_4) -> case happyOut140 happy_x_5 of { happy_var_5 -> happyIn86 (Data (getRange (happy_var_1,happy_var_2,happy_var_3,happy_var_4,happy_var_5)) Inductive happy_var_2 happy_var_3 Nothing happy_var_5 ) `HappyStk` happyRest}}}}} happyReduce_312 = happyReduce 5# 79# happyReduction_312 happyReduction_312 (happy_x_5 `HappyStk` happy_x_4 `HappyStk` happy_x_3 `HappyStk` happy_x_2 `HappyStk` happy_x_1 `HappyStk` happyRest) = case happyOutTok happy_x_1 of { (TokKeyword KwCoData happy_var_1) -> case happyOut16 happy_x_2 of { happy_var_2 -> case happyOut62 happy_x_3 of { happy_var_3 -> case happyOutTok happy_x_4 of { (TokKeyword KwWhere happy_var_4) -> case happyOut140 happy_x_5 of { happy_var_5 -> happyIn86 (Data (getRange (happy_var_1,happy_var_2,happy_var_3,happy_var_4,happy_var_5)) CoInductive happy_var_2 happy_var_3 Nothing happy_var_5 ) `HappyStk` happyRest}}}}} happyReduce_313 = happyReduce 5# 80# happyReduction_313 happyReduction_313 (happy_x_5 `HappyStk` happy_x_4 `HappyStk` happy_x_3 `HappyStk` happy_x_2 `HappyStk` happy_x_1 `HappyStk` happyRest) = case happyOutTok happy_x_1 of { (TokKeyword KwData happy_var_1) -> case happyOut16 happy_x_2 of { happy_var_2 -> case happyOut62 happy_x_3 of { happy_var_3 -> case happyOutTok happy_x_4 of { (TokSymbol SymColon happy_var_4) -> case happyOut33 happy_x_5 of { happy_var_5 -> happyIn87 (DataSig (getRange (happy_var_1,happy_var_2,happy_var_3,happy_var_4,happy_var_5)) Inductive happy_var_2 happy_var_3 happy_var_5 ) `HappyStk` happyRest}}}}} happyReduce_314 = happyMonadReduce 7# 81# happyReduction_314 happyReduction_314 (happy_x_7 `HappyStk` happy_x_6 `HappyStk` happy_x_5 `HappyStk` happy_x_4 `HappyStk` happy_x_3 `HappyStk` happy_x_2 `HappyStk` happy_x_1 `HappyStk` happyRest) tk = happyThen (case happyOutTok happy_x_1 of { (TokKeyword KwRecord happy_var_1) -> case happyOut41 happy_x_2 of { happy_var_2 -> case happyOut62 happy_x_3 of { happy_var_3 -> case happyOutTok happy_x_4 of { (TokSymbol SymColon happy_var_4) -> case happyOut33 happy_x_5 of { happy_var_5 -> case happyOutTok happy_x_6 of { (TokKeyword KwWhere happy_var_6) -> case happyOut141 happy_x_7 of { happy_var_7 -> ( exprToName happy_var_2 >>= \ n -> return $ Record (getRange (happy_var_1,happy_var_2,happy_var_3,happy_var_4,happy_var_5,happy_var_6,happy_var_7)) n (fst3 happy_var_7) (snd3 happy_var_7) happy_var_3 (Just happy_var_5) (thd3 happy_var_7))}}}}}}} ) (\r -> happyReturn (happyIn88 r)) happyReduce_315 = happyMonadReduce 5# 81# happyReduction_315 happyReduction_315 (happy_x_5 `HappyStk` happy_x_4 `HappyStk` happy_x_3 `HappyStk` happy_x_2 `HappyStk` happy_x_1 `HappyStk` happyRest) tk = happyThen (case happyOutTok happy_x_1 of { (TokKeyword KwRecord happy_var_1) -> case happyOut41 happy_x_2 of { happy_var_2 -> case happyOut62 happy_x_3 of { happy_var_3 -> case happyOutTok happy_x_4 of { (TokKeyword KwWhere happy_var_4) -> case happyOut141 happy_x_5 of { happy_var_5 -> ( exprToName happy_var_2 >>= \ n -> return $ Record (getRange (happy_var_1,happy_var_2,happy_var_3,happy_var_4,happy_var_5)) n (fst3 happy_var_5) (snd3 happy_var_5) happy_var_3 Nothing (thd3 happy_var_5))}}}}} ) (\r -> happyReturn (happyIn88 r)) happyReduce_316 = happyMonadReduce 5# 82# happyReduction_316 happyReduction_316 (happy_x_5 `HappyStk` happy_x_4 `HappyStk` happy_x_3 `HappyStk` happy_x_2 `HappyStk` happy_x_1 `HappyStk` happyRest) tk = happyThen (case happyOutTok happy_x_1 of { (TokKeyword KwRecord happy_var_1) -> case happyOut41 happy_x_2 of { happy_var_2 -> case happyOut62 happy_x_3 of { happy_var_3 -> case happyOutTok happy_x_4 of { (TokSymbol SymColon happy_var_4) -> case happyOut33 happy_x_5 of { happy_var_5 -> ( exprToName happy_var_2 >>= \ n -> return $ RecordSig (getRange (happy_var_1,happy_var_2,happy_var_3,happy_var_4,happy_var_5)) n happy_var_3 happy_var_5)}}}}} ) (\r -> happyReturn (happyIn89 r)) happyReduce_317 = happySpecReduce_2 83# happyReduction_317 happyReduction_317 happy_x_2 happy_x_1 = case happyOut16 happy_x_2 of { happy_var_2 -> happyIn90 (happy_var_2 )} happyReduce_318 = happySpecReduce_3 84# happyReduction_318 happyReduction_318 happy_x_3 happy_x_2 happy_x_1 = case happyOutTok happy_x_1 of { (TokKeyword KwInfix happy_var_1) -> case happyOut15 happy_x_2 of { happy_var_2 -> case happyOut25 happy_x_3 of { happy_var_3 -> happyIn91 (Infix (Fixity (getRange (happy_var_1,happy_var_3)) happy_var_2 NonAssoc) happy_var_3 )}}} happyReduce_319 = happySpecReduce_3 84# happyReduction_319 happyReduction_319 happy_x_3 happy_x_2 happy_x_1 = case happyOutTok happy_x_1 of { (TokKeyword KwInfixL happy_var_1) -> case happyOut15 happy_x_2 of { happy_var_2 -> case happyOut25 happy_x_3 of { happy_var_3 -> happyIn91 (Infix (Fixity (getRange (happy_var_1,happy_var_3)) happy_var_2 LeftAssoc) happy_var_3 )}}} happyReduce_320 = happySpecReduce_3 84# happyReduction_320 happyReduction_320 happy_x_3 happy_x_2 happy_x_1 = case happyOutTok happy_x_1 of { (TokKeyword KwInfixR happy_var_1) -> case happyOut15 happy_x_2 of { happy_var_2 -> case happyOut25 happy_x_3 of { happy_var_3 -> happyIn91 (Infix (Fixity (getRange (happy_var_1,happy_var_3)) happy_var_2 RightAssoc) happy_var_3 )}}} happyReduce_321 = happySpecReduce_2 85# happyReduction_321 happyReduction_321 happy_x_2 happy_x_1 = case happyOut138 happy_x_2 of { happy_var_2 -> happyIn92 (let toField (Common.Arg info (TypeSig _ x t)) = Field x (Common.Arg info t) in map toField happy_var_2 )} happyReduce_322 = happySpecReduce_2 86# happyReduction_322 happyReduction_322 happy_x_2 happy_x_1 = case happyOutTok happy_x_1 of { (TokKeyword KwMutual happy_var_1) -> case happyOut143 happy_x_2 of { happy_var_2 -> happyIn93 (Mutual (fuseRange happy_var_1 happy_var_2) happy_var_2 )}} happyReduce_323 = happySpecReduce_2 87# happyReduction_323 happyReduction_323 happy_x_2 happy_x_1 = case happyOutTok happy_x_1 of { (TokKeyword KwAbstract happy_var_1) -> case happyOut143 happy_x_2 of { happy_var_2 -> happyIn94 (Abstract (fuseRange happy_var_1 happy_var_2) happy_var_2 )}} happyReduce_324 = happySpecReduce_2 88# happyReduction_324 happyReduction_324 happy_x_2 happy_x_1 = case happyOutTok happy_x_1 of { (TokKeyword KwPrivate happy_var_1) -> case happyOut143 happy_x_2 of { happy_var_2 -> happyIn95 (Private (fuseRange happy_var_1 happy_var_2) happy_var_2 )}} happyReduce_325 = happySpecReduce_2 89# happyReduction_325 happyReduction_325 happy_x_2 happy_x_1 = case happyOutTok happy_x_1 of { (TokKeyword KwInstance happy_var_1) -> case happyOut143 happy_x_2 of { happy_var_2 -> happyIn96 (InstanceB (fuseRange happy_var_1 happy_var_2) happy_var_2 )}} happyReduce_326 = happySpecReduce_2 90# happyReduction_326 happyReduction_326 happy_x_2 happy_x_1 = case happyOutTok happy_x_1 of { (TokKeyword KwPostulate happy_var_1) -> case happyOut143 happy_x_2 of { happy_var_2 -> happyIn97 (Postulate (fuseRange happy_var_1 happy_var_2) happy_var_2 )}} happyReduce_327 = happySpecReduce_2 91# happyReduction_327 happyReduction_327 happy_x_2 happy_x_1 = case happyOutTok happy_x_1 of { (TokKeyword KwPrimitive happy_var_1) -> case happyOut136 happy_x_2 of { happy_var_2 -> happyIn98 (Primitive (fuseRange happy_var_1 happy_var_2) happy_var_2 )}} happyReduce_328 = happyReduce 4# 92# happyReduction_328 happyReduction_328 (happy_x_4 `HappyStk` happy_x_3 `HappyStk` happy_x_2 `HappyStk` happy_x_1 `HappyStk` happyRest) = case happyOutTok happy_x_1 of { (TokKeyword KwUnquoteDecl happy_var_1) -> case happyOut16 happy_x_2 of { happy_var_2 -> case happyOut33 happy_x_4 of { happy_var_4 -> happyIn99 (UnquoteDecl (fuseRange happy_var_1 happy_var_4) happy_var_2 happy_var_4 ) `HappyStk` happyRest}}} happyReduce_329 = happyMonadReduce 5# 93# happyReduction_329 happyReduction_329 (happy_x_5 `HappyStk` happy_x_4 `HappyStk` happy_x_3 `HappyStk` happy_x_2 `HappyStk` happy_x_1 `HappyStk` happyRest) tk = happyThen (case happyOut16 happy_x_2 of { happy_var_2 -> case happyOut104 happy_x_3 of { happy_var_3 -> case happyOut103 happy_x_5 of { happy_var_5 -> ( case happy_var_2 of Name _ [_] -> case mkNotation happy_var_3 (map rangedThing happy_var_5) of Left err -> parseError $ "Malformed syntax declaration: " ++ err Right n -> return $ Syntax happy_var_2 n _ -> parseError "Syntax declarations are allowed only for simple names (without holes)")}}} ) (\r -> happyReturn (happyIn100 r)) happyReduce_330 = happyMonadReduce 5# 94# happyReduction_330 happyReduction_330 (happy_x_5 `HappyStk` happy_x_4 `HappyStk` happy_x_3 `HappyStk` happy_x_2 `HappyStk` happy_x_1 `HappyStk` happyRest) tk = happyThen (case happyOutTok happy_x_1 of { (TokKeyword KwPatternSyn happy_var_1) -> case happyOut16 happy_x_2 of { happy_var_2 -> case happyOut102 happy_x_3 of { happy_var_3 -> case happyOutTok happy_x_4 of { (TokSymbol SymEqual happy_var_4) -> case happyOut33 happy_x_5 of { happy_var_5 -> ( do p <- exprToPattern happy_var_5 return (PatternSyn (getRange (happy_var_1,happy_var_2,happy_var_3,happy_var_4,happy_var_5)) happy_var_2 happy_var_3 p))}}}}} ) (\r -> happyReturn (happyIn101 r)) happyReduce_331 = happySpecReduce_0 95# happyReduction_331 happyReduction_331 = happyIn102 ([] ) happyReduce_332 = happyMonadReduce 1# 95# happyReduction_332 happyReduction_332 (happy_x_1 `HappyStk` happyRest) tk = happyThen (case happyOut54 happy_x_1 of { happy_var_1 -> ( patternSynArgs happy_var_1)} ) (\r -> happyReturn (happyIn102 r)) happyReduce_333 = happySpecReduce_1 96# happyReduction_333 happyReduction_333 happy_x_1 = case happyOut108 happy_x_1 of { happy_var_1 -> happyIn103 ([happy_var_1] )} happyReduce_334 = happySpecReduce_2 96# happyReduction_334 happyReduction_334 happy_x_2 happy_x_1 = case happyOut103 happy_x_1 of { happy_var_1 -> case happyOut108 happy_x_2 of { happy_var_2 -> happyIn103 (happy_var_1 ++ [happy_var_2] )}} happyReduce_335 = happySpecReduce_1 97# happyReduction_335 happyReduction_335 happy_x_1 = case happyOut105 happy_x_1 of { happy_var_1 -> happyIn104 ([happy_var_1] )} happyReduce_336 = happySpecReduce_2 97# happyReduction_336 happyReduction_336 happy_x_2 happy_x_1 = case happyOut104 happy_x_1 of { happy_var_1 -> case happyOut105 happy_x_2 of { happy_var_2 -> happyIn104 (happy_var_1 ++ [happy_var_2] )}} happyReduce_337 = happySpecReduce_1 98# happyReduction_337 happyReduction_337 happy_x_1 = case happyOut106 happy_x_1 of { happy_var_1 -> happyIn105 (defaultNamedArg happy_var_1 )} happyReduce_338 = happySpecReduce_3 98# happyReduction_338 happyReduction_338 happy_x_3 happy_x_2 happy_x_1 = case happyOut107 happy_x_2 of { happy_var_2 -> happyIn105 (setHiding Hidden $ defaultNamedArg happy_var_2 )} happyReduce_339 = happySpecReduce_3 98# happyReduction_339 happyReduction_339 happy_x_3 happy_x_2 happy_x_1 = case happyOut107 happy_x_2 of { happy_var_2 -> happyIn105 (setHiding Instance $ defaultNamedArg happy_var_2 )} happyReduce_340 = happyReduce 5# 98# happyReduction_340 happyReduction_340 (happy_x_5 `HappyStk` happy_x_4 `HappyStk` happy_x_3 `HappyStk` happy_x_2 `HappyStk` happy_x_1 `HappyStk` happyRest) = case happyOut108 happy_x_2 of { happy_var_2 -> case happyOut107 happy_x_4 of { happy_var_4 -> happyIn105 (setHiding Hidden $ defaultArg $ named happy_var_2 happy_var_4 ) `HappyStk` happyRest}} happyReduce_341 = happyReduce 5# 98# happyReduction_341 happyReduction_341 (happy_x_5 `HappyStk` happy_x_4 `HappyStk` happy_x_3 `HappyStk` happy_x_2 `HappyStk` happy_x_1 `HappyStk` happyRest) = case happyOut108 happy_x_2 of { happy_var_2 -> case happyOut107 happy_x_4 of { happy_var_4 -> happyIn105 (setHiding Instance $ defaultArg $ named happy_var_2 happy_var_4 ) `HappyStk` happyRest}} happyReduce_342 = happySpecReduce_1 99# happyReduction_342 happyReduction_342 happy_x_1 = case happyOut108 happy_x_1 of { happy_var_1 -> happyIn106 (ExprHole (rangedThing happy_var_1) )} happyReduce_343 = happyReduce 6# 99# happyReduction_343 happyReduction_343 (happy_x_6 `HappyStk` happy_x_5 `HappyStk` happy_x_4 `HappyStk` happy_x_3 `HappyStk` happy_x_2 `HappyStk` happy_x_1 `HappyStk` happyRest) = case happyOut108 happy_x_3 of { happy_var_3 -> case happyOut108 happy_x_5 of { happy_var_5 -> happyIn106 (LambdaHole (rangedThing happy_var_3) (rangedThing happy_var_5) ) `HappyStk` happyRest}} happyReduce_344 = happySpecReduce_1 100# happyReduction_344 happyReduction_344 happy_x_1 = case happyOut108 happy_x_1 of { happy_var_1 -> happyIn107 (ExprHole (rangedThing happy_var_1) )} happyReduce_345 = happyReduce 4# 100# happyReduction_345 happyReduction_345 (happy_x_4 `HappyStk` happy_x_3 `HappyStk` happy_x_2 `HappyStk` happy_x_1 `HappyStk` happyRest) = case happyOut108 happy_x_2 of { happy_var_2 -> case happyOut108 happy_x_4 of { happy_var_4 -> happyIn107 (LambdaHole (rangedThing happy_var_2) (rangedThing happy_var_4) ) `HappyStk` happyRest}} happyReduce_346 = happySpecReduce_1 101# happyReduction_346 happyReduction_346 happy_x_1 = case happyOutTok happy_x_1 of { (TokId happy_var_1) -> happyIn108 (Ranged (getRange $ fst happy_var_1) (stringToRawName $ snd happy_var_1) )} happyReduce_347 = happySpecReduce_1 102# happyReduction_347 happyReduction_347 happy_x_1 = case happyOutTok happy_x_1 of { (TokKeyword KwOpen happy_var_1) -> happyIn109 (Just (getRange happy_var_1) )} happyReduce_348 = happySpecReduce_0 102# happyReduction_348 happyReduction_348 = happyIn109 (Nothing ) happyReduce_349 = happyMonadReduce 5# 103# happyReduction_349 happyReduction_349 (happy_x_5 `HappyStk` happy_x_4 `HappyStk` happy_x_3 `HappyStk` happy_x_2 `HappyStk` happy_x_1 `HappyStk` happyRest) tk = happyThen (case happyOut109 happy_x_1 of { happy_var_1 -> case happyOutTok happy_x_2 of { (TokKeyword KwImport happy_var_2) -> case happyOut23 happy_x_3 of { happy_var_3 -> case happyOut111 happy_x_4 of { happy_var_4 -> case happyOut65 happy_x_5 of { happy_var_5 -> ( let { doOpen = maybe DontOpen (const DoOpen) happy_var_1 ; m = happy_var_3 ; es = happy_var_4 ; dir = happy_var_5 ; r = getRange (m, es, dir) ; mr = getRange m ; unique = hashString $ show $ (Nothing :: Maybe ()) <$ r -- turn range into unique id, but delete file path -- which is absolute and messes up suite of failing tests -- (different hashs on different installations) -- TODO: Don't use (insecure) hashes in this way. ; fresh = Name mr [ Id $ stringToRawName $ ".#" ++ show m ++ "-" ++ show unique ] ; impStm asR = Import mr m (Just (AsName fresh asR)) DontOpen defaultImportDir ; appStm m' es = let r = getRange (m, es) in Private r [ ModuleMacro r m' (SectionApp (getRange es) [] (RawApp (getRange es) (Ident (QName fresh) : es))) doOpen dir ] ; (initArgs, last2Args) = splitAt (length es - 2) es ; parseAsClause = case last2Args of { [ Ident (QName (Name asR [Id x])) , Ident (QName m') ] | rawNameToString x == "as" -> Just (asR, m') ; _ -> Nothing } } in case es of { [] -> return [Import mr m Nothing doOpen dir] ; _ | Just (asR, m') <- parseAsClause -> if null initArgs then return [ Import (getRange (m, asR, m', dir)) m (Just (AsName m' asR)) doOpen dir ] else return [ impStm asR, appStm m' initArgs ] | DontOpen <- doOpen -> parseErrorAt (fromJust $ rStart $ getRange happy_var_2) "An import statement with module instantiation does not actually import the module. This statement achieves nothing. Either add the `open' keyword or bind the instantiated module with an `as' clause." | otherwise -> return [ impStm noRange , appStm (noName $ beginningOf $ getRange m) es ] })}}}}} ) (\r -> happyReturn (happyIn110 r)) happyReduce_350 = happyReduce 4# 103# happyReduction_350 happyReduction_350 (happy_x_4 `HappyStk` happy_x_3 `HappyStk` happy_x_2 `HappyStk` happy_x_1 `HappyStk` happyRest) = case happyOut23 happy_x_2 of { happy_var_2 -> case happyOut111 happy_x_3 of { happy_var_3 -> case happyOut65 happy_x_4 of { happy_var_4 -> happyIn110 (let { m = happy_var_2 ; es = happy_var_3 ; dir = happy_var_4 ; r = getRange (m, es, dir) } in [ case es of { [] -> Open r m dir ; _ -> Private r [ ModuleMacro r (noName $ beginningOf $ getRange m) (SectionApp (getRange (m , es)) [] (RawApp (fuseRange m es) (Ident m : es))) DoOpen dir ] } ] ) `HappyStk` happyRest}}} happyReduce_351 = happyReduce 6# 103# happyReduction_351 happyReduction_351 (happy_x_6 `HappyStk` happy_x_5 `HappyStk` happy_x_4 `HappyStk` happy_x_3 `HappyStk` happy_x_2 `HappyStk` happy_x_1 `HappyStk` happyRest) = case happyOut23 happy_x_2 of { happy_var_2 -> case happyOut65 happy_x_6 of { happy_var_6 -> happyIn110 (let r = getRange happy_var_2 in [ Private r [ ModuleMacro r (noName $ beginningOf $ getRange happy_var_2) (RecordModuleIFS r happy_var_2) DoOpen happy_var_6 ] ] ) `HappyStk` happyRest}} happyReduce_352 = happySpecReduce_0 104# happyReduction_352 happyReduction_352 = happyIn111 ([] ) happyReduce_353 = happySpecReduce_2 104# happyReduction_353 happyReduction_353 happy_x_2 happy_x_1 = case happyOut42 happy_x_1 of { happy_var_1 -> case happyOut111 happy_x_2 of { happy_var_2 -> happyIn111 (happy_var_1 : happy_var_2 )}} happyReduce_354 = happyReduce 4# 105# happyReduction_354 happyReduction_354 (happy_x_4 `HappyStk` happy_x_3 `HappyStk` happy_x_2 `HappyStk` happy_x_1 `HappyStk` happyRest) = case happyOut23 happy_x_1 of { happy_var_1 -> case happyOutTok happy_x_2 of { (TokSymbol SymDoubleOpenBrace happy_var_2) -> case happyOutTok happy_x_3 of { (TokSymbol SymEllipsis happy_var_3) -> case happyOut18 happy_x_4 of { happy_var_4 -> happyIn112 ((\ts -> if null ts then return $ RecordModuleIFS (getRange (happy_var_1,happy_var_2,happy_var_3,happy_var_4)) happy_var_1 else parseError "No bindings allowed for record module with non-canonical implicits" ) ) `HappyStk` happyRest}}}} happyReduce_355 = happySpecReduce_2 105# happyReduction_355 happyReduction_355 happy_x_2 happy_x_1 = case happyOut23 happy_x_1 of { happy_var_1 -> case happyOut111 happy_x_2 of { happy_var_2 -> happyIn112 ((\ts -> return $ SectionApp (getRange (happy_var_1, happy_var_2)) ts (RawApp (fuseRange happy_var_1 happy_var_2) (Ident happy_var_1 : happy_var_2)) ) )}} happyReduce_356 = happyMonadReduce 6# 106# happyReduction_356 happyReduction_356 (happy_x_6 `HappyStk` happy_x_5 `HappyStk` happy_x_4 `HappyStk` happy_x_3 `HappyStk` happy_x_2 `HappyStk` happy_x_1 `HappyStk` happyRest) tk = happyThen (case happyOutTok happy_x_1 of { (TokKeyword KwModule happy_var_1) -> case happyOut23 happy_x_2 of { happy_var_2 -> case happyOut62 happy_x_3 of { happy_var_3 -> case happyOut112 happy_x_5 of { happy_var_5 -> case happyOut65 happy_x_6 of { happy_var_6 -> ( do { ma <- happy_var_5 (map addType happy_var_3) ; name <- ensureUnqual happy_var_2 ; return $ ModuleMacro (getRange (happy_var_1, happy_var_2, ma, happy_var_6)) name ma DontOpen happy_var_6 })}}}}} ) (\r -> happyReturn (happyIn113 r)) happyReduce_357 = happyMonadReduce 7# 106# happyReduction_357 happyReduction_357 (happy_x_7 `HappyStk` happy_x_6 `HappyStk` happy_x_5 `HappyStk` happy_x_4 `HappyStk` happy_x_3 `HappyStk` happy_x_2 `HappyStk` happy_x_1 `HappyStk` happyRest) tk = happyThen (case happyOutTok happy_x_1 of { (TokKeyword KwOpen happy_var_1) -> case happyOutTok happy_x_2 of { (TokKeyword KwModule happy_var_2) -> case happyOut16 happy_x_3 of { happy_var_3 -> case happyOut62 happy_x_4 of { happy_var_4 -> case happyOut112 happy_x_6 of { happy_var_6 -> case happyOut65 happy_x_7 of { happy_var_7 -> ( do {ma <- happy_var_6 (map addType happy_var_4); return $ ModuleMacro (getRange (happy_var_1, happy_var_2, happy_var_3, ma, happy_var_7)) happy_var_3 ma DoOpen happy_var_7 })}}}}}} ) (\r -> happyReturn (happyIn113 r)) happyReduce_358 = happyReduce 5# 107# happyReduction_358 happyReduction_358 (happy_x_5 `HappyStk` happy_x_4 `HappyStk` happy_x_3 `HappyStk` happy_x_2 `HappyStk` happy_x_1 `HappyStk` happyRest) = case happyOutTok happy_x_1 of { (TokKeyword KwModule happy_var_1) -> case happyOut23 happy_x_2 of { happy_var_2 -> case happyOut62 happy_x_3 of { happy_var_3 -> case happyOutTok happy_x_4 of { (TokKeyword KwWhere happy_var_4) -> case happyOut144 happy_x_5 of { happy_var_5 -> happyIn114 (Module (getRange (happy_var_1,happy_var_2,happy_var_3,happy_var_4,happy_var_5)) happy_var_2 (map addType happy_var_3) happy_var_5 ) `HappyStk` happyRest}}}}} happyReduce_359 = happyReduce 5# 107# happyReduction_359 happyReduction_359 (happy_x_5 `HappyStk` happy_x_4 `HappyStk` happy_x_3 `HappyStk` happy_x_2 `HappyStk` happy_x_1 `HappyStk` happyRest) = case happyOutTok happy_x_1 of { (TokKeyword KwModule happy_var_1) -> case happyOut115 happy_x_2 of { happy_var_2 -> case happyOut62 happy_x_3 of { happy_var_3 -> case happyOutTok happy_x_4 of { (TokKeyword KwWhere happy_var_4) -> case happyOut144 happy_x_5 of { happy_var_5 -> happyIn114 (Module (getRange (happy_var_1,happy_var_2,happy_var_3,happy_var_4,happy_var_5)) (QName happy_var_2) (map addType happy_var_3) happy_var_5 ) `HappyStk` happyRest}}}}} happyReduce_360 = happySpecReduce_1 108# happyReduction_360 happyReduction_360 happy_x_1 = case happyOutTok happy_x_1 of { (TokSymbol SymUnderscore happy_var_1) -> happyIn115 (noName (getRange happy_var_1) )} happyReduce_361 = happySpecReduce_1 109# happyReduction_361 happyReduction_361 happy_x_1 = case happyOut146 happy_x_1 of { happy_var_1 -> happyIn116 (figureOutTopLevelModule happy_var_1 )} happyReduce_362 = happySpecReduce_1 110# happyReduction_362 happyReduction_362 happy_x_1 = case happyOut118 happy_x_1 of { happy_var_1 -> happyIn117 (Pragma happy_var_1 )} happyReduce_363 = happySpecReduce_1 111# happyReduction_363 happyReduction_363 happy_x_1 = case happyOut120 happy_x_1 of { happy_var_1 -> happyIn118 (happy_var_1 )} happyReduce_364 = happySpecReduce_1 111# happyReduction_364 happyReduction_364 happy_x_1 = case happyOut121 happy_x_1 of { happy_var_1 -> happyIn118 (happy_var_1 )} happyReduce_365 = happySpecReduce_1 111# happyReduction_365 happyReduction_365 happy_x_1 = case happyOut122 happy_x_1 of { happy_var_1 -> happyIn118 (happy_var_1 )} happyReduce_366 = happySpecReduce_1 111# happyReduction_366 happyReduction_366 happy_x_1 = case happyOut123 happy_x_1 of { happy_var_1 -> happyIn118 (happy_var_1 )} happyReduce_367 = happySpecReduce_1 111# happyReduction_367 happyReduction_367 happy_x_1 = case happyOut125 happy_x_1 of { happy_var_1 -> happyIn118 (happy_var_1 )} happyReduce_368 = happySpecReduce_1 111# happyReduction_368 happyReduction_368 happy_x_1 = case happyOut124 happy_x_1 of { happy_var_1 -> happyIn118 (happy_var_1 )} happyReduce_369 = happySpecReduce_1 111# happyReduction_369 happyReduction_369 happy_x_1 = case happyOut126 happy_x_1 of { happy_var_1 -> happyIn118 (happy_var_1 )} happyReduce_370 = happySpecReduce_1 111# happyReduction_370 happyReduction_370 happy_x_1 = case happyOut127 happy_x_1 of { happy_var_1 -> happyIn118 (happy_var_1 )} happyReduce_371 = happySpecReduce_1 111# happyReduction_371 happyReduction_371 happy_x_1 = case happyOut128 happy_x_1 of { happy_var_1 -> happyIn118 (happy_var_1 )} happyReduce_372 = happySpecReduce_1 111# happyReduction_372 happyReduction_372 happy_x_1 = case happyOut134 happy_x_1 of { happy_var_1 -> happyIn118 (happy_var_1 )} happyReduce_373 = happySpecReduce_1 111# happyReduction_373 happyReduction_373 happy_x_1 = case happyOut135 happy_x_1 of { happy_var_1 -> happyIn118 (happy_var_1 )} happyReduce_374 = happySpecReduce_1 111# happyReduction_374 happyReduction_374 happy_x_1 = case happyOut129 happy_x_1 of { happy_var_1 -> happyIn118 (happy_var_1 )} happyReduce_375 = happySpecReduce_1 111# happyReduction_375 happyReduction_375 happy_x_1 = case happyOut132 happy_x_1 of { happy_var_1 -> happyIn118 (happy_var_1 )} happyReduce_376 = happySpecReduce_1 111# happyReduction_376 happyReduction_376 happy_x_1 = case happyOut131 happy_x_1 of { happy_var_1 -> happyIn118 (happy_var_1 )} happyReduce_377 = happySpecReduce_1 111# happyReduction_377 happyReduction_377 happy_x_1 = case happyOut130 happy_x_1 of { happy_var_1 -> happyIn118 (happy_var_1 )} happyReduce_378 = happySpecReduce_1 111# happyReduction_378 happyReduction_378 happy_x_1 = case happyOut133 happy_x_1 of { happy_var_1 -> happyIn118 (happy_var_1 )} happyReduce_379 = happySpecReduce_1 111# happyReduction_379 happyReduction_379 happy_x_1 = case happyOut119 happy_x_1 of { happy_var_1 -> happyIn118 (happy_var_1 )} happyReduce_380 = happyReduce 4# 112# happyReduction_380 happyReduction_380 (happy_x_4 `HappyStk` happy_x_3 `HappyStk` happy_x_2 `HappyStk` happy_x_1 `HappyStk` happyRest) = case happyOutTok happy_x_1 of { (TokSymbol SymOpenPragma happy_var_1) -> case happyOutTok happy_x_2 of { (TokKeyword KwOPTIONS happy_var_2) -> case happyOut29 happy_x_3 of { happy_var_3 -> case happyOutTok happy_x_4 of { (TokSymbol SymClosePragma happy_var_4) -> happyIn119 (OptionsPragma (getRange (happy_var_1,happy_var_2,happy_var_4)) happy_var_3 ) `HappyStk` happyRest}}}} happyReduce_381 = happyReduce 5# 113# happyReduction_381 happyReduction_381 (happy_x_5 `HappyStk` happy_x_4 `HappyStk` happy_x_3 `HappyStk` happy_x_2 `HappyStk` happy_x_1 `HappyStk` happyRest) = case happyOutTok happy_x_1 of { (TokSymbol SymOpenPragma happy_var_1) -> case happyOutTok happy_x_2 of { (TokKeyword KwBUILTIN happy_var_2) -> case happyOutTok happy_x_3 of { (TokString happy_var_3) -> case happyOut32 happy_x_4 of { happy_var_4 -> case happyOutTok happy_x_5 of { (TokSymbol SymClosePragma happy_var_5) -> happyIn120 (BuiltinPragma (getRange (happy_var_1,happy_var_2,fst happy_var_3,happy_var_4,happy_var_5)) (snd happy_var_3) (Ident happy_var_4) ) `HappyStk` happyRest}}}}} happyReduce_382 = happyReduce 5# 113# happyReduction_382 happyReduction_382 (happy_x_5 `HappyStk` happy_x_4 `HappyStk` happy_x_3 `HappyStk` happy_x_2 `HappyStk` happy_x_1 `HappyStk` happyRest) = case happyOutTok happy_x_1 of { (TokSymbol SymOpenPragma happy_var_1) -> case happyOutTok happy_x_2 of { (TokKeyword KwBUILTIN happy_var_2) -> case happyOutTok happy_x_3 of { (TokKeyword KwREWRITE happy_var_3) -> case happyOut32 happy_x_4 of { happy_var_4 -> case happyOutTok happy_x_5 of { (TokSymbol SymClosePragma happy_var_5) -> happyIn120 (BuiltinPragma (getRange (happy_var_1,happy_var_2,happy_var_3,happy_var_4,happy_var_5)) "REWRITE" (Ident happy_var_4) ) `HappyStk` happyRest}}}}} happyReduce_383 = happyReduce 4# 114# happyReduction_383 happyReduction_383 (happy_x_4 `HappyStk` happy_x_3 `HappyStk` happy_x_2 `HappyStk` happy_x_1 `HappyStk` happyRest) = case happyOutTok happy_x_1 of { (TokSymbol SymOpenPragma happy_var_1) -> case happyOutTok happy_x_2 of { (TokKeyword KwREWRITE happy_var_2) -> case happyOut32 happy_x_3 of { happy_var_3 -> case happyOutTok happy_x_4 of { (TokSymbol SymClosePragma happy_var_4) -> happyIn121 (RewritePragma (getRange (happy_var_1,happy_var_2,happy_var_3,happy_var_4)) happy_var_3 ) `HappyStk` happyRest}}}} happyReduce_384 = happyReduce 5# 115# happyReduction_384 happyReduction_384 (happy_x_5 `HappyStk` happy_x_4 `HappyStk` happy_x_3 `HappyStk` happy_x_2 `HappyStk` happy_x_1 `HappyStk` happyRest) = case happyOutTok happy_x_1 of { (TokSymbol SymOpenPragma happy_var_1) -> case happyOutTok happy_x_2 of { (TokKeyword KwCOMPILED happy_var_2) -> case happyOut32 happy_x_3 of { happy_var_3 -> case happyOut29 happy_x_4 of { happy_var_4 -> case happyOutTok happy_x_5 of { (TokSymbol SymClosePragma happy_var_5) -> happyIn122 (CompiledPragma (getRange (happy_var_1,happy_var_2,happy_var_3,happy_var_5)) happy_var_3 (unwords happy_var_4) ) `HappyStk` happyRest}}}}} happyReduce_385 = happyReduce 5# 116# happyReduction_385 happyReduction_385 (happy_x_5 `HappyStk` happy_x_4 `HappyStk` happy_x_3 `HappyStk` happy_x_2 `HappyStk` happy_x_1 `HappyStk` happyRest) = case happyOutTok happy_x_1 of { (TokSymbol SymOpenPragma happy_var_1) -> case happyOutTok happy_x_2 of { (TokKeyword KwCOMPILED_EXPORT happy_var_2) -> case happyOut32 happy_x_3 of { happy_var_3 -> case happyOut30 happy_x_4 of { happy_var_4 -> case happyOutTok happy_x_5 of { (TokSymbol SymClosePragma happy_var_5) -> happyIn123 (CompiledExportPragma (getRange (happy_var_1,happy_var_2,happy_var_3,happy_var_5)) happy_var_3 happy_var_4 ) `HappyStk` happyRest}}}}} happyReduce_386 = happyReduce 5# 117# happyReduction_386 happyReduction_386 (happy_x_5 `HappyStk` happy_x_4 `HappyStk` happy_x_3 `HappyStk` happy_x_2 `HappyStk` happy_x_1 `HappyStk` happyRest) = case happyOutTok happy_x_1 of { (TokSymbol SymOpenPragma happy_var_1) -> case happyOutTok happy_x_2 of { (TokKeyword KwCOMPILED_TYPE happy_var_2) -> case happyOut32 happy_x_3 of { happy_var_3 -> case happyOut29 happy_x_4 of { happy_var_4 -> case happyOutTok happy_x_5 of { (TokSymbol SymClosePragma happy_var_5) -> happyIn124 (CompiledTypePragma (getRange (happy_var_1,happy_var_2,happy_var_3,happy_var_5)) happy_var_3 (unwords happy_var_4) ) `HappyStk` happyRest}}}}} happyReduce_387 = happyReduce 6# 118# happyReduction_387 happyReduction_387 (happy_x_6 `HappyStk` happy_x_5 `HappyStk` happy_x_4 `HappyStk` happy_x_3 `HappyStk` happy_x_2 `HappyStk` happy_x_1 `HappyStk` happyRest) = case happyOutTok happy_x_1 of { (TokSymbol SymOpenPragma happy_var_1) -> case happyOutTok happy_x_2 of { (TokKeyword KwCOMPILED_DATA happy_var_2) -> case happyOut32 happy_x_3 of { happy_var_3 -> case happyOutTok happy_x_4 of { (TokString happy_var_4) -> case happyOut29 happy_x_5 of { happy_var_5 -> case happyOutTok happy_x_6 of { (TokSymbol SymClosePragma happy_var_6) -> happyIn125 (CompiledDataPragma (getRange (happy_var_1,happy_var_2,happy_var_3,fst happy_var_4,happy_var_6)) happy_var_3 (snd happy_var_4) happy_var_5 ) `HappyStk` happyRest}}}}}} happyReduce_388 = happyReduce 5# 119# happyReduction_388 happyReduction_388 (happy_x_5 `HappyStk` happy_x_4 `HappyStk` happy_x_3 `HappyStk` happy_x_2 `HappyStk` happy_x_1 `HappyStk` happyRest) = case happyOutTok happy_x_1 of { (TokSymbol SymOpenPragma happy_var_1) -> case happyOutTok happy_x_2 of { (TokKeyword KwCOMPILED_EPIC happy_var_2) -> case happyOut32 happy_x_3 of { happy_var_3 -> case happyOut29 happy_x_4 of { happy_var_4 -> case happyOutTok happy_x_5 of { (TokSymbol SymClosePragma happy_var_5) -> happyIn126 (CompiledEpicPragma (getRange (happy_var_1,happy_var_2,happy_var_3,happy_var_5)) happy_var_3 (unwords happy_var_4) ) `HappyStk` happyRest}}}}} happyReduce_389 = happyReduce 5# 120# happyReduction_389 happyReduction_389 (happy_x_5 `HappyStk` happy_x_4 `HappyStk` happy_x_3 `HappyStk` happy_x_2 `HappyStk` happy_x_1 `HappyStk` happyRest) = case happyOutTok happy_x_1 of { (TokSymbol SymOpenPragma happy_var_1) -> case happyOutTok happy_x_2 of { (TokKeyword KwCOMPILED_JS happy_var_2) -> case happyOut32 happy_x_3 of { happy_var_3 -> case happyOut29 happy_x_4 of { happy_var_4 -> case happyOutTok happy_x_5 of { (TokSymbol SymClosePragma happy_var_5) -> happyIn127 (CompiledJSPragma (getRange (happy_var_1,happy_var_2,happy_var_3,happy_var_5)) happy_var_3 (unwords happy_var_4) ) `HappyStk` happyRest}}}}} happyReduce_390 = happyReduce 4# 121# happyReduction_390 happyReduction_390 (happy_x_4 `HappyStk` happy_x_3 `HappyStk` happy_x_2 `HappyStk` happy_x_1 `HappyStk` happyRest) = case happyOutTok happy_x_1 of { (TokSymbol SymOpenPragma happy_var_1) -> case happyOutTok happy_x_2 of { (TokKeyword KwSTATIC happy_var_2) -> case happyOut32 happy_x_3 of { happy_var_3 -> case happyOutTok happy_x_4 of { (TokSymbol SymClosePragma happy_var_4) -> happyIn128 (StaticPragma (getRange (happy_var_1,happy_var_2,happy_var_3,happy_var_4)) happy_var_3 ) `HappyStk` happyRest}}}} happyReduce_391 = happyReduce 4# 122# happyReduction_391 happyReduction_391 (happy_x_4 `HappyStk` happy_x_3 `HappyStk` happy_x_2 `HappyStk` happy_x_1 `HappyStk` happyRest) = case happyOutTok happy_x_1 of { (TokSymbol SymOpenPragma happy_var_1) -> case happyOutTok happy_x_2 of { (TokKeyword KwETA happy_var_2) -> case happyOut32 happy_x_3 of { happy_var_3 -> case happyOutTok happy_x_4 of { (TokSymbol SymClosePragma happy_var_4) -> happyIn129 (EtaPragma (getRange (happy_var_1,happy_var_2,happy_var_3,happy_var_4)) happy_var_3 ) `HappyStk` happyRest}}}} happyReduce_392 = happySpecReduce_3 123# happyReduction_392 happyReduction_392 happy_x_3 happy_x_2 happy_x_1 = case happyOutTok happy_x_1 of { (TokSymbol SymOpenPragma happy_var_1) -> case happyOutTok happy_x_2 of { (TokKeyword KwNO_TERMINATION_CHECK happy_var_2) -> case happyOutTok happy_x_3 of { (TokSymbol SymClosePragma happy_var_3) -> happyIn130 (TerminationCheckPragma (getRange (happy_var_1,happy_var_2,happy_var_3)) NoTerminationCheck )}}} happyReduce_393 = happySpecReduce_3 124# happyReduction_393 happyReduction_393 happy_x_3 happy_x_2 happy_x_1 = case happyOutTok happy_x_1 of { (TokSymbol SymOpenPragma happy_var_1) -> case happyOutTok happy_x_2 of { (TokKeyword KwNON_TERMINATING happy_var_2) -> case happyOutTok happy_x_3 of { (TokSymbol SymClosePragma happy_var_3) -> happyIn131 (TerminationCheckPragma (getRange (happy_var_1,happy_var_2,happy_var_3)) NonTerminating )}}} happyReduce_394 = happySpecReduce_3 125# happyReduction_394 happyReduction_394 happy_x_3 happy_x_2 happy_x_1 = case happyOutTok happy_x_1 of { (TokSymbol SymOpenPragma happy_var_1) -> case happyOutTok happy_x_2 of { (TokKeyword KwTERMINATING happy_var_2) -> case happyOutTok happy_x_3 of { (TokSymbol SymClosePragma happy_var_3) -> happyIn132 (TerminationCheckPragma (getRange (happy_var_1,happy_var_2,happy_var_3)) Terminating )}}} happyReduce_395 = happyReduce 4# 126# happyReduction_395 happyReduction_395 (happy_x_4 `HappyStk` happy_x_3 `HappyStk` happy_x_2 `HappyStk` happy_x_1 `HappyStk` happyRest) = case happyOutTok happy_x_1 of { (TokSymbol SymOpenPragma happy_var_1) -> case happyOutTok happy_x_2 of { (TokKeyword KwMEASURE happy_var_2) -> case happyOut31 happy_x_3 of { happy_var_3 -> case happyOutTok happy_x_4 of { (TokSymbol SymClosePragma happy_var_4) -> happyIn133 (let r = getRange (happy_var_1, happy_var_2, happy_var_3, happy_var_4) in TerminationCheckPragma r (TerminationMeasure r happy_var_3) ) `HappyStk` happyRest}}}} happyReduce_396 = happyMonadReduce 4# 127# happyReduction_396 happyReduction_396 (happy_x_4 `HappyStk` happy_x_3 `HappyStk` happy_x_2 `HappyStk` happy_x_1 `HappyStk` happyRest) tk = happyThen (case happyOutTok happy_x_1 of { (TokSymbol SymOpenPragma happy_var_1) -> case happyOutTok happy_x_2 of { (TokKeyword KwIMPORT happy_var_2) -> case happyOutTok happy_x_3 of { (TokString happy_var_3) -> case happyOutTok happy_x_4 of { (TokSymbol SymClosePragma happy_var_4) -> ( let s = snd happy_var_3 in if validHaskellModuleName s then return $ ImportPragma (getRange (happy_var_1,happy_var_2,fst happy_var_3,happy_var_4)) s else parseError $ "Malformed module name: " ++ s ++ ".")}}}} ) (\r -> happyReturn (happyIn134 r)) happyReduce_397 = happySpecReduce_3 128# happyReduction_397 happyReduction_397 happy_x_3 happy_x_2 happy_x_1 = case happyOutTok happy_x_1 of { (TokSymbol SymOpenPragma happy_var_1) -> case happyOutTok happy_x_2 of { (TokKeyword KwIMPOSSIBLE happy_var_2) -> case happyOutTok happy_x_3 of { (TokSymbol SymClosePragma happy_var_3) -> happyIn135 (ImpossiblePragma (getRange (happy_var_1,happy_var_2,happy_var_3)) )}}} happyReduce_398 = happySpecReduce_3 129# happyReduction_398 happyReduction_398 happy_x_3 happy_x_2 happy_x_1 = case happyOut137 happy_x_2 of { happy_var_2 -> happyIn136 (reverse happy_var_2 )} happyReduce_399 = happySpecReduce_3 130# happyReduction_399 happyReduction_399 happy_x_3 happy_x_2 happy_x_1 = case happyOut137 happy_x_1 of { happy_var_1 -> case happyOut82 happy_x_3 of { happy_var_3 -> happyIn137 (reverse happy_var_3 ++ happy_var_1 )}} happyReduce_400 = happySpecReduce_1 130# happyReduction_400 happyReduction_400 happy_x_1 = case happyOut82 happy_x_1 of { happy_var_1 -> happyIn137 (reverse happy_var_1 )} happyReduce_401 = happySpecReduce_3 131# happyReduction_401 happyReduction_401 happy_x_3 happy_x_2 happy_x_1 = case happyOut139 happy_x_2 of { happy_var_2 -> happyIn138 (reverse happy_var_2 )} happyReduce_402 = happySpecReduce_3 132# happyReduction_402 happyReduction_402 happy_x_3 happy_x_2 happy_x_1 = case happyOut139 happy_x_1 of { happy_var_1 -> case happyOut83 happy_x_3 of { happy_var_3 -> happyIn139 (reverse happy_var_3 ++ happy_var_1 )}} happyReduce_403 = happySpecReduce_1 132# happyReduction_403 happyReduction_403 happy_x_1 = case happyOut83 happy_x_1 of { happy_var_1 -> happyIn139 (reverse happy_var_1 )} happyReduce_404 = happySpecReduce_2 133# happyReduction_404 happyReduction_404 happy_x_2 happy_x_1 = happyIn140 ([] ) happyReduce_405 = happySpecReduce_1 133# happyReduction_405 happyReduction_405 happy_x_1 = case happyOut136 happy_x_1 of { happy_var_1 -> happyIn140 (happy_var_1 )} happyReduce_406 = happySpecReduce_2 134# happyReduction_406 happyReduction_406 happy_x_2 happy_x_1 = happyIn141 ((Nothing, Nothing, []) ) happyReduce_407 = happySpecReduce_3 134# happyReduction_407 happyReduction_407 happy_x_3 happy_x_2 happy_x_1 = case happyOut90 happy_x_2 of { happy_var_2 -> happyIn141 ((Nothing, Just happy_var_2, []) )} happyReduce_408 = happyReduce 5# 134# happyReduction_408 happyReduction_408 (happy_x_5 `HappyStk` happy_x_4 `HappyStk` happy_x_3 `HappyStk` happy_x_2 `HappyStk` happy_x_1 `HappyStk` happyRest) = case happyOut90 happy_x_2 of { happy_var_2 -> case happyOut145 happy_x_4 of { happy_var_4 -> happyIn141 ((Nothing, Just happy_var_2, happy_var_4) ) `HappyStk` happyRest}} happyReduce_409 = happySpecReduce_3 134# happyReduction_409 happyReduction_409 happy_x_3 happy_x_2 happy_x_1 = case happyOut145 happy_x_2 of { happy_var_2 -> happyIn141 ((Nothing, Nothing, happy_var_2) )} happyReduce_410 = happySpecReduce_3 134# happyReduction_410 happyReduction_410 happy_x_3 happy_x_2 happy_x_1 = case happyOut142 happy_x_2 of { happy_var_2 -> happyIn141 ((Just happy_var_2, Nothing, []) )} happyReduce_411 = happyReduce 5# 134# happyReduction_411 happyReduction_411 (happy_x_5 `HappyStk` happy_x_4 `HappyStk` happy_x_3 `HappyStk` happy_x_2 `HappyStk` happy_x_1 `HappyStk` happyRest) = case happyOut142 happy_x_2 of { happy_var_2 -> case happyOut90 happy_x_4 of { happy_var_4 -> happyIn141 ((Just happy_var_2, Just happy_var_4, []) ) `HappyStk` happyRest}} happyReduce_412 = happyReduce 7# 134# happyReduction_412 happyReduction_412 (happy_x_7 `HappyStk` happy_x_6 `HappyStk` happy_x_5 `HappyStk` happy_x_4 `HappyStk` happy_x_3 `HappyStk` happy_x_2 `HappyStk` happy_x_1 `HappyStk` happyRest) = case happyOut142 happy_x_2 of { happy_var_2 -> case happyOut90 happy_x_4 of { happy_var_4 -> case happyOut145 happy_x_6 of { happy_var_6 -> happyIn141 ((Just happy_var_2, Just happy_var_4, happy_var_6) ) `HappyStk` happyRest}}} happyReduce_413 = happyReduce 5# 134# happyReduction_413 happyReduction_413 (happy_x_5 `HappyStk` happy_x_4 `HappyStk` happy_x_3 `HappyStk` happy_x_2 `HappyStk` happy_x_1 `HappyStk` happyRest) = case happyOut142 happy_x_2 of { happy_var_2 -> case happyOut145 happy_x_4 of { happy_var_4 -> happyIn141 ((Just happy_var_2, Nothing, happy_var_4) ) `HappyStk` happyRest}} happyReduce_414 = happySpecReduce_1 135# happyReduction_414 happyReduction_414 happy_x_1 = case happyOutTok happy_x_1 of { (TokKeyword KwInductive happy_var_1) -> happyIn142 (Ranged (getRange happy_var_1) Inductive )} happyReduce_415 = happySpecReduce_1 135# happyReduction_415 happyReduction_415 happy_x_1 = case happyOutTok happy_x_1 of { (TokKeyword KwCoInductive happy_var_1) -> happyIn142 (Ranged (getRange happy_var_1) CoInductive )} happyReduce_416 = happySpecReduce_3 136# happyReduction_416 happyReduction_416 happy_x_3 happy_x_2 happy_x_1 = case happyOut145 happy_x_2 of { happy_var_2 -> happyIn143 (happy_var_2 )} happyReduce_417 = happySpecReduce_2 137# happyReduction_417 happyReduction_417 happy_x_2 happy_x_1 = happyIn144 ([] ) happyReduce_418 = happySpecReduce_1 137# happyReduction_418 happyReduction_418 happy_x_1 = case happyOut143 happy_x_1 of { happy_var_1 -> happyIn144 (happy_var_1 )} happyReduce_419 = happySpecReduce_3 138# happyReduction_419 happyReduction_419 happy_x_3 happy_x_2 happy_x_1 = case happyOut81 happy_x_1 of { happy_var_1 -> case happyOut145 happy_x_3 of { happy_var_3 -> happyIn145 (happy_var_1 ++ happy_var_3 )}} happyReduce_420 = happySpecReduce_1 138# happyReduction_420 happyReduction_420 happy_x_1 = case happyOut81 happy_x_1 of { happy_var_1 -> happyIn145 (happy_var_1 )} happyReduce_421 = happySpecReduce_0 139# happyReduction_421 happyReduction_421 = happyIn146 ([] ) happyReduce_422 = happySpecReduce_1 139# happyReduction_422 happyReduction_422 happy_x_1 = case happyOut145 happy_x_1 of { happy_var_1 -> happyIn146 (happy_var_1 )} happyNewToken action sts stk = lexer(\tk -> let cont i = happyDoAction i tk action sts stk in case tk of { TokEOF -> happyDoAction 89# tk action sts stk; TokKeyword KwAbstract happy_dollar_dollar -> cont 1#; TokKeyword KwCoData happy_dollar_dollar -> cont 2#; TokKeyword KwCoInductive happy_dollar_dollar -> cont 3#; TokKeyword KwConstructor happy_dollar_dollar -> cont 4#; TokKeyword KwData happy_dollar_dollar -> cont 5#; TokKeyword KwField happy_dollar_dollar -> cont 6#; TokKeyword KwForall happy_dollar_dollar -> cont 7#; TokKeyword KwHiding happy_dollar_dollar -> cont 8#; TokKeyword KwImport happy_dollar_dollar -> cont 9#; TokKeyword KwIn happy_dollar_dollar -> cont 10#; TokKeyword KwInductive happy_dollar_dollar -> cont 11#; TokKeyword KwInfix happy_dollar_dollar -> cont 12#; TokKeyword KwInfixL happy_dollar_dollar -> cont 13#; TokKeyword KwInfixR happy_dollar_dollar -> cont 14#; TokKeyword KwInstance happy_dollar_dollar -> cont 15#; TokKeyword KwLet happy_dollar_dollar -> cont 16#; TokKeyword KwModule happy_dollar_dollar -> cont 17#; TokKeyword KwMutual happy_dollar_dollar -> cont 18#; TokKeyword KwOpen happy_dollar_dollar -> cont 19#; TokKeyword KwPatternSyn happy_dollar_dollar -> cont 20#; TokKeyword KwPostulate happy_dollar_dollar -> cont 21#; TokKeyword KwPrimitive happy_dollar_dollar -> cont 22#; TokKeyword KwPrivate happy_dollar_dollar -> cont 23#; TokKeyword KwProp happy_dollar_dollar -> cont 24#; TokKeyword KwPublic happy_dollar_dollar -> cont 25#; TokKeyword KwQuote happy_dollar_dollar -> cont 26#; TokKeyword KwQuoteContext happy_dollar_dollar -> cont 27#; TokKeyword KwQuoteGoal happy_dollar_dollar -> cont 28#; TokKeyword KwQuoteTerm happy_dollar_dollar -> cont 29#; TokKeyword KwRecord happy_dollar_dollar -> cont 30#; TokKeyword KwRenaming happy_dollar_dollar -> cont 31#; TokKeyword KwRewrite happy_dollar_dollar -> cont 32#; TokKeyword KwSet happy_dollar_dollar -> cont 33#; TokKeyword KwSyntax happy_dollar_dollar -> cont 34#; TokKeyword KwTactic happy_dollar_dollar -> cont 35#; TokKeyword KwTo happy_dollar_dollar -> cont 36#; TokKeyword KwUnquote happy_dollar_dollar -> cont 37#; TokKeyword KwUnquoteDecl happy_dollar_dollar -> cont 38#; TokKeyword KwUsing happy_dollar_dollar -> cont 39#; TokKeyword KwWhere happy_dollar_dollar -> cont 40#; TokKeyword KwWith happy_dollar_dollar -> cont 41#; TokKeyword KwBUILTIN happy_dollar_dollar -> cont 42#; TokKeyword KwCOMPILED happy_dollar_dollar -> cont 43#; TokKeyword KwCOMPILED_DATA happy_dollar_dollar -> cont 44#; TokKeyword KwCOMPILED_EPIC happy_dollar_dollar -> cont 45#; TokKeyword KwCOMPILED_EXPORT happy_dollar_dollar -> cont 46#; TokKeyword KwCOMPILED_JS happy_dollar_dollar -> cont 47#; TokKeyword KwCOMPILED_TYPE happy_dollar_dollar -> cont 48#; TokKeyword KwETA happy_dollar_dollar -> cont 49#; TokKeyword KwIMPORT happy_dollar_dollar -> cont 50#; TokKeyword KwIMPOSSIBLE happy_dollar_dollar -> cont 51#; TokKeyword KwMEASURE happy_dollar_dollar -> cont 52#; TokKeyword KwNO_TERMINATION_CHECK happy_dollar_dollar -> cont 53#; TokKeyword KwNON_TERMINATING happy_dollar_dollar -> cont 54#; TokKeyword KwOPTIONS happy_dollar_dollar -> cont 55#; TokKeyword KwREWRITE happy_dollar_dollar -> cont 56#; TokKeyword KwSTATIC happy_dollar_dollar -> cont 57#; TokKeyword KwTERMINATING happy_dollar_dollar -> cont 58#; TokSetN happy_dollar_dollar -> cont 59#; TokTeX happy_dollar_dollar -> cont 60#; TokComment happy_dollar_dollar -> cont 61#; TokSymbol SymEllipsis happy_dollar_dollar -> cont 62#; TokSymbol SymDotDot happy_dollar_dollar -> cont 63#; TokSymbol SymDot happy_dollar_dollar -> cont 64#; TokSymbol SymSemi happy_dollar_dollar -> cont 65#; TokSymbol SymColon happy_dollar_dollar -> cont 66#; TokSymbol SymEqual happy_dollar_dollar -> cont 67#; TokSymbol SymUnderscore happy_dollar_dollar -> cont 68#; TokSymbol SymQuestionMark happy_dollar_dollar -> cont 69#; TokSymbol SymArrow happy_dollar_dollar -> cont 70#; TokSymbol SymLambda happy_dollar_dollar -> cont 71#; TokSymbol SymAs happy_dollar_dollar -> cont 72#; TokSymbol SymBar happy_dollar_dollar -> cont 73#; TokSymbol SymOpenParen happy_dollar_dollar -> cont 74#; TokSymbol SymCloseParen happy_dollar_dollar -> cont 75#; TokSymbol SymDoubleOpenBrace happy_dollar_dollar -> cont 76#; TokSymbol SymDoubleCloseBrace happy_dollar_dollar -> cont 77#; TokSymbol SymOpenBrace happy_dollar_dollar -> cont 78#; TokSymbol SymCloseBrace happy_dollar_dollar -> cont 79#; TokSymbol SymOpenVirtualBrace happy_dollar_dollar -> cont 80#; TokSymbol SymCloseVirtualBrace happy_dollar_dollar -> cont 81#; TokSymbol SymVirtualSemi happy_dollar_dollar -> cont 82#; TokSymbol SymOpenPragma happy_dollar_dollar -> cont 83#; TokSymbol SymClosePragma happy_dollar_dollar -> cont 84#; TokId happy_dollar_dollar -> cont 85#; TokQId happy_dollar_dollar -> cont 86#; TokString happy_dollar_dollar -> cont 87#; TokLiteral happy_dollar_dollar -> cont 88#; _ -> happyError' tk }) happyError_ 89# tk = happyError' tk happyError_ _ tk = happyError' tk happyThen :: () => Parser a -> (a -> Parser b) -> Parser b happyThen = (>>=) happyReturn :: () => a -> Parser a happyReturn = (return) happyThen1 = happyThen happyReturn1 :: () => a -> Parser a happyReturn1 = happyReturn happyError' :: () => (Token) -> Parser a happyError' tk = (\token -> happyError) tk tokensParser = happySomeParser where happySomeParser = happyThen (happyParse 0#) (\x -> happyReturn (happyOut7 x)) exprParser = happySomeParser where happySomeParser = happyThen (happyParse 1#) (\x -> happyReturn (happyOut33 x)) moduleParser = happySomeParser where happySomeParser = happyThen (happyParse 2#) (\x -> happyReturn (happyOut10 x)) moduleNameParser = happySomeParser where happySomeParser = happyThen (happyParse 3#) (\x -> happyReturn (happyOut23 x)) happySeq = happyDontSeq {-------------------------------------------------------------------------- Parsers --------------------------------------------------------------------------} -- | Parse the token stream. Used by the TeX compiler. tokensParser :: Parser [Token] -- | Parse an expression. Could be used in interactions. exprParser :: Parser Expr -- | Parse a module. moduleParser :: Parser Module {-------------------------------------------------------------------------- Happy stuff --------------------------------------------------------------------------} -- | Required by Happy. happyError :: Parser a happyError = parseError "Parse error" {-------------------------------------------------------------------------- Utility functions --------------------------------------------------------------------------} -- | Grab leading OPTIONS pragmas. takeOptionsPragmas :: [Declaration] -> ([Pragma], [Declaration]) takeOptionsPragmas = spanJust $ \ d -> case d of Pragma p@OptionsPragma{} -> Just p _ -> Nothing -- | Insert a top-level module if there is none. figureOutTopLevelModule :: [Declaration] -> [Declaration] figureOutTopLevelModule ds = case span isAllowedBeforeModule ds of (ds0, Module r m tel ds1 : ds2) -> ds0 ++ [Module r m tel $ ds1 ++ ds2] (ds0, ds1) -> ds0 ++ [Module (getRange ds1) (QName noName_) [] ds1] where isAllowedBeforeModule (Pragma OptionsPragma{}) = True isAllowedBeforeModule (Private _ ds) = all isAllowedBeforeModule ds isAllowedBeforeModule Import{} = True isAllowedBeforeModule ModuleMacro{} = True isAllowedBeforeModule Open{} = True isAllowedBeforeModule _ = False -- | Create a name from a string. mkName :: (Interval, String) -> Parser Name mkName (i, s) = do let xs = C.stringNameParts s mapM_ isValidId xs unless (alternating xs) $ fail $ "a name cannot contain two consecutive underscores" return $ Name (getRange i) xs where isValidId Hole = return () isValidId (Id y) = do let x = rawNameToString y case parse defaultParseFlags [0] (lexer return) x of ParseOk _ (TokId _) -> return () _ -> fail $ "in the name " ++ s ++ ", the part " ++ x ++ " is not valid" -- we know that there are no two Ids in a row alternating (Hole : Hole : _) = False alternating (_ : xs) = alternating xs alternating [] = True -- | Create a qualified name from a list of strings mkQName :: [(Interval, String)] -> Parser QName mkQName ss = do xs <- mapM mkName ss return $ foldr Qual (QName $ last xs) (init xs) ensureUnqual :: QName -> Parser Name ensureUnqual (QName x) = return x ensureUnqual q@Qual{} = parseError' (rStart $ getRange q) "Qualified name not allowed here" -- | Match a particular name. isName :: String -> (Interval, String) -> Parser () isName s (_,s') | s == s' = return () | otherwise = fail $ "expected " ++ s ++ ", found " ++ s' -- | Build a forall pi (forall x y z -> ...) forallPi :: [LamBinding] -> Expr -> Expr forallPi bs e = Pi (map addType bs) e -- | Build a telescoping let (let Ds) tLet :: Range -> [Declaration] -> TypedBindings tLet r = TypedBindings r . Common.Arg defaultArgInfo . TLet r -- | Converts lambda bindings to typed bindings. addType :: LamBinding -> TypedBindings addType (DomainFull b) = b addType (DomainFree info x) = TypedBindings r $ Common.Arg info $ TBind r [pure x] $ Underscore r Nothing where r = getRange x mergeImportDirectives :: [ImportDirective] -> Parser ImportDirective mergeImportDirectives is = do i <- foldl merge (return defaultImportDir) is verifyImportDirective i where merge mi i2 = do i1 <- mi let err = parseError' (rStart $ getRange i2) "Cannot mix using and hiding module directives" uh <- case (usingOrHiding i1, usingOrHiding i2) of (Hiding [], u) -> return u (u, Hiding []) -> return u (Using{}, Hiding{}) -> err (Hiding{}, Using{}) -> err (Using xs, Using ys) -> return $ Using (xs ++ ys) (Hiding xs, Hiding ys) -> return $ Hiding (xs ++ ys) return $ ImportDirective { importDirRange = fuseRange i1 i2 , usingOrHiding = uh , renaming = renaming i1 ++ renaming i2 , publicOpen = publicOpen i1 || publicOpen i2 } -- | Check that an import directive doesn't contain repeated names verifyImportDirective :: ImportDirective -> Parser ImportDirective verifyImportDirective i = case filter ((>1) . length) $ group $ sort xs of [] -> return i yss -> let Just pos = rStart $ getRange $ head $ concat yss in parseErrorAt pos $ "Repeated name" ++ s ++ " in import directive: " ++ concat (intersperse ", " $ map (show . head) yss) where s = case yss of [_] -> "" _ -> "s" where xs = names (usingOrHiding i) ++ map renFrom (renaming i) names (Using xs) = xs names (Hiding xs) = xs -- | Breaks up a string into substrings. Returns every maximal -- subsequence of zero or more characters distinct from @'.'@. -- -- > splitOnDots "" == [""] -- > splitOnDots "foo.bar" == ["foo", "bar"] -- > splitOnDots ".foo.bar" == ["", "foo", "bar"] -- > splitOnDots "foo.bar." == ["foo", "bar", ""] -- > splitOnDots "foo..bar" == ["foo", "", "bar"] splitOnDots :: String -> [String] splitOnDots "" = [""] splitOnDots ('.' : s) = [] : splitOnDots s splitOnDots (c : s) = case splitOnDots s of p : ps -> (c : p) : ps prop_splitOnDots = and [ splitOnDots "" == [""] , splitOnDots "foo.bar" == ["foo", "bar"] , splitOnDots ".foo.bar" == ["", "foo", "bar"] , splitOnDots "foo.bar." == ["foo", "bar", ""] , splitOnDots "foo..bar" == ["foo", "", "bar"] ] -- | Returns 'True' iff the name is a valid Haskell (hierarchical) -- module name. validHaskellModuleName :: String -> Bool validHaskellModuleName = all ok . splitOnDots where -- Checks if a dot-less module name is well-formed. ok :: String -> Bool ok [] = False ok (c : s) = isUpper c && all (\c -> isLower c || c == '_' || isUpper c || generalCategory c == DecimalNumber || c == '\'') s {-------------------------------------------------------------------------- Patterns --------------------------------------------------------------------------} -- | Turn an expression into a left hand side. exprToLHS :: Expr -> Parser ([Expr] -> [Expr] -> LHS) exprToLHS e = case e of WithApp r e es -> LHS <$> exprToPattern e <*> mapM exprToPattern es _ -> LHS <$> exprToPattern e <*> return [] -- | Turn an expression into a pattern. Fails if the expression is not a -- valid pattern. exprToPattern :: Expr -> Parser Pattern exprToPattern e = case e of Ident x -> return $ IdentP x App _ e1 e2 -> AppP <$> exprToPattern e1 <*> T.mapM (T.mapM exprToPattern) e2 Paren r e -> ParenP r <$> exprToPattern e Underscore r _ -> return $ WildP r Absurd r -> return $ AbsurdP r As r x e -> AsP r x <$> exprToPattern e Dot r (HiddenArg _ e) -> return $ HiddenP r $ fmap (DotP r) e Dot r e -> return $ DotP r e Lit l -> return $ LitP l HiddenArg r e -> HiddenP r <$> T.mapM exprToPattern e InstanceArg r e -> InstanceP r <$> T.mapM exprToPattern e RawApp r es -> RawAppP r <$> mapM exprToPattern es Quote r -> return $ QuoteP r _ -> let Just pos = rStart $ getRange e in parseErrorAt pos $ "Not a valid pattern: " ++ show e opAppExprToPattern :: OpApp Expr -> Parser Pattern opAppExprToPattern (SyntaxBindingLambda _ _ _) = parseError "Syntax binding lambda cannot appear in a pattern" opAppExprToPattern (Ordinary e) = exprToPattern e -- | Turn an expression into a name. Fails if the expression is not a -- valid identifier. exprToName :: Expr -> Parser Name exprToName (Ident (QName x)) = return x exprToName e = let Just pos = rStart $ getRange e in parseErrorAt pos $ "Not a valid identifier: " ++ show e stripSingletonRawApp :: Expr -> Expr stripSingletonRawApp (RawApp _ [e]) = stripSingletonRawApp e stripSingletonRawApp e = e isEqual :: Expr -> Maybe (Expr, Expr) isEqual e = case stripSingletonRawApp e of Equal _ a b -> Just (stripSingletonRawApp a, stripSingletonRawApp b) _ -> Nothing maybeNamed :: Expr -> Named_ Expr maybeNamed e = case isEqual e of Just (Ident (QName x), b) -> named (Ranged (getRange x) (nameToRawName x)) b _ -> unnamed e patternSynArgs :: [Either Hiding LamBinding] -> Parser [Arg Name] patternSynArgs = mapM pSynArg where pSynArg Left{} = parseError "Absurd patterns are not allowed in pattern synonyms" pSynArg (Right DomainFull{}) = parseError "Unexpected type signature in pattern synonym argument" pSynArg (Right (DomainFree a x)) | getHiding a `notElem` [Hidden, NotHidden] = parseError $ show (getHiding a) ++ " arguments not allowed to pattern synonyms" | getRelevance a /= Relevant = parseError "Arguments to pattern synonyms must be relevant" | otherwise = return $ Common.Arg a (boundName x) parsePanic s = parseError $ "Internal parser error: " ++ s ++ ". Please report this as a bug." {- RHS or type signature -} data RHSOrTypeSigs = JustRHS RHS | TypeSigsRHS Expr deriving Show patternToNames :: Pattern -> Parser [(C.ArgInfo, Name)] patternToNames p = case p of IdentP (QName i) -> return [(defaultArgInfo, i)] WildP r -> return [(defaultArgInfo, C.noName r)] DotP _ (Ident (QName i)) -> return [(setRelevance Irrelevant defaultArgInfo, i)] RawAppP _ ps -> concat <$> mapM patternToNames ps _ -> parseError $ "Illegal name in type signature: " ++ prettyShow p funClauseOrTypeSigs :: LHS -> RHSOrTypeSigs -> WhereClause -> Parser [Declaration] funClauseOrTypeSigs lhs mrhs wh = do -- traceShowM lhs case mrhs of JustRHS rhs -> return [FunClause lhs rhs wh] TypeSigsRHS e -> case wh of NoWhere -> case lhs of Ellipsis{} -> parseError "The ellipsis ... cannot have a type signature" LHS _ _ _ (_:_) -> parseError "Illegal: with in type signature" LHS _ _ (_:_) _ -> parseError "Illegal: rewrite in type signature" LHS _ (_:_) _ _ -> parseError "Illegal: with patterns in type signature" LHS p [] [] [] -> map (\ (x, y) -> TypeSig x y e) <$> patternToNames p _ -> parseError "A type signature cannot have a where clause" {-------------------------------------------------------------------------- Tests --------------------------------------------------------------------------} -- | Test suite. tests :: IO Bool tests = runTests "Agda.Syntax.Parser.Parser" [ quickCheck' prop_splitOnDots ] {-# LINE 1 "templates/GenericTemplate.hs" #-} {-# LINE 1 "templates/GenericTemplate.hs" #-} {-# LINE 1 "" #-} {-# LINE 1 "" #-} {-# LINE 11 "" #-} {-# LINE 1 "/usr/local/stow/ghc-7.10.3/lib/ghc-7.10.3/include/ghcversion.h" #-} {-# LINE 11 "" #-} {-# LINE 1 "templates/GenericTemplate.hs" #-} -- Id: GenericTemplate.hs,v 1.26 2005/01/14 14:47:22 simonmar Exp {-# LINE 13 "templates/GenericTemplate.hs" #-} -- Do not remove this comment. Required to fix CPP parsing when using GCC and a clang-compiled alex. #if __GLASGOW_HASKELL__ > 706 #define LT(n,m) ((Happy_GHC_Exts.tagToEnum# (n Happy_GHC_Exts.<# m)) :: Bool) #define GTE(n,m) ((Happy_GHC_Exts.tagToEnum# (n Happy_GHC_Exts.>=# m)) :: Bool) #define EQ(n,m) ((Happy_GHC_Exts.tagToEnum# (n Happy_GHC_Exts.==# m)) :: Bool) #else #define LT(n,m) (n Happy_GHC_Exts.<# m) #define GTE(n,m) (n Happy_GHC_Exts.>=# m) #define EQ(n,m) (n Happy_GHC_Exts.==# m) #endif {-# LINE 46 "templates/GenericTemplate.hs" #-} data Happy_IntList = HappyCons Happy_GHC_Exts.Int# Happy_IntList {-# LINE 67 "templates/GenericTemplate.hs" #-} {-# LINE 77 "templates/GenericTemplate.hs" #-} {-# LINE 86 "templates/GenericTemplate.hs" #-} infixr 9 `HappyStk` data HappyStk a = HappyStk a (HappyStk a) ----------------------------------------------------------------------------- -- starting the parse happyParse start_state = happyNewToken start_state notHappyAtAll notHappyAtAll ----------------------------------------------------------------------------- -- Accepting the parse -- If the current token is 0#, it means we've just accepted a partial -- parse (a %partial parser). We must ignore the saved token on the top of -- the stack in this case. happyAccept 0# tk st sts (_ `HappyStk` ans `HappyStk` _) = happyReturn1 ans happyAccept j tk st sts (HappyStk ans _) = (happyTcHack j (happyTcHack st)) (happyReturn1 ans) ----------------------------------------------------------------------------- -- Arrays only: do the next action happyDoAction i tk st = {- nothing -} case action of 0# -> {- nothing -} happyFail i tk st -1# -> {- nothing -} happyAccept i tk st n | LT(n,(0# :: Happy_GHC_Exts.Int#)) -> {- nothing -} (happyReduceArr Happy_Data_Array.! rule) i tk st where rule = (Happy_GHC_Exts.I# ((Happy_GHC_Exts.negateInt# ((n Happy_GHC_Exts.+# (1# :: Happy_GHC_Exts.Int#)))))) n -> {- nothing -} happyShift new_state i tk st where new_state = (n Happy_GHC_Exts.-# (1# :: Happy_GHC_Exts.Int#)) where off = indexShortOffAddr happyActOffsets st off_i = (off Happy_GHC_Exts.+# i) check = if GTE(off_i,(0# :: Happy_GHC_Exts.Int#)) then EQ(indexShortOffAddr happyCheck off_i, i) else False action | check = indexShortOffAddr happyTable off_i | otherwise = indexShortOffAddr happyDefActions st indexShortOffAddr (HappyA# arr) off = Happy_GHC_Exts.narrow16Int# i where i = Happy_GHC_Exts.word2Int# (Happy_GHC_Exts.or# (Happy_GHC_Exts.uncheckedShiftL# high 8#) low) high = Happy_GHC_Exts.int2Word# (Happy_GHC_Exts.ord# (Happy_GHC_Exts.indexCharOffAddr# arr (off' Happy_GHC_Exts.+# 1#))) low = Happy_GHC_Exts.int2Word# (Happy_GHC_Exts.ord# (Happy_GHC_Exts.indexCharOffAddr# arr off')) off' = off Happy_GHC_Exts.*# 2# data HappyAddr = HappyA# Happy_GHC_Exts.Addr# ----------------------------------------------------------------------------- -- HappyState data type (not arrays) {-# LINE 170 "templates/GenericTemplate.hs" #-} ----------------------------------------------------------------------------- -- Shifting a token happyShift new_state 0# tk st sts stk@(x `HappyStk` _) = let i = (case Happy_GHC_Exts.unsafeCoerce# x of { (Happy_GHC_Exts.I# (i)) -> i }) in -- trace "shifting the error token" $ happyDoAction i tk new_state (HappyCons (st) (sts)) (stk) happyShift new_state i tk st sts stk = happyNewToken new_state (HappyCons (st) (sts)) ((happyInTok (tk))`HappyStk`stk) -- happyReduce is specialised for the common cases. happySpecReduce_0 i fn 0# tk st sts stk = happyFail 0# tk st sts stk happySpecReduce_0 nt fn j tk st@((action)) sts stk = happyGoto nt j tk st (HappyCons (st) (sts)) (fn `HappyStk` stk) happySpecReduce_1 i fn 0# tk st sts stk = happyFail 0# tk st sts stk happySpecReduce_1 nt fn j tk _ sts@((HappyCons (st@(action)) (_))) (v1`HappyStk`stk') = let r = fn v1 in happySeq r (happyGoto nt j tk st sts (r `HappyStk` stk')) happySpecReduce_2 i fn 0# tk st sts stk = happyFail 0# tk st sts stk happySpecReduce_2 nt fn j tk _ (HappyCons (_) (sts@((HappyCons (st@(action)) (_))))) (v1`HappyStk`v2`HappyStk`stk') = let r = fn v1 v2 in happySeq r (happyGoto nt j tk st sts (r `HappyStk` stk')) happySpecReduce_3 i fn 0# tk st sts stk = happyFail 0# tk st sts stk happySpecReduce_3 nt fn j tk _ (HappyCons (_) ((HappyCons (_) (sts@((HappyCons (st@(action)) (_))))))) (v1`HappyStk`v2`HappyStk`v3`HappyStk`stk') = let r = fn v1 v2 v3 in happySeq r (happyGoto nt j tk st sts (r `HappyStk` stk')) happyReduce k i fn 0# tk st sts stk = happyFail 0# tk st sts stk happyReduce k nt fn j tk st sts stk = case happyDrop (k Happy_GHC_Exts.-# (1# :: Happy_GHC_Exts.Int#)) sts of sts1@((HappyCons (st1@(action)) (_))) -> let r = fn stk in -- it doesn't hurt to always seq here... happyDoSeq r (happyGoto nt j tk st1 sts1 r) happyMonadReduce k nt fn 0# tk st sts stk = happyFail 0# tk st sts stk happyMonadReduce k nt fn j tk st sts stk = case happyDrop k (HappyCons (st) (sts)) of sts1@((HappyCons (st1@(action)) (_))) -> let drop_stk = happyDropStk k stk in happyThen1 (fn stk tk) (\r -> happyGoto nt j tk st1 sts1 (r `HappyStk` drop_stk)) happyMonad2Reduce k nt fn 0# tk st sts stk = happyFail 0# tk st sts stk happyMonad2Reduce k nt fn j tk st sts stk = case happyDrop k (HappyCons (st) (sts)) of sts1@((HappyCons (st1@(action)) (_))) -> let drop_stk = happyDropStk k stk off = indexShortOffAddr happyGotoOffsets st1 off_i = (off Happy_GHC_Exts.+# nt) new_state = indexShortOffAddr happyTable off_i in happyThen1 (fn stk tk) (\r -> happyNewToken new_state sts1 (r `HappyStk` drop_stk)) happyDrop 0# l = l happyDrop n (HappyCons (_) (t)) = happyDrop (n Happy_GHC_Exts.-# (1# :: Happy_GHC_Exts.Int#)) t happyDropStk 0# l = l happyDropStk n (x `HappyStk` xs) = happyDropStk (n Happy_GHC_Exts.-# (1#::Happy_GHC_Exts.Int#)) xs ----------------------------------------------------------------------------- -- Moving to a new state after a reduction happyGoto nt j tk st = {- nothing -} happyDoAction j tk new_state where off = indexShortOffAddr happyGotoOffsets st off_i = (off Happy_GHC_Exts.+# nt) new_state = indexShortOffAddr happyTable off_i ----------------------------------------------------------------------------- -- Error recovery (0# is the error token) -- parse error if we are in recovery and we fail again happyFail 0# tk old_st _ stk@(x `HappyStk` _) = let i = (case Happy_GHC_Exts.unsafeCoerce# x of { (Happy_GHC_Exts.I# (i)) -> i }) in -- trace "failing" $ happyError_ i tk {- We don't need state discarding for our restricted implementation of "error". In fact, it can cause some bogus parses, so I've disabled it for now --SDM -- discard a state happyFail 0# tk old_st (HappyCons ((action)) (sts)) (saved_tok `HappyStk` _ `HappyStk` stk) = -- trace ("discarding state, depth " ++ show (length stk)) $ happyDoAction 0# tk action sts ((saved_tok`HappyStk`stk)) -} -- Enter error recovery: generate an error token, -- save the old token and carry on. happyFail i tk (action) sts stk = -- trace "entering error recovery" $ happyDoAction 0# tk action sts ( (Happy_GHC_Exts.unsafeCoerce# (Happy_GHC_Exts.I# (i))) `HappyStk` stk) -- Internal happy errors: notHappyAtAll :: a notHappyAtAll = error "Internal Happy error\n" ----------------------------------------------------------------------------- -- Hack to get the typechecker to accept our action functions happyTcHack :: Happy_GHC_Exts.Int# -> a -> a happyTcHack x y = y {-# INLINE happyTcHack #-} ----------------------------------------------------------------------------- -- Seq-ing. If the --strict flag is given, then Happy emits -- happySeq = happyDoSeq -- otherwise it emits -- happySeq = happyDontSeq happyDoSeq, happyDontSeq :: a -> b -> b happyDoSeq a b = a `seq` b happyDontSeq a b = b ----------------------------------------------------------------------------- -- Don't inline any functions from the template. GHC has a nasty habit -- of deciding to inline happyGoto everywhere, which increases the size of -- the generated parser quite a bit. {-# NOINLINE happyDoAction #-} {-# NOINLINE happyTable #-} {-# NOINLINE happyCheck #-} {-# NOINLINE happyActOffsets #-} {-# NOINLINE happyGotoOffsets #-} {-# NOINLINE happyDefActions #-} {-# NOINLINE happyShift #-} {-# NOINLINE happySpecReduce_0 #-} {-# NOINLINE happySpecReduce_1 #-} {-# NOINLINE happySpecReduce_2 #-} {-# NOINLINE happySpecReduce_3 #-} {-# NOINLINE happyReduce #-} {-# NOINLINE happyMonadReduce #-} {-# NOINLINE happyGoto #-} {-# NOINLINE happyFail #-} -- end of Happy Template. Agda-2.4.2.5/dist/build/Agda/Syntax/Parser/Lexer.hs0000644000000000000000000375364012635075266017775 0ustar0000000000000000{-# OPTIONS_GHC -fno-warn-unused-binds -fno-warn-missing-signatures #-} {-# LANGUAGE CPP,MagicHash #-} {-# LINE 1 "src/full/Agda/Syntax/Parser/Lexer.x" #-} {-# OPTIONS_GHC -fno-warn-deprecated-flags #-} {-# OPTIONS_GHC -fno-warn-missing-signatures #-} {-# OPTIONS_GHC -fno-warn-tabs #-} {-# OPTIONS_GHC -fno-warn-unused-imports #-} {-# LANGUAGE BangPatterns #-} {-| The lexer is generated by Alex () and is an adaptation of GHC's lexer. The main lexing function 'lexer' is called by the "Agda.Syntax.Parser.Parser" to get the next token from the input. -} module Agda.Syntax.Parser.Lexer ( -- * The main function lexer -- * Lex states , normal, literate, code , layout, empty_layout, bol, imp_dir -- * Alex generated functions , AlexReturn(..), alexScanUser ) where -- -- import Data.List import Agda.Syntax.Parser.Alex import Agda.Syntax.Parser.Comments #ifndef __HADDOCK__ import {-# SOURCE #-} Agda.Syntax.Parser.Layout import {-# SOURCE #-} Agda.Syntax.Parser.LexActions #endif import Agda.Syntax.Parser.Monad import Agda.Syntax.Parser.StringLiterals import Agda.Syntax.Parser.Tokens import Agda.Syntax.Literal #if __GLASGOW_HASKELL__ >= 603 #include "ghcconfig.h" #elif defined(__GLASGOW_HASKELL__) #include "config.h" #endif #if __GLASGOW_HASKELL__ >= 503 import Data.Array import Data.Array.Base (unsafeAt) #else import Array #endif #if __GLASGOW_HASKELL__ >= 503 import GHC.Exts #else import GlaExts #endif alex_tab_size :: Int alex_tab_size = 8 alex_base :: AlexAddr alex_base = AlexA# "\xf7\xff\xff\xff\x6c\x00\x00\x00\xe1\x00\x00\x00\x55\x01\x00\x00\xca\x01\x00\x00\x3f\x02\x00\x00\xb5\x02\x00\x00\xab\x03\x00\x00\x88\xff\xff\xff\xd9\xff\xff\xff\x8a\x04\x00\x00\xe8\x04\x00\x00\x46\x05\x00\x00\xb6\x02\x00\x00\xa2\x05\x00\x00\x9d\x03\x00\x00\xfe\x05\x00\x00\xfd\x05\x00\x00\x7d\x06\x00\x00\xa2\xff\xff\xff\xfd\x06\x00\x00\xdc\x07\x00\x00\xdb\x07\x00\x00\x5b\x08\x00\x00\xdb\x08\x00\x00\x5b\x09\x00\x00\x3a\x0a\x00\x00\x96\x0a\x00\x00\xf2\x0a\x00\x00\xf1\x0a\x00\x00\x99\xff\xff\xff\xa6\xff\xff\xff\x8f\xff\xff\xff\x9d\xff\xff\xff\xa8\xff\xff\xff\x00\x00\x00\x00\x62\x0b\x00\x00\x00\x00\x00\x00\xd3\x0b\x00\x00\xa9\xff\xff\xff\x00\x00\x00\x00\x44\x0c\x00\x00\x00\x00\x00\x00\xb5\x0c\x00\x00\x00\x00\x00\x00\xf6\x0c\x00\x00\x00\x00\x00\x00\x37\x0d\x00\x00\x00\x00\x00\x00\x78\x0d\x00\x00\x00\x00\x00\x00\xb9\x0d\x00\x00\x98\x0e\x00\x00\x17\x0f\x00\x00\xd7\x0e\x00\x00\x00\x00\x00\x00\xd7\x0f\x00\x00\x97\x0f\x00\x00\x00\x00\x00\x00\x97\x10\x00\x00\x57\x10\x00\x00\x00\x00\x00\x00\x57\x11\x00\x00\x04\x00\x00\x00\xcd\x11\x00\x00\x2f\x11\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xc3\x12\x00\x00\xb9\x13\x00\x00\xaf\x14\x00\x00\xa5\x15\x00\x00\x9b\x16\x00\x00\x91\x17\x00\x00\x87\x18\x00\x00\x7d\x19\x00\x00\x73\x1a\x00\x00\x69\x1b\x00\x00\x5f\x1c\x00\x00\x55\x1d\x00\x00\x4b\x1e\x00\x00\x41\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x73\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x38\x20\x00\x00\x2f\x21\x00\x00\x26\x22\x00\x00\x1d\x23\x00\x00\x14\x24\x00\x00\x0b\x25\x00\x00\x02\x26\x00\x00\xf9\x26\x00\x00\xf0\x27\x00\x00\xe7\x28\x00\x00\xde\x29\x00\x00\xd5\x2a\x00\x00\xcc\x2b\x00\x00\xc3\x2c\x00\x00\xba\x2d\x00\x00\xb1\x2e\x00\x00\xa8\x2f\x00\x00\x9f\x30\x00\x00\x96\x31\x00\x00\x8d\x32\x00\x00\x84\x33\x00\x00\x7b\x34\x00\x00\x72\x35\x00\x00\x69\x36\x00\x00\x60\x37\x00\x00\x57\x38\x00\x00\x4e\x39\x00\x00\x45\x3a\x00\x00\x3c\x3b\x00\x00\x33\x3c\x00\x00\x2a\x3d\x00\x00\x21\x3e\x00\x00\x18\x3f\x00\x00\x0f\x40\x00\x00\x06\x41\x00\x00\xfd\x41\x00\x00\xf4\x42\x00\x00\xeb\x43\x00\x00\xe2\x44\x00\x00\xd9\x45\x00\x00\xd0\x46\x00\x00\xc7\x47\x00\x00\xbe\x48\x00\x00\xb5\x49\x00\x00\xac\x4a\x00\x00\xa3\x4b\x00\x00\x9a\x4c\x00\x00\x91\x4d\x00\x00\x88\x4e\x00\x00\x7f\x4f\x00\x00\x76\x50\x00\x00\x6d\x51\x00\x00\x64\x52\x00\x00\x5b\x53\x00\x00\x52\x54\x00\x00\x49\x55\x00\x00\x40\x56\x00\x00\x37\x57\x00\x00\x2e\x58\x00\x00\x25\x59\x00\x00\x1c\x5a\x00\x00\x13\x5b\x00\x00\x0a\x5c\x00\x00\x01\x5d\x00\x00\xf8\x5d\x00\x00\xef\x5e\x00\x00\xe6\x5f\x00\x00\xdd\x60\x00\x00\xd4\x61\x00\x00\xcb\x62\x00\x00\xc2\x63\x00\x00\xb9\x64\x00\x00\xb0\x65\x00\x00\xa7\x66\x00\x00\x9e\x67\x00\x00\x95\x68\x00\x00\x8c\x69\x00\x00\x83\x6a\x00\x00\x7a\x6b\x00\x00\x71\x6c\x00\x00\x68\x6d\x00\x00\x5f\x6e\x00\x00\x56\x6f\x00\x00\x4d\x70\x00\x00\x44\x71\x00\x00\x3b\x72\x00\x00\x32\x73\x00\x00\x29\x74\x00\x00\x20\x75\x00\x00\x17\x76\x00\x00\x0e\x77\x00\x00\x05\x78\x00\x00\xfc\x78\x00\x00\xf3\x79\x00\x00\xea\x7a\x00\x00\xe1\x7b\x00\x00\xd8\x7c\x00\x00\xcf\x7d\x00\x00\xc6\x7e\x00\x00\xbd\x7f\x00\x00\xb4\x80\x00\x00\xab\x81\x00\x00\xa2\x82\x00\x00\x99\x83\x00\x00\x90\x84\x00\x00\x87\x85\x00\x00\x7e\x86\x00\x00\x75\x87\x00\x00\x6c\x88\x00\x00\x63\x89\x00\x00\x5a\x8a\x00\x00\x51\x8b\x00\x00\x48\x8c\x00\x00\x3f\x8d\x00\x00\x36\x8e\x00\x00\x2d\x8f\x00\x00\x24\x90\x00\x00\x1b\x91\x00\x00\x12\x92\x00\x00\x09\x93\x00\x00\x00\x94\x00\x00\xf7\x94\x00\x00\xee\x95\x00\x00\xe5\x96\x00\x00\xdc\x97\x00\x00\xd3\x98\x00\x00\xca\x99\x00\x00\xc1\x9a\x00\x00\xb8\x9b\x00\x00\xaf\x9c\x00\x00\xa6\x9d\x00\x00\x9d\x9e\x00\x00\xec\xff\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x93\x9f\x00\x00\x93\xa0\x00\x00\x93\xa1\x00\x00\x89\xa2\x00\x00\x89\xa3\x00\x00\x7f\xa4\x00\x00\x7f\xa5\x00\x00\x7f\xa6\x00\x00\x7f\xa7\x00\x00\x7f\xa8\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xba\x12\x00\x00\xa3\x13\x00\x00\x99\x14\x00\x00\x8f\x15\x00\x00\x7b\x17\x00\x00\x71\x18\x00\x00\x67\x19\x00\x00\x5d\x1a\x00\x00\x53\x1b\x00\x00\x35\x1e\x00\x00\x2f\x20\x00\x00\x26\x21\x00\x00\x1d\x22\x00\x00\x14\x23\x00\x00\x0b\x24\x00\x00\x02\x25\x00\x00\xf9\x25\x00\x00\xe7\x27\x00\x00\xde\x28\x00\x00\xd5\x29\x00\x00\xcc\x2a\x00\x00\xc3\x2b\x00\x00\xba\x2c\x00\x00\xb1\x2d\x00\x00\xa8\x2e\x00\x00\x9f\x2f\x00\x00\x96\x30\x00\x00\x8d\x31\x00\x00\x84\x32\x00\x00\x85\x33\x00\x00\x72\x34\x00\x00\x61\x37\x00\x00\x2b\x3d\x00\x00\xa4\x4b\x00\x00\x41\x56\x00\x00\xf9\x5d\x00\x00\xf0\x5e\x00\x00\xe7\x5f\x00\x00\x60\x6e\x00\x00\x20\x74\x00\x00\x7d\x9f\x00\x00\x73\xa2\x00\x00\x5e\xa9\x00\x00\xba\xa9\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xe2\xff\xff\xff\xe3\xff\xff\xff\x00\x00\x00\x00\x16\xaa\x00\x00\x72\xaa\x00\x00\xe6\x42\x00\x00\xce\xaa\x00\x00\x2a\xab\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x86\xab\x00\x00\x85\x16\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xa2\x02\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xe2\xab\x00\x00\x3e\xac\x00\x00\x9a\xac\x00\x00\xf6\xac\x00\x00\x52\xad\x00\x00\xae\xad\x00\x00\x0a\xae\x00\x00\x66\xae\x00\x00\xc2\xae\x00\x00\x1e\xaf\x00\x00\x7a\xaf\x00\x00\xd6\xaf\x00\x00\x32\xb0\x00\x00\x8e\xb0\x00\x00\xea\xb0\x00\x00\x46\xb1\x00\x00\xa2\xb1\x00\x00\x00\xb2\x00\x00\x5e\xb2\x00\x00\xbc\xb2\x00\x00\x1a\xb3\x00\x00\x76\xb3\x00\x00\xd2\xb3\x00\x00\x2e\xb4\x00\x00\x8a\xb4\x00\x00\xe6\xb4\x00\x00\x42\xb5\x00\x00\x9e\xb5\x00\x00\xfa\xb5\x00\x00\x56\xb6\x00\x00\xb2\xb6\x00\x00\x0e\xb7\x00\x00\x6a\xb7\x00\x00\xc6\xb7\x00\x00\x22\xb8\x00\x00\x7e\xb8\x00\x00\xda\xb8\x00\x00\x36\xb9\x00\x00\x92\xb9\x00\x00\xee\xb9\x00\x00\x4a\xba\x00\x00\xa6\xba\x00\x00\x02\xbb\x00\x00\x5e\xbb\x00\x00\xba\xbb\x00\x00\x16\xbc\x00\x00\x72\xbc\x00\x00\xce\xbc\x00\x00\x2a\xbd\x00\x00\x86\xbd\x00\x00\xe2\xbd\x00\x00\x3e\xbe\x00\x00\x9a\xbe\x00\x00\xf6\xbe\x00\x00\x52\xbf\x00\x00\xae\xbf\x00\x00\x0a\xc0\x00\x00\x66\xc0\x00\x00\xc2\xc0\x00\x00\x1e\xc1\x00\x00\x7a\xc1\x00\x00\xd6\xc1\x00\x00\x32\xc2\x00\x00\x8e\xc2\x00\x00\xea\xc2\x00\x00\x46\xc3\x00\x00\xa2\xc3\x00\x00\xfe\xc3\x00\x00\x5a\xc4\x00\x00\xb6\xc4\x00\x00\x12\xc5\x00\x00\x6e\xc5\x00\x00\xca\xc5\x00\x00\x26\xc6\x00\x00\x82\xc6\x00\x00\xde\xc6\x00\x00\x3a\xc7\x00\x00\x96\xc7\x00\x00\xf2\xc7\x00\x00\x4e\xc8\x00\x00\xaa\xc8\x00\x00\x06\xc9\x00\x00\x62\xc9\x00\x00\xbe\xc9\x00\x00\x1a\xca\x00\x00\x76\xca\x00\x00\xd2\xca\x00\x00\x2e\xcb\x00\x00\x8a\xcb\x00\x00\xe6\xcb\x00\x00\x42\xcc\x00\x00\x9e\xcc\x00\x00\xfa\xcc\x00\x00\x56\xcd\x00\x00\xb2\xcd\x00\x00\x0e\xce\x00\x00\x6a\xce\x00\x00\xc6\xce\x00\x00\x22\xcf\x00\x00\x7e\xcf\x00\x00\xda\xcf\x00\x00\x36\xd0\x00\x00\x92\xd0\x00\x00\xee\xd0\x00\x00\x4a\xd1\x00\x00\xa6\xd1\x00\x00\x02\xd2\x00\x00\x5e\xd2\x00\x00\xba\xd2\x00\x00\x16\xd3\x00\x00\x72\xd3\x00\x00\xce\xd3\x00\x00\x2a\xd4\x00\x00\x86\xd4\x00\x00\xe2\xd4\x00\x00\x3e\xd5\x00\x00\x9a\xd5\x00\x00\xf6\xd5\x00\x00\x52\xd6\x00\x00\xae\xd6\x00\x00\x0a\xd7\x00\x00\x66\xd7\x00\x00\xc2\xd7\x00\x00\x1e\xd8\x00\x00\x7a\xd8\x00\x00\xd6\xd8\x00\x00\x32\xd9\x00\x00\x8e\xd9\x00\x00\xea\xd9\x00\x00\x46\xda\x00\x00\xa2\xda\x00\x00\xfe\xda\x00\x00\x5a\xdb\x00\x00\xb6\xdb\x00\x00\x12\xdc\x00\x00\x6e\xdc\x00\x00\xca\xdc\x00\x00\x26\xdd\x00\x00\x82\xdd\x00\x00\xde\xdd\x00\x00\x3a\xde\x00\x00\x96\xde\x00\x00\xf2\xde\x00\x00\x4e\xdf\x00\x00\xaa\xdf\x00\x00\x06\xe0\x00\x00\x62\xe0\x00\x00\xbe\xe0\x00\x00\x1a\xe1\x00\x00\x76\xe1\x00\x00\xd2\xe1\x00\x00\x2e\xe2\x00\x00\x8a\xe2\x00\x00\xe6\xe2\x00\x00\x42\xe3\x00\x00\x9e\xe3\x00\x00\xfa\xe3\x00\x00\x56\xe4\x00\x00\xb2\xe4\x00\x00\x0e\xe5\x00\x00\x6a\xe5\x00\x00\xc6\xe5\x00\x00\x22\xe6\x00\x00\x7e\xe6\x00\x00\xda\xe6\x00\x00\x36\xe7\x00\x00\x92\xe7\x00\x00\xee\xe7\x00\x00\x4a\xe8\x00\x00\xa6\xe8\x00\x00\x02\xe9\x00\x00\x5e\xe9\x00\x00\xba\xe9\x00\x00\x16\xea\x00\x00\x72\xea\x00\x00\xce\xea\x00\x00\x2a\xeb\x00\x00\x86\xeb\x00\x00\xe2\xeb\x00\x00\x3e\xec\x00\x00\x9a\xec\x00\x00\xf6\xec\x00\x00\x52\xed\x00\x00\xae\xed\x00\x00\x0a\xee\x00\x00\x66\xee\x00\x00\xc2\xee\x00\x00\x1e\xef\x00\x00\x7a\xef\x00\x00\xd6\xef\x00\x00\x32\xf0\x00\x00\x8e\xf0\x00\x00\xea\xf0\x00\x00\x46\xf1\x00\x00\xa2\xf1\x00\x00\xfe\xf1\x00\x00\x5a\xf2\x00\x00\xb6\xf2\x00\x00"# alex_table :: AlexAddr alex_table = AlexA# "\x00\x00\xe9\x00\x54\x00\x54\x00\x54\x00\x53\x00\xdc\x00\x08\x00\x27\x00\x1e\x00\x1f\x00\x22\x00\x20\x00\x13\x00\x43\x00\x56\x00\x19\x01\x1a\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x54\x00\x9b\x01\x2b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x2a\x01\x22\x01\x23\x01\x9b\x01\x9b\x01\x9b\x01\x3d\x01\x1b\x01\x9b\x01\x30\x01\x2f\x01\x2f\x01\x2f\x01\x2f\x01\x2f\x01\x2f\x01\x2f\x01\x2f\x01\x2f\x01\x1d\x01\x1c\x01\x9b\x01\x1e\x01\x9b\x01\x20\x01\x26\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\xba\x01\x9b\x01\x9b\x01\x5b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x25\x01\x9b\x01\x9b\x01\x1f\x01\x9b\x01\x9d\x01\x9b\x01\x89\x01\x6a\x01\x9b\x01\x7d\x01\x9b\x01\x92\x01\xf0\x01\x9b\x01\x9b\x01\x54\x01\x88\x01\x9b\x01\xbd\x01\x94\x01\x81\x01\x8a\x01\x91\x01\x90\x01\x84\x01\x9b\x01\x64\x01\x9b\x01\x9b\x01\x9b\x01\x28\x01\x21\x01\x29\x01\x9b\x01\xea\x00\x54\x00\x54\x00\x54\x00\x00\x00\x00\x00\x00\x00\x00\x00\x54\x00\x54\x00\x54\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x54\x00\x15\x00\x00\x00\x15\x00\x15\x00\x15\x00\x15\x00\x54\x00\x00\x00\x00\x00\x15\x00\x15\x00\x15\x00\x0a\x00\x00\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x00\x00\x15\x00\x15\x00\x15\x00\x15\x00\x00\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x1b\x00\x15\x00\x15\x00\x1a\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x09\x00\x15\x00\x00\x00\x15\x00\xe9\x00\x54\x00\x54\x00\x54\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x54\x00\x9b\x01\x2b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x2a\x01\x22\x01\x23\x01\x9b\x01\x9b\x01\x9b\x01\x3d\x01\x1b\x01\x9b\x01\x30\x01\x2f\x01\x2f\x01\x2f\x01\x2f\x01\x2f\x01\x2f\x01\x2f\x01\x2f\x01\x2f\x01\x1d\x01\x1c\x01\x9b\x01\x1e\x01\x9b\x01\x20\x01\x26\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\xba\x01\x9b\x01\x9b\x01\x5b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x25\x01\x9b\x01\x9b\x01\x1f\x01\x9b\x01\x9d\x01\x9b\x01\x89\x01\x6a\x01\x9b\x01\x7d\x01\x9b\x01\x92\x01\xf0\x01\x9b\x01\x9b\x01\x54\x01\x88\x01\x9b\x01\xbd\x01\x94\x01\x81\x01\x8a\x01\x91\x01\x90\x01\x84\x01\x9b\x01\x64\x01\x9b\x01\x9b\x01\x9b\x01\x28\x01\x21\x01\x29\x01\x9b\x01\x54\x00\x54\x00\x54\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x54\x00\x15\x00\x00\x00\x15\x00\x15\x00\x15\x00\x15\x00\x00\x00\x00\x00\x00\x00\x15\x00\x15\x00\x15\x00\x0a\x00\x00\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x00\x00\x15\x00\x15\x00\x15\x00\x15\x00\x00\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x1c\x00\x15\x00\x15\x00\x1a\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x09\x00\x15\x00\x00\x00\x15\x00\xe9\x00\x54\x00\x54\x00\x54\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x54\x00\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x00\x00\x00\x00\x9b\x01\x9b\x01\x9b\x01\x3c\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x0d\x00\x9b\x01\x9b\x01\x0c\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x52\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x09\x00\x9b\x01\x00\x00\x9b\x01\xeb\x00\x54\x00\x54\x00\x54\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x54\x00\x15\x00\x00\x00\x15\x00\x15\x00\x15\x00\x15\x00\x00\x00\x00\x00\x00\x00\x15\x00\x15\x00\x15\x00\x0a\x00\x00\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x00\x00\x15\x00\x15\x00\x15\x00\x15\x00\x00\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x1b\x00\x15\x00\x15\x00\x1a\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x09\x00\x15\x00\x00\x00\x15\x00\xff\xff\x55\x00\x55\x00\x55\x00\x55\x00\x18\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xdb\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x55\x00\x00\x00\x9b\x01\x7c\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9a\x00\x9f\x00\x00\x00\xce\x00\x00\x00\x00\x00\x00\x00\x94\x00\x00\x00\x00\x00\x8c\x00\x9e\x00\xac\x00\xba\x00\x00\x00\x00\x00\x9b\x00\xbb\x00\xa7\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x27\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x7b\x00\x00\x00\x9b\x01\x00\x00\x9b\x01\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x38\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x39\x00\x14\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2f\x00\x19\x00\x25\x00\x25\x00\x25\x00\x26\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x52\x00\x4e\x00\x4e\x00\x4e\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xd5\x01\x00\x00\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\x00\x00\x00\x00\xd5\x01\xd5\x01\xd5\x01\xd5\x01\x4e\x00\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\x00\x00\xd5\x01\xd5\x01\xd5\x01\xd5\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xd5\x01\xd5\x01\xd5\x01\xd5\x01\x00\x00\xd5\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x4f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xd5\x01\x00\x00\xd5\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x3b\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3c\x00\x12\x00\x30\x00\x30\x00\x30\x00\x30\x00\x30\x00\x30\x00\x30\x00\x30\x00\x30\x00\x30\x00\x30\x00\x30\x00\x30\x00\x30\x00\x31\x00\x18\x00\x28\x00\x28\x00\x28\x00\x29\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x15\x00\x00\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x00\x00\x00\x00\x15\x00\x15\x00\x15\x00\xe0\x00\x00\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x00\x00\x15\x00\x15\x00\x15\x00\x15\x00\x00\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x00\x00\x15\x00\xdd\x00\x15\x00\x15\x00\x00\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x00\x00\x00\x00\x15\x00\x15\x00\x15\x00\x0b\x00\x00\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x00\x00\x15\x00\x15\x00\x15\x00\x15\x00\x00\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x00\x00\x15\x00\xde\x00\x15\x00\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\xd5\x01\x9b\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\x00\x00\x00\x00\xd5\x01\xd5\x01\xd5\x01\xd5\x01\x00\x00\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\x00\x00\xd5\x01\xd5\x01\xd5\x01\xd5\x01\x00\x00\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\x00\x00\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\x00\x00\x00\x00\x00\x00\xd5\x01\xd5\x01\xd5\x01\xd5\x01\x00\x00\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\x00\x00\xd5\x01\xd5\x01\xd5\x01\xd5\x01\x00\x00\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\x0f\x00\xd5\x01\xd5\x01\x0e\x00\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\x00\x00\xd5\x01\x00\x00\xd5\x01\x3e\x00\x42\x00\x42\x00\x42\x00\x42\x00\x42\x00\x42\x00\x42\x00\x42\x00\x42\x00\x42\x00\x42\x00\x42\x00\x42\x00\x42\x00\x42\x00\x42\x00\x42\x00\x42\x00\x42\x00\x42\x00\x42\x00\x42\x00\x42\x00\x42\x00\x42\x00\x42\x00\x42\x00\x42\x00\x42\x00\x42\x00\x42\x00\x42\x00\x42\x00\x42\x00\x42\x00\x42\x00\x42\x00\x42\x00\x42\x00\x42\x00\x42\x00\x42\x00\x42\x00\x42\x00\x42\x00\x42\x00\x42\x00\x42\x00\x42\x00\x42\x00\x42\x00\x42\x00\x42\x00\x42\x00\x42\x00\x42\x00\x42\x00\x42\x00\x42\x00\x42\x00\x42\x00\x42\x00\x42\x00\x42\x00\x42\x00\x42\x00\x42\x00\x42\x00\x42\x00\x42\x00\x42\x00\x42\x00\x42\x00\x42\x00\x42\x00\x42\x00\x42\x00\x42\x00\x42\x00\x42\x00\x42\x00\x42\x00\x42\x00\x42\x00\x42\x00\x42\x00\x42\x00\x42\x00\x42\x00\x42\x00\x42\x00\x42\x00\x42\x00\x42\x00\x42\x00\x42\x00\x42\x00\x42\x00\x42\x00\x42\x00\x42\x00\x42\x00\x42\x00\x42\x00\x42\x00\x42\x00\x42\x00\x42\x00\x42\x00\x42\x00\x42\x00\x42\x00\x42\x00\x42\x00\x42\x00\x42\x00\x42\x00\x42\x00\x42\x00\x42\x00\x42\x00\x42\x00\x42\x00\x42\x00\x42\x00\x42\x00\x42\x00\x3b\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x38\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x15\x00\x00\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x00\x00\x00\x00\x15\x00\x15\x00\x15\x00\x0b\x00\x00\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x00\x00\x15\x00\x15\x00\x15\x00\x15\x00\x00\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x00\x00\x15\x00\x00\x00\x15\x00\x35\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x11\x00\x32\x00\x32\x00\x32\x00\x32\x00\x32\x00\x32\x00\x32\x00\x32\x00\x32\x00\x32\x00\x32\x00\x32\x00\x32\x00\x32\x00\x32\x00\x32\x00\x32\x00\x32\x00\x32\x00\x32\x00\x32\x00\x32\x00\x32\x00\x32\x00\x32\x00\x32\x00\x32\x00\x32\x00\x32\x00\x32\x00\x32\x00\x32\x00\x32\x00\x32\x00\x32\x00\x32\x00\x32\x00\x32\x00\x32\x00\x32\x00\x32\x00\x32\x00\x32\x00\x32\x00\x32\x00\x32\x00\x32\x00\x32\x00\x32\x00\x32\x00\x32\x00\x32\x00\x32\x00\x32\x00\x32\x00\x32\x00\x32\x00\x32\x00\x32\x00\x32\x00\x32\x00\x32\x00\x32\x00\x32\x00\x32\x00\x32\x00\x32\x00\x32\x00\x32\x00\x32\x00\x32\x00\x32\x00\x32\x00\x32\x00\x32\x00\x32\x00\x32\x00\x32\x00\x32\x00\x32\x00\x32\x00\x32\x00\x32\x00\x32\x00\x32\x00\x32\x00\x32\x00\x32\x00\x32\x00\x32\x00\x32\x00\x32\x00\x32\x00\x32\x00\x32\x00\x32\x00\x32\x00\x32\x00\x32\x00\x32\x00\x32\x00\x32\x00\x32\x00\x32\x00\x32\x00\x32\x00\x32\x00\x32\x00\x32\x00\x32\x00\x32\x00\x32\x00\x32\x00\x32\x00\x32\x00\x32\x00\x32\x00\x32\x00\x32\x00\x32\x00\x32\x00\x32\x00\x32\x00\x32\x00\x32\x00\x32\x00\x32\x00\x12\x00\x30\x00\x30\x00\x30\x00\x30\x00\x30\x00\x30\x00\x30\x00\x30\x00\x30\x00\x30\x00\x30\x00\x30\x00\x30\x00\x30\x00\x30\x00\x30\x00\x30\x00\x30\x00\x30\x00\x30\x00\x30\x00\x30\x00\x30\x00\x30\x00\x30\x00\x30\x00\x30\x00\x30\x00\x30\x00\x30\x00\x30\x00\x30\x00\x30\x00\x30\x00\x30\x00\x30\x00\x30\x00\x30\x00\x30\x00\x30\x00\x30\x00\x30\x00\x30\x00\x30\x00\x30\x00\x30\x00\x30\x00\x30\x00\x30\x00\x30\x00\x30\x00\x30\x00\x30\x00\x30\x00\x30\x00\x30\x00\x30\x00\x30\x00\x30\x00\x30\x00\x30\x00\x30\x00\x30\x00\x30\x00\x30\x00\x30\x00\x30\x00\x30\x00\x30\x00\x30\x00\x30\x00\x30\x00\x30\x00\x30\x00\x30\x00\x30\x00\x30\x00\x30\x00\x30\x00\x30\x00\x30\x00\x30\x00\x30\x00\x30\x00\x30\x00\x30\x00\x30\x00\x30\x00\x30\x00\x30\x00\x30\x00\x30\x00\x30\x00\x30\x00\x30\x00\x30\x00\x30\x00\x30\x00\x30\x00\x30\x00\x30\x00\x30\x00\x30\x00\x30\x00\x30\x00\x30\x00\x30\x00\x30\x00\x30\x00\x30\x00\x30\x00\x30\x00\x30\x00\x30\x00\x30\x00\x30\x00\x30\x00\x30\x00\x30\x00\x30\x00\x30\x00\x30\x00\x30\x00\x30\x00\x30\x00\x30\x00\x30\x00\x14\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x15\x00\x00\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x00\x00\x00\x00\x15\x00\x15\x00\x15\x00\x15\x00\x00\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x00\x00\x15\x00\x15\x00\x15\x00\x15\x00\x00\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x00\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x00\x00\x00\x00\x15\x00\x15\x00\x15\x00\x15\x00\x00\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x00\x00\x15\x00\x15\x00\x15\x00\x15\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x15\x00\x15\x00\x15\x00\x15\x00\x00\x00\x15\x00\x00\x00\x00\x00\x00\x00\x00\x00\x21\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x00\x00\x00\x00\x15\x00\x15\x00\x15\x00\x15\x00\x00\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x15\x00\x00\x00\x15\x00\x15\x00\x15\x00\x15\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x15\x00\x15\x00\x15\x00\x15\x00\x00\x00\x15\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x15\x00\x00\x00\x15\x00\x16\x00\x2c\x00\x2c\x00\x2c\x00\x2c\x00\x2c\x00\x2c\x00\x2c\x00\x2c\x00\x2c\x00\x2c\x00\x2c\x00\x2c\x00\x2c\x00\x2c\x00\x2c\x00\x2c\x00\x2c\x00\x2c\x00\x2c\x00\x2c\x00\x2c\x00\x2c\x00\x2c\x00\x2c\x00\x2c\x00\x2c\x00\x2c\x00\x2c\x00\x2c\x00\x2c\x00\x2c\x00\x2c\x00\x2c\x00\x2c\x00\x2c\x00\x2c\x00\x2c\x00\x2c\x00\x2c\x00\x2c\x00\x2c\x00\x2c\x00\x2c\x00\x2c\x00\x2c\x00\x2c\x00\x2c\x00\x2c\x00\x2c\x00\x2c\x00\x2c\x00\x2c\x00\x2c\x00\x2c\x00\x2c\x00\x2c\x00\x2c\x00\x2c\x00\x2c\x00\x2c\x00\x2c\x00\x2c\x00\x2c\x00\x2c\x00\x2c\x00\x2c\x00\x2c\x00\x2c\x00\x2c\x00\x2c\x00\x2c\x00\x2c\x00\x2c\x00\x2c\x00\x2c\x00\x2c\x00\x2c\x00\x2c\x00\x2c\x00\x2c\x00\x2c\x00\x2c\x00\x2c\x00\x2c\x00\x2c\x00\x2c\x00\x2c\x00\x2c\x00\x2c\x00\x2c\x00\x2c\x00\x2c\x00\x2c\x00\x2c\x00\x2c\x00\x2c\x00\x2c\x00\x2c\x00\x2c\x00\x2c\x00\x2c\x00\x2c\x00\x2c\x00\x2c\x00\x2c\x00\x2c\x00\x2c\x00\x2c\x00\x2c\x00\x2c\x00\x2c\x00\x2c\x00\x2c\x00\x2c\x00\x2c\x00\x2c\x00\x2c\x00\x2c\x00\x2c\x00\x2c\x00\x2c\x00\x2c\x00\x2c\x00\x2c\x00\x2c\x00\x2c\x00\x2c\x00\x2d\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x2f\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x31\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x33\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x36\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x39\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x3c\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x41\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xd5\x01\x00\x00\xd5\x01\xd5\x01\xd5\x01\xd5\x01\x00\x00\x00\x00\x00\x00\xd5\x01\xd5\x01\xd5\x01\xd5\x01\x00\x00\xd5\x01\x3a\x01\x38\x01\x38\x01\x38\x01\x38\x01\x38\x01\x38\x01\x38\x01\x38\x01\x38\x01\xd5\x01\x00\x00\xd5\x01\xd5\x01\xd5\x01\xd5\x01\x00\x00\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\x0f\x00\xd5\x01\xd5\x01\x0e\x00\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\x00\x00\xd5\x01\x00\x00\xd5\x01\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x3e\x00\x42\x00\x42\x00\x42\x00\x42\x00\x42\x00\x42\x00\x42\x00\x42\x00\x42\x00\x42\x00\x42\x00\x42\x00\x42\x00\x42\x00\x42\x00\x42\x00\x42\x00\x42\x00\x42\x00\x42\x00\x42\x00\x42\x00\x42\x00\x42\x00\x42\x00\x42\x00\x42\x00\x42\x00\x41\x00\x11\x00\x32\x00\x32\x00\x32\x00\x32\x00\x32\x00\x32\x00\x32\x00\x32\x00\x32\x00\x32\x00\x32\x00\x32\x00\x32\x00\x32\x00\x33\x00\x17\x00\x2a\x00\x2a\x00\x2a\x00\x2b\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x44\x00\x44\x00\x44\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x44\x00\x9b\x01\x9b\x01\x9b\x01\x3e\x01\x10\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x00\x00\x9b\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x3b\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3c\x00\x12\x00\x30\x00\x30\x00\x30\x00\x30\x00\x30\x00\x30\x00\x30\x00\x30\x00\x30\x00\x30\x00\x30\x00\x30\x00\x30\x00\x30\x00\x31\x00\x18\x00\x28\x00\x28\x00\x28\x00\x29\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x00\x00\x9b\x01\x9b\x01\x9b\x01\x3e\x01\x10\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x95\x01\x9b\x01\x57\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\xa4\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x00\x00\x9b\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x44\x00\x00\x00\x00\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x3b\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3c\x00\x12\x00\x30\x00\x30\x00\x30\x00\x30\x00\x30\x00\x30\x00\x30\x00\x30\x00\x30\x00\x30\x00\x30\x00\x30\x00\x30\x00\x30\x00\x31\x00\x18\x00\x28\x00\x28\x00\x28\x00\x29\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x00\x00\x9b\x01\x9b\x01\x9b\x01\x3e\x01\x10\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x45\x00\x9b\x01\x00\x00\x9b\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x3b\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3c\x00\x12\x00\x30\x00\x30\x00\x30\x00\x30\x00\x30\x00\x30\x00\x30\x00\x30\x00\x30\x00\x30\x00\x30\x00\x30\x00\x30\x00\x30\x00\x31\x00\x18\x00\x28\x00\x28\x00\x28\x00\x29\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x00\x00\x9b\x01\x9b\x01\x9b\x01\x3e\x01\x10\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x00\x00\x9b\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x51\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x3b\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3c\x00\x12\x00\x30\x00\x30\x00\x30\x00\x30\x00\x30\x00\x30\x00\x30\x00\x30\x00\x30\x00\x30\x00\x30\x00\x30\x00\x30\x00\x30\x00\x31\x00\x18\x00\x28\x00\x28\x00\x28\x00\x29\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x47\x00\x00\x00\x00\x00\x9b\x01\x00\x00\x9b\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x3b\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3c\x00\x12\x00\x30\x00\x30\x00\x30\x00\x30\x00\x30\x00\x30\x00\x30\x00\x30\x00\x30\x00\x30\x00\x30\x00\x30\x00\x30\x00\x30\x00\x31\x00\x18\x00\x28\x00\x28\x00\x28\x00\x29\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x00\x00\x9b\x01\x9b\x01\x9b\x01\x3e\x01\x10\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x00\x00\x9b\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x48\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x3b\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3c\x00\x12\x00\x30\x00\x30\x00\x30\x00\x30\x00\x30\x00\x30\x00\x30\x00\x30\x00\x30\x00\x30\x00\x30\x00\x30\x00\x30\x00\x30\x00\x31\x00\x18\x00\x28\x00\x28\x00\x28\x00\x29\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x00\x00\x9b\x01\x9b\x01\x9b\x01\x3e\x01\x10\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x00\x00\x9b\x01\x50\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x3b\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3c\x00\x12\x00\x30\x00\x30\x00\x30\x00\x30\x00\x30\x00\x30\x00\x30\x00\x30\x00\x30\x00\x30\x00\x30\x00\x30\x00\x30\x00\x30\x00\x31\x00\x18\x00\x28\x00\x28\x00\x28\x00\x29\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x00\x00\x9b\x01\x9b\x01\x9b\x01\x3e\x01\x10\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x4a\x00\x9b\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x3b\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3c\x00\x12\x00\x30\x00\x30\x00\x30\x00\x30\x00\x30\x00\x30\x00\x30\x00\x30\x00\x30\x00\x30\x00\x30\x00\x30\x00\x30\x00\x30\x00\x31\x00\x18\x00\x28\x00\x28\x00\x28\x00\x29\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x00\x00\x9b\x01\x9b\x01\x9b\x01\x3e\x01\x10\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x4b\x00\x9b\x01\x00\x00\x9b\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x3b\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3c\x00\x12\x00\x30\x00\x30\x00\x30\x00\x30\x00\x30\x00\x30\x00\x30\x00\x30\x00\x30\x00\x30\x00\x30\x00\x30\x00\x30\x00\x30\x00\x31\x00\x18\x00\x28\x00\x28\x00\x28\x00\x29\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x00\x00\x9b\x01\x9b\x01\x9b\x01\x3e\x01\x10\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x00\x00\x9b\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x3b\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3c\x00\x12\x00\x30\x00\x30\x00\x30\x00\x30\x00\x30\x00\x30\x00\x30\x00\x30\x00\x30\x00\x30\x00\x30\x00\x30\x00\x30\x00\x30\x00\x31\x00\x18\x00\x28\x00\x28\x00\x28\x00\x29\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x4e\x00\x4e\x00\x4e\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x4e\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x4f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x3b\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3c\x00\x12\x00\x30\x00\x30\x00\x30\x00\x30\x00\x30\x00\x30\x00\x30\x00\x30\x00\x30\x00\x30\x00\x30\x00\x30\x00\x30\x00\x30\x00\x31\x00\x18\x00\x28\x00\x28\x00\x28\x00\x29\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x4c\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x3b\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3c\x00\x12\x00\x30\x00\x30\x00\x30\x00\x30\x00\x30\x00\x30\x00\x30\x00\x30\x00\x30\x00\x30\x00\x30\x00\x30\x00\x30\x00\x30\x00\x31\x00\x18\x00\x28\x00\x28\x00\x28\x00\x29\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x00\x00\x9b\x01\x9b\x01\x9b\x01\x3e\x01\x10\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x00\x00\x9b\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x49\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x3b\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3c\x00\x12\x00\x30\x00\x30\x00\x30\x00\x30\x00\x30\x00\x30\x00\x30\x00\x30\x00\x30\x00\x30\x00\x30\x00\x30\x00\x30\x00\x30\x00\x31\x00\x18\x00\x28\x00\x28\x00\x28\x00\x29\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x46\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x3b\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\x3c\x00\x12\x00\x30\x00\x30\x00\x30\x00\x30\x00\x30\x00\x30\x00\x30\x00\x30\x00\x30\x00\x30\x00\x30\x00\x30\x00\x30\x00\x30\x00\x31\x00\x18\x00\x28\x00\x28\x00\x28\x00\x29\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\xff\xff\x9b\x01\x9b\x01\x9b\x01\x3e\x01\x10\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x00\x00\x9b\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x38\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x39\x00\x14\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2f\x00\x19\x00\x25\x00\x25\x00\x25\x00\x26\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\xff\xff\x9b\x01\x9b\x01\x9b\x01\x3e\x01\x10\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x00\x00\x9b\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x38\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x39\x00\x14\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2f\x00\x19\x00\x25\x00\x25\x00\x25\x00\x26\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\xff\xff\x9b\x01\x9b\x01\x9b\x01\x3e\x01\x10\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x00\x00\x9b\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x38\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x39\x00\x14\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2f\x00\x19\x00\x25\x00\x25\x00\x25\x00\x26\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\xff\xff\x9b\x01\x9b\x01\x9b\x01\x3e\x01\x10\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x00\x00\x9b\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x38\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x39\x00\x14\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2f\x00\x19\x00\x25\x00\x25\x00\x25\x00\x26\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\xff\xff\x9b\x01\x9b\x01\x9b\x01\x3e\x01\x10\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x00\x00\x9b\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x38\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x39\x00\x14\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2f\x00\x19\x00\x25\x00\x25\x00\x25\x00\x26\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\xff\xff\x9b\x01\x9b\x01\x9b\x01\x3e\x01\x10\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x00\x00\x9b\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x38\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x39\x00\x14\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2f\x00\x19\x00\x25\x00\x25\x00\x25\x00\x26\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\xff\xff\x9b\x01\x9b\x01\x9b\x01\x3e\x01\x10\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x00\x00\x9b\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x38\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x39\x00\x14\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2f\x00\x19\x00\x25\x00\x25\x00\x25\x00\x26\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xd1\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x38\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x39\x00\x14\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2f\x00\x19\x00\x25\x00\x25\x00\x25\x00\x26\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\xff\xff\x9b\x01\x9b\x01\x9b\x01\x3e\x01\x10\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\xfe\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\xff\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x00\x00\x9b\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x38\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x39\x00\x14\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2f\x00\x19\x00\x25\x00\x25\x00\x25\x00\x26\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\xff\xff\x9b\x01\x9b\x01\x9b\x01\x3e\x01\x10\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x00\x00\x9b\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x38\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x39\x00\x14\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2f\x00\x19\x00\x25\x00\x25\x00\x25\x00\x26\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\xff\xff\x9b\x01\x9b\x01\x9b\x01\x3e\x01\x10\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x00\x00\x9b\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x38\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x39\x00\x14\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2f\x00\x19\x00\x25\x00\x25\x00\x25\x00\x26\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\xff\xff\x9b\x01\x9b\x01\x9b\x01\x3e\x01\x10\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x00\x00\x9b\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x38\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x39\x00\x14\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2f\x00\x19\x00\x25\x00\x25\x00\x25\x00\x26\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\xff\xff\x9b\x01\x9b\x01\x9b\x01\x3e\x01\x10\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x00\x00\x9b\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x38\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x39\x00\x14\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2f\x00\x19\x00\x25\x00\x25\x00\x25\x00\x26\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\xff\xff\x9b\x01\x9b\x01\x9b\x01\x3e\x01\x10\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x00\x00\x9b\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x38\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x39\x00\x14\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2f\x00\x19\x00\x25\x00\x25\x00\x25\x00\x26\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\xff\xff\x9b\x01\x9b\x01\x9b\x01\x3e\x01\x10\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x00\x00\x9b\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x38\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x39\x00\x14\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2f\x00\x19\x00\x25\x00\x25\x00\x25\x00\x26\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\xff\xff\x9b\x01\x9b\x01\x9b\x01\x3e\x01\x10\x00\x9b\x01\x09\x01\x08\x01\x08\x01\x08\x01\x08\x01\x08\x01\x08\x01\x08\x01\x08\x01\x08\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x00\x00\x9b\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x38\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x39\x00\x14\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2f\x00\x19\x00\x25\x00\x25\x00\x25\x00\x26\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\xff\xff\x9b\x01\x9b\x01\x9b\x01\x3e\x01\x10\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x00\x00\x9b\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x38\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x39\x00\x14\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2f\x00\x19\x00\x25\x00\x25\x00\x25\x00\x26\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\xff\xff\x9b\x01\x9b\x01\x9b\x01\x3e\x01\x10\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x00\x00\x9b\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x38\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x39\x00\x14\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2f\x00\x19\x00\x25\x00\x25\x00\x25\x00\x26\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\xff\xff\x9b\x01\x9b\x01\x9b\x01\x3e\x01\x10\x00\x9b\x01\x07\x01\x07\x01\x07\x01\x07\x01\x07\x01\x07\x01\x07\x01\x07\x01\x07\x01\x07\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x07\x01\x07\x01\x07\x01\x07\x01\x07\x01\x07\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x07\x01\x07\x01\x07\x01\x07\x01\x07\x01\x07\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x00\x00\x9b\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x38\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x39\x00\x14\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2f\x00\x19\x00\x25\x00\x25\x00\x25\x00\x26\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\xff\xff\x9b\x01\x9b\x01\x9b\x01\x3e\x01\x10\x00\x9b\x01\x08\x01\x08\x01\x08\x01\x08\x01\x08\x01\x08\x01\x08\x01\x08\x01\x08\x01\x08\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x00\x00\x9b\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x38\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x39\x00\x14\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2f\x00\x19\x00\x25\x00\x25\x00\x25\x00\x26\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\x00\x00\x9b\x01\x57\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x00\x00\x9b\x01\x9b\x01\x9b\x01\x3e\x01\x10\x00\x9b\x01\x08\x01\x08\x01\x08\x01\x08\x01\x08\x01\x08\x01\x08\x01\x08\x01\x08\x01\x08\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\xe3\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x00\x00\x9b\x01\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x38\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x39\x00\x14\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2f\x00\x19\x00\x25\x00\x25\x00\x25\x00\x26\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\xff\xff\x9b\x01\x9b\x01\x9b\x01\x3e\x01\x10\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x00\x00\x9b\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x58\x00\x00\x00\x00\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x38\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x39\x00\x14\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2f\x00\x19\x00\x25\x00\x25\x00\x25\x00\x26\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x59\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x38\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x39\x00\x14\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2f\x00\x19\x00\x25\x00\x25\x00\x25\x00\x26\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x5b\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x38\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x39\x00\x14\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2f\x00\x19\x00\x25\x00\x25\x00\x25\x00\x26\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\x00\x00\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x00\x00\x9b\x01\x9b\x01\x9b\x01\x3e\x01\x10\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x5c\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x00\x00\x9b\x01\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x38\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x39\x00\x14\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2f\x00\x19\x00\x25\x00\x25\x00\x25\x00\x26\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x5d\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x38\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x39\x00\x14\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2f\x00\x19\x00\x25\x00\x25\x00\x25\x00\x26\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x60\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x38\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x39\x00\x14\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2f\x00\x19\x00\x25\x00\x25\x00\x25\x00\x26\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x61\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x38\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x39\x00\x14\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2f\x00\x19\x00\x25\x00\x25\x00\x25\x00\x26\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x62\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x38\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x39\x00\x14\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2f\x00\x19\x00\x25\x00\x25\x00\x25\x00\x26\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x64\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x38\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x39\x00\x14\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2f\x00\x19\x00\x25\x00\x25\x00\x25\x00\x26\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\x00\x00\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x00\x00\x9b\x01\x9b\x01\x9b\x01\x3e\x01\x10\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x65\x00\x9b\x01\x9b\x01\x98\x01\x9b\x01\x9b\x01\x9b\x01\x73\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x76\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x00\x00\x9b\x01\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x38\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x39\x00\x14\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2f\x00\x19\x00\x25\x00\x25\x00\x25\x00\x26\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x66\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x38\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x39\x00\x14\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2f\x00\x19\x00\x25\x00\x25\x00\x25\x00\x26\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x67\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x38\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x39\x00\x14\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2f\x00\x19\x00\x25\x00\x25\x00\x25\x00\x26\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x68\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x38\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x39\x00\x14\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2f\x00\x19\x00\x25\x00\x25\x00\x25\x00\x26\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x69\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x38\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x39\x00\x14\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2f\x00\x19\x00\x25\x00\x25\x00\x25\x00\x26\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x6a\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x38\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x39\x00\x14\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2f\x00\x19\x00\x25\x00\x25\x00\x25\x00\x26\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\xff\xff\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x6b\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x00\x00\x9b\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x38\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x39\x00\x14\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2f\x00\x19\x00\x25\x00\x25\x00\x25\x00\x26\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x6c\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x38\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x39\x00\x14\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2f\x00\x19\x00\x25\x00\x25\x00\x25\x00\x26\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xda\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x38\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x39\x00\x14\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2f\x00\x19\x00\x25\x00\x25\x00\x25\x00\x26\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xd9\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x38\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x39\x00\x14\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2f\x00\x19\x00\x25\x00\x25\x00\x25\x00\x26\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x71\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x38\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x39\x00\x14\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2f\x00\x19\x00\x25\x00\x25\x00\x25\x00\x26\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x73\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x38\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x39\x00\x14\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2f\x00\x19\x00\x25\x00\x25\x00\x25\x00\x26\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x76\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x38\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x39\x00\x14\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2f\x00\x19\x00\x25\x00\x25\x00\x25\x00\x26\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xd6\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x38\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x39\x00\x14\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2f\x00\x19\x00\x25\x00\x25\x00\x25\x00\x26\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xd5\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x38\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x39\x00\x14\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2f\x00\x19\x00\x25\x00\x25\x00\x25\x00\x26\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\x00\x00\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x00\x00\x9b\x01\x9b\x01\x9b\x01\x3e\x01\x10\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\xd4\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x00\x00\x9b\x01\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x38\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x39\x00\x14\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2f\x00\x19\x00\x25\x00\x25\x00\x25\x00\x26\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xd3\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x38\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x39\x00\x14\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2f\x00\x19\x00\x25\x00\x25\x00\x25\x00\x26\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xd2\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x38\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x39\x00\x14\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2f\x00\x19\x00\x25\x00\x25\x00\x25\x00\x26\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xd0\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x38\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x39\x00\x14\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2f\x00\x19\x00\x25\x00\x25\x00\x25\x00\x26\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x81\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x38\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x39\x00\x14\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2f\x00\x19\x00\x25\x00\x25\x00\x25\x00\x26\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xcd\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x38\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x39\x00\x14\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2f\x00\x19\x00\x25\x00\x25\x00\x25\x00\x26\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xcc\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x38\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x39\x00\x14\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2f\x00\x19\x00\x25\x00\x25\x00\x25\x00\x26\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xcb\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x38\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x39\x00\x14\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2f\x00\x19\x00\x25\x00\x25\x00\x25\x00\x26\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xca\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x38\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x39\x00\x14\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2f\x00\x19\x00\x25\x00\x25\x00\x25\x00\x26\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x82\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x38\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x39\x00\x14\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2f\x00\x19\x00\x25\x00\x25\x00\x25\x00\x26\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xc8\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x38\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x39\x00\x14\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2f\x00\x19\x00\x25\x00\x25\x00\x25\x00\x26\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\x00\x00\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x00\x00\x9b\x01\x9b\x01\x9b\x01\x3e\x01\x10\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\xc6\x00\x9b\x01\x9b\x01\x9b\x01\x78\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x00\x00\x9b\x01\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x38\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x39\x00\x14\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2f\x00\x19\x00\x25\x00\x25\x00\x25\x00\x26\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xc5\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x38\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x39\x00\x14\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2f\x00\x19\x00\x25\x00\x25\x00\x25\x00\x26\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x8b\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x38\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x39\x00\x14\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2f\x00\x19\x00\x25\x00\x25\x00\x25\x00\x26\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xc4\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x38\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x39\x00\x14\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2f\x00\x19\x00\x25\x00\x25\x00\x25\x00\x26\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xc3\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x38\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x39\x00\x14\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2f\x00\x19\x00\x25\x00\x25\x00\x25\x00\x26\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xc1\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x38\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x39\x00\x14\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2f\x00\x19\x00\x25\x00\x25\x00\x25\x00\x26\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x90\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x38\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x39\x00\x14\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2f\x00\x19\x00\x25\x00\x25\x00\x25\x00\x26\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xc0\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x38\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x39\x00\x14\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2f\x00\x19\x00\x25\x00\x25\x00\x25\x00\x26\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\x00\x00\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x00\x00\x9b\x01\x9b\x01\x9b\x01\x3e\x01\x10\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\xbf\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x00\x00\x9b\x01\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x38\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x39\x00\x14\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2f\x00\x19\x00\x25\x00\x25\x00\x25\x00\x26\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\x00\x00\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x00\x00\x9b\x01\x9b\x01\x9b\x01\x3e\x01\x10\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\xbe\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x00\x00\x9b\x01\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x38\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x39\x00\x14\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2f\x00\x19\x00\x25\x00\x25\x00\x25\x00\x26\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\x00\x00\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x00\x00\x9b\x01\x9b\x01\x9b\x01\x3e\x01\x10\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x91\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x00\x00\x9b\x01\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x38\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x39\x00\x14\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2f\x00\x19\x00\x25\x00\x25\x00\x25\x00\x26\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x92\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x38\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x39\x00\x14\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2f\x00\x19\x00\x25\x00\x25\x00\x25\x00\x26\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x93\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x38\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x39\x00\x14\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2f\x00\x19\x00\x25\x00\x25\x00\x25\x00\x26\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xbc\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x38\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x39\x00\x14\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2f\x00\x19\x00\x25\x00\x25\x00\x25\x00\x26\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x96\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x38\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x39\x00\x14\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2f\x00\x19\x00\x25\x00\x25\x00\x25\x00\x26\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x99\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x38\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x39\x00\x14\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2f\x00\x19\x00\x25\x00\x25\x00\x25\x00\x26\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x9c\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x38\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x39\x00\x14\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2f\x00\x19\x00\x25\x00\x25\x00\x25\x00\x26\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xb9\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x38\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x39\x00\x14\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2f\x00\x19\x00\x25\x00\x25\x00\x25\x00\x26\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xb8\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x38\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x39\x00\x14\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2f\x00\x19\x00\x25\x00\x25\x00\x25\x00\x26\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xb7\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x38\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x39\x00\x14\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2f\x00\x19\x00\x25\x00\x25\x00\x25\x00\x26\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xa0\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x38\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x39\x00\x14\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2f\x00\x19\x00\x25\x00\x25\x00\x25\x00\x26\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xa1\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x38\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x39\x00\x14\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2f\x00\x19\x00\x25\x00\x25\x00\x25\x00\x26\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xa2\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x38\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x39\x00\x14\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2f\x00\x19\x00\x25\x00\x25\x00\x25\x00\x26\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xb6\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x38\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x39\x00\x14\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2f\x00\x19\x00\x25\x00\x25\x00\x25\x00\x26\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xb5\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x38\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x39\x00\x14\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2f\x00\x19\x00\x25\x00\x25\x00\x25\x00\x26\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\x00\x00\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x00\x00\x9b\x01\x9b\x01\x9b\x01\x3e\x01\x10\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\xb4\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x00\x00\x9b\x01\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x38\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x39\x00\x14\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2f\x00\x19\x00\x25\x00\x25\x00\x25\x00\x26\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xb3\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x38\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x39\x00\x14\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2f\x00\x19\x00\x25\x00\x25\x00\x25\x00\x26\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xb2\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x38\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x39\x00\x14\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2f\x00\x19\x00\x25\x00\x25\x00\x25\x00\x26\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xaa\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x38\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x39\x00\x14\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2f\x00\x19\x00\x25\x00\x25\x00\x25\x00\x26\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xb1\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x38\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x39\x00\x14\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2f\x00\x19\x00\x25\x00\x25\x00\x25\x00\x26\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xb0\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x38\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x39\x00\x14\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2f\x00\x19\x00\x25\x00\x25\x00\x25\x00\x26\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\xff\xff\x9b\x01\x9b\x01\x9b\x01\x3e\x01\x10\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x00\x00\x9b\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x38\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x39\x00\x14\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2f\x00\x19\x00\x25\x00\x25\x00\x25\x00\x26\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xad\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x38\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x39\x00\x14\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2f\x00\x19\x00\x25\x00\x25\x00\x25\x00\x26\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xab\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x38\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x39\x00\x14\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2f\x00\x19\x00\x25\x00\x25\x00\x25\x00\x26\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xa9\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xaf\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x38\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x39\x00\x14\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2f\x00\x19\x00\x25\x00\x25\x00\x25\x00\x26\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xa8\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x38\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x39\x00\x14\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2f\x00\x19\x00\x25\x00\x25\x00\x25\x00\x26\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xa6\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x38\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x39\x00\x14\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2f\x00\x19\x00\x25\x00\x25\x00\x25\x00\x26\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xa5\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x38\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x39\x00\x14\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2f\x00\x19\x00\x25\x00\x25\x00\x25\x00\x26\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xa4\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x38\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x39\x00\x14\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2f\x00\x19\x00\x25\x00\x25\x00\x25\x00\x26\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xa3\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x38\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x39\x00\x14\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2f\x00\x19\x00\x25\x00\x25\x00\x25\x00\x26\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x9d\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x38\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x39\x00\x14\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2f\x00\x19\x00\x25\x00\x25\x00\x25\x00\x26\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x98\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x38\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x39\x00\x14\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2f\x00\x19\x00\x25\x00\x25\x00\x25\x00\x26\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x97\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x38\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x39\x00\x14\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2f\x00\x19\x00\x25\x00\x25\x00\x25\x00\x26\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xbd\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x38\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x39\x00\x14\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2f\x00\x19\x00\x25\x00\x25\x00\x25\x00\x26\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x8f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x38\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x39\x00\x14\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2f\x00\x19\x00\x25\x00\x25\x00\x25\x00\x26\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x8e\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x38\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x39\x00\x14\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2f\x00\x19\x00\x25\x00\x25\x00\x25\x00\x26\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x8d\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x38\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x39\x00\x14\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2f\x00\x19\x00\x25\x00\x25\x00\x25\x00\x26\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x8a\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x38\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x39\x00\x14\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2f\x00\x19\x00\x25\x00\x25\x00\x25\x00\x26\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x89\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x38\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x39\x00\x14\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2f\x00\x19\x00\x25\x00\x25\x00\x25\x00\x26\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x88\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x38\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x39\x00\x14\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2f\x00\x19\x00\x25\x00\x25\x00\x25\x00\x26\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x87\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x38\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x39\x00\x14\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2f\x00\x19\x00\x25\x00\x25\x00\x25\x00\x26\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x86\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x38\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x39\x00\x14\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2f\x00\x19\x00\x25\x00\x25\x00\x25\x00\x26\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x83\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x38\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x39\x00\x14\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2f\x00\x19\x00\x25\x00\x25\x00\x25\x00\x26\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xc9\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x38\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x39\x00\x14\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2f\x00\x19\x00\x25\x00\x25\x00\x25\x00\x26\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xcf\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x38\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x39\x00\x14\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2f\x00\x19\x00\x25\x00\x25\x00\x25\x00\x26\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x38\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x39\x00\x14\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2f\x00\x19\x00\x25\x00\x25\x00\x25\x00\x26\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x7f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xc2\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x38\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x39\x00\x14\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2f\x00\x19\x00\x25\x00\x25\x00\x25\x00\x26\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x7e\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x38\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x39\x00\x14\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2f\x00\x19\x00\x25\x00\x25\x00\x25\x00\x26\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x7d\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x38\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x39\x00\x14\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2f\x00\x19\x00\x25\x00\x25\x00\x25\x00\x26\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x7a\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x38\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x39\x00\x14\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2f\x00\x19\x00\x25\x00\x25\x00\x25\x00\x26\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x79\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x38\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x39\x00\x14\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2f\x00\x19\x00\x25\x00\x25\x00\x25\x00\x26\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x78\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x38\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x39\x00\x14\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2f\x00\x19\x00\x25\x00\x25\x00\x25\x00\x26\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x77\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x38\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x39\x00\x14\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2f\x00\x19\x00\x25\x00\x25\x00\x25\x00\x26\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x75\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x38\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x39\x00\x14\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2f\x00\x19\x00\x25\x00\x25\x00\x25\x00\x26\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x74\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x38\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x39\x00\x14\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2f\x00\x19\x00\x25\x00\x25\x00\x25\x00\x26\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xd7\x00\x95\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x38\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x39\x00\x14\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2f\x00\x19\x00\x25\x00\x25\x00\x25\x00\x26\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x84\x00\xc7\x00\x00\x00\x00\x00\x00\x00\x00\x00\x72\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x85\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x38\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x39\x00\x14\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2f\x00\x19\x00\x25\x00\x25\x00\x25\x00\x26\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xd8\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x38\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x39\x00\x14\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2f\x00\x19\x00\x25\x00\x25\x00\x25\x00\x26\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x70\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x38\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x39\x00\x14\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2f\x00\x19\x00\x25\x00\x25\x00\x25\x00\x26\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x6f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x38\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x39\x00\x14\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2f\x00\x19\x00\x25\x00\x25\x00\x25\x00\x26\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x6e\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x38\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x39\x00\x14\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2f\x00\x19\x00\x25\x00\x25\x00\x25\x00\x26\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x6d\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x38\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x39\x00\x14\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2f\x00\x19\x00\x25\x00\x25\x00\x25\x00\x26\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x63\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x38\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x39\x00\x14\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2f\x00\x19\x00\x25\x00\x25\x00\x25\x00\x26\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x5f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x38\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x39\x00\x14\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2f\x00\x19\x00\x25\x00\x25\x00\x25\x00\x26\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x5e\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x38\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x39\x00\x14\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2f\x00\x19\x00\x25\x00\x25\x00\x25\x00\x26\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x5a\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x38\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x3a\x00\x39\x00\x14\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2f\x00\x19\x00\x25\x00\x25\x00\x25\x00\x26\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x00\x00\x9b\x01\x9b\x01\x9b\x01\x3e\x01\x10\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x00\x00\x9b\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x35\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x36\x00\x16\x00\x2c\x00\x2c\x00\x2c\x00\x2c\x00\x2c\x00\x2c\x00\x2c\x00\x2c\x00\x2c\x00\x2c\x00\x2c\x00\x2c\x00\x2c\x00\x2c\x00\x2d\x00\x1d\x00\x23\x00\x23\x00\x23\x00\x24\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xe2\x00\xe2\x00\xe2\x00\xe2\x00\xe2\x00\xe2\x00\xe2\x00\xe2\x00\xe2\x00\xe2\x00\xff\xff\xe2\x00\xe2\x00\xe2\x00\xe2\x00\xe2\x00\xe2\x00\xe2\x00\xe2\x00\xe2\x00\xe2\x00\xe2\x00\xe2\x00\xe2\x00\xe2\x00\xe2\x00\xe2\x00\xe2\x00\xe2\x00\xe2\x00\xe2\x00\xe2\x00\xe2\x00\x00\x00\xe2\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xe2\x00\xe2\x00\x00\x00\x00\x00\x00\x00\xe0\x00\xe2\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xe2\x00\x00\x00\x00\x00\x00\x00\x00\x00\xe2\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xe2\x00\x00\x00\xdf\x00\x00\x00\xe2\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x35\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x36\x00\x16\x00\x2c\x00\x2c\x00\x2c\x00\x2c\x00\x2c\x00\x2c\x00\x2c\x00\x2c\x00\x2c\x00\x2c\x00\x2c\x00\x2c\x00\x2c\x00\x2c\x00\x2d\x00\x1d\x00\x23\x00\x23\x00\x23\x00\x24\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xe2\x00\xe2\x00\xe2\x00\xe2\x00\xe2\x00\xe2\x00\xe2\x00\xe2\x00\xe2\x00\xe2\x00\xff\xff\xe2\x00\xe2\x00\xe2\x00\xe2\x00\xe2\x00\xe2\x00\xe2\x00\xe2\x00\xe2\x00\xe2\x00\xe2\x00\xe2\x00\xe2\x00\xe2\x00\xe2\x00\xe2\x00\xe2\x00\xe2\x00\xe2\x00\xe2\x00\xe2\x00\xe2\x00\x00\x00\xe2\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xe2\x00\xe2\x00\x00\x00\x00\x00\x00\x00\xe0\x00\xe2\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xe2\x00\x00\x00\x00\x00\x00\x00\x00\x00\xe2\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xe2\x00\x00\x00\xe2\x00\x00\x00\xe2\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x35\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x36\x00\x16\x00\x2c\x00\x2c\x00\x2c\x00\x2c\x00\x2c\x00\x2c\x00\x2c\x00\x2c\x00\x2c\x00\x2c\x00\x2c\x00\x2c\x00\x2c\x00\x2c\x00\x2d\x00\x1d\x00\x23\x00\x23\x00\x23\x00\x24\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x00\x00\x9b\x01\x9b\x01\x9b\x01\x3e\x01\x10\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x00\x00\x9b\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x35\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x36\x00\x16\x00\x2c\x00\x2c\x00\x2c\x00\x2c\x00\x2c\x00\x2c\x00\x2c\x00\x2c\x00\x2c\x00\x2c\x00\x2c\x00\x2c\x00\x2c\x00\x2c\x00\x2d\x00\x1d\x00\x23\x00\x23\x00\x23\x00\x24\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xe2\x00\xe2\x00\xe2\x00\xe2\x00\xe2\x00\xe2\x00\xe2\x00\xe2\x00\xe2\x00\xe2\x00\xff\xff\xe2\x00\xe2\x00\xe2\x00\xe2\x00\xe2\x00\xe2\x00\xe2\x00\xe2\x00\xe2\x00\xe2\x00\xe2\x00\xe2\x00\xe2\x00\xe2\x00\xe2\x00\xe2\x00\xe2\x00\xe2\x00\xe2\x00\xe2\x00\xe2\x00\xe2\x00\x00\x00\xe2\x00\x00\x00\x00\x00\x00\x00\x00\x00\xe2\x00\xe2\x00\xe2\x00\x00\x00\x00\x00\x00\x00\x00\x00\xe2\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xe2\x00\x00\x00\x00\x00\x00\x00\x00\x00\xe2\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xe4\x00\x00\x00\x00\x00\xe5\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xe2\x00\x00\x00\xe2\x00\x00\x00\xe2\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x35\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x36\x00\x16\x00\x2c\x00\x2c\x00\x2c\x00\x2c\x00\x2c\x00\x2c\x00\x2c\x00\x2c\x00\x2c\x00\x2c\x00\x2c\x00\x2c\x00\x2c\x00\x2c\x00\x2d\x00\x1d\x00\x23\x00\x23\x00\x23\x00\x24\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xe8\x00\x00\x00\xe8\x00\xe8\x00\xe8\x00\xe8\x00\xe8\x00\x00\x00\x00\x00\xe8\x00\xe8\x00\xe8\x00\xe8\x00\x00\x00\xe8\x00\xe8\x00\xe8\x00\xe8\x00\xe8\x00\xe8\x00\xe8\x00\xe8\x00\xe8\x00\xe8\x00\xe8\x00\xe8\x00\x00\x00\xe8\x00\xe8\x00\xe8\x00\xe8\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xe8\x00\xe8\x00\xe8\x00\xe8\x00\x00\x00\xe8\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xe8\x00\x00\x00\xe8\x00\x00\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x35\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x36\x00\x16\x00\x2c\x00\x2c\x00\x2c\x00\x2c\x00\x2c\x00\x2c\x00\x2c\x00\x2c\x00\x2c\x00\x2c\x00\x2c\x00\x2c\x00\x2c\x00\x2c\x00\x2d\x00\x1d\x00\x23\x00\x23\x00\x23\x00\x24\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xe2\x00\xe2\x00\xe2\x00\xe2\x00\xe2\x00\xe2\x00\xe2\x00\xe2\x00\xe2\x00\xe2\x00\xff\xff\xe2\x00\xe2\x00\xe2\x00\xe2\x00\xe2\x00\xe2\x00\xe2\x00\xe2\x00\xe2\x00\xe2\x00\xe2\x00\xe2\x00\xe2\x00\xe2\x00\xe2\x00\xe2\x00\xe2\x00\xe2\x00\xe2\x00\xe2\x00\xe2\x00\xe2\x00\x00\x00\xe2\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xe2\x00\xe2\x00\x00\x00\x00\x00\x00\x00\x00\x00\xe2\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xe2\x00\x00\x00\x00\x00\x00\x00\x00\x00\xe2\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xe2\x00\x00\x00\xe2\x00\x00\x00\xe2\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x35\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x36\x00\x16\x00\x2c\x00\x2c\x00\x2c\x00\x2c\x00\x2c\x00\x2c\x00\x2c\x00\x2c\x00\x2c\x00\x2c\x00\x2c\x00\x2c\x00\x2c\x00\x2c\x00\x2d\x00\x1d\x00\x23\x00\x23\x00\x23\x00\x24\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xe2\x00\xe2\x00\xe2\x00\xe2\x00\xe2\x00\xe2\x00\xe2\x00\xe2\x00\xe2\x00\xe2\x00\xff\xff\xe2\x00\xe2\x00\xe2\x00\xe2\x00\xe2\x00\xe2\x00\xe2\x00\xe2\x00\xe2\x00\xe2\x00\xe2\x00\xe2\x00\xe2\x00\xe2\x00\xe2\x00\xe2\x00\xe2\x00\xe2\x00\xe2\x00\xe2\x00\xe2\x00\xe2\x00\x00\x00\xe2\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xe2\x00\xe2\x00\x00\x00\x00\x00\x00\x00\xe6\x00\xe3\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xe2\x00\x00\x00\x00\x00\x00\x00\x00\x00\xe2\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xe2\x00\x00\x00\xdf\x00\x00\x00\xe2\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x35\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x36\x00\x16\x00\x2c\x00\x2c\x00\x2c\x00\x2c\x00\x2c\x00\x2c\x00\x2c\x00\x2c\x00\x2c\x00\x2c\x00\x2c\x00\x2c\x00\x2c\x00\x2c\x00\x2d\x00\x1d\x00\x23\x00\x23\x00\x23\x00\x24\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xe2\x00\xe2\x00\xe2\x00\xe2\x00\xe2\x00\xe2\x00\xe2\x00\xe2\x00\xe2\x00\xe2\x00\xff\xff\xe2\x00\xe2\x00\xe2\x00\xe2\x00\xe2\x00\xe2\x00\xe2\x00\xe2\x00\xe2\x00\xe2\x00\xe2\x00\xe2\x00\xe2\x00\xe2\x00\xe2\x00\xe2\x00\xe2\x00\xe2\x00\xe2\x00\xe2\x00\xe2\x00\xe2\x00\x00\x00\xe2\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xe2\x00\xe2\x00\x00\x00\x00\x00\x00\x00\xe6\x00\xe3\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xe2\x00\x00\x00\x00\x00\x00\x00\x00\x00\xe2\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xe2\x00\x00\x00\xe2\x00\x00\x00\xe2\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x35\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x36\x00\x16\x00\x2c\x00\x2c\x00\x2c\x00\x2c\x00\x2c\x00\x2c\x00\x2c\x00\x2c\x00\x2c\x00\x2c\x00\x2c\x00\x2c\x00\x2c\x00\x2c\x00\x2d\x00\x1d\x00\x23\x00\x23\x00\x23\x00\x24\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xe2\x00\xe2\x00\xe2\x00\xe2\x00\xe2\x00\xe2\x00\xe2\x00\xe2\x00\xe2\x00\xe2\x00\xff\xff\xe2\x00\xe2\x00\xe2\x00\xe2\x00\xe2\x00\xe2\x00\xe2\x00\xe2\x00\xe2\x00\xe2\x00\xe2\x00\xe2\x00\xe2\x00\xe2\x00\xe2\x00\xe2\x00\xe2\x00\xe2\x00\xe2\x00\xe2\x00\xe2\x00\xe2\x00\x00\x00\xe2\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xe2\x00\xe2\x00\x00\x00\x00\x00\x00\x00\x00\x00\xe3\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xe2\x00\x00\x00\x00\x00\x00\x00\x00\x00\xe2\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xe2\x00\x00\x00\xe2\x00\x00\x00\xe2\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x35\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x36\x00\x16\x00\x2c\x00\x2c\x00\x2c\x00\x2c\x00\x2c\x00\x2c\x00\x2c\x00\x2c\x00\x2c\x00\x2c\x00\x2c\x00\x2c\x00\x2c\x00\x2c\x00\x2d\x00\x1d\x00\x23\x00\x23\x00\x23\x00\x24\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x00\x00\x9b\x01\x9b\x01\x9b\x01\x3e\x01\x10\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x00\x00\x9b\x01\x9b\x01\x9b\x01\x3e\x01\x10\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x00\x00\x9b\x01\x9b\x01\x9b\x01\x3e\x01\x10\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x00\x00\x9b\x01\x9b\x01\x9b\x01\x3e\x01\x10\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x00\x00\x9b\x01\x9b\x01\x9b\x01\x3e\x01\x10\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x00\x00\x9b\x01\x9b\x01\x9b\x01\x3e\x01\x10\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x00\x00\x9b\x01\x9b\x01\x9b\x01\x3e\x01\x10\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x00\x00\x9b\x01\xda\x01\x9b\x01\x3f\x01\x34\x00\x9b\x01\x2e\x01\x2d\x01\x2d\x01\x2d\x01\x2d\x01\x2d\x01\x2d\x01\x2d\x01\x2d\x01\x2d\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x2d\x01\x2d\x01\x2d\x01\x2d\x01\x2c\x01\x2d\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x2d\x01\x2d\x01\x2d\x01\x2d\x01\x2c\x01\x2d\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x00\x00\x9b\x01\x9b\x01\x9b\x01\x3e\x01\x34\x00\x9b\x01\x2d\x01\x2d\x01\x2d\x01\x2d\x01\x2d\x01\x2d\x01\x2d\x01\x2d\x01\x2d\x01\x2d\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x2d\x01\x2d\x01\x2d\x01\x2d\x01\x2c\x01\x2d\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x2d\x01\x2d\x01\x2d\x01\x2d\x01\x2c\x01\x2d\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x00\x00\x9b\x01\x9b\x01\x9b\x01\x3e\x01\x34\x00\x9b\x01\x2d\x01\x2d\x01\x2d\x01\x2d\x01\x2d\x01\x2d\x01\x2d\x01\x2d\x01\x2d\x01\x2d\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x2d\x01\x2d\x01\x2d\x01\x2d\x01\x2c\x01\x2d\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x2d\x01\x2d\x01\x2d\x01\x2d\x01\x2c\x01\x2d\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\xd6\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x00\x00\x9b\x01\x9b\x01\x9b\x01\x3e\x01\x34\x00\x9b\x01\x2f\x01\x2f\x01\x2f\x01\x2f\x01\x2f\x01\x2f\x01\x2f\x01\x2f\x01\x2f\x01\x2f\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\xd9\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\xd9\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x00\x00\x9b\x01\x9b\x01\x9b\x01\x3e\x01\x34\x00\x9b\x01\x2f\x01\x2f\x01\x2f\x01\x2f\x01\x2f\x01\x2f\x01\x2f\x01\x2f\x01\x2f\x01\x2f\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\xd9\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\xd9\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\xdd\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x00\x00\x9b\x01\x9b\x01\x9b\x01\x3e\x01\x10\x00\x9b\x01\x31\x01\x31\x01\x31\x01\x31\x01\x31\x01\x31\x01\x31\x01\x31\x01\x31\x01\x31\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x31\x01\x31\x01\x31\x01\x31\x01\x31\x01\x31\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x31\x01\x31\x01\x31\x01\x31\x01\x31\x01\x31\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\xd5\x01\x9b\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\x00\x00\x00\x00\xd5\x01\xdc\x01\xd5\x01\xdc\x01\x10\x00\xd5\x01\x35\x01\x33\x01\x33\x01\x33\x01\x33\x01\x33\x01\x33\x01\x33\x01\x33\x01\x33\x01\xd5\x01\x00\x00\xd5\x01\xd5\x01\xd5\x01\xd5\x01\x00\x00\x33\x01\x33\x01\x33\x01\x33\x01\x32\x01\x33\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\x33\x01\x33\x01\x33\x01\x33\x01\x32\x01\x33\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\x00\x00\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\x00\x00\x00\x00\xd5\x01\xd5\x01\xd5\x01\xd5\x01\x10\x00\xd5\x01\x33\x01\x33\x01\x33\x01\x33\x01\x33\x01\x33\x01\x33\x01\x33\x01\x33\x01\x33\x01\xd5\x01\x00\x00\xd5\x01\xd5\x01\xd5\x01\xd5\x01\x00\x00\x33\x01\x33\x01\x33\x01\x33\x01\x32\x01\x33\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\x33\x01\x33\x01\x33\x01\x33\x01\x32\x01\x33\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\x00\x00\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\x00\x00\x00\x00\xd5\x01\xd5\x01\xd5\x01\xd5\x01\x10\x00\xd5\x01\x34\x01\x34\x01\x34\x01\x34\x01\x34\x01\x34\x01\x34\x01\x34\x01\x34\x01\x34\x01\xd5\x01\x00\x00\xd5\x01\xd5\x01\xd5\x01\xd5\x01\x00\x00\x34\x01\x34\x01\x34\x01\x34\x01\x34\x01\x34\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\x34\x01\x34\x01\x34\x01\x34\x01\x34\x01\x34\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\x00\x00\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\x00\x00\x00\x00\xd5\x01\xd5\x01\xd5\x01\xd5\x01\x10\x00\xd5\x01\x33\x01\x33\x01\x33\x01\x33\x01\x33\x01\x33\x01\x33\x01\x33\x01\x33\x01\x33\x01\xd5\x01\x00\x00\xd5\x01\xd5\x01\xd5\x01\xd5\x01\x00\x00\x33\x01\x33\x01\x33\x01\x33\x01\x32\x01\x33\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\x33\x01\x33\x01\x33\x01\x33\x01\x32\x01\x33\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd7\x01\xd5\x01\xd5\x01\x00\x00\xd5\x01\x9b\x01\xd5\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x00\x00\x9b\x01\x9b\x01\x9b\x01\x3e\x01\x10\x00\x9b\x01\x36\x01\x36\x01\x36\x01\x36\x01\x36\x01\x36\x01\x36\x01\x36\x01\x36\x01\x36\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x00\x00\x9b\x01\x9b\x01\x9b\x01\x3e\x01\x10\x00\x9b\x01\x36\x01\x36\x01\x36\x01\x36\x01\x36\x01\x36\x01\x36\x01\x36\x01\x36\x01\x36\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\xd6\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\xd5\x01\x9b\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\x00\x00\x00\x00\xd5\x01\xd5\x01\xd5\x01\xd5\x01\x10\x00\xd5\x01\x38\x01\x38\x01\x38\x01\x38\x01\x38\x01\x38\x01\x38\x01\x38\x01\x38\x01\x38\x01\xd5\x01\x00\x00\xd5\x01\xd5\x01\xd5\x01\xd5\x01\x00\x00\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xdb\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xdb\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\x00\x00\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\x00\x00\x00\x00\xd5\x01\xd5\x01\xd5\x01\xd5\x01\x10\x00\xd5\x01\x39\x01\x39\x01\x39\x01\x39\x01\x39\x01\x39\x01\x39\x01\x39\x01\x39\x01\x39\x01\xd5\x01\x00\x00\xd5\x01\xd5\x01\xd5\x01\xd5\x01\x00\x00\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\x00\x00\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\x00\x00\x00\x00\xd5\x01\xd5\x01\xd5\x01\xd5\x01\x10\x00\xd5\x01\x38\x01\x38\x01\x38\x01\x38\x01\x38\x01\x38\x01\x38\x01\x38\x01\x38\x01\x38\x01\xd5\x01\x00\x00\xd5\x01\xd5\x01\xd5\x01\xd5\x01\x00\x00\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xdb\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xdb\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd8\x01\xd5\x01\xd5\x01\x00\x00\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\x00\x00\x00\x00\xd5\x01\xd5\x01\xd5\x01\xd5\x01\x10\x00\xd5\x01\x39\x01\x39\x01\x39\x01\x39\x01\x39\x01\x39\x01\x39\x01\x39\x01\x39\x01\x39\x01\xd5\x01\x00\x00\xd5\x01\xd5\x01\xd5\x01\xd5\x01\x00\x00\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd7\x01\xd5\x01\xd5\x01\x00\x00\xd5\x01\x9b\x01\xd5\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x00\x00\x9b\x01\x9b\x01\x9b\x01\xe6\x00\x10\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\xdd\x00\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x00\x00\x9b\x01\x9b\x01\x9b\x01\xe6\x00\x10\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x24\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\xdd\x00\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x00\x00\x9b\x01\x9b\x01\x9b\x01\x3e\x01\x10\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\xde\x00\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x00\x00\x9b\x01\x9b\x01\x9b\x01\x3e\x01\x10\x00\x9b\x01\x37\x01\x36\x01\x36\x01\x36\x01\x36\x01\x36\x01\x36\x01\x36\x01\x36\x01\x36\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\xde\x00\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x00\x00\x9b\x01\x9b\x01\x9b\x01\x3e\x01\x10\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\xee\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x00\x00\x9b\x01\x9b\x01\x9b\x01\x3e\x01\x10\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\xf1\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x00\x00\x9b\x01\x9b\x01\x9b\x01\x3e\x01\x10\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\xf2\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x00\x00\x9b\x01\x9b\x01\x9b\x01\x3e\x01\x10\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\xf3\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x00\x00\x9b\x01\x9b\x01\x9b\x01\x3e\x01\x10\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\xf6\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x00\x00\x9b\x01\x9b\x01\x9b\x01\x3e\x01\x10\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\xf7\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x00\x00\x9b\x01\x9b\x01\x9b\x01\x3e\x01\x10\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\xf8\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x00\x00\x9b\x01\x9b\x01\x9b\x01\x3e\x01\x10\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\xfb\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x00\x00\x9b\x01\x9b\x01\x9b\x01\x3e\x01\x10\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\xfc\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x00\x00\x9b\x01\x9b\x01\x9b\x01\x3e\x01\x10\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x02\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x00\x00\x9b\x01\x9b\x01\x9b\x01\x3e\x01\x10\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x03\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x00\x00\x9b\x01\x9b\x01\x9b\x01\x3e\x01\x10\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x0c\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x00\x00\x9b\x01\x9b\x01\x9b\x01\x3e\x01\x10\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x0d\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x00\x00\x9b\x01\x9b\x01\x9b\x01\x3e\x01\x10\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x0e\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x00\x00\x9b\x01\x9b\x01\x9b\x01\x3e\x01\x10\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x10\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x00\x00\x9b\x01\x9b\x01\x9b\x01\x3e\x01\x10\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x13\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x00\x00\x9b\x01\x9b\x01\x9b\x01\x3e\x01\x10\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x14\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x00\x00\x9b\x01\x9b\x01\x9b\x01\x3e\x01\x10\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x15\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x00\x00\x9b\x01\x9b\x01\x9b\x01\x3e\x01\x10\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x16\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x00\x00\x9b\x01\x9b\x01\x9b\x01\x3e\x01\x10\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x17\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x00\x00\x9b\x01\x9b\x01\x9b\x01\x3e\x01\x10\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\xf1\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x00\x00\x9b\x01\x9b\x01\x9b\x01\x3e\x01\x10\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\xed\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x00\x00\x9b\x01\x9b\x01\x9b\x01\x3e\x01\x10\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\xea\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x00\x00\x9b\x01\x9b\x01\x9b\x01\x3e\x01\x10\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\xe9\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x00\x00\x9b\x01\x9b\x01\x9b\x01\x3e\x01\x10\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\xe8\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x00\x00\x9b\x01\x9b\x01\x9b\x01\x3e\x01\x10\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\xe7\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x00\x00\x9b\x01\x9b\x01\x9b\x01\x3e\x01\x10\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x4a\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x00\x00\x9b\x01\x9b\x01\x9b\x01\x3e\x01\x10\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\xe6\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x00\x00\x9b\x01\x9b\x01\x9b\x01\x3e\x01\x10\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\xe5\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x00\x00\x9b\x01\x9b\x01\x9b\x01\x3e\x01\x10\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\xe2\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x00\x00\x9b\x01\x9b\x01\x9b\x01\x3e\x01\x10\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\xe0\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x00\x00\x9b\x01\x9b\x01\x9b\x01\x3e\x01\x10\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x4e\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x00\x00\x9b\x01\x9b\x01\x9b\x01\x3e\x01\x10\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\xdf\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x00\x00\x9b\x01\x9b\x01\x9b\x01\x3e\x01\x10\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x53\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x00\x00\x9b\x01\x9b\x01\x9b\x01\x3e\x01\x10\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\xd4\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x00\x00\x9b\x01\x9b\x01\x9b\x01\x3e\x01\x10\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\xd3\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x00\x00\x9b\x01\x9b\x01\x9b\x01\x3e\x01\x10\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x62\x01\xd2\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x00\x00\x9b\x01\x9b\x01\x9b\x01\x3e\x01\x10\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\xd1\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x00\x00\x9b\x01\x9b\x01\x9b\x01\x3e\x01\x10\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\xd0\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x00\x00\x9b\x01\x9b\x01\x9b\x01\x3e\x01\x10\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\xcf\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x00\x00\x9b\x01\x9b\x01\x9b\x01\x3e\x01\x10\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\xce\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x00\x00\x9b\x01\x9b\x01\x9b\x01\x3e\x01\x10\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\xcd\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x00\x00\x9b\x01\x9b\x01\x9b\x01\x3e\x01\x10\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\xcc\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x00\x00\x9b\x01\x9b\x01\x9b\x01\x3e\x01\x10\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\xcb\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x00\x00\x9b\x01\x9b\x01\x9b\x01\x3e\x01\x10\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\xca\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x00\x00\x9b\x01\x9b\x01\x9b\x01\x3e\x01\x10\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\xc9\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x00\x00\x9b\x01\x9b\x01\x9b\x01\x3e\x01\x10\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\xc8\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x00\x00\x9b\x01\x9b\x01\x9b\x01\x3e\x01\x10\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x58\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x00\x00\x9b\x01\x9b\x01\x9b\x01\x3e\x01\x10\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x59\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x00\x00\x9b\x01\x9b\x01\x9b\x01\x3e\x01\x10\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\xc7\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x00\x00\x9b\x01\x9b\x01\x9b\x01\x3e\x01\x10\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\xc6\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x00\x00\x9b\x01\x9b\x01\x9b\x01\x3e\x01\x10\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x5d\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x00\x00\x9b\x01\x9b\x01\x9b\x01\x3e\x01\x10\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\xc5\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x00\x00\x9b\x01\x9b\x01\x9b\x01\x3e\x01\x10\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\xc4\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x00\x00\x9b\x01\x9b\x01\x9b\x01\x3e\x01\x10\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\xc3\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x00\x00\x9b\x01\x9b\x01\x9b\x01\x3e\x01\x10\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\xc2\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x00\x00\x9b\x01\x9b\x01\x9b\x01\x3e\x01\x10\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x5e\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x00\x00\x9b\x01\x9b\x01\x9b\x01\x3e\x01\x10\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\xc1\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x00\x00\x9b\x01\x9b\x01\x9b\x01\x3e\x01\x10\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\xc0\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x00\x00\x9b\x01\x9b\x01\x9b\x01\x3e\x01\x10\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\xbf\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x00\x00\x9b\x01\x9b\x01\x9b\x01\x3e\x01\x10\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\xbe\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x00\x00\x9b\x01\x9b\x01\x9b\x01\x3e\x01\x10\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x63\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\xab\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x00\x00\x9b\x01\x9b\x01\x9b\x01\x3e\x01\x10\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x6c\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x93\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\xb6\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x00\x00\x9b\x01\x9b\x01\x9b\x01\x3e\x01\x10\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\xbc\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x00\x00\x9b\x01\x9b\x01\x9b\x01\x3e\x01\x10\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\xbb\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x00\x00\x9b\x01\x9b\x01\x9b\x01\x3e\x01\x10\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x75\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x00\x00\x9b\x01\x9b\x01\x9b\x01\x3e\x01\x10\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x77\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x00\x00\x9b\x01\x9b\x01\x9b\x01\x3e\x01\x10\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\xb9\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x00\x00\x9b\x01\x9b\x01\x9b\x01\x3e\x01\x10\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x8f\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x7a\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x00\x00\x9b\x01\x9b\x01\x9b\x01\x3e\x01\x10\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x7c\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x00\x00\x9b\x01\x9b\x01\x9b\x01\x3e\x01\x10\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\xb5\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x00\x00\x9b\x01\x9b\x01\x9b\x01\x3e\x01\x10\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\xb4\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x00\x00\x9b\x01\x9b\x01\x9b\x01\x3e\x01\x10\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\xb2\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\xae\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x00\x00\x9b\x01\x9b\x01\x9b\x01\x3e\x01\x10\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\xb1\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x00\x00\x9b\x01\x9b\x01\x9b\x01\x3e\x01\x10\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x7e\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x00\x00\x9b\x01\x9b\x01\x9b\x01\x3e\x01\x10\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x7f\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x00\x00\x9b\x01\x9b\x01\x9b\x01\x3e\x01\x10\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\xb0\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x00\x00\x9b\x01\x9b\x01\x9b\x01\x3e\x01\x10\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\xaf\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x00\x00\x9b\x01\x9b\x01\x9b\x01\x3e\x01\x10\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\xac\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x00\x00\x9b\x01\x9b\x01\x9b\x01\x3e\x01\x10\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x82\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x00\x00\x9b\x01\x9b\x01\x9b\x01\x3e\x01\x10\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x83\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x00\x00\x9b\x01\x9b\x01\x9b\x01\x3e\x01\x10\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\xa9\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x00\x00\x9b\x01\x9b\x01\x9b\x01\x3e\x01\x10\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\xa7\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x00\x00\x9b\x01\x9b\x01\x9b\x01\x3e\x01\x10\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x85\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x00\x00\x9b\x01\x9b\x01\x9b\x01\x3e\x01\x10\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\xa2\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x99\x01\x9b\x01\x9b\x01\x8e\x01\x9b\x01\x9b\x01\xa6\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x00\x00\x9b\x01\x9b\x01\x9b\x01\x3e\x01\x10\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x8c\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x00\x00\x9b\x01\x9b\x01\x9b\x01\x3e\x01\x10\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x8d\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x00\x00\x9b\x01\x9b\x01\x9b\x01\x3e\x01\x10\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\xa5\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x00\x00\x9b\x01\x9b\x01\x9b\x01\x3e\x01\x10\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\xa3\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x00\x00\x9b\x01\x9b\x01\x9b\x01\x3e\x01\x10\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\xa1\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x00\x00\x9b\x01\x9b\x01\x9b\x01\x3e\x01\x10\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9f\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x00\x00\x9b\x01\x9b\x01\x9b\x01\x3e\x01\x10\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x00\x00\x9b\x01\x9b\x01\x9b\x01\x3e\x01\x10\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9e\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x00\x00\x9b\x01\x9b\x01\x9b\x01\x3e\x01\x10\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x97\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x00\x00\x9b\x01\x9b\x01\x9b\x01\x3e\x01\x10\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x96\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x00\x00\x9b\x01\x9b\x01\x9b\x01\x3e\x01\x10\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\xa0\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x00\x00\x9b\x01\x9b\x01\x9b\x01\x3e\x01\x10\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x8b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x00\x00\x9b\x01\x9b\x01\x9b\x01\x3e\x01\x10\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x86\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x00\x00\x9b\x01\x9b\x01\x9b\x01\x3e\x01\x10\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\xa8\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x00\x00\x9b\x01\x9b\x01\x9b\x01\x3e\x01\x10\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\xaa\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x00\x00\x9b\x01\x9b\x01\x9b\x01\x3e\x01\x10\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x80\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x00\x00\x9b\x01\x9b\x01\x9b\x01\x3e\x01\x10\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\xad\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x00\x00\x9b\x01\x9b\x01\x9b\x01\x3e\x01\x10\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\xb7\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x00\x00\x9b\x01\x9b\x01\x9b\x01\x3e\x01\x10\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x7b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x00\x00\x9b\x01\x9b\x01\x9b\x01\x3e\x01\x10\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x79\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x00\x00\x9b\x01\x9b\x01\x9b\x01\x3e\x01\x10\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\xb8\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x00\x00\x9b\x01\x9b\x01\x9b\x01\x3e\x01\x10\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x74\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x00\x00\x9b\x01\x9b\x01\x9b\x01\x3e\x01\x10\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x72\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x00\x00\x9b\x01\x9b\x01\x9b\x01\x3e\x01\x10\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x87\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x71\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x00\x00\x9b\x01\x9b\x01\x9b\x01\x3e\x01\x10\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x70\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x00\x00\x9b\x01\x9b\x01\x9b\x01\x3e\x01\x10\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x6f\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x00\x00\x9b\x01\x9b\x01\x9b\x01\x3e\x01\x10\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x6e\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x00\x00\x9b\x01\x9b\x01\x9b\x01\x3e\x01\x10\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x6d\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x00\x00\x9b\x01\x9b\x01\x9b\x01\x3e\x01\x10\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x6b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9c\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9a\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x00\x00\x9b\x01\x9b\x01\x9b\x01\x3e\x01\x10\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x69\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x00\x00\x9b\x01\x9b\x01\x9b\x01\x3e\x01\x10\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x68\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x00\x00\x9b\x01\x9b\x01\x9b\x01\x3e\x01\x10\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x67\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x00\x00\x9b\x01\x9b\x01\x9b\x01\x3e\x01\x10\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x66\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x00\x00\x9b\x01\x9b\x01\x9b\x01\x3e\x01\x10\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x65\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x00\x00\x9b\x01\x9b\x01\x9b\x01\x3e\x01\x10\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x61\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x00\x00\x9b\x01\x9b\x01\x9b\x01\x3e\x01\x10\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x60\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x00\x00\x9b\x01\x9b\x01\x9b\x01\x3e\x01\x10\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x5f\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x00\x00\x9b\x01\x9b\x01\x9b\x01\x3e\x01\x10\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x5c\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x00\x00\x9b\x01\x9b\x01\x9b\x01\x3e\x01\x10\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x5a\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x00\x00\x9b\x01\x9b\x01\x9b\x01\x3e\x01\x10\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x56\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x00\x00\x9b\x01\x9b\x01\x9b\x01\x3e\x01\x10\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x55\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x00\x00\x9b\x01\x9b\x01\x9b\x01\x3e\x01\x10\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x51\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x00\x00\x9b\x01\x9b\x01\x9b\x01\x3e\x01\x10\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x50\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x00\x00\x9b\x01\x9b\x01\x9b\x01\x3e\x01\x10\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x4f\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x00\x00\x9b\x01\x9b\x01\x9b\x01\x3e\x01\x10\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\xde\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x00\x00\x9b\x01\x9b\x01\x9b\x01\x3e\x01\x10\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x4d\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x00\x00\x9b\x01\x9b\x01\x9b\x01\x3e\x01\x10\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x4c\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x00\x00\x9b\x01\x9b\x01\x9b\x01\x3e\x01\x10\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x4b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x00\x00\x9b\x01\x9b\x01\x9b\x01\x3e\x01\x10\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\xe1\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x00\x00\x9b\x01\x9b\x01\x9b\x01\x3e\x01\x10\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\xe4\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x00\x00\x9b\x01\x9b\x01\x9b\x01\x3e\x01\x10\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x49\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x00\x00\x9b\x01\x9b\x01\x9b\x01\x3e\x01\x10\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x48\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x00\x00\x9b\x01\x9b\x01\x9b\x01\x3e\x01\x10\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x47\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x00\x00\x9b\x01\x9b\x01\x9b\x01\x3e\x01\x10\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\xeb\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x00\x00\x9b\x01\x9b\x01\x9b\x01\x3e\x01\x10\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x46\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x00\x00\x9b\x01\x9b\x01\x9b\x01\x3e\x01\x10\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x45\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x00\x00\x9b\x01\x9b\x01\x9b\x01\x3e\x01\x10\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x44\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x00\x00\x9b\x01\x9b\x01\x9b\x01\x3e\x01\x10\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\xec\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x00\x00\x9b\x01\x9b\x01\x9b\x01\x3e\x01\x10\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x43\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x00\x00\x9b\x01\x9b\x01\x9b\x01\x3e\x01\x10\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x42\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x00\x00\x9b\x01\x9b\x01\x9b\x01\x3e\x01\x10\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x41\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x00\x00\x9b\x01\x9b\x01\x9b\x01\x3e\x01\x10\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\xee\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x00\x00\x9b\x01\x9b\x01\x9b\x01\x3e\x01\x10\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\xef\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x00\x00\x9b\x01\x9b\x01\x9b\x01\x3e\x01\x10\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x40\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\xd5\x01\x9b\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\x00\x00\x00\x00\xd5\x01\xd5\x01\xd5\x01\xd5\x01\x10\x00\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\x00\x00\xd5\x01\xd5\x01\xd5\x01\xd5\x01\x00\x00\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\x00\x00\xd5\x01\x9b\x01\xd5\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x00\x00\x9b\x01\x9b\x01\x9b\x01\x3e\x01\x10\x00\x9b\x01\x31\x01\x31\x01\x31\x01\x31\x01\x31\x01\x31\x01\x31\x01\x31\x01\x31\x01\x31\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x31\x01\x31\x01\x31\x01\x31\x01\x31\x01\x31\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x31\x01\x31\x01\x31\x01\x31\x01\x31\x01\x31\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\xd5\x01\x9b\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\x00\x00\x00\x00\xd5\x01\xd5\x01\xd5\x01\xd5\x01\x10\x00\xd5\x01\x34\x01\x34\x01\x34\x01\x34\x01\x34\x01\x34\x01\x34\x01\x34\x01\x34\x01\x34\x01\xd5\x01\x00\x00\xd5\x01\xd5\x01\xd5\x01\xd5\x01\x00\x00\x34\x01\x34\x01\x34\x01\x34\x01\x34\x01\x34\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\x34\x01\x34\x01\x34\x01\x34\x01\x34\x01\x34\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\x00\x00\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\x00\x00\x00\x00\xd5\x01\xd5\x01\xd5\x01\xd5\x01\x10\x00\xd5\x01\x33\x01\x33\x01\x33\x01\x33\x01\x33\x01\x33\x01\x33\x01\x33\x01\x33\x01\x33\x01\xd5\x01\x00\x00\xd5\x01\xd5\x01\xd5\x01\xd5\x01\x00\x00\x33\x01\x33\x01\x33\x01\x33\x01\x33\x01\x33\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\x33\x01\x33\x01\x33\x01\x33\x01\x33\x01\x33\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\x00\x00\xd5\x01\x9b\x01\xd5\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x00\x00\x9b\x01\xda\x01\x9b\x01\x3f\x01\x10\x00\x9b\x01\x37\x01\x36\x01\x36\x01\x36\x01\x36\x01\x36\x01\x36\x01\x36\x01\x36\x01\x36\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x00\x00\x9b\x01\x9b\x01\x9b\x01\x3e\x01\x10\x00\x9b\x01\x37\x01\x36\x01\x36\x01\x36\x01\x36\x01\x36\x01\x36\x01\x36\x01\x36\x01\x36\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\xd5\x01\x9b\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\x00\x00\x00\x00\xd5\x01\xdc\x01\xd5\x01\xdc\x01\x10\x00\xd5\x01\x3b\x01\x39\x01\x39\x01\x39\x01\x39\x01\x39\x01\x39\x01\x39\x01\x39\x01\x39\x01\xd5\x01\x00\x00\xd5\x01\xd5\x01\xd5\x01\xd5\x01\x00\x00\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\x00\x00\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\x00\x00\x00\x00\xd5\x01\xd5\x01\xd5\x01\xd5\x01\x10\x00\xd5\x01\x3b\x01\x39\x01\x39\x01\x39\x01\x39\x01\x39\x01\x39\x01\x39\x01\x39\x01\x39\x01\xd5\x01\x00\x00\xd5\x01\xd5\x01\xd5\x01\xd5\x01\x00\x00\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\xd5\x01\x00\x00\xd5\x01\x9b\x01\xd5\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x00\x00\x9b\x01\x9b\x01\x9b\x01\x3e\x01\x10\x00\x9b\x01\x2d\x01\x2d\x01\x2d\x01\x2d\x01\x2d\x01\x2d\x01\x2d\x01\x2d\x01\x2d\x01\x2d\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x2d\x01\x2d\x01\x2d\x01\x2d\x01\x2d\x01\x2d\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x2d\x01\x2d\x01\x2d\x01\x2d\x01\x2d\x01\x2d\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x00\x00\x9b\x01\x9b\x01\x9b\x01\x3e\x01\x10\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x12\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x00\x00\x9b\x01\x9b\x01\x9b\x01\x3e\x01\x10\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x11\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x00\x00\x9b\x01\x9b\x01\x9b\x01\x3e\x01\x10\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x0f\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x00\x00\x9b\x01\x9b\x01\x9b\x01\x3e\x01\x10\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x0b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x00\x00\x9b\x01\x9b\x01\x9b\x01\x3e\x01\x10\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x0a\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x00\x00\x9b\x01\x9b\x01\x9b\x01\x3e\x01\x10\x00\x9b\x01\x07\x01\x07\x01\x07\x01\x07\x01\x07\x01\x07\x01\x07\x01\x07\x01\x07\x01\x07\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x07\x01\x07\x01\x07\x01\x07\x01\x07\x01\x07\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x07\x01\x07\x01\x07\x01\x07\x01\x07\x01\x07\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x00\x00\x9b\x01\x9b\x01\x9b\x01\x3e\x01\x10\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x06\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x00\x00\x9b\x01\x9b\x01\x9b\x01\x3e\x01\x10\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x05\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x00\x00\x9b\x01\x9b\x01\x9b\x01\x3e\x01\x10\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x04\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x00\x00\x9b\x01\x9b\x01\x9b\x01\x3e\x01\x10\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x01\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x00\x00\x9b\x01\x9b\x01\x9b\x01\x3e\x01\x10\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x00\x00\x9b\x01\x9b\x01\x9b\x01\x3e\x01\x10\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\xfd\x00\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x00\x00\x9b\x01\x9b\x01\x9b\x01\x3e\x01\x10\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\xfa\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x00\x00\x9b\x01\x9b\x01\x9b\x01\x3e\x01\x10\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\xf9\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x00\x00\x9b\x01\x9b\x01\x9b\x01\x3e\x01\x10\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\xf5\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x00\x00\x9b\x01\x9b\x01\x9b\x01\x3e\x01\x10\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\xf4\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x00\x00\x9b\x01\x9b\x01\x9b\x01\x3e\x01\x10\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\xf0\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x00\x00\x9b\x01\x9b\x01\x9b\x01\x3e\x01\x10\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\xef\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x00\x00\x9b\x01\x9b\x01\x9b\x01\x3e\x01\x10\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\xb3\x01\xed\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x00\x00\x9b\x01\x9b\x01\x9b\x01\x3e\x01\x10\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\xec\x00\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x9b\x01\x00\x00\x9b\x01\x00\x00\x9b\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"# alex_check :: AlexAddr alex_check = AlexA# "\xff\xff\x0a\x00\x0b\x00\x0c\x00\x0d\x00\x7d\x00\x2d\x00\x65\x00\x6f\x00\x63\x00\x7b\x00\x6e\x00\x64\x00\x64\x00\x0a\x00\x23\x00\x2e\x00\x2e\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x20\x00\x21\x00\x22\x00\x23\x00\x24\x00\x25\x00\x26\x00\x27\x00\x28\x00\x29\x00\x2a\x00\x2b\x00\x2c\x00\x2d\x00\x2e\x00\x2f\x00\x30\x00\x31\x00\x32\x00\x33\x00\x34\x00\x35\x00\x36\x00\x37\x00\x38\x00\x39\x00\x3a\x00\x3b\x00\x3c\x00\x3d\x00\x3e\x00\x3f\x00\x40\x00\x41\x00\x42\x00\x43\x00\x44\x00\x45\x00\x46\x00\x47\x00\x48\x00\x49\x00\x4a\x00\x4b\x00\x4c\x00\x4d\x00\x4e\x00\x4f\x00\x50\x00\x51\x00\x52\x00\x53\x00\x54\x00\x55\x00\x56\x00\x57\x00\x58\x00\x59\x00\x5a\x00\x5b\x00\x5c\x00\x5d\x00\x5e\x00\x5f\x00\x60\x00\x61\x00\x62\x00\x63\x00\x64\x00\x65\x00\x66\x00\x67\x00\x68\x00\x69\x00\x6a\x00\x6b\x00\x6c\x00\x6d\x00\x6e\x00\x6f\x00\x70\x00\x71\x00\x72\x00\x73\x00\x74\x00\x75\x00\x76\x00\x77\x00\x78\x00\x79\x00\x7a\x00\x7b\x00\x7c\x00\x7d\x00\x7e\x00\x0a\x00\x0b\x00\x0c\x00\x0d\x00\xff\xff\xff\xff\xff\xff\xff\xff\x0b\x00\x0c\x00\x0d\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x20\x00\x21\x00\xff\xff\x23\x00\x24\x00\x25\x00\x26\x00\x20\x00\xff\xff\xff\xff\x2a\x00\x2b\x00\x2c\x00\x2d\x00\xff\xff\x2f\x00\x30\x00\x31\x00\x32\x00\x33\x00\x34\x00\x35\x00\x36\x00\x37\x00\x38\x00\x39\x00\x3a\x00\xff\xff\x3c\x00\x3d\x00\x3e\x00\x3f\x00\xff\xff\x41\x00\x42\x00\x43\x00\x44\x00\x45\x00\x46\x00\x47\x00\x48\x00\x49\x00\x4a\x00\x4b\x00\x4c\x00\x4d\x00\x4e\x00\x4f\x00\x50\x00\x51\x00\x52\x00\x53\x00\x54\x00\x55\x00\x56\x00\x57\x00\x58\x00\x59\x00\x5a\x00\x5b\x00\x5c\x00\x5d\x00\x5e\x00\x5f\x00\x60\x00\x61\x00\x62\x00\x63\x00\x64\x00\x65\x00\x66\x00\x67\x00\x68\x00\x69\x00\x6a\x00\x6b\x00\x6c\x00\x6d\x00\x6e\x00\x6f\x00\x70\x00\x71\x00\x72\x00\x73\x00\x74\x00\x75\x00\x76\x00\x77\x00\x78\x00\x79\x00\x7a\x00\x7b\x00\x7c\x00\xff\xff\x7e\x00\x0a\x00\x0b\x00\x0c\x00\x0d\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x20\x00\x21\x00\x22\x00\x23\x00\x24\x00\x25\x00\x26\x00\x27\x00\x28\x00\x29\x00\x2a\x00\x2b\x00\x2c\x00\x2d\x00\x2e\x00\x2f\x00\x30\x00\x31\x00\x32\x00\x33\x00\x34\x00\x35\x00\x36\x00\x37\x00\x38\x00\x39\x00\x3a\x00\x3b\x00\x3c\x00\x3d\x00\x3e\x00\x3f\x00\x40\x00\x41\x00\x42\x00\x43\x00\x44\x00\x45\x00\x46\x00\x47\x00\x48\x00\x49\x00\x4a\x00\x4b\x00\x4c\x00\x4d\x00\x4e\x00\x4f\x00\x50\x00\x51\x00\x52\x00\x53\x00\x54\x00\x55\x00\x56\x00\x57\x00\x58\x00\x59\x00\x5a\x00\x5b\x00\x5c\x00\x5d\x00\x5e\x00\x5f\x00\x60\x00\x61\x00\x62\x00\x63\x00\x64\x00\x65\x00\x66\x00\x67\x00\x68\x00\x69\x00\x6a\x00\x6b\x00\x6c\x00\x6d\x00\x6e\x00\x6f\x00\x70\x00\x71\x00\x72\x00\x73\x00\x74\x00\x75\x00\x76\x00\x77\x00\x78\x00\x79\x00\x7a\x00\x7b\x00\x7c\x00\x7d\x00\x7e\x00\x0b\x00\x0c\x00\x0d\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x20\x00\x21\x00\xff\xff\x23\x00\x24\x00\x25\x00\x26\x00\xff\xff\xff\xff\xff\xff\x2a\x00\x2b\x00\x2c\x00\x2d\x00\xff\xff\x2f\x00\x30\x00\x31\x00\x32\x00\x33\x00\x34\x00\x35\x00\x36\x00\x37\x00\x38\x00\x39\x00\x3a\x00\xff\xff\x3c\x00\x3d\x00\x3e\x00\x3f\x00\xff\xff\x41\x00\x42\x00\x43\x00\x44\x00\x45\x00\x46\x00\x47\x00\x48\x00\x49\x00\x4a\x00\x4b\x00\x4c\x00\x4d\x00\x4e\x00\x4f\x00\x50\x00\x51\x00\x52\x00\x53\x00\x54\x00\x55\x00\x56\x00\x57\x00\x58\x00\x59\x00\x5a\x00\x5b\x00\x5c\x00\x5d\x00\x5e\x00\x5f\x00\x60\x00\x61\x00\x62\x00\x63\x00\x64\x00\x65\x00\x66\x00\x67\x00\x68\x00\x69\x00\x6a\x00\x6b\x00\x6c\x00\x6d\x00\x6e\x00\x6f\x00\x70\x00\x71\x00\x72\x00\x73\x00\x74\x00\x75\x00\x76\x00\x77\x00\x78\x00\x79\x00\x7a\x00\x7b\x00\x7c\x00\xff\xff\x7e\x00\x0a\x00\x0b\x00\x0c\x00\x0d\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x20\x00\x21\x00\xff\xff\x23\x00\x24\x00\x25\x00\x26\x00\xff\xff\xff\xff\xff\xff\x2a\x00\x2b\x00\x2c\x00\x2d\x00\xff\xff\x2f\x00\x30\x00\x31\x00\x32\x00\x33\x00\x34\x00\x35\x00\x36\x00\x37\x00\x38\x00\x39\x00\x3a\x00\xff\xff\x3c\x00\x3d\x00\x3e\x00\x3f\x00\xff\xff\x41\x00\x42\x00\x43\x00\x44\x00\x45\x00\x46\x00\x47\x00\x48\x00\x49\x00\x4a\x00\x4b\x00\x4c\x00\x4d\x00\x4e\x00\x4f\x00\x50\x00\x51\x00\x52\x00\x53\x00\x54\x00\x55\x00\x56\x00\x57\x00\x58\x00\x59\x00\x5a\x00\x5b\x00\x5c\x00\x5d\x00\x5e\x00\x5f\x00\x60\x00\x61\x00\x62\x00\x63\x00\x64\x00\x65\x00\x66\x00\x67\x00\x68\x00\x69\x00\x6a\x00\x6b\x00\x6c\x00\x6d\x00\x6e\x00\x6f\x00\x70\x00\x71\x00\x72\x00\x73\x00\x74\x00\x75\x00\x76\x00\x77\x00\x78\x00\x79\x00\x7a\x00\x7b\x00\x7c\x00\xff\xff\x7e\x00\x0a\x00\x0b\x00\x0c\x00\x0d\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x20\x00\x21\x00\xff\xff\x23\x00\x24\x00\x25\x00\x26\x00\xff\xff\xff\xff\xff\xff\x2a\x00\x2b\x00\x2c\x00\x2d\x00\xff\xff\x2f\x00\x30\x00\x31\x00\x32\x00\x33\x00\x34\x00\x35\x00\x36\x00\x37\x00\x38\x00\x39\x00\x3a\x00\xff\xff\x3c\x00\x3d\x00\x3e\x00\x3f\x00\xff\xff\x41\x00\x42\x00\x43\x00\x44\x00\x45\x00\x46\x00\x47\x00\x48\x00\x49\x00\x4a\x00\x4b\x00\x4c\x00\x4d\x00\x4e\x00\x4f\x00\x50\x00\x51\x00\x52\x00\x53\x00\x54\x00\x55\x00\x56\x00\x57\x00\x58\x00\x59\x00\x5a\x00\x5b\x00\x5c\x00\x5d\x00\x5e\x00\x5f\x00\x60\x00\x61\x00\x62\x00\x63\x00\x64\x00\x65\x00\x66\x00\x67\x00\x68\x00\x69\x00\x6a\x00\x6b\x00\x6c\x00\x6d\x00\x6e\x00\x6f\x00\x70\x00\x71\x00\x72\x00\x73\x00\x74\x00\x75\x00\x76\x00\x77\x00\x78\x00\x79\x00\x7a\x00\x7b\x00\x7c\x00\xff\xff\x7e\x00\x09\x00\x0a\x00\x0b\x00\x0c\x00\x0d\x00\x21\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x2d\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x20\x00\xff\xff\x21\x00\x23\x00\x23\x00\x24\x00\x25\x00\x26\x00\x27\x00\xff\xff\xff\xff\x2a\x00\x2b\x00\x2c\x00\x2d\x00\xff\xff\x2f\x00\x30\x00\x31\x00\x32\x00\x33\x00\x34\x00\x35\x00\x36\x00\x37\x00\x38\x00\x39\x00\x3a\x00\xff\xff\x3c\x00\x3d\x00\x3e\x00\x3f\x00\xff\xff\x42\x00\x43\x00\xff\xff\x45\x00\xff\xff\xff\xff\xff\xff\x49\x00\xff\xff\xff\xff\x4c\x00\x4d\x00\x4e\x00\x4f\x00\xff\xff\xff\xff\x52\x00\x53\x00\x54\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x5b\x00\x5c\x00\x5d\x00\x5e\x00\xff\xff\x60\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x7b\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x7b\x00\xff\xff\x7c\x00\xff\xff\x7e\x00\x80\x00\x81\x00\x82\x00\x83\x00\x84\x00\x85\x00\x86\x00\x87\x00\x88\x00\x89\x00\x8a\x00\x8b\x00\x8c\x00\x8d\x00\x8e\x00\x8f\x00\x90\x00\x91\x00\x92\x00\x93\x00\x94\x00\x95\x00\x96\x00\x97\x00\x98\x00\x99\x00\x9a\x00\x9b\x00\x9c\x00\x9d\x00\x9e\x00\x9f\x00\xa0\x00\xa1\x00\xa2\x00\xa3\x00\xa4\x00\xa5\x00\xa6\x00\xa7\x00\xa8\x00\xa9\x00\xaa\x00\xab\x00\xac\x00\xad\x00\xae\x00\xaf\x00\xb0\x00\xb1\x00\xb2\x00\xb3\x00\xb4\x00\xb5\x00\xb6\x00\xb7\x00\xb8\x00\xb9\x00\xba\x00\xbb\x00\xbc\x00\xbd\x00\xbe\x00\xbf\x00\xc0\x00\xc1\x00\xc2\x00\xc3\x00\xc4\x00\xc5\x00\xc6\x00\xc7\x00\xc8\x00\xc9\x00\xca\x00\xcb\x00\xcc\x00\xcd\x00\xce\x00\xcf\x00\xd0\x00\xd1\x00\xd2\x00\xd3\x00\xd4\x00\xd5\x00\xd6\x00\xd7\x00\xd8\x00\xd9\x00\xda\x00\xdb\x00\xdc\x00\xdd\x00\xde\x00\xdf\x00\xe0\x00\xe1\x00\xe2\x00\xe3\x00\xe4\x00\xe5\x00\xe6\x00\xe7\x00\xe8\x00\xe9\x00\xea\x00\xeb\x00\xec\x00\xed\x00\xee\x00\xef\x00\xf0\x00\xf1\x00\xf2\x00\xf3\x00\xf4\x00\xf5\x00\xf6\x00\xf7\x00\xf8\x00\xf9\x00\xfa\x00\xfb\x00\xfc\x00\xfd\x00\xfe\x00\xff\x00\x0a\x00\x0b\x00\x0c\x00\x0d\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x21\x00\xff\xff\x23\x00\x24\x00\x25\x00\x26\x00\x27\x00\xff\xff\xff\xff\x2a\x00\x2b\x00\x2c\x00\x2d\x00\x20\x00\x2f\x00\x30\x00\x31\x00\x32\x00\x33\x00\x34\x00\x35\x00\x36\x00\x37\x00\x38\x00\x39\x00\x3a\x00\xff\xff\x3c\x00\x3d\x00\x3e\x00\x3f\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x5b\x00\x5c\x00\x5d\x00\x5e\x00\xff\xff\x60\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x5c\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x7c\x00\xff\xff\x7e\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x80\x00\x81\x00\x82\x00\x83\x00\x84\x00\x85\x00\x86\x00\x87\x00\x88\x00\x89\x00\x8a\x00\x8b\x00\x8c\x00\x8d\x00\x8e\x00\x8f\x00\x90\x00\x91\x00\x92\x00\x93\x00\x94\x00\x95\x00\x96\x00\x97\x00\x98\x00\x99\x00\x9a\x00\x9b\x00\x9c\x00\x9d\x00\x9e\x00\x9f\x00\xa0\x00\xa1\x00\xa2\x00\xa3\x00\xa4\x00\xa5\x00\xa6\x00\xa7\x00\xa8\x00\xa9\x00\xaa\x00\xab\x00\xac\x00\xad\x00\xae\x00\xaf\x00\xb0\x00\xb1\x00\xb2\x00\xb3\x00\xb4\x00\xb5\x00\xb6\x00\xb7\x00\xb8\x00\xb9\x00\xba\x00\xbb\x00\xbc\x00\xbd\x00\xbe\x00\xbf\x00\xc0\x00\xc1\x00\xc2\x00\xc3\x00\xc4\x00\xc5\x00\xc6\x00\xc7\x00\xc8\x00\xc9\x00\xca\x00\xcb\x00\xcc\x00\xcd\x00\xce\x00\xcf\x00\xd0\x00\xd1\x00\xd2\x00\xd3\x00\xd4\x00\xd5\x00\xd6\x00\xd7\x00\xd8\x00\xd9\x00\xda\x00\xdb\x00\xdc\x00\xdd\x00\xde\x00\xdf\x00\xe0\x00\xe1\x00\xe2\x00\xe3\x00\xe4\x00\xe5\x00\xe6\x00\xe7\x00\xe8\x00\xe9\x00\xea\x00\xeb\x00\xec\x00\xed\x00\xee\x00\xef\x00\xf0\x00\xf1\x00\xf2\x00\xf3\x00\xf4\x00\xf5\x00\xf6\x00\xf7\x00\xf8\x00\xf9\x00\xfa\x00\xfb\x00\xfc\x00\xfd\x00\xfe\x00\xff\x00\x21\x00\xff\xff\x23\x00\x24\x00\x25\x00\x26\x00\x27\x00\xff\xff\xff\xff\x2a\x00\x2b\x00\x2c\x00\x2d\x00\xff\xff\x2f\x00\x30\x00\x31\x00\x32\x00\x33\x00\x34\x00\x35\x00\x36\x00\x37\x00\x38\x00\x39\x00\x3a\x00\xff\xff\x3c\x00\x3d\x00\x3e\x00\x3f\x00\xff\xff\x41\x00\x42\x00\x43\x00\x44\x00\x45\x00\x46\x00\x47\x00\x48\x00\x49\x00\x4a\x00\x4b\x00\x4c\x00\x4d\x00\x4e\x00\x4f\x00\x50\x00\x51\x00\x52\x00\x53\x00\x54\x00\x55\x00\x56\x00\x57\x00\x58\x00\x59\x00\x5a\x00\x5b\x00\x5c\x00\x5d\x00\x5e\x00\x5f\x00\x60\x00\x61\x00\x62\x00\x63\x00\x64\x00\x65\x00\x66\x00\x67\x00\x68\x00\x69\x00\x6a\x00\x6b\x00\x6c\x00\x6d\x00\x6e\x00\x6f\x00\x70\x00\x71\x00\x72\x00\x73\x00\x74\x00\x75\x00\x76\x00\x77\x00\x78\x00\x79\x00\x7a\x00\xff\xff\x7c\x00\x7d\x00\x7e\x00\x21\x00\xff\xff\x23\x00\x24\x00\x25\x00\x26\x00\x27\x00\xff\xff\xff\xff\x2a\x00\x2b\x00\x2c\x00\x2d\x00\xff\xff\x2f\x00\x30\x00\x31\x00\x32\x00\x33\x00\x34\x00\x35\x00\x36\x00\x37\x00\x38\x00\x39\x00\x3a\x00\xff\xff\x3c\x00\x3d\x00\x3e\x00\x3f\x00\xff\xff\x41\x00\x42\x00\x43\x00\x44\x00\x45\x00\x46\x00\x47\x00\x48\x00\x49\x00\x4a\x00\x4b\x00\x4c\x00\x4d\x00\x4e\x00\x4f\x00\x50\x00\x51\x00\x52\x00\x53\x00\x54\x00\x55\x00\x56\x00\x57\x00\x58\x00\x59\x00\x5a\x00\x5b\x00\x5c\x00\x5d\x00\x5e\x00\x5f\x00\x60\x00\x61\x00\x62\x00\x63\x00\x64\x00\x65\x00\x66\x00\x67\x00\x68\x00\x69\x00\x6a\x00\x6b\x00\x6c\x00\x6d\x00\x6e\x00\x6f\x00\x70\x00\x71\x00\x72\x00\x73\x00\x74\x00\x75\x00\x76\x00\x77\x00\x78\x00\x79\x00\x7a\x00\xff\xff\x7c\x00\x7d\x00\x7e\x00\x21\x00\xff\xff\x23\x00\x24\x00\x25\x00\x26\x00\x27\x00\xff\xff\xff\xff\x2a\x00\x2b\x00\x2c\x00\x2d\x00\xff\xff\x2f\x00\x30\x00\x31\x00\x32\x00\x33\x00\x34\x00\x35\x00\x36\x00\x37\x00\x38\x00\x39\x00\x3a\x00\xff\xff\x3c\x00\x3d\x00\x3e\x00\x3f\x00\xff\xff\x41\x00\x42\x00\x43\x00\x44\x00\x45\x00\x46\x00\x47\x00\x48\x00\x49\x00\x4a\x00\x4b\x00\x4c\x00\x4d\x00\x4e\x00\x4f\x00\x50\x00\x51\x00\x52\x00\x53\x00\x54\x00\x55\x00\x56\x00\x57\x00\x58\x00\x59\x00\x5a\x00\x5b\x00\x5c\x00\x5d\x00\x5e\x00\x5f\x00\x60\x00\x61\x00\x62\x00\x63\x00\x64\x00\x65\x00\x66\x00\x67\x00\x68\x00\x69\x00\x6a\x00\x6b\x00\x6c\x00\x6d\x00\x6e\x00\x6f\x00\x70\x00\x71\x00\x72\x00\x73\x00\x74\x00\x75\x00\x76\x00\x77\x00\x78\x00\x79\x00\x7a\x00\xff\xff\x7c\x00\x21\x00\x7e\x00\x23\x00\x24\x00\x25\x00\x26\x00\x27\x00\xff\xff\xff\xff\x2a\x00\x2b\x00\x2c\x00\x2d\x00\xff\xff\x2f\x00\x30\x00\x31\x00\x32\x00\x33\x00\x34\x00\x35\x00\x36\x00\x37\x00\x38\x00\x39\x00\x3a\x00\xff\xff\x3c\x00\x3d\x00\x3e\x00\x3f\x00\xff\xff\x41\x00\x42\x00\x43\x00\x44\x00\x45\x00\x46\x00\x47\x00\x48\x00\x49\x00\x4a\x00\x4b\x00\x4c\x00\x4d\x00\x4e\x00\x4f\x00\x50\x00\x51\x00\x52\x00\x53\x00\x54\x00\x55\x00\x56\x00\x57\x00\x58\x00\x59\x00\x5a\x00\x5b\x00\x5c\x00\x5d\x00\x5e\x00\x5f\x00\x60\x00\x61\x00\x62\x00\x63\x00\x64\x00\x65\x00\x66\x00\x67\x00\x68\x00\x69\x00\x6a\x00\x6b\x00\x6c\x00\x6d\x00\x6e\x00\x6f\x00\x70\x00\x71\x00\x72\x00\x73\x00\x74\x00\x75\x00\x76\x00\x77\x00\x78\x00\x79\x00\x7a\x00\xff\xff\x7c\x00\x21\x00\x7e\x00\x23\x00\x24\x00\x25\x00\x26\x00\xff\xff\xff\xff\xff\xff\x2a\x00\x2b\x00\x2c\x00\x2d\x00\xff\xff\x2f\x00\x30\x00\x31\x00\x32\x00\x33\x00\x34\x00\x35\x00\x36\x00\x37\x00\x38\x00\x39\x00\x3a\x00\xff\xff\x3c\x00\x3d\x00\x3e\x00\x3f\x00\xff\xff\x41\x00\x42\x00\x43\x00\x44\x00\x45\x00\x46\x00\x47\x00\x48\x00\x49\x00\x4a\x00\x4b\x00\x4c\x00\x4d\x00\x4e\x00\x4f\x00\x50\x00\x51\x00\x52\x00\x53\x00\x54\x00\x55\x00\x56\x00\x57\x00\x58\x00\x59\x00\x5a\x00\x5b\x00\x5c\x00\x5d\x00\x5e\x00\x5f\x00\x60\x00\x61\x00\x62\x00\x63\x00\x64\x00\x65\x00\x66\x00\x67\x00\x68\x00\x69\x00\x6a\x00\x6b\x00\x6c\x00\x6d\x00\x6e\x00\x6f\x00\x70\x00\x71\x00\x72\x00\x73\x00\x74\x00\x75\x00\x76\x00\x77\x00\x78\x00\x79\x00\x7a\x00\xff\xff\x7c\x00\xff\xff\x7e\x00\x80\x00\x81\x00\x82\x00\x83\x00\x84\x00\x85\x00\x86\x00\x87\x00\x88\x00\x89\x00\x8a\x00\x8b\x00\x8c\x00\x8d\x00\x8e\x00\x8f\x00\x90\x00\x91\x00\x92\x00\x93\x00\x94\x00\x95\x00\x96\x00\x97\x00\x98\x00\x99\x00\x9a\x00\x9b\x00\x9c\x00\x9d\x00\x9e\x00\x9f\x00\xa0\x00\xa1\x00\xa2\x00\xa3\x00\xa4\x00\xa5\x00\xa6\x00\xa7\x00\xa8\x00\xa9\x00\xaa\x00\xab\x00\xac\x00\xad\x00\xae\x00\xaf\x00\xb0\x00\xb1\x00\xb2\x00\xb3\x00\xb4\x00\xb5\x00\xb6\x00\xb7\x00\xb8\x00\xb9\x00\xba\x00\xbb\x00\xbc\x00\xbd\x00\xbe\x00\xbf\x00\xc0\x00\xc1\x00\xc2\x00\xc3\x00\xc4\x00\xc5\x00\xc6\x00\xc7\x00\xc8\x00\xc9\x00\xca\x00\xcb\x00\xcc\x00\xcd\x00\xce\x00\xcf\x00\xd0\x00\xd1\x00\xd2\x00\xd3\x00\xd4\x00\xd5\x00\xd6\x00\xd7\x00\xd8\x00\xd9\x00\xda\x00\xdb\x00\xdc\x00\xdd\x00\xde\x00\xdf\x00\xe0\x00\xe1\x00\xe2\x00\xe3\x00\xe4\x00\xe5\x00\xe6\x00\xe7\x00\xe8\x00\xe9\x00\xea\x00\xeb\x00\xec\x00\xed\x00\xee\x00\xef\x00\xf0\x00\xf1\x00\xf2\x00\xf3\x00\xf4\x00\xf5\x00\xf6\x00\xf7\x00\xf8\x00\xf9\x00\xfa\x00\xfb\x00\xfc\x00\xfd\x00\xfe\x00\xff\x00\x80\x00\x81\x00\x82\x00\x83\x00\x84\x00\x85\x00\x86\x00\x87\x00\x88\x00\x89\x00\x8a\x00\x8b\x00\x8c\x00\x8d\x00\x8e\x00\x8f\x00\x90\x00\x91\x00\x92\x00\x93\x00\x94\x00\x95\x00\x96\x00\x97\x00\x98\x00\x99\x00\x9a\x00\x9b\x00\x9c\x00\x9d\x00\x9e\x00\x9f\x00\xa0\x00\xa1\x00\xa2\x00\xa3\x00\xa4\x00\xa5\x00\xa6\x00\xa7\x00\xa8\x00\xa9\x00\xaa\x00\xab\x00\xac\x00\xad\x00\xae\x00\xaf\x00\xb0\x00\xb1\x00\xb2\x00\xb3\x00\xb4\x00\xb5\x00\xb6\x00\xb7\x00\xb8\x00\xb9\x00\xba\x00\xbb\x00\xbc\x00\xbd\x00\xbe\x00\xbf\x00\xc0\x00\xc1\x00\xc2\x00\xc3\x00\xc4\x00\xc5\x00\xc6\x00\xc7\x00\xc8\x00\xc9\x00\xca\x00\xcb\x00\xcc\x00\xcd\x00\xce\x00\xcf\x00\xd0\x00\xd1\x00\xd2\x00\xd3\x00\xd4\x00\xd5\x00\xd6\x00\xd7\x00\xd8\x00\xd9\x00\xda\x00\xdb\x00\xdc\x00\xdd\x00\xde\x00\xdf\x00\xe0\x00\xe1\x00\xe2\x00\xe3\x00\xe4\x00\xe5\x00\xe6\x00\xe7\x00\xe8\x00\xe9\x00\xea\x00\xeb\x00\xec\x00\xed\x00\xee\x00\xef\x00\xf0\x00\xf1\x00\xf2\x00\xf3\x00\xf4\x00\xf5\x00\xf6\x00\xf7\x00\xf8\x00\xf9\x00\xfa\x00\xfb\x00\xfc\x00\xfd\x00\xfe\x00\xff\x00\x80\x00\x81\x00\x82\x00\x83\x00\x84\x00\x85\x00\x86\x00\x87\x00\x88\x00\x89\x00\x8a\x00\x8b\x00\x8c\x00\x8d\x00\x8e\x00\x8f\x00\x90\x00\x91\x00\x92\x00\x93\x00\x94\x00\x95\x00\x96\x00\x97\x00\x98\x00\x99\x00\x9a\x00\x9b\x00\x9c\x00\x9d\x00\x9e\x00\x9f\x00\xa0\x00\xa1\x00\xa2\x00\xa3\x00\xa4\x00\xa5\x00\xa6\x00\xa7\x00\xa8\x00\xa9\x00\xaa\x00\xab\x00\xac\x00\xad\x00\xae\x00\xaf\x00\xb0\x00\xb1\x00\xb2\x00\xb3\x00\xb4\x00\xb5\x00\xb6\x00\xb7\x00\xb8\x00\xb9\x00\xba\x00\xbb\x00\xbc\x00\xbd\x00\xbe\x00\xbf\x00\xc0\x00\xc1\x00\xc2\x00\xc3\x00\xc4\x00\xc5\x00\xc6\x00\xc7\x00\xc8\x00\xc9\x00\xca\x00\xcb\x00\xcc\x00\xcd\x00\xce\x00\xcf\x00\xd0\x00\xd1\x00\xd2\x00\xd3\x00\xd4\x00\xd5\x00\xd6\x00\xd7\x00\xd8\x00\xd9\x00\xda\x00\xdb\x00\xdc\x00\xdd\x00\xde\x00\xdf\x00\xe0\x00\xe1\x00\xe2\x00\xe3\x00\xe4\x00\xe5\x00\xe6\x00\xe7\x00\xe8\x00\xe9\x00\xea\x00\xeb\x00\xec\x00\xed\x00\xee\x00\xef\x00\xf0\x00\xf1\x00\xf2\x00\xf3\x00\xf4\x00\xf5\x00\xf6\x00\xf7\x00\xf8\x00\xf9\x00\xfa\x00\xfb\x00\xfc\x00\xfd\x00\xfe\x00\xff\x00\x21\x00\xff\xff\x23\x00\x24\x00\x25\x00\x26\x00\x27\x00\xff\xff\xff\xff\x2a\x00\x2b\x00\x2c\x00\x2d\x00\xff\xff\x2f\x00\x30\x00\x31\x00\x32\x00\x33\x00\x34\x00\x35\x00\x36\x00\x37\x00\x38\x00\x39\x00\x3a\x00\xff\xff\x3c\x00\x3d\x00\x3e\x00\x3f\x00\xff\xff\x41\x00\x42\x00\x43\x00\x44\x00\x45\x00\x46\x00\x47\x00\x48\x00\x49\x00\x4a\x00\x4b\x00\x4c\x00\x4d\x00\x4e\x00\x4f\x00\x50\x00\x51\x00\x52\x00\x53\x00\x54\x00\x55\x00\x56\x00\x57\x00\x58\x00\x59\x00\x5a\x00\x5b\x00\x5c\x00\x5d\x00\x5e\x00\x5f\x00\x60\x00\x61\x00\x62\x00\x63\x00\x64\x00\x65\x00\x66\x00\x67\x00\x68\x00\x69\x00\x6a\x00\x6b\x00\x6c\x00\x6d\x00\x6e\x00\x6f\x00\x70\x00\x71\x00\x72\x00\x73\x00\x74\x00\x75\x00\x76\x00\x77\x00\x78\x00\x79\x00\x7a\x00\xff\xff\x7c\x00\xff\xff\x7e\x00\x80\x00\x81\x00\x82\x00\x83\x00\x84\x00\x85\x00\x86\x00\x87\x00\x88\x00\x89\x00\x8a\x00\x8b\x00\x8c\x00\x8d\x00\x8e\x00\x8f\x00\x90\x00\x91\x00\x92\x00\x93\x00\x94\x00\x95\x00\x96\x00\x97\x00\x98\x00\x99\x00\x9a\x00\x9b\x00\x9c\x00\x9d\x00\x9e\x00\x9f\x00\xa0\x00\xa1\x00\xa2\x00\xa3\x00\xa4\x00\xa5\x00\xa6\x00\xa7\x00\xa8\x00\xa9\x00\xaa\x00\xab\x00\xac\x00\xad\x00\xae\x00\xaf\x00\xb0\x00\xb1\x00\xb2\x00\xb3\x00\xb4\x00\xb5\x00\xb6\x00\xb7\x00\xb8\x00\xb9\x00\xba\x00\xbb\x00\xbc\x00\xbd\x00\xbe\x00\xbf\x00\xc0\x00\xc1\x00\xc2\x00\xc3\x00\xc4\x00\xc5\x00\xc6\x00\xc7\x00\xc8\x00\xc9\x00\xca\x00\xcb\x00\xcc\x00\xcd\x00\xce\x00\xcf\x00\xd0\x00\xd1\x00\xd2\x00\xd3\x00\xd4\x00\xd5\x00\xd6\x00\xd7\x00\xd8\x00\xd9\x00\xda\x00\xdb\x00\xdc\x00\xdd\x00\xde\x00\xdf\x00\xe0\x00\xe1\x00\xe2\x00\xe3\x00\xe4\x00\xe5\x00\xe6\x00\xe7\x00\xe8\x00\xe9\x00\xea\x00\xeb\x00\xec\x00\xed\x00\xee\x00\xef\x00\xf0\x00\xf1\x00\xf2\x00\xf3\x00\xf4\x00\xf5\x00\xf6\x00\xf7\x00\xf8\x00\xf9\x00\xfa\x00\xfb\x00\xfc\x00\xfd\x00\xfe\x00\xff\x00\x80\x00\x81\x00\x82\x00\x83\x00\x84\x00\x85\x00\x86\x00\x87\x00\x88\x00\x89\x00\x8a\x00\x8b\x00\x8c\x00\x8d\x00\x8e\x00\x8f\x00\x90\x00\x91\x00\x92\x00\x93\x00\x94\x00\x95\x00\x96\x00\x97\x00\x98\x00\x99\x00\x9a\x00\x9b\x00\x9c\x00\x9d\x00\x9e\x00\x9f\x00\xa0\x00\xa1\x00\xa2\x00\xa3\x00\xa4\x00\xa5\x00\xa6\x00\xa7\x00\xa8\x00\xa9\x00\xaa\x00\xab\x00\xac\x00\xad\x00\xae\x00\xaf\x00\xb0\x00\xb1\x00\xb2\x00\xb3\x00\xb4\x00\xb5\x00\xb6\x00\xb7\x00\xb8\x00\xb9\x00\xba\x00\xbb\x00\xbc\x00\xbd\x00\xbe\x00\xbf\x00\xc0\x00\xc1\x00\xc2\x00\xc3\x00\xc4\x00\xc5\x00\xc6\x00\xc7\x00\xc8\x00\xc9\x00\xca\x00\xcb\x00\xcc\x00\xcd\x00\xce\x00\xcf\x00\xd0\x00\xd1\x00\xd2\x00\xd3\x00\xd4\x00\xd5\x00\xd6\x00\xd7\x00\xd8\x00\xd9\x00\xda\x00\xdb\x00\xdc\x00\xdd\x00\xde\x00\xdf\x00\xe0\x00\xe1\x00\xe2\x00\xe3\x00\xe4\x00\xe5\x00\xe6\x00\xe7\x00\xe8\x00\xe9\x00\xea\x00\xeb\x00\xec\x00\xed\x00\xee\x00\xef\x00\xf0\x00\xf1\x00\xf2\x00\xf3\x00\xf4\x00\xf5\x00\xf6\x00\xf7\x00\xf8\x00\xf9\x00\xfa\x00\xfb\x00\xfc\x00\xfd\x00\xfe\x00\xff\x00\x80\x00\x81\x00\x82\x00\x83\x00\x84\x00\x85\x00\x86\x00\x87\x00\x88\x00\x89\x00\x8a\x00\x8b\x00\x8c\x00\x8d\x00\x8e\x00\x8f\x00\x90\x00\x91\x00\x92\x00\x93\x00\x94\x00\x95\x00\x96\x00\x97\x00\x98\x00\x99\x00\x9a\x00\x9b\x00\x9c\x00\x9d\x00\x9e\x00\x9f\x00\xa0\x00\xa1\x00\xa2\x00\xa3\x00\xa4\x00\xa5\x00\xa6\x00\xa7\x00\xa8\x00\xa9\x00\xaa\x00\xab\x00\xac\x00\xad\x00\xae\x00\xaf\x00\xb0\x00\xb1\x00\xb2\x00\xb3\x00\xb4\x00\xb5\x00\xb6\x00\xb7\x00\xb8\x00\xb9\x00\xba\x00\xbb\x00\xbc\x00\xbd\x00\xbe\x00\xbf\x00\xc0\x00\xc1\x00\xc2\x00\xc3\x00\xc4\x00\xc5\x00\xc6\x00\xc7\x00\xc8\x00\xc9\x00\xca\x00\xcb\x00\xcc\x00\xcd\x00\xce\x00\xcf\x00\xd0\x00\xd1\x00\xd2\x00\xd3\x00\xd4\x00\xd5\x00\xd6\x00\xd7\x00\xd8\x00\xd9\x00\xda\x00\xdb\x00\xdc\x00\xdd\x00\xde\x00\xdf\x00\xe0\x00\xe1\x00\xe2\x00\xe3\x00\xe4\x00\xe5\x00\xe6\x00\xe7\x00\xe8\x00\xe9\x00\xea\x00\xeb\x00\xec\x00\xed\x00\xee\x00\xef\x00\xf0\x00\xf1\x00\xf2\x00\xf3\x00\xf4\x00\xf5\x00\xf6\x00\xf7\x00\xf8\x00\xf9\x00\xfa\x00\xfb\x00\xfc\x00\xfd\x00\xfe\x00\xff\x00\x80\x00\x81\x00\x82\x00\x83\x00\x84\x00\x85\x00\x86\x00\x87\x00\x88\x00\x89\x00\x8a\x00\x8b\x00\x8c\x00\x8d\x00\x8e\x00\x8f\x00\x90\x00\x91\x00\x92\x00\x93\x00\x94\x00\x95\x00\x96\x00\x97\x00\x98\x00\x99\x00\x9a\x00\x9b\x00\x9c\x00\x9d\x00\x9e\x00\x9f\x00\xa0\x00\xa1\x00\xa2\x00\xa3\x00\xa4\x00\xa5\x00\xa6\x00\xa7\x00\xa8\x00\xa9\x00\xaa\x00\xab\x00\xac\x00\xad\x00\xae\x00\xaf\x00\xb0\x00\xb1\x00\xb2\x00\xb3\x00\xb4\x00\xb5\x00\xb6\x00\xb7\x00\xb8\x00\xb9\x00\xba\x00\xbb\x00\xbc\x00\xbd\x00\xbe\x00\xbf\x00\xc0\x00\xc1\x00\xc2\x00\xc3\x00\xc4\x00\xc5\x00\xc6\x00\xc7\x00\xc8\x00\xc9\x00\xca\x00\xcb\x00\xcc\x00\xcd\x00\xce\x00\xcf\x00\xd0\x00\xd1\x00\xd2\x00\xd3\x00\xd4\x00\xd5\x00\xd6\x00\xd7\x00\xd8\x00\xd9\x00\xda\x00\xdb\x00\xdc\x00\xdd\x00\xde\x00\xdf\x00\xe0\x00\xe1\x00\xe2\x00\xe3\x00\xe4\x00\xe5\x00\xe6\x00\xe7\x00\xe8\x00\xe9\x00\xea\x00\xeb\x00\xec\x00\xed\x00\xee\x00\xef\x00\xf0\x00\xf1\x00\xf2\x00\xf3\x00\xf4\x00\xf5\x00\xf6\x00\xf7\x00\xf8\x00\xf9\x00\xfa\x00\xfb\x00\xfc\x00\xfd\x00\xfe\x00\xff\x00\x21\x00\xff\xff\x23\x00\x24\x00\x25\x00\x26\x00\x27\x00\xff\xff\xff\xff\x2a\x00\x2b\x00\x2c\x00\x2d\x00\xff\xff\x2f\x00\x30\x00\x31\x00\x32\x00\x33\x00\x34\x00\x35\x00\x36\x00\x37\x00\x38\x00\x39\x00\x3a\x00\xff\xff\x3c\x00\x3d\x00\x3e\x00\x3f\x00\xff\xff\x41\x00\x42\x00\x43\x00\x44\x00\x45\x00\x46\x00\x47\x00\x48\x00\x49\x00\x4a\x00\x4b\x00\x4c\x00\x4d\x00\x4e\x00\x4f\x00\x50\x00\x51\x00\x52\x00\x53\x00\x54\x00\x55\x00\x56\x00\x57\x00\x58\x00\x59\x00\x5a\x00\x5b\x00\x5c\x00\x5d\x00\x5e\x00\x5f\x00\x60\x00\x61\x00\x62\x00\x63\x00\x64\x00\x65\x00\x66\x00\x67\x00\x68\x00\x69\x00\x6a\x00\x6b\x00\x6c\x00\x6d\x00\x6e\x00\x6f\x00\x70\x00\x71\x00\x72\x00\x73\x00\x74\x00\x75\x00\x76\x00\x77\x00\x78\x00\x79\x00\x7a\x00\xff\xff\x7c\x00\x21\x00\x7e\x00\x23\x00\x24\x00\x25\x00\x26\x00\x27\x00\xff\xff\xff\xff\x2a\x00\x2b\x00\x2c\x00\x2d\x00\xff\xff\x2f\x00\x30\x00\x31\x00\x32\x00\x33\x00\x34\x00\x35\x00\x36\x00\x37\x00\x38\x00\x39\x00\x3a\x00\xff\xff\x3c\x00\x3d\x00\x3e\x00\x3f\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x5b\x00\x5c\x00\x5d\x00\x5e\x00\xff\xff\x60\x00\xff\xff\xff\xff\xff\xff\xff\xff\x65\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x7c\x00\x21\x00\x7e\x00\x23\x00\x24\x00\x25\x00\x26\x00\x27\x00\xff\xff\xff\xff\x2a\x00\x2b\x00\x2c\x00\x2d\x00\xff\xff\x2f\x00\x30\x00\x31\x00\x32\x00\x33\x00\x34\x00\x35\x00\x36\x00\x37\x00\x38\x00\x39\x00\x3a\x00\xff\xff\x3c\x00\x3d\x00\x3e\x00\x3f\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x5b\x00\x5c\x00\x5d\x00\x5e\x00\xff\xff\x60\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x7c\x00\xff\xff\x7e\x00\x80\x00\x81\x00\x82\x00\x83\x00\x84\x00\x85\x00\x86\x00\x87\x00\x88\x00\x89\x00\x8a\x00\x8b\x00\x8c\x00\x8d\x00\x8e\x00\x8f\x00\x90\x00\x91\x00\x92\x00\x93\x00\x94\x00\x95\x00\x96\x00\x97\x00\x98\x00\x99\x00\x9a\x00\x9b\x00\x9c\x00\x9d\x00\x9e\x00\x9f\x00\xa0\x00\xa1\x00\xa2\x00\xa3\x00\xa4\x00\xa5\x00\xa6\x00\xa7\x00\xa8\x00\xa9\x00\xaa\x00\xab\x00\xac\x00\xad\x00\xae\x00\xaf\x00\xb0\x00\xb1\x00\xb2\x00\xb3\x00\xb4\x00\xb5\x00\xb6\x00\xb7\x00\xb8\x00\xb9\x00\xba\x00\xbb\x00\xbc\x00\xbd\x00\xbe\x00\xbf\x00\xc0\x00\xc1\x00\xc2\x00\xc3\x00\xc4\x00\xc5\x00\xc6\x00\xc7\x00\xc8\x00\xc9\x00\xca\x00\xcb\x00\xcc\x00\xcd\x00\xce\x00\xcf\x00\xd0\x00\xd1\x00\xd2\x00\xd3\x00\xd4\x00\xd5\x00\xd6\x00\xd7\x00\xd8\x00\xd9\x00\xda\x00\xdb\x00\xdc\x00\xdd\x00\xde\x00\xdf\x00\xe0\x00\xe1\x00\xe2\x00\xe3\x00\xe4\x00\xe5\x00\xe6\x00\xe7\x00\xe8\x00\xe9\x00\xea\x00\xeb\x00\xec\x00\xed\x00\xee\x00\xef\x00\xf0\x00\xf1\x00\xf2\x00\xf3\x00\xf4\x00\xf5\x00\xf6\x00\xf7\x00\xf8\x00\xf9\x00\xfa\x00\xfb\x00\xfc\x00\xfd\x00\xfe\x00\xff\x00\x8f\x00\x90\x00\x91\x00\x92\x00\x93\x00\x94\x00\x95\x00\x96\x00\x97\x00\x98\x00\x99\x00\x9a\x00\x9b\x00\x9c\x00\x9d\x00\x9e\x00\x9f\x00\xa0\x00\xa1\x00\xa2\x00\xa3\x00\xa4\x00\xa5\x00\xa6\x00\xa7\x00\xa8\x00\xa9\x00\xaa\x00\xab\x00\xac\x00\xad\x00\xae\x00\xaf\x00\xb0\x00\xb1\x00\xb2\x00\xb3\x00\xb4\x00\xb5\x00\xb6\x00\xb7\x00\xb8\x00\xb9\x00\xba\x00\xbb\x00\xbc\x00\xbd\x00\xbe\x00\xbf\x00\xc0\x00\xc1\x00\xc2\x00\xc3\x00\xc4\x00\xc5\x00\xc6\x00\xc7\x00\xc8\x00\xc9\x00\xca\x00\xcb\x00\xcc\x00\xcd\x00\xce\x00\xcf\x00\xd0\x00\xd1\x00\xd2\x00\xd3\x00\xd4\x00\xd5\x00\xd6\x00\xd7\x00\xd8\x00\xd9\x00\xda\x00\xdb\x00\xdc\x00\xdd\x00\xde\x00\xdf\x00\xe0\x00\xe1\x00\xe2\x00\xe3\x00\xe4\x00\xe5\x00\xe6\x00\xe7\x00\xe8\x00\xe9\x00\xea\x00\xeb\x00\xec\x00\xed\x00\xee\x00\xef\x00\xf0\x00\xf1\x00\xf2\x00\xf3\x00\xf4\x00\xf5\x00\xf6\x00\xf7\x00\xf8\x00\xf9\x00\xfa\x00\xfb\x00\xfc\x00\xfd\x00\xfe\x00\xff\x00\x8f\x00\x90\x00\x91\x00\x92\x00\x93\x00\x94\x00\x95\x00\x96\x00\x97\x00\x98\x00\x99\x00\x9a\x00\x9b\x00\x9c\x00\x9d\x00\x9e\x00\x9f\x00\xa0\x00\xa1\x00\xa2\x00\xa3\x00\xa4\x00\xa5\x00\xa6\x00\xa7\x00\xa8\x00\xa9\x00\xaa\x00\xab\x00\xac\x00\xad\x00\xae\x00\xaf\x00\xb0\x00\xb1\x00\xb2\x00\xb3\x00\xb4\x00\xb5\x00\xb6\x00\xb7\x00\xb8\x00\xb9\x00\xba\x00\xbb\x00\xbc\x00\xbd\x00\xbe\x00\xbf\x00\xc0\x00\xc1\x00\xc2\x00\xc3\x00\xc4\x00\xc5\x00\xc6\x00\xc7\x00\xc8\x00\xc9\x00\xca\x00\xcb\x00\xcc\x00\xcd\x00\xce\x00\xcf\x00\xd0\x00\xd1\x00\xd2\x00\xd3\x00\xd4\x00\xd5\x00\xd6\x00\xd7\x00\xd8\x00\xd9\x00\xda\x00\xdb\x00\xdc\x00\xdd\x00\xde\x00\xdf\x00\xe0\x00\xe1\x00\xe2\x00\xe3\x00\xe4\x00\xe5\x00\xe6\x00\xe7\x00\xe8\x00\xe9\x00\xea\x00\xeb\x00\xec\x00\xed\x00\xee\x00\xef\x00\xf0\x00\xf1\x00\xf2\x00\xf3\x00\xf4\x00\xf5\x00\xf6\x00\xf7\x00\xf8\x00\xf9\x00\xfa\x00\xfb\x00\xfc\x00\xfd\x00\xfe\x00\xff\x00\x8f\x00\x90\x00\x91\x00\x92\x00\x93\x00\x94\x00\x95\x00\x96\x00\x97\x00\x98\x00\x99\x00\x9a\x00\x9b\x00\x9c\x00\x9d\x00\x9e\x00\x9f\x00\xa0\x00\xa1\x00\xa2\x00\xa3\x00\xa4\x00\xa5\x00\xa6\x00\xa7\x00\xa8\x00\xa9\x00\xaa\x00\xab\x00\xac\x00\xad\x00\xae\x00\xaf\x00\xb0\x00\xb1\x00\xb2\x00\xb3\x00\xb4\x00\xb5\x00\xb6\x00\xb7\x00\xb8\x00\xb9\x00\xba\x00\xbb\x00\xbc\x00\xbd\x00\xbe\x00\xbf\x00\xc0\x00\xc1\x00\xc2\x00\xc3\x00\xc4\x00\xc5\x00\xc6\x00\xc7\x00\xc8\x00\xc9\x00\xca\x00\xcb\x00\xcc\x00\xcd\x00\xce\x00\xcf\x00\xd0\x00\xd1\x00\xd2\x00\xd3\x00\xd4\x00\xd5\x00\xd6\x00\xd7\x00\xd8\x00\xd9\x00\xda\x00\xdb\x00\xdc\x00\xdd\x00\xde\x00\xdf\x00\xe0\x00\xe1\x00\xe2\x00\xe3\x00\xe4\x00\xe5\x00\xe6\x00\xe7\x00\xe8\x00\xe9\x00\xea\x00\xeb\x00\xec\x00\xed\x00\xee\x00\xef\x00\xf0\x00\xf1\x00\xf2\x00\xf3\x00\xf4\x00\xf5\x00\xf6\x00\xf7\x00\xf8\x00\xf9\x00\xfa\x00\xfb\x00\xfc\x00\xfd\x00\xfe\x00\xff\x00\x8f\x00\x90\x00\x91\x00\x92\x00\x93\x00\x94\x00\x95\x00\x96\x00\x97\x00\x98\x00\x99\x00\x9a\x00\x9b\x00\x9c\x00\x9d\x00\x9e\x00\x9f\x00\xa0\x00\xa1\x00\xa2\x00\xa3\x00\xa4\x00\xa5\x00\xa6\x00\xa7\x00\xa8\x00\xa9\x00\xaa\x00\xab\x00\xac\x00\xad\x00\xae\x00\xaf\x00\xb0\x00\xb1\x00\xb2\x00\xb3\x00\xb4\x00\xb5\x00\xb6\x00\xb7\x00\xb8\x00\xb9\x00\xba\x00\xbb\x00\xbc\x00\xbd\x00\xbe\x00\xbf\x00\xc0\x00\xc1\x00\xc2\x00\xc3\x00\xc4\x00\xc5\x00\xc6\x00\xc7\x00\xc8\x00\xc9\x00\xca\x00\xcb\x00\xcc\x00\xcd\x00\xce\x00\xcf\x00\xd0\x00\xd1\x00\xd2\x00\xd3\x00\xd4\x00\xd5\x00\xd6\x00\xd7\x00\xd8\x00\xd9\x00\xda\x00\xdb\x00\xdc\x00\xdd\x00\xde\x00\xdf\x00\xe0\x00\xe1\x00\xe2\x00\xe3\x00\xe4\x00\xe5\x00\xe6\x00\xe7\x00\xe8\x00\xe9\x00\xea\x00\xeb\x00\xec\x00\xed\x00\xee\x00\xef\x00\xf0\x00\xf1\x00\xf2\x00\xf3\x00\xf4\x00\xf5\x00\xf6\x00\xf7\x00\xf8\x00\xf9\x00\xfa\x00\xfb\x00\xfc\x00\xfd\x00\xfe\x00\xff\x00\xbf\x00\xc0\x00\xc1\x00\xc2\x00\xc3\x00\xc4\x00\xc5\x00\xc6\x00\xc7\x00\xc8\x00\xc9\x00\xca\x00\xcb\x00\xcc\x00\xcd\x00\xce\x00\xcf\x00\xd0\x00\xd1\x00\xd2\x00\xd3\x00\xd4\x00\xd5\x00\xd6\x00\xd7\x00\xd8\x00\xd9\x00\xda\x00\xdb\x00\xdc\x00\xdd\x00\xde\x00\xdf\x00\xe0\x00\xe1\x00\xe2\x00\xe3\x00\xe4\x00\xe5\x00\xe6\x00\xe7\x00\xe8\x00\xe9\x00\xea\x00\xeb\x00\xec\x00\xed\x00\xee\x00\xef\x00\xf0\x00\xf1\x00\xf2\x00\xf3\x00\xf4\x00\xf5\x00\xf6\x00\xf7\x00\xf8\x00\xf9\x00\xfa\x00\xfb\x00\xfc\x00\xfd\x00\xfe\x00\xff\x00\xbf\x00\xc0\x00\xc1\x00\xc2\x00\xc3\x00\xc4\x00\xc5\x00\xc6\x00\xc7\x00\xc8\x00\xc9\x00\xca\x00\xcb\x00\xcc\x00\xcd\x00\xce\x00\xcf\x00\xd0\x00\xd1\x00\xd2\x00\xd3\x00\xd4\x00\xd5\x00\xd6\x00\xd7\x00\xd8\x00\xd9\x00\xda\x00\xdb\x00\xdc\x00\xdd\x00\xde\x00\xdf\x00\xe0\x00\xe1\x00\xe2\x00\xe3\x00\xe4\x00\xe5\x00\xe6\x00\xe7\x00\xe8\x00\xe9\x00\xea\x00\xeb\x00\xec\x00\xed\x00\xee\x00\xef\x00\xf0\x00\xf1\x00\xf2\x00\xf3\x00\xf4\x00\xf5\x00\xf6\x00\xf7\x00\xf8\x00\xf9\x00\xfa\x00\xfb\x00\xfc\x00\xfd\x00\xfe\x00\xff\x00\xbf\x00\xc0\x00\xc1\x00\xc2\x00\xc3\x00\xc4\x00\xc5\x00\xc6\x00\xc7\x00\xc8\x00\xc9\x00\xca\x00\xcb\x00\xcc\x00\xcd\x00\xce\x00\xcf\x00\xd0\x00\xd1\x00\xd2\x00\xd3\x00\xd4\x00\xd5\x00\xd6\x00\xd7\x00\xd8\x00\xd9\x00\xda\x00\xdb\x00\xdc\x00\xdd\x00\xde\x00\xdf\x00\xe0\x00\xe1\x00\xe2\x00\xe3\x00\xe4\x00\xe5\x00\xe6\x00\xe7\x00\xe8\x00\xe9\x00\xea\x00\xeb\x00\xec\x00\xed\x00\xee\x00\xef\x00\xf0\x00\xf1\x00\xf2\x00\xf3\x00\xf4\x00\xf5\x00\xf6\x00\xf7\x00\xf8\x00\xf9\x00\xfa\x00\xfb\x00\xfc\x00\xfd\x00\xfe\x00\xff\x00\xbf\x00\xc0\x00\xc1\x00\xc2\x00\xc3\x00\xc4\x00\xc5\x00\xc6\x00\xc7\x00\xc8\x00\xc9\x00\xca\x00\xcb\x00\xcc\x00\xcd\x00\xce\x00\xcf\x00\xd0\x00\xd1\x00\xd2\x00\xd3\x00\xd4\x00\xd5\x00\xd6\x00\xd7\x00\xd8\x00\xd9\x00\xda\x00\xdb\x00\xdc\x00\xdd\x00\xde\x00\xdf\x00\xe0\x00\xe1\x00\xe2\x00\xe3\x00\xe4\x00\xe5\x00\xe6\x00\xe7\x00\xe8\x00\xe9\x00\xea\x00\xeb\x00\xec\x00\xed\x00\xee\x00\xef\x00\xf0\x00\xf1\x00\xf2\x00\xf3\x00\xf4\x00\xf5\x00\xf6\x00\xf7\x00\xf8\x00\xf9\x00\xfa\x00\xfb\x00\xfc\x00\xfd\x00\xfe\x00\xff\x00\x21\x00\xff\xff\x23\x00\x24\x00\x25\x00\x26\x00\xff\xff\xff\xff\xff\xff\x2a\x00\x2b\x00\x2c\x00\x2d\x00\xff\xff\x2f\x00\x30\x00\x31\x00\x32\x00\x33\x00\x34\x00\x35\x00\x36\x00\x37\x00\x38\x00\x39\x00\x3a\x00\xff\xff\x3c\x00\x3d\x00\x3e\x00\x3f\x00\xff\xff\x41\x00\x42\x00\x43\x00\x44\x00\x45\x00\x46\x00\x47\x00\x48\x00\x49\x00\x4a\x00\x4b\x00\x4c\x00\x4d\x00\x4e\x00\x4f\x00\x50\x00\x51\x00\x52\x00\x53\x00\x54\x00\x55\x00\x56\x00\x57\x00\x58\x00\x59\x00\x5a\x00\x5b\x00\x5c\x00\x5d\x00\x5e\x00\x5f\x00\x60\x00\x61\x00\x62\x00\x63\x00\x64\x00\x65\x00\x66\x00\x67\x00\x68\x00\x69\x00\x6a\x00\x6b\x00\x6c\x00\x6d\x00\x6e\x00\x6f\x00\x70\x00\x71\x00\x72\x00\x73\x00\x74\x00\x75\x00\x76\x00\x77\x00\x78\x00\x79\x00\x7a\x00\xff\xff\x7c\x00\xff\xff\x7e\x00\x00\x00\x01\x00\x02\x00\x03\x00\x04\x00\x05\x00\x06\x00\x07\x00\x08\x00\x09\x00\x0a\x00\x0b\x00\x0c\x00\x0d\x00\x0e\x00\x0f\x00\x10\x00\x11\x00\x12\x00\x13\x00\x14\x00\x15\x00\x16\x00\x17\x00\x18\x00\x19\x00\x1a\x00\x1b\x00\x1c\x00\x1d\x00\x1e\x00\x1f\x00\x20\x00\x21\x00\x22\x00\x23\x00\x24\x00\x25\x00\x26\x00\x27\x00\x28\x00\x29\x00\x2a\x00\x2b\x00\x2c\x00\x2d\x00\x2e\x00\x2f\x00\x30\x00\x31\x00\x32\x00\x33\x00\x34\x00\x35\x00\x36\x00\x37\x00\x38\x00\x39\x00\x3a\x00\x3b\x00\x3c\x00\x3d\x00\x3e\x00\x3f\x00\x40\x00\x41\x00\x42\x00\x43\x00\x44\x00\x45\x00\x46\x00\x47\x00\x48\x00\x49\x00\x4a\x00\x4b\x00\x4c\x00\x4d\x00\x4e\x00\x4f\x00\x50\x00\x51\x00\x52\x00\x53\x00\x54\x00\x55\x00\x56\x00\x57\x00\x58\x00\x59\x00\x5a\x00\x5b\x00\x5c\x00\x5d\x00\x5e\x00\x5f\x00\x60\x00\x61\x00\x62\x00\x63\x00\x64\x00\x65\x00\x66\x00\x67\x00\x68\x00\x69\x00\x6a\x00\x6b\x00\x6c\x00\x6d\x00\x6e\x00\x6f\x00\x70\x00\x71\x00\x72\x00\x73\x00\x74\x00\x75\x00\x76\x00\x77\x00\x78\x00\x79\x00\x7a\x00\x7b\x00\x7c\x00\x7d\x00\x7e\x00\x7f\x00\xc0\x00\xc1\x00\xc2\x00\xc3\x00\xc4\x00\xc5\x00\xc6\x00\xc7\x00\xc8\x00\xc9\x00\xca\x00\xcb\x00\xcc\x00\xcd\x00\xce\x00\xcf\x00\xd0\x00\xd1\x00\xd2\x00\xd3\x00\xd4\x00\xd5\x00\xd6\x00\xd7\x00\xd8\x00\xd9\x00\xda\x00\xdb\x00\xdc\x00\xdd\x00\xde\x00\xdf\x00\xe0\x00\xe1\x00\xe2\x00\xe3\x00\xe4\x00\xe5\x00\xe6\x00\xe7\x00\xe8\x00\xe9\x00\xea\x00\xeb\x00\xec\x00\xed\x00\xee\x00\xef\x00\xf0\x00\xf1\x00\xf2\x00\xf3\x00\xf4\x00\xf5\x00\xf6\x00\xf7\x00\xf8\x00\xf9\x00\xfa\x00\xfb\x00\xfc\x00\xfd\x00\xfe\x00\xff\x00\x00\x00\x01\x00\x02\x00\x03\x00\x04\x00\x05\x00\x06\x00\x07\x00\x08\x00\x09\x00\x0a\x00\x0b\x00\x0c\x00\x0d\x00\x0e\x00\x0f\x00\x10\x00\x11\x00\x12\x00\x13\x00\x14\x00\x15\x00\x16\x00\x17\x00\x18\x00\x19\x00\x1a\x00\x1b\x00\x1c\x00\x1d\x00\x1e\x00\x1f\x00\x20\x00\x21\x00\x22\x00\x23\x00\x24\x00\x25\x00\x26\x00\x27\x00\x28\x00\x29\x00\x2a\x00\x2b\x00\x2c\x00\x2d\x00\x2e\x00\x2f\x00\x30\x00\x31\x00\x32\x00\x33\x00\x34\x00\x35\x00\x36\x00\x37\x00\x38\x00\x39\x00\x3a\x00\x3b\x00\x3c\x00\x3d\x00\x3e\x00\x3f\x00\x40\x00\x41\x00\x42\x00\x43\x00\x44\x00\x45\x00\x46\x00\x47\x00\x48\x00\x49\x00\x4a\x00\x4b\x00\x4c\x00\x4d\x00\x4e\x00\x4f\x00\x50\x00\x51\x00\x52\x00\x53\x00\x54\x00\x55\x00\x56\x00\x57\x00\x58\x00\x59\x00\x5a\x00\x5b\x00\x5c\x00\x5d\x00\x5e\x00\x5f\x00\x60\x00\x61\x00\x62\x00\x63\x00\x64\x00\x65\x00\x66\x00\x67\x00\x68\x00\x69\x00\x6a\x00\x6b\x00\x6c\x00\x6d\x00\x6e\x00\x6f\x00\x70\x00\x71\x00\x72\x00\x73\x00\x74\x00\x75\x00\x76\x00\x77\x00\x78\x00\x79\x00\x7a\x00\x7b\x00\x7c\x00\x7d\x00\x7e\x00\x7f\x00\xc0\x00\xc1\x00\xc2\x00\xc3\x00\xc4\x00\xc5\x00\xc6\x00\xc7\x00\xc8\x00\xc9\x00\xca\x00\xcb\x00\xcc\x00\xcd\x00\xce\x00\xcf\x00\xd0\x00\xd1\x00\xd2\x00\xd3\x00\xd4\x00\xd5\x00\xd6\x00\xd7\x00\xd8\x00\xd9\x00\xda\x00\xdb\x00\xdc\x00\xdd\x00\xde\x00\xdf\x00\xe0\x00\xe1\x00\xe2\x00\xe3\x00\xe4\x00\xe5\x00\xe6\x00\xe7\x00\xe8\x00\xe9\x00\xea\x00\xeb\x00\xec\x00\xed\x00\xee\x00\xef\x00\xf0\x00\xf1\x00\xf2\x00\xf3\x00\xf4\x00\xf5\x00\xf6\x00\xf7\x00\xf8\x00\xf9\x00\xfa\x00\xfb\x00\xfc\x00\xfd\x00\xfe\x00\xff\x00\x00\x00\x01\x00\x02\x00\x03\x00\x04\x00\x05\x00\x06\x00\x07\x00\x08\x00\x09\x00\x0a\x00\x0b\x00\x0c\x00\x0d\x00\x0e\x00\x0f\x00\x10\x00\x11\x00\x12\x00\x13\x00\x14\x00\x15\x00\x16\x00\x17\x00\x18\x00\x19\x00\x1a\x00\x1b\x00\x1c\x00\x1d\x00\x1e\x00\x1f\x00\x20\x00\x21\x00\x22\x00\x23\x00\x24\x00\x25\x00\x26\x00\x27\x00\x28\x00\x29\x00\x2a\x00\x2b\x00\x2c\x00\x2d\x00\x2e\x00\x2f\x00\x30\x00\x31\x00\x32\x00\x33\x00\x34\x00\x35\x00\x36\x00\x37\x00\x38\x00\x39\x00\x3a\x00\x3b\x00\x3c\x00\x3d\x00\x3e\x00\x3f\x00\x40\x00\x41\x00\x42\x00\x43\x00\x44\x00\x45\x00\x46\x00\x47\x00\x48\x00\x49\x00\x4a\x00\x4b\x00\x4c\x00\x4d\x00\x4e\x00\x4f\x00\x50\x00\x51\x00\x52\x00\x53\x00\x54\x00\x55\x00\x56\x00\x57\x00\x58\x00\x59\x00\x5a\x00\x5b\x00\x5c\x00\x5d\x00\x5e\x00\x5f\x00\x60\x00\x61\x00\x62\x00\x63\x00\x64\x00\x65\x00\x66\x00\x67\x00\x68\x00\x69\x00\x6a\x00\x6b\x00\x6c\x00\x6d\x00\x6e\x00\x6f\x00\x70\x00\x71\x00\x72\x00\x73\x00\x74\x00\x75\x00\x76\x00\x77\x00\x78\x00\x79\x00\x7a\x00\x7b\x00\x7c\x00\x7d\x00\x7e\x00\x7f\x00\xc0\x00\xc1\x00\xc2\x00\xc3\x00\xc4\x00\xc5\x00\xc6\x00\xc7\x00\xc8\x00\xc9\x00\xca\x00\xcb\x00\xcc\x00\xcd\x00\xce\x00\xcf\x00\xd0\x00\xd1\x00\xd2\x00\xd3\x00\xd4\x00\xd5\x00\xd6\x00\xd7\x00\xd8\x00\xd9\x00\xda\x00\xdb\x00\xdc\x00\xdd\x00\xde\x00\xdf\x00\xe0\x00\xe1\x00\xe2\x00\xe3\x00\xe4\x00\xe5\x00\xe6\x00\xe7\x00\xe8\x00\xe9\x00\xea\x00\xeb\x00\xec\x00\xed\x00\xee\x00\xef\x00\xf0\x00\xf1\x00\xf2\x00\xf3\x00\xf4\x00\xf5\x00\xf6\x00\xf7\x00\xf8\x00\xf9\x00\xfa\x00\xfb\x00\xfc\x00\xfd\x00\xfe\x00\xff\x00\x00\x00\x01\x00\x02\x00\x03\x00\x04\x00\x05\x00\x06\x00\x07\x00\x08\x00\x09\x00\x0a\x00\x0b\x00\x0c\x00\x0d\x00\x0e\x00\x0f\x00\x10\x00\x11\x00\x12\x00\x13\x00\x14\x00\x15\x00\x16\x00\x17\x00\x18\x00\x19\x00\x1a\x00\x1b\x00\x1c\x00\x1d\x00\x1e\x00\x1f\x00\x20\x00\x21\x00\x22\x00\x23\x00\x24\x00\x25\x00\x26\x00\x27\x00\x28\x00\x29\x00\x2a\x00\x2b\x00\x2c\x00\x2d\x00\x2e\x00\x2f\x00\x30\x00\x31\x00\x32\x00\x33\x00\x34\x00\x35\x00\x36\x00\x37\x00\x38\x00\x39\x00\x3a\x00\x3b\x00\x3c\x00\x3d\x00\x3e\x00\x3f\x00\x40\x00\x41\x00\x42\x00\x43\x00\x44\x00\x45\x00\x46\x00\x47\x00\x48\x00\x49\x00\x4a\x00\x4b\x00\x4c\x00\x4d\x00\x4e\x00\x4f\x00\x50\x00\x51\x00\x52\x00\x53\x00\x54\x00\x55\x00\x56\x00\x57\x00\x58\x00\x59\x00\x5a\x00\x5b\x00\x5c\x00\x5d\x00\x5e\x00\x5f\x00\x60\x00\x61\x00\x62\x00\x63\x00\x64\x00\x65\x00\x66\x00\x67\x00\x68\x00\x69\x00\x6a\x00\x6b\x00\x6c\x00\x6d\x00\x6e\x00\x6f\x00\x70\x00\x71\x00\x72\x00\x73\x00\x74\x00\x75\x00\x76\x00\x77\x00\x78\x00\x79\x00\x7a\x00\x7b\x00\x7c\x00\x7d\x00\x7e\x00\x7f\x00\x0a\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x21\x00\xc0\x00\xc1\x00\xc2\x00\xc3\x00\xc4\x00\xc5\x00\xc6\x00\xc7\x00\xc8\x00\xc9\x00\xca\x00\xcb\x00\xcc\x00\xcd\x00\xce\x00\xcf\x00\xd0\x00\xd1\x00\xd2\x00\xd3\x00\xd4\x00\xd5\x00\xd6\x00\xd7\x00\xd8\x00\xd9\x00\xda\x00\xdb\x00\xdc\x00\xdd\x00\xde\x00\xdf\x00\xe0\x00\xe1\x00\xe2\x00\xe3\x00\xe4\x00\xe5\x00\xe6\x00\xe7\x00\xe8\x00\xe9\x00\xea\x00\xeb\x00\xec\x00\xed\x00\xee\x00\xef\x00\xf0\x00\xf1\x00\xf2\x00\xf3\x00\xf4\x00\xf5\x00\xf6\x00\xf7\x00\xf8\x00\xf9\x00\xfa\x00\xfb\x00\xfc\x00\xfd\x00\xfe\x00\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x80\x00\x81\x00\x82\x00\x83\x00\x84\x00\x85\x00\x86\x00\x87\x00\x88\x00\x89\x00\x8a\x00\x8b\x00\x8c\x00\x8d\x00\x8e\x00\x8f\x00\x90\x00\x91\x00\x92\x00\x93\x00\x94\x00\x95\x00\x96\x00\x97\x00\x98\x00\x99\x00\x9a\x00\x9b\x00\x9c\x00\x9d\x00\x9e\x00\x9f\x00\xa0\x00\xa1\x00\xa2\x00\xa3\x00\xa4\x00\xa5\x00\xa6\x00\xa7\x00\xa8\x00\xa9\x00\xaa\x00\xab\x00\xac\x00\xad\x00\xae\x00\xaf\x00\xb0\x00\xb1\x00\xb2\x00\xb3\x00\xb4\x00\xb5\x00\xb6\x00\xb7\x00\xb8\x00\xb9\x00\xba\x00\xbb\x00\xbc\x00\xbd\x00\xbe\x00\xbf\x00\xc0\x00\xc1\x00\xc2\x00\xc3\x00\xc4\x00\xc5\x00\xc6\x00\xc7\x00\xc8\x00\xc9\x00\xca\x00\xcb\x00\xcc\x00\xcd\x00\xce\x00\xcf\x00\xd0\x00\xd1\x00\xd2\x00\xd3\x00\xd4\x00\xd5\x00\xd6\x00\xd7\x00\xd8\x00\xd9\x00\xda\x00\xdb\x00\xdc\x00\xdd\x00\xde\x00\xdf\x00\xe0\x00\xe1\x00\xe2\x00\xe3\x00\xe4\x00\xe5\x00\xe6\x00\xe7\x00\xe8\x00\xe9\x00\xea\x00\xeb\x00\xec\x00\xed\x00\xee\x00\xef\x00\xf0\x00\xf1\x00\xf2\x00\xf3\x00\xf4\x00\xf5\x00\xf6\x00\xf7\x00\xf8\x00\xf9\x00\xfa\x00\xfb\x00\xfc\x00\xfd\x00\xfe\x00\xff\x00\x0a\x00\x0b\x00\x0c\x00\x0d\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x21\x00\xff\xff\x23\x00\x24\x00\x25\x00\x26\x00\x27\x00\xff\xff\x20\x00\x2a\x00\x2b\x00\x2c\x00\x2d\x00\x2e\x00\x2f\x00\x30\x00\x31\x00\x32\x00\x33\x00\x34\x00\x35\x00\x36\x00\x37\x00\x38\x00\x39\x00\x3a\x00\xff\xff\x3c\x00\x3d\x00\x3e\x00\x3f\x00\xff\xff\x41\x00\x42\x00\x43\x00\x44\x00\x45\x00\x46\x00\x47\x00\x48\x00\x49\x00\x4a\x00\x4b\x00\x4c\x00\x4d\x00\x4e\x00\x4f\x00\x50\x00\x51\x00\x52\x00\x53\x00\x54\x00\x55\x00\x56\x00\x57\x00\x58\x00\x59\x00\x5a\x00\x5b\x00\x5c\x00\x5d\x00\x5e\x00\x5f\x00\x60\x00\x61\x00\x62\x00\x63\x00\x64\x00\x65\x00\x66\x00\x67\x00\x68\x00\x69\x00\x6a\x00\x6b\x00\x6c\x00\x6d\x00\x6e\x00\x6f\x00\x70\x00\x71\x00\x72\x00\x73\x00\x74\x00\x75\x00\x76\x00\x77\x00\x78\x00\x79\x00\x7a\x00\xff\xff\x7c\x00\xff\xff\x7e\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x80\x00\x81\x00\x82\x00\x83\x00\x84\x00\x85\x00\x86\x00\x87\x00\x88\x00\x89\x00\x8a\x00\x8b\x00\x8c\x00\x8d\x00\x8e\x00\x8f\x00\x90\x00\x91\x00\x92\x00\x93\x00\x94\x00\x95\x00\x96\x00\x97\x00\x98\x00\x99\x00\x9a\x00\x9b\x00\x9c\x00\x9d\x00\x9e\x00\x9f\x00\xa0\x00\xa1\x00\xa2\x00\xa3\x00\xa4\x00\xa5\x00\xa6\x00\xa7\x00\xa8\x00\xa9\x00\xaa\x00\xab\x00\xac\x00\xad\x00\xae\x00\xaf\x00\xb0\x00\xb1\x00\xb2\x00\xb3\x00\xb4\x00\xb5\x00\xb6\x00\xb7\x00\xb8\x00\xb9\x00\xba\x00\xbb\x00\xbc\x00\xbd\x00\xbe\x00\xbf\x00\xc0\x00\xc1\x00\xc2\x00\xc3\x00\xc4\x00\xc5\x00\xc6\x00\xc7\x00\xc8\x00\xc9\x00\xca\x00\xcb\x00\xcc\x00\xcd\x00\xce\x00\xcf\x00\xd0\x00\xd1\x00\xd2\x00\xd3\x00\xd4\x00\xd5\x00\xd6\x00\xd7\x00\xd8\x00\xd9\x00\xda\x00\xdb\x00\xdc\x00\xdd\x00\xde\x00\xdf\x00\xe0\x00\xe1\x00\xe2\x00\xe3\x00\xe4\x00\xe5\x00\xe6\x00\xe7\x00\xe8\x00\xe9\x00\xea\x00\xeb\x00\xec\x00\xed\x00\xee\x00\xef\x00\xf0\x00\xf1\x00\xf2\x00\xf3\x00\xf4\x00\xf5\x00\xf6\x00\xf7\x00\xf8\x00\xf9\x00\xfa\x00\xfb\x00\xfc\x00\xfd\x00\xfe\x00\xff\x00\x0a\x00\x21\x00\xff\xff\x23\x00\x24\x00\x25\x00\x26\x00\x27\x00\xff\xff\xff\xff\x2a\x00\x2b\x00\x2c\x00\x2d\x00\x2e\x00\x2f\x00\x30\x00\x31\x00\x32\x00\x33\x00\x34\x00\x35\x00\x36\x00\x37\x00\x38\x00\x39\x00\x3a\x00\xff\xff\x3c\x00\x3d\x00\x3e\x00\x3f\x00\xff\xff\x41\x00\x42\x00\x43\x00\x44\x00\x45\x00\x46\x00\x47\x00\x48\x00\x49\x00\x4a\x00\x4b\x00\x4c\x00\x4d\x00\x4e\x00\x4f\x00\x50\x00\x51\x00\x52\x00\x53\x00\x54\x00\x55\x00\x56\x00\x57\x00\x58\x00\x59\x00\x5a\x00\x5b\x00\x5c\x00\x5d\x00\x5e\x00\x5f\x00\x60\x00\x61\x00\x62\x00\x63\x00\x64\x00\x65\x00\x66\x00\x67\x00\x68\x00\x69\x00\x6a\x00\x6b\x00\x6c\x00\x6d\x00\x6e\x00\x6f\x00\x70\x00\x71\x00\x72\x00\x73\x00\x74\x00\x75\x00\x76\x00\x77\x00\x78\x00\x79\x00\x7a\x00\xff\xff\x7c\x00\xff\xff\x7e\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x7d\x00\xff\xff\xff\xff\x80\x00\x81\x00\x82\x00\x83\x00\x84\x00\x85\x00\x86\x00\x87\x00\x88\x00\x89\x00\x8a\x00\x8b\x00\x8c\x00\x8d\x00\x8e\x00\x8f\x00\x90\x00\x91\x00\x92\x00\x93\x00\x94\x00\x95\x00\x96\x00\x97\x00\x98\x00\x99\x00\x9a\x00\x9b\x00\x9c\x00\x9d\x00\x9e\x00\x9f\x00\xa0\x00\xa1\x00\xa2\x00\xa3\x00\xa4\x00\xa5\x00\xa6\x00\xa7\x00\xa8\x00\xa9\x00\xaa\x00\xab\x00\xac\x00\xad\x00\xae\x00\xaf\x00\xb0\x00\xb1\x00\xb2\x00\xb3\x00\xb4\x00\xb5\x00\xb6\x00\xb7\x00\xb8\x00\xb9\x00\xba\x00\xbb\x00\xbc\x00\xbd\x00\xbe\x00\xbf\x00\xc0\x00\xc1\x00\xc2\x00\xc3\x00\xc4\x00\xc5\x00\xc6\x00\xc7\x00\xc8\x00\xc9\x00\xca\x00\xcb\x00\xcc\x00\xcd\x00\xce\x00\xcf\x00\xd0\x00\xd1\x00\xd2\x00\xd3\x00\xd4\x00\xd5\x00\xd6\x00\xd7\x00\xd8\x00\xd9\x00\xda\x00\xdb\x00\xdc\x00\xdd\x00\xde\x00\xdf\x00\xe0\x00\xe1\x00\xe2\x00\xe3\x00\xe4\x00\xe5\x00\xe6\x00\xe7\x00\xe8\x00\xe9\x00\xea\x00\xeb\x00\xec\x00\xed\x00\xee\x00\xef\x00\xf0\x00\xf1\x00\xf2\x00\xf3\x00\xf4\x00\xf5\x00\xf6\x00\xf7\x00\xf8\x00\xf9\x00\xfa\x00\xfb\x00\xfc\x00\xfd\x00\xfe\x00\xff\x00\x0a\x00\x21\x00\xff\xff\x23\x00\x24\x00\x25\x00\x26\x00\x27\x00\xff\xff\xff\xff\x2a\x00\x2b\x00\x2c\x00\x2d\x00\x2e\x00\x2f\x00\x30\x00\x31\x00\x32\x00\x33\x00\x34\x00\x35\x00\x36\x00\x37\x00\x38\x00\x39\x00\x3a\x00\xff\xff\x3c\x00\x3d\x00\x3e\x00\x3f\x00\xff\xff\x41\x00\x42\x00\x43\x00\x44\x00\x45\x00\x46\x00\x47\x00\x48\x00\x49\x00\x4a\x00\x4b\x00\x4c\x00\x4d\x00\x4e\x00\x4f\x00\x50\x00\x51\x00\x52\x00\x53\x00\x54\x00\x55\x00\x56\x00\x57\x00\x58\x00\x59\x00\x5a\x00\x5b\x00\x5c\x00\x5d\x00\x5e\x00\x5f\x00\x60\x00\x61\x00\x62\x00\x63\x00\x64\x00\x65\x00\x66\x00\x67\x00\x68\x00\x69\x00\x6a\x00\x6b\x00\x6c\x00\x6d\x00\x6e\x00\x6f\x00\x70\x00\x71\x00\x72\x00\x73\x00\x74\x00\x75\x00\x76\x00\x77\x00\x78\x00\x79\x00\x7a\x00\x65\x00\x7c\x00\xff\xff\x7e\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x80\x00\x81\x00\x82\x00\x83\x00\x84\x00\x85\x00\x86\x00\x87\x00\x88\x00\x89\x00\x8a\x00\x8b\x00\x8c\x00\x8d\x00\x8e\x00\x8f\x00\x90\x00\x91\x00\x92\x00\x93\x00\x94\x00\x95\x00\x96\x00\x97\x00\x98\x00\x99\x00\x9a\x00\x9b\x00\x9c\x00\x9d\x00\x9e\x00\x9f\x00\xa0\x00\xa1\x00\xa2\x00\xa3\x00\xa4\x00\xa5\x00\xa6\x00\xa7\x00\xa8\x00\xa9\x00\xaa\x00\xab\x00\xac\x00\xad\x00\xae\x00\xaf\x00\xb0\x00\xb1\x00\xb2\x00\xb3\x00\xb4\x00\xb5\x00\xb6\x00\xb7\x00\xb8\x00\xb9\x00\xba\x00\xbb\x00\xbc\x00\xbd\x00\xbe\x00\xbf\x00\xc0\x00\xc1\x00\xc2\x00\xc3\x00\xc4\x00\xc5\x00\xc6\x00\xc7\x00\xc8\x00\xc9\x00\xca\x00\xcb\x00\xcc\x00\xcd\x00\xce\x00\xcf\x00\xd0\x00\xd1\x00\xd2\x00\xd3\x00\xd4\x00\xd5\x00\xd6\x00\xd7\x00\xd8\x00\xd9\x00\xda\x00\xdb\x00\xdc\x00\xdd\x00\xde\x00\xdf\x00\xe0\x00\xe1\x00\xe2\x00\xe3\x00\xe4\x00\xe5\x00\xe6\x00\xe7\x00\xe8\x00\xe9\x00\xea\x00\xeb\x00\xec\x00\xed\x00\xee\x00\xef\x00\xf0\x00\xf1\x00\xf2\x00\xf3\x00\xf4\x00\xf5\x00\xf6\x00\xf7\x00\xf8\x00\xf9\x00\xfa\x00\xfb\x00\xfc\x00\xfd\x00\xfe\x00\xff\x00\x0a\x00\x21\x00\xff\xff\x23\x00\x24\x00\x25\x00\x26\x00\x27\x00\xff\xff\xff\xff\x2a\x00\x2b\x00\x2c\x00\x2d\x00\x2e\x00\x2f\x00\x30\x00\x31\x00\x32\x00\x33\x00\x34\x00\x35\x00\x36\x00\x37\x00\x38\x00\x39\x00\x3a\x00\xff\xff\x3c\x00\x3d\x00\x3e\x00\x3f\x00\xff\xff\x41\x00\x42\x00\x43\x00\x44\x00\x45\x00\x46\x00\x47\x00\x48\x00\x49\x00\x4a\x00\x4b\x00\x4c\x00\x4d\x00\x4e\x00\x4f\x00\x50\x00\x51\x00\x52\x00\x53\x00\x54\x00\x55\x00\x56\x00\x57\x00\x58\x00\x59\x00\x5a\x00\x5b\x00\x5c\x00\x5d\x00\x5e\x00\x5f\x00\x60\x00\x61\x00\x62\x00\x63\x00\x64\x00\x65\x00\x66\x00\x67\x00\x68\x00\x69\x00\x6a\x00\x6b\x00\x6c\x00\x6d\x00\x6e\x00\x6f\x00\x70\x00\x71\x00\x72\x00\x73\x00\x74\x00\x75\x00\x76\x00\x77\x00\x78\x00\x79\x00\x7a\x00\xff\xff\x7c\x00\xff\xff\x7e\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x6f\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x80\x00\x81\x00\x82\x00\x83\x00\x84\x00\x85\x00\x86\x00\x87\x00\x88\x00\x89\x00\x8a\x00\x8b\x00\x8c\x00\x8d\x00\x8e\x00\x8f\x00\x90\x00\x91\x00\x92\x00\x93\x00\x94\x00\x95\x00\x96\x00\x97\x00\x98\x00\x99\x00\x9a\x00\x9b\x00\x9c\x00\x9d\x00\x9e\x00\x9f\x00\xa0\x00\xa1\x00\xa2\x00\xa3\x00\xa4\x00\xa5\x00\xa6\x00\xa7\x00\xa8\x00\xa9\x00\xaa\x00\xab\x00\xac\x00\xad\x00\xae\x00\xaf\x00\xb0\x00\xb1\x00\xb2\x00\xb3\x00\xb4\x00\xb5\x00\xb6\x00\xb7\x00\xb8\x00\xb9\x00\xba\x00\xbb\x00\xbc\x00\xbd\x00\xbe\x00\xbf\x00\xc0\x00\xc1\x00\xc2\x00\xc3\x00\xc4\x00\xc5\x00\xc6\x00\xc7\x00\xc8\x00\xc9\x00\xca\x00\xcb\x00\xcc\x00\xcd\x00\xce\x00\xcf\x00\xd0\x00\xd1\x00\xd2\x00\xd3\x00\xd4\x00\xd5\x00\xd6\x00\xd7\x00\xd8\x00\xd9\x00\xda\x00\xdb\x00\xdc\x00\xdd\x00\xde\x00\xdf\x00\xe0\x00\xe1\x00\xe2\x00\xe3\x00\xe4\x00\xe5\x00\xe6\x00\xe7\x00\xe8\x00\xe9\x00\xea\x00\xeb\x00\xec\x00\xed\x00\xee\x00\xef\x00\xf0\x00\xf1\x00\xf2\x00\xf3\x00\xf4\x00\xf5\x00\xf6\x00\xf7\x00\xf8\x00\xf9\x00\xfa\x00\xfb\x00\xfc\x00\xfd\x00\xfe\x00\xff\x00\x0a\x00\x21\x00\xff\xff\x23\x00\x24\x00\x25\x00\x26\x00\x27\x00\xff\xff\xff\xff\x2a\x00\x2b\x00\x2c\x00\x2d\x00\xff\xff\x2f\x00\x30\x00\x31\x00\x32\x00\x33\x00\x34\x00\x35\x00\x36\x00\x37\x00\x38\x00\x39\x00\x3a\x00\xff\xff\x3c\x00\x3d\x00\x3e\x00\x3f\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x5b\x00\x5c\x00\x5d\x00\x5e\x00\xff\xff\x60\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x63\x00\xff\xff\xff\xff\x7c\x00\xff\xff\x7e\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x80\x00\x81\x00\x82\x00\x83\x00\x84\x00\x85\x00\x86\x00\x87\x00\x88\x00\x89\x00\x8a\x00\x8b\x00\x8c\x00\x8d\x00\x8e\x00\x8f\x00\x90\x00\x91\x00\x92\x00\x93\x00\x94\x00\x95\x00\x96\x00\x97\x00\x98\x00\x99\x00\x9a\x00\x9b\x00\x9c\x00\x9d\x00\x9e\x00\x9f\x00\xa0\x00\xa1\x00\xa2\x00\xa3\x00\xa4\x00\xa5\x00\xa6\x00\xa7\x00\xa8\x00\xa9\x00\xaa\x00\xab\x00\xac\x00\xad\x00\xae\x00\xaf\x00\xb0\x00\xb1\x00\xb2\x00\xb3\x00\xb4\x00\xb5\x00\xb6\x00\xb7\x00\xb8\x00\xb9\x00\xba\x00\xbb\x00\xbc\x00\xbd\x00\xbe\x00\xbf\x00\xc0\x00\xc1\x00\xc2\x00\xc3\x00\xc4\x00\xc5\x00\xc6\x00\xc7\x00\xc8\x00\xc9\x00\xca\x00\xcb\x00\xcc\x00\xcd\x00\xce\x00\xcf\x00\xd0\x00\xd1\x00\xd2\x00\xd3\x00\xd4\x00\xd5\x00\xd6\x00\xd7\x00\xd8\x00\xd9\x00\xda\x00\xdb\x00\xdc\x00\xdd\x00\xde\x00\xdf\x00\xe0\x00\xe1\x00\xe2\x00\xe3\x00\xe4\x00\xe5\x00\xe6\x00\xe7\x00\xe8\x00\xe9\x00\xea\x00\xeb\x00\xec\x00\xed\x00\xee\x00\xef\x00\xf0\x00\xf1\x00\xf2\x00\xf3\x00\xf4\x00\xf5\x00\xf6\x00\xf7\x00\xf8\x00\xf9\x00\xfa\x00\xfb\x00\xfc\x00\xfd\x00\xfe\x00\xff\x00\x0a\x00\x21\x00\xff\xff\x23\x00\x24\x00\x25\x00\x26\x00\x27\x00\xff\xff\xff\xff\x2a\x00\x2b\x00\x2c\x00\x2d\x00\x2e\x00\x2f\x00\x30\x00\x31\x00\x32\x00\x33\x00\x34\x00\x35\x00\x36\x00\x37\x00\x38\x00\x39\x00\x3a\x00\xff\xff\x3c\x00\x3d\x00\x3e\x00\x3f\x00\xff\xff\x41\x00\x42\x00\x43\x00\x44\x00\x45\x00\x46\x00\x47\x00\x48\x00\x49\x00\x4a\x00\x4b\x00\x4c\x00\x4d\x00\x4e\x00\x4f\x00\x50\x00\x51\x00\x52\x00\x53\x00\x54\x00\x55\x00\x56\x00\x57\x00\x58\x00\x59\x00\x5a\x00\x5b\x00\x5c\x00\x5d\x00\x5e\x00\x5f\x00\x60\x00\x61\x00\x62\x00\x63\x00\x64\x00\x65\x00\x66\x00\x67\x00\x68\x00\x69\x00\x6a\x00\x6b\x00\x6c\x00\x6d\x00\x6e\x00\x6f\x00\x70\x00\x71\x00\x72\x00\x73\x00\x74\x00\x75\x00\x76\x00\x77\x00\x78\x00\x79\x00\x7a\x00\xff\xff\x7c\x00\xff\xff\x7e\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x7b\x00\xff\xff\xff\xff\xff\xff\xff\xff\x80\x00\x81\x00\x82\x00\x83\x00\x84\x00\x85\x00\x86\x00\x87\x00\x88\x00\x89\x00\x8a\x00\x8b\x00\x8c\x00\x8d\x00\x8e\x00\x8f\x00\x90\x00\x91\x00\x92\x00\x93\x00\x94\x00\x95\x00\x96\x00\x97\x00\x98\x00\x99\x00\x9a\x00\x9b\x00\x9c\x00\x9d\x00\x9e\x00\x9f\x00\xa0\x00\xa1\x00\xa2\x00\xa3\x00\xa4\x00\xa5\x00\xa6\x00\xa7\x00\xa8\x00\xa9\x00\xaa\x00\xab\x00\xac\x00\xad\x00\xae\x00\xaf\x00\xb0\x00\xb1\x00\xb2\x00\xb3\x00\xb4\x00\xb5\x00\xb6\x00\xb7\x00\xb8\x00\xb9\x00\xba\x00\xbb\x00\xbc\x00\xbd\x00\xbe\x00\xbf\x00\xc0\x00\xc1\x00\xc2\x00\xc3\x00\xc4\x00\xc5\x00\xc6\x00\xc7\x00\xc8\x00\xc9\x00\xca\x00\xcb\x00\xcc\x00\xcd\x00\xce\x00\xcf\x00\xd0\x00\xd1\x00\xd2\x00\xd3\x00\xd4\x00\xd5\x00\xd6\x00\xd7\x00\xd8\x00\xd9\x00\xda\x00\xdb\x00\xdc\x00\xdd\x00\xde\x00\xdf\x00\xe0\x00\xe1\x00\xe2\x00\xe3\x00\xe4\x00\xe5\x00\xe6\x00\xe7\x00\xe8\x00\xe9\x00\xea\x00\xeb\x00\xec\x00\xed\x00\xee\x00\xef\x00\xf0\x00\xf1\x00\xf2\x00\xf3\x00\xf4\x00\xf5\x00\xf6\x00\xf7\x00\xf8\x00\xf9\x00\xfa\x00\xfb\x00\xfc\x00\xfd\x00\xfe\x00\xff\x00\x0a\x00\x21\x00\xff\xff\x23\x00\x24\x00\x25\x00\x26\x00\x27\x00\xff\xff\xff\xff\x2a\x00\x2b\x00\x2c\x00\x2d\x00\x2e\x00\x2f\x00\x30\x00\x31\x00\x32\x00\x33\x00\x34\x00\x35\x00\x36\x00\x37\x00\x38\x00\x39\x00\x3a\x00\xff\xff\x3c\x00\x3d\x00\x3e\x00\x3f\x00\xff\xff\x41\x00\x42\x00\x43\x00\x44\x00\x45\x00\x46\x00\x47\x00\x48\x00\x49\x00\x4a\x00\x4b\x00\x4c\x00\x4d\x00\x4e\x00\x4f\x00\x50\x00\x51\x00\x52\x00\x53\x00\x54\x00\x55\x00\x56\x00\x57\x00\x58\x00\x59\x00\x5a\x00\x5b\x00\x5c\x00\x5d\x00\x5e\x00\x5f\x00\x60\x00\x61\x00\x62\x00\x63\x00\x64\x00\x65\x00\x66\x00\x67\x00\x68\x00\x69\x00\x6a\x00\x6b\x00\x6c\x00\x6d\x00\x6e\x00\x6f\x00\x70\x00\x71\x00\x72\x00\x73\x00\x74\x00\x75\x00\x76\x00\x77\x00\x78\x00\x79\x00\x7a\x00\xff\xff\x7c\x00\xff\xff\x7e\x00\x69\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x80\x00\x81\x00\x82\x00\x83\x00\x84\x00\x85\x00\x86\x00\x87\x00\x88\x00\x89\x00\x8a\x00\x8b\x00\x8c\x00\x8d\x00\x8e\x00\x8f\x00\x90\x00\x91\x00\x92\x00\x93\x00\x94\x00\x95\x00\x96\x00\x97\x00\x98\x00\x99\x00\x9a\x00\x9b\x00\x9c\x00\x9d\x00\x9e\x00\x9f\x00\xa0\x00\xa1\x00\xa2\x00\xa3\x00\xa4\x00\xa5\x00\xa6\x00\xa7\x00\xa8\x00\xa9\x00\xaa\x00\xab\x00\xac\x00\xad\x00\xae\x00\xaf\x00\xb0\x00\xb1\x00\xb2\x00\xb3\x00\xb4\x00\xb5\x00\xb6\x00\xb7\x00\xb8\x00\xb9\x00\xba\x00\xbb\x00\xbc\x00\xbd\x00\xbe\x00\xbf\x00\xc0\x00\xc1\x00\xc2\x00\xc3\x00\xc4\x00\xc5\x00\xc6\x00\xc7\x00\xc8\x00\xc9\x00\xca\x00\xcb\x00\xcc\x00\xcd\x00\xce\x00\xcf\x00\xd0\x00\xd1\x00\xd2\x00\xd3\x00\xd4\x00\xd5\x00\xd6\x00\xd7\x00\xd8\x00\xd9\x00\xda\x00\xdb\x00\xdc\x00\xdd\x00\xde\x00\xdf\x00\xe0\x00\xe1\x00\xe2\x00\xe3\x00\xe4\x00\xe5\x00\xe6\x00\xe7\x00\xe8\x00\xe9\x00\xea\x00\xeb\x00\xec\x00\xed\x00\xee\x00\xef\x00\xf0\x00\xf1\x00\xf2\x00\xf3\x00\xf4\x00\xf5\x00\xf6\x00\xf7\x00\xf8\x00\xf9\x00\xfa\x00\xfb\x00\xfc\x00\xfd\x00\xfe\x00\xff\x00\x0a\x00\x21\x00\xff\xff\x23\x00\x24\x00\x25\x00\x26\x00\x27\x00\xff\xff\xff\xff\x2a\x00\x2b\x00\x2c\x00\x2d\x00\x2e\x00\x2f\x00\x30\x00\x31\x00\x32\x00\x33\x00\x34\x00\x35\x00\x36\x00\x37\x00\x38\x00\x39\x00\x3a\x00\xff\xff\x3c\x00\x3d\x00\x3e\x00\x3f\x00\xff\xff\x41\x00\x42\x00\x43\x00\x44\x00\x45\x00\x46\x00\x47\x00\x48\x00\x49\x00\x4a\x00\x4b\x00\x4c\x00\x4d\x00\x4e\x00\x4f\x00\x50\x00\x51\x00\x52\x00\x53\x00\x54\x00\x55\x00\x56\x00\x57\x00\x58\x00\x59\x00\x5a\x00\x5b\x00\x5c\x00\x5d\x00\x5e\x00\x5f\x00\x60\x00\x61\x00\x62\x00\x63\x00\x64\x00\x65\x00\x66\x00\x67\x00\x68\x00\x69\x00\x6a\x00\x6b\x00\x6c\x00\x6d\x00\x6e\x00\x6f\x00\x70\x00\x71\x00\x72\x00\x73\x00\x74\x00\x75\x00\x76\x00\x77\x00\x78\x00\x79\x00\x7a\x00\xff\xff\x7c\x00\x67\x00\x7e\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x80\x00\x81\x00\x82\x00\x83\x00\x84\x00\x85\x00\x86\x00\x87\x00\x88\x00\x89\x00\x8a\x00\x8b\x00\x8c\x00\x8d\x00\x8e\x00\x8f\x00\x90\x00\x91\x00\x92\x00\x93\x00\x94\x00\x95\x00\x96\x00\x97\x00\x98\x00\x99\x00\x9a\x00\x9b\x00\x9c\x00\x9d\x00\x9e\x00\x9f\x00\xa0\x00\xa1\x00\xa2\x00\xa3\x00\xa4\x00\xa5\x00\xa6\x00\xa7\x00\xa8\x00\xa9\x00\xaa\x00\xab\x00\xac\x00\xad\x00\xae\x00\xaf\x00\xb0\x00\xb1\x00\xb2\x00\xb3\x00\xb4\x00\xb5\x00\xb6\x00\xb7\x00\xb8\x00\xb9\x00\xba\x00\xbb\x00\xbc\x00\xbd\x00\xbe\x00\xbf\x00\xc0\x00\xc1\x00\xc2\x00\xc3\x00\xc4\x00\xc5\x00\xc6\x00\xc7\x00\xc8\x00\xc9\x00\xca\x00\xcb\x00\xcc\x00\xcd\x00\xce\x00\xcf\x00\xd0\x00\xd1\x00\xd2\x00\xd3\x00\xd4\x00\xd5\x00\xd6\x00\xd7\x00\xd8\x00\xd9\x00\xda\x00\xdb\x00\xdc\x00\xdd\x00\xde\x00\xdf\x00\xe0\x00\xe1\x00\xe2\x00\xe3\x00\xe4\x00\xe5\x00\xe6\x00\xe7\x00\xe8\x00\xe9\x00\xea\x00\xeb\x00\xec\x00\xed\x00\xee\x00\xef\x00\xf0\x00\xf1\x00\xf2\x00\xf3\x00\xf4\x00\xf5\x00\xf6\x00\xf7\x00\xf8\x00\xf9\x00\xfa\x00\xfb\x00\xfc\x00\xfd\x00\xfe\x00\xff\x00\x0a\x00\x21\x00\xff\xff\x23\x00\x24\x00\x25\x00\x26\x00\x27\x00\xff\xff\xff\xff\x2a\x00\x2b\x00\x2c\x00\x2d\x00\x2e\x00\x2f\x00\x30\x00\x31\x00\x32\x00\x33\x00\x34\x00\x35\x00\x36\x00\x37\x00\x38\x00\x39\x00\x3a\x00\xff\xff\x3c\x00\x3d\x00\x3e\x00\x3f\x00\xff\xff\x41\x00\x42\x00\x43\x00\x44\x00\x45\x00\x46\x00\x47\x00\x48\x00\x49\x00\x4a\x00\x4b\x00\x4c\x00\x4d\x00\x4e\x00\x4f\x00\x50\x00\x51\x00\x52\x00\x53\x00\x54\x00\x55\x00\x56\x00\x57\x00\x58\x00\x59\x00\x5a\x00\x5b\x00\x5c\x00\x5d\x00\x5e\x00\x5f\x00\x60\x00\x61\x00\x62\x00\x63\x00\x64\x00\x65\x00\x66\x00\x67\x00\x68\x00\x69\x00\x6a\x00\x6b\x00\x6c\x00\x6d\x00\x6e\x00\x6f\x00\x70\x00\x71\x00\x72\x00\x73\x00\x74\x00\x75\x00\x76\x00\x77\x00\x78\x00\x79\x00\x7a\x00\x65\x00\x7c\x00\xff\xff\x7e\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x80\x00\x81\x00\x82\x00\x83\x00\x84\x00\x85\x00\x86\x00\x87\x00\x88\x00\x89\x00\x8a\x00\x8b\x00\x8c\x00\x8d\x00\x8e\x00\x8f\x00\x90\x00\x91\x00\x92\x00\x93\x00\x94\x00\x95\x00\x96\x00\x97\x00\x98\x00\x99\x00\x9a\x00\x9b\x00\x9c\x00\x9d\x00\x9e\x00\x9f\x00\xa0\x00\xa1\x00\xa2\x00\xa3\x00\xa4\x00\xa5\x00\xa6\x00\xa7\x00\xa8\x00\xa9\x00\xaa\x00\xab\x00\xac\x00\xad\x00\xae\x00\xaf\x00\xb0\x00\xb1\x00\xb2\x00\xb3\x00\xb4\x00\xb5\x00\xb6\x00\xb7\x00\xb8\x00\xb9\x00\xba\x00\xbb\x00\xbc\x00\xbd\x00\xbe\x00\xbf\x00\xc0\x00\xc1\x00\xc2\x00\xc3\x00\xc4\x00\xc5\x00\xc6\x00\xc7\x00\xc8\x00\xc9\x00\xca\x00\xcb\x00\xcc\x00\xcd\x00\xce\x00\xcf\x00\xd0\x00\xd1\x00\xd2\x00\xd3\x00\xd4\x00\xd5\x00\xd6\x00\xd7\x00\xd8\x00\xd9\x00\xda\x00\xdb\x00\xdc\x00\xdd\x00\xde\x00\xdf\x00\xe0\x00\xe1\x00\xe2\x00\xe3\x00\xe4\x00\xe5\x00\xe6\x00\xe7\x00\xe8\x00\xe9\x00\xea\x00\xeb\x00\xec\x00\xed\x00\xee\x00\xef\x00\xf0\x00\xf1\x00\xf2\x00\xf3\x00\xf4\x00\xf5\x00\xf6\x00\xf7\x00\xf8\x00\xf9\x00\xfa\x00\xfb\x00\xfc\x00\xfd\x00\xfe\x00\xff\x00\x0a\x00\x21\x00\xff\xff\x23\x00\x24\x00\x25\x00\x26\x00\x27\x00\xff\xff\xff\xff\x2a\x00\x2b\x00\x2c\x00\x2d\x00\x2e\x00\x2f\x00\x30\x00\x31\x00\x32\x00\x33\x00\x34\x00\x35\x00\x36\x00\x37\x00\x38\x00\x39\x00\x3a\x00\xff\xff\x3c\x00\x3d\x00\x3e\x00\x3f\x00\xff\xff\x41\x00\x42\x00\x43\x00\x44\x00\x45\x00\x46\x00\x47\x00\x48\x00\x49\x00\x4a\x00\x4b\x00\x4c\x00\x4d\x00\x4e\x00\x4f\x00\x50\x00\x51\x00\x52\x00\x53\x00\x54\x00\x55\x00\x56\x00\x57\x00\x58\x00\x59\x00\x5a\x00\x5b\x00\x5c\x00\x5d\x00\x5e\x00\x5f\x00\x60\x00\x61\x00\x62\x00\x63\x00\x64\x00\x65\x00\x66\x00\x67\x00\x68\x00\x69\x00\x6a\x00\x6b\x00\x6c\x00\x6d\x00\x6e\x00\x6f\x00\x70\x00\x71\x00\x72\x00\x73\x00\x74\x00\x75\x00\x76\x00\x77\x00\x78\x00\x79\x00\x7a\x00\xff\xff\x7c\x00\xff\xff\x7e\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x80\x00\x81\x00\x82\x00\x83\x00\x84\x00\x85\x00\x86\x00\x87\x00\x88\x00\x89\x00\x8a\x00\x8b\x00\x8c\x00\x8d\x00\x8e\x00\x8f\x00\x90\x00\x91\x00\x92\x00\x93\x00\x94\x00\x95\x00\x96\x00\x97\x00\x98\x00\x99\x00\x9a\x00\x9b\x00\x9c\x00\x9d\x00\x9e\x00\x9f\x00\xa0\x00\xa1\x00\xa2\x00\xa3\x00\xa4\x00\xa5\x00\xa6\x00\xa7\x00\xa8\x00\xa9\x00\xaa\x00\xab\x00\xac\x00\xad\x00\xae\x00\xaf\x00\xb0\x00\xb1\x00\xb2\x00\xb3\x00\xb4\x00\xb5\x00\xb6\x00\xb7\x00\xb8\x00\xb9\x00\xba\x00\xbb\x00\xbc\x00\xbd\x00\xbe\x00\xbf\x00\xc0\x00\xc1\x00\xc2\x00\xc3\x00\xc4\x00\xc5\x00\xc6\x00\xc7\x00\xc8\x00\xc9\x00\xca\x00\xcb\x00\xcc\x00\xcd\x00\xce\x00\xcf\x00\xd0\x00\xd1\x00\xd2\x00\xd3\x00\xd4\x00\xd5\x00\xd6\x00\xd7\x00\xd8\x00\xd9\x00\xda\x00\xdb\x00\xdc\x00\xdd\x00\xde\x00\xdf\x00\xe0\x00\xe1\x00\xe2\x00\xe3\x00\xe4\x00\xe5\x00\xe6\x00\xe7\x00\xe8\x00\xe9\x00\xea\x00\xeb\x00\xec\x00\xed\x00\xee\x00\xef\x00\xf0\x00\xf1\x00\xf2\x00\xf3\x00\xf4\x00\xf5\x00\xf6\x00\xf7\x00\xf8\x00\xf9\x00\xfa\x00\xfb\x00\xfc\x00\xfd\x00\xfe\x00\xff\x00\x0a\x00\x0b\x00\x0c\x00\x0d\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x20\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x5c\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x80\x00\x81\x00\x82\x00\x83\x00\x84\x00\x85\x00\x86\x00\x87\x00\x88\x00\x89\x00\x8a\x00\x8b\x00\x8c\x00\x8d\x00\x8e\x00\x8f\x00\x90\x00\x91\x00\x92\x00\x93\x00\x94\x00\x95\x00\x96\x00\x97\x00\x98\x00\x99\x00\x9a\x00\x9b\x00\x9c\x00\x9d\x00\x9e\x00\x9f\x00\xa0\x00\xa1\x00\xa2\x00\xa3\x00\xa4\x00\xa5\x00\xa6\x00\xa7\x00\xa8\x00\xa9\x00\xaa\x00\xab\x00\xac\x00\xad\x00\xae\x00\xaf\x00\xb0\x00\xb1\x00\xb2\x00\xb3\x00\xb4\x00\xb5\x00\xb6\x00\xb7\x00\xb8\x00\xb9\x00\xba\x00\xbb\x00\xbc\x00\xbd\x00\xbe\x00\xbf\x00\xc0\x00\xc1\x00\xc2\x00\xc3\x00\xc4\x00\xc5\x00\xc6\x00\xc7\x00\xc8\x00\xc9\x00\xca\x00\xcb\x00\xcc\x00\xcd\x00\xce\x00\xcf\x00\xd0\x00\xd1\x00\xd2\x00\xd3\x00\xd4\x00\xd5\x00\xd6\x00\xd7\x00\xd8\x00\xd9\x00\xda\x00\xdb\x00\xdc\x00\xdd\x00\xde\x00\xdf\x00\xe0\x00\xe1\x00\xe2\x00\xe3\x00\xe4\x00\xe5\x00\xe6\x00\xe7\x00\xe8\x00\xe9\x00\xea\x00\xeb\x00\xec\x00\xed\x00\xee\x00\xef\x00\xf0\x00\xf1\x00\xf2\x00\xf3\x00\xf4\x00\xf5\x00\xf6\x00\xf7\x00\xf8\x00\xf9\x00\xfa\x00\xfb\x00\xfc\x00\xfd\x00\xfe\x00\xff\x00\x0a\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x62\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x80\x00\x81\x00\x82\x00\x83\x00\x84\x00\x85\x00\x86\x00\x87\x00\x88\x00\x89\x00\x8a\x00\x8b\x00\x8c\x00\x8d\x00\x8e\x00\x8f\x00\x90\x00\x91\x00\x92\x00\x93\x00\x94\x00\x95\x00\x96\x00\x97\x00\x98\x00\x99\x00\x9a\x00\x9b\x00\x9c\x00\x9d\x00\x9e\x00\x9f\x00\xa0\x00\xa1\x00\xa2\x00\xa3\x00\xa4\x00\xa5\x00\xa6\x00\xa7\x00\xa8\x00\xa9\x00\xaa\x00\xab\x00\xac\x00\xad\x00\xae\x00\xaf\x00\xb0\x00\xb1\x00\xb2\x00\xb3\x00\xb4\x00\xb5\x00\xb6\x00\xb7\x00\xb8\x00\xb9\x00\xba\x00\xbb\x00\xbc\x00\xbd\x00\xbe\x00\xbf\x00\xc0\x00\xc1\x00\xc2\x00\xc3\x00\xc4\x00\xc5\x00\xc6\x00\xc7\x00\xc8\x00\xc9\x00\xca\x00\xcb\x00\xcc\x00\xcd\x00\xce\x00\xcf\x00\xd0\x00\xd1\x00\xd2\x00\xd3\x00\xd4\x00\xd5\x00\xd6\x00\xd7\x00\xd8\x00\xd9\x00\xda\x00\xdb\x00\xdc\x00\xdd\x00\xde\x00\xdf\x00\xe0\x00\xe1\x00\xe2\x00\xe3\x00\xe4\x00\xe5\x00\xe6\x00\xe7\x00\xe8\x00\xe9\x00\xea\x00\xeb\x00\xec\x00\xed\x00\xee\x00\xef\x00\xf0\x00\xf1\x00\xf2\x00\xf3\x00\xf4\x00\xf5\x00\xf6\x00\xf7\x00\xf8\x00\xf9\x00\xfa\x00\xfb\x00\xfc\x00\xfd\x00\xfe\x00\xff\x00\x0a\x00\x21\x00\xff\xff\x23\x00\x24\x00\x25\x00\x26\x00\x27\x00\xff\xff\xff\xff\x2a\x00\x2b\x00\x2c\x00\x2d\x00\x2e\x00\x2f\x00\x30\x00\x31\x00\x32\x00\x33\x00\x34\x00\x35\x00\x36\x00\x37\x00\x38\x00\x39\x00\x3a\x00\xff\xff\x3c\x00\x3d\x00\x3e\x00\x3f\x00\xff\xff\x41\x00\x42\x00\x43\x00\x44\x00\x45\x00\x46\x00\x47\x00\x48\x00\x49\x00\x4a\x00\x4b\x00\x4c\x00\x4d\x00\x4e\x00\x4f\x00\x50\x00\x51\x00\x52\x00\x53\x00\x54\x00\x55\x00\x56\x00\x57\x00\x58\x00\x59\x00\x5a\x00\x5b\x00\x5c\x00\x5d\x00\x5e\x00\x5f\x00\x60\x00\x61\x00\x62\x00\x63\x00\x64\x00\x65\x00\x66\x00\x67\x00\x68\x00\x69\x00\x6a\x00\x6b\x00\x6c\x00\x6d\x00\x6e\x00\x6f\x00\x70\x00\x71\x00\x72\x00\x73\x00\x74\x00\x75\x00\x76\x00\x77\x00\x78\x00\x79\x00\x7a\x00\xff\xff\x7c\x00\xff\xff\x7e\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x6e\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x80\x00\x81\x00\x82\x00\x83\x00\x84\x00\x85\x00\x86\x00\x87\x00\x88\x00\x89\x00\x8a\x00\x8b\x00\x8c\x00\x8d\x00\x8e\x00\x8f\x00\x90\x00\x91\x00\x92\x00\x93\x00\x94\x00\x95\x00\x96\x00\x97\x00\x98\x00\x99\x00\x9a\x00\x9b\x00\x9c\x00\x9d\x00\x9e\x00\x9f\x00\xa0\x00\xa1\x00\xa2\x00\xa3\x00\xa4\x00\xa5\x00\xa6\x00\xa7\x00\xa8\x00\xa9\x00\xaa\x00\xab\x00\xac\x00\xad\x00\xae\x00\xaf\x00\xb0\x00\xb1\x00\xb2\x00\xb3\x00\xb4\x00\xb5\x00\xb6\x00\xb7\x00\xb8\x00\xb9\x00\xba\x00\xbb\x00\xbc\x00\xbd\x00\xbe\x00\xbf\x00\xc0\x00\xc1\x00\xc2\x00\xc3\x00\xc4\x00\xc5\x00\xc6\x00\xc7\x00\xc8\x00\xc9\x00\xca\x00\xcb\x00\xcc\x00\xcd\x00\xce\x00\xcf\x00\xd0\x00\xd1\x00\xd2\x00\xd3\x00\xd4\x00\xd5\x00\xd6\x00\xd7\x00\xd8\x00\xd9\x00\xda\x00\xdb\x00\xdc\x00\xdd\x00\xde\x00\xdf\x00\xe0\x00\xe1\x00\xe2\x00\xe3\x00\xe4\x00\xe5\x00\xe6\x00\xe7\x00\xe8\x00\xe9\x00\xea\x00\xeb\x00\xec\x00\xed\x00\xee\x00\xef\x00\xf0\x00\xf1\x00\xf2\x00\xf3\x00\xf4\x00\xf5\x00\xf6\x00\xf7\x00\xf8\x00\xf9\x00\xfa\x00\xfb\x00\xfc\x00\xfd\x00\xfe\x00\xff\x00\x0a\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x64\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x80\x00\x81\x00\x82\x00\x83\x00\x84\x00\x85\x00\x86\x00\x87\x00\x88\x00\x89\x00\x8a\x00\x8b\x00\x8c\x00\x8d\x00\x8e\x00\x8f\x00\x90\x00\x91\x00\x92\x00\x93\x00\x94\x00\x95\x00\x96\x00\x97\x00\x98\x00\x99\x00\x9a\x00\x9b\x00\x9c\x00\x9d\x00\x9e\x00\x9f\x00\xa0\x00\xa1\x00\xa2\x00\xa3\x00\xa4\x00\xa5\x00\xa6\x00\xa7\x00\xa8\x00\xa9\x00\xaa\x00\xab\x00\xac\x00\xad\x00\xae\x00\xaf\x00\xb0\x00\xb1\x00\xb2\x00\xb3\x00\xb4\x00\xb5\x00\xb6\x00\xb7\x00\xb8\x00\xb9\x00\xba\x00\xbb\x00\xbc\x00\xbd\x00\xbe\x00\xbf\x00\xc0\x00\xc1\x00\xc2\x00\xc3\x00\xc4\x00\xc5\x00\xc6\x00\xc7\x00\xc8\x00\xc9\x00\xca\x00\xcb\x00\xcc\x00\xcd\x00\xce\x00\xcf\x00\xd0\x00\xd1\x00\xd2\x00\xd3\x00\xd4\x00\xd5\x00\xd6\x00\xd7\x00\xd8\x00\xd9\x00\xda\x00\xdb\x00\xdc\x00\xdd\x00\xde\x00\xdf\x00\xe0\x00\xe1\x00\xe2\x00\xe3\x00\xe4\x00\xe5\x00\xe6\x00\xe7\x00\xe8\x00\xe9\x00\xea\x00\xeb\x00\xec\x00\xed\x00\xee\x00\xef\x00\xf0\x00\xf1\x00\xf2\x00\xf3\x00\xf4\x00\xf5\x00\xf6\x00\xf7\x00\xf8\x00\xf9\x00\xfa\x00\xfb\x00\xfc\x00\xfd\x00\xfe\x00\xff\x00\x09\x00\x0a\x00\x0b\x00\x0c\x00\x0d\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x21\x00\xff\xff\x23\x00\x24\x00\x25\x00\x26\x00\x27\x00\xff\xff\x20\x00\x2a\x00\x2b\x00\x2c\x00\x2d\x00\x2e\x00\x2f\x00\x30\x00\x31\x00\x32\x00\x33\x00\x34\x00\x35\x00\x36\x00\x37\x00\x38\x00\x39\x00\x3a\x00\xff\xff\x3c\x00\x3d\x00\x3e\x00\x3f\x00\xff\xff\x41\x00\x42\x00\x43\x00\x44\x00\x45\x00\x46\x00\x47\x00\x48\x00\x49\x00\x4a\x00\x4b\x00\x4c\x00\x4d\x00\x4e\x00\x4f\x00\x50\x00\x51\x00\x52\x00\x53\x00\x54\x00\x55\x00\x56\x00\x57\x00\x58\x00\x59\x00\x5a\x00\x5b\x00\x5c\x00\x5d\x00\x5e\x00\x5f\x00\x60\x00\x61\x00\x62\x00\x63\x00\x64\x00\x65\x00\x66\x00\x67\x00\x68\x00\x69\x00\x6a\x00\x6b\x00\x6c\x00\x6d\x00\x6e\x00\x6f\x00\x70\x00\x71\x00\x72\x00\x73\x00\x74\x00\x75\x00\x76\x00\x77\x00\x78\x00\x79\x00\x7a\x00\xff\xff\x7c\x00\xff\xff\x7e\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x80\x00\x81\x00\x82\x00\x83\x00\x84\x00\x85\x00\x86\x00\x87\x00\x88\x00\x89\x00\x8a\x00\x8b\x00\x8c\x00\x8d\x00\x8e\x00\x8f\x00\x90\x00\x91\x00\x92\x00\x93\x00\x94\x00\x95\x00\x96\x00\x97\x00\x98\x00\x99\x00\x9a\x00\x9b\x00\x9c\x00\x9d\x00\x9e\x00\x9f\x00\xa0\x00\xa1\x00\xa2\x00\xa3\x00\xa4\x00\xa5\x00\xa6\x00\xa7\x00\xa8\x00\xa9\x00\xaa\x00\xab\x00\xac\x00\xad\x00\xae\x00\xaf\x00\xb0\x00\xb1\x00\xb2\x00\xb3\x00\xb4\x00\xb5\x00\xb6\x00\xb7\x00\xb8\x00\xb9\x00\xba\x00\xbb\x00\xbc\x00\xbd\x00\xbe\x00\xbf\x00\xc0\x00\xc1\x00\xc2\x00\xc3\x00\xc4\x00\xc5\x00\xc6\x00\xc7\x00\xc8\x00\xc9\x00\xca\x00\xcb\x00\xcc\x00\xcd\x00\xce\x00\xcf\x00\xd0\x00\xd1\x00\xd2\x00\xd3\x00\xd4\x00\xd5\x00\xd6\x00\xd7\x00\xd8\x00\xd9\x00\xda\x00\xdb\x00\xdc\x00\xdd\x00\xde\x00\xdf\x00\xe0\x00\xe1\x00\xe2\x00\xe3\x00\xe4\x00\xe5\x00\xe6\x00\xe7\x00\xe8\x00\xe9\x00\xea\x00\xeb\x00\xec\x00\xed\x00\xee\x00\xef\x00\xf0\x00\xf1\x00\xf2\x00\xf3\x00\xf4\x00\xf5\x00\xf6\x00\xf7\x00\xf8\x00\xf9\x00\xfa\x00\xfb\x00\xfc\x00\xfd\x00\xfe\x00\xff\x00\x09\x00\x0a\x00\x0b\x00\x0c\x00\x0d\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x21\x00\xff\xff\x23\x00\x24\x00\x25\x00\x26\x00\x27\x00\xff\xff\x20\x00\x2a\x00\x2b\x00\x2c\x00\x2d\x00\x2e\x00\x2f\x00\x30\x00\x31\x00\x32\x00\x33\x00\x34\x00\x35\x00\x36\x00\x37\x00\x38\x00\x39\x00\x3a\x00\xff\xff\x3c\x00\x3d\x00\x3e\x00\x3f\x00\xff\xff\x41\x00\x42\x00\x43\x00\x44\x00\x45\x00\x46\x00\x47\x00\x48\x00\x49\x00\x4a\x00\x4b\x00\x4c\x00\x4d\x00\x4e\x00\x4f\x00\x50\x00\x51\x00\x52\x00\x53\x00\x54\x00\x55\x00\x56\x00\x57\x00\x58\x00\x59\x00\x5a\x00\x5b\x00\x5c\x00\x5d\x00\x5e\x00\x5f\x00\x60\x00\x61\x00\x62\x00\x63\x00\x64\x00\x65\x00\x66\x00\x67\x00\x68\x00\x69\x00\x6a\x00\x6b\x00\x6c\x00\x6d\x00\x6e\x00\x6f\x00\x70\x00\x71\x00\x72\x00\x73\x00\x74\x00\x75\x00\x76\x00\x77\x00\x78\x00\x79\x00\x7a\x00\xff\xff\x7c\x00\xff\xff\x7e\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x80\x00\x81\x00\x82\x00\x83\x00\x84\x00\x85\x00\x86\x00\x87\x00\x88\x00\x89\x00\x8a\x00\x8b\x00\x8c\x00\x8d\x00\x8e\x00\x8f\x00\x90\x00\x91\x00\x92\x00\x93\x00\x94\x00\x95\x00\x96\x00\x97\x00\x98\x00\x99\x00\x9a\x00\x9b\x00\x9c\x00\x9d\x00\x9e\x00\x9f\x00\xa0\x00\xa1\x00\xa2\x00\xa3\x00\xa4\x00\xa5\x00\xa6\x00\xa7\x00\xa8\x00\xa9\x00\xaa\x00\xab\x00\xac\x00\xad\x00\xae\x00\xaf\x00\xb0\x00\xb1\x00\xb2\x00\xb3\x00\xb4\x00\xb5\x00\xb6\x00\xb7\x00\xb8\x00\xb9\x00\xba\x00\xbb\x00\xbc\x00\xbd\x00\xbe\x00\xbf\x00\xc0\x00\xc1\x00\xc2\x00\xc3\x00\xc4\x00\xc5\x00\xc6\x00\xc7\x00\xc8\x00\xc9\x00\xca\x00\xcb\x00\xcc\x00\xcd\x00\xce\x00\xcf\x00\xd0\x00\xd1\x00\xd2\x00\xd3\x00\xd4\x00\xd5\x00\xd6\x00\xd7\x00\xd8\x00\xd9\x00\xda\x00\xdb\x00\xdc\x00\xdd\x00\xde\x00\xdf\x00\xe0\x00\xe1\x00\xe2\x00\xe3\x00\xe4\x00\xe5\x00\xe6\x00\xe7\x00\xe8\x00\xe9\x00\xea\x00\xeb\x00\xec\x00\xed\x00\xee\x00\xef\x00\xf0\x00\xf1\x00\xf2\x00\xf3\x00\xf4\x00\xf5\x00\xf6\x00\xf7\x00\xf8\x00\xf9\x00\xfa\x00\xfb\x00\xfc\x00\xfd\x00\xfe\x00\xff\x00\x09\x00\x0a\x00\x0b\x00\x0c\x00\x0d\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x21\x00\xff\xff\x23\x00\x24\x00\x25\x00\x26\x00\x27\x00\xff\xff\x20\x00\x2a\x00\x2b\x00\x2c\x00\x2d\x00\x2e\x00\x2f\x00\x30\x00\x31\x00\x32\x00\x33\x00\x34\x00\x35\x00\x36\x00\x37\x00\x38\x00\x39\x00\x3a\x00\xff\xff\x3c\x00\x3d\x00\x3e\x00\x3f\x00\xff\xff\x41\x00\x42\x00\x43\x00\x44\x00\x45\x00\x46\x00\x47\x00\x48\x00\x49\x00\x4a\x00\x4b\x00\x4c\x00\x4d\x00\x4e\x00\x4f\x00\x50\x00\x51\x00\x52\x00\x53\x00\x54\x00\x55\x00\x56\x00\x57\x00\x58\x00\x59\x00\x5a\x00\x5b\x00\x5c\x00\x5d\x00\x5e\x00\x5f\x00\x60\x00\x61\x00\x62\x00\x63\x00\x64\x00\x65\x00\x66\x00\x67\x00\x68\x00\x69\x00\x6a\x00\x6b\x00\x6c\x00\x6d\x00\x6e\x00\x6f\x00\x70\x00\x71\x00\x72\x00\x73\x00\x74\x00\x75\x00\x76\x00\x77\x00\x78\x00\x79\x00\x7a\x00\xff\xff\x7c\x00\xff\xff\x7e\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x80\x00\x81\x00\x82\x00\x83\x00\x84\x00\x85\x00\x86\x00\x87\x00\x88\x00\x89\x00\x8a\x00\x8b\x00\x8c\x00\x8d\x00\x8e\x00\x8f\x00\x90\x00\x91\x00\x92\x00\x93\x00\x94\x00\x95\x00\x96\x00\x97\x00\x98\x00\x99\x00\x9a\x00\x9b\x00\x9c\x00\x9d\x00\x9e\x00\x9f\x00\xa0\x00\xa1\x00\xa2\x00\xa3\x00\xa4\x00\xa5\x00\xa6\x00\xa7\x00\xa8\x00\xa9\x00\xaa\x00\xab\x00\xac\x00\xad\x00\xae\x00\xaf\x00\xb0\x00\xb1\x00\xb2\x00\xb3\x00\xb4\x00\xb5\x00\xb6\x00\xb7\x00\xb8\x00\xb9\x00\xba\x00\xbb\x00\xbc\x00\xbd\x00\xbe\x00\xbf\x00\xc0\x00\xc1\x00\xc2\x00\xc3\x00\xc4\x00\xc5\x00\xc6\x00\xc7\x00\xc8\x00\xc9\x00\xca\x00\xcb\x00\xcc\x00\xcd\x00\xce\x00\xcf\x00\xd0\x00\xd1\x00\xd2\x00\xd3\x00\xd4\x00\xd5\x00\xd6\x00\xd7\x00\xd8\x00\xd9\x00\xda\x00\xdb\x00\xdc\x00\xdd\x00\xde\x00\xdf\x00\xe0\x00\xe1\x00\xe2\x00\xe3\x00\xe4\x00\xe5\x00\xe6\x00\xe7\x00\xe8\x00\xe9\x00\xea\x00\xeb\x00\xec\x00\xed\x00\xee\x00\xef\x00\xf0\x00\xf1\x00\xf2\x00\xf3\x00\xf4\x00\xf5\x00\xf6\x00\xf7\x00\xf8\x00\xf9\x00\xfa\x00\xfb\x00\xfc\x00\xfd\x00\xfe\x00\xff\x00\x09\x00\x0a\x00\x0b\x00\x0c\x00\x0d\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x21\x00\xff\xff\x23\x00\x24\x00\x25\x00\x26\x00\x27\x00\xff\xff\x20\x00\x2a\x00\x2b\x00\x2c\x00\x2d\x00\x2e\x00\x2f\x00\x30\x00\x31\x00\x32\x00\x33\x00\x34\x00\x35\x00\x36\x00\x37\x00\x38\x00\x39\x00\x3a\x00\xff\xff\x3c\x00\x3d\x00\x3e\x00\x3f\x00\xff\xff\x41\x00\x42\x00\x43\x00\x44\x00\x45\x00\x46\x00\x47\x00\x48\x00\x49\x00\x4a\x00\x4b\x00\x4c\x00\x4d\x00\x4e\x00\x4f\x00\x50\x00\x51\x00\x52\x00\x53\x00\x54\x00\x55\x00\x56\x00\x57\x00\x58\x00\x59\x00\x5a\x00\x5b\x00\x5c\x00\x5d\x00\x5e\x00\x5f\x00\x60\x00\x61\x00\x62\x00\x63\x00\x64\x00\x65\x00\x66\x00\x67\x00\x68\x00\x69\x00\x6a\x00\x6b\x00\x6c\x00\x6d\x00\x6e\x00\x6f\x00\x70\x00\x71\x00\x72\x00\x73\x00\x74\x00\x75\x00\x76\x00\x77\x00\x78\x00\x79\x00\x7a\x00\xff\xff\x7c\x00\xff\xff\x7e\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x80\x00\x81\x00\x82\x00\x83\x00\x84\x00\x85\x00\x86\x00\x87\x00\x88\x00\x89\x00\x8a\x00\x8b\x00\x8c\x00\x8d\x00\x8e\x00\x8f\x00\x90\x00\x91\x00\x92\x00\x93\x00\x94\x00\x95\x00\x96\x00\x97\x00\x98\x00\x99\x00\x9a\x00\x9b\x00\x9c\x00\x9d\x00\x9e\x00\x9f\x00\xa0\x00\xa1\x00\xa2\x00\xa3\x00\xa4\x00\xa5\x00\xa6\x00\xa7\x00\xa8\x00\xa9\x00\xaa\x00\xab\x00\xac\x00\xad\x00\xae\x00\xaf\x00\xb0\x00\xb1\x00\xb2\x00\xb3\x00\xb4\x00\xb5\x00\xb6\x00\xb7\x00\xb8\x00\xb9\x00\xba\x00\xbb\x00\xbc\x00\xbd\x00\xbe\x00\xbf\x00\xc0\x00\xc1\x00\xc2\x00\xc3\x00\xc4\x00\xc5\x00\xc6\x00\xc7\x00\xc8\x00\xc9\x00\xca\x00\xcb\x00\xcc\x00\xcd\x00\xce\x00\xcf\x00\xd0\x00\xd1\x00\xd2\x00\xd3\x00\xd4\x00\xd5\x00\xd6\x00\xd7\x00\xd8\x00\xd9\x00\xda\x00\xdb\x00\xdc\x00\xdd\x00\xde\x00\xdf\x00\xe0\x00\xe1\x00\xe2\x00\xe3\x00\xe4\x00\xe5\x00\xe6\x00\xe7\x00\xe8\x00\xe9\x00\xea\x00\xeb\x00\xec\x00\xed\x00\xee\x00\xef\x00\xf0\x00\xf1\x00\xf2\x00\xf3\x00\xf4\x00\xf5\x00\xf6\x00\xf7\x00\xf8\x00\xf9\x00\xfa\x00\xfb\x00\xfc\x00\xfd\x00\xfe\x00\xff\x00\x09\x00\x0a\x00\x0b\x00\x0c\x00\x0d\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x21\x00\xff\xff\x23\x00\x24\x00\x25\x00\x26\x00\x27\x00\xff\xff\x20\x00\x2a\x00\x2b\x00\x2c\x00\x2d\x00\x2e\x00\x2f\x00\x30\x00\x31\x00\x32\x00\x33\x00\x34\x00\x35\x00\x36\x00\x37\x00\x38\x00\x39\x00\x3a\x00\xff\xff\x3c\x00\x3d\x00\x3e\x00\x3f\x00\xff\xff\x41\x00\x42\x00\x43\x00\x44\x00\x45\x00\x46\x00\x47\x00\x48\x00\x49\x00\x4a\x00\x4b\x00\x4c\x00\x4d\x00\x4e\x00\x4f\x00\x50\x00\x51\x00\x52\x00\x53\x00\x54\x00\x55\x00\x56\x00\x57\x00\x58\x00\x59\x00\x5a\x00\x5b\x00\x5c\x00\x5d\x00\x5e\x00\x5f\x00\x60\x00\x61\x00\x62\x00\x63\x00\x64\x00\x65\x00\x66\x00\x67\x00\x68\x00\x69\x00\x6a\x00\x6b\x00\x6c\x00\x6d\x00\x6e\x00\x6f\x00\x70\x00\x71\x00\x72\x00\x73\x00\x74\x00\x75\x00\x76\x00\x77\x00\x78\x00\x79\x00\x7a\x00\xff\xff\x7c\x00\xff\xff\x7e\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x80\x00\x81\x00\x82\x00\x83\x00\x84\x00\x85\x00\x86\x00\x87\x00\x88\x00\x89\x00\x8a\x00\x8b\x00\x8c\x00\x8d\x00\x8e\x00\x8f\x00\x90\x00\x91\x00\x92\x00\x93\x00\x94\x00\x95\x00\x96\x00\x97\x00\x98\x00\x99\x00\x9a\x00\x9b\x00\x9c\x00\x9d\x00\x9e\x00\x9f\x00\xa0\x00\xa1\x00\xa2\x00\xa3\x00\xa4\x00\xa5\x00\xa6\x00\xa7\x00\xa8\x00\xa9\x00\xaa\x00\xab\x00\xac\x00\xad\x00\xae\x00\xaf\x00\xb0\x00\xb1\x00\xb2\x00\xb3\x00\xb4\x00\xb5\x00\xb6\x00\xb7\x00\xb8\x00\xb9\x00\xba\x00\xbb\x00\xbc\x00\xbd\x00\xbe\x00\xbf\x00\xc0\x00\xc1\x00\xc2\x00\xc3\x00\xc4\x00\xc5\x00\xc6\x00\xc7\x00\xc8\x00\xc9\x00\xca\x00\xcb\x00\xcc\x00\xcd\x00\xce\x00\xcf\x00\xd0\x00\xd1\x00\xd2\x00\xd3\x00\xd4\x00\xd5\x00\xd6\x00\xd7\x00\xd8\x00\xd9\x00\xda\x00\xdb\x00\xdc\x00\xdd\x00\xde\x00\xdf\x00\xe0\x00\xe1\x00\xe2\x00\xe3\x00\xe4\x00\xe5\x00\xe6\x00\xe7\x00\xe8\x00\xe9\x00\xea\x00\xeb\x00\xec\x00\xed\x00\xee\x00\xef\x00\xf0\x00\xf1\x00\xf2\x00\xf3\x00\xf4\x00\xf5\x00\xf6\x00\xf7\x00\xf8\x00\xf9\x00\xfa\x00\xfb\x00\xfc\x00\xfd\x00\xfe\x00\xff\x00\x09\x00\x0a\x00\x0b\x00\x0c\x00\x0d\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x21\x00\xff\xff\x23\x00\x24\x00\x25\x00\x26\x00\x27\x00\xff\xff\x20\x00\x2a\x00\x2b\x00\x2c\x00\x2d\x00\x2e\x00\x2f\x00\x30\x00\x31\x00\x32\x00\x33\x00\x34\x00\x35\x00\x36\x00\x37\x00\x38\x00\x39\x00\x3a\x00\xff\xff\x3c\x00\x3d\x00\x3e\x00\x3f\x00\xff\xff\x41\x00\x42\x00\x43\x00\x44\x00\x45\x00\x46\x00\x47\x00\x48\x00\x49\x00\x4a\x00\x4b\x00\x4c\x00\x4d\x00\x4e\x00\x4f\x00\x50\x00\x51\x00\x52\x00\x53\x00\x54\x00\x55\x00\x56\x00\x57\x00\x58\x00\x59\x00\x5a\x00\x5b\x00\x5c\x00\x5d\x00\x5e\x00\x5f\x00\x60\x00\x61\x00\x62\x00\x63\x00\x64\x00\x65\x00\x66\x00\x67\x00\x68\x00\x69\x00\x6a\x00\x6b\x00\x6c\x00\x6d\x00\x6e\x00\x6f\x00\x70\x00\x71\x00\x72\x00\x73\x00\x74\x00\x75\x00\x76\x00\x77\x00\x78\x00\x79\x00\x7a\x00\xff\xff\x7c\x00\xff\xff\x7e\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x80\x00\x81\x00\x82\x00\x83\x00\x84\x00\x85\x00\x86\x00\x87\x00\x88\x00\x89\x00\x8a\x00\x8b\x00\x8c\x00\x8d\x00\x8e\x00\x8f\x00\x90\x00\x91\x00\x92\x00\x93\x00\x94\x00\x95\x00\x96\x00\x97\x00\x98\x00\x99\x00\x9a\x00\x9b\x00\x9c\x00\x9d\x00\x9e\x00\x9f\x00\xa0\x00\xa1\x00\xa2\x00\xa3\x00\xa4\x00\xa5\x00\xa6\x00\xa7\x00\xa8\x00\xa9\x00\xaa\x00\xab\x00\xac\x00\xad\x00\xae\x00\xaf\x00\xb0\x00\xb1\x00\xb2\x00\xb3\x00\xb4\x00\xb5\x00\xb6\x00\xb7\x00\xb8\x00\xb9\x00\xba\x00\xbb\x00\xbc\x00\xbd\x00\xbe\x00\xbf\x00\xc0\x00\xc1\x00\xc2\x00\xc3\x00\xc4\x00\xc5\x00\xc6\x00\xc7\x00\xc8\x00\xc9\x00\xca\x00\xcb\x00\xcc\x00\xcd\x00\xce\x00\xcf\x00\xd0\x00\xd1\x00\xd2\x00\xd3\x00\xd4\x00\xd5\x00\xd6\x00\xd7\x00\xd8\x00\xd9\x00\xda\x00\xdb\x00\xdc\x00\xdd\x00\xde\x00\xdf\x00\xe0\x00\xe1\x00\xe2\x00\xe3\x00\xe4\x00\xe5\x00\xe6\x00\xe7\x00\xe8\x00\xe9\x00\xea\x00\xeb\x00\xec\x00\xed\x00\xee\x00\xef\x00\xf0\x00\xf1\x00\xf2\x00\xf3\x00\xf4\x00\xf5\x00\xf6\x00\xf7\x00\xf8\x00\xf9\x00\xfa\x00\xfb\x00\xfc\x00\xfd\x00\xfe\x00\xff\x00\x09\x00\x0a\x00\x0b\x00\x0c\x00\x0d\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x21\x00\xff\xff\x23\x00\x24\x00\x25\x00\x26\x00\x27\x00\xff\xff\x20\x00\x2a\x00\x2b\x00\x2c\x00\x2d\x00\x2e\x00\x2f\x00\x30\x00\x31\x00\x32\x00\x33\x00\x34\x00\x35\x00\x36\x00\x37\x00\x38\x00\x39\x00\x3a\x00\xff\xff\x3c\x00\x3d\x00\x3e\x00\x3f\x00\xff\xff\x41\x00\x42\x00\x43\x00\x44\x00\x45\x00\x46\x00\x47\x00\x48\x00\x49\x00\x4a\x00\x4b\x00\x4c\x00\x4d\x00\x4e\x00\x4f\x00\x50\x00\x51\x00\x52\x00\x53\x00\x54\x00\x55\x00\x56\x00\x57\x00\x58\x00\x59\x00\x5a\x00\x5b\x00\x5c\x00\x5d\x00\x5e\x00\x5f\x00\x60\x00\x61\x00\x62\x00\x63\x00\x64\x00\x65\x00\x66\x00\x67\x00\x68\x00\x69\x00\x6a\x00\x6b\x00\x6c\x00\x6d\x00\x6e\x00\x6f\x00\x70\x00\x71\x00\x72\x00\x73\x00\x74\x00\x75\x00\x76\x00\x77\x00\x78\x00\x79\x00\x7a\x00\xff\xff\x7c\x00\xff\xff\x7e\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x80\x00\x81\x00\x82\x00\x83\x00\x84\x00\x85\x00\x86\x00\x87\x00\x88\x00\x89\x00\x8a\x00\x8b\x00\x8c\x00\x8d\x00\x8e\x00\x8f\x00\x90\x00\x91\x00\x92\x00\x93\x00\x94\x00\x95\x00\x96\x00\x97\x00\x98\x00\x99\x00\x9a\x00\x9b\x00\x9c\x00\x9d\x00\x9e\x00\x9f\x00\xa0\x00\xa1\x00\xa2\x00\xa3\x00\xa4\x00\xa5\x00\xa6\x00\xa7\x00\xa8\x00\xa9\x00\xaa\x00\xab\x00\xac\x00\xad\x00\xae\x00\xaf\x00\xb0\x00\xb1\x00\xb2\x00\xb3\x00\xb4\x00\xb5\x00\xb6\x00\xb7\x00\xb8\x00\xb9\x00\xba\x00\xbb\x00\xbc\x00\xbd\x00\xbe\x00\xbf\x00\xc0\x00\xc1\x00\xc2\x00\xc3\x00\xc4\x00\xc5\x00\xc6\x00\xc7\x00\xc8\x00\xc9\x00\xca\x00\xcb\x00\xcc\x00\xcd\x00\xce\x00\xcf\x00\xd0\x00\xd1\x00\xd2\x00\xd3\x00\xd4\x00\xd5\x00\xd6\x00\xd7\x00\xd8\x00\xd9\x00\xda\x00\xdb\x00\xdc\x00\xdd\x00\xde\x00\xdf\x00\xe0\x00\xe1\x00\xe2\x00\xe3\x00\xe4\x00\xe5\x00\xe6\x00\xe7\x00\xe8\x00\xe9\x00\xea\x00\xeb\x00\xec\x00\xed\x00\xee\x00\xef\x00\xf0\x00\xf1\x00\xf2\x00\xf3\x00\xf4\x00\xf5\x00\xf6\x00\xf7\x00\xf8\x00\xf9\x00\xfa\x00\xfb\x00\xfc\x00\xfd\x00\xfe\x00\xff\x00\x09\x00\x0a\x00\x0b\x00\x0c\x00\x0d\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x20\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x5f\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x80\x00\x81\x00\x82\x00\x83\x00\x84\x00\x85\x00\x86\x00\x87\x00\x88\x00\x89\x00\x8a\x00\x8b\x00\x8c\x00\x8d\x00\x8e\x00\x8f\x00\x90\x00\x91\x00\x92\x00\x93\x00\x94\x00\x95\x00\x96\x00\x97\x00\x98\x00\x99\x00\x9a\x00\x9b\x00\x9c\x00\x9d\x00\x9e\x00\x9f\x00\xa0\x00\xa1\x00\xa2\x00\xa3\x00\xa4\x00\xa5\x00\xa6\x00\xa7\x00\xa8\x00\xa9\x00\xaa\x00\xab\x00\xac\x00\xad\x00\xae\x00\xaf\x00\xb0\x00\xb1\x00\xb2\x00\xb3\x00\xb4\x00\xb5\x00\xb6\x00\xb7\x00\xb8\x00\xb9\x00\xba\x00\xbb\x00\xbc\x00\xbd\x00\xbe\x00\xbf\x00\xc0\x00\xc1\x00\xc2\x00\xc3\x00\xc4\x00\xc5\x00\xc6\x00\xc7\x00\xc8\x00\xc9\x00\xca\x00\xcb\x00\xcc\x00\xcd\x00\xce\x00\xcf\x00\xd0\x00\xd1\x00\xd2\x00\xd3\x00\xd4\x00\xd5\x00\xd6\x00\xd7\x00\xd8\x00\xd9\x00\xda\x00\xdb\x00\xdc\x00\xdd\x00\xde\x00\xdf\x00\xe0\x00\xe1\x00\xe2\x00\xe3\x00\xe4\x00\xe5\x00\xe6\x00\xe7\x00\xe8\x00\xe9\x00\xea\x00\xeb\x00\xec\x00\xed\x00\xee\x00\xef\x00\xf0\x00\xf1\x00\xf2\x00\xf3\x00\xf4\x00\xf5\x00\xf6\x00\xf7\x00\xf8\x00\xf9\x00\xfa\x00\xfb\x00\xfc\x00\xfd\x00\xfe\x00\xff\x00\x09\x00\x0a\x00\x0b\x00\x0c\x00\x0d\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x21\x00\xff\xff\x23\x00\x24\x00\x25\x00\x26\x00\x27\x00\xff\xff\x20\x00\x2a\x00\x2b\x00\x2c\x00\x2d\x00\x2e\x00\x2f\x00\x30\x00\x31\x00\x32\x00\x33\x00\x34\x00\x35\x00\x36\x00\x37\x00\x38\x00\x39\x00\x3a\x00\xff\xff\x3c\x00\x3d\x00\x3e\x00\x3f\x00\xff\xff\x41\x00\x42\x00\x43\x00\x44\x00\x45\x00\x46\x00\x47\x00\x48\x00\x49\x00\x4a\x00\x4b\x00\x4c\x00\x4d\x00\x4e\x00\x4f\x00\x50\x00\x51\x00\x52\x00\x53\x00\x54\x00\x55\x00\x56\x00\x57\x00\x58\x00\x59\x00\x5a\x00\x5b\x00\x5c\x00\x5d\x00\x5e\x00\x5f\x00\x60\x00\x61\x00\x62\x00\x63\x00\x64\x00\x65\x00\x66\x00\x67\x00\x68\x00\x69\x00\x6a\x00\x6b\x00\x6c\x00\x6d\x00\x6e\x00\x6f\x00\x70\x00\x71\x00\x72\x00\x73\x00\x74\x00\x75\x00\x76\x00\x77\x00\x78\x00\x79\x00\x7a\x00\xff\xff\x7c\x00\xff\xff\x7e\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x80\x00\x81\x00\x82\x00\x83\x00\x84\x00\x85\x00\x86\x00\x87\x00\x88\x00\x89\x00\x8a\x00\x8b\x00\x8c\x00\x8d\x00\x8e\x00\x8f\x00\x90\x00\x91\x00\x92\x00\x93\x00\x94\x00\x95\x00\x96\x00\x97\x00\x98\x00\x99\x00\x9a\x00\x9b\x00\x9c\x00\x9d\x00\x9e\x00\x9f\x00\xa0\x00\xa1\x00\xa2\x00\xa3\x00\xa4\x00\xa5\x00\xa6\x00\xa7\x00\xa8\x00\xa9\x00\xaa\x00\xab\x00\xac\x00\xad\x00\xae\x00\xaf\x00\xb0\x00\xb1\x00\xb2\x00\xb3\x00\xb4\x00\xb5\x00\xb6\x00\xb7\x00\xb8\x00\xb9\x00\xba\x00\xbb\x00\xbc\x00\xbd\x00\xbe\x00\xbf\x00\xc0\x00\xc1\x00\xc2\x00\xc3\x00\xc4\x00\xc5\x00\xc6\x00\xc7\x00\xc8\x00\xc9\x00\xca\x00\xcb\x00\xcc\x00\xcd\x00\xce\x00\xcf\x00\xd0\x00\xd1\x00\xd2\x00\xd3\x00\xd4\x00\xd5\x00\xd6\x00\xd7\x00\xd8\x00\xd9\x00\xda\x00\xdb\x00\xdc\x00\xdd\x00\xde\x00\xdf\x00\xe0\x00\xe1\x00\xe2\x00\xe3\x00\xe4\x00\xe5\x00\xe6\x00\xe7\x00\xe8\x00\xe9\x00\xea\x00\xeb\x00\xec\x00\xed\x00\xee\x00\xef\x00\xf0\x00\xf1\x00\xf2\x00\xf3\x00\xf4\x00\xf5\x00\xf6\x00\xf7\x00\xf8\x00\xf9\x00\xfa\x00\xfb\x00\xfc\x00\xfd\x00\xfe\x00\xff\x00\x09\x00\x0a\x00\x0b\x00\x0c\x00\x0d\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x21\x00\xff\xff\x23\x00\x24\x00\x25\x00\x26\x00\x27\x00\xff\xff\x20\x00\x2a\x00\x2b\x00\x2c\x00\x2d\x00\x2e\x00\x2f\x00\x30\x00\x31\x00\x32\x00\x33\x00\x34\x00\x35\x00\x36\x00\x37\x00\x38\x00\x39\x00\x3a\x00\xff\xff\x3c\x00\x3d\x00\x3e\x00\x3f\x00\xff\xff\x41\x00\x42\x00\x43\x00\x44\x00\x45\x00\x46\x00\x47\x00\x48\x00\x49\x00\x4a\x00\x4b\x00\x4c\x00\x4d\x00\x4e\x00\x4f\x00\x50\x00\x51\x00\x52\x00\x53\x00\x54\x00\x55\x00\x56\x00\x57\x00\x58\x00\x59\x00\x5a\x00\x5b\x00\x5c\x00\x5d\x00\x5e\x00\x5f\x00\x60\x00\x61\x00\x62\x00\x63\x00\x64\x00\x65\x00\x66\x00\x67\x00\x68\x00\x69\x00\x6a\x00\x6b\x00\x6c\x00\x6d\x00\x6e\x00\x6f\x00\x70\x00\x71\x00\x72\x00\x73\x00\x74\x00\x75\x00\x76\x00\x77\x00\x78\x00\x79\x00\x7a\x00\xff\xff\x7c\x00\xff\xff\x7e\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x80\x00\x81\x00\x82\x00\x83\x00\x84\x00\x85\x00\x86\x00\x87\x00\x88\x00\x89\x00\x8a\x00\x8b\x00\x8c\x00\x8d\x00\x8e\x00\x8f\x00\x90\x00\x91\x00\x92\x00\x93\x00\x94\x00\x95\x00\x96\x00\x97\x00\x98\x00\x99\x00\x9a\x00\x9b\x00\x9c\x00\x9d\x00\x9e\x00\x9f\x00\xa0\x00\xa1\x00\xa2\x00\xa3\x00\xa4\x00\xa5\x00\xa6\x00\xa7\x00\xa8\x00\xa9\x00\xaa\x00\xab\x00\xac\x00\xad\x00\xae\x00\xaf\x00\xb0\x00\xb1\x00\xb2\x00\xb3\x00\xb4\x00\xb5\x00\xb6\x00\xb7\x00\xb8\x00\xb9\x00\xba\x00\xbb\x00\xbc\x00\xbd\x00\xbe\x00\xbf\x00\xc0\x00\xc1\x00\xc2\x00\xc3\x00\xc4\x00\xc5\x00\xc6\x00\xc7\x00\xc8\x00\xc9\x00\xca\x00\xcb\x00\xcc\x00\xcd\x00\xce\x00\xcf\x00\xd0\x00\xd1\x00\xd2\x00\xd3\x00\xd4\x00\xd5\x00\xd6\x00\xd7\x00\xd8\x00\xd9\x00\xda\x00\xdb\x00\xdc\x00\xdd\x00\xde\x00\xdf\x00\xe0\x00\xe1\x00\xe2\x00\xe3\x00\xe4\x00\xe5\x00\xe6\x00\xe7\x00\xe8\x00\xe9\x00\xea\x00\xeb\x00\xec\x00\xed\x00\xee\x00\xef\x00\xf0\x00\xf1\x00\xf2\x00\xf3\x00\xf4\x00\xf5\x00\xf6\x00\xf7\x00\xf8\x00\xf9\x00\xfa\x00\xfb\x00\xfc\x00\xfd\x00\xfe\x00\xff\x00\x09\x00\x0a\x00\x0b\x00\x0c\x00\x0d\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x21\x00\xff\xff\x23\x00\x24\x00\x25\x00\x26\x00\x27\x00\xff\xff\x20\x00\x2a\x00\x2b\x00\x2c\x00\x2d\x00\x2e\x00\x2f\x00\x30\x00\x31\x00\x32\x00\x33\x00\x34\x00\x35\x00\x36\x00\x37\x00\x38\x00\x39\x00\x3a\x00\xff\xff\x3c\x00\x3d\x00\x3e\x00\x3f\x00\xff\xff\x41\x00\x42\x00\x43\x00\x44\x00\x45\x00\x46\x00\x47\x00\x48\x00\x49\x00\x4a\x00\x4b\x00\x4c\x00\x4d\x00\x4e\x00\x4f\x00\x50\x00\x51\x00\x52\x00\x53\x00\x54\x00\x55\x00\x56\x00\x57\x00\x58\x00\x59\x00\x5a\x00\x5b\x00\x5c\x00\x5d\x00\x5e\x00\x5f\x00\x60\x00\x61\x00\x62\x00\x63\x00\x64\x00\x65\x00\x66\x00\x67\x00\x68\x00\x69\x00\x6a\x00\x6b\x00\x6c\x00\x6d\x00\x6e\x00\x6f\x00\x70\x00\x71\x00\x72\x00\x73\x00\x74\x00\x75\x00\x76\x00\x77\x00\x78\x00\x79\x00\x7a\x00\xff\xff\x7c\x00\xff\xff\x7e\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x80\x00\x81\x00\x82\x00\x83\x00\x84\x00\x85\x00\x86\x00\x87\x00\x88\x00\x89\x00\x8a\x00\x8b\x00\x8c\x00\x8d\x00\x8e\x00\x8f\x00\x90\x00\x91\x00\x92\x00\x93\x00\x94\x00\x95\x00\x96\x00\x97\x00\x98\x00\x99\x00\x9a\x00\x9b\x00\x9c\x00\x9d\x00\x9e\x00\x9f\x00\xa0\x00\xa1\x00\xa2\x00\xa3\x00\xa4\x00\xa5\x00\xa6\x00\xa7\x00\xa8\x00\xa9\x00\xaa\x00\xab\x00\xac\x00\xad\x00\xae\x00\xaf\x00\xb0\x00\xb1\x00\xb2\x00\xb3\x00\xb4\x00\xb5\x00\xb6\x00\xb7\x00\xb8\x00\xb9\x00\xba\x00\xbb\x00\xbc\x00\xbd\x00\xbe\x00\xbf\x00\xc0\x00\xc1\x00\xc2\x00\xc3\x00\xc4\x00\xc5\x00\xc6\x00\xc7\x00\xc8\x00\xc9\x00\xca\x00\xcb\x00\xcc\x00\xcd\x00\xce\x00\xcf\x00\xd0\x00\xd1\x00\xd2\x00\xd3\x00\xd4\x00\xd5\x00\xd6\x00\xd7\x00\xd8\x00\xd9\x00\xda\x00\xdb\x00\xdc\x00\xdd\x00\xde\x00\xdf\x00\xe0\x00\xe1\x00\xe2\x00\xe3\x00\xe4\x00\xe5\x00\xe6\x00\xe7\x00\xe8\x00\xe9\x00\xea\x00\xeb\x00\xec\x00\xed\x00\xee\x00\xef\x00\xf0\x00\xf1\x00\xf2\x00\xf3\x00\xf4\x00\xf5\x00\xf6\x00\xf7\x00\xf8\x00\xf9\x00\xfa\x00\xfb\x00\xfc\x00\xfd\x00\xfe\x00\xff\x00\x09\x00\x0a\x00\x0b\x00\x0c\x00\x0d\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x21\x00\xff\xff\x23\x00\x24\x00\x25\x00\x26\x00\x27\x00\xff\xff\x20\x00\x2a\x00\x2b\x00\x2c\x00\x2d\x00\x2e\x00\x2f\x00\x30\x00\x31\x00\x32\x00\x33\x00\x34\x00\x35\x00\x36\x00\x37\x00\x38\x00\x39\x00\x3a\x00\xff\xff\x3c\x00\x3d\x00\x3e\x00\x3f\x00\xff\xff\x41\x00\x42\x00\x43\x00\x44\x00\x45\x00\x46\x00\x47\x00\x48\x00\x49\x00\x4a\x00\x4b\x00\x4c\x00\x4d\x00\x4e\x00\x4f\x00\x50\x00\x51\x00\x52\x00\x53\x00\x54\x00\x55\x00\x56\x00\x57\x00\x58\x00\x59\x00\x5a\x00\x5b\x00\x5c\x00\x5d\x00\x5e\x00\x5f\x00\x60\x00\x61\x00\x62\x00\x63\x00\x64\x00\x65\x00\x66\x00\x67\x00\x68\x00\x69\x00\x6a\x00\x6b\x00\x6c\x00\x6d\x00\x6e\x00\x6f\x00\x70\x00\x71\x00\x72\x00\x73\x00\x74\x00\x75\x00\x76\x00\x77\x00\x78\x00\x79\x00\x7a\x00\xff\xff\x7c\x00\xff\xff\x7e\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x80\x00\x81\x00\x82\x00\x83\x00\x84\x00\x85\x00\x86\x00\x87\x00\x88\x00\x89\x00\x8a\x00\x8b\x00\x8c\x00\x8d\x00\x8e\x00\x8f\x00\x90\x00\x91\x00\x92\x00\x93\x00\x94\x00\x95\x00\x96\x00\x97\x00\x98\x00\x99\x00\x9a\x00\x9b\x00\x9c\x00\x9d\x00\x9e\x00\x9f\x00\xa0\x00\xa1\x00\xa2\x00\xa3\x00\xa4\x00\xa5\x00\xa6\x00\xa7\x00\xa8\x00\xa9\x00\xaa\x00\xab\x00\xac\x00\xad\x00\xae\x00\xaf\x00\xb0\x00\xb1\x00\xb2\x00\xb3\x00\xb4\x00\xb5\x00\xb6\x00\xb7\x00\xb8\x00\xb9\x00\xba\x00\xbb\x00\xbc\x00\xbd\x00\xbe\x00\xbf\x00\xc0\x00\xc1\x00\xc2\x00\xc3\x00\xc4\x00\xc5\x00\xc6\x00\xc7\x00\xc8\x00\xc9\x00\xca\x00\xcb\x00\xcc\x00\xcd\x00\xce\x00\xcf\x00\xd0\x00\xd1\x00\xd2\x00\xd3\x00\xd4\x00\xd5\x00\xd6\x00\xd7\x00\xd8\x00\xd9\x00\xda\x00\xdb\x00\xdc\x00\xdd\x00\xde\x00\xdf\x00\xe0\x00\xe1\x00\xe2\x00\xe3\x00\xe4\x00\xe5\x00\xe6\x00\xe7\x00\xe8\x00\xe9\x00\xea\x00\xeb\x00\xec\x00\xed\x00\xee\x00\xef\x00\xf0\x00\xf1\x00\xf2\x00\xf3\x00\xf4\x00\xf5\x00\xf6\x00\xf7\x00\xf8\x00\xf9\x00\xfa\x00\xfb\x00\xfc\x00\xfd\x00\xfe\x00\xff\x00\x09\x00\x0a\x00\x0b\x00\x0c\x00\x0d\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x21\x00\xff\xff\x23\x00\x24\x00\x25\x00\x26\x00\x27\x00\xff\xff\x20\x00\x2a\x00\x2b\x00\x2c\x00\x2d\x00\x2e\x00\x2f\x00\x30\x00\x31\x00\x32\x00\x33\x00\x34\x00\x35\x00\x36\x00\x37\x00\x38\x00\x39\x00\x3a\x00\xff\xff\x3c\x00\x3d\x00\x3e\x00\x3f\x00\xff\xff\x41\x00\x42\x00\x43\x00\x44\x00\x45\x00\x46\x00\x47\x00\x48\x00\x49\x00\x4a\x00\x4b\x00\x4c\x00\x4d\x00\x4e\x00\x4f\x00\x50\x00\x51\x00\x52\x00\x53\x00\x54\x00\x55\x00\x56\x00\x57\x00\x58\x00\x59\x00\x5a\x00\x5b\x00\x5c\x00\x5d\x00\x5e\x00\x5f\x00\x60\x00\x61\x00\x62\x00\x63\x00\x64\x00\x65\x00\x66\x00\x67\x00\x68\x00\x69\x00\x6a\x00\x6b\x00\x6c\x00\x6d\x00\x6e\x00\x6f\x00\x70\x00\x71\x00\x72\x00\x73\x00\x74\x00\x75\x00\x76\x00\x77\x00\x78\x00\x79\x00\x7a\x00\xff\xff\x7c\x00\xff\xff\x7e\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x80\x00\x81\x00\x82\x00\x83\x00\x84\x00\x85\x00\x86\x00\x87\x00\x88\x00\x89\x00\x8a\x00\x8b\x00\x8c\x00\x8d\x00\x8e\x00\x8f\x00\x90\x00\x91\x00\x92\x00\x93\x00\x94\x00\x95\x00\x96\x00\x97\x00\x98\x00\x99\x00\x9a\x00\x9b\x00\x9c\x00\x9d\x00\x9e\x00\x9f\x00\xa0\x00\xa1\x00\xa2\x00\xa3\x00\xa4\x00\xa5\x00\xa6\x00\xa7\x00\xa8\x00\xa9\x00\xaa\x00\xab\x00\xac\x00\xad\x00\xae\x00\xaf\x00\xb0\x00\xb1\x00\xb2\x00\xb3\x00\xb4\x00\xb5\x00\xb6\x00\xb7\x00\xb8\x00\xb9\x00\xba\x00\xbb\x00\xbc\x00\xbd\x00\xbe\x00\xbf\x00\xc0\x00\xc1\x00\xc2\x00\xc3\x00\xc4\x00\xc5\x00\xc6\x00\xc7\x00\xc8\x00\xc9\x00\xca\x00\xcb\x00\xcc\x00\xcd\x00\xce\x00\xcf\x00\xd0\x00\xd1\x00\xd2\x00\xd3\x00\xd4\x00\xd5\x00\xd6\x00\xd7\x00\xd8\x00\xd9\x00\xda\x00\xdb\x00\xdc\x00\xdd\x00\xde\x00\xdf\x00\xe0\x00\xe1\x00\xe2\x00\xe3\x00\xe4\x00\xe5\x00\xe6\x00\xe7\x00\xe8\x00\xe9\x00\xea\x00\xeb\x00\xec\x00\xed\x00\xee\x00\xef\x00\xf0\x00\xf1\x00\xf2\x00\xf3\x00\xf4\x00\xf5\x00\xf6\x00\xf7\x00\xf8\x00\xf9\x00\xfa\x00\xfb\x00\xfc\x00\xfd\x00\xfe\x00\xff\x00\x09\x00\x0a\x00\x0b\x00\x0c\x00\x0d\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x21\x00\xff\xff\x23\x00\x24\x00\x25\x00\x26\x00\x27\x00\xff\xff\x20\x00\x2a\x00\x2b\x00\x2c\x00\x2d\x00\x2e\x00\x2f\x00\x30\x00\x31\x00\x32\x00\x33\x00\x34\x00\x35\x00\x36\x00\x37\x00\x38\x00\x39\x00\x3a\x00\xff\xff\x3c\x00\x3d\x00\x3e\x00\x3f\x00\xff\xff\x41\x00\x42\x00\x43\x00\x44\x00\x45\x00\x46\x00\x47\x00\x48\x00\x49\x00\x4a\x00\x4b\x00\x4c\x00\x4d\x00\x4e\x00\x4f\x00\x50\x00\x51\x00\x52\x00\x53\x00\x54\x00\x55\x00\x56\x00\x57\x00\x58\x00\x59\x00\x5a\x00\x5b\x00\x5c\x00\x5d\x00\x5e\x00\x5f\x00\x60\x00\x61\x00\x62\x00\x63\x00\x64\x00\x65\x00\x66\x00\x67\x00\x68\x00\x69\x00\x6a\x00\x6b\x00\x6c\x00\x6d\x00\x6e\x00\x6f\x00\x70\x00\x71\x00\x72\x00\x73\x00\x74\x00\x75\x00\x76\x00\x77\x00\x78\x00\x79\x00\x7a\x00\xff\xff\x7c\x00\xff\xff\x7e\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x80\x00\x81\x00\x82\x00\x83\x00\x84\x00\x85\x00\x86\x00\x87\x00\x88\x00\x89\x00\x8a\x00\x8b\x00\x8c\x00\x8d\x00\x8e\x00\x8f\x00\x90\x00\x91\x00\x92\x00\x93\x00\x94\x00\x95\x00\x96\x00\x97\x00\x98\x00\x99\x00\x9a\x00\x9b\x00\x9c\x00\x9d\x00\x9e\x00\x9f\x00\xa0\x00\xa1\x00\xa2\x00\xa3\x00\xa4\x00\xa5\x00\xa6\x00\xa7\x00\xa8\x00\xa9\x00\xaa\x00\xab\x00\xac\x00\xad\x00\xae\x00\xaf\x00\xb0\x00\xb1\x00\xb2\x00\xb3\x00\xb4\x00\xb5\x00\xb6\x00\xb7\x00\xb8\x00\xb9\x00\xba\x00\xbb\x00\xbc\x00\xbd\x00\xbe\x00\xbf\x00\xc0\x00\xc1\x00\xc2\x00\xc3\x00\xc4\x00\xc5\x00\xc6\x00\xc7\x00\xc8\x00\xc9\x00\xca\x00\xcb\x00\xcc\x00\xcd\x00\xce\x00\xcf\x00\xd0\x00\xd1\x00\xd2\x00\xd3\x00\xd4\x00\xd5\x00\xd6\x00\xd7\x00\xd8\x00\xd9\x00\xda\x00\xdb\x00\xdc\x00\xdd\x00\xde\x00\xdf\x00\xe0\x00\xe1\x00\xe2\x00\xe3\x00\xe4\x00\xe5\x00\xe6\x00\xe7\x00\xe8\x00\xe9\x00\xea\x00\xeb\x00\xec\x00\xed\x00\xee\x00\xef\x00\xf0\x00\xf1\x00\xf2\x00\xf3\x00\xf4\x00\xf5\x00\xf6\x00\xf7\x00\xf8\x00\xf9\x00\xfa\x00\xfb\x00\xfc\x00\xfd\x00\xfe\x00\xff\x00\x09\x00\x0a\x00\x0b\x00\x0c\x00\x0d\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x21\x00\xff\xff\x23\x00\x24\x00\x25\x00\x26\x00\x27\x00\xff\xff\x20\x00\x2a\x00\x2b\x00\x2c\x00\x2d\x00\x2e\x00\x2f\x00\x30\x00\x31\x00\x32\x00\x33\x00\x34\x00\x35\x00\x36\x00\x37\x00\x38\x00\x39\x00\x3a\x00\xff\xff\x3c\x00\x3d\x00\x3e\x00\x3f\x00\xff\xff\x41\x00\x42\x00\x43\x00\x44\x00\x45\x00\x46\x00\x47\x00\x48\x00\x49\x00\x4a\x00\x4b\x00\x4c\x00\x4d\x00\x4e\x00\x4f\x00\x50\x00\x51\x00\x52\x00\x53\x00\x54\x00\x55\x00\x56\x00\x57\x00\x58\x00\x59\x00\x5a\x00\x5b\x00\x5c\x00\x5d\x00\x5e\x00\x5f\x00\x60\x00\x61\x00\x62\x00\x63\x00\x64\x00\x65\x00\x66\x00\x67\x00\x68\x00\x69\x00\x6a\x00\x6b\x00\x6c\x00\x6d\x00\x6e\x00\x6f\x00\x70\x00\x71\x00\x72\x00\x73\x00\x74\x00\x75\x00\x76\x00\x77\x00\x78\x00\x79\x00\x7a\x00\xff\xff\x7c\x00\xff\xff\x7e\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x80\x00\x81\x00\x82\x00\x83\x00\x84\x00\x85\x00\x86\x00\x87\x00\x88\x00\x89\x00\x8a\x00\x8b\x00\x8c\x00\x8d\x00\x8e\x00\x8f\x00\x90\x00\x91\x00\x92\x00\x93\x00\x94\x00\x95\x00\x96\x00\x97\x00\x98\x00\x99\x00\x9a\x00\x9b\x00\x9c\x00\x9d\x00\x9e\x00\x9f\x00\xa0\x00\xa1\x00\xa2\x00\xa3\x00\xa4\x00\xa5\x00\xa6\x00\xa7\x00\xa8\x00\xa9\x00\xaa\x00\xab\x00\xac\x00\xad\x00\xae\x00\xaf\x00\xb0\x00\xb1\x00\xb2\x00\xb3\x00\xb4\x00\xb5\x00\xb6\x00\xb7\x00\xb8\x00\xb9\x00\xba\x00\xbb\x00\xbc\x00\xbd\x00\xbe\x00\xbf\x00\xc0\x00\xc1\x00\xc2\x00\xc3\x00\xc4\x00\xc5\x00\xc6\x00\xc7\x00\xc8\x00\xc9\x00\xca\x00\xcb\x00\xcc\x00\xcd\x00\xce\x00\xcf\x00\xd0\x00\xd1\x00\xd2\x00\xd3\x00\xd4\x00\xd5\x00\xd6\x00\xd7\x00\xd8\x00\xd9\x00\xda\x00\xdb\x00\xdc\x00\xdd\x00\xde\x00\xdf\x00\xe0\x00\xe1\x00\xe2\x00\xe3\x00\xe4\x00\xe5\x00\xe6\x00\xe7\x00\xe8\x00\xe9\x00\xea\x00\xeb\x00\xec\x00\xed\x00\xee\x00\xef\x00\xf0\x00\xf1\x00\xf2\x00\xf3\x00\xf4\x00\xf5\x00\xf6\x00\xf7\x00\xf8\x00\xf9\x00\xfa\x00\xfb\x00\xfc\x00\xfd\x00\xfe\x00\xff\x00\x09\x00\x0a\x00\x0b\x00\x0c\x00\x0d\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x21\x00\xff\xff\x23\x00\x24\x00\x25\x00\x26\x00\x27\x00\xff\xff\x20\x00\x2a\x00\x2b\x00\x2c\x00\x2d\x00\x2e\x00\x2f\x00\x30\x00\x31\x00\x32\x00\x33\x00\x34\x00\x35\x00\x36\x00\x37\x00\x38\x00\x39\x00\x3a\x00\xff\xff\x3c\x00\x3d\x00\x3e\x00\x3f\x00\xff\xff\x41\x00\x42\x00\x43\x00\x44\x00\x45\x00\x46\x00\x47\x00\x48\x00\x49\x00\x4a\x00\x4b\x00\x4c\x00\x4d\x00\x4e\x00\x4f\x00\x50\x00\x51\x00\x52\x00\x53\x00\x54\x00\x55\x00\x56\x00\x57\x00\x58\x00\x59\x00\x5a\x00\x5b\x00\x5c\x00\x5d\x00\x5e\x00\x5f\x00\x60\x00\x61\x00\x62\x00\x63\x00\x64\x00\x65\x00\x66\x00\x67\x00\x68\x00\x69\x00\x6a\x00\x6b\x00\x6c\x00\x6d\x00\x6e\x00\x6f\x00\x70\x00\x71\x00\x72\x00\x73\x00\x74\x00\x75\x00\x76\x00\x77\x00\x78\x00\x79\x00\x7a\x00\xff\xff\x7c\x00\xff\xff\x7e\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x80\x00\x81\x00\x82\x00\x83\x00\x84\x00\x85\x00\x86\x00\x87\x00\x88\x00\x89\x00\x8a\x00\x8b\x00\x8c\x00\x8d\x00\x8e\x00\x8f\x00\x90\x00\x91\x00\x92\x00\x93\x00\x94\x00\x95\x00\x96\x00\x97\x00\x98\x00\x99\x00\x9a\x00\x9b\x00\x9c\x00\x9d\x00\x9e\x00\x9f\x00\xa0\x00\xa1\x00\xa2\x00\xa3\x00\xa4\x00\xa5\x00\xa6\x00\xa7\x00\xa8\x00\xa9\x00\xaa\x00\xab\x00\xac\x00\xad\x00\xae\x00\xaf\x00\xb0\x00\xb1\x00\xb2\x00\xb3\x00\xb4\x00\xb5\x00\xb6\x00\xb7\x00\xb8\x00\xb9\x00\xba\x00\xbb\x00\xbc\x00\xbd\x00\xbe\x00\xbf\x00\xc0\x00\xc1\x00\xc2\x00\xc3\x00\xc4\x00\xc5\x00\xc6\x00\xc7\x00\xc8\x00\xc9\x00\xca\x00\xcb\x00\xcc\x00\xcd\x00\xce\x00\xcf\x00\xd0\x00\xd1\x00\xd2\x00\xd3\x00\xd4\x00\xd5\x00\xd6\x00\xd7\x00\xd8\x00\xd9\x00\xda\x00\xdb\x00\xdc\x00\xdd\x00\xde\x00\xdf\x00\xe0\x00\xe1\x00\xe2\x00\xe3\x00\xe4\x00\xe5\x00\xe6\x00\xe7\x00\xe8\x00\xe9\x00\xea\x00\xeb\x00\xec\x00\xed\x00\xee\x00\xef\x00\xf0\x00\xf1\x00\xf2\x00\xf3\x00\xf4\x00\xf5\x00\xf6\x00\xf7\x00\xf8\x00\xf9\x00\xfa\x00\xfb\x00\xfc\x00\xfd\x00\xfe\x00\xff\x00\x09\x00\x0a\x00\x0b\x00\x0c\x00\x0d\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x21\x00\xff\xff\x23\x00\x24\x00\x25\x00\x26\x00\x27\x00\xff\xff\x20\x00\x2a\x00\x2b\x00\x2c\x00\x2d\x00\x2e\x00\x2f\x00\x30\x00\x31\x00\x32\x00\x33\x00\x34\x00\x35\x00\x36\x00\x37\x00\x38\x00\x39\x00\x3a\x00\xff\xff\x3c\x00\x3d\x00\x3e\x00\x3f\x00\xff\xff\x41\x00\x42\x00\x43\x00\x44\x00\x45\x00\x46\x00\x47\x00\x48\x00\x49\x00\x4a\x00\x4b\x00\x4c\x00\x4d\x00\x4e\x00\x4f\x00\x50\x00\x51\x00\x52\x00\x53\x00\x54\x00\x55\x00\x56\x00\x57\x00\x58\x00\x59\x00\x5a\x00\x5b\x00\x5c\x00\x5d\x00\x5e\x00\x5f\x00\x60\x00\x61\x00\x62\x00\x63\x00\x64\x00\x65\x00\x66\x00\x67\x00\x68\x00\x69\x00\x6a\x00\x6b\x00\x6c\x00\x6d\x00\x6e\x00\x6f\x00\x70\x00\x71\x00\x72\x00\x73\x00\x74\x00\x75\x00\x76\x00\x77\x00\x78\x00\x79\x00\x7a\x00\xff\xff\x7c\x00\xff\xff\x7e\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x80\x00\x81\x00\x82\x00\x83\x00\x84\x00\x85\x00\x86\x00\x87\x00\x88\x00\x89\x00\x8a\x00\x8b\x00\x8c\x00\x8d\x00\x8e\x00\x8f\x00\x90\x00\x91\x00\x92\x00\x93\x00\x94\x00\x95\x00\x96\x00\x97\x00\x98\x00\x99\x00\x9a\x00\x9b\x00\x9c\x00\x9d\x00\x9e\x00\x9f\x00\xa0\x00\xa1\x00\xa2\x00\xa3\x00\xa4\x00\xa5\x00\xa6\x00\xa7\x00\xa8\x00\xa9\x00\xaa\x00\xab\x00\xac\x00\xad\x00\xae\x00\xaf\x00\xb0\x00\xb1\x00\xb2\x00\xb3\x00\xb4\x00\xb5\x00\xb6\x00\xb7\x00\xb8\x00\xb9\x00\xba\x00\xbb\x00\xbc\x00\xbd\x00\xbe\x00\xbf\x00\xc0\x00\xc1\x00\xc2\x00\xc3\x00\xc4\x00\xc5\x00\xc6\x00\xc7\x00\xc8\x00\xc9\x00\xca\x00\xcb\x00\xcc\x00\xcd\x00\xce\x00\xcf\x00\xd0\x00\xd1\x00\xd2\x00\xd3\x00\xd4\x00\xd5\x00\xd6\x00\xd7\x00\xd8\x00\xd9\x00\xda\x00\xdb\x00\xdc\x00\xdd\x00\xde\x00\xdf\x00\xe0\x00\xe1\x00\xe2\x00\xe3\x00\xe4\x00\xe5\x00\xe6\x00\xe7\x00\xe8\x00\xe9\x00\xea\x00\xeb\x00\xec\x00\xed\x00\xee\x00\xef\x00\xf0\x00\xf1\x00\xf2\x00\xf3\x00\xf4\x00\xf5\x00\xf6\x00\xf7\x00\xf8\x00\xf9\x00\xfa\x00\xfb\x00\xfc\x00\xfd\x00\xfe\x00\xff\x00\x09\x00\x0a\x00\x0b\x00\x0c\x00\x0d\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x21\x00\xff\xff\x23\x00\x24\x00\x25\x00\x26\x00\x27\x00\xff\xff\x20\x00\x2a\x00\x2b\x00\x2c\x00\x2d\x00\x2e\x00\x2f\x00\x30\x00\x31\x00\x32\x00\x33\x00\x34\x00\x35\x00\x36\x00\x37\x00\x38\x00\x39\x00\x3a\x00\xff\xff\x3c\x00\x3d\x00\x3e\x00\x3f\x00\xff\xff\x41\x00\x42\x00\x43\x00\x44\x00\x45\x00\x46\x00\x47\x00\x48\x00\x49\x00\x4a\x00\x4b\x00\x4c\x00\x4d\x00\x4e\x00\x4f\x00\x50\x00\x51\x00\x52\x00\x53\x00\x54\x00\x55\x00\x56\x00\x57\x00\x58\x00\x59\x00\x5a\x00\x5b\x00\x5c\x00\x5d\x00\x5e\x00\x5f\x00\x60\x00\x61\x00\x62\x00\x63\x00\x64\x00\x65\x00\x66\x00\x67\x00\x68\x00\x69\x00\x6a\x00\x6b\x00\x6c\x00\x6d\x00\x6e\x00\x6f\x00\x70\x00\x71\x00\x72\x00\x73\x00\x74\x00\x75\x00\x76\x00\x77\x00\x78\x00\x79\x00\x7a\x00\xff\xff\x7c\x00\xff\xff\x7e\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x80\x00\x81\x00\x82\x00\x83\x00\x84\x00\x85\x00\x86\x00\x87\x00\x88\x00\x89\x00\x8a\x00\x8b\x00\x8c\x00\x8d\x00\x8e\x00\x8f\x00\x90\x00\x91\x00\x92\x00\x93\x00\x94\x00\x95\x00\x96\x00\x97\x00\x98\x00\x99\x00\x9a\x00\x9b\x00\x9c\x00\x9d\x00\x9e\x00\x9f\x00\xa0\x00\xa1\x00\xa2\x00\xa3\x00\xa4\x00\xa5\x00\xa6\x00\xa7\x00\xa8\x00\xa9\x00\xaa\x00\xab\x00\xac\x00\xad\x00\xae\x00\xaf\x00\xb0\x00\xb1\x00\xb2\x00\xb3\x00\xb4\x00\xb5\x00\xb6\x00\xb7\x00\xb8\x00\xb9\x00\xba\x00\xbb\x00\xbc\x00\xbd\x00\xbe\x00\xbf\x00\xc0\x00\xc1\x00\xc2\x00\xc3\x00\xc4\x00\xc5\x00\xc6\x00\xc7\x00\xc8\x00\xc9\x00\xca\x00\xcb\x00\xcc\x00\xcd\x00\xce\x00\xcf\x00\xd0\x00\xd1\x00\xd2\x00\xd3\x00\xd4\x00\xd5\x00\xd6\x00\xd7\x00\xd8\x00\xd9\x00\xda\x00\xdb\x00\xdc\x00\xdd\x00\xde\x00\xdf\x00\xe0\x00\xe1\x00\xe2\x00\xe3\x00\xe4\x00\xe5\x00\xe6\x00\xe7\x00\xe8\x00\xe9\x00\xea\x00\xeb\x00\xec\x00\xed\x00\xee\x00\xef\x00\xf0\x00\xf1\x00\xf2\x00\xf3\x00\xf4\x00\xf5\x00\xf6\x00\xf7\x00\xf8\x00\xf9\x00\xfa\x00\xfb\x00\xfc\x00\xfd\x00\xfe\x00\xff\x00\x09\x00\x0a\x00\x0b\x00\x0c\x00\x0d\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x21\x00\xff\xff\x23\x00\x24\x00\x25\x00\x26\x00\x27\x00\xff\xff\x20\x00\x2a\x00\x2b\x00\x2c\x00\x2d\x00\x2e\x00\x2f\x00\x30\x00\x31\x00\x32\x00\x33\x00\x34\x00\x35\x00\x36\x00\x37\x00\x38\x00\x39\x00\x3a\x00\xff\xff\x3c\x00\x3d\x00\x3e\x00\x3f\x00\xff\xff\x41\x00\x42\x00\x43\x00\x44\x00\x45\x00\x46\x00\x47\x00\x48\x00\x49\x00\x4a\x00\x4b\x00\x4c\x00\x4d\x00\x4e\x00\x4f\x00\x50\x00\x51\x00\x52\x00\x53\x00\x54\x00\x55\x00\x56\x00\x57\x00\x58\x00\x59\x00\x5a\x00\x5b\x00\x5c\x00\x5d\x00\x5e\x00\x5f\x00\x60\x00\x61\x00\x62\x00\x63\x00\x64\x00\x65\x00\x66\x00\x67\x00\x68\x00\x69\x00\x6a\x00\x6b\x00\x6c\x00\x6d\x00\x6e\x00\x6f\x00\x70\x00\x71\x00\x72\x00\x73\x00\x74\x00\x75\x00\x76\x00\x77\x00\x78\x00\x79\x00\x7a\x00\xff\xff\x7c\x00\xff\xff\x7e\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x80\x00\x81\x00\x82\x00\x83\x00\x84\x00\x85\x00\x86\x00\x87\x00\x88\x00\x89\x00\x8a\x00\x8b\x00\x8c\x00\x8d\x00\x8e\x00\x8f\x00\x90\x00\x91\x00\x92\x00\x93\x00\x94\x00\x95\x00\x96\x00\x97\x00\x98\x00\x99\x00\x9a\x00\x9b\x00\x9c\x00\x9d\x00\x9e\x00\x9f\x00\xa0\x00\xa1\x00\xa2\x00\xa3\x00\xa4\x00\xa5\x00\xa6\x00\xa7\x00\xa8\x00\xa9\x00\xaa\x00\xab\x00\xac\x00\xad\x00\xae\x00\xaf\x00\xb0\x00\xb1\x00\xb2\x00\xb3\x00\xb4\x00\xb5\x00\xb6\x00\xb7\x00\xb8\x00\xb9\x00\xba\x00\xbb\x00\xbc\x00\xbd\x00\xbe\x00\xbf\x00\xc0\x00\xc1\x00\xc2\x00\xc3\x00\xc4\x00\xc5\x00\xc6\x00\xc7\x00\xc8\x00\xc9\x00\xca\x00\xcb\x00\xcc\x00\xcd\x00\xce\x00\xcf\x00\xd0\x00\xd1\x00\xd2\x00\xd3\x00\xd4\x00\xd5\x00\xd6\x00\xd7\x00\xd8\x00\xd9\x00\xda\x00\xdb\x00\xdc\x00\xdd\x00\xde\x00\xdf\x00\xe0\x00\xe1\x00\xe2\x00\xe3\x00\xe4\x00\xe5\x00\xe6\x00\xe7\x00\xe8\x00\xe9\x00\xea\x00\xeb\x00\xec\x00\xed\x00\xee\x00\xef\x00\xf0\x00\xf1\x00\xf2\x00\xf3\x00\xf4\x00\xf5\x00\xf6\x00\xf7\x00\xf8\x00\xf9\x00\xfa\x00\xfb\x00\xfc\x00\xfd\x00\xfe\x00\xff\x00\x09\x00\x0a\x00\x0b\x00\x0c\x00\x0d\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x21\x00\xff\xff\x23\x00\x24\x00\x25\x00\x26\x00\x27\x00\xff\xff\x20\x00\x2a\x00\x2b\x00\x2c\x00\x2d\x00\x2e\x00\x2f\x00\x30\x00\x31\x00\x32\x00\x33\x00\x34\x00\x35\x00\x36\x00\x37\x00\x38\x00\x39\x00\x3a\x00\xff\xff\x3c\x00\x3d\x00\x3e\x00\x3f\x00\xff\xff\x41\x00\x42\x00\x43\x00\x44\x00\x45\x00\x46\x00\x47\x00\x48\x00\x49\x00\x4a\x00\x4b\x00\x4c\x00\x4d\x00\x4e\x00\x4f\x00\x50\x00\x51\x00\x52\x00\x53\x00\x54\x00\x55\x00\x56\x00\x57\x00\x58\x00\x59\x00\x5a\x00\x5b\x00\x5c\x00\x5d\x00\x5e\x00\x5f\x00\x60\x00\x61\x00\x62\x00\x63\x00\x64\x00\x65\x00\x66\x00\x67\x00\x68\x00\x69\x00\x6a\x00\x6b\x00\x6c\x00\x6d\x00\x6e\x00\x6f\x00\x70\x00\x71\x00\x72\x00\x73\x00\x74\x00\x75\x00\x76\x00\x77\x00\x78\x00\x79\x00\x7a\x00\xff\xff\x7c\x00\xff\xff\x7e\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x80\x00\x81\x00\x82\x00\x83\x00\x84\x00\x85\x00\x86\x00\x87\x00\x88\x00\x89\x00\x8a\x00\x8b\x00\x8c\x00\x8d\x00\x8e\x00\x8f\x00\x90\x00\x91\x00\x92\x00\x93\x00\x94\x00\x95\x00\x96\x00\x97\x00\x98\x00\x99\x00\x9a\x00\x9b\x00\x9c\x00\x9d\x00\x9e\x00\x9f\x00\xa0\x00\xa1\x00\xa2\x00\xa3\x00\xa4\x00\xa5\x00\xa6\x00\xa7\x00\xa8\x00\xa9\x00\xaa\x00\xab\x00\xac\x00\xad\x00\xae\x00\xaf\x00\xb0\x00\xb1\x00\xb2\x00\xb3\x00\xb4\x00\xb5\x00\xb6\x00\xb7\x00\xb8\x00\xb9\x00\xba\x00\xbb\x00\xbc\x00\xbd\x00\xbe\x00\xbf\x00\xc0\x00\xc1\x00\xc2\x00\xc3\x00\xc4\x00\xc5\x00\xc6\x00\xc7\x00\xc8\x00\xc9\x00\xca\x00\xcb\x00\xcc\x00\xcd\x00\xce\x00\xcf\x00\xd0\x00\xd1\x00\xd2\x00\xd3\x00\xd4\x00\xd5\x00\xd6\x00\xd7\x00\xd8\x00\xd9\x00\xda\x00\xdb\x00\xdc\x00\xdd\x00\xde\x00\xdf\x00\xe0\x00\xe1\x00\xe2\x00\xe3\x00\xe4\x00\xe5\x00\xe6\x00\xe7\x00\xe8\x00\xe9\x00\xea\x00\xeb\x00\xec\x00\xed\x00\xee\x00\xef\x00\xf0\x00\xf1\x00\xf2\x00\xf3\x00\xf4\x00\xf5\x00\xf6\x00\xf7\x00\xf8\x00\xf9\x00\xfa\x00\xfb\x00\xfc\x00\xfd\x00\xfe\x00\xff\x00\x09\x00\x0a\x00\x0b\x00\x0c\x00\x0d\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x20\x00\xff\xff\x21\x00\x23\x00\x23\x00\x24\x00\x25\x00\x26\x00\x27\x00\xff\xff\xff\xff\x2a\x00\x2b\x00\x2c\x00\x2d\x00\x2e\x00\x2f\x00\x30\x00\x31\x00\x32\x00\x33\x00\x34\x00\x35\x00\x36\x00\x37\x00\x38\x00\x39\x00\x3a\x00\xff\xff\x3c\x00\x3d\x00\x3e\x00\x3f\x00\xff\xff\x41\x00\x42\x00\x43\x00\x44\x00\x45\x00\x46\x00\x47\x00\x48\x00\x49\x00\x4a\x00\x4b\x00\x4c\x00\x4d\x00\x4e\x00\x4f\x00\x50\x00\x51\x00\x52\x00\x53\x00\x54\x00\x55\x00\x56\x00\x57\x00\x58\x00\x59\x00\x5a\x00\x5b\x00\x5c\x00\x5d\x00\x5e\x00\x5f\x00\x60\x00\x61\x00\x62\x00\x63\x00\x64\x00\x65\x00\x66\x00\x67\x00\x68\x00\x69\x00\x6a\x00\x6b\x00\x6c\x00\x6d\x00\x6e\x00\x6f\x00\x70\x00\x71\x00\x72\x00\x73\x00\x74\x00\x75\x00\x76\x00\x77\x00\x78\x00\x79\x00\x7a\x00\xff\xff\x7c\x00\xff\xff\x7e\x00\x80\x00\x81\x00\x82\x00\x83\x00\x84\x00\x85\x00\x86\x00\x87\x00\x88\x00\x89\x00\x8a\x00\x8b\x00\x8c\x00\x8d\x00\x8e\x00\x8f\x00\x90\x00\x91\x00\x92\x00\x93\x00\x94\x00\x95\x00\x96\x00\x97\x00\x98\x00\x99\x00\x9a\x00\x9b\x00\x9c\x00\x9d\x00\x9e\x00\x9f\x00\xa0\x00\xa1\x00\xa2\x00\xa3\x00\xa4\x00\xa5\x00\xa6\x00\xa7\x00\xa8\x00\xa9\x00\xaa\x00\xab\x00\xac\x00\xad\x00\xae\x00\xaf\x00\xb0\x00\xb1\x00\xb2\x00\xb3\x00\xb4\x00\xb5\x00\xb6\x00\xb7\x00\xb8\x00\xb9\x00\xba\x00\xbb\x00\xbc\x00\xbd\x00\xbe\x00\xbf\x00\xc0\x00\xc1\x00\xc2\x00\xc3\x00\xc4\x00\xc5\x00\xc6\x00\xc7\x00\xc8\x00\xc9\x00\xca\x00\xcb\x00\xcc\x00\xcd\x00\xce\x00\xcf\x00\xd0\x00\xd1\x00\xd2\x00\xd3\x00\xd4\x00\xd5\x00\xd6\x00\xd7\x00\xd8\x00\xd9\x00\xda\x00\xdb\x00\xdc\x00\xdd\x00\xde\x00\xdf\x00\xe0\x00\xe1\x00\xe2\x00\xe3\x00\xe4\x00\xe5\x00\xe6\x00\xe7\x00\xe8\x00\xe9\x00\xea\x00\xeb\x00\xec\x00\xed\x00\xee\x00\xef\x00\xf0\x00\xf1\x00\xf2\x00\xf3\x00\xf4\x00\xf5\x00\xf6\x00\xf7\x00\xf8\x00\xf9\x00\xfa\x00\xfb\x00\xfc\x00\xfd\x00\xfe\x00\xff\x00\x09\x00\x0a\x00\x0b\x00\x0c\x00\x0d\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x21\x00\xff\xff\x23\x00\x24\x00\x25\x00\x26\x00\x27\x00\xff\xff\x20\x00\x2a\x00\x2b\x00\x2c\x00\x2d\x00\x2e\x00\x2f\x00\x30\x00\x31\x00\x32\x00\x33\x00\x34\x00\x35\x00\x36\x00\x37\x00\x38\x00\x39\x00\x3a\x00\xff\xff\x3c\x00\x3d\x00\x3e\x00\x3f\x00\xff\xff\x41\x00\x42\x00\x43\x00\x44\x00\x45\x00\x46\x00\x47\x00\x48\x00\x49\x00\x4a\x00\x4b\x00\x4c\x00\x4d\x00\x4e\x00\x4f\x00\x50\x00\x51\x00\x52\x00\x53\x00\x54\x00\x55\x00\x56\x00\x57\x00\x58\x00\x59\x00\x5a\x00\x5b\x00\x5c\x00\x5d\x00\x5e\x00\x5f\x00\x60\x00\x61\x00\x62\x00\x63\x00\x64\x00\x65\x00\x66\x00\x67\x00\x68\x00\x69\x00\x6a\x00\x6b\x00\x6c\x00\x6d\x00\x6e\x00\x6f\x00\x70\x00\x71\x00\x72\x00\x73\x00\x74\x00\x75\x00\x76\x00\x77\x00\x78\x00\x79\x00\x7a\x00\xff\xff\x7c\x00\xff\xff\x7e\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x7d\x00\xff\xff\xff\xff\x80\x00\x81\x00\x82\x00\x83\x00\x84\x00\x85\x00\x86\x00\x87\x00\x88\x00\x89\x00\x8a\x00\x8b\x00\x8c\x00\x8d\x00\x8e\x00\x8f\x00\x90\x00\x91\x00\x92\x00\x93\x00\x94\x00\x95\x00\x96\x00\x97\x00\x98\x00\x99\x00\x9a\x00\x9b\x00\x9c\x00\x9d\x00\x9e\x00\x9f\x00\xa0\x00\xa1\x00\xa2\x00\xa3\x00\xa4\x00\xa5\x00\xa6\x00\xa7\x00\xa8\x00\xa9\x00\xaa\x00\xab\x00\xac\x00\xad\x00\xae\x00\xaf\x00\xb0\x00\xb1\x00\xb2\x00\xb3\x00\xb4\x00\xb5\x00\xb6\x00\xb7\x00\xb8\x00\xb9\x00\xba\x00\xbb\x00\xbc\x00\xbd\x00\xbe\x00\xbf\x00\xc0\x00\xc1\x00\xc2\x00\xc3\x00\xc4\x00\xc5\x00\xc6\x00\xc7\x00\xc8\x00\xc9\x00\xca\x00\xcb\x00\xcc\x00\xcd\x00\xce\x00\xcf\x00\xd0\x00\xd1\x00\xd2\x00\xd3\x00\xd4\x00\xd5\x00\xd6\x00\xd7\x00\xd8\x00\xd9\x00\xda\x00\xdb\x00\xdc\x00\xdd\x00\xde\x00\xdf\x00\xe0\x00\xe1\x00\xe2\x00\xe3\x00\xe4\x00\xe5\x00\xe6\x00\xe7\x00\xe8\x00\xe9\x00\xea\x00\xeb\x00\xec\x00\xed\x00\xee\x00\xef\x00\xf0\x00\xf1\x00\xf2\x00\xf3\x00\xf4\x00\xf5\x00\xf6\x00\xf7\x00\xf8\x00\xf9\x00\xfa\x00\xfb\x00\xfc\x00\xfd\x00\xfe\x00\xff\x00\x09\x00\x0a\x00\x0b\x00\x0c\x00\x0d\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x20\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x53\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x80\x00\x81\x00\x82\x00\x83\x00\x84\x00\x85\x00\x86\x00\x87\x00\x88\x00\x89\x00\x8a\x00\x8b\x00\x8c\x00\x8d\x00\x8e\x00\x8f\x00\x90\x00\x91\x00\x92\x00\x93\x00\x94\x00\x95\x00\x96\x00\x97\x00\x98\x00\x99\x00\x9a\x00\x9b\x00\x9c\x00\x9d\x00\x9e\x00\x9f\x00\xa0\x00\xa1\x00\xa2\x00\xa3\x00\xa4\x00\xa5\x00\xa6\x00\xa7\x00\xa8\x00\xa9\x00\xaa\x00\xab\x00\xac\x00\xad\x00\xae\x00\xaf\x00\xb0\x00\xb1\x00\xb2\x00\xb3\x00\xb4\x00\xb5\x00\xb6\x00\xb7\x00\xb8\x00\xb9\x00\xba\x00\xbb\x00\xbc\x00\xbd\x00\xbe\x00\xbf\x00\xc0\x00\xc1\x00\xc2\x00\xc3\x00\xc4\x00\xc5\x00\xc6\x00\xc7\x00\xc8\x00\xc9\x00\xca\x00\xcb\x00\xcc\x00\xcd\x00\xce\x00\xcf\x00\xd0\x00\xd1\x00\xd2\x00\xd3\x00\xd4\x00\xd5\x00\xd6\x00\xd7\x00\xd8\x00\xd9\x00\xda\x00\xdb\x00\xdc\x00\xdd\x00\xde\x00\xdf\x00\xe0\x00\xe1\x00\xe2\x00\xe3\x00\xe4\x00\xe5\x00\xe6\x00\xe7\x00\xe8\x00\xe9\x00\xea\x00\xeb\x00\xec\x00\xed\x00\xee\x00\xef\x00\xf0\x00\xf1\x00\xf2\x00\xf3\x00\xf4\x00\xf5\x00\xf6\x00\xf7\x00\xf8\x00\xf9\x00\xfa\x00\xfb\x00\xfc\x00\xfd\x00\xfe\x00\xff\x00\x09\x00\x0a\x00\x0b\x00\x0c\x00\x0d\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x20\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x45\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x80\x00\x81\x00\x82\x00\x83\x00\x84\x00\x85\x00\x86\x00\x87\x00\x88\x00\x89\x00\x8a\x00\x8b\x00\x8c\x00\x8d\x00\x8e\x00\x8f\x00\x90\x00\x91\x00\x92\x00\x93\x00\x94\x00\x95\x00\x96\x00\x97\x00\x98\x00\x99\x00\x9a\x00\x9b\x00\x9c\x00\x9d\x00\x9e\x00\x9f\x00\xa0\x00\xa1\x00\xa2\x00\xa3\x00\xa4\x00\xa5\x00\xa6\x00\xa7\x00\xa8\x00\xa9\x00\xaa\x00\xab\x00\xac\x00\xad\x00\xae\x00\xaf\x00\xb0\x00\xb1\x00\xb2\x00\xb3\x00\xb4\x00\xb5\x00\xb6\x00\xb7\x00\xb8\x00\xb9\x00\xba\x00\xbb\x00\xbc\x00\xbd\x00\xbe\x00\xbf\x00\xc0\x00\xc1\x00\xc2\x00\xc3\x00\xc4\x00\xc5\x00\xc6\x00\xc7\x00\xc8\x00\xc9\x00\xca\x00\xcb\x00\xcc\x00\xcd\x00\xce\x00\xcf\x00\xd0\x00\xd1\x00\xd2\x00\xd3\x00\xd4\x00\xd5\x00\xd6\x00\xd7\x00\xd8\x00\xd9\x00\xda\x00\xdb\x00\xdc\x00\xdd\x00\xde\x00\xdf\x00\xe0\x00\xe1\x00\xe2\x00\xe3\x00\xe4\x00\xe5\x00\xe6\x00\xe7\x00\xe8\x00\xe9\x00\xea\x00\xeb\x00\xec\x00\xed\x00\xee\x00\xef\x00\xf0\x00\xf1\x00\xf2\x00\xf3\x00\xf4\x00\xf5\x00\xf6\x00\xf7\x00\xf8\x00\xf9\x00\xfa\x00\xfb\x00\xfc\x00\xfd\x00\xfe\x00\xff\x00\x09\x00\x0a\x00\x0b\x00\x0c\x00\x0d\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x20\x00\xff\xff\x21\x00\xff\xff\x23\x00\x24\x00\x25\x00\x26\x00\x27\x00\xff\xff\xff\xff\x2a\x00\x2b\x00\x2c\x00\x2d\x00\x2e\x00\x2f\x00\x30\x00\x31\x00\x32\x00\x33\x00\x34\x00\x35\x00\x36\x00\x37\x00\x38\x00\x39\x00\x3a\x00\xff\xff\x3c\x00\x3d\x00\x3e\x00\x3f\x00\x41\x00\x41\x00\x42\x00\x43\x00\x44\x00\x45\x00\x46\x00\x47\x00\x48\x00\x49\x00\x4a\x00\x4b\x00\x4c\x00\x4d\x00\x4e\x00\x4f\x00\x50\x00\x51\x00\x52\x00\x53\x00\x54\x00\x55\x00\x56\x00\x57\x00\x58\x00\x59\x00\x5a\x00\x5b\x00\x5c\x00\x5d\x00\x5e\x00\x5f\x00\x60\x00\x61\x00\x62\x00\x63\x00\x64\x00\x65\x00\x66\x00\x67\x00\x68\x00\x69\x00\x6a\x00\x6b\x00\x6c\x00\x6d\x00\x6e\x00\x6f\x00\x70\x00\x71\x00\x72\x00\x73\x00\x74\x00\x75\x00\x76\x00\x77\x00\x78\x00\x79\x00\x7a\x00\xff\xff\x7c\x00\xff\xff\x7e\x00\x80\x00\x81\x00\x82\x00\x83\x00\x84\x00\x85\x00\x86\x00\x87\x00\x88\x00\x89\x00\x8a\x00\x8b\x00\x8c\x00\x8d\x00\x8e\x00\x8f\x00\x90\x00\x91\x00\x92\x00\x93\x00\x94\x00\x95\x00\x96\x00\x97\x00\x98\x00\x99\x00\x9a\x00\x9b\x00\x9c\x00\x9d\x00\x9e\x00\x9f\x00\xa0\x00\xa1\x00\xa2\x00\xa3\x00\xa4\x00\xa5\x00\xa6\x00\xa7\x00\xa8\x00\xa9\x00\xaa\x00\xab\x00\xac\x00\xad\x00\xae\x00\xaf\x00\xb0\x00\xb1\x00\xb2\x00\xb3\x00\xb4\x00\xb5\x00\xb6\x00\xb7\x00\xb8\x00\xb9\x00\xba\x00\xbb\x00\xbc\x00\xbd\x00\xbe\x00\xbf\x00\xc0\x00\xc1\x00\xc2\x00\xc3\x00\xc4\x00\xc5\x00\xc6\x00\xc7\x00\xc8\x00\xc9\x00\xca\x00\xcb\x00\xcc\x00\xcd\x00\xce\x00\xcf\x00\xd0\x00\xd1\x00\xd2\x00\xd3\x00\xd4\x00\xd5\x00\xd6\x00\xd7\x00\xd8\x00\xd9\x00\xda\x00\xdb\x00\xdc\x00\xdd\x00\xde\x00\xdf\x00\xe0\x00\xe1\x00\xe2\x00\xe3\x00\xe4\x00\xe5\x00\xe6\x00\xe7\x00\xe8\x00\xe9\x00\xea\x00\xeb\x00\xec\x00\xed\x00\xee\x00\xef\x00\xf0\x00\xf1\x00\xf2\x00\xf3\x00\xf4\x00\xf5\x00\xf6\x00\xf7\x00\xf8\x00\xf9\x00\xfa\x00\xfb\x00\xfc\x00\xfd\x00\xfe\x00\xff\x00\x09\x00\x0a\x00\x0b\x00\x0c\x00\x0d\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x20\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x45\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x80\x00\x81\x00\x82\x00\x83\x00\x84\x00\x85\x00\x86\x00\x87\x00\x88\x00\x89\x00\x8a\x00\x8b\x00\x8c\x00\x8d\x00\x8e\x00\x8f\x00\x90\x00\x91\x00\x92\x00\x93\x00\x94\x00\x95\x00\x96\x00\x97\x00\x98\x00\x99\x00\x9a\x00\x9b\x00\x9c\x00\x9d\x00\x9e\x00\x9f\x00\xa0\x00\xa1\x00\xa2\x00\xa3\x00\xa4\x00\xa5\x00\xa6\x00\xa7\x00\xa8\x00\xa9\x00\xaa\x00\xab\x00\xac\x00\xad\x00\xae\x00\xaf\x00\xb0\x00\xb1\x00\xb2\x00\xb3\x00\xb4\x00\xb5\x00\xb6\x00\xb7\x00\xb8\x00\xb9\x00\xba\x00\xbb\x00\xbc\x00\xbd\x00\xbe\x00\xbf\x00\xc0\x00\xc1\x00\xc2\x00\xc3\x00\xc4\x00\xc5\x00\xc6\x00\xc7\x00\xc8\x00\xc9\x00\xca\x00\xcb\x00\xcc\x00\xcd\x00\xce\x00\xcf\x00\xd0\x00\xd1\x00\xd2\x00\xd3\x00\xd4\x00\xd5\x00\xd6\x00\xd7\x00\xd8\x00\xd9\x00\xda\x00\xdb\x00\xdc\x00\xdd\x00\xde\x00\xdf\x00\xe0\x00\xe1\x00\xe2\x00\xe3\x00\xe4\x00\xe5\x00\xe6\x00\xe7\x00\xe8\x00\xe9\x00\xea\x00\xeb\x00\xec\x00\xed\x00\xee\x00\xef\x00\xf0\x00\xf1\x00\xf2\x00\xf3\x00\xf4\x00\xf5\x00\xf6\x00\xf7\x00\xf8\x00\xf9\x00\xfa\x00\xfb\x00\xfc\x00\xfd\x00\xfe\x00\xff\x00\x09\x00\x0a\x00\x0b\x00\x0c\x00\x0d\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x20\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x43\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x80\x00\x81\x00\x82\x00\x83\x00\x84\x00\x85\x00\x86\x00\x87\x00\x88\x00\x89\x00\x8a\x00\x8b\x00\x8c\x00\x8d\x00\x8e\x00\x8f\x00\x90\x00\x91\x00\x92\x00\x93\x00\x94\x00\x95\x00\x96\x00\x97\x00\x98\x00\x99\x00\x9a\x00\x9b\x00\x9c\x00\x9d\x00\x9e\x00\x9f\x00\xa0\x00\xa1\x00\xa2\x00\xa3\x00\xa4\x00\xa5\x00\xa6\x00\xa7\x00\xa8\x00\xa9\x00\xaa\x00\xab\x00\xac\x00\xad\x00\xae\x00\xaf\x00\xb0\x00\xb1\x00\xb2\x00\xb3\x00\xb4\x00\xb5\x00\xb6\x00\xb7\x00\xb8\x00\xb9\x00\xba\x00\xbb\x00\xbc\x00\xbd\x00\xbe\x00\xbf\x00\xc0\x00\xc1\x00\xc2\x00\xc3\x00\xc4\x00\xc5\x00\xc6\x00\xc7\x00\xc8\x00\xc9\x00\xca\x00\xcb\x00\xcc\x00\xcd\x00\xce\x00\xcf\x00\xd0\x00\xd1\x00\xd2\x00\xd3\x00\xd4\x00\xd5\x00\xd6\x00\xd7\x00\xd8\x00\xd9\x00\xda\x00\xdb\x00\xdc\x00\xdd\x00\xde\x00\xdf\x00\xe0\x00\xe1\x00\xe2\x00\xe3\x00\xe4\x00\xe5\x00\xe6\x00\xe7\x00\xe8\x00\xe9\x00\xea\x00\xeb\x00\xec\x00\xed\x00\xee\x00\xef\x00\xf0\x00\xf1\x00\xf2\x00\xf3\x00\xf4\x00\xf5\x00\xf6\x00\xf7\x00\xf8\x00\xf9\x00\xfa\x00\xfb\x00\xfc\x00\xfd\x00\xfe\x00\xff\x00\x09\x00\x0a\x00\x0b\x00\x0c\x00\x0d\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x20\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x53\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x80\x00\x81\x00\x82\x00\x83\x00\x84\x00\x85\x00\x86\x00\x87\x00\x88\x00\x89\x00\x8a\x00\x8b\x00\x8c\x00\x8d\x00\x8e\x00\x8f\x00\x90\x00\x91\x00\x92\x00\x93\x00\x94\x00\x95\x00\x96\x00\x97\x00\x98\x00\x99\x00\x9a\x00\x9b\x00\x9c\x00\x9d\x00\x9e\x00\x9f\x00\xa0\x00\xa1\x00\xa2\x00\xa3\x00\xa4\x00\xa5\x00\xa6\x00\xa7\x00\xa8\x00\xa9\x00\xaa\x00\xab\x00\xac\x00\xad\x00\xae\x00\xaf\x00\xb0\x00\xb1\x00\xb2\x00\xb3\x00\xb4\x00\xb5\x00\xb6\x00\xb7\x00\xb8\x00\xb9\x00\xba\x00\xbb\x00\xbc\x00\xbd\x00\xbe\x00\xbf\x00\xc0\x00\xc1\x00\xc2\x00\xc3\x00\xc4\x00\xc5\x00\xc6\x00\xc7\x00\xc8\x00\xc9\x00\xca\x00\xcb\x00\xcc\x00\xcd\x00\xce\x00\xcf\x00\xd0\x00\xd1\x00\xd2\x00\xd3\x00\xd4\x00\xd5\x00\xd6\x00\xd7\x00\xd8\x00\xd9\x00\xda\x00\xdb\x00\xdc\x00\xdd\x00\xde\x00\xdf\x00\xe0\x00\xe1\x00\xe2\x00\xe3\x00\xe4\x00\xe5\x00\xe6\x00\xe7\x00\xe8\x00\xe9\x00\xea\x00\xeb\x00\xec\x00\xed\x00\xee\x00\xef\x00\xf0\x00\xf1\x00\xf2\x00\xf3\x00\xf4\x00\xf5\x00\xf6\x00\xf7\x00\xf8\x00\xf9\x00\xfa\x00\xfb\x00\xfc\x00\xfd\x00\xfe\x00\xff\x00\x09\x00\x0a\x00\x0b\x00\x0c\x00\x0d\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x20\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x43\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x80\x00\x81\x00\x82\x00\x83\x00\x84\x00\x85\x00\x86\x00\x87\x00\x88\x00\x89\x00\x8a\x00\x8b\x00\x8c\x00\x8d\x00\x8e\x00\x8f\x00\x90\x00\x91\x00\x92\x00\x93\x00\x94\x00\x95\x00\x96\x00\x97\x00\x98\x00\x99\x00\x9a\x00\x9b\x00\x9c\x00\x9d\x00\x9e\x00\x9f\x00\xa0\x00\xa1\x00\xa2\x00\xa3\x00\xa4\x00\xa5\x00\xa6\x00\xa7\x00\xa8\x00\xa9\x00\xaa\x00\xab\x00\xac\x00\xad\x00\xae\x00\xaf\x00\xb0\x00\xb1\x00\xb2\x00\xb3\x00\xb4\x00\xb5\x00\xb6\x00\xb7\x00\xb8\x00\xb9\x00\xba\x00\xbb\x00\xbc\x00\xbd\x00\xbe\x00\xbf\x00\xc0\x00\xc1\x00\xc2\x00\xc3\x00\xc4\x00\xc5\x00\xc6\x00\xc7\x00\xc8\x00\xc9\x00\xca\x00\xcb\x00\xcc\x00\xcd\x00\xce\x00\xcf\x00\xd0\x00\xd1\x00\xd2\x00\xd3\x00\xd4\x00\xd5\x00\xd6\x00\xd7\x00\xd8\x00\xd9\x00\xda\x00\xdb\x00\xdc\x00\xdd\x00\xde\x00\xdf\x00\xe0\x00\xe1\x00\xe2\x00\xe3\x00\xe4\x00\xe5\x00\xe6\x00\xe7\x00\xe8\x00\xe9\x00\xea\x00\xeb\x00\xec\x00\xed\x00\xee\x00\xef\x00\xf0\x00\xf1\x00\xf2\x00\xf3\x00\xf4\x00\xf5\x00\xf6\x00\xf7\x00\xf8\x00\xf9\x00\xfa\x00\xfb\x00\xfc\x00\xfd\x00\xfe\x00\xff\x00\x09\x00\x0a\x00\x0b\x00\x0c\x00\x0d\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x20\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x45\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x80\x00\x81\x00\x82\x00\x83\x00\x84\x00\x85\x00\x86\x00\x87\x00\x88\x00\x89\x00\x8a\x00\x8b\x00\x8c\x00\x8d\x00\x8e\x00\x8f\x00\x90\x00\x91\x00\x92\x00\x93\x00\x94\x00\x95\x00\x96\x00\x97\x00\x98\x00\x99\x00\x9a\x00\x9b\x00\x9c\x00\x9d\x00\x9e\x00\x9f\x00\xa0\x00\xa1\x00\xa2\x00\xa3\x00\xa4\x00\xa5\x00\xa6\x00\xa7\x00\xa8\x00\xa9\x00\xaa\x00\xab\x00\xac\x00\xad\x00\xae\x00\xaf\x00\xb0\x00\xb1\x00\xb2\x00\xb3\x00\xb4\x00\xb5\x00\xb6\x00\xb7\x00\xb8\x00\xb9\x00\xba\x00\xbb\x00\xbc\x00\xbd\x00\xbe\x00\xbf\x00\xc0\x00\xc1\x00\xc2\x00\xc3\x00\xc4\x00\xc5\x00\xc6\x00\xc7\x00\xc8\x00\xc9\x00\xca\x00\xcb\x00\xcc\x00\xcd\x00\xce\x00\xcf\x00\xd0\x00\xd1\x00\xd2\x00\xd3\x00\xd4\x00\xd5\x00\xd6\x00\xd7\x00\xd8\x00\xd9\x00\xda\x00\xdb\x00\xdc\x00\xdd\x00\xde\x00\xdf\x00\xe0\x00\xe1\x00\xe2\x00\xe3\x00\xe4\x00\xe5\x00\xe6\x00\xe7\x00\xe8\x00\xe9\x00\xea\x00\xeb\x00\xec\x00\xed\x00\xee\x00\xef\x00\xf0\x00\xf1\x00\xf2\x00\xf3\x00\xf4\x00\xf5\x00\xf6\x00\xf7\x00\xf8\x00\xf9\x00\xfa\x00\xfb\x00\xfc\x00\xfd\x00\xfe\x00\xff\x00\x09\x00\x0a\x00\x0b\x00\x0c\x00\x0d\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x20\x00\xff\xff\x21\x00\xff\xff\x23\x00\x24\x00\x25\x00\x26\x00\x27\x00\xff\xff\xff\xff\x2a\x00\x2b\x00\x2c\x00\x2d\x00\x2e\x00\x2f\x00\x30\x00\x31\x00\x32\x00\x33\x00\x34\x00\x35\x00\x36\x00\x37\x00\x38\x00\x39\x00\x3a\x00\xff\xff\x3c\x00\x3d\x00\x3e\x00\x3f\x00\x41\x00\x41\x00\x42\x00\x43\x00\x44\x00\x45\x00\x46\x00\x47\x00\x48\x00\x49\x00\x4a\x00\x4b\x00\x4c\x00\x4d\x00\x4e\x00\x4f\x00\x50\x00\x51\x00\x52\x00\x53\x00\x54\x00\x55\x00\x56\x00\x57\x00\x58\x00\x59\x00\x5a\x00\x5b\x00\x5c\x00\x5d\x00\x5e\x00\x5f\x00\x60\x00\x61\x00\x62\x00\x63\x00\x64\x00\x65\x00\x66\x00\x67\x00\x68\x00\x69\x00\x6a\x00\x6b\x00\x6c\x00\x6d\x00\x6e\x00\x6f\x00\x70\x00\x71\x00\x72\x00\x73\x00\x74\x00\x75\x00\x76\x00\x77\x00\x78\x00\x79\x00\x7a\x00\xff\xff\x7c\x00\xff\xff\x7e\x00\x80\x00\x81\x00\x82\x00\x83\x00\x84\x00\x85\x00\x86\x00\x87\x00\x88\x00\x89\x00\x8a\x00\x8b\x00\x8c\x00\x8d\x00\x8e\x00\x8f\x00\x90\x00\x91\x00\x92\x00\x93\x00\x94\x00\x95\x00\x96\x00\x97\x00\x98\x00\x99\x00\x9a\x00\x9b\x00\x9c\x00\x9d\x00\x9e\x00\x9f\x00\xa0\x00\xa1\x00\xa2\x00\xa3\x00\xa4\x00\xa5\x00\xa6\x00\xa7\x00\xa8\x00\xa9\x00\xaa\x00\xab\x00\xac\x00\xad\x00\xae\x00\xaf\x00\xb0\x00\xb1\x00\xb2\x00\xb3\x00\xb4\x00\xb5\x00\xb6\x00\xb7\x00\xb8\x00\xb9\x00\xba\x00\xbb\x00\xbc\x00\xbd\x00\xbe\x00\xbf\x00\xc0\x00\xc1\x00\xc2\x00\xc3\x00\xc4\x00\xc5\x00\xc6\x00\xc7\x00\xc8\x00\xc9\x00\xca\x00\xcb\x00\xcc\x00\xcd\x00\xce\x00\xcf\x00\xd0\x00\xd1\x00\xd2\x00\xd3\x00\xd4\x00\xd5\x00\xd6\x00\xd7\x00\xd8\x00\xd9\x00\xda\x00\xdb\x00\xdc\x00\xdd\x00\xde\x00\xdf\x00\xe0\x00\xe1\x00\xe2\x00\xe3\x00\xe4\x00\xe5\x00\xe6\x00\xe7\x00\xe8\x00\xe9\x00\xea\x00\xeb\x00\xec\x00\xed\x00\xee\x00\xef\x00\xf0\x00\xf1\x00\xf2\x00\xf3\x00\xf4\x00\xf5\x00\xf6\x00\xf7\x00\xf8\x00\xf9\x00\xfa\x00\xfb\x00\xfc\x00\xfd\x00\xfe\x00\xff\x00\x09\x00\x0a\x00\x0b\x00\x0c\x00\x0d\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x20\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x4b\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x80\x00\x81\x00\x82\x00\x83\x00\x84\x00\x85\x00\x86\x00\x87\x00\x88\x00\x89\x00\x8a\x00\x8b\x00\x8c\x00\x8d\x00\x8e\x00\x8f\x00\x90\x00\x91\x00\x92\x00\x93\x00\x94\x00\x95\x00\x96\x00\x97\x00\x98\x00\x99\x00\x9a\x00\x9b\x00\x9c\x00\x9d\x00\x9e\x00\x9f\x00\xa0\x00\xa1\x00\xa2\x00\xa3\x00\xa4\x00\xa5\x00\xa6\x00\xa7\x00\xa8\x00\xa9\x00\xaa\x00\xab\x00\xac\x00\xad\x00\xae\x00\xaf\x00\xb0\x00\xb1\x00\xb2\x00\xb3\x00\xb4\x00\xb5\x00\xb6\x00\xb7\x00\xb8\x00\xb9\x00\xba\x00\xbb\x00\xbc\x00\xbd\x00\xbe\x00\xbf\x00\xc0\x00\xc1\x00\xc2\x00\xc3\x00\xc4\x00\xc5\x00\xc6\x00\xc7\x00\xc8\x00\xc9\x00\xca\x00\xcb\x00\xcc\x00\xcd\x00\xce\x00\xcf\x00\xd0\x00\xd1\x00\xd2\x00\xd3\x00\xd4\x00\xd5\x00\xd6\x00\xd7\x00\xd8\x00\xd9\x00\xda\x00\xdb\x00\xdc\x00\xdd\x00\xde\x00\xdf\x00\xe0\x00\xe1\x00\xe2\x00\xe3\x00\xe4\x00\xe5\x00\xe6\x00\xe7\x00\xe8\x00\xe9\x00\xea\x00\xeb\x00\xec\x00\xed\x00\xee\x00\xef\x00\xf0\x00\xf1\x00\xf2\x00\xf3\x00\xf4\x00\xf5\x00\xf6\x00\xf7\x00\xf8\x00\xf9\x00\xfa\x00\xfb\x00\xfc\x00\xfd\x00\xfe\x00\xff\x00\x09\x00\x0a\x00\x0b\x00\x0c\x00\x0d\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x20\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x47\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x80\x00\x81\x00\x82\x00\x83\x00\x84\x00\x85\x00\x86\x00\x87\x00\x88\x00\x89\x00\x8a\x00\x8b\x00\x8c\x00\x8d\x00\x8e\x00\x8f\x00\x90\x00\x91\x00\x92\x00\x93\x00\x94\x00\x95\x00\x96\x00\x97\x00\x98\x00\x99\x00\x9a\x00\x9b\x00\x9c\x00\x9d\x00\x9e\x00\x9f\x00\xa0\x00\xa1\x00\xa2\x00\xa3\x00\xa4\x00\xa5\x00\xa6\x00\xa7\x00\xa8\x00\xa9\x00\xaa\x00\xab\x00\xac\x00\xad\x00\xae\x00\xaf\x00\xb0\x00\xb1\x00\xb2\x00\xb3\x00\xb4\x00\xb5\x00\xb6\x00\xb7\x00\xb8\x00\xb9\x00\xba\x00\xbb\x00\xbc\x00\xbd\x00\xbe\x00\xbf\x00\xc0\x00\xc1\x00\xc2\x00\xc3\x00\xc4\x00\xc5\x00\xc6\x00\xc7\x00\xc8\x00\xc9\x00\xca\x00\xcb\x00\xcc\x00\xcd\x00\xce\x00\xcf\x00\xd0\x00\xd1\x00\xd2\x00\xd3\x00\xd4\x00\xd5\x00\xd6\x00\xd7\x00\xd8\x00\xd9\x00\xda\x00\xdb\x00\xdc\x00\xdd\x00\xde\x00\xdf\x00\xe0\x00\xe1\x00\xe2\x00\xe3\x00\xe4\x00\xe5\x00\xe6\x00\xe7\x00\xe8\x00\xe9\x00\xea\x00\xeb\x00\xec\x00\xed\x00\xee\x00\xef\x00\xf0\x00\xf1\x00\xf2\x00\xf3\x00\xf4\x00\xf5\x00\xf6\x00\xf7\x00\xf8\x00\xf9\x00\xfa\x00\xfb\x00\xfc\x00\xfd\x00\xfe\x00\xff\x00\x09\x00\x0a\x00\x0b\x00\x0c\x00\x0d\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x20\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x47\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x80\x00\x81\x00\x82\x00\x83\x00\x84\x00\x85\x00\x86\x00\x87\x00\x88\x00\x89\x00\x8a\x00\x8b\x00\x8c\x00\x8d\x00\x8e\x00\x8f\x00\x90\x00\x91\x00\x92\x00\x93\x00\x94\x00\x95\x00\x96\x00\x97\x00\x98\x00\x99\x00\x9a\x00\x9b\x00\x9c\x00\x9d\x00\x9e\x00\x9f\x00\xa0\x00\xa1\x00\xa2\x00\xa3\x00\xa4\x00\xa5\x00\xa6\x00\xa7\x00\xa8\x00\xa9\x00\xaa\x00\xab\x00\xac\x00\xad\x00\xae\x00\xaf\x00\xb0\x00\xb1\x00\xb2\x00\xb3\x00\xb4\x00\xb5\x00\xb6\x00\xb7\x00\xb8\x00\xb9\x00\xba\x00\xbb\x00\xbc\x00\xbd\x00\xbe\x00\xbf\x00\xc0\x00\xc1\x00\xc2\x00\xc3\x00\xc4\x00\xc5\x00\xc6\x00\xc7\x00\xc8\x00\xc9\x00\xca\x00\xcb\x00\xcc\x00\xcd\x00\xce\x00\xcf\x00\xd0\x00\xd1\x00\xd2\x00\xd3\x00\xd4\x00\xd5\x00\xd6\x00\xd7\x00\xd8\x00\xd9\x00\xda\x00\xdb\x00\xdc\x00\xdd\x00\xde\x00\xdf\x00\xe0\x00\xe1\x00\xe2\x00\xe3\x00\xe4\x00\xe5\x00\xe6\x00\xe7\x00\xe8\x00\xe9\x00\xea\x00\xeb\x00\xec\x00\xed\x00\xee\x00\xef\x00\xf0\x00\xf1\x00\xf2\x00\xf3\x00\xf4\x00\xf5\x00\xf6\x00\xf7\x00\xf8\x00\xf9\x00\xfa\x00\xfb\x00\xfc\x00\xfd\x00\xfe\x00\xff\x00\x09\x00\x0a\x00\x0b\x00\x0c\x00\x0d\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x20\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x45\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x80\x00\x81\x00\x82\x00\x83\x00\x84\x00\x85\x00\x86\x00\x87\x00\x88\x00\x89\x00\x8a\x00\x8b\x00\x8c\x00\x8d\x00\x8e\x00\x8f\x00\x90\x00\x91\x00\x92\x00\x93\x00\x94\x00\x95\x00\x96\x00\x97\x00\x98\x00\x99\x00\x9a\x00\x9b\x00\x9c\x00\x9d\x00\x9e\x00\x9f\x00\xa0\x00\xa1\x00\xa2\x00\xa3\x00\xa4\x00\xa5\x00\xa6\x00\xa7\x00\xa8\x00\xa9\x00\xaa\x00\xab\x00\xac\x00\xad\x00\xae\x00\xaf\x00\xb0\x00\xb1\x00\xb2\x00\xb3\x00\xb4\x00\xb5\x00\xb6\x00\xb7\x00\xb8\x00\xb9\x00\xba\x00\xbb\x00\xbc\x00\xbd\x00\xbe\x00\xbf\x00\xc0\x00\xc1\x00\xc2\x00\xc3\x00\xc4\x00\xc5\x00\xc6\x00\xc7\x00\xc8\x00\xc9\x00\xca\x00\xcb\x00\xcc\x00\xcd\x00\xce\x00\xcf\x00\xd0\x00\xd1\x00\xd2\x00\xd3\x00\xd4\x00\xd5\x00\xd6\x00\xd7\x00\xd8\x00\xd9\x00\xda\x00\xdb\x00\xdc\x00\xdd\x00\xde\x00\xdf\x00\xe0\x00\xe1\x00\xe2\x00\xe3\x00\xe4\x00\xe5\x00\xe6\x00\xe7\x00\xe8\x00\xe9\x00\xea\x00\xeb\x00\xec\x00\xed\x00\xee\x00\xef\x00\xf0\x00\xf1\x00\xf2\x00\xf3\x00\xf4\x00\xf5\x00\xf6\x00\xf7\x00\xf8\x00\xf9\x00\xfa\x00\xfb\x00\xfc\x00\xfd\x00\xfe\x00\xff\x00\x09\x00\x0a\x00\x0b\x00\x0c\x00\x0d\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x20\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x45\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x80\x00\x81\x00\x82\x00\x83\x00\x84\x00\x85\x00\x86\x00\x87\x00\x88\x00\x89\x00\x8a\x00\x8b\x00\x8c\x00\x8d\x00\x8e\x00\x8f\x00\x90\x00\x91\x00\x92\x00\x93\x00\x94\x00\x95\x00\x96\x00\x97\x00\x98\x00\x99\x00\x9a\x00\x9b\x00\x9c\x00\x9d\x00\x9e\x00\x9f\x00\xa0\x00\xa1\x00\xa2\x00\xa3\x00\xa4\x00\xa5\x00\xa6\x00\xa7\x00\xa8\x00\xa9\x00\xaa\x00\xab\x00\xac\x00\xad\x00\xae\x00\xaf\x00\xb0\x00\xb1\x00\xb2\x00\xb3\x00\xb4\x00\xb5\x00\xb6\x00\xb7\x00\xb8\x00\xb9\x00\xba\x00\xbb\x00\xbc\x00\xbd\x00\xbe\x00\xbf\x00\xc0\x00\xc1\x00\xc2\x00\xc3\x00\xc4\x00\xc5\x00\xc6\x00\xc7\x00\xc8\x00\xc9\x00\xca\x00\xcb\x00\xcc\x00\xcd\x00\xce\x00\xcf\x00\xd0\x00\xd1\x00\xd2\x00\xd3\x00\xd4\x00\xd5\x00\xd6\x00\xd7\x00\xd8\x00\xd9\x00\xda\x00\xdb\x00\xdc\x00\xdd\x00\xde\x00\xdf\x00\xe0\x00\xe1\x00\xe2\x00\xe3\x00\xe4\x00\xe5\x00\xe6\x00\xe7\x00\xe8\x00\xe9\x00\xea\x00\xeb\x00\xec\x00\xed\x00\xee\x00\xef\x00\xf0\x00\xf1\x00\xf2\x00\xf3\x00\xf4\x00\xf5\x00\xf6\x00\xf7\x00\xf8\x00\xf9\x00\xfa\x00\xfb\x00\xfc\x00\xfd\x00\xfe\x00\xff\x00\x09\x00\x0a\x00\x0b\x00\x0c\x00\x0d\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x21\x00\xff\xff\x23\x00\x24\x00\x25\x00\x26\x00\x27\x00\xff\xff\xff\xff\x2a\x00\x2b\x00\x2c\x00\x2d\x00\x20\x00\x2f\x00\x30\x00\x31\x00\x32\x00\x33\x00\x34\x00\x35\x00\x36\x00\x37\x00\x38\x00\x39\x00\x3a\x00\x2d\x00\x3c\x00\x3d\x00\x3e\x00\x3f\x00\xff\xff\x41\x00\x42\x00\x43\x00\x44\x00\x45\x00\x46\x00\x47\x00\x48\x00\x49\x00\x4a\x00\x4b\x00\x4c\x00\x4d\x00\x4e\x00\x4f\x00\x50\x00\x51\x00\x52\x00\x53\x00\x54\x00\x55\x00\x56\x00\x57\x00\x58\x00\x59\x00\x5a\x00\x5b\x00\x5c\x00\x5d\x00\x5e\x00\x5f\x00\x60\x00\x61\x00\x62\x00\x63\x00\x64\x00\x65\x00\x66\x00\x67\x00\x68\x00\x69\x00\x6a\x00\x6b\x00\x6c\x00\x6d\x00\x6e\x00\x6f\x00\x70\x00\x71\x00\x72\x00\x73\x00\x74\x00\x75\x00\x76\x00\x77\x00\x78\x00\x79\x00\x7a\x00\xff\xff\x7c\x00\xff\xff\x7e\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x80\x00\x81\x00\x82\x00\x83\x00\x84\x00\x85\x00\x86\x00\x87\x00\x88\x00\x89\x00\x8a\x00\x8b\x00\x8c\x00\x8d\x00\x8e\x00\x8f\x00\x90\x00\x91\x00\x92\x00\x93\x00\x94\x00\x95\x00\x96\x00\x97\x00\x98\x00\x99\x00\x9a\x00\x9b\x00\x9c\x00\x9d\x00\x9e\x00\x9f\x00\xa0\x00\xa1\x00\xa2\x00\xa3\x00\xa4\x00\xa5\x00\xa6\x00\xa7\x00\xa8\x00\xa9\x00\xaa\x00\xab\x00\xac\x00\xad\x00\xae\x00\xaf\x00\xb0\x00\xb1\x00\xb2\x00\xb3\x00\xb4\x00\xb5\x00\xb6\x00\xb7\x00\xb8\x00\xb9\x00\xba\x00\xbb\x00\xbc\x00\xbd\x00\xbe\x00\xbf\x00\xc0\x00\xc1\x00\xc2\x00\xc3\x00\xc4\x00\xc5\x00\xc6\x00\xc7\x00\xc8\x00\xc9\x00\xca\x00\xcb\x00\xcc\x00\xcd\x00\xce\x00\xcf\x00\xd0\x00\xd1\x00\xd2\x00\xd3\x00\xd4\x00\xd5\x00\xd6\x00\xd7\x00\xd8\x00\xd9\x00\xda\x00\xdb\x00\xdc\x00\xdd\x00\xde\x00\xdf\x00\xe0\x00\xe1\x00\xe2\x00\xe3\x00\xe4\x00\xe5\x00\xe6\x00\xe7\x00\xe8\x00\xe9\x00\xea\x00\xeb\x00\xec\x00\xed\x00\xee\x00\xef\x00\xf0\x00\xf1\x00\xf2\x00\xf3\x00\xf4\x00\xf5\x00\xf6\x00\xf7\x00\xf8\x00\xf9\x00\xfa\x00\xfb\x00\xfc\x00\xfd\x00\xfe\x00\xff\x00\x09\x00\x0a\x00\x0b\x00\x0c\x00\x0d\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x20\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x2d\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x80\x00\x81\x00\x82\x00\x83\x00\x84\x00\x85\x00\x86\x00\x87\x00\x88\x00\x89\x00\x8a\x00\x8b\x00\x8c\x00\x8d\x00\x8e\x00\x8f\x00\x90\x00\x91\x00\x92\x00\x93\x00\x94\x00\x95\x00\x96\x00\x97\x00\x98\x00\x99\x00\x9a\x00\x9b\x00\x9c\x00\x9d\x00\x9e\x00\x9f\x00\xa0\x00\xa1\x00\xa2\x00\xa3\x00\xa4\x00\xa5\x00\xa6\x00\xa7\x00\xa8\x00\xa9\x00\xaa\x00\xab\x00\xac\x00\xad\x00\xae\x00\xaf\x00\xb0\x00\xb1\x00\xb2\x00\xb3\x00\xb4\x00\xb5\x00\xb6\x00\xb7\x00\xb8\x00\xb9\x00\xba\x00\xbb\x00\xbc\x00\xbd\x00\xbe\x00\xbf\x00\xc0\x00\xc1\x00\xc2\x00\xc3\x00\xc4\x00\xc5\x00\xc6\x00\xc7\x00\xc8\x00\xc9\x00\xca\x00\xcb\x00\xcc\x00\xcd\x00\xce\x00\xcf\x00\xd0\x00\xd1\x00\xd2\x00\xd3\x00\xd4\x00\xd5\x00\xd6\x00\xd7\x00\xd8\x00\xd9\x00\xda\x00\xdb\x00\xdc\x00\xdd\x00\xde\x00\xdf\x00\xe0\x00\xe1\x00\xe2\x00\xe3\x00\xe4\x00\xe5\x00\xe6\x00\xe7\x00\xe8\x00\xe9\x00\xea\x00\xeb\x00\xec\x00\xed\x00\xee\x00\xef\x00\xf0\x00\xf1\x00\xf2\x00\xf3\x00\xf4\x00\xf5\x00\xf6\x00\xf7\x00\xf8\x00\xf9\x00\xfa\x00\xfb\x00\xfc\x00\xfd\x00\xfe\x00\xff\x00\x09\x00\x0a\x00\x0b\x00\x0c\x00\x0d\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x20\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x49\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x80\x00\x81\x00\x82\x00\x83\x00\x84\x00\x85\x00\x86\x00\x87\x00\x88\x00\x89\x00\x8a\x00\x8b\x00\x8c\x00\x8d\x00\x8e\x00\x8f\x00\x90\x00\x91\x00\x92\x00\x93\x00\x94\x00\x95\x00\x96\x00\x97\x00\x98\x00\x99\x00\x9a\x00\x9b\x00\x9c\x00\x9d\x00\x9e\x00\x9f\x00\xa0\x00\xa1\x00\xa2\x00\xa3\x00\xa4\x00\xa5\x00\xa6\x00\xa7\x00\xa8\x00\xa9\x00\xaa\x00\xab\x00\xac\x00\xad\x00\xae\x00\xaf\x00\xb0\x00\xb1\x00\xb2\x00\xb3\x00\xb4\x00\xb5\x00\xb6\x00\xb7\x00\xb8\x00\xb9\x00\xba\x00\xbb\x00\xbc\x00\xbd\x00\xbe\x00\xbf\x00\xc0\x00\xc1\x00\xc2\x00\xc3\x00\xc4\x00\xc5\x00\xc6\x00\xc7\x00\xc8\x00\xc9\x00\xca\x00\xcb\x00\xcc\x00\xcd\x00\xce\x00\xcf\x00\xd0\x00\xd1\x00\xd2\x00\xd3\x00\xd4\x00\xd5\x00\xd6\x00\xd7\x00\xd8\x00\xd9\x00\xda\x00\xdb\x00\xdc\x00\xdd\x00\xde\x00\xdf\x00\xe0\x00\xe1\x00\xe2\x00\xe3\x00\xe4\x00\xe5\x00\xe6\x00\xe7\x00\xe8\x00\xe9\x00\xea\x00\xeb\x00\xec\x00\xed\x00\xee\x00\xef\x00\xf0\x00\xf1\x00\xf2\x00\xf3\x00\xf4\x00\xf5\x00\xf6\x00\xf7\x00\xf8\x00\xf9\x00\xfa\x00\xfb\x00\xfc\x00\xfd\x00\xfe\x00\xff\x00\x09\x00\x0a\x00\x0b\x00\x0c\x00\x0d\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x20\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x45\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x80\x00\x81\x00\x82\x00\x83\x00\x84\x00\x85\x00\x86\x00\x87\x00\x88\x00\x89\x00\x8a\x00\x8b\x00\x8c\x00\x8d\x00\x8e\x00\x8f\x00\x90\x00\x91\x00\x92\x00\x93\x00\x94\x00\x95\x00\x96\x00\x97\x00\x98\x00\x99\x00\x9a\x00\x9b\x00\x9c\x00\x9d\x00\x9e\x00\x9f\x00\xa0\x00\xa1\x00\xa2\x00\xa3\x00\xa4\x00\xa5\x00\xa6\x00\xa7\x00\xa8\x00\xa9\x00\xaa\x00\xab\x00\xac\x00\xad\x00\xae\x00\xaf\x00\xb0\x00\xb1\x00\xb2\x00\xb3\x00\xb4\x00\xb5\x00\xb6\x00\xb7\x00\xb8\x00\xb9\x00\xba\x00\xbb\x00\xbc\x00\xbd\x00\xbe\x00\xbf\x00\xc0\x00\xc1\x00\xc2\x00\xc3\x00\xc4\x00\xc5\x00\xc6\x00\xc7\x00\xc8\x00\xc9\x00\xca\x00\xcb\x00\xcc\x00\xcd\x00\xce\x00\xcf\x00\xd0\x00\xd1\x00\xd2\x00\xd3\x00\xd4\x00\xd5\x00\xd6\x00\xd7\x00\xd8\x00\xd9\x00\xda\x00\xdb\x00\xdc\x00\xdd\x00\xde\x00\xdf\x00\xe0\x00\xe1\x00\xe2\x00\xe3\x00\xe4\x00\xe5\x00\xe6\x00\xe7\x00\xe8\x00\xe9\x00\xea\x00\xeb\x00\xec\x00\xed\x00\xee\x00\xef\x00\xf0\x00\xf1\x00\xf2\x00\xf3\x00\xf4\x00\xf5\x00\xf6\x00\xf7\x00\xf8\x00\xf9\x00\xfa\x00\xfb\x00\xfc\x00\xfd\x00\xfe\x00\xff\x00\x09\x00\x0a\x00\x0b\x00\x0c\x00\x0d\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x20\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x49\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x80\x00\x81\x00\x82\x00\x83\x00\x84\x00\x85\x00\x86\x00\x87\x00\x88\x00\x89\x00\x8a\x00\x8b\x00\x8c\x00\x8d\x00\x8e\x00\x8f\x00\x90\x00\x91\x00\x92\x00\x93\x00\x94\x00\x95\x00\x96\x00\x97\x00\x98\x00\x99\x00\x9a\x00\x9b\x00\x9c\x00\x9d\x00\x9e\x00\x9f\x00\xa0\x00\xa1\x00\xa2\x00\xa3\x00\xa4\x00\xa5\x00\xa6\x00\xa7\x00\xa8\x00\xa9\x00\xaa\x00\xab\x00\xac\x00\xad\x00\xae\x00\xaf\x00\xb0\x00\xb1\x00\xb2\x00\xb3\x00\xb4\x00\xb5\x00\xb6\x00\xb7\x00\xb8\x00\xb9\x00\xba\x00\xbb\x00\xbc\x00\xbd\x00\xbe\x00\xbf\x00\xc0\x00\xc1\x00\xc2\x00\xc3\x00\xc4\x00\xc5\x00\xc6\x00\xc7\x00\xc8\x00\xc9\x00\xca\x00\xcb\x00\xcc\x00\xcd\x00\xce\x00\xcf\x00\xd0\x00\xd1\x00\xd2\x00\xd3\x00\xd4\x00\xd5\x00\xd6\x00\xd7\x00\xd8\x00\xd9\x00\xda\x00\xdb\x00\xdc\x00\xdd\x00\xde\x00\xdf\x00\xe0\x00\xe1\x00\xe2\x00\xe3\x00\xe4\x00\xe5\x00\xe6\x00\xe7\x00\xe8\x00\xe9\x00\xea\x00\xeb\x00\xec\x00\xed\x00\xee\x00\xef\x00\xf0\x00\xf1\x00\xf2\x00\xf3\x00\xf4\x00\xf5\x00\xf6\x00\xf7\x00\xf8\x00\xf9\x00\xfa\x00\xfb\x00\xfc\x00\xfd\x00\xfe\x00\xff\x00\x09\x00\x0a\x00\x0b\x00\x0c\x00\x0d\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x20\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x49\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x80\x00\x81\x00\x82\x00\x83\x00\x84\x00\x85\x00\x86\x00\x87\x00\x88\x00\x89\x00\x8a\x00\x8b\x00\x8c\x00\x8d\x00\x8e\x00\x8f\x00\x90\x00\x91\x00\x92\x00\x93\x00\x94\x00\x95\x00\x96\x00\x97\x00\x98\x00\x99\x00\x9a\x00\x9b\x00\x9c\x00\x9d\x00\x9e\x00\x9f\x00\xa0\x00\xa1\x00\xa2\x00\xa3\x00\xa4\x00\xa5\x00\xa6\x00\xa7\x00\xa8\x00\xa9\x00\xaa\x00\xab\x00\xac\x00\xad\x00\xae\x00\xaf\x00\xb0\x00\xb1\x00\xb2\x00\xb3\x00\xb4\x00\xb5\x00\xb6\x00\xb7\x00\xb8\x00\xb9\x00\xba\x00\xbb\x00\xbc\x00\xbd\x00\xbe\x00\xbf\x00\xc0\x00\xc1\x00\xc2\x00\xc3\x00\xc4\x00\xc5\x00\xc6\x00\xc7\x00\xc8\x00\xc9\x00\xca\x00\xcb\x00\xcc\x00\xcd\x00\xce\x00\xcf\x00\xd0\x00\xd1\x00\xd2\x00\xd3\x00\xd4\x00\xd5\x00\xd6\x00\xd7\x00\xd8\x00\xd9\x00\xda\x00\xdb\x00\xdc\x00\xdd\x00\xde\x00\xdf\x00\xe0\x00\xe1\x00\xe2\x00\xe3\x00\xe4\x00\xe5\x00\xe6\x00\xe7\x00\xe8\x00\xe9\x00\xea\x00\xeb\x00\xec\x00\xed\x00\xee\x00\xef\x00\xf0\x00\xf1\x00\xf2\x00\xf3\x00\xf4\x00\xf5\x00\xf6\x00\xf7\x00\xf8\x00\xf9\x00\xfa\x00\xfb\x00\xfc\x00\xfd\x00\xfe\x00\xff\x00\x09\x00\x0a\x00\x0b\x00\x0c\x00\x0d\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x20\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x43\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x80\x00\x81\x00\x82\x00\x83\x00\x84\x00\x85\x00\x86\x00\x87\x00\x88\x00\x89\x00\x8a\x00\x8b\x00\x8c\x00\x8d\x00\x8e\x00\x8f\x00\x90\x00\x91\x00\x92\x00\x93\x00\x94\x00\x95\x00\x96\x00\x97\x00\x98\x00\x99\x00\x9a\x00\x9b\x00\x9c\x00\x9d\x00\x9e\x00\x9f\x00\xa0\x00\xa1\x00\xa2\x00\xa3\x00\xa4\x00\xa5\x00\xa6\x00\xa7\x00\xa8\x00\xa9\x00\xaa\x00\xab\x00\xac\x00\xad\x00\xae\x00\xaf\x00\xb0\x00\xb1\x00\xb2\x00\xb3\x00\xb4\x00\xb5\x00\xb6\x00\xb7\x00\xb8\x00\xb9\x00\xba\x00\xbb\x00\xbc\x00\xbd\x00\xbe\x00\xbf\x00\xc0\x00\xc1\x00\xc2\x00\xc3\x00\xc4\x00\xc5\x00\xc6\x00\xc7\x00\xc8\x00\xc9\x00\xca\x00\xcb\x00\xcc\x00\xcd\x00\xce\x00\xcf\x00\xd0\x00\xd1\x00\xd2\x00\xd3\x00\xd4\x00\xd5\x00\xd6\x00\xd7\x00\xd8\x00\xd9\x00\xda\x00\xdb\x00\xdc\x00\xdd\x00\xde\x00\xdf\x00\xe0\x00\xe1\x00\xe2\x00\xe3\x00\xe4\x00\xe5\x00\xe6\x00\xe7\x00\xe8\x00\xe9\x00\xea\x00\xeb\x00\xec\x00\xed\x00\xee\x00\xef\x00\xf0\x00\xf1\x00\xf2\x00\xf3\x00\xf4\x00\xf5\x00\xf6\x00\xf7\x00\xf8\x00\xf9\x00\xfa\x00\xfb\x00\xfc\x00\xfd\x00\xfe\x00\xff\x00\x09\x00\x0a\x00\x0b\x00\x0c\x00\x0d\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x20\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x4f\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x80\x00\x81\x00\x82\x00\x83\x00\x84\x00\x85\x00\x86\x00\x87\x00\x88\x00\x89\x00\x8a\x00\x8b\x00\x8c\x00\x8d\x00\x8e\x00\x8f\x00\x90\x00\x91\x00\x92\x00\x93\x00\x94\x00\x95\x00\x96\x00\x97\x00\x98\x00\x99\x00\x9a\x00\x9b\x00\x9c\x00\x9d\x00\x9e\x00\x9f\x00\xa0\x00\xa1\x00\xa2\x00\xa3\x00\xa4\x00\xa5\x00\xa6\x00\xa7\x00\xa8\x00\xa9\x00\xaa\x00\xab\x00\xac\x00\xad\x00\xae\x00\xaf\x00\xb0\x00\xb1\x00\xb2\x00\xb3\x00\xb4\x00\xb5\x00\xb6\x00\xb7\x00\xb8\x00\xb9\x00\xba\x00\xbb\x00\xbc\x00\xbd\x00\xbe\x00\xbf\x00\xc0\x00\xc1\x00\xc2\x00\xc3\x00\xc4\x00\xc5\x00\xc6\x00\xc7\x00\xc8\x00\xc9\x00\xca\x00\xcb\x00\xcc\x00\xcd\x00\xce\x00\xcf\x00\xd0\x00\xd1\x00\xd2\x00\xd3\x00\xd4\x00\xd5\x00\xd6\x00\xd7\x00\xd8\x00\xd9\x00\xda\x00\xdb\x00\xdc\x00\xdd\x00\xde\x00\xdf\x00\xe0\x00\xe1\x00\xe2\x00\xe3\x00\xe4\x00\xe5\x00\xe6\x00\xe7\x00\xe8\x00\xe9\x00\xea\x00\xeb\x00\xec\x00\xed\x00\xee\x00\xef\x00\xf0\x00\xf1\x00\xf2\x00\xf3\x00\xf4\x00\xf5\x00\xf6\x00\xf7\x00\xf8\x00\xf9\x00\xfa\x00\xfb\x00\xfc\x00\xfd\x00\xfe\x00\xff\x00\x09\x00\x0a\x00\x0b\x00\x0c\x00\x0d\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x20\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x49\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x80\x00\x81\x00\x82\x00\x83\x00\x84\x00\x85\x00\x86\x00\x87\x00\x88\x00\x89\x00\x8a\x00\x8b\x00\x8c\x00\x8d\x00\x8e\x00\x8f\x00\x90\x00\x91\x00\x92\x00\x93\x00\x94\x00\x95\x00\x96\x00\x97\x00\x98\x00\x99\x00\x9a\x00\x9b\x00\x9c\x00\x9d\x00\x9e\x00\x9f\x00\xa0\x00\xa1\x00\xa2\x00\xa3\x00\xa4\x00\xa5\x00\xa6\x00\xa7\x00\xa8\x00\xa9\x00\xaa\x00\xab\x00\xac\x00\xad\x00\xae\x00\xaf\x00\xb0\x00\xb1\x00\xb2\x00\xb3\x00\xb4\x00\xb5\x00\xb6\x00\xb7\x00\xb8\x00\xb9\x00\xba\x00\xbb\x00\xbc\x00\xbd\x00\xbe\x00\xbf\x00\xc0\x00\xc1\x00\xc2\x00\xc3\x00\xc4\x00\xc5\x00\xc6\x00\xc7\x00\xc8\x00\xc9\x00\xca\x00\xcb\x00\xcc\x00\xcd\x00\xce\x00\xcf\x00\xd0\x00\xd1\x00\xd2\x00\xd3\x00\xd4\x00\xd5\x00\xd6\x00\xd7\x00\xd8\x00\xd9\x00\xda\x00\xdb\x00\xdc\x00\xdd\x00\xde\x00\xdf\x00\xe0\x00\xe1\x00\xe2\x00\xe3\x00\xe4\x00\xe5\x00\xe6\x00\xe7\x00\xe8\x00\xe9\x00\xea\x00\xeb\x00\xec\x00\xed\x00\xee\x00\xef\x00\xf0\x00\xf1\x00\xf2\x00\xf3\x00\xf4\x00\xf5\x00\xf6\x00\xf7\x00\xf8\x00\xf9\x00\xfa\x00\xfb\x00\xfc\x00\xfd\x00\xfe\x00\xff\x00\x09\x00\x0a\x00\x0b\x00\x0c\x00\x0d\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x20\x00\xff\xff\x21\x00\xff\xff\x23\x00\x24\x00\x25\x00\x26\x00\x27\x00\xff\xff\xff\xff\x2a\x00\x2b\x00\x2c\x00\x2d\x00\x2e\x00\x2f\x00\x30\x00\x31\x00\x32\x00\x33\x00\x34\x00\x35\x00\x36\x00\x37\x00\x38\x00\x39\x00\x3a\x00\xff\xff\x3c\x00\x3d\x00\x3e\x00\x3f\x00\x41\x00\x41\x00\x42\x00\x43\x00\x44\x00\x45\x00\x46\x00\x47\x00\x48\x00\x49\x00\x4a\x00\x4b\x00\x4c\x00\x4d\x00\x4e\x00\x4f\x00\x50\x00\x51\x00\x52\x00\x53\x00\x54\x00\x55\x00\x56\x00\x57\x00\x58\x00\x59\x00\x5a\x00\x5b\x00\x5c\x00\x5d\x00\x5e\x00\x5f\x00\x60\x00\x61\x00\x62\x00\x63\x00\x64\x00\x65\x00\x66\x00\x67\x00\x68\x00\x69\x00\x6a\x00\x6b\x00\x6c\x00\x6d\x00\x6e\x00\x6f\x00\x70\x00\x71\x00\x72\x00\x73\x00\x74\x00\x75\x00\x76\x00\x77\x00\x78\x00\x79\x00\x7a\x00\xff\xff\x7c\x00\xff\xff\x7e\x00\x80\x00\x81\x00\x82\x00\x83\x00\x84\x00\x85\x00\x86\x00\x87\x00\x88\x00\x89\x00\x8a\x00\x8b\x00\x8c\x00\x8d\x00\x8e\x00\x8f\x00\x90\x00\x91\x00\x92\x00\x93\x00\x94\x00\x95\x00\x96\x00\x97\x00\x98\x00\x99\x00\x9a\x00\x9b\x00\x9c\x00\x9d\x00\x9e\x00\x9f\x00\xa0\x00\xa1\x00\xa2\x00\xa3\x00\xa4\x00\xa5\x00\xa6\x00\xa7\x00\xa8\x00\xa9\x00\xaa\x00\xab\x00\xac\x00\xad\x00\xae\x00\xaf\x00\xb0\x00\xb1\x00\xb2\x00\xb3\x00\xb4\x00\xb5\x00\xb6\x00\xb7\x00\xb8\x00\xb9\x00\xba\x00\xbb\x00\xbc\x00\xbd\x00\xbe\x00\xbf\x00\xc0\x00\xc1\x00\xc2\x00\xc3\x00\xc4\x00\xc5\x00\xc6\x00\xc7\x00\xc8\x00\xc9\x00\xca\x00\xcb\x00\xcc\x00\xcd\x00\xce\x00\xcf\x00\xd0\x00\xd1\x00\xd2\x00\xd3\x00\xd4\x00\xd5\x00\xd6\x00\xd7\x00\xd8\x00\xd9\x00\xda\x00\xdb\x00\xdc\x00\xdd\x00\xde\x00\xdf\x00\xe0\x00\xe1\x00\xe2\x00\xe3\x00\xe4\x00\xe5\x00\xe6\x00\xe7\x00\xe8\x00\xe9\x00\xea\x00\xeb\x00\xec\x00\xed\x00\xee\x00\xef\x00\xf0\x00\xf1\x00\xf2\x00\xf3\x00\xf4\x00\xf5\x00\xf6\x00\xf7\x00\xf8\x00\xf9\x00\xfa\x00\xfb\x00\xfc\x00\xfd\x00\xfe\x00\xff\x00\x09\x00\x0a\x00\x0b\x00\x0c\x00\x0d\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x20\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x59\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x80\x00\x81\x00\x82\x00\x83\x00\x84\x00\x85\x00\x86\x00\x87\x00\x88\x00\x89\x00\x8a\x00\x8b\x00\x8c\x00\x8d\x00\x8e\x00\x8f\x00\x90\x00\x91\x00\x92\x00\x93\x00\x94\x00\x95\x00\x96\x00\x97\x00\x98\x00\x99\x00\x9a\x00\x9b\x00\x9c\x00\x9d\x00\x9e\x00\x9f\x00\xa0\x00\xa1\x00\xa2\x00\xa3\x00\xa4\x00\xa5\x00\xa6\x00\xa7\x00\xa8\x00\xa9\x00\xaa\x00\xab\x00\xac\x00\xad\x00\xae\x00\xaf\x00\xb0\x00\xb1\x00\xb2\x00\xb3\x00\xb4\x00\xb5\x00\xb6\x00\xb7\x00\xb8\x00\xb9\x00\xba\x00\xbb\x00\xbc\x00\xbd\x00\xbe\x00\xbf\x00\xc0\x00\xc1\x00\xc2\x00\xc3\x00\xc4\x00\xc5\x00\xc6\x00\xc7\x00\xc8\x00\xc9\x00\xca\x00\xcb\x00\xcc\x00\xcd\x00\xce\x00\xcf\x00\xd0\x00\xd1\x00\xd2\x00\xd3\x00\xd4\x00\xd5\x00\xd6\x00\xd7\x00\xd8\x00\xd9\x00\xda\x00\xdb\x00\xdc\x00\xdd\x00\xde\x00\xdf\x00\xe0\x00\xe1\x00\xe2\x00\xe3\x00\xe4\x00\xe5\x00\xe6\x00\xe7\x00\xe8\x00\xe9\x00\xea\x00\xeb\x00\xec\x00\xed\x00\xee\x00\xef\x00\xf0\x00\xf1\x00\xf2\x00\xf3\x00\xf4\x00\xf5\x00\xf6\x00\xf7\x00\xf8\x00\xf9\x00\xfa\x00\xfb\x00\xfc\x00\xfd\x00\xfe\x00\xff\x00\x09\x00\x0a\x00\x0b\x00\x0c\x00\x0d\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x20\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x4f\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x80\x00\x81\x00\x82\x00\x83\x00\x84\x00\x85\x00\x86\x00\x87\x00\x88\x00\x89\x00\x8a\x00\x8b\x00\x8c\x00\x8d\x00\x8e\x00\x8f\x00\x90\x00\x91\x00\x92\x00\x93\x00\x94\x00\x95\x00\x96\x00\x97\x00\x98\x00\x99\x00\x9a\x00\x9b\x00\x9c\x00\x9d\x00\x9e\x00\x9f\x00\xa0\x00\xa1\x00\xa2\x00\xa3\x00\xa4\x00\xa5\x00\xa6\x00\xa7\x00\xa8\x00\xa9\x00\xaa\x00\xab\x00\xac\x00\xad\x00\xae\x00\xaf\x00\xb0\x00\xb1\x00\xb2\x00\xb3\x00\xb4\x00\xb5\x00\xb6\x00\xb7\x00\xb8\x00\xb9\x00\xba\x00\xbb\x00\xbc\x00\xbd\x00\xbe\x00\xbf\x00\xc0\x00\xc1\x00\xc2\x00\xc3\x00\xc4\x00\xc5\x00\xc6\x00\xc7\x00\xc8\x00\xc9\x00\xca\x00\xcb\x00\xcc\x00\xcd\x00\xce\x00\xcf\x00\xd0\x00\xd1\x00\xd2\x00\xd3\x00\xd4\x00\xd5\x00\xd6\x00\xd7\x00\xd8\x00\xd9\x00\xda\x00\xdb\x00\xdc\x00\xdd\x00\xde\x00\xdf\x00\xe0\x00\xe1\x00\xe2\x00\xe3\x00\xe4\x00\xe5\x00\xe6\x00\xe7\x00\xe8\x00\xe9\x00\xea\x00\xeb\x00\xec\x00\xed\x00\xee\x00\xef\x00\xf0\x00\xf1\x00\xf2\x00\xf3\x00\xf4\x00\xf5\x00\xf6\x00\xf7\x00\xf8\x00\xf9\x00\xfa\x00\xfb\x00\xfc\x00\xfd\x00\xfe\x00\xff\x00\x09\x00\x0a\x00\x0b\x00\x0c\x00\x0d\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x20\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x4f\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x80\x00\x81\x00\x82\x00\x83\x00\x84\x00\x85\x00\x86\x00\x87\x00\x88\x00\x89\x00\x8a\x00\x8b\x00\x8c\x00\x8d\x00\x8e\x00\x8f\x00\x90\x00\x91\x00\x92\x00\x93\x00\x94\x00\x95\x00\x96\x00\x97\x00\x98\x00\x99\x00\x9a\x00\x9b\x00\x9c\x00\x9d\x00\x9e\x00\x9f\x00\xa0\x00\xa1\x00\xa2\x00\xa3\x00\xa4\x00\xa5\x00\xa6\x00\xa7\x00\xa8\x00\xa9\x00\xaa\x00\xab\x00\xac\x00\xad\x00\xae\x00\xaf\x00\xb0\x00\xb1\x00\xb2\x00\xb3\x00\xb4\x00\xb5\x00\xb6\x00\xb7\x00\xb8\x00\xb9\x00\xba\x00\xbb\x00\xbc\x00\xbd\x00\xbe\x00\xbf\x00\xc0\x00\xc1\x00\xc2\x00\xc3\x00\xc4\x00\xc5\x00\xc6\x00\xc7\x00\xc8\x00\xc9\x00\xca\x00\xcb\x00\xcc\x00\xcd\x00\xce\x00\xcf\x00\xd0\x00\xd1\x00\xd2\x00\xd3\x00\xd4\x00\xd5\x00\xd6\x00\xd7\x00\xd8\x00\xd9\x00\xda\x00\xdb\x00\xdc\x00\xdd\x00\xde\x00\xdf\x00\xe0\x00\xe1\x00\xe2\x00\xe3\x00\xe4\x00\xe5\x00\xe6\x00\xe7\x00\xe8\x00\xe9\x00\xea\x00\xeb\x00\xec\x00\xed\x00\xee\x00\xef\x00\xf0\x00\xf1\x00\xf2\x00\xf3\x00\xf4\x00\xf5\x00\xf6\x00\xf7\x00\xf8\x00\xf9\x00\xfa\x00\xfb\x00\xfc\x00\xfd\x00\xfe\x00\xff\x00\x09\x00\x0a\x00\x0b\x00\x0c\x00\x0d\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x20\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x45\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x80\x00\x81\x00\x82\x00\x83\x00\x84\x00\x85\x00\x86\x00\x87\x00\x88\x00\x89\x00\x8a\x00\x8b\x00\x8c\x00\x8d\x00\x8e\x00\x8f\x00\x90\x00\x91\x00\x92\x00\x93\x00\x94\x00\x95\x00\x96\x00\x97\x00\x98\x00\x99\x00\x9a\x00\x9b\x00\x9c\x00\x9d\x00\x9e\x00\x9f\x00\xa0\x00\xa1\x00\xa2\x00\xa3\x00\xa4\x00\xa5\x00\xa6\x00\xa7\x00\xa8\x00\xa9\x00\xaa\x00\xab\x00\xac\x00\xad\x00\xae\x00\xaf\x00\xb0\x00\xb1\x00\xb2\x00\xb3\x00\xb4\x00\xb5\x00\xb6\x00\xb7\x00\xb8\x00\xb9\x00\xba\x00\xbb\x00\xbc\x00\xbd\x00\xbe\x00\xbf\x00\xc0\x00\xc1\x00\xc2\x00\xc3\x00\xc4\x00\xc5\x00\xc6\x00\xc7\x00\xc8\x00\xc9\x00\xca\x00\xcb\x00\xcc\x00\xcd\x00\xce\x00\xcf\x00\xd0\x00\xd1\x00\xd2\x00\xd3\x00\xd4\x00\xd5\x00\xd6\x00\xd7\x00\xd8\x00\xd9\x00\xda\x00\xdb\x00\xdc\x00\xdd\x00\xde\x00\xdf\x00\xe0\x00\xe1\x00\xe2\x00\xe3\x00\xe4\x00\xe5\x00\xe6\x00\xe7\x00\xe8\x00\xe9\x00\xea\x00\xeb\x00\xec\x00\xed\x00\xee\x00\xef\x00\xf0\x00\xf1\x00\xf2\x00\xf3\x00\xf4\x00\xf5\x00\xf6\x00\xf7\x00\xf8\x00\xf9\x00\xfa\x00\xfb\x00\xfc\x00\xfd\x00\xfe\x00\xff\x00\x09\x00\x0a\x00\x0b\x00\x0c\x00\x0d\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x20\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x49\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x80\x00\x81\x00\x82\x00\x83\x00\x84\x00\x85\x00\x86\x00\x87\x00\x88\x00\x89\x00\x8a\x00\x8b\x00\x8c\x00\x8d\x00\x8e\x00\x8f\x00\x90\x00\x91\x00\x92\x00\x93\x00\x94\x00\x95\x00\x96\x00\x97\x00\x98\x00\x99\x00\x9a\x00\x9b\x00\x9c\x00\x9d\x00\x9e\x00\x9f\x00\xa0\x00\xa1\x00\xa2\x00\xa3\x00\xa4\x00\xa5\x00\xa6\x00\xa7\x00\xa8\x00\xa9\x00\xaa\x00\xab\x00\xac\x00\xad\x00\xae\x00\xaf\x00\xb0\x00\xb1\x00\xb2\x00\xb3\x00\xb4\x00\xb5\x00\xb6\x00\xb7\x00\xb8\x00\xb9\x00\xba\x00\xbb\x00\xbc\x00\xbd\x00\xbe\x00\xbf\x00\xc0\x00\xc1\x00\xc2\x00\xc3\x00\xc4\x00\xc5\x00\xc6\x00\xc7\x00\xc8\x00\xc9\x00\xca\x00\xcb\x00\xcc\x00\xcd\x00\xce\x00\xcf\x00\xd0\x00\xd1\x00\xd2\x00\xd3\x00\xd4\x00\xd5\x00\xd6\x00\xd7\x00\xd8\x00\xd9\x00\xda\x00\xdb\x00\xdc\x00\xdd\x00\xde\x00\xdf\x00\xe0\x00\xe1\x00\xe2\x00\xe3\x00\xe4\x00\xe5\x00\xe6\x00\xe7\x00\xe8\x00\xe9\x00\xea\x00\xeb\x00\xec\x00\xed\x00\xee\x00\xef\x00\xf0\x00\xf1\x00\xf2\x00\xf3\x00\xf4\x00\xf5\x00\xf6\x00\xf7\x00\xf8\x00\xf9\x00\xfa\x00\xfb\x00\xfc\x00\xfd\x00\xfe\x00\xff\x00\x09\x00\x0a\x00\x0b\x00\x0c\x00\x0d\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x20\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x49\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x80\x00\x81\x00\x82\x00\x83\x00\x84\x00\x85\x00\x86\x00\x87\x00\x88\x00\x89\x00\x8a\x00\x8b\x00\x8c\x00\x8d\x00\x8e\x00\x8f\x00\x90\x00\x91\x00\x92\x00\x93\x00\x94\x00\x95\x00\x96\x00\x97\x00\x98\x00\x99\x00\x9a\x00\x9b\x00\x9c\x00\x9d\x00\x9e\x00\x9f\x00\xa0\x00\xa1\x00\xa2\x00\xa3\x00\xa4\x00\xa5\x00\xa6\x00\xa7\x00\xa8\x00\xa9\x00\xaa\x00\xab\x00\xac\x00\xad\x00\xae\x00\xaf\x00\xb0\x00\xb1\x00\xb2\x00\xb3\x00\xb4\x00\xb5\x00\xb6\x00\xb7\x00\xb8\x00\xb9\x00\xba\x00\xbb\x00\xbc\x00\xbd\x00\xbe\x00\xbf\x00\xc0\x00\xc1\x00\xc2\x00\xc3\x00\xc4\x00\xc5\x00\xc6\x00\xc7\x00\xc8\x00\xc9\x00\xca\x00\xcb\x00\xcc\x00\xcd\x00\xce\x00\xcf\x00\xd0\x00\xd1\x00\xd2\x00\xd3\x00\xd4\x00\xd5\x00\xd6\x00\xd7\x00\xd8\x00\xd9\x00\xda\x00\xdb\x00\xdc\x00\xdd\x00\xde\x00\xdf\x00\xe0\x00\xe1\x00\xe2\x00\xe3\x00\xe4\x00\xe5\x00\xe6\x00\xe7\x00\xe8\x00\xe9\x00\xea\x00\xeb\x00\xec\x00\xed\x00\xee\x00\xef\x00\xf0\x00\xf1\x00\xf2\x00\xf3\x00\xf4\x00\xf5\x00\xf6\x00\xf7\x00\xf8\x00\xf9\x00\xfa\x00\xfb\x00\xfc\x00\xfd\x00\xfe\x00\xff\x00\x09\x00\x0a\x00\x0b\x00\x0c\x00\x0d\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x20\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x55\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x80\x00\x81\x00\x82\x00\x83\x00\x84\x00\x85\x00\x86\x00\x87\x00\x88\x00\x89\x00\x8a\x00\x8b\x00\x8c\x00\x8d\x00\x8e\x00\x8f\x00\x90\x00\x91\x00\x92\x00\x93\x00\x94\x00\x95\x00\x96\x00\x97\x00\x98\x00\x99\x00\x9a\x00\x9b\x00\x9c\x00\x9d\x00\x9e\x00\x9f\x00\xa0\x00\xa1\x00\xa2\x00\xa3\x00\xa4\x00\xa5\x00\xa6\x00\xa7\x00\xa8\x00\xa9\x00\xaa\x00\xab\x00\xac\x00\xad\x00\xae\x00\xaf\x00\xb0\x00\xb1\x00\xb2\x00\xb3\x00\xb4\x00\xb5\x00\xb6\x00\xb7\x00\xb8\x00\xb9\x00\xba\x00\xbb\x00\xbc\x00\xbd\x00\xbe\x00\xbf\x00\xc0\x00\xc1\x00\xc2\x00\xc3\x00\xc4\x00\xc5\x00\xc6\x00\xc7\x00\xc8\x00\xc9\x00\xca\x00\xcb\x00\xcc\x00\xcd\x00\xce\x00\xcf\x00\xd0\x00\xd1\x00\xd2\x00\xd3\x00\xd4\x00\xd5\x00\xd6\x00\xd7\x00\xd8\x00\xd9\x00\xda\x00\xdb\x00\xdc\x00\xdd\x00\xde\x00\xdf\x00\xe0\x00\xe1\x00\xe2\x00\xe3\x00\xe4\x00\xe5\x00\xe6\x00\xe7\x00\xe8\x00\xe9\x00\xea\x00\xeb\x00\xec\x00\xed\x00\xee\x00\xef\x00\xf0\x00\xf1\x00\xf2\x00\xf3\x00\xf4\x00\xf5\x00\xf6\x00\xf7\x00\xf8\x00\xf9\x00\xfa\x00\xfb\x00\xfc\x00\xfd\x00\xfe\x00\xff\x00\x09\x00\x0a\x00\x0b\x00\x0c\x00\x0d\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x20\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x49\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x80\x00\x81\x00\x82\x00\x83\x00\x84\x00\x85\x00\x86\x00\x87\x00\x88\x00\x89\x00\x8a\x00\x8b\x00\x8c\x00\x8d\x00\x8e\x00\x8f\x00\x90\x00\x91\x00\x92\x00\x93\x00\x94\x00\x95\x00\x96\x00\x97\x00\x98\x00\x99\x00\x9a\x00\x9b\x00\x9c\x00\x9d\x00\x9e\x00\x9f\x00\xa0\x00\xa1\x00\xa2\x00\xa3\x00\xa4\x00\xa5\x00\xa6\x00\xa7\x00\xa8\x00\xa9\x00\xaa\x00\xab\x00\xac\x00\xad\x00\xae\x00\xaf\x00\xb0\x00\xb1\x00\xb2\x00\xb3\x00\xb4\x00\xb5\x00\xb6\x00\xb7\x00\xb8\x00\xb9\x00\xba\x00\xbb\x00\xbc\x00\xbd\x00\xbe\x00\xbf\x00\xc0\x00\xc1\x00\xc2\x00\xc3\x00\xc4\x00\xc5\x00\xc6\x00\xc7\x00\xc8\x00\xc9\x00\xca\x00\xcb\x00\xcc\x00\xcd\x00\xce\x00\xcf\x00\xd0\x00\xd1\x00\xd2\x00\xd3\x00\xd4\x00\xd5\x00\xd6\x00\xd7\x00\xd8\x00\xd9\x00\xda\x00\xdb\x00\xdc\x00\xdd\x00\xde\x00\xdf\x00\xe0\x00\xe1\x00\xe2\x00\xe3\x00\xe4\x00\xe5\x00\xe6\x00\xe7\x00\xe8\x00\xe9\x00\xea\x00\xeb\x00\xec\x00\xed\x00\xee\x00\xef\x00\xf0\x00\xf1\x00\xf2\x00\xf3\x00\xf4\x00\xf5\x00\xf6\x00\xf7\x00\xf8\x00\xf9\x00\xfa\x00\xfb\x00\xfc\x00\xfd\x00\xfe\x00\xff\x00\x09\x00\x0a\x00\x0b\x00\x0c\x00\x0d\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x20\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x49\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x80\x00\x81\x00\x82\x00\x83\x00\x84\x00\x85\x00\x86\x00\x87\x00\x88\x00\x89\x00\x8a\x00\x8b\x00\x8c\x00\x8d\x00\x8e\x00\x8f\x00\x90\x00\x91\x00\x92\x00\x93\x00\x94\x00\x95\x00\x96\x00\x97\x00\x98\x00\x99\x00\x9a\x00\x9b\x00\x9c\x00\x9d\x00\x9e\x00\x9f\x00\xa0\x00\xa1\x00\xa2\x00\xa3\x00\xa4\x00\xa5\x00\xa6\x00\xa7\x00\xa8\x00\xa9\x00\xaa\x00\xab\x00\xac\x00\xad\x00\xae\x00\xaf\x00\xb0\x00\xb1\x00\xb2\x00\xb3\x00\xb4\x00\xb5\x00\xb6\x00\xb7\x00\xb8\x00\xb9\x00\xba\x00\xbb\x00\xbc\x00\xbd\x00\xbe\x00\xbf\x00\xc0\x00\xc1\x00\xc2\x00\xc3\x00\xc4\x00\xc5\x00\xc6\x00\xc7\x00\xc8\x00\xc9\x00\xca\x00\xcb\x00\xcc\x00\xcd\x00\xce\x00\xcf\x00\xd0\x00\xd1\x00\xd2\x00\xd3\x00\xd4\x00\xd5\x00\xd6\x00\xd7\x00\xd8\x00\xd9\x00\xda\x00\xdb\x00\xdc\x00\xdd\x00\xde\x00\xdf\x00\xe0\x00\xe1\x00\xe2\x00\xe3\x00\xe4\x00\xe5\x00\xe6\x00\xe7\x00\xe8\x00\xe9\x00\xea\x00\xeb\x00\xec\x00\xed\x00\xee\x00\xef\x00\xf0\x00\xf1\x00\xf2\x00\xf3\x00\xf4\x00\xf5\x00\xf6\x00\xf7\x00\xf8\x00\xf9\x00\xfa\x00\xfb\x00\xfc\x00\xfd\x00\xfe\x00\xff\x00\x09\x00\x0a\x00\x0b\x00\x0c\x00\x0d\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x20\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x49\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x80\x00\x81\x00\x82\x00\x83\x00\x84\x00\x85\x00\x86\x00\x87\x00\x88\x00\x89\x00\x8a\x00\x8b\x00\x8c\x00\x8d\x00\x8e\x00\x8f\x00\x90\x00\x91\x00\x92\x00\x93\x00\x94\x00\x95\x00\x96\x00\x97\x00\x98\x00\x99\x00\x9a\x00\x9b\x00\x9c\x00\x9d\x00\x9e\x00\x9f\x00\xa0\x00\xa1\x00\xa2\x00\xa3\x00\xa4\x00\xa5\x00\xa6\x00\xa7\x00\xa8\x00\xa9\x00\xaa\x00\xab\x00\xac\x00\xad\x00\xae\x00\xaf\x00\xb0\x00\xb1\x00\xb2\x00\xb3\x00\xb4\x00\xb5\x00\xb6\x00\xb7\x00\xb8\x00\xb9\x00\xba\x00\xbb\x00\xbc\x00\xbd\x00\xbe\x00\xbf\x00\xc0\x00\xc1\x00\xc2\x00\xc3\x00\xc4\x00\xc5\x00\xc6\x00\xc7\x00\xc8\x00\xc9\x00\xca\x00\xcb\x00\xcc\x00\xcd\x00\xce\x00\xcf\x00\xd0\x00\xd1\x00\xd2\x00\xd3\x00\xd4\x00\xd5\x00\xd6\x00\xd7\x00\xd8\x00\xd9\x00\xda\x00\xdb\x00\xdc\x00\xdd\x00\xde\x00\xdf\x00\xe0\x00\xe1\x00\xe2\x00\xe3\x00\xe4\x00\xe5\x00\xe6\x00\xe7\x00\xe8\x00\xe9\x00\xea\x00\xeb\x00\xec\x00\xed\x00\xee\x00\xef\x00\xf0\x00\xf1\x00\xf2\x00\xf3\x00\xf4\x00\xf5\x00\xf6\x00\xf7\x00\xf8\x00\xf9\x00\xfa\x00\xfb\x00\xfc\x00\xfd\x00\xfe\x00\xff\x00\x09\x00\x0a\x00\x0b\x00\x0c\x00\x0d\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x20\x00\xff\xff\x21\x00\xff\xff\x23\x00\x24\x00\x25\x00\x26\x00\x27\x00\xff\xff\xff\xff\x2a\x00\x2b\x00\x2c\x00\x2d\x00\x2e\x00\x2f\x00\x30\x00\x31\x00\x32\x00\x33\x00\x34\x00\x35\x00\x36\x00\x37\x00\x38\x00\x39\x00\x3a\x00\xff\xff\x3c\x00\x3d\x00\x3e\x00\x3f\x00\x41\x00\x41\x00\x42\x00\x43\x00\x44\x00\x45\x00\x46\x00\x47\x00\x48\x00\x49\x00\x4a\x00\x4b\x00\x4c\x00\x4d\x00\x4e\x00\x4f\x00\x50\x00\x51\x00\x52\x00\x53\x00\x54\x00\x55\x00\x56\x00\x57\x00\x58\x00\x59\x00\x5a\x00\x5b\x00\x5c\x00\x5d\x00\x5e\x00\x5f\x00\x60\x00\x61\x00\x62\x00\x63\x00\x64\x00\x65\x00\x66\x00\x67\x00\x68\x00\x69\x00\x6a\x00\x6b\x00\x6c\x00\x6d\x00\x6e\x00\x6f\x00\x70\x00\x71\x00\x72\x00\x73\x00\x74\x00\x75\x00\x76\x00\x77\x00\x78\x00\x79\x00\x7a\x00\xff\xff\x7c\x00\xff\xff\x7e\x00\x80\x00\x81\x00\x82\x00\x83\x00\x84\x00\x85\x00\x86\x00\x87\x00\x88\x00\x89\x00\x8a\x00\x8b\x00\x8c\x00\x8d\x00\x8e\x00\x8f\x00\x90\x00\x91\x00\x92\x00\x93\x00\x94\x00\x95\x00\x96\x00\x97\x00\x98\x00\x99\x00\x9a\x00\x9b\x00\x9c\x00\x9d\x00\x9e\x00\x9f\x00\xa0\x00\xa1\x00\xa2\x00\xa3\x00\xa4\x00\xa5\x00\xa6\x00\xa7\x00\xa8\x00\xa9\x00\xaa\x00\xab\x00\xac\x00\xad\x00\xae\x00\xaf\x00\xb0\x00\xb1\x00\xb2\x00\xb3\x00\xb4\x00\xb5\x00\xb6\x00\xb7\x00\xb8\x00\xb9\x00\xba\x00\xbb\x00\xbc\x00\xbd\x00\xbe\x00\xbf\x00\xc0\x00\xc1\x00\xc2\x00\xc3\x00\xc4\x00\xc5\x00\xc6\x00\xc7\x00\xc8\x00\xc9\x00\xca\x00\xcb\x00\xcc\x00\xcd\x00\xce\x00\xcf\x00\xd0\x00\xd1\x00\xd2\x00\xd3\x00\xd4\x00\xd5\x00\xd6\x00\xd7\x00\xd8\x00\xd9\x00\xda\x00\xdb\x00\xdc\x00\xdd\x00\xde\x00\xdf\x00\xe0\x00\xe1\x00\xe2\x00\xe3\x00\xe4\x00\xe5\x00\xe6\x00\xe7\x00\xe8\x00\xe9\x00\xea\x00\xeb\x00\xec\x00\xed\x00\xee\x00\xef\x00\xf0\x00\xf1\x00\xf2\x00\xf3\x00\xf4\x00\xf5\x00\xf6\x00\xf7\x00\xf8\x00\xf9\x00\xfa\x00\xfb\x00\xfc\x00\xfd\x00\xfe\x00\xff\x00\x09\x00\x0a\x00\x0b\x00\x0c\x00\x0d\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x20\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x49\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x80\x00\x81\x00\x82\x00\x83\x00\x84\x00\x85\x00\x86\x00\x87\x00\x88\x00\x89\x00\x8a\x00\x8b\x00\x8c\x00\x8d\x00\x8e\x00\x8f\x00\x90\x00\x91\x00\x92\x00\x93\x00\x94\x00\x95\x00\x96\x00\x97\x00\x98\x00\x99\x00\x9a\x00\x9b\x00\x9c\x00\x9d\x00\x9e\x00\x9f\x00\xa0\x00\xa1\x00\xa2\x00\xa3\x00\xa4\x00\xa5\x00\xa6\x00\xa7\x00\xa8\x00\xa9\x00\xaa\x00\xab\x00\xac\x00\xad\x00\xae\x00\xaf\x00\xb0\x00\xb1\x00\xb2\x00\xb3\x00\xb4\x00\xb5\x00\xb6\x00\xb7\x00\xb8\x00\xb9\x00\xba\x00\xbb\x00\xbc\x00\xbd\x00\xbe\x00\xbf\x00\xc0\x00\xc1\x00\xc2\x00\xc3\x00\xc4\x00\xc5\x00\xc6\x00\xc7\x00\xc8\x00\xc9\x00\xca\x00\xcb\x00\xcc\x00\xcd\x00\xce\x00\xcf\x00\xd0\x00\xd1\x00\xd2\x00\xd3\x00\xd4\x00\xd5\x00\xd6\x00\xd7\x00\xd8\x00\xd9\x00\xda\x00\xdb\x00\xdc\x00\xdd\x00\xde\x00\xdf\x00\xe0\x00\xe1\x00\xe2\x00\xe3\x00\xe4\x00\xe5\x00\xe6\x00\xe7\x00\xe8\x00\xe9\x00\xea\x00\xeb\x00\xec\x00\xed\x00\xee\x00\xef\x00\xf0\x00\xf1\x00\xf2\x00\xf3\x00\xf4\x00\xf5\x00\xf6\x00\xf7\x00\xf8\x00\xf9\x00\xfa\x00\xfb\x00\xfc\x00\xfd\x00\xfe\x00\xff\x00\x09\x00\x0a\x00\x0b\x00\x0c\x00\x0d\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x20\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x53\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x80\x00\x81\x00\x82\x00\x83\x00\x84\x00\x85\x00\x86\x00\x87\x00\x88\x00\x89\x00\x8a\x00\x8b\x00\x8c\x00\x8d\x00\x8e\x00\x8f\x00\x90\x00\x91\x00\x92\x00\x93\x00\x94\x00\x95\x00\x96\x00\x97\x00\x98\x00\x99\x00\x9a\x00\x9b\x00\x9c\x00\x9d\x00\x9e\x00\x9f\x00\xa0\x00\xa1\x00\xa2\x00\xa3\x00\xa4\x00\xa5\x00\xa6\x00\xa7\x00\xa8\x00\xa9\x00\xaa\x00\xab\x00\xac\x00\xad\x00\xae\x00\xaf\x00\xb0\x00\xb1\x00\xb2\x00\xb3\x00\xb4\x00\xb5\x00\xb6\x00\xb7\x00\xb8\x00\xb9\x00\xba\x00\xbb\x00\xbc\x00\xbd\x00\xbe\x00\xbf\x00\xc0\x00\xc1\x00\xc2\x00\xc3\x00\xc4\x00\xc5\x00\xc6\x00\xc7\x00\xc8\x00\xc9\x00\xca\x00\xcb\x00\xcc\x00\xcd\x00\xce\x00\xcf\x00\xd0\x00\xd1\x00\xd2\x00\xd3\x00\xd4\x00\xd5\x00\xd6\x00\xd7\x00\xd8\x00\xd9\x00\xda\x00\xdb\x00\xdc\x00\xdd\x00\xde\x00\xdf\x00\xe0\x00\xe1\x00\xe2\x00\xe3\x00\xe4\x00\xe5\x00\xe6\x00\xe7\x00\xe8\x00\xe9\x00\xea\x00\xeb\x00\xec\x00\xed\x00\xee\x00\xef\x00\xf0\x00\xf1\x00\xf2\x00\xf3\x00\xf4\x00\xf5\x00\xf6\x00\xf7\x00\xf8\x00\xf9\x00\xfa\x00\xfb\x00\xfc\x00\xfd\x00\xfe\x00\xff\x00\x09\x00\x0a\x00\x0b\x00\x0c\x00\x0d\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x20\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x49\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x80\x00\x81\x00\x82\x00\x83\x00\x84\x00\x85\x00\x86\x00\x87\x00\x88\x00\x89\x00\x8a\x00\x8b\x00\x8c\x00\x8d\x00\x8e\x00\x8f\x00\x90\x00\x91\x00\x92\x00\x93\x00\x94\x00\x95\x00\x96\x00\x97\x00\x98\x00\x99\x00\x9a\x00\x9b\x00\x9c\x00\x9d\x00\x9e\x00\x9f\x00\xa0\x00\xa1\x00\xa2\x00\xa3\x00\xa4\x00\xa5\x00\xa6\x00\xa7\x00\xa8\x00\xa9\x00\xaa\x00\xab\x00\xac\x00\xad\x00\xae\x00\xaf\x00\xb0\x00\xb1\x00\xb2\x00\xb3\x00\xb4\x00\xb5\x00\xb6\x00\xb7\x00\xb8\x00\xb9\x00\xba\x00\xbb\x00\xbc\x00\xbd\x00\xbe\x00\xbf\x00\xc0\x00\xc1\x00\xc2\x00\xc3\x00\xc4\x00\xc5\x00\xc6\x00\xc7\x00\xc8\x00\xc9\x00\xca\x00\xcb\x00\xcc\x00\xcd\x00\xce\x00\xcf\x00\xd0\x00\xd1\x00\xd2\x00\xd3\x00\xd4\x00\xd5\x00\xd6\x00\xd7\x00\xd8\x00\xd9\x00\xda\x00\xdb\x00\xdc\x00\xdd\x00\xde\x00\xdf\x00\xe0\x00\xe1\x00\xe2\x00\xe3\x00\xe4\x00\xe5\x00\xe6\x00\xe7\x00\xe8\x00\xe9\x00\xea\x00\xeb\x00\xec\x00\xed\x00\xee\x00\xef\x00\xf0\x00\xf1\x00\xf2\x00\xf3\x00\xf4\x00\xf5\x00\xf6\x00\xf7\x00\xf8\x00\xf9\x00\xfa\x00\xfb\x00\xfc\x00\xfd\x00\xfe\x00\xff\x00\x09\x00\x0a\x00\x0b\x00\x0c\x00\x0d\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x20\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x57\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x80\x00\x81\x00\x82\x00\x83\x00\x84\x00\x85\x00\x86\x00\x87\x00\x88\x00\x89\x00\x8a\x00\x8b\x00\x8c\x00\x8d\x00\x8e\x00\x8f\x00\x90\x00\x91\x00\x92\x00\x93\x00\x94\x00\x95\x00\x96\x00\x97\x00\x98\x00\x99\x00\x9a\x00\x9b\x00\x9c\x00\x9d\x00\x9e\x00\x9f\x00\xa0\x00\xa1\x00\xa2\x00\xa3\x00\xa4\x00\xa5\x00\xa6\x00\xa7\x00\xa8\x00\xa9\x00\xaa\x00\xab\x00\xac\x00\xad\x00\xae\x00\xaf\x00\xb0\x00\xb1\x00\xb2\x00\xb3\x00\xb4\x00\xb5\x00\xb6\x00\xb7\x00\xb8\x00\xb9\x00\xba\x00\xbb\x00\xbc\x00\xbd\x00\xbe\x00\xbf\x00\xc0\x00\xc1\x00\xc2\x00\xc3\x00\xc4\x00\xc5\x00\xc6\x00\xc7\x00\xc8\x00\xc9\x00\xca\x00\xcb\x00\xcc\x00\xcd\x00\xce\x00\xcf\x00\xd0\x00\xd1\x00\xd2\x00\xd3\x00\xd4\x00\xd5\x00\xd6\x00\xd7\x00\xd8\x00\xd9\x00\xda\x00\xdb\x00\xdc\x00\xdd\x00\xde\x00\xdf\x00\xe0\x00\xe1\x00\xe2\x00\xe3\x00\xe4\x00\xe5\x00\xe6\x00\xe7\x00\xe8\x00\xe9\x00\xea\x00\xeb\x00\xec\x00\xed\x00\xee\x00\xef\x00\xf0\x00\xf1\x00\xf2\x00\xf3\x00\xf4\x00\xf5\x00\xf6\x00\xf7\x00\xf8\x00\xf9\x00\xfa\x00\xfb\x00\xfc\x00\xfd\x00\xfe\x00\xff\x00\x09\x00\x0a\x00\x0b\x00\x0c\x00\x0d\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x20\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x4d\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x80\x00\x81\x00\x82\x00\x83\x00\x84\x00\x85\x00\x86\x00\x87\x00\x88\x00\x89\x00\x8a\x00\x8b\x00\x8c\x00\x8d\x00\x8e\x00\x8f\x00\x90\x00\x91\x00\x92\x00\x93\x00\x94\x00\x95\x00\x96\x00\x97\x00\x98\x00\x99\x00\x9a\x00\x9b\x00\x9c\x00\x9d\x00\x9e\x00\x9f\x00\xa0\x00\xa1\x00\xa2\x00\xa3\x00\xa4\x00\xa5\x00\xa6\x00\xa7\x00\xa8\x00\xa9\x00\xaa\x00\xab\x00\xac\x00\xad\x00\xae\x00\xaf\x00\xb0\x00\xb1\x00\xb2\x00\xb3\x00\xb4\x00\xb5\x00\xb6\x00\xb7\x00\xb8\x00\xb9\x00\xba\x00\xbb\x00\xbc\x00\xbd\x00\xbe\x00\xbf\x00\xc0\x00\xc1\x00\xc2\x00\xc3\x00\xc4\x00\xc5\x00\xc6\x00\xc7\x00\xc8\x00\xc9\x00\xca\x00\xcb\x00\xcc\x00\xcd\x00\xce\x00\xcf\x00\xd0\x00\xd1\x00\xd2\x00\xd3\x00\xd4\x00\xd5\x00\xd6\x00\xd7\x00\xd8\x00\xd9\x00\xda\x00\xdb\x00\xdc\x00\xdd\x00\xde\x00\xdf\x00\xe0\x00\xe1\x00\xe2\x00\xe3\x00\xe4\x00\xe5\x00\xe6\x00\xe7\x00\xe8\x00\xe9\x00\xea\x00\xeb\x00\xec\x00\xed\x00\xee\x00\xef\x00\xf0\x00\xf1\x00\xf2\x00\xf3\x00\xf4\x00\xf5\x00\xf6\x00\xf7\x00\xf8\x00\xf9\x00\xfa\x00\xfb\x00\xfc\x00\xfd\x00\xfe\x00\xff\x00\x09\x00\x0a\x00\x0b\x00\x0c\x00\x0d\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x20\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x53\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x80\x00\x81\x00\x82\x00\x83\x00\x84\x00\x85\x00\x86\x00\x87\x00\x88\x00\x89\x00\x8a\x00\x8b\x00\x8c\x00\x8d\x00\x8e\x00\x8f\x00\x90\x00\x91\x00\x92\x00\x93\x00\x94\x00\x95\x00\x96\x00\x97\x00\x98\x00\x99\x00\x9a\x00\x9b\x00\x9c\x00\x9d\x00\x9e\x00\x9f\x00\xa0\x00\xa1\x00\xa2\x00\xa3\x00\xa4\x00\xa5\x00\xa6\x00\xa7\x00\xa8\x00\xa9\x00\xaa\x00\xab\x00\xac\x00\xad\x00\xae\x00\xaf\x00\xb0\x00\xb1\x00\xb2\x00\xb3\x00\xb4\x00\xb5\x00\xb6\x00\xb7\x00\xb8\x00\xb9\x00\xba\x00\xbb\x00\xbc\x00\xbd\x00\xbe\x00\xbf\x00\xc0\x00\xc1\x00\xc2\x00\xc3\x00\xc4\x00\xc5\x00\xc6\x00\xc7\x00\xc8\x00\xc9\x00\xca\x00\xcb\x00\xcc\x00\xcd\x00\xce\x00\xcf\x00\xd0\x00\xd1\x00\xd2\x00\xd3\x00\xd4\x00\xd5\x00\xd6\x00\xd7\x00\xd8\x00\xd9\x00\xda\x00\xdb\x00\xdc\x00\xdd\x00\xde\x00\xdf\x00\xe0\x00\xe1\x00\xe2\x00\xe3\x00\xe4\x00\xe5\x00\xe6\x00\xe7\x00\xe8\x00\xe9\x00\xea\x00\xeb\x00\xec\x00\xed\x00\xee\x00\xef\x00\xf0\x00\xf1\x00\xf2\x00\xf3\x00\xf4\x00\xf5\x00\xf6\x00\xf7\x00\xf8\x00\xf9\x00\xfa\x00\xfb\x00\xfc\x00\xfd\x00\xfe\x00\xff\x00\x09\x00\x0a\x00\x0b\x00\x0c\x00\x0d\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x20\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x43\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x80\x00\x81\x00\x82\x00\x83\x00\x84\x00\x85\x00\x86\x00\x87\x00\x88\x00\x89\x00\x8a\x00\x8b\x00\x8c\x00\x8d\x00\x8e\x00\x8f\x00\x90\x00\x91\x00\x92\x00\x93\x00\x94\x00\x95\x00\x96\x00\x97\x00\x98\x00\x99\x00\x9a\x00\x9b\x00\x9c\x00\x9d\x00\x9e\x00\x9f\x00\xa0\x00\xa1\x00\xa2\x00\xa3\x00\xa4\x00\xa5\x00\xa6\x00\xa7\x00\xa8\x00\xa9\x00\xaa\x00\xab\x00\xac\x00\xad\x00\xae\x00\xaf\x00\xb0\x00\xb1\x00\xb2\x00\xb3\x00\xb4\x00\xb5\x00\xb6\x00\xb7\x00\xb8\x00\xb9\x00\xba\x00\xbb\x00\xbc\x00\xbd\x00\xbe\x00\xbf\x00\xc0\x00\xc1\x00\xc2\x00\xc3\x00\xc4\x00\xc5\x00\xc6\x00\xc7\x00\xc8\x00\xc9\x00\xca\x00\xcb\x00\xcc\x00\xcd\x00\xce\x00\xcf\x00\xd0\x00\xd1\x00\xd2\x00\xd3\x00\xd4\x00\xd5\x00\xd6\x00\xd7\x00\xd8\x00\xd9\x00\xda\x00\xdb\x00\xdc\x00\xdd\x00\xde\x00\xdf\x00\xe0\x00\xe1\x00\xe2\x00\xe3\x00\xe4\x00\xe5\x00\xe6\x00\xe7\x00\xe8\x00\xe9\x00\xea\x00\xeb\x00\xec\x00\xed\x00\xee\x00\xef\x00\xf0\x00\xf1\x00\xf2\x00\xf3\x00\xf4\x00\xf5\x00\xf6\x00\xf7\x00\xf8\x00\xf9\x00\xfa\x00\xfb\x00\xfc\x00\xfd\x00\xfe\x00\xff\x00\x09\x00\x0a\x00\x0b\x00\x0c\x00\x0d\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x20\x00\xff\xff\x21\x00\xff\xff\x23\x00\x24\x00\x25\x00\x26\x00\x27\x00\xff\xff\xff\xff\x2a\x00\x2b\x00\x2c\x00\x2d\x00\x2e\x00\x2f\x00\x30\x00\x31\x00\x32\x00\x33\x00\x34\x00\x35\x00\x36\x00\x37\x00\x38\x00\x39\x00\x3a\x00\xff\xff\x3c\x00\x3d\x00\x3e\x00\x3f\x00\x41\x00\x41\x00\x42\x00\x43\x00\x44\x00\x45\x00\x46\x00\x47\x00\x48\x00\x49\x00\x4a\x00\x4b\x00\x4c\x00\x4d\x00\x4e\x00\x4f\x00\x50\x00\x51\x00\x52\x00\x53\x00\x54\x00\x55\x00\x56\x00\x57\x00\x58\x00\x59\x00\x5a\x00\x5b\x00\x5c\x00\x5d\x00\x5e\x00\x5f\x00\x60\x00\x61\x00\x62\x00\x63\x00\x64\x00\x65\x00\x66\x00\x67\x00\x68\x00\x69\x00\x6a\x00\x6b\x00\x6c\x00\x6d\x00\x6e\x00\x6f\x00\x70\x00\x71\x00\x72\x00\x73\x00\x74\x00\x75\x00\x76\x00\x77\x00\x78\x00\x79\x00\x7a\x00\xff\xff\x7c\x00\xff\xff\x7e\x00\x80\x00\x81\x00\x82\x00\x83\x00\x84\x00\x85\x00\x86\x00\x87\x00\x88\x00\x89\x00\x8a\x00\x8b\x00\x8c\x00\x8d\x00\x8e\x00\x8f\x00\x90\x00\x91\x00\x92\x00\x93\x00\x94\x00\x95\x00\x96\x00\x97\x00\x98\x00\x99\x00\x9a\x00\x9b\x00\x9c\x00\x9d\x00\x9e\x00\x9f\x00\xa0\x00\xa1\x00\xa2\x00\xa3\x00\xa4\x00\xa5\x00\xa6\x00\xa7\x00\xa8\x00\xa9\x00\xaa\x00\xab\x00\xac\x00\xad\x00\xae\x00\xaf\x00\xb0\x00\xb1\x00\xb2\x00\xb3\x00\xb4\x00\xb5\x00\xb6\x00\xb7\x00\xb8\x00\xb9\x00\xba\x00\xbb\x00\xbc\x00\xbd\x00\xbe\x00\xbf\x00\xc0\x00\xc1\x00\xc2\x00\xc3\x00\xc4\x00\xc5\x00\xc6\x00\xc7\x00\xc8\x00\xc9\x00\xca\x00\xcb\x00\xcc\x00\xcd\x00\xce\x00\xcf\x00\xd0\x00\xd1\x00\xd2\x00\xd3\x00\xd4\x00\xd5\x00\xd6\x00\xd7\x00\xd8\x00\xd9\x00\xda\x00\xdb\x00\xdc\x00\xdd\x00\xde\x00\xdf\x00\xe0\x00\xe1\x00\xe2\x00\xe3\x00\xe4\x00\xe5\x00\xe6\x00\xe7\x00\xe8\x00\xe9\x00\xea\x00\xeb\x00\xec\x00\xed\x00\xee\x00\xef\x00\xf0\x00\xf1\x00\xf2\x00\xf3\x00\xf4\x00\xf5\x00\xf6\x00\xf7\x00\xf8\x00\xf9\x00\xfa\x00\xfb\x00\xfc\x00\xfd\x00\xfe\x00\xff\x00\x09\x00\x0a\x00\x0b\x00\x0c\x00\x0d\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x20\x00\xff\xff\x21\x00\xff\xff\x23\x00\x24\x00\x25\x00\x26\x00\x27\x00\xff\xff\xff\xff\x2a\x00\x2b\x00\x2c\x00\x2d\x00\x2e\x00\x2f\x00\x30\x00\x31\x00\x32\x00\x33\x00\x34\x00\x35\x00\x36\x00\x37\x00\x38\x00\x39\x00\x3a\x00\xff\xff\x3c\x00\x3d\x00\x3e\x00\x3f\x00\x41\x00\x41\x00\x42\x00\x43\x00\x44\x00\x45\x00\x46\x00\x47\x00\x48\x00\x49\x00\x4a\x00\x4b\x00\x4c\x00\x4d\x00\x4e\x00\x4f\x00\x50\x00\x51\x00\x52\x00\x53\x00\x54\x00\x55\x00\x56\x00\x57\x00\x58\x00\x59\x00\x5a\x00\x5b\x00\x5c\x00\x5d\x00\x5e\x00\x5f\x00\x60\x00\x61\x00\x62\x00\x63\x00\x64\x00\x65\x00\x66\x00\x67\x00\x68\x00\x69\x00\x6a\x00\x6b\x00\x6c\x00\x6d\x00\x6e\x00\x6f\x00\x70\x00\x71\x00\x72\x00\x73\x00\x74\x00\x75\x00\x76\x00\x77\x00\x78\x00\x79\x00\x7a\x00\xff\xff\x7c\x00\xff\xff\x7e\x00\x80\x00\x81\x00\x82\x00\x83\x00\x84\x00\x85\x00\x86\x00\x87\x00\x88\x00\x89\x00\x8a\x00\x8b\x00\x8c\x00\x8d\x00\x8e\x00\x8f\x00\x90\x00\x91\x00\x92\x00\x93\x00\x94\x00\x95\x00\x96\x00\x97\x00\x98\x00\x99\x00\x9a\x00\x9b\x00\x9c\x00\x9d\x00\x9e\x00\x9f\x00\xa0\x00\xa1\x00\xa2\x00\xa3\x00\xa4\x00\xa5\x00\xa6\x00\xa7\x00\xa8\x00\xa9\x00\xaa\x00\xab\x00\xac\x00\xad\x00\xae\x00\xaf\x00\xb0\x00\xb1\x00\xb2\x00\xb3\x00\xb4\x00\xb5\x00\xb6\x00\xb7\x00\xb8\x00\xb9\x00\xba\x00\xbb\x00\xbc\x00\xbd\x00\xbe\x00\xbf\x00\xc0\x00\xc1\x00\xc2\x00\xc3\x00\xc4\x00\xc5\x00\xc6\x00\xc7\x00\xc8\x00\xc9\x00\xca\x00\xcb\x00\xcc\x00\xcd\x00\xce\x00\xcf\x00\xd0\x00\xd1\x00\xd2\x00\xd3\x00\xd4\x00\xd5\x00\xd6\x00\xd7\x00\xd8\x00\xd9\x00\xda\x00\xdb\x00\xdc\x00\xdd\x00\xde\x00\xdf\x00\xe0\x00\xe1\x00\xe2\x00\xe3\x00\xe4\x00\xe5\x00\xe6\x00\xe7\x00\xe8\x00\xe9\x00\xea\x00\xeb\x00\xec\x00\xed\x00\xee\x00\xef\x00\xf0\x00\xf1\x00\xf2\x00\xf3\x00\xf4\x00\xf5\x00\xf6\x00\xf7\x00\xf8\x00\xf9\x00\xfa\x00\xfb\x00\xfc\x00\xfd\x00\xfe\x00\xff\x00\x09\x00\x0a\x00\x0b\x00\x0c\x00\x0d\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x20\x00\xff\xff\x21\x00\xff\xff\x23\x00\x24\x00\x25\x00\x26\x00\x27\x00\xff\xff\xff\xff\x2a\x00\x2b\x00\x2c\x00\x2d\x00\x2e\x00\x2f\x00\x30\x00\x31\x00\x32\x00\x33\x00\x34\x00\x35\x00\x36\x00\x37\x00\x38\x00\x39\x00\x3a\x00\xff\xff\x3c\x00\x3d\x00\x3e\x00\x3f\x00\x41\x00\x41\x00\x42\x00\x43\x00\x44\x00\x45\x00\x46\x00\x47\x00\x48\x00\x49\x00\x4a\x00\x4b\x00\x4c\x00\x4d\x00\x4e\x00\x4f\x00\x50\x00\x51\x00\x52\x00\x53\x00\x54\x00\x55\x00\x56\x00\x57\x00\x58\x00\x59\x00\x5a\x00\x5b\x00\x5c\x00\x5d\x00\x5e\x00\x5f\x00\x60\x00\x61\x00\x62\x00\x63\x00\x64\x00\x65\x00\x66\x00\x67\x00\x68\x00\x69\x00\x6a\x00\x6b\x00\x6c\x00\x6d\x00\x6e\x00\x6f\x00\x70\x00\x71\x00\x72\x00\x73\x00\x74\x00\x75\x00\x76\x00\x77\x00\x78\x00\x79\x00\x7a\x00\xff\xff\x7c\x00\xff\xff\x7e\x00\x80\x00\x81\x00\x82\x00\x83\x00\x84\x00\x85\x00\x86\x00\x87\x00\x88\x00\x89\x00\x8a\x00\x8b\x00\x8c\x00\x8d\x00\x8e\x00\x8f\x00\x90\x00\x91\x00\x92\x00\x93\x00\x94\x00\x95\x00\x96\x00\x97\x00\x98\x00\x99\x00\x9a\x00\x9b\x00\x9c\x00\x9d\x00\x9e\x00\x9f\x00\xa0\x00\xa1\x00\xa2\x00\xa3\x00\xa4\x00\xa5\x00\xa6\x00\xa7\x00\xa8\x00\xa9\x00\xaa\x00\xab\x00\xac\x00\xad\x00\xae\x00\xaf\x00\xb0\x00\xb1\x00\xb2\x00\xb3\x00\xb4\x00\xb5\x00\xb6\x00\xb7\x00\xb8\x00\xb9\x00\xba\x00\xbb\x00\xbc\x00\xbd\x00\xbe\x00\xbf\x00\xc0\x00\xc1\x00\xc2\x00\xc3\x00\xc4\x00\xc5\x00\xc6\x00\xc7\x00\xc8\x00\xc9\x00\xca\x00\xcb\x00\xcc\x00\xcd\x00\xce\x00\xcf\x00\xd0\x00\xd1\x00\xd2\x00\xd3\x00\xd4\x00\xd5\x00\xd6\x00\xd7\x00\xd8\x00\xd9\x00\xda\x00\xdb\x00\xdc\x00\xdd\x00\xde\x00\xdf\x00\xe0\x00\xe1\x00\xe2\x00\xe3\x00\xe4\x00\xe5\x00\xe6\x00\xe7\x00\xe8\x00\xe9\x00\xea\x00\xeb\x00\xec\x00\xed\x00\xee\x00\xef\x00\xf0\x00\xf1\x00\xf2\x00\xf3\x00\xf4\x00\xf5\x00\xf6\x00\xf7\x00\xf8\x00\xf9\x00\xfa\x00\xfb\x00\xfc\x00\xfd\x00\xfe\x00\xff\x00\x09\x00\x0a\x00\x0b\x00\x0c\x00\x0d\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x20\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x55\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x80\x00\x81\x00\x82\x00\x83\x00\x84\x00\x85\x00\x86\x00\x87\x00\x88\x00\x89\x00\x8a\x00\x8b\x00\x8c\x00\x8d\x00\x8e\x00\x8f\x00\x90\x00\x91\x00\x92\x00\x93\x00\x94\x00\x95\x00\x96\x00\x97\x00\x98\x00\x99\x00\x9a\x00\x9b\x00\x9c\x00\x9d\x00\x9e\x00\x9f\x00\xa0\x00\xa1\x00\xa2\x00\xa3\x00\xa4\x00\xa5\x00\xa6\x00\xa7\x00\xa8\x00\xa9\x00\xaa\x00\xab\x00\xac\x00\xad\x00\xae\x00\xaf\x00\xb0\x00\xb1\x00\xb2\x00\xb3\x00\xb4\x00\xb5\x00\xb6\x00\xb7\x00\xb8\x00\xb9\x00\xba\x00\xbb\x00\xbc\x00\xbd\x00\xbe\x00\xbf\x00\xc0\x00\xc1\x00\xc2\x00\xc3\x00\xc4\x00\xc5\x00\xc6\x00\xc7\x00\xc8\x00\xc9\x00\xca\x00\xcb\x00\xcc\x00\xcd\x00\xce\x00\xcf\x00\xd0\x00\xd1\x00\xd2\x00\xd3\x00\xd4\x00\xd5\x00\xd6\x00\xd7\x00\xd8\x00\xd9\x00\xda\x00\xdb\x00\xdc\x00\xdd\x00\xde\x00\xdf\x00\xe0\x00\xe1\x00\xe2\x00\xe3\x00\xe4\x00\xe5\x00\xe6\x00\xe7\x00\xe8\x00\xe9\x00\xea\x00\xeb\x00\xec\x00\xed\x00\xee\x00\xef\x00\xf0\x00\xf1\x00\xf2\x00\xf3\x00\xf4\x00\xf5\x00\xf6\x00\xf7\x00\xf8\x00\xf9\x00\xfa\x00\xfb\x00\xfc\x00\xfd\x00\xfe\x00\xff\x00\x09\x00\x0a\x00\x0b\x00\x0c\x00\x0d\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x20\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x45\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x80\x00\x81\x00\x82\x00\x83\x00\x84\x00\x85\x00\x86\x00\x87\x00\x88\x00\x89\x00\x8a\x00\x8b\x00\x8c\x00\x8d\x00\x8e\x00\x8f\x00\x90\x00\x91\x00\x92\x00\x93\x00\x94\x00\x95\x00\x96\x00\x97\x00\x98\x00\x99\x00\x9a\x00\x9b\x00\x9c\x00\x9d\x00\x9e\x00\x9f\x00\xa0\x00\xa1\x00\xa2\x00\xa3\x00\xa4\x00\xa5\x00\xa6\x00\xa7\x00\xa8\x00\xa9\x00\xaa\x00\xab\x00\xac\x00\xad\x00\xae\x00\xaf\x00\xb0\x00\xb1\x00\xb2\x00\xb3\x00\xb4\x00\xb5\x00\xb6\x00\xb7\x00\xb8\x00\xb9\x00\xba\x00\xbb\x00\xbc\x00\xbd\x00\xbe\x00\xbf\x00\xc0\x00\xc1\x00\xc2\x00\xc3\x00\xc4\x00\xc5\x00\xc6\x00\xc7\x00\xc8\x00\xc9\x00\xca\x00\xcb\x00\xcc\x00\xcd\x00\xce\x00\xcf\x00\xd0\x00\xd1\x00\xd2\x00\xd3\x00\xd4\x00\xd5\x00\xd6\x00\xd7\x00\xd8\x00\xd9\x00\xda\x00\xdb\x00\xdc\x00\xdd\x00\xde\x00\xdf\x00\xe0\x00\xe1\x00\xe2\x00\xe3\x00\xe4\x00\xe5\x00\xe6\x00\xe7\x00\xe8\x00\xe9\x00\xea\x00\xeb\x00\xec\x00\xed\x00\xee\x00\xef\x00\xf0\x00\xf1\x00\xf2\x00\xf3\x00\xf4\x00\xf5\x00\xf6\x00\xf7\x00\xf8\x00\xf9\x00\xfa\x00\xfb\x00\xfc\x00\xfd\x00\xfe\x00\xff\x00\x09\x00\x0a\x00\x0b\x00\x0c\x00\x0d\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x20\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x4d\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x80\x00\x81\x00\x82\x00\x83\x00\x84\x00\x85\x00\x86\x00\x87\x00\x88\x00\x89\x00\x8a\x00\x8b\x00\x8c\x00\x8d\x00\x8e\x00\x8f\x00\x90\x00\x91\x00\x92\x00\x93\x00\x94\x00\x95\x00\x96\x00\x97\x00\x98\x00\x99\x00\x9a\x00\x9b\x00\x9c\x00\x9d\x00\x9e\x00\x9f\x00\xa0\x00\xa1\x00\xa2\x00\xa3\x00\xa4\x00\xa5\x00\xa6\x00\xa7\x00\xa8\x00\xa9\x00\xaa\x00\xab\x00\xac\x00\xad\x00\xae\x00\xaf\x00\xb0\x00\xb1\x00\xb2\x00\xb3\x00\xb4\x00\xb5\x00\xb6\x00\xb7\x00\xb8\x00\xb9\x00\xba\x00\xbb\x00\xbc\x00\xbd\x00\xbe\x00\xbf\x00\xc0\x00\xc1\x00\xc2\x00\xc3\x00\xc4\x00\xc5\x00\xc6\x00\xc7\x00\xc8\x00\xc9\x00\xca\x00\xcb\x00\xcc\x00\xcd\x00\xce\x00\xcf\x00\xd0\x00\xd1\x00\xd2\x00\xd3\x00\xd4\x00\xd5\x00\xd6\x00\xd7\x00\xd8\x00\xd9\x00\xda\x00\xdb\x00\xdc\x00\xdd\x00\xde\x00\xdf\x00\xe0\x00\xe1\x00\xe2\x00\xe3\x00\xe4\x00\xe5\x00\xe6\x00\xe7\x00\xe8\x00\xe9\x00\xea\x00\xeb\x00\xec\x00\xed\x00\xee\x00\xef\x00\xf0\x00\xf1\x00\xf2\x00\xf3\x00\xf4\x00\xf5\x00\xf6\x00\xf7\x00\xf8\x00\xf9\x00\xfa\x00\xfb\x00\xfc\x00\xfd\x00\xfe\x00\xff\x00\x09\x00\x0a\x00\x0b\x00\x0c\x00\x0d\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x20\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x5f\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x80\x00\x81\x00\x82\x00\x83\x00\x84\x00\x85\x00\x86\x00\x87\x00\x88\x00\x89\x00\x8a\x00\x8b\x00\x8c\x00\x8d\x00\x8e\x00\x8f\x00\x90\x00\x91\x00\x92\x00\x93\x00\x94\x00\x95\x00\x96\x00\x97\x00\x98\x00\x99\x00\x9a\x00\x9b\x00\x9c\x00\x9d\x00\x9e\x00\x9f\x00\xa0\x00\xa1\x00\xa2\x00\xa3\x00\xa4\x00\xa5\x00\xa6\x00\xa7\x00\xa8\x00\xa9\x00\xaa\x00\xab\x00\xac\x00\xad\x00\xae\x00\xaf\x00\xb0\x00\xb1\x00\xb2\x00\xb3\x00\xb4\x00\xb5\x00\xb6\x00\xb7\x00\xb8\x00\xb9\x00\xba\x00\xbb\x00\xbc\x00\xbd\x00\xbe\x00\xbf\x00\xc0\x00\xc1\x00\xc2\x00\xc3\x00\xc4\x00\xc5\x00\xc6\x00\xc7\x00\xc8\x00\xc9\x00\xca\x00\xcb\x00\xcc\x00\xcd\x00\xce\x00\xcf\x00\xd0\x00\xd1\x00\xd2\x00\xd3\x00\xd4\x00\xd5\x00\xd6\x00\xd7\x00\xd8\x00\xd9\x00\xda\x00\xdb\x00\xdc\x00\xdd\x00\xde\x00\xdf\x00\xe0\x00\xe1\x00\xe2\x00\xe3\x00\xe4\x00\xe5\x00\xe6\x00\xe7\x00\xe8\x00\xe9\x00\xea\x00\xeb\x00\xec\x00\xed\x00\xee\x00\xef\x00\xf0\x00\xf1\x00\xf2\x00\xf3\x00\xf4\x00\xf5\x00\xf6\x00\xf7\x00\xf8\x00\xf9\x00\xfa\x00\xfb\x00\xfc\x00\xfd\x00\xfe\x00\xff\x00\x09\x00\x0a\x00\x0b\x00\x0c\x00\x0d\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x20\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x45\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x80\x00\x81\x00\x82\x00\x83\x00\x84\x00\x85\x00\x86\x00\x87\x00\x88\x00\x89\x00\x8a\x00\x8b\x00\x8c\x00\x8d\x00\x8e\x00\x8f\x00\x90\x00\x91\x00\x92\x00\x93\x00\x94\x00\x95\x00\x96\x00\x97\x00\x98\x00\x99\x00\x9a\x00\x9b\x00\x9c\x00\x9d\x00\x9e\x00\x9f\x00\xa0\x00\xa1\x00\xa2\x00\xa3\x00\xa4\x00\xa5\x00\xa6\x00\xa7\x00\xa8\x00\xa9\x00\xaa\x00\xab\x00\xac\x00\xad\x00\xae\x00\xaf\x00\xb0\x00\xb1\x00\xb2\x00\xb3\x00\xb4\x00\xb5\x00\xb6\x00\xb7\x00\xb8\x00\xb9\x00\xba\x00\xbb\x00\xbc\x00\xbd\x00\xbe\x00\xbf\x00\xc0\x00\xc1\x00\xc2\x00\xc3\x00\xc4\x00\xc5\x00\xc6\x00\xc7\x00\xc8\x00\xc9\x00\xca\x00\xcb\x00\xcc\x00\xcd\x00\xce\x00\xcf\x00\xd0\x00\xd1\x00\xd2\x00\xd3\x00\xd4\x00\xd5\x00\xd6\x00\xd7\x00\xd8\x00\xd9\x00\xda\x00\xdb\x00\xdc\x00\xdd\x00\xde\x00\xdf\x00\xe0\x00\xe1\x00\xe2\x00\xe3\x00\xe4\x00\xe5\x00\xe6\x00\xe7\x00\xe8\x00\xe9\x00\xea\x00\xeb\x00\xec\x00\xed\x00\xee\x00\xef\x00\xf0\x00\xf1\x00\xf2\x00\xf3\x00\xf4\x00\xf5\x00\xf6\x00\xf7\x00\xf8\x00\xf9\x00\xfa\x00\xfb\x00\xfc\x00\xfd\x00\xfe\x00\xff\x00\x09\x00\x0a\x00\x0b\x00\x0c\x00\x0d\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x20\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x4f\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x80\x00\x81\x00\x82\x00\x83\x00\x84\x00\x85\x00\x86\x00\x87\x00\x88\x00\x89\x00\x8a\x00\x8b\x00\x8c\x00\x8d\x00\x8e\x00\x8f\x00\x90\x00\x91\x00\x92\x00\x93\x00\x94\x00\x95\x00\x96\x00\x97\x00\x98\x00\x99\x00\x9a\x00\x9b\x00\x9c\x00\x9d\x00\x9e\x00\x9f\x00\xa0\x00\xa1\x00\xa2\x00\xa3\x00\xa4\x00\xa5\x00\xa6\x00\xa7\x00\xa8\x00\xa9\x00\xaa\x00\xab\x00\xac\x00\xad\x00\xae\x00\xaf\x00\xb0\x00\xb1\x00\xb2\x00\xb3\x00\xb4\x00\xb5\x00\xb6\x00\xb7\x00\xb8\x00\xb9\x00\xba\x00\xbb\x00\xbc\x00\xbd\x00\xbe\x00\xbf\x00\xc0\x00\xc1\x00\xc2\x00\xc3\x00\xc4\x00\xc5\x00\xc6\x00\xc7\x00\xc8\x00\xc9\x00\xca\x00\xcb\x00\xcc\x00\xcd\x00\xce\x00\xcf\x00\xd0\x00\xd1\x00\xd2\x00\xd3\x00\xd4\x00\xd5\x00\xd6\x00\xd7\x00\xd8\x00\xd9\x00\xda\x00\xdb\x00\xdc\x00\xdd\x00\xde\x00\xdf\x00\xe0\x00\xe1\x00\xe2\x00\xe3\x00\xe4\x00\xe5\x00\xe6\x00\xe7\x00\xe8\x00\xe9\x00\xea\x00\xeb\x00\xec\x00\xed\x00\xee\x00\xef\x00\xf0\x00\xf1\x00\xf2\x00\xf3\x00\xf4\x00\xf5\x00\xf6\x00\xf7\x00\xf8\x00\xf9\x00\xfa\x00\xfb\x00\xfc\x00\xfd\x00\xfe\x00\xff\x00\x09\x00\x0a\x00\x0b\x00\x0c\x00\x0d\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x20\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x49\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x80\x00\x81\x00\x82\x00\x83\x00\x84\x00\x85\x00\x86\x00\x87\x00\x88\x00\x89\x00\x8a\x00\x8b\x00\x8c\x00\x8d\x00\x8e\x00\x8f\x00\x90\x00\x91\x00\x92\x00\x93\x00\x94\x00\x95\x00\x96\x00\x97\x00\x98\x00\x99\x00\x9a\x00\x9b\x00\x9c\x00\x9d\x00\x9e\x00\x9f\x00\xa0\x00\xa1\x00\xa2\x00\xa3\x00\xa4\x00\xa5\x00\xa6\x00\xa7\x00\xa8\x00\xa9\x00\xaa\x00\xab\x00\xac\x00\xad\x00\xae\x00\xaf\x00\xb0\x00\xb1\x00\xb2\x00\xb3\x00\xb4\x00\xb5\x00\xb6\x00\xb7\x00\xb8\x00\xb9\x00\xba\x00\xbb\x00\xbc\x00\xbd\x00\xbe\x00\xbf\x00\xc0\x00\xc1\x00\xc2\x00\xc3\x00\xc4\x00\xc5\x00\xc6\x00\xc7\x00\xc8\x00\xc9\x00\xca\x00\xcb\x00\xcc\x00\xcd\x00\xce\x00\xcf\x00\xd0\x00\xd1\x00\xd2\x00\xd3\x00\xd4\x00\xd5\x00\xd6\x00\xd7\x00\xd8\x00\xd9\x00\xda\x00\xdb\x00\xdc\x00\xdd\x00\xde\x00\xdf\x00\xe0\x00\xe1\x00\xe2\x00\xe3\x00\xe4\x00\xe5\x00\xe6\x00\xe7\x00\xe8\x00\xe9\x00\xea\x00\xeb\x00\xec\x00\xed\x00\xee\x00\xef\x00\xf0\x00\xf1\x00\xf2\x00\xf3\x00\xf4\x00\xf5\x00\xf6\x00\xf7\x00\xf8\x00\xf9\x00\xfa\x00\xfb\x00\xfc\x00\xfd\x00\xfe\x00\xff\x00\x09\x00\x0a\x00\x0b\x00\x0c\x00\x0d\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x20\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x49\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x80\x00\x81\x00\x82\x00\x83\x00\x84\x00\x85\x00\x86\x00\x87\x00\x88\x00\x89\x00\x8a\x00\x8b\x00\x8c\x00\x8d\x00\x8e\x00\x8f\x00\x90\x00\x91\x00\x92\x00\x93\x00\x94\x00\x95\x00\x96\x00\x97\x00\x98\x00\x99\x00\x9a\x00\x9b\x00\x9c\x00\x9d\x00\x9e\x00\x9f\x00\xa0\x00\xa1\x00\xa2\x00\xa3\x00\xa4\x00\xa5\x00\xa6\x00\xa7\x00\xa8\x00\xa9\x00\xaa\x00\xab\x00\xac\x00\xad\x00\xae\x00\xaf\x00\xb0\x00\xb1\x00\xb2\x00\xb3\x00\xb4\x00\xb5\x00\xb6\x00\xb7\x00\xb8\x00\xb9\x00\xba\x00\xbb\x00\xbc\x00\xbd\x00\xbe\x00\xbf\x00\xc0\x00\xc1\x00\xc2\x00\xc3\x00\xc4\x00\xc5\x00\xc6\x00\xc7\x00\xc8\x00\xc9\x00\xca\x00\xcb\x00\xcc\x00\xcd\x00\xce\x00\xcf\x00\xd0\x00\xd1\x00\xd2\x00\xd3\x00\xd4\x00\xd5\x00\xd6\x00\xd7\x00\xd8\x00\xd9\x00\xda\x00\xdb\x00\xdc\x00\xdd\x00\xde\x00\xdf\x00\xe0\x00\xe1\x00\xe2\x00\xe3\x00\xe4\x00\xe5\x00\xe6\x00\xe7\x00\xe8\x00\xe9\x00\xea\x00\xeb\x00\xec\x00\xed\x00\xee\x00\xef\x00\xf0\x00\xf1\x00\xf2\x00\xf3\x00\xf4\x00\xf5\x00\xf6\x00\xf7\x00\xf8\x00\xf9\x00\xfa\x00\xfb\x00\xfc\x00\xfd\x00\xfe\x00\xff\x00\x09\x00\x0a\x00\x0b\x00\x0c\x00\x0d\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x20\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x4f\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x80\x00\x81\x00\x82\x00\x83\x00\x84\x00\x85\x00\x86\x00\x87\x00\x88\x00\x89\x00\x8a\x00\x8b\x00\x8c\x00\x8d\x00\x8e\x00\x8f\x00\x90\x00\x91\x00\x92\x00\x93\x00\x94\x00\x95\x00\x96\x00\x97\x00\x98\x00\x99\x00\x9a\x00\x9b\x00\x9c\x00\x9d\x00\x9e\x00\x9f\x00\xa0\x00\xa1\x00\xa2\x00\xa3\x00\xa4\x00\xa5\x00\xa6\x00\xa7\x00\xa8\x00\xa9\x00\xaa\x00\xab\x00\xac\x00\xad\x00\xae\x00\xaf\x00\xb0\x00\xb1\x00\xb2\x00\xb3\x00\xb4\x00\xb5\x00\xb6\x00\xb7\x00\xb8\x00\xb9\x00\xba\x00\xbb\x00\xbc\x00\xbd\x00\xbe\x00\xbf\x00\xc0\x00\xc1\x00\xc2\x00\xc3\x00\xc4\x00\xc5\x00\xc6\x00\xc7\x00\xc8\x00\xc9\x00\xca\x00\xcb\x00\xcc\x00\xcd\x00\xce\x00\xcf\x00\xd0\x00\xd1\x00\xd2\x00\xd3\x00\xd4\x00\xd5\x00\xd6\x00\xd7\x00\xd8\x00\xd9\x00\xda\x00\xdb\x00\xdc\x00\xdd\x00\xde\x00\xdf\x00\xe0\x00\xe1\x00\xe2\x00\xe3\x00\xe4\x00\xe5\x00\xe6\x00\xe7\x00\xe8\x00\xe9\x00\xea\x00\xeb\x00\xec\x00\xed\x00\xee\x00\xef\x00\xf0\x00\xf1\x00\xf2\x00\xf3\x00\xf4\x00\xf5\x00\xf6\x00\xf7\x00\xf8\x00\xf9\x00\xfa\x00\xfb\x00\xfc\x00\xfd\x00\xfe\x00\xff\x00\x09\x00\x0a\x00\x0b\x00\x0c\x00\x0d\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x20\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x4d\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x80\x00\x81\x00\x82\x00\x83\x00\x84\x00\x85\x00\x86\x00\x87\x00\x88\x00\x89\x00\x8a\x00\x8b\x00\x8c\x00\x8d\x00\x8e\x00\x8f\x00\x90\x00\x91\x00\x92\x00\x93\x00\x94\x00\x95\x00\x96\x00\x97\x00\x98\x00\x99\x00\x9a\x00\x9b\x00\x9c\x00\x9d\x00\x9e\x00\x9f\x00\xa0\x00\xa1\x00\xa2\x00\xa3\x00\xa4\x00\xa5\x00\xa6\x00\xa7\x00\xa8\x00\xa9\x00\xaa\x00\xab\x00\xac\x00\xad\x00\xae\x00\xaf\x00\xb0\x00\xb1\x00\xb2\x00\xb3\x00\xb4\x00\xb5\x00\xb6\x00\xb7\x00\xb8\x00\xb9\x00\xba\x00\xbb\x00\xbc\x00\xbd\x00\xbe\x00\xbf\x00\xc0\x00\xc1\x00\xc2\x00\xc3\x00\xc4\x00\xc5\x00\xc6\x00\xc7\x00\xc8\x00\xc9\x00\xca\x00\xcb\x00\xcc\x00\xcd\x00\xce\x00\xcf\x00\xd0\x00\xd1\x00\xd2\x00\xd3\x00\xd4\x00\xd5\x00\xd6\x00\xd7\x00\xd8\x00\xd9\x00\xda\x00\xdb\x00\xdc\x00\xdd\x00\xde\x00\xdf\x00\xe0\x00\xe1\x00\xe2\x00\xe3\x00\xe4\x00\xe5\x00\xe6\x00\xe7\x00\xe8\x00\xe9\x00\xea\x00\xeb\x00\xec\x00\xed\x00\xee\x00\xef\x00\xf0\x00\xf1\x00\xf2\x00\xf3\x00\xf4\x00\xf5\x00\xf6\x00\xf7\x00\xf8\x00\xf9\x00\xfa\x00\xfb\x00\xfc\x00\xfd\x00\xfe\x00\xff\x00\x09\x00\x0a\x00\x0b\x00\x0c\x00\x0d\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x20\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x4d\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x80\x00\x81\x00\x82\x00\x83\x00\x84\x00\x85\x00\x86\x00\x87\x00\x88\x00\x89\x00\x8a\x00\x8b\x00\x8c\x00\x8d\x00\x8e\x00\x8f\x00\x90\x00\x91\x00\x92\x00\x93\x00\x94\x00\x95\x00\x96\x00\x97\x00\x98\x00\x99\x00\x9a\x00\x9b\x00\x9c\x00\x9d\x00\x9e\x00\x9f\x00\xa0\x00\xa1\x00\xa2\x00\xa3\x00\xa4\x00\xa5\x00\xa6\x00\xa7\x00\xa8\x00\xa9\x00\xaa\x00\xab\x00\xac\x00\xad\x00\xae\x00\xaf\x00\xb0\x00\xb1\x00\xb2\x00\xb3\x00\xb4\x00\xb5\x00\xb6\x00\xb7\x00\xb8\x00\xb9\x00\xba\x00\xbb\x00\xbc\x00\xbd\x00\xbe\x00\xbf\x00\xc0\x00\xc1\x00\xc2\x00\xc3\x00\xc4\x00\xc5\x00\xc6\x00\xc7\x00\xc8\x00\xc9\x00\xca\x00\xcb\x00\xcc\x00\xcd\x00\xce\x00\xcf\x00\xd0\x00\xd1\x00\xd2\x00\xd3\x00\xd4\x00\xd5\x00\xd6\x00\xd7\x00\xd8\x00\xd9\x00\xda\x00\xdb\x00\xdc\x00\xdd\x00\xde\x00\xdf\x00\xe0\x00\xe1\x00\xe2\x00\xe3\x00\xe4\x00\xe5\x00\xe6\x00\xe7\x00\xe8\x00\xe9\x00\xea\x00\xeb\x00\xec\x00\xed\x00\xee\x00\xef\x00\xf0\x00\xf1\x00\xf2\x00\xf3\x00\xf4\x00\xf5\x00\xf6\x00\xf7\x00\xf8\x00\xf9\x00\xfa\x00\xfb\x00\xfc\x00\xfd\x00\xfe\x00\xff\x00\x09\x00\x0a\x00\x0b\x00\x0c\x00\x0d\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x20\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x49\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x80\x00\x81\x00\x82\x00\x83\x00\x84\x00\x85\x00\x86\x00\x87\x00\x88\x00\x89\x00\x8a\x00\x8b\x00\x8c\x00\x8d\x00\x8e\x00\x8f\x00\x90\x00\x91\x00\x92\x00\x93\x00\x94\x00\x95\x00\x96\x00\x97\x00\x98\x00\x99\x00\x9a\x00\x9b\x00\x9c\x00\x9d\x00\x9e\x00\x9f\x00\xa0\x00\xa1\x00\xa2\x00\xa3\x00\xa4\x00\xa5\x00\xa6\x00\xa7\x00\xa8\x00\xa9\x00\xaa\x00\xab\x00\xac\x00\xad\x00\xae\x00\xaf\x00\xb0\x00\xb1\x00\xb2\x00\xb3\x00\xb4\x00\xb5\x00\xb6\x00\xb7\x00\xb8\x00\xb9\x00\xba\x00\xbb\x00\xbc\x00\xbd\x00\xbe\x00\xbf\x00\xc0\x00\xc1\x00\xc2\x00\xc3\x00\xc4\x00\xc5\x00\xc6\x00\xc7\x00\xc8\x00\xc9\x00\xca\x00\xcb\x00\xcc\x00\xcd\x00\xce\x00\xcf\x00\xd0\x00\xd1\x00\xd2\x00\xd3\x00\xd4\x00\xd5\x00\xd6\x00\xd7\x00\xd8\x00\xd9\x00\xda\x00\xdb\x00\xdc\x00\xdd\x00\xde\x00\xdf\x00\xe0\x00\xe1\x00\xe2\x00\xe3\x00\xe4\x00\xe5\x00\xe6\x00\xe7\x00\xe8\x00\xe9\x00\xea\x00\xeb\x00\xec\x00\xed\x00\xee\x00\xef\x00\xf0\x00\xf1\x00\xf2\x00\xf3\x00\xf4\x00\xf5\x00\xf6\x00\xf7\x00\xf8\x00\xf9\x00\xfa\x00\xfb\x00\xfc\x00\xfd\x00\xfe\x00\xff\x00\x09\x00\x0a\x00\x0b\x00\x0c\x00\x0d\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x20\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x45\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x80\x00\x81\x00\x82\x00\x83\x00\x84\x00\x85\x00\x86\x00\x87\x00\x88\x00\x89\x00\x8a\x00\x8b\x00\x8c\x00\x8d\x00\x8e\x00\x8f\x00\x90\x00\x91\x00\x92\x00\x93\x00\x94\x00\x95\x00\x96\x00\x97\x00\x98\x00\x99\x00\x9a\x00\x9b\x00\x9c\x00\x9d\x00\x9e\x00\x9f\x00\xa0\x00\xa1\x00\xa2\x00\xa3\x00\xa4\x00\xa5\x00\xa6\x00\xa7\x00\xa8\x00\xa9\x00\xaa\x00\xab\x00\xac\x00\xad\x00\xae\x00\xaf\x00\xb0\x00\xb1\x00\xb2\x00\xb3\x00\xb4\x00\xb5\x00\xb6\x00\xb7\x00\xb8\x00\xb9\x00\xba\x00\xbb\x00\xbc\x00\xbd\x00\xbe\x00\xbf\x00\xc0\x00\xc1\x00\xc2\x00\xc3\x00\xc4\x00\xc5\x00\xc6\x00\xc7\x00\xc8\x00\xc9\x00\xca\x00\xcb\x00\xcc\x00\xcd\x00\xce\x00\xcf\x00\xd0\x00\xd1\x00\xd2\x00\xd3\x00\xd4\x00\xd5\x00\xd6\x00\xd7\x00\xd8\x00\xd9\x00\xda\x00\xdb\x00\xdc\x00\xdd\x00\xde\x00\xdf\x00\xe0\x00\xe1\x00\xe2\x00\xe3\x00\xe4\x00\xe5\x00\xe6\x00\xe7\x00\xe8\x00\xe9\x00\xea\x00\xeb\x00\xec\x00\xed\x00\xee\x00\xef\x00\xf0\x00\xf1\x00\xf2\x00\xf3\x00\xf4\x00\xf5\x00\xf6\x00\xf7\x00\xf8\x00\xf9\x00\xfa\x00\xfb\x00\xfc\x00\xfd\x00\xfe\x00\xff\x00\x09\x00\x0a\x00\x0b\x00\x0c\x00\x0d\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x20\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x45\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x80\x00\x81\x00\x82\x00\x83\x00\x84\x00\x85\x00\x86\x00\x87\x00\x88\x00\x89\x00\x8a\x00\x8b\x00\x8c\x00\x8d\x00\x8e\x00\x8f\x00\x90\x00\x91\x00\x92\x00\x93\x00\x94\x00\x95\x00\x96\x00\x97\x00\x98\x00\x99\x00\x9a\x00\x9b\x00\x9c\x00\x9d\x00\x9e\x00\x9f\x00\xa0\x00\xa1\x00\xa2\x00\xa3\x00\xa4\x00\xa5\x00\xa6\x00\xa7\x00\xa8\x00\xa9\x00\xaa\x00\xab\x00\xac\x00\xad\x00\xae\x00\xaf\x00\xb0\x00\xb1\x00\xb2\x00\xb3\x00\xb4\x00\xb5\x00\xb6\x00\xb7\x00\xb8\x00\xb9\x00\xba\x00\xbb\x00\xbc\x00\xbd\x00\xbe\x00\xbf\x00\xc0\x00\xc1\x00\xc2\x00\xc3\x00\xc4\x00\xc5\x00\xc6\x00\xc7\x00\xc8\x00\xc9\x00\xca\x00\xcb\x00\xcc\x00\xcd\x00\xce\x00\xcf\x00\xd0\x00\xd1\x00\xd2\x00\xd3\x00\xd4\x00\xd5\x00\xd6\x00\xd7\x00\xd8\x00\xd9\x00\xda\x00\xdb\x00\xdc\x00\xdd\x00\xde\x00\xdf\x00\xe0\x00\xe1\x00\xe2\x00\xe3\x00\xe4\x00\xe5\x00\xe6\x00\xe7\x00\xe8\x00\xe9\x00\xea\x00\xeb\x00\xec\x00\xed\x00\xee\x00\xef\x00\xf0\x00\xf1\x00\xf2\x00\xf3\x00\xf4\x00\xf5\x00\xf6\x00\xf7\x00\xf8\x00\xf9\x00\xfa\x00\xfb\x00\xfc\x00\xfd\x00\xfe\x00\xff\x00\x09\x00\x0a\x00\x0b\x00\x0c\x00\x0d\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x20\x00\xff\xff\x21\x00\xff\xff\x23\x00\x24\x00\x25\x00\x26\x00\x27\x00\xff\xff\xff\xff\x2a\x00\x2b\x00\x2c\x00\x2d\x00\x2e\x00\x2f\x00\x30\x00\x31\x00\x32\x00\x33\x00\x34\x00\x35\x00\x36\x00\x37\x00\x38\x00\x39\x00\x3a\x00\xff\xff\x3c\x00\x3d\x00\x3e\x00\x3f\x00\x41\x00\x41\x00\x42\x00\x43\x00\x44\x00\x45\x00\x46\x00\x47\x00\x48\x00\x49\x00\x4a\x00\x4b\x00\x4c\x00\x4d\x00\x4e\x00\x4f\x00\x50\x00\x51\x00\x52\x00\x53\x00\x54\x00\x55\x00\x56\x00\x57\x00\x58\x00\x59\x00\x5a\x00\x5b\x00\x5c\x00\x5d\x00\x5e\x00\x5f\x00\x60\x00\x61\x00\x62\x00\x63\x00\x64\x00\x65\x00\x66\x00\x67\x00\x68\x00\x69\x00\x6a\x00\x6b\x00\x6c\x00\x6d\x00\x6e\x00\x6f\x00\x70\x00\x71\x00\x72\x00\x73\x00\x74\x00\x75\x00\x76\x00\x77\x00\x78\x00\x79\x00\x7a\x00\xff\xff\x7c\x00\xff\xff\x7e\x00\x80\x00\x81\x00\x82\x00\x83\x00\x84\x00\x85\x00\x86\x00\x87\x00\x88\x00\x89\x00\x8a\x00\x8b\x00\x8c\x00\x8d\x00\x8e\x00\x8f\x00\x90\x00\x91\x00\x92\x00\x93\x00\x94\x00\x95\x00\x96\x00\x97\x00\x98\x00\x99\x00\x9a\x00\x9b\x00\x9c\x00\x9d\x00\x9e\x00\x9f\x00\xa0\x00\xa1\x00\xa2\x00\xa3\x00\xa4\x00\xa5\x00\xa6\x00\xa7\x00\xa8\x00\xa9\x00\xaa\x00\xab\x00\xac\x00\xad\x00\xae\x00\xaf\x00\xb0\x00\xb1\x00\xb2\x00\xb3\x00\xb4\x00\xb5\x00\xb6\x00\xb7\x00\xb8\x00\xb9\x00\xba\x00\xbb\x00\xbc\x00\xbd\x00\xbe\x00\xbf\x00\xc0\x00\xc1\x00\xc2\x00\xc3\x00\xc4\x00\xc5\x00\xc6\x00\xc7\x00\xc8\x00\xc9\x00\xca\x00\xcb\x00\xcc\x00\xcd\x00\xce\x00\xcf\x00\xd0\x00\xd1\x00\xd2\x00\xd3\x00\xd4\x00\xd5\x00\xd6\x00\xd7\x00\xd8\x00\xd9\x00\xda\x00\xdb\x00\xdc\x00\xdd\x00\xde\x00\xdf\x00\xe0\x00\xe1\x00\xe2\x00\xe3\x00\xe4\x00\xe5\x00\xe6\x00\xe7\x00\xe8\x00\xe9\x00\xea\x00\xeb\x00\xec\x00\xed\x00\xee\x00\xef\x00\xf0\x00\xf1\x00\xf2\x00\xf3\x00\xf4\x00\xf5\x00\xf6\x00\xf7\x00\xf8\x00\xf9\x00\xfa\x00\xfb\x00\xfc\x00\xfd\x00\xfe\x00\xff\x00\x09\x00\x0a\x00\x0b\x00\x0c\x00\x0d\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x20\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x5f\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x80\x00\x81\x00\x82\x00\x83\x00\x84\x00\x85\x00\x86\x00\x87\x00\x88\x00\x89\x00\x8a\x00\x8b\x00\x8c\x00\x8d\x00\x8e\x00\x8f\x00\x90\x00\x91\x00\x92\x00\x93\x00\x94\x00\x95\x00\x96\x00\x97\x00\x98\x00\x99\x00\x9a\x00\x9b\x00\x9c\x00\x9d\x00\x9e\x00\x9f\x00\xa0\x00\xa1\x00\xa2\x00\xa3\x00\xa4\x00\xa5\x00\xa6\x00\xa7\x00\xa8\x00\xa9\x00\xaa\x00\xab\x00\xac\x00\xad\x00\xae\x00\xaf\x00\xb0\x00\xb1\x00\xb2\x00\xb3\x00\xb4\x00\xb5\x00\xb6\x00\xb7\x00\xb8\x00\xb9\x00\xba\x00\xbb\x00\xbc\x00\xbd\x00\xbe\x00\xbf\x00\xc0\x00\xc1\x00\xc2\x00\xc3\x00\xc4\x00\xc5\x00\xc6\x00\xc7\x00\xc8\x00\xc9\x00\xca\x00\xcb\x00\xcc\x00\xcd\x00\xce\x00\xcf\x00\xd0\x00\xd1\x00\xd2\x00\xd3\x00\xd4\x00\xd5\x00\xd6\x00\xd7\x00\xd8\x00\xd9\x00\xda\x00\xdb\x00\xdc\x00\xdd\x00\xde\x00\xdf\x00\xe0\x00\xe1\x00\xe2\x00\xe3\x00\xe4\x00\xe5\x00\xe6\x00\xe7\x00\xe8\x00\xe9\x00\xea\x00\xeb\x00\xec\x00\xed\x00\xee\x00\xef\x00\xf0\x00\xf1\x00\xf2\x00\xf3\x00\xf4\x00\xf5\x00\xf6\x00\xf7\x00\xf8\x00\xf9\x00\xfa\x00\xfb\x00\xfc\x00\xfd\x00\xfe\x00\xff\x00\x09\x00\x0a\x00\x0b\x00\x0c\x00\x0d\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x20\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x49\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x80\x00\x81\x00\x82\x00\x83\x00\x84\x00\x85\x00\x86\x00\x87\x00\x88\x00\x89\x00\x8a\x00\x8b\x00\x8c\x00\x8d\x00\x8e\x00\x8f\x00\x90\x00\x91\x00\x92\x00\x93\x00\x94\x00\x95\x00\x96\x00\x97\x00\x98\x00\x99\x00\x9a\x00\x9b\x00\x9c\x00\x9d\x00\x9e\x00\x9f\x00\xa0\x00\xa1\x00\xa2\x00\xa3\x00\xa4\x00\xa5\x00\xa6\x00\xa7\x00\xa8\x00\xa9\x00\xaa\x00\xab\x00\xac\x00\xad\x00\xae\x00\xaf\x00\xb0\x00\xb1\x00\xb2\x00\xb3\x00\xb4\x00\xb5\x00\xb6\x00\xb7\x00\xb8\x00\xb9\x00\xba\x00\xbb\x00\xbc\x00\xbd\x00\xbe\x00\xbf\x00\xc0\x00\xc1\x00\xc2\x00\xc3\x00\xc4\x00\xc5\x00\xc6\x00\xc7\x00\xc8\x00\xc9\x00\xca\x00\xcb\x00\xcc\x00\xcd\x00\xce\x00\xcf\x00\xd0\x00\xd1\x00\xd2\x00\xd3\x00\xd4\x00\xd5\x00\xd6\x00\xd7\x00\xd8\x00\xd9\x00\xda\x00\xdb\x00\xdc\x00\xdd\x00\xde\x00\xdf\x00\xe0\x00\xe1\x00\xe2\x00\xe3\x00\xe4\x00\xe5\x00\xe6\x00\xe7\x00\xe8\x00\xe9\x00\xea\x00\xeb\x00\xec\x00\xed\x00\xee\x00\xef\x00\xf0\x00\xf1\x00\xf2\x00\xf3\x00\xf4\x00\xf5\x00\xf6\x00\xf7\x00\xf8\x00\xf9\x00\xfa\x00\xfb\x00\xfc\x00\xfd\x00\xfe\x00\xff\x00\x09\x00\x0a\x00\x0b\x00\x0c\x00\x0d\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x20\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x4d\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x80\x00\x81\x00\x82\x00\x83\x00\x84\x00\x85\x00\x86\x00\x87\x00\x88\x00\x89\x00\x8a\x00\x8b\x00\x8c\x00\x8d\x00\x8e\x00\x8f\x00\x90\x00\x91\x00\x92\x00\x93\x00\x94\x00\x95\x00\x96\x00\x97\x00\x98\x00\x99\x00\x9a\x00\x9b\x00\x9c\x00\x9d\x00\x9e\x00\x9f\x00\xa0\x00\xa1\x00\xa2\x00\xa3\x00\xa4\x00\xa5\x00\xa6\x00\xa7\x00\xa8\x00\xa9\x00\xaa\x00\xab\x00\xac\x00\xad\x00\xae\x00\xaf\x00\xb0\x00\xb1\x00\xb2\x00\xb3\x00\xb4\x00\xb5\x00\xb6\x00\xb7\x00\xb8\x00\xb9\x00\xba\x00\xbb\x00\xbc\x00\xbd\x00\xbe\x00\xbf\x00\xc0\x00\xc1\x00\xc2\x00\xc3\x00\xc4\x00\xc5\x00\xc6\x00\xc7\x00\xc8\x00\xc9\x00\xca\x00\xcb\x00\xcc\x00\xcd\x00\xce\x00\xcf\x00\xd0\x00\xd1\x00\xd2\x00\xd3\x00\xd4\x00\xd5\x00\xd6\x00\xd7\x00\xd8\x00\xd9\x00\xda\x00\xdb\x00\xdc\x00\xdd\x00\xde\x00\xdf\x00\xe0\x00\xe1\x00\xe2\x00\xe3\x00\xe4\x00\xe5\x00\xe6\x00\xe7\x00\xe8\x00\xe9\x00\xea\x00\xeb\x00\xec\x00\xed\x00\xee\x00\xef\x00\xf0\x00\xf1\x00\xf2\x00\xf3\x00\xf4\x00\xf5\x00\xf6\x00\xf7\x00\xf8\x00\xf9\x00\xfa\x00\xfb\x00\xfc\x00\xfd\x00\xfe\x00\xff\x00\x09\x00\x0a\x00\x0b\x00\x0c\x00\x0d\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x20\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x4f\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x80\x00\x81\x00\x82\x00\x83\x00\x84\x00\x85\x00\x86\x00\x87\x00\x88\x00\x89\x00\x8a\x00\x8b\x00\x8c\x00\x8d\x00\x8e\x00\x8f\x00\x90\x00\x91\x00\x92\x00\x93\x00\x94\x00\x95\x00\x96\x00\x97\x00\x98\x00\x99\x00\x9a\x00\x9b\x00\x9c\x00\x9d\x00\x9e\x00\x9f\x00\xa0\x00\xa1\x00\xa2\x00\xa3\x00\xa4\x00\xa5\x00\xa6\x00\xa7\x00\xa8\x00\xa9\x00\xaa\x00\xab\x00\xac\x00\xad\x00\xae\x00\xaf\x00\xb0\x00\xb1\x00\xb2\x00\xb3\x00\xb4\x00\xb5\x00\xb6\x00\xb7\x00\xb8\x00\xb9\x00\xba\x00\xbb\x00\xbc\x00\xbd\x00\xbe\x00\xbf\x00\xc0\x00\xc1\x00\xc2\x00\xc3\x00\xc4\x00\xc5\x00\xc6\x00\xc7\x00\xc8\x00\xc9\x00\xca\x00\xcb\x00\xcc\x00\xcd\x00\xce\x00\xcf\x00\xd0\x00\xd1\x00\xd2\x00\xd3\x00\xd4\x00\xd5\x00\xd6\x00\xd7\x00\xd8\x00\xd9\x00\xda\x00\xdb\x00\xdc\x00\xdd\x00\xde\x00\xdf\x00\xe0\x00\xe1\x00\xe2\x00\xe3\x00\xe4\x00\xe5\x00\xe6\x00\xe7\x00\xe8\x00\xe9\x00\xea\x00\xeb\x00\xec\x00\xed\x00\xee\x00\xef\x00\xf0\x00\xf1\x00\xf2\x00\xf3\x00\xf4\x00\xf5\x00\xf6\x00\xf7\x00\xf8\x00\xf9\x00\xfa\x00\xfb\x00\xfc\x00\xfd\x00\xfe\x00\xff\x00\x09\x00\x0a\x00\x0b\x00\x0c\x00\x0d\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x20\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x45\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x80\x00\x81\x00\x82\x00\x83\x00\x84\x00\x85\x00\x86\x00\x87\x00\x88\x00\x89\x00\x8a\x00\x8b\x00\x8c\x00\x8d\x00\x8e\x00\x8f\x00\x90\x00\x91\x00\x92\x00\x93\x00\x94\x00\x95\x00\x96\x00\x97\x00\x98\x00\x99\x00\x9a\x00\x9b\x00\x9c\x00\x9d\x00\x9e\x00\x9f\x00\xa0\x00\xa1\x00\xa2\x00\xa3\x00\xa4\x00\xa5\x00\xa6\x00\xa7\x00\xa8\x00\xa9\x00\xaa\x00\xab\x00\xac\x00\xad\x00\xae\x00\xaf\x00\xb0\x00\xb1\x00\xb2\x00\xb3\x00\xb4\x00\xb5\x00\xb6\x00\xb7\x00\xb8\x00\xb9\x00\xba\x00\xbb\x00\xbc\x00\xbd\x00\xbe\x00\xbf\x00\xc0\x00\xc1\x00\xc2\x00\xc3\x00\xc4\x00\xc5\x00\xc6\x00\xc7\x00\xc8\x00\xc9\x00\xca\x00\xcb\x00\xcc\x00\xcd\x00\xce\x00\xcf\x00\xd0\x00\xd1\x00\xd2\x00\xd3\x00\xd4\x00\xd5\x00\xd6\x00\xd7\x00\xd8\x00\xd9\x00\xda\x00\xdb\x00\xdc\x00\xdd\x00\xde\x00\xdf\x00\xe0\x00\xe1\x00\xe2\x00\xe3\x00\xe4\x00\xe5\x00\xe6\x00\xe7\x00\xe8\x00\xe9\x00\xea\x00\xeb\x00\xec\x00\xed\x00\xee\x00\xef\x00\xf0\x00\xf1\x00\xf2\x00\xf3\x00\xf4\x00\xf5\x00\xf6\x00\xf7\x00\xf8\x00\xf9\x00\xfa\x00\xfb\x00\xfc\x00\xfd\x00\xfe\x00\xff\x00\x09\x00\x0a\x00\x0b\x00\x0c\x00\x0d\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x21\x00\xff\xff\x23\x00\x24\x00\x25\x00\x26\x00\x27\x00\xff\xff\x20\x00\x2a\x00\x2b\x00\x2c\x00\x2d\x00\x2e\x00\x2f\x00\x30\x00\x31\x00\x32\x00\x33\x00\x34\x00\x35\x00\x36\x00\x37\x00\x38\x00\x39\x00\x3a\x00\xff\xff\x3c\x00\x3d\x00\x3e\x00\x3f\x00\xff\xff\x41\x00\x42\x00\x43\x00\x44\x00\x45\x00\x46\x00\x47\x00\x48\x00\x49\x00\x4a\x00\x4b\x00\x4c\x00\x4d\x00\x4e\x00\x4f\x00\x50\x00\x51\x00\x52\x00\x53\x00\x54\x00\x55\x00\x56\x00\x57\x00\x58\x00\x59\x00\x5a\x00\x5b\x00\x5c\x00\x5d\x00\x5e\x00\x5f\x00\x60\x00\x61\x00\x62\x00\x63\x00\x64\x00\x65\x00\x66\x00\x67\x00\x68\x00\x69\x00\x6a\x00\x6b\x00\x6c\x00\x6d\x00\x6e\x00\x6f\x00\x70\x00\x71\x00\x72\x00\x73\x00\x74\x00\x75\x00\x76\x00\x77\x00\x78\x00\x79\x00\x7a\x00\xff\xff\x7c\x00\xff\xff\x7e\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x80\x00\x81\x00\x82\x00\x83\x00\x84\x00\x85\x00\x86\x00\x87\x00\x88\x00\x89\x00\x8a\x00\x8b\x00\x8c\x00\x8d\x00\x8e\x00\x8f\x00\x90\x00\x91\x00\x92\x00\x93\x00\x94\x00\x95\x00\x96\x00\x97\x00\x98\x00\x99\x00\x9a\x00\x9b\x00\x9c\x00\x9d\x00\x9e\x00\x9f\x00\xa0\x00\xa1\x00\xa2\x00\xa3\x00\xa4\x00\xa5\x00\xa6\x00\xa7\x00\xa8\x00\xa9\x00\xaa\x00\xab\x00\xac\x00\xad\x00\xae\x00\xaf\x00\xb0\x00\xb1\x00\xb2\x00\xb3\x00\xb4\x00\xb5\x00\xb6\x00\xb7\x00\xb8\x00\xb9\x00\xba\x00\xbb\x00\xbc\x00\xbd\x00\xbe\x00\xbf\x00\xc0\x00\xc1\x00\xc2\x00\xc3\x00\xc4\x00\xc5\x00\xc6\x00\xc7\x00\xc8\x00\xc9\x00\xca\x00\xcb\x00\xcc\x00\xcd\x00\xce\x00\xcf\x00\xd0\x00\xd1\x00\xd2\x00\xd3\x00\xd4\x00\xd5\x00\xd6\x00\xd7\x00\xd8\x00\xd9\x00\xda\x00\xdb\x00\xdc\x00\xdd\x00\xde\x00\xdf\x00\xe0\x00\xe1\x00\xe2\x00\xe3\x00\xe4\x00\xe5\x00\xe6\x00\xe7\x00\xe8\x00\xe9\x00\xea\x00\xeb\x00\xec\x00\xed\x00\xee\x00\xef\x00\xf0\x00\xf1\x00\xf2\x00\xf3\x00\xf4\x00\xf5\x00\xf6\x00\xf7\x00\xf8\x00\xf9\x00\xfa\x00\xfb\x00\xfc\x00\xfd\x00\xfe\x00\xff\x00\x09\x00\x0a\x00\x0b\x00\x0c\x00\x0d\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x20\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x54\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x80\x00\x81\x00\x82\x00\x83\x00\x84\x00\x85\x00\x86\x00\x87\x00\x88\x00\x89\x00\x8a\x00\x8b\x00\x8c\x00\x8d\x00\x8e\x00\x8f\x00\x90\x00\x91\x00\x92\x00\x93\x00\x94\x00\x95\x00\x96\x00\x97\x00\x98\x00\x99\x00\x9a\x00\x9b\x00\x9c\x00\x9d\x00\x9e\x00\x9f\x00\xa0\x00\xa1\x00\xa2\x00\xa3\x00\xa4\x00\xa5\x00\xa6\x00\xa7\x00\xa8\x00\xa9\x00\xaa\x00\xab\x00\xac\x00\xad\x00\xae\x00\xaf\x00\xb0\x00\xb1\x00\xb2\x00\xb3\x00\xb4\x00\xb5\x00\xb6\x00\xb7\x00\xb8\x00\xb9\x00\xba\x00\xbb\x00\xbc\x00\xbd\x00\xbe\x00\xbf\x00\xc0\x00\xc1\x00\xc2\x00\xc3\x00\xc4\x00\xc5\x00\xc6\x00\xc7\x00\xc8\x00\xc9\x00\xca\x00\xcb\x00\xcc\x00\xcd\x00\xce\x00\xcf\x00\xd0\x00\xd1\x00\xd2\x00\xd3\x00\xd4\x00\xd5\x00\xd6\x00\xd7\x00\xd8\x00\xd9\x00\xda\x00\xdb\x00\xdc\x00\xdd\x00\xde\x00\xdf\x00\xe0\x00\xe1\x00\xe2\x00\xe3\x00\xe4\x00\xe5\x00\xe6\x00\xe7\x00\xe8\x00\xe9\x00\xea\x00\xeb\x00\xec\x00\xed\x00\xee\x00\xef\x00\xf0\x00\xf1\x00\xf2\x00\xf3\x00\xf4\x00\xf5\x00\xf6\x00\xf7\x00\xf8\x00\xf9\x00\xfa\x00\xfb\x00\xfc\x00\xfd\x00\xfe\x00\xff\x00\x09\x00\x0a\x00\x0b\x00\x0c\x00\x0d\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x20\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x52\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x80\x00\x81\x00\x82\x00\x83\x00\x84\x00\x85\x00\x86\x00\x87\x00\x88\x00\x89\x00\x8a\x00\x8b\x00\x8c\x00\x8d\x00\x8e\x00\x8f\x00\x90\x00\x91\x00\x92\x00\x93\x00\x94\x00\x95\x00\x96\x00\x97\x00\x98\x00\x99\x00\x9a\x00\x9b\x00\x9c\x00\x9d\x00\x9e\x00\x9f\x00\xa0\x00\xa1\x00\xa2\x00\xa3\x00\xa4\x00\xa5\x00\xa6\x00\xa7\x00\xa8\x00\xa9\x00\xaa\x00\xab\x00\xac\x00\xad\x00\xae\x00\xaf\x00\xb0\x00\xb1\x00\xb2\x00\xb3\x00\xb4\x00\xb5\x00\xb6\x00\xb7\x00\xb8\x00\xb9\x00\xba\x00\xbb\x00\xbc\x00\xbd\x00\xbe\x00\xbf\x00\xc0\x00\xc1\x00\xc2\x00\xc3\x00\xc4\x00\xc5\x00\xc6\x00\xc7\x00\xc8\x00\xc9\x00\xca\x00\xcb\x00\xcc\x00\xcd\x00\xce\x00\xcf\x00\xd0\x00\xd1\x00\xd2\x00\xd3\x00\xd4\x00\xd5\x00\xd6\x00\xd7\x00\xd8\x00\xd9\x00\xda\x00\xdb\x00\xdc\x00\xdd\x00\xde\x00\xdf\x00\xe0\x00\xe1\x00\xe2\x00\xe3\x00\xe4\x00\xe5\x00\xe6\x00\xe7\x00\xe8\x00\xe9\x00\xea\x00\xeb\x00\xec\x00\xed\x00\xee\x00\xef\x00\xf0\x00\xf1\x00\xf2\x00\xf3\x00\xf4\x00\xf5\x00\xf6\x00\xf7\x00\xf8\x00\xf9\x00\xfa\x00\xfb\x00\xfc\x00\xfd\x00\xfe\x00\xff\x00\x09\x00\x0a\x00\x0b\x00\x0c\x00\x0d\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x20\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x4e\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x5f\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x80\x00\x81\x00\x82\x00\x83\x00\x84\x00\x85\x00\x86\x00\x87\x00\x88\x00\x89\x00\x8a\x00\x8b\x00\x8c\x00\x8d\x00\x8e\x00\x8f\x00\x90\x00\x91\x00\x92\x00\x93\x00\x94\x00\x95\x00\x96\x00\x97\x00\x98\x00\x99\x00\x9a\x00\x9b\x00\x9c\x00\x9d\x00\x9e\x00\x9f\x00\xa0\x00\xa1\x00\xa2\x00\xa3\x00\xa4\x00\xa5\x00\xa6\x00\xa7\x00\xa8\x00\xa9\x00\xaa\x00\xab\x00\xac\x00\xad\x00\xae\x00\xaf\x00\xb0\x00\xb1\x00\xb2\x00\xb3\x00\xb4\x00\xb5\x00\xb6\x00\xb7\x00\xb8\x00\xb9\x00\xba\x00\xbb\x00\xbc\x00\xbd\x00\xbe\x00\xbf\x00\xc0\x00\xc1\x00\xc2\x00\xc3\x00\xc4\x00\xc5\x00\xc6\x00\xc7\x00\xc8\x00\xc9\x00\xca\x00\xcb\x00\xcc\x00\xcd\x00\xce\x00\xcf\x00\xd0\x00\xd1\x00\xd2\x00\xd3\x00\xd4\x00\xd5\x00\xd6\x00\xd7\x00\xd8\x00\xd9\x00\xda\x00\xdb\x00\xdc\x00\xdd\x00\xde\x00\xdf\x00\xe0\x00\xe1\x00\xe2\x00\xe3\x00\xe4\x00\xe5\x00\xe6\x00\xe7\x00\xe8\x00\xe9\x00\xea\x00\xeb\x00\xec\x00\xed\x00\xee\x00\xef\x00\xf0\x00\xf1\x00\xf2\x00\xf3\x00\xf4\x00\xf5\x00\xf6\x00\xf7\x00\xf8\x00\xf9\x00\xfa\x00\xfb\x00\xfc\x00\xfd\x00\xfe\x00\xff\x00\x09\x00\x0a\x00\x0b\x00\x0c\x00\x0d\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x20\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x4e\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x80\x00\x81\x00\x82\x00\x83\x00\x84\x00\x85\x00\x86\x00\x87\x00\x88\x00\x89\x00\x8a\x00\x8b\x00\x8c\x00\x8d\x00\x8e\x00\x8f\x00\x90\x00\x91\x00\x92\x00\x93\x00\x94\x00\x95\x00\x96\x00\x97\x00\x98\x00\x99\x00\x9a\x00\x9b\x00\x9c\x00\x9d\x00\x9e\x00\x9f\x00\xa0\x00\xa1\x00\xa2\x00\xa3\x00\xa4\x00\xa5\x00\xa6\x00\xa7\x00\xa8\x00\xa9\x00\xaa\x00\xab\x00\xac\x00\xad\x00\xae\x00\xaf\x00\xb0\x00\xb1\x00\xb2\x00\xb3\x00\xb4\x00\xb5\x00\xb6\x00\xb7\x00\xb8\x00\xb9\x00\xba\x00\xbb\x00\xbc\x00\xbd\x00\xbe\x00\xbf\x00\xc0\x00\xc1\x00\xc2\x00\xc3\x00\xc4\x00\xc5\x00\xc6\x00\xc7\x00\xc8\x00\xc9\x00\xca\x00\xcb\x00\xcc\x00\xcd\x00\xce\x00\xcf\x00\xd0\x00\xd1\x00\xd2\x00\xd3\x00\xd4\x00\xd5\x00\xd6\x00\xd7\x00\xd8\x00\xd9\x00\xda\x00\xdb\x00\xdc\x00\xdd\x00\xde\x00\xdf\x00\xe0\x00\xe1\x00\xe2\x00\xe3\x00\xe4\x00\xe5\x00\xe6\x00\xe7\x00\xe8\x00\xe9\x00\xea\x00\xeb\x00\xec\x00\xed\x00\xee\x00\xef\x00\xf0\x00\xf1\x00\xf2\x00\xf3\x00\xf4\x00\xf5\x00\xf6\x00\xf7\x00\xf8\x00\xf9\x00\xfa\x00\xfb\x00\xfc\x00\xfd\x00\xfe\x00\xff\x00\x09\x00\x0a\x00\x0b\x00\x0c\x00\x0d\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x20\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x54\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x80\x00\x81\x00\x82\x00\x83\x00\x84\x00\x85\x00\x86\x00\x87\x00\x88\x00\x89\x00\x8a\x00\x8b\x00\x8c\x00\x8d\x00\x8e\x00\x8f\x00\x90\x00\x91\x00\x92\x00\x93\x00\x94\x00\x95\x00\x96\x00\x97\x00\x98\x00\x99\x00\x9a\x00\x9b\x00\x9c\x00\x9d\x00\x9e\x00\x9f\x00\xa0\x00\xa1\x00\xa2\x00\xa3\x00\xa4\x00\xa5\x00\xa6\x00\xa7\x00\xa8\x00\xa9\x00\xaa\x00\xab\x00\xac\x00\xad\x00\xae\x00\xaf\x00\xb0\x00\xb1\x00\xb2\x00\xb3\x00\xb4\x00\xb5\x00\xb6\x00\xb7\x00\xb8\x00\xb9\x00\xba\x00\xbb\x00\xbc\x00\xbd\x00\xbe\x00\xbf\x00\xc0\x00\xc1\x00\xc2\x00\xc3\x00\xc4\x00\xc5\x00\xc6\x00\xc7\x00\xc8\x00\xc9\x00\xca\x00\xcb\x00\xcc\x00\xcd\x00\xce\x00\xcf\x00\xd0\x00\xd1\x00\xd2\x00\xd3\x00\xd4\x00\xd5\x00\xd6\x00\xd7\x00\xd8\x00\xd9\x00\xda\x00\xdb\x00\xdc\x00\xdd\x00\xde\x00\xdf\x00\xe0\x00\xe1\x00\xe2\x00\xe3\x00\xe4\x00\xe5\x00\xe6\x00\xe7\x00\xe8\x00\xe9\x00\xea\x00\xeb\x00\xec\x00\xed\x00\xee\x00\xef\x00\xf0\x00\xf1\x00\xf2\x00\xf3\x00\xf4\x00\xf5\x00\xf6\x00\xf7\x00\xf8\x00\xf9\x00\xfa\x00\xfb\x00\xfc\x00\xfd\x00\xfe\x00\xff\x00\x09\x00\x0a\x00\x0b\x00\x0c\x00\x0d\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x20\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x54\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x80\x00\x81\x00\x82\x00\x83\x00\x84\x00\x85\x00\x86\x00\x87\x00\x88\x00\x89\x00\x8a\x00\x8b\x00\x8c\x00\x8d\x00\x8e\x00\x8f\x00\x90\x00\x91\x00\x92\x00\x93\x00\x94\x00\x95\x00\x96\x00\x97\x00\x98\x00\x99\x00\x9a\x00\x9b\x00\x9c\x00\x9d\x00\x9e\x00\x9f\x00\xa0\x00\xa1\x00\xa2\x00\xa3\x00\xa4\x00\xa5\x00\xa6\x00\xa7\x00\xa8\x00\xa9\x00\xaa\x00\xab\x00\xac\x00\xad\x00\xae\x00\xaf\x00\xb0\x00\xb1\x00\xb2\x00\xb3\x00\xb4\x00\xb5\x00\xb6\x00\xb7\x00\xb8\x00\xb9\x00\xba\x00\xbb\x00\xbc\x00\xbd\x00\xbe\x00\xbf\x00\xc0\x00\xc1\x00\xc2\x00\xc3\x00\xc4\x00\xc5\x00\xc6\x00\xc7\x00\xc8\x00\xc9\x00\xca\x00\xcb\x00\xcc\x00\xcd\x00\xce\x00\xcf\x00\xd0\x00\xd1\x00\xd2\x00\xd3\x00\xd4\x00\xd5\x00\xd6\x00\xd7\x00\xd8\x00\xd9\x00\xda\x00\xdb\x00\xdc\x00\xdd\x00\xde\x00\xdf\x00\xe0\x00\xe1\x00\xe2\x00\xe3\x00\xe4\x00\xe5\x00\xe6\x00\xe7\x00\xe8\x00\xe9\x00\xea\x00\xeb\x00\xec\x00\xed\x00\xee\x00\xef\x00\xf0\x00\xf1\x00\xf2\x00\xf3\x00\xf4\x00\xf5\x00\xf6\x00\xf7\x00\xf8\x00\xf9\x00\xfa\x00\xfb\x00\xfc\x00\xfd\x00\xfe\x00\xff\x00\x09\x00\x0a\x00\x0b\x00\x0c\x00\x0d\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x20\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x52\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x80\x00\x81\x00\x82\x00\x83\x00\x84\x00\x85\x00\x86\x00\x87\x00\x88\x00\x89\x00\x8a\x00\x8b\x00\x8c\x00\x8d\x00\x8e\x00\x8f\x00\x90\x00\x91\x00\x92\x00\x93\x00\x94\x00\x95\x00\x96\x00\x97\x00\x98\x00\x99\x00\x9a\x00\x9b\x00\x9c\x00\x9d\x00\x9e\x00\x9f\x00\xa0\x00\xa1\x00\xa2\x00\xa3\x00\xa4\x00\xa5\x00\xa6\x00\xa7\x00\xa8\x00\xa9\x00\xaa\x00\xab\x00\xac\x00\xad\x00\xae\x00\xaf\x00\xb0\x00\xb1\x00\xb2\x00\xb3\x00\xb4\x00\xb5\x00\xb6\x00\xb7\x00\xb8\x00\xb9\x00\xba\x00\xbb\x00\xbc\x00\xbd\x00\xbe\x00\xbf\x00\xc0\x00\xc1\x00\xc2\x00\xc3\x00\xc4\x00\xc5\x00\xc6\x00\xc7\x00\xc8\x00\xc9\x00\xca\x00\xcb\x00\xcc\x00\xcd\x00\xce\x00\xcf\x00\xd0\x00\xd1\x00\xd2\x00\xd3\x00\xd4\x00\xd5\x00\xd6\x00\xd7\x00\xd8\x00\xd9\x00\xda\x00\xdb\x00\xdc\x00\xdd\x00\xde\x00\xdf\x00\xe0\x00\xe1\x00\xe2\x00\xe3\x00\xe4\x00\xe5\x00\xe6\x00\xe7\x00\xe8\x00\xe9\x00\xea\x00\xeb\x00\xec\x00\xed\x00\xee\x00\xef\x00\xf0\x00\xf1\x00\xf2\x00\xf3\x00\xf4\x00\xf5\x00\xf6\x00\xf7\x00\xf8\x00\xf9\x00\xfa\x00\xfb\x00\xfc\x00\xfd\x00\xfe\x00\xff\x00\x09\x00\x0a\x00\x0b\x00\x0c\x00\x0d\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x20\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x52\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x80\x00\x81\x00\x82\x00\x83\x00\x84\x00\x85\x00\x86\x00\x87\x00\x88\x00\x89\x00\x8a\x00\x8b\x00\x8c\x00\x8d\x00\x8e\x00\x8f\x00\x90\x00\x91\x00\x92\x00\x93\x00\x94\x00\x95\x00\x96\x00\x97\x00\x98\x00\x99\x00\x9a\x00\x9b\x00\x9c\x00\x9d\x00\x9e\x00\x9f\x00\xa0\x00\xa1\x00\xa2\x00\xa3\x00\xa4\x00\xa5\x00\xa6\x00\xa7\x00\xa8\x00\xa9\x00\xaa\x00\xab\x00\xac\x00\xad\x00\xae\x00\xaf\x00\xb0\x00\xb1\x00\xb2\x00\xb3\x00\xb4\x00\xb5\x00\xb6\x00\xb7\x00\xb8\x00\xb9\x00\xba\x00\xbb\x00\xbc\x00\xbd\x00\xbe\x00\xbf\x00\xc0\x00\xc1\x00\xc2\x00\xc3\x00\xc4\x00\xc5\x00\xc6\x00\xc7\x00\xc8\x00\xc9\x00\xca\x00\xcb\x00\xcc\x00\xcd\x00\xce\x00\xcf\x00\xd0\x00\xd1\x00\xd2\x00\xd3\x00\xd4\x00\xd5\x00\xd6\x00\xd7\x00\xd8\x00\xd9\x00\xda\x00\xdb\x00\xdc\x00\xdd\x00\xde\x00\xdf\x00\xe0\x00\xe1\x00\xe2\x00\xe3\x00\xe4\x00\xe5\x00\xe6\x00\xe7\x00\xe8\x00\xe9\x00\xea\x00\xeb\x00\xec\x00\xed\x00\xee\x00\xef\x00\xf0\x00\xf1\x00\xf2\x00\xf3\x00\xf4\x00\xf5\x00\xf6\x00\xf7\x00\xf8\x00\xf9\x00\xfa\x00\xfb\x00\xfc\x00\xfd\x00\xfe\x00\xff\x00\x09\x00\x0a\x00\x0b\x00\x0c\x00\x0d\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x20\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x4e\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x80\x00\x81\x00\x82\x00\x83\x00\x84\x00\x85\x00\x86\x00\x87\x00\x88\x00\x89\x00\x8a\x00\x8b\x00\x8c\x00\x8d\x00\x8e\x00\x8f\x00\x90\x00\x91\x00\x92\x00\x93\x00\x94\x00\x95\x00\x96\x00\x97\x00\x98\x00\x99\x00\x9a\x00\x9b\x00\x9c\x00\x9d\x00\x9e\x00\x9f\x00\xa0\x00\xa1\x00\xa2\x00\xa3\x00\xa4\x00\xa5\x00\xa6\x00\xa7\x00\xa8\x00\xa9\x00\xaa\x00\xab\x00\xac\x00\xad\x00\xae\x00\xaf\x00\xb0\x00\xb1\x00\xb2\x00\xb3\x00\xb4\x00\xb5\x00\xb6\x00\xb7\x00\xb8\x00\xb9\x00\xba\x00\xbb\x00\xbc\x00\xbd\x00\xbe\x00\xbf\x00\xc0\x00\xc1\x00\xc2\x00\xc3\x00\xc4\x00\xc5\x00\xc6\x00\xc7\x00\xc8\x00\xc9\x00\xca\x00\xcb\x00\xcc\x00\xcd\x00\xce\x00\xcf\x00\xd0\x00\xd1\x00\xd2\x00\xd3\x00\xd4\x00\xd5\x00\xd6\x00\xd7\x00\xd8\x00\xd9\x00\xda\x00\xdb\x00\xdc\x00\xdd\x00\xde\x00\xdf\x00\xe0\x00\xe1\x00\xe2\x00\xe3\x00\xe4\x00\xe5\x00\xe6\x00\xe7\x00\xe8\x00\xe9\x00\xea\x00\xeb\x00\xec\x00\xed\x00\xee\x00\xef\x00\xf0\x00\xf1\x00\xf2\x00\xf3\x00\xf4\x00\xf5\x00\xf6\x00\xf7\x00\xf8\x00\xf9\x00\xfa\x00\xfb\x00\xfc\x00\xfd\x00\xfe\x00\xff\x00\x09\x00\x0a\x00\x0b\x00\x0c\x00\x0d\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x20\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x4e\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x80\x00\x81\x00\x82\x00\x83\x00\x84\x00\x85\x00\x86\x00\x87\x00\x88\x00\x89\x00\x8a\x00\x8b\x00\x8c\x00\x8d\x00\x8e\x00\x8f\x00\x90\x00\x91\x00\x92\x00\x93\x00\x94\x00\x95\x00\x96\x00\x97\x00\x98\x00\x99\x00\x9a\x00\x9b\x00\x9c\x00\x9d\x00\x9e\x00\x9f\x00\xa0\x00\xa1\x00\xa2\x00\xa3\x00\xa4\x00\xa5\x00\xa6\x00\xa7\x00\xa8\x00\xa9\x00\xaa\x00\xab\x00\xac\x00\xad\x00\xae\x00\xaf\x00\xb0\x00\xb1\x00\xb2\x00\xb3\x00\xb4\x00\xb5\x00\xb6\x00\xb7\x00\xb8\x00\xb9\x00\xba\x00\xbb\x00\xbc\x00\xbd\x00\xbe\x00\xbf\x00\xc0\x00\xc1\x00\xc2\x00\xc3\x00\xc4\x00\xc5\x00\xc6\x00\xc7\x00\xc8\x00\xc9\x00\xca\x00\xcb\x00\xcc\x00\xcd\x00\xce\x00\xcf\x00\xd0\x00\xd1\x00\xd2\x00\xd3\x00\xd4\x00\xd5\x00\xd6\x00\xd7\x00\xd8\x00\xd9\x00\xda\x00\xdb\x00\xdc\x00\xdd\x00\xde\x00\xdf\x00\xe0\x00\xe1\x00\xe2\x00\xe3\x00\xe4\x00\xe5\x00\xe6\x00\xe7\x00\xe8\x00\xe9\x00\xea\x00\xeb\x00\xec\x00\xed\x00\xee\x00\xef\x00\xf0\x00\xf1\x00\xf2\x00\xf3\x00\xf4\x00\xf5\x00\xf6\x00\xf7\x00\xf8\x00\xf9\x00\xfa\x00\xfb\x00\xfc\x00\xfd\x00\xfe\x00\xff\x00\x09\x00\x0a\x00\x0b\x00\x0c\x00\x0d\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x20\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x4e\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x80\x00\x81\x00\x82\x00\x83\x00\x84\x00\x85\x00\x86\x00\x87\x00\x88\x00\x89\x00\x8a\x00\x8b\x00\x8c\x00\x8d\x00\x8e\x00\x8f\x00\x90\x00\x91\x00\x92\x00\x93\x00\x94\x00\x95\x00\x96\x00\x97\x00\x98\x00\x99\x00\x9a\x00\x9b\x00\x9c\x00\x9d\x00\x9e\x00\x9f\x00\xa0\x00\xa1\x00\xa2\x00\xa3\x00\xa4\x00\xa5\x00\xa6\x00\xa7\x00\xa8\x00\xa9\x00\xaa\x00\xab\x00\xac\x00\xad\x00\xae\x00\xaf\x00\xb0\x00\xb1\x00\xb2\x00\xb3\x00\xb4\x00\xb5\x00\xb6\x00\xb7\x00\xb8\x00\xb9\x00\xba\x00\xbb\x00\xbc\x00\xbd\x00\xbe\x00\xbf\x00\xc0\x00\xc1\x00\xc2\x00\xc3\x00\xc4\x00\xc5\x00\xc6\x00\xc7\x00\xc8\x00\xc9\x00\xca\x00\xcb\x00\xcc\x00\xcd\x00\xce\x00\xcf\x00\xd0\x00\xd1\x00\xd2\x00\xd3\x00\xd4\x00\xd5\x00\xd6\x00\xd7\x00\xd8\x00\xd9\x00\xda\x00\xdb\x00\xdc\x00\xdd\x00\xde\x00\xdf\x00\xe0\x00\xe1\x00\xe2\x00\xe3\x00\xe4\x00\xe5\x00\xe6\x00\xe7\x00\xe8\x00\xe9\x00\xea\x00\xeb\x00\xec\x00\xed\x00\xee\x00\xef\x00\xf0\x00\xf1\x00\xf2\x00\xf3\x00\xf4\x00\xf5\x00\xf6\x00\xf7\x00\xf8\x00\xf9\x00\xfa\x00\xfb\x00\xfc\x00\xfd\x00\xfe\x00\xff\x00\x09\x00\x0a\x00\x0b\x00\x0c\x00\x0d\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x20\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x50\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x80\x00\x81\x00\x82\x00\x83\x00\x84\x00\x85\x00\x86\x00\x87\x00\x88\x00\x89\x00\x8a\x00\x8b\x00\x8c\x00\x8d\x00\x8e\x00\x8f\x00\x90\x00\x91\x00\x92\x00\x93\x00\x94\x00\x95\x00\x96\x00\x97\x00\x98\x00\x99\x00\x9a\x00\x9b\x00\x9c\x00\x9d\x00\x9e\x00\x9f\x00\xa0\x00\xa1\x00\xa2\x00\xa3\x00\xa4\x00\xa5\x00\xa6\x00\xa7\x00\xa8\x00\xa9\x00\xaa\x00\xab\x00\xac\x00\xad\x00\xae\x00\xaf\x00\xb0\x00\xb1\x00\xb2\x00\xb3\x00\xb4\x00\xb5\x00\xb6\x00\xb7\x00\xb8\x00\xb9\x00\xba\x00\xbb\x00\xbc\x00\xbd\x00\xbe\x00\xbf\x00\xc0\x00\xc1\x00\xc2\x00\xc3\x00\xc4\x00\xc5\x00\xc6\x00\xc7\x00\xc8\x00\xc9\x00\xca\x00\xcb\x00\xcc\x00\xcd\x00\xce\x00\xcf\x00\xd0\x00\xd1\x00\xd2\x00\xd3\x00\xd4\x00\xd5\x00\xd6\x00\xd7\x00\xd8\x00\xd9\x00\xda\x00\xdb\x00\xdc\x00\xdd\x00\xde\x00\xdf\x00\xe0\x00\xe1\x00\xe2\x00\xe3\x00\xe4\x00\xe5\x00\xe6\x00\xe7\x00\xe8\x00\xe9\x00\xea\x00\xeb\x00\xec\x00\xed\x00\xee\x00\xef\x00\xf0\x00\xf1\x00\xf2\x00\xf3\x00\xf4\x00\xf5\x00\xf6\x00\xf7\x00\xf8\x00\xf9\x00\xfa\x00\xfb\x00\xfc\x00\xfd\x00\xfe\x00\xff\x00\x09\x00\x0a\x00\x0b\x00\x0c\x00\x0d\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x20\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x54\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x80\x00\x81\x00\x82\x00\x83\x00\x84\x00\x85\x00\x86\x00\x87\x00\x88\x00\x89\x00\x8a\x00\x8b\x00\x8c\x00\x8d\x00\x8e\x00\x8f\x00\x90\x00\x91\x00\x92\x00\x93\x00\x94\x00\x95\x00\x96\x00\x97\x00\x98\x00\x99\x00\x9a\x00\x9b\x00\x9c\x00\x9d\x00\x9e\x00\x9f\x00\xa0\x00\xa1\x00\xa2\x00\xa3\x00\xa4\x00\xa5\x00\xa6\x00\xa7\x00\xa8\x00\xa9\x00\xaa\x00\xab\x00\xac\x00\xad\x00\xae\x00\xaf\x00\xb0\x00\xb1\x00\xb2\x00\xb3\x00\xb4\x00\xb5\x00\xb6\x00\xb7\x00\xb8\x00\xb9\x00\xba\x00\xbb\x00\xbc\x00\xbd\x00\xbe\x00\xbf\x00\xc0\x00\xc1\x00\xc2\x00\xc3\x00\xc4\x00\xc5\x00\xc6\x00\xc7\x00\xc8\x00\xc9\x00\xca\x00\xcb\x00\xcc\x00\xcd\x00\xce\x00\xcf\x00\xd0\x00\xd1\x00\xd2\x00\xd3\x00\xd4\x00\xd5\x00\xd6\x00\xd7\x00\xd8\x00\xd9\x00\xda\x00\xdb\x00\xdc\x00\xdd\x00\xde\x00\xdf\x00\xe0\x00\xe1\x00\xe2\x00\xe3\x00\xe4\x00\xe5\x00\xe6\x00\xe7\x00\xe8\x00\xe9\x00\xea\x00\xeb\x00\xec\x00\xed\x00\xee\x00\xef\x00\xf0\x00\xf1\x00\xf2\x00\xf3\x00\xf4\x00\xf5\x00\xf6\x00\xf7\x00\xf8\x00\xf9\x00\xfa\x00\xfb\x00\xfc\x00\xfd\x00\xfe\x00\xff\x00\x09\x00\x0a\x00\x0b\x00\x0c\x00\x0d\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x20\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x50\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x80\x00\x81\x00\x82\x00\x83\x00\x84\x00\x85\x00\x86\x00\x87\x00\x88\x00\x89\x00\x8a\x00\x8b\x00\x8c\x00\x8d\x00\x8e\x00\x8f\x00\x90\x00\x91\x00\x92\x00\x93\x00\x94\x00\x95\x00\x96\x00\x97\x00\x98\x00\x99\x00\x9a\x00\x9b\x00\x9c\x00\x9d\x00\x9e\x00\x9f\x00\xa0\x00\xa1\x00\xa2\x00\xa3\x00\xa4\x00\xa5\x00\xa6\x00\xa7\x00\xa8\x00\xa9\x00\xaa\x00\xab\x00\xac\x00\xad\x00\xae\x00\xaf\x00\xb0\x00\xb1\x00\xb2\x00\xb3\x00\xb4\x00\xb5\x00\xb6\x00\xb7\x00\xb8\x00\xb9\x00\xba\x00\xbb\x00\xbc\x00\xbd\x00\xbe\x00\xbf\x00\xc0\x00\xc1\x00\xc2\x00\xc3\x00\xc4\x00\xc5\x00\xc6\x00\xc7\x00\xc8\x00\xc9\x00\xca\x00\xcb\x00\xcc\x00\xcd\x00\xce\x00\xcf\x00\xd0\x00\xd1\x00\xd2\x00\xd3\x00\xd4\x00\xd5\x00\xd6\x00\xd7\x00\xd8\x00\xd9\x00\xda\x00\xdb\x00\xdc\x00\xdd\x00\xde\x00\xdf\x00\xe0\x00\xe1\x00\xe2\x00\xe3\x00\xe4\x00\xe5\x00\xe6\x00\xe7\x00\xe8\x00\xe9\x00\xea\x00\xeb\x00\xec\x00\xed\x00\xee\x00\xef\x00\xf0\x00\xf1\x00\xf2\x00\xf3\x00\xf4\x00\xf5\x00\xf6\x00\xf7\x00\xf8\x00\xf9\x00\xfa\x00\xfb\x00\xfc\x00\xfd\x00\xfe\x00\xff\x00\x09\x00\x0a\x00\x0b\x00\x0c\x00\x0d\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x20\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x54\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x80\x00\x81\x00\x82\x00\x83\x00\x84\x00\x85\x00\x86\x00\x87\x00\x88\x00\x89\x00\x8a\x00\x8b\x00\x8c\x00\x8d\x00\x8e\x00\x8f\x00\x90\x00\x91\x00\x92\x00\x93\x00\x94\x00\x95\x00\x96\x00\x97\x00\x98\x00\x99\x00\x9a\x00\x9b\x00\x9c\x00\x9d\x00\x9e\x00\x9f\x00\xa0\x00\xa1\x00\xa2\x00\xa3\x00\xa4\x00\xa5\x00\xa6\x00\xa7\x00\xa8\x00\xa9\x00\xaa\x00\xab\x00\xac\x00\xad\x00\xae\x00\xaf\x00\xb0\x00\xb1\x00\xb2\x00\xb3\x00\xb4\x00\xb5\x00\xb6\x00\xb7\x00\xb8\x00\xb9\x00\xba\x00\xbb\x00\xbc\x00\xbd\x00\xbe\x00\xbf\x00\xc0\x00\xc1\x00\xc2\x00\xc3\x00\xc4\x00\xc5\x00\xc6\x00\xc7\x00\xc8\x00\xc9\x00\xca\x00\xcb\x00\xcc\x00\xcd\x00\xce\x00\xcf\x00\xd0\x00\xd1\x00\xd2\x00\xd3\x00\xd4\x00\xd5\x00\xd6\x00\xd7\x00\xd8\x00\xd9\x00\xda\x00\xdb\x00\xdc\x00\xdd\x00\xde\x00\xdf\x00\xe0\x00\xe1\x00\xe2\x00\xe3\x00\xe4\x00\xe5\x00\xe6\x00\xe7\x00\xe8\x00\xe9\x00\xea\x00\xeb\x00\xec\x00\xed\x00\xee\x00\xef\x00\xf0\x00\xf1\x00\xf2\x00\xf3\x00\xf4\x00\xf5\x00\xf6\x00\xf7\x00\xf8\x00\xf9\x00\xfa\x00\xfb\x00\xfc\x00\xfd\x00\xfe\x00\xff\x00\x09\x00\x0a\x00\x0b\x00\x0c\x00\x0d\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x20\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x54\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x80\x00\x81\x00\x82\x00\x83\x00\x84\x00\x85\x00\x86\x00\x87\x00\x88\x00\x89\x00\x8a\x00\x8b\x00\x8c\x00\x8d\x00\x8e\x00\x8f\x00\x90\x00\x91\x00\x92\x00\x93\x00\x94\x00\x95\x00\x96\x00\x97\x00\x98\x00\x99\x00\x9a\x00\x9b\x00\x9c\x00\x9d\x00\x9e\x00\x9f\x00\xa0\x00\xa1\x00\xa2\x00\xa3\x00\xa4\x00\xa5\x00\xa6\x00\xa7\x00\xa8\x00\xa9\x00\xaa\x00\xab\x00\xac\x00\xad\x00\xae\x00\xaf\x00\xb0\x00\xb1\x00\xb2\x00\xb3\x00\xb4\x00\xb5\x00\xb6\x00\xb7\x00\xb8\x00\xb9\x00\xba\x00\xbb\x00\xbc\x00\xbd\x00\xbe\x00\xbf\x00\xc0\x00\xc1\x00\xc2\x00\xc3\x00\xc4\x00\xc5\x00\xc6\x00\xc7\x00\xc8\x00\xc9\x00\xca\x00\xcb\x00\xcc\x00\xcd\x00\xce\x00\xcf\x00\xd0\x00\xd1\x00\xd2\x00\xd3\x00\xd4\x00\xd5\x00\xd6\x00\xd7\x00\xd8\x00\xd9\x00\xda\x00\xdb\x00\xdc\x00\xdd\x00\xde\x00\xdf\x00\xe0\x00\xe1\x00\xe2\x00\xe3\x00\xe4\x00\xe5\x00\xe6\x00\xe7\x00\xe8\x00\xe9\x00\xea\x00\xeb\x00\xec\x00\xed\x00\xee\x00\xef\x00\xf0\x00\xf1\x00\xf2\x00\xf3\x00\xf4\x00\xf5\x00\xf6\x00\xf7\x00\xf8\x00\xf9\x00\xfa\x00\xfb\x00\xfc\x00\xfd\x00\xfe\x00\xff\x00\x09\x00\x0a\x00\x0b\x00\x0c\x00\x0d\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x20\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x54\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x80\x00\x81\x00\x82\x00\x83\x00\x84\x00\x85\x00\x86\x00\x87\x00\x88\x00\x89\x00\x8a\x00\x8b\x00\x8c\x00\x8d\x00\x8e\x00\x8f\x00\x90\x00\x91\x00\x92\x00\x93\x00\x94\x00\x95\x00\x96\x00\x97\x00\x98\x00\x99\x00\x9a\x00\x9b\x00\x9c\x00\x9d\x00\x9e\x00\x9f\x00\xa0\x00\xa1\x00\xa2\x00\xa3\x00\xa4\x00\xa5\x00\xa6\x00\xa7\x00\xa8\x00\xa9\x00\xaa\x00\xab\x00\xac\x00\xad\x00\xae\x00\xaf\x00\xb0\x00\xb1\x00\xb2\x00\xb3\x00\xb4\x00\xb5\x00\xb6\x00\xb7\x00\xb8\x00\xb9\x00\xba\x00\xbb\x00\xbc\x00\xbd\x00\xbe\x00\xbf\x00\xc0\x00\xc1\x00\xc2\x00\xc3\x00\xc4\x00\xc5\x00\xc6\x00\xc7\x00\xc8\x00\xc9\x00\xca\x00\xcb\x00\xcc\x00\xcd\x00\xce\x00\xcf\x00\xd0\x00\xd1\x00\xd2\x00\xd3\x00\xd4\x00\xd5\x00\xd6\x00\xd7\x00\xd8\x00\xd9\x00\xda\x00\xdb\x00\xdc\x00\xdd\x00\xde\x00\xdf\x00\xe0\x00\xe1\x00\xe2\x00\xe3\x00\xe4\x00\xe5\x00\xe6\x00\xe7\x00\xe8\x00\xe9\x00\xea\x00\xeb\x00\xec\x00\xed\x00\xee\x00\xef\x00\xf0\x00\xf1\x00\xf2\x00\xf3\x00\xf4\x00\xf5\x00\xf6\x00\xf7\x00\xf8\x00\xf9\x00\xfa\x00\xfb\x00\xfc\x00\xfd\x00\xfe\x00\xff\x00\x09\x00\x0a\x00\x0b\x00\x0c\x00\x0d\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x20\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x48\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x80\x00\x81\x00\x82\x00\x83\x00\x84\x00\x85\x00\x86\x00\x87\x00\x88\x00\x89\x00\x8a\x00\x8b\x00\x8c\x00\x8d\x00\x8e\x00\x8f\x00\x90\x00\x91\x00\x92\x00\x93\x00\x94\x00\x95\x00\x96\x00\x97\x00\x98\x00\x99\x00\x9a\x00\x9b\x00\x9c\x00\x9d\x00\x9e\x00\x9f\x00\xa0\x00\xa1\x00\xa2\x00\xa3\x00\xa4\x00\xa5\x00\xa6\x00\xa7\x00\xa8\x00\xa9\x00\xaa\x00\xab\x00\xac\x00\xad\x00\xae\x00\xaf\x00\xb0\x00\xb1\x00\xb2\x00\xb3\x00\xb4\x00\xb5\x00\xb6\x00\xb7\x00\xb8\x00\xb9\x00\xba\x00\xbb\x00\xbc\x00\xbd\x00\xbe\x00\xbf\x00\xc0\x00\xc1\x00\xc2\x00\xc3\x00\xc4\x00\xc5\x00\xc6\x00\xc7\x00\xc8\x00\xc9\x00\xca\x00\xcb\x00\xcc\x00\xcd\x00\xce\x00\xcf\x00\xd0\x00\xd1\x00\xd2\x00\xd3\x00\xd4\x00\xd5\x00\xd6\x00\xd7\x00\xd8\x00\xd9\x00\xda\x00\xdb\x00\xdc\x00\xdd\x00\xde\x00\xdf\x00\xe0\x00\xe1\x00\xe2\x00\xe3\x00\xe4\x00\xe5\x00\xe6\x00\xe7\x00\xe8\x00\xe9\x00\xea\x00\xeb\x00\xec\x00\xed\x00\xee\x00\xef\x00\xf0\x00\xf1\x00\xf2\x00\xf3\x00\xf4\x00\xf5\x00\xf6\x00\xf7\x00\xf8\x00\xf9\x00\xfa\x00\xfb\x00\xfc\x00\xfd\x00\xfe\x00\xff\x00\x09\x00\x0a\x00\x0b\x00\x0c\x00\x0d\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x20\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x50\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x80\x00\x81\x00\x82\x00\x83\x00\x84\x00\x85\x00\x86\x00\x87\x00\x88\x00\x89\x00\x8a\x00\x8b\x00\x8c\x00\x8d\x00\x8e\x00\x8f\x00\x90\x00\x91\x00\x92\x00\x93\x00\x94\x00\x95\x00\x96\x00\x97\x00\x98\x00\x99\x00\x9a\x00\x9b\x00\x9c\x00\x9d\x00\x9e\x00\x9f\x00\xa0\x00\xa1\x00\xa2\x00\xa3\x00\xa4\x00\xa5\x00\xa6\x00\xa7\x00\xa8\x00\xa9\x00\xaa\x00\xab\x00\xac\x00\xad\x00\xae\x00\xaf\x00\xb0\x00\xb1\x00\xb2\x00\xb3\x00\xb4\x00\xb5\x00\xb6\x00\xb7\x00\xb8\x00\xb9\x00\xba\x00\xbb\x00\xbc\x00\xbd\x00\xbe\x00\xbf\x00\xc0\x00\xc1\x00\xc2\x00\xc3\x00\xc4\x00\xc5\x00\xc6\x00\xc7\x00\xc8\x00\xc9\x00\xca\x00\xcb\x00\xcc\x00\xcd\x00\xce\x00\xcf\x00\xd0\x00\xd1\x00\xd2\x00\xd3\x00\xd4\x00\xd5\x00\xd6\x00\xd7\x00\xd8\x00\xd9\x00\xda\x00\xdb\x00\xdc\x00\xdd\x00\xde\x00\xdf\x00\xe0\x00\xe1\x00\xe2\x00\xe3\x00\xe4\x00\xe5\x00\xe6\x00\xe7\x00\xe8\x00\xe9\x00\xea\x00\xeb\x00\xec\x00\xed\x00\xee\x00\xef\x00\xf0\x00\xf1\x00\xf2\x00\xf3\x00\xf4\x00\xf5\x00\xf6\x00\xf7\x00\xf8\x00\xf9\x00\xfa\x00\xfb\x00\xfc\x00\xfd\x00\xfe\x00\xff\x00\x09\x00\x0a\x00\x0b\x00\x0c\x00\x0d\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x20\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x50\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x80\x00\x81\x00\x82\x00\x83\x00\x84\x00\x85\x00\x86\x00\x87\x00\x88\x00\x89\x00\x8a\x00\x8b\x00\x8c\x00\x8d\x00\x8e\x00\x8f\x00\x90\x00\x91\x00\x92\x00\x93\x00\x94\x00\x95\x00\x96\x00\x97\x00\x98\x00\x99\x00\x9a\x00\x9b\x00\x9c\x00\x9d\x00\x9e\x00\x9f\x00\xa0\x00\xa1\x00\xa2\x00\xa3\x00\xa4\x00\xa5\x00\xa6\x00\xa7\x00\xa8\x00\xa9\x00\xaa\x00\xab\x00\xac\x00\xad\x00\xae\x00\xaf\x00\xb0\x00\xb1\x00\xb2\x00\xb3\x00\xb4\x00\xb5\x00\xb6\x00\xb7\x00\xb8\x00\xb9\x00\xba\x00\xbb\x00\xbc\x00\xbd\x00\xbe\x00\xbf\x00\xc0\x00\xc1\x00\xc2\x00\xc3\x00\xc4\x00\xc5\x00\xc6\x00\xc7\x00\xc8\x00\xc9\x00\xca\x00\xcb\x00\xcc\x00\xcd\x00\xce\x00\xcf\x00\xd0\x00\xd1\x00\xd2\x00\xd3\x00\xd4\x00\xd5\x00\xd6\x00\xd7\x00\xd8\x00\xd9\x00\xda\x00\xdb\x00\xdc\x00\xdd\x00\xde\x00\xdf\x00\xe0\x00\xe1\x00\xe2\x00\xe3\x00\xe4\x00\xe5\x00\xe6\x00\xe7\x00\xe8\x00\xe9\x00\xea\x00\xeb\x00\xec\x00\xed\x00\xee\x00\xef\x00\xf0\x00\xf1\x00\xf2\x00\xf3\x00\xf4\x00\xf5\x00\xf6\x00\xf7\x00\xf8\x00\xf9\x00\xfa\x00\xfb\x00\xfc\x00\xfd\x00\xfe\x00\xff\x00\x09\x00\x0a\x00\x0b\x00\x0c\x00\x0d\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x20\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x52\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x80\x00\x81\x00\x82\x00\x83\x00\x84\x00\x85\x00\x86\x00\x87\x00\x88\x00\x89\x00\x8a\x00\x8b\x00\x8c\x00\x8d\x00\x8e\x00\x8f\x00\x90\x00\x91\x00\x92\x00\x93\x00\x94\x00\x95\x00\x96\x00\x97\x00\x98\x00\x99\x00\x9a\x00\x9b\x00\x9c\x00\x9d\x00\x9e\x00\x9f\x00\xa0\x00\xa1\x00\xa2\x00\xa3\x00\xa4\x00\xa5\x00\xa6\x00\xa7\x00\xa8\x00\xa9\x00\xaa\x00\xab\x00\xac\x00\xad\x00\xae\x00\xaf\x00\xb0\x00\xb1\x00\xb2\x00\xb3\x00\xb4\x00\xb5\x00\xb6\x00\xb7\x00\xb8\x00\xb9\x00\xba\x00\xbb\x00\xbc\x00\xbd\x00\xbe\x00\xbf\x00\xc0\x00\xc1\x00\xc2\x00\xc3\x00\xc4\x00\xc5\x00\xc6\x00\xc7\x00\xc8\x00\xc9\x00\xca\x00\xcb\x00\xcc\x00\xcd\x00\xce\x00\xcf\x00\xd0\x00\xd1\x00\xd2\x00\xd3\x00\xd4\x00\xd5\x00\xd6\x00\xd7\x00\xd8\x00\xd9\x00\xda\x00\xdb\x00\xdc\x00\xdd\x00\xde\x00\xdf\x00\xe0\x00\xe1\x00\xe2\x00\xe3\x00\xe4\x00\xe5\x00\xe6\x00\xe7\x00\xe8\x00\xe9\x00\xea\x00\xeb\x00\xec\x00\xed\x00\xee\x00\xef\x00\xf0\x00\xf1\x00\xf2\x00\xf3\x00\xf4\x00\xf5\x00\xf6\x00\xf7\x00\xf8\x00\xf9\x00\xfa\x00\xfb\x00\xfc\x00\xfd\x00\xfe\x00\xff\x00\x09\x00\x0a\x00\x0b\x00\x0c\x00\x0d\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x20\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x4c\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x80\x00\x81\x00\x82\x00\x83\x00\x84\x00\x85\x00\x86\x00\x87\x00\x88\x00\x89\x00\x8a\x00\x8b\x00\x8c\x00\x8d\x00\x8e\x00\x8f\x00\x90\x00\x91\x00\x92\x00\x93\x00\x94\x00\x95\x00\x96\x00\x97\x00\x98\x00\x99\x00\x9a\x00\x9b\x00\x9c\x00\x9d\x00\x9e\x00\x9f\x00\xa0\x00\xa1\x00\xa2\x00\xa3\x00\xa4\x00\xa5\x00\xa6\x00\xa7\x00\xa8\x00\xa9\x00\xaa\x00\xab\x00\xac\x00\xad\x00\xae\x00\xaf\x00\xb0\x00\xb1\x00\xb2\x00\xb3\x00\xb4\x00\xb5\x00\xb6\x00\xb7\x00\xb8\x00\xb9\x00\xba\x00\xbb\x00\xbc\x00\xbd\x00\xbe\x00\xbf\x00\xc0\x00\xc1\x00\xc2\x00\xc3\x00\xc4\x00\xc5\x00\xc6\x00\xc7\x00\xc8\x00\xc9\x00\xca\x00\xcb\x00\xcc\x00\xcd\x00\xce\x00\xcf\x00\xd0\x00\xd1\x00\xd2\x00\xd3\x00\xd4\x00\xd5\x00\xd6\x00\xd7\x00\xd8\x00\xd9\x00\xda\x00\xdb\x00\xdc\x00\xdd\x00\xde\x00\xdf\x00\xe0\x00\xe1\x00\xe2\x00\xe3\x00\xe4\x00\xe5\x00\xe6\x00\xe7\x00\xe8\x00\xe9\x00\xea\x00\xeb\x00\xec\x00\xed\x00\xee\x00\xef\x00\xf0\x00\xf1\x00\xf2\x00\xf3\x00\xf4\x00\xf5\x00\xf6\x00\xf7\x00\xf8\x00\xf9\x00\xfa\x00\xfb\x00\xfc\x00\xfd\x00\xfe\x00\xff\x00\x09\x00\x0a\x00\x0b\x00\x0c\x00\x0d\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x20\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x42\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x80\x00\x81\x00\x82\x00\x83\x00\x84\x00\x85\x00\x86\x00\x87\x00\x88\x00\x89\x00\x8a\x00\x8b\x00\x8c\x00\x8d\x00\x8e\x00\x8f\x00\x90\x00\x91\x00\x92\x00\x93\x00\x94\x00\x95\x00\x96\x00\x97\x00\x98\x00\x99\x00\x9a\x00\x9b\x00\x9c\x00\x9d\x00\x9e\x00\x9f\x00\xa0\x00\xa1\x00\xa2\x00\xa3\x00\xa4\x00\xa5\x00\xa6\x00\xa7\x00\xa8\x00\xa9\x00\xaa\x00\xab\x00\xac\x00\xad\x00\xae\x00\xaf\x00\xb0\x00\xb1\x00\xb2\x00\xb3\x00\xb4\x00\xb5\x00\xb6\x00\xb7\x00\xb8\x00\xb9\x00\xba\x00\xbb\x00\xbc\x00\xbd\x00\xbe\x00\xbf\x00\xc0\x00\xc1\x00\xc2\x00\xc3\x00\xc4\x00\xc5\x00\xc6\x00\xc7\x00\xc8\x00\xc9\x00\xca\x00\xcb\x00\xcc\x00\xcd\x00\xce\x00\xcf\x00\xd0\x00\xd1\x00\xd2\x00\xd3\x00\xd4\x00\xd5\x00\xd6\x00\xd7\x00\xd8\x00\xd9\x00\xda\x00\xdb\x00\xdc\x00\xdd\x00\xde\x00\xdf\x00\xe0\x00\xe1\x00\xe2\x00\xe3\x00\xe4\x00\xe5\x00\xe6\x00\xe7\x00\xe8\x00\xe9\x00\xea\x00\xeb\x00\xec\x00\xed\x00\xee\x00\xef\x00\xf0\x00\xf1\x00\xf2\x00\xf3\x00\xf4\x00\xf5\x00\xf6\x00\xf7\x00\xf8\x00\xf9\x00\xfa\x00\xfb\x00\xfc\x00\xfd\x00\xfe\x00\xff\x00\x09\x00\x0a\x00\x0b\x00\x0c\x00\x0d\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x20\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x54\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x80\x00\x81\x00\x82\x00\x83\x00\x84\x00\x85\x00\x86\x00\x87\x00\x88\x00\x89\x00\x8a\x00\x8b\x00\x8c\x00\x8d\x00\x8e\x00\x8f\x00\x90\x00\x91\x00\x92\x00\x93\x00\x94\x00\x95\x00\x96\x00\x97\x00\x98\x00\x99\x00\x9a\x00\x9b\x00\x9c\x00\x9d\x00\x9e\x00\x9f\x00\xa0\x00\xa1\x00\xa2\x00\xa3\x00\xa4\x00\xa5\x00\xa6\x00\xa7\x00\xa8\x00\xa9\x00\xaa\x00\xab\x00\xac\x00\xad\x00\xae\x00\xaf\x00\xb0\x00\xb1\x00\xb2\x00\xb3\x00\xb4\x00\xb5\x00\xb6\x00\xb7\x00\xb8\x00\xb9\x00\xba\x00\xbb\x00\xbc\x00\xbd\x00\xbe\x00\xbf\x00\xc0\x00\xc1\x00\xc2\x00\xc3\x00\xc4\x00\xc5\x00\xc6\x00\xc7\x00\xc8\x00\xc9\x00\xca\x00\xcb\x00\xcc\x00\xcd\x00\xce\x00\xcf\x00\xd0\x00\xd1\x00\xd2\x00\xd3\x00\xd4\x00\xd5\x00\xd6\x00\xd7\x00\xd8\x00\xd9\x00\xda\x00\xdb\x00\xdc\x00\xdd\x00\xde\x00\xdf\x00\xe0\x00\xe1\x00\xe2\x00\xe3\x00\xe4\x00\xe5\x00\xe6\x00\xe7\x00\xe8\x00\xe9\x00\xea\x00\xeb\x00\xec\x00\xed\x00\xee\x00\xef\x00\xf0\x00\xf1\x00\xf2\x00\xf3\x00\xf4\x00\xf5\x00\xf6\x00\xf7\x00\xf8\x00\xf9\x00\xfa\x00\xfb\x00\xfc\x00\xfd\x00\xfe\x00\xff\x00\x09\x00\x0a\x00\x0b\x00\x0c\x00\x0d\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x20\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x50\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x58\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x80\x00\x81\x00\x82\x00\x83\x00\x84\x00\x85\x00\x86\x00\x87\x00\x88\x00\x89\x00\x8a\x00\x8b\x00\x8c\x00\x8d\x00\x8e\x00\x8f\x00\x90\x00\x91\x00\x92\x00\x93\x00\x94\x00\x95\x00\x96\x00\x97\x00\x98\x00\x99\x00\x9a\x00\x9b\x00\x9c\x00\x9d\x00\x9e\x00\x9f\x00\xa0\x00\xa1\x00\xa2\x00\xa3\x00\xa4\x00\xa5\x00\xa6\x00\xa7\x00\xa8\x00\xa9\x00\xaa\x00\xab\x00\xac\x00\xad\x00\xae\x00\xaf\x00\xb0\x00\xb1\x00\xb2\x00\xb3\x00\xb4\x00\xb5\x00\xb6\x00\xb7\x00\xb8\x00\xb9\x00\xba\x00\xbb\x00\xbc\x00\xbd\x00\xbe\x00\xbf\x00\xc0\x00\xc1\x00\xc2\x00\xc3\x00\xc4\x00\xc5\x00\xc6\x00\xc7\x00\xc8\x00\xc9\x00\xca\x00\xcb\x00\xcc\x00\xcd\x00\xce\x00\xcf\x00\xd0\x00\xd1\x00\xd2\x00\xd3\x00\xd4\x00\xd5\x00\xd6\x00\xd7\x00\xd8\x00\xd9\x00\xda\x00\xdb\x00\xdc\x00\xdd\x00\xde\x00\xdf\x00\xe0\x00\xe1\x00\xe2\x00\xe3\x00\xe4\x00\xe5\x00\xe6\x00\xe7\x00\xe8\x00\xe9\x00\xea\x00\xeb\x00\xec\x00\xed\x00\xee\x00\xef\x00\xf0\x00\xf1\x00\xf2\x00\xf3\x00\xf4\x00\xf5\x00\xf6\x00\xf7\x00\xf8\x00\xf9\x00\xfa\x00\xfb\x00\xfc\x00\xfd\x00\xfe\x00\xff\x00\x09\x00\x0a\x00\x0b\x00\x0c\x00\x0d\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x20\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x4c\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x80\x00\x81\x00\x82\x00\x83\x00\x84\x00\x85\x00\x86\x00\x87\x00\x88\x00\x89\x00\x8a\x00\x8b\x00\x8c\x00\x8d\x00\x8e\x00\x8f\x00\x90\x00\x91\x00\x92\x00\x93\x00\x94\x00\x95\x00\x96\x00\x97\x00\x98\x00\x99\x00\x9a\x00\x9b\x00\x9c\x00\x9d\x00\x9e\x00\x9f\x00\xa0\x00\xa1\x00\xa2\x00\xa3\x00\xa4\x00\xa5\x00\xa6\x00\xa7\x00\xa8\x00\xa9\x00\xaa\x00\xab\x00\xac\x00\xad\x00\xae\x00\xaf\x00\xb0\x00\xb1\x00\xb2\x00\xb3\x00\xb4\x00\xb5\x00\xb6\x00\xb7\x00\xb8\x00\xb9\x00\xba\x00\xbb\x00\xbc\x00\xbd\x00\xbe\x00\xbf\x00\xc0\x00\xc1\x00\xc2\x00\xc3\x00\xc4\x00\xc5\x00\xc6\x00\xc7\x00\xc8\x00\xc9\x00\xca\x00\xcb\x00\xcc\x00\xcd\x00\xce\x00\xcf\x00\xd0\x00\xd1\x00\xd2\x00\xd3\x00\xd4\x00\xd5\x00\xd6\x00\xd7\x00\xd8\x00\xd9\x00\xda\x00\xdb\x00\xdc\x00\xdd\x00\xde\x00\xdf\x00\xe0\x00\xe1\x00\xe2\x00\xe3\x00\xe4\x00\xe5\x00\xe6\x00\xe7\x00\xe8\x00\xe9\x00\xea\x00\xeb\x00\xec\x00\xed\x00\xee\x00\xef\x00\xf0\x00\xf1\x00\xf2\x00\xf3\x00\xf4\x00\xf5\x00\xf6\x00\xf7\x00\xf8\x00\xf9\x00\xfa\x00\xfb\x00\xfc\x00\xfd\x00\xfe\x00\xff\x00\x09\x00\x0a\x00\x0b\x00\x0c\x00\x0d\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x20\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x54\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x80\x00\x81\x00\x82\x00\x83\x00\x84\x00\x85\x00\x86\x00\x87\x00\x88\x00\x89\x00\x8a\x00\x8b\x00\x8c\x00\x8d\x00\x8e\x00\x8f\x00\x90\x00\x91\x00\x92\x00\x93\x00\x94\x00\x95\x00\x96\x00\x97\x00\x98\x00\x99\x00\x9a\x00\x9b\x00\x9c\x00\x9d\x00\x9e\x00\x9f\x00\xa0\x00\xa1\x00\xa2\x00\xa3\x00\xa4\x00\xa5\x00\xa6\x00\xa7\x00\xa8\x00\xa9\x00\xaa\x00\xab\x00\xac\x00\xad\x00\xae\x00\xaf\x00\xb0\x00\xb1\x00\xb2\x00\xb3\x00\xb4\x00\xb5\x00\xb6\x00\xb7\x00\xb8\x00\xb9\x00\xba\x00\xbb\x00\xbc\x00\xbd\x00\xbe\x00\xbf\x00\xc0\x00\xc1\x00\xc2\x00\xc3\x00\xc4\x00\xc5\x00\xc6\x00\xc7\x00\xc8\x00\xc9\x00\xca\x00\xcb\x00\xcc\x00\xcd\x00\xce\x00\xcf\x00\xd0\x00\xd1\x00\xd2\x00\xd3\x00\xd4\x00\xd5\x00\xd6\x00\xd7\x00\xd8\x00\xd9\x00\xda\x00\xdb\x00\xdc\x00\xdd\x00\xde\x00\xdf\x00\xe0\x00\xe1\x00\xe2\x00\xe3\x00\xe4\x00\xe5\x00\xe6\x00\xe7\x00\xe8\x00\xe9\x00\xea\x00\xeb\x00\xec\x00\xed\x00\xee\x00\xef\x00\xf0\x00\xf1\x00\xf2\x00\xf3\x00\xf4\x00\xf5\x00\xf6\x00\xf7\x00\xf8\x00\xf9\x00\xfa\x00\xfb\x00\xfc\x00\xfd\x00\xfe\x00\xff\x00\x09\x00\x0a\x00\x0b\x00\x0c\x00\x0d\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x20\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x4e\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x80\x00\x81\x00\x82\x00\x83\x00\x84\x00\x85\x00\x86\x00\x87\x00\x88\x00\x89\x00\x8a\x00\x8b\x00\x8c\x00\x8d\x00\x8e\x00\x8f\x00\x90\x00\x91\x00\x92\x00\x93\x00\x94\x00\x95\x00\x96\x00\x97\x00\x98\x00\x99\x00\x9a\x00\x9b\x00\x9c\x00\x9d\x00\x9e\x00\x9f\x00\xa0\x00\xa1\x00\xa2\x00\xa3\x00\xa4\x00\xa5\x00\xa6\x00\xa7\x00\xa8\x00\xa9\x00\xaa\x00\xab\x00\xac\x00\xad\x00\xae\x00\xaf\x00\xb0\x00\xb1\x00\xb2\x00\xb3\x00\xb4\x00\xb5\x00\xb6\x00\xb7\x00\xb8\x00\xb9\x00\xba\x00\xbb\x00\xbc\x00\xbd\x00\xbe\x00\xbf\x00\xc0\x00\xc1\x00\xc2\x00\xc3\x00\xc4\x00\xc5\x00\xc6\x00\xc7\x00\xc8\x00\xc9\x00\xca\x00\xcb\x00\xcc\x00\xcd\x00\xce\x00\xcf\x00\xd0\x00\xd1\x00\xd2\x00\xd3\x00\xd4\x00\xd5\x00\xd6\x00\xd7\x00\xd8\x00\xd9\x00\xda\x00\xdb\x00\xdc\x00\xdd\x00\xde\x00\xdf\x00\xe0\x00\xe1\x00\xe2\x00\xe3\x00\xe4\x00\xe5\x00\xe6\x00\xe7\x00\xe8\x00\xe9\x00\xea\x00\xeb\x00\xec\x00\xed\x00\xee\x00\xef\x00\xf0\x00\xf1\x00\xf2\x00\xf3\x00\xf4\x00\xf5\x00\xf6\x00\xf7\x00\xf8\x00\xf9\x00\xfa\x00\xfb\x00\xfc\x00\xfd\x00\xfe\x00\xff\x00\x09\x00\x0a\x00\x0b\x00\x0c\x00\x0d\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x20\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x52\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x80\x00\x81\x00\x82\x00\x83\x00\x84\x00\x85\x00\x86\x00\x87\x00\x88\x00\x89\x00\x8a\x00\x8b\x00\x8c\x00\x8d\x00\x8e\x00\x8f\x00\x90\x00\x91\x00\x92\x00\x93\x00\x94\x00\x95\x00\x96\x00\x97\x00\x98\x00\x99\x00\x9a\x00\x9b\x00\x9c\x00\x9d\x00\x9e\x00\x9f\x00\xa0\x00\xa1\x00\xa2\x00\xa3\x00\xa4\x00\xa5\x00\xa6\x00\xa7\x00\xa8\x00\xa9\x00\xaa\x00\xab\x00\xac\x00\xad\x00\xae\x00\xaf\x00\xb0\x00\xb1\x00\xb2\x00\xb3\x00\xb4\x00\xb5\x00\xb6\x00\xb7\x00\xb8\x00\xb9\x00\xba\x00\xbb\x00\xbc\x00\xbd\x00\xbe\x00\xbf\x00\xc0\x00\xc1\x00\xc2\x00\xc3\x00\xc4\x00\xc5\x00\xc6\x00\xc7\x00\xc8\x00\xc9\x00\xca\x00\xcb\x00\xcc\x00\xcd\x00\xce\x00\xcf\x00\xd0\x00\xd1\x00\xd2\x00\xd3\x00\xd4\x00\xd5\x00\xd6\x00\xd7\x00\xd8\x00\xd9\x00\xda\x00\xdb\x00\xdc\x00\xdd\x00\xde\x00\xdf\x00\xe0\x00\xe1\x00\xe2\x00\xe3\x00\xe4\x00\xe5\x00\xe6\x00\xe7\x00\xe8\x00\xe9\x00\xea\x00\xeb\x00\xec\x00\xed\x00\xee\x00\xef\x00\xf0\x00\xf1\x00\xf2\x00\xf3\x00\xf4\x00\xf5\x00\xf6\x00\xf7\x00\xf8\x00\xf9\x00\xfa\x00\xfb\x00\xfc\x00\xfd\x00\xfe\x00\xff\x00\x09\x00\x0a\x00\x0b\x00\x0c\x00\x0d\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x20\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x4e\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x80\x00\x81\x00\x82\x00\x83\x00\x84\x00\x85\x00\x86\x00\x87\x00\x88\x00\x89\x00\x8a\x00\x8b\x00\x8c\x00\x8d\x00\x8e\x00\x8f\x00\x90\x00\x91\x00\x92\x00\x93\x00\x94\x00\x95\x00\x96\x00\x97\x00\x98\x00\x99\x00\x9a\x00\x9b\x00\x9c\x00\x9d\x00\x9e\x00\x9f\x00\xa0\x00\xa1\x00\xa2\x00\xa3\x00\xa4\x00\xa5\x00\xa6\x00\xa7\x00\xa8\x00\xa9\x00\xaa\x00\xab\x00\xac\x00\xad\x00\xae\x00\xaf\x00\xb0\x00\xb1\x00\xb2\x00\xb3\x00\xb4\x00\xb5\x00\xb6\x00\xb7\x00\xb8\x00\xb9\x00\xba\x00\xbb\x00\xbc\x00\xbd\x00\xbe\x00\xbf\x00\xc0\x00\xc1\x00\xc2\x00\xc3\x00\xc4\x00\xc5\x00\xc6\x00\xc7\x00\xc8\x00\xc9\x00\xca\x00\xcb\x00\xcc\x00\xcd\x00\xce\x00\xcf\x00\xd0\x00\xd1\x00\xd2\x00\xd3\x00\xd4\x00\xd5\x00\xd6\x00\xd7\x00\xd8\x00\xd9\x00\xda\x00\xdb\x00\xdc\x00\xdd\x00\xde\x00\xdf\x00\xe0\x00\xe1\x00\xe2\x00\xe3\x00\xe4\x00\xe5\x00\xe6\x00\xe7\x00\xe8\x00\xe9\x00\xea\x00\xeb\x00\xec\x00\xed\x00\xee\x00\xef\x00\xf0\x00\xf1\x00\xf2\x00\xf3\x00\xf4\x00\xf5\x00\xf6\x00\xf7\x00\xf8\x00\xf9\x00\xfa\x00\xfb\x00\xfc\x00\xfd\x00\xfe\x00\xff\x00\x09\x00\x0a\x00\x0b\x00\x0c\x00\x0d\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x20\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x4e\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x80\x00\x81\x00\x82\x00\x83\x00\x84\x00\x85\x00\x86\x00\x87\x00\x88\x00\x89\x00\x8a\x00\x8b\x00\x8c\x00\x8d\x00\x8e\x00\x8f\x00\x90\x00\x91\x00\x92\x00\x93\x00\x94\x00\x95\x00\x96\x00\x97\x00\x98\x00\x99\x00\x9a\x00\x9b\x00\x9c\x00\x9d\x00\x9e\x00\x9f\x00\xa0\x00\xa1\x00\xa2\x00\xa3\x00\xa4\x00\xa5\x00\xa6\x00\xa7\x00\xa8\x00\xa9\x00\xaa\x00\xab\x00\xac\x00\xad\x00\xae\x00\xaf\x00\xb0\x00\xb1\x00\xb2\x00\xb3\x00\xb4\x00\xb5\x00\xb6\x00\xb7\x00\xb8\x00\xb9\x00\xba\x00\xbb\x00\xbc\x00\xbd\x00\xbe\x00\xbf\x00\xc0\x00\xc1\x00\xc2\x00\xc3\x00\xc4\x00\xc5\x00\xc6\x00\xc7\x00\xc8\x00\xc9\x00\xca\x00\xcb\x00\xcc\x00\xcd\x00\xce\x00\xcf\x00\xd0\x00\xd1\x00\xd2\x00\xd3\x00\xd4\x00\xd5\x00\xd6\x00\xd7\x00\xd8\x00\xd9\x00\xda\x00\xdb\x00\xdc\x00\xdd\x00\xde\x00\xdf\x00\xe0\x00\xe1\x00\xe2\x00\xe3\x00\xe4\x00\xe5\x00\xe6\x00\xe7\x00\xe8\x00\xe9\x00\xea\x00\xeb\x00\xec\x00\xed\x00\xee\x00\xef\x00\xf0\x00\xf1\x00\xf2\x00\xf3\x00\xf4\x00\xf5\x00\xf6\x00\xf7\x00\xf8\x00\xf9\x00\xfa\x00\xfb\x00\xfc\x00\xfd\x00\xfe\x00\xff\x00\x09\x00\x0a\x00\x0b\x00\x0c\x00\x0d\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x20\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x54\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x80\x00\x81\x00\x82\x00\x83\x00\x84\x00\x85\x00\x86\x00\x87\x00\x88\x00\x89\x00\x8a\x00\x8b\x00\x8c\x00\x8d\x00\x8e\x00\x8f\x00\x90\x00\x91\x00\x92\x00\x93\x00\x94\x00\x95\x00\x96\x00\x97\x00\x98\x00\x99\x00\x9a\x00\x9b\x00\x9c\x00\x9d\x00\x9e\x00\x9f\x00\xa0\x00\xa1\x00\xa2\x00\xa3\x00\xa4\x00\xa5\x00\xa6\x00\xa7\x00\xa8\x00\xa9\x00\xaa\x00\xab\x00\xac\x00\xad\x00\xae\x00\xaf\x00\xb0\x00\xb1\x00\xb2\x00\xb3\x00\xb4\x00\xb5\x00\xb6\x00\xb7\x00\xb8\x00\xb9\x00\xba\x00\xbb\x00\xbc\x00\xbd\x00\xbe\x00\xbf\x00\xc0\x00\xc1\x00\xc2\x00\xc3\x00\xc4\x00\xc5\x00\xc6\x00\xc7\x00\xc8\x00\xc9\x00\xca\x00\xcb\x00\xcc\x00\xcd\x00\xce\x00\xcf\x00\xd0\x00\xd1\x00\xd2\x00\xd3\x00\xd4\x00\xd5\x00\xd6\x00\xd7\x00\xd8\x00\xd9\x00\xda\x00\xdb\x00\xdc\x00\xdd\x00\xde\x00\xdf\x00\xe0\x00\xe1\x00\xe2\x00\xe3\x00\xe4\x00\xe5\x00\xe6\x00\xe7\x00\xe8\x00\xe9\x00\xea\x00\xeb\x00\xec\x00\xed\x00\xee\x00\xef\x00\xf0\x00\xf1\x00\xf2\x00\xf3\x00\xf4\x00\xf5\x00\xf6\x00\xf7\x00\xf8\x00\xf9\x00\xfa\x00\xfb\x00\xfc\x00\xfd\x00\xfe\x00\xff\x00\x09\x00\x0a\x00\x0b\x00\x0c\x00\x0d\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x20\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x4c\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x80\x00\x81\x00\x82\x00\x83\x00\x84\x00\x85\x00\x86\x00\x87\x00\x88\x00\x89\x00\x8a\x00\x8b\x00\x8c\x00\x8d\x00\x8e\x00\x8f\x00\x90\x00\x91\x00\x92\x00\x93\x00\x94\x00\x95\x00\x96\x00\x97\x00\x98\x00\x99\x00\x9a\x00\x9b\x00\x9c\x00\x9d\x00\x9e\x00\x9f\x00\xa0\x00\xa1\x00\xa2\x00\xa3\x00\xa4\x00\xa5\x00\xa6\x00\xa7\x00\xa8\x00\xa9\x00\xaa\x00\xab\x00\xac\x00\xad\x00\xae\x00\xaf\x00\xb0\x00\xb1\x00\xb2\x00\xb3\x00\xb4\x00\xb5\x00\xb6\x00\xb7\x00\xb8\x00\xb9\x00\xba\x00\xbb\x00\xbc\x00\xbd\x00\xbe\x00\xbf\x00\xc0\x00\xc1\x00\xc2\x00\xc3\x00\xc4\x00\xc5\x00\xc6\x00\xc7\x00\xc8\x00\xc9\x00\xca\x00\xcb\x00\xcc\x00\xcd\x00\xce\x00\xcf\x00\xd0\x00\xd1\x00\xd2\x00\xd3\x00\xd4\x00\xd5\x00\xd6\x00\xd7\x00\xd8\x00\xd9\x00\xda\x00\xdb\x00\xdc\x00\xdd\x00\xde\x00\xdf\x00\xe0\x00\xe1\x00\xe2\x00\xe3\x00\xe4\x00\xe5\x00\xe6\x00\xe7\x00\xe8\x00\xe9\x00\xea\x00\xeb\x00\xec\x00\xed\x00\xee\x00\xef\x00\xf0\x00\xf1\x00\xf2\x00\xf3\x00\xf4\x00\xf5\x00\xf6\x00\xf7\x00\xf8\x00\xf9\x00\xfa\x00\xfb\x00\xfc\x00\xfd\x00\xfe\x00\xff\x00\x09\x00\x0a\x00\x0b\x00\x0c\x00\x0d\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x20\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x52\x00\x53\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x80\x00\x81\x00\x82\x00\x83\x00\x84\x00\x85\x00\x86\x00\x87\x00\x88\x00\x89\x00\x8a\x00\x8b\x00\x8c\x00\x8d\x00\x8e\x00\x8f\x00\x90\x00\x91\x00\x92\x00\x93\x00\x94\x00\x95\x00\x96\x00\x97\x00\x98\x00\x99\x00\x9a\x00\x9b\x00\x9c\x00\x9d\x00\x9e\x00\x9f\x00\xa0\x00\xa1\x00\xa2\x00\xa3\x00\xa4\x00\xa5\x00\xa6\x00\xa7\x00\xa8\x00\xa9\x00\xaa\x00\xab\x00\xac\x00\xad\x00\xae\x00\xaf\x00\xb0\x00\xb1\x00\xb2\x00\xb3\x00\xb4\x00\xb5\x00\xb6\x00\xb7\x00\xb8\x00\xb9\x00\xba\x00\xbb\x00\xbc\x00\xbd\x00\xbe\x00\xbf\x00\xc0\x00\xc1\x00\xc2\x00\xc3\x00\xc4\x00\xc5\x00\xc6\x00\xc7\x00\xc8\x00\xc9\x00\xca\x00\xcb\x00\xcc\x00\xcd\x00\xce\x00\xcf\x00\xd0\x00\xd1\x00\xd2\x00\xd3\x00\xd4\x00\xd5\x00\xd6\x00\xd7\x00\xd8\x00\xd9\x00\xda\x00\xdb\x00\xdc\x00\xdd\x00\xde\x00\xdf\x00\xe0\x00\xe1\x00\xe2\x00\xe3\x00\xe4\x00\xe5\x00\xe6\x00\xe7\x00\xe8\x00\xe9\x00\xea\x00\xeb\x00\xec\x00\xed\x00\xee\x00\xef\x00\xf0\x00\xf1\x00\xf2\x00\xf3\x00\xf4\x00\xf5\x00\xf6\x00\xf7\x00\xf8\x00\xf9\x00\xfa\x00\xfb\x00\xfc\x00\xfd\x00\xfe\x00\xff\x00\x09\x00\x0a\x00\x0b\x00\x0c\x00\x0d\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x20\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x44\x00\x45\x00\xff\xff\xff\xff\xff\xff\xff\xff\x4a\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x54\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x80\x00\x81\x00\x82\x00\x83\x00\x84\x00\x85\x00\x86\x00\x87\x00\x88\x00\x89\x00\x8a\x00\x8b\x00\x8c\x00\x8d\x00\x8e\x00\x8f\x00\x90\x00\x91\x00\x92\x00\x93\x00\x94\x00\x95\x00\x96\x00\x97\x00\x98\x00\x99\x00\x9a\x00\x9b\x00\x9c\x00\x9d\x00\x9e\x00\x9f\x00\xa0\x00\xa1\x00\xa2\x00\xa3\x00\xa4\x00\xa5\x00\xa6\x00\xa7\x00\xa8\x00\xa9\x00\xaa\x00\xab\x00\xac\x00\xad\x00\xae\x00\xaf\x00\xb0\x00\xb1\x00\xb2\x00\xb3\x00\xb4\x00\xb5\x00\xb6\x00\xb7\x00\xb8\x00\xb9\x00\xba\x00\xbb\x00\xbc\x00\xbd\x00\xbe\x00\xbf\x00\xc0\x00\xc1\x00\xc2\x00\xc3\x00\xc4\x00\xc5\x00\xc6\x00\xc7\x00\xc8\x00\xc9\x00\xca\x00\xcb\x00\xcc\x00\xcd\x00\xce\x00\xcf\x00\xd0\x00\xd1\x00\xd2\x00\xd3\x00\xd4\x00\xd5\x00\xd6\x00\xd7\x00\xd8\x00\xd9\x00\xda\x00\xdb\x00\xdc\x00\xdd\x00\xde\x00\xdf\x00\xe0\x00\xe1\x00\xe2\x00\xe3\x00\xe4\x00\xe5\x00\xe6\x00\xe7\x00\xe8\x00\xe9\x00\xea\x00\xeb\x00\xec\x00\xed\x00\xee\x00\xef\x00\xf0\x00\xf1\x00\xf2\x00\xf3\x00\xf4\x00\xf5\x00\xf6\x00\xf7\x00\xf8\x00\xf9\x00\xfa\x00\xfb\x00\xfc\x00\xfd\x00\xfe\x00\xff\x00\x09\x00\x0a\x00\x0b\x00\x0c\x00\x0d\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x20\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x52\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x80\x00\x81\x00\x82\x00\x83\x00\x84\x00\x85\x00\x86\x00\x87\x00\x88\x00\x89\x00\x8a\x00\x8b\x00\x8c\x00\x8d\x00\x8e\x00\x8f\x00\x90\x00\x91\x00\x92\x00\x93\x00\x94\x00\x95\x00\x96\x00\x97\x00\x98\x00\x99\x00\x9a\x00\x9b\x00\x9c\x00\x9d\x00\x9e\x00\x9f\x00\xa0\x00\xa1\x00\xa2\x00\xa3\x00\xa4\x00\xa5\x00\xa6\x00\xa7\x00\xa8\x00\xa9\x00\xaa\x00\xab\x00\xac\x00\xad\x00\xae\x00\xaf\x00\xb0\x00\xb1\x00\xb2\x00\xb3\x00\xb4\x00\xb5\x00\xb6\x00\xb7\x00\xb8\x00\xb9\x00\xba\x00\xbb\x00\xbc\x00\xbd\x00\xbe\x00\xbf\x00\xc0\x00\xc1\x00\xc2\x00\xc3\x00\xc4\x00\xc5\x00\xc6\x00\xc7\x00\xc8\x00\xc9\x00\xca\x00\xcb\x00\xcc\x00\xcd\x00\xce\x00\xcf\x00\xd0\x00\xd1\x00\xd2\x00\xd3\x00\xd4\x00\xd5\x00\xd6\x00\xd7\x00\xd8\x00\xd9\x00\xda\x00\xdb\x00\xdc\x00\xdd\x00\xde\x00\xdf\x00\xe0\x00\xe1\x00\xe2\x00\xe3\x00\xe4\x00\xe5\x00\xe6\x00\xe7\x00\xe8\x00\xe9\x00\xea\x00\xeb\x00\xec\x00\xed\x00\xee\x00\xef\x00\xf0\x00\xf1\x00\xf2\x00\xf3\x00\xf4\x00\xf5\x00\xf6\x00\xf7\x00\xf8\x00\xf9\x00\xfa\x00\xfb\x00\xfc\x00\xfd\x00\xfe\x00\xff\x00\x09\x00\x0a\x00\x0b\x00\x0c\x00\x0d\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x20\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x50\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x80\x00\x81\x00\x82\x00\x83\x00\x84\x00\x85\x00\x86\x00\x87\x00\x88\x00\x89\x00\x8a\x00\x8b\x00\x8c\x00\x8d\x00\x8e\x00\x8f\x00\x90\x00\x91\x00\x92\x00\x93\x00\x94\x00\x95\x00\x96\x00\x97\x00\x98\x00\x99\x00\x9a\x00\x9b\x00\x9c\x00\x9d\x00\x9e\x00\x9f\x00\xa0\x00\xa1\x00\xa2\x00\xa3\x00\xa4\x00\xa5\x00\xa6\x00\xa7\x00\xa8\x00\xa9\x00\xaa\x00\xab\x00\xac\x00\xad\x00\xae\x00\xaf\x00\xb0\x00\xb1\x00\xb2\x00\xb3\x00\xb4\x00\xb5\x00\xb6\x00\xb7\x00\xb8\x00\xb9\x00\xba\x00\xbb\x00\xbc\x00\xbd\x00\xbe\x00\xbf\x00\xc0\x00\xc1\x00\xc2\x00\xc3\x00\xc4\x00\xc5\x00\xc6\x00\xc7\x00\xc8\x00\xc9\x00\xca\x00\xcb\x00\xcc\x00\xcd\x00\xce\x00\xcf\x00\xd0\x00\xd1\x00\xd2\x00\xd3\x00\xd4\x00\xd5\x00\xd6\x00\xd7\x00\xd8\x00\xd9\x00\xda\x00\xdb\x00\xdc\x00\xdd\x00\xde\x00\xdf\x00\xe0\x00\xe1\x00\xe2\x00\xe3\x00\xe4\x00\xe5\x00\xe6\x00\xe7\x00\xe8\x00\xe9\x00\xea\x00\xeb\x00\xec\x00\xed\x00\xee\x00\xef\x00\xf0\x00\xf1\x00\xf2\x00\xf3\x00\xf4\x00\xf5\x00\xf6\x00\xf7\x00\xf8\x00\xf9\x00\xfa\x00\xfb\x00\xfc\x00\xfd\x00\xfe\x00\xff\x00\x09\x00\x0a\x00\x0b\x00\x0c\x00\x0d\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x20\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x54\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x80\x00\x81\x00\x82\x00\x83\x00\x84\x00\x85\x00\x86\x00\x87\x00\x88\x00\x89\x00\x8a\x00\x8b\x00\x8c\x00\x8d\x00\x8e\x00\x8f\x00\x90\x00\x91\x00\x92\x00\x93\x00\x94\x00\x95\x00\x96\x00\x97\x00\x98\x00\x99\x00\x9a\x00\x9b\x00\x9c\x00\x9d\x00\x9e\x00\x9f\x00\xa0\x00\xa1\x00\xa2\x00\xa3\x00\xa4\x00\xa5\x00\xa6\x00\xa7\x00\xa8\x00\xa9\x00\xaa\x00\xab\x00\xac\x00\xad\x00\xae\x00\xaf\x00\xb0\x00\xb1\x00\xb2\x00\xb3\x00\xb4\x00\xb5\x00\xb6\x00\xb7\x00\xb8\x00\xb9\x00\xba\x00\xbb\x00\xbc\x00\xbd\x00\xbe\x00\xbf\x00\xc0\x00\xc1\x00\xc2\x00\xc3\x00\xc4\x00\xc5\x00\xc6\x00\xc7\x00\xc8\x00\xc9\x00\xca\x00\xcb\x00\xcc\x00\xcd\x00\xce\x00\xcf\x00\xd0\x00\xd1\x00\xd2\x00\xd3\x00\xd4\x00\xd5\x00\xd6\x00\xd7\x00\xd8\x00\xd9\x00\xda\x00\xdb\x00\xdc\x00\xdd\x00\xde\x00\xdf\x00\xe0\x00\xe1\x00\xe2\x00\xe3\x00\xe4\x00\xe5\x00\xe6\x00\xe7\x00\xe8\x00\xe9\x00\xea\x00\xeb\x00\xec\x00\xed\x00\xee\x00\xef\x00\xf0\x00\xf1\x00\xf2\x00\xf3\x00\xf4\x00\xf5\x00\xf6\x00\xf7\x00\xf8\x00\xf9\x00\xfa\x00\xfb\x00\xfc\x00\xfd\x00\xfe\x00\xff\x00\x09\x00\x0a\x00\x0b\x00\x0c\x00\x0d\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x20\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x54\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x80\x00\x81\x00\x82\x00\x83\x00\x84\x00\x85\x00\x86\x00\x87\x00\x88\x00\x89\x00\x8a\x00\x8b\x00\x8c\x00\x8d\x00\x8e\x00\x8f\x00\x90\x00\x91\x00\x92\x00\x93\x00\x94\x00\x95\x00\x96\x00\x97\x00\x98\x00\x99\x00\x9a\x00\x9b\x00\x9c\x00\x9d\x00\x9e\x00\x9f\x00\xa0\x00\xa1\x00\xa2\x00\xa3\x00\xa4\x00\xa5\x00\xa6\x00\xa7\x00\xa8\x00\xa9\x00\xaa\x00\xab\x00\xac\x00\xad\x00\xae\x00\xaf\x00\xb0\x00\xb1\x00\xb2\x00\xb3\x00\xb4\x00\xb5\x00\xb6\x00\xb7\x00\xb8\x00\xb9\x00\xba\x00\xbb\x00\xbc\x00\xbd\x00\xbe\x00\xbf\x00\xc0\x00\xc1\x00\xc2\x00\xc3\x00\xc4\x00\xc5\x00\xc6\x00\xc7\x00\xc8\x00\xc9\x00\xca\x00\xcb\x00\xcc\x00\xcd\x00\xce\x00\xcf\x00\xd0\x00\xd1\x00\xd2\x00\xd3\x00\xd4\x00\xd5\x00\xd6\x00\xd7\x00\xd8\x00\xd9\x00\xda\x00\xdb\x00\xdc\x00\xdd\x00\xde\x00\xdf\x00\xe0\x00\xe1\x00\xe2\x00\xe3\x00\xe4\x00\xe5\x00\xe6\x00\xe7\x00\xe8\x00\xe9\x00\xea\x00\xeb\x00\xec\x00\xed\x00\xee\x00\xef\x00\xf0\x00\xf1\x00\xf2\x00\xf3\x00\xf4\x00\xf5\x00\xf6\x00\xf7\x00\xf8\x00\xf9\x00\xfa\x00\xfb\x00\xfc\x00\xfd\x00\xfe\x00\xff\x00\x09\x00\x0a\x00\x0b\x00\x0c\x00\x0d\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x20\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x4e\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x80\x00\x81\x00\x82\x00\x83\x00\x84\x00\x85\x00\x86\x00\x87\x00\x88\x00\x89\x00\x8a\x00\x8b\x00\x8c\x00\x8d\x00\x8e\x00\x8f\x00\x90\x00\x91\x00\x92\x00\x93\x00\x94\x00\x95\x00\x96\x00\x97\x00\x98\x00\x99\x00\x9a\x00\x9b\x00\x9c\x00\x9d\x00\x9e\x00\x9f\x00\xa0\x00\xa1\x00\xa2\x00\xa3\x00\xa4\x00\xa5\x00\xa6\x00\xa7\x00\xa8\x00\xa9\x00\xaa\x00\xab\x00\xac\x00\xad\x00\xae\x00\xaf\x00\xb0\x00\xb1\x00\xb2\x00\xb3\x00\xb4\x00\xb5\x00\xb6\x00\xb7\x00\xb8\x00\xb9\x00\xba\x00\xbb\x00\xbc\x00\xbd\x00\xbe\x00\xbf\x00\xc0\x00\xc1\x00\xc2\x00\xc3\x00\xc4\x00\xc5\x00\xc6\x00\xc7\x00\xc8\x00\xc9\x00\xca\x00\xcb\x00\xcc\x00\xcd\x00\xce\x00\xcf\x00\xd0\x00\xd1\x00\xd2\x00\xd3\x00\xd4\x00\xd5\x00\xd6\x00\xd7\x00\xd8\x00\xd9\x00\xda\x00\xdb\x00\xdc\x00\xdd\x00\xde\x00\xdf\x00\xe0\x00\xe1\x00\xe2\x00\xe3\x00\xe4\x00\xe5\x00\xe6\x00\xe7\x00\xe8\x00\xe9\x00\xea\x00\xeb\x00\xec\x00\xed\x00\xee\x00\xef\x00\xf0\x00\xf1\x00\xf2\x00\xf3\x00\xf4\x00\xf5\x00\xf6\x00\xf7\x00\xf8\x00\xf9\x00\xfa\x00\xfb\x00\xfc\x00\xfd\x00\xfe\x00\xff\x00\x09\x00\x0a\x00\x0b\x00\x0c\x00\x0d\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x20\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x54\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x80\x00\x81\x00\x82\x00\x83\x00\x84\x00\x85\x00\x86\x00\x87\x00\x88\x00\x89\x00\x8a\x00\x8b\x00\x8c\x00\x8d\x00\x8e\x00\x8f\x00\x90\x00\x91\x00\x92\x00\x93\x00\x94\x00\x95\x00\x96\x00\x97\x00\x98\x00\x99\x00\x9a\x00\x9b\x00\x9c\x00\x9d\x00\x9e\x00\x9f\x00\xa0\x00\xa1\x00\xa2\x00\xa3\x00\xa4\x00\xa5\x00\xa6\x00\xa7\x00\xa8\x00\xa9\x00\xaa\x00\xab\x00\xac\x00\xad\x00\xae\x00\xaf\x00\xb0\x00\xb1\x00\xb2\x00\xb3\x00\xb4\x00\xb5\x00\xb6\x00\xb7\x00\xb8\x00\xb9\x00\xba\x00\xbb\x00\xbc\x00\xbd\x00\xbe\x00\xbf\x00\xc0\x00\xc1\x00\xc2\x00\xc3\x00\xc4\x00\xc5\x00\xc6\x00\xc7\x00\xc8\x00\xc9\x00\xca\x00\xcb\x00\xcc\x00\xcd\x00\xce\x00\xcf\x00\xd0\x00\xd1\x00\xd2\x00\xd3\x00\xd4\x00\xd5\x00\xd6\x00\xd7\x00\xd8\x00\xd9\x00\xda\x00\xdb\x00\xdc\x00\xdd\x00\xde\x00\xdf\x00\xe0\x00\xe1\x00\xe2\x00\xe3\x00\xe4\x00\xe5\x00\xe6\x00\xe7\x00\xe8\x00\xe9\x00\xea\x00\xeb\x00\xec\x00\xed\x00\xee\x00\xef\x00\xf0\x00\xf1\x00\xf2\x00\xf3\x00\xf4\x00\xf5\x00\xf6\x00\xf7\x00\xf8\x00\xf9\x00\xfa\x00\xfb\x00\xfc\x00\xfd\x00\xfe\x00\xff\x00\x09\x00\x0a\x00\x0b\x00\x0c\x00\x0d\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x20\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x54\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x80\x00\x81\x00\x82\x00\x83\x00\x84\x00\x85\x00\x86\x00\x87\x00\x88\x00\x89\x00\x8a\x00\x8b\x00\x8c\x00\x8d\x00\x8e\x00\x8f\x00\x90\x00\x91\x00\x92\x00\x93\x00\x94\x00\x95\x00\x96\x00\x97\x00\x98\x00\x99\x00\x9a\x00\x9b\x00\x9c\x00\x9d\x00\x9e\x00\x9f\x00\xa0\x00\xa1\x00\xa2\x00\xa3\x00\xa4\x00\xa5\x00\xa6\x00\xa7\x00\xa8\x00\xa9\x00\xaa\x00\xab\x00\xac\x00\xad\x00\xae\x00\xaf\x00\xb0\x00\xb1\x00\xb2\x00\xb3\x00\xb4\x00\xb5\x00\xb6\x00\xb7\x00\xb8\x00\xb9\x00\xba\x00\xbb\x00\xbc\x00\xbd\x00\xbe\x00\xbf\x00\xc0\x00\xc1\x00\xc2\x00\xc3\x00\xc4\x00\xc5\x00\xc6\x00\xc7\x00\xc8\x00\xc9\x00\xca\x00\xcb\x00\xcc\x00\xcd\x00\xce\x00\xcf\x00\xd0\x00\xd1\x00\xd2\x00\xd3\x00\xd4\x00\xd5\x00\xd6\x00\xd7\x00\xd8\x00\xd9\x00\xda\x00\xdb\x00\xdc\x00\xdd\x00\xde\x00\xdf\x00\xe0\x00\xe1\x00\xe2\x00\xe3\x00\xe4\x00\xe5\x00\xe6\x00\xe7\x00\xe8\x00\xe9\x00\xea\x00\xeb\x00\xec\x00\xed\x00\xee\x00\xef\x00\xf0\x00\xf1\x00\xf2\x00\xf3\x00\xf4\x00\xf5\x00\xf6\x00\xf7\x00\xf8\x00\xf9\x00\xfa\x00\xfb\x00\xfc\x00\xfd\x00\xfe\x00\xff\x00\x09\x00\x0a\x00\x0b\x00\x0c\x00\x0d\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x20\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x44\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x80\x00\x81\x00\x82\x00\x83\x00\x84\x00\x85\x00\x86\x00\x87\x00\x88\x00\x89\x00\x8a\x00\x8b\x00\x8c\x00\x8d\x00\x8e\x00\x8f\x00\x90\x00\x91\x00\x92\x00\x93\x00\x94\x00\x95\x00\x96\x00\x97\x00\x98\x00\x99\x00\x9a\x00\x9b\x00\x9c\x00\x9d\x00\x9e\x00\x9f\x00\xa0\x00\xa1\x00\xa2\x00\xa3\x00\xa4\x00\xa5\x00\xa6\x00\xa7\x00\xa8\x00\xa9\x00\xaa\x00\xab\x00\xac\x00\xad\x00\xae\x00\xaf\x00\xb0\x00\xb1\x00\xb2\x00\xb3\x00\xb4\x00\xb5\x00\xb6\x00\xb7\x00\xb8\x00\xb9\x00\xba\x00\xbb\x00\xbc\x00\xbd\x00\xbe\x00\xbf\x00\xc0\x00\xc1\x00\xc2\x00\xc3\x00\xc4\x00\xc5\x00\xc6\x00\xc7\x00\xc8\x00\xc9\x00\xca\x00\xcb\x00\xcc\x00\xcd\x00\xce\x00\xcf\x00\xd0\x00\xd1\x00\xd2\x00\xd3\x00\xd4\x00\xd5\x00\xd6\x00\xd7\x00\xd8\x00\xd9\x00\xda\x00\xdb\x00\xdc\x00\xdd\x00\xde\x00\xdf\x00\xe0\x00\xe1\x00\xe2\x00\xe3\x00\xe4\x00\xe5\x00\xe6\x00\xe7\x00\xe8\x00\xe9\x00\xea\x00\xeb\x00\xec\x00\xed\x00\xee\x00\xef\x00\xf0\x00\xf1\x00\xf2\x00\xf3\x00\xf4\x00\xf5\x00\xf6\x00\xf7\x00\xf8\x00\xf9\x00\xfa\x00\xfb\x00\xfc\x00\xfd\x00\xfe\x00\xff\x00\x09\x00\x0a\x00\x0b\x00\x0c\x00\x0d\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x20\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x4e\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x80\x00\x81\x00\x82\x00\x83\x00\x84\x00\x85\x00\x86\x00\x87\x00\x88\x00\x89\x00\x8a\x00\x8b\x00\x8c\x00\x8d\x00\x8e\x00\x8f\x00\x90\x00\x91\x00\x92\x00\x93\x00\x94\x00\x95\x00\x96\x00\x97\x00\x98\x00\x99\x00\x9a\x00\x9b\x00\x9c\x00\x9d\x00\x9e\x00\x9f\x00\xa0\x00\xa1\x00\xa2\x00\xa3\x00\xa4\x00\xa5\x00\xa6\x00\xa7\x00\xa8\x00\xa9\x00\xaa\x00\xab\x00\xac\x00\xad\x00\xae\x00\xaf\x00\xb0\x00\xb1\x00\xb2\x00\xb3\x00\xb4\x00\xb5\x00\xb6\x00\xb7\x00\xb8\x00\xb9\x00\xba\x00\xbb\x00\xbc\x00\xbd\x00\xbe\x00\xbf\x00\xc0\x00\xc1\x00\xc2\x00\xc3\x00\xc4\x00\xc5\x00\xc6\x00\xc7\x00\xc8\x00\xc9\x00\xca\x00\xcb\x00\xcc\x00\xcd\x00\xce\x00\xcf\x00\xd0\x00\xd1\x00\xd2\x00\xd3\x00\xd4\x00\xd5\x00\xd6\x00\xd7\x00\xd8\x00\xd9\x00\xda\x00\xdb\x00\xdc\x00\xdd\x00\xde\x00\xdf\x00\xe0\x00\xe1\x00\xe2\x00\xe3\x00\xe4\x00\xe5\x00\xe6\x00\xe7\x00\xe8\x00\xe9\x00\xea\x00\xeb\x00\xec\x00\xed\x00\xee\x00\xef\x00\xf0\x00\xf1\x00\xf2\x00\xf3\x00\xf4\x00\xf5\x00\xf6\x00\xf7\x00\xf8\x00\xf9\x00\xfa\x00\xfb\x00\xfc\x00\xfd\x00\xfe\x00\xff\x00\x0a\x00\x21\x00\xff\xff\x23\x00\x24\x00\x25\x00\x26\x00\x27\x00\xff\xff\xff\xff\x2a\x00\x2b\x00\x2c\x00\x2d\x00\x2e\x00\x2f\x00\x30\x00\x31\x00\x32\x00\x33\x00\x34\x00\x35\x00\x36\x00\x37\x00\x38\x00\x39\x00\x3a\x00\xff\xff\x3c\x00\x3d\x00\x3e\x00\x3f\x00\xff\xff\x41\x00\x42\x00\x43\x00\x44\x00\x45\x00\x46\x00\x47\x00\x48\x00\x49\x00\x4a\x00\x4b\x00\x4c\x00\x4d\x00\x4e\x00\x4f\x00\x50\x00\x51\x00\x52\x00\x53\x00\x54\x00\x55\x00\x56\x00\x57\x00\x58\x00\x59\x00\x5a\x00\x5b\x00\x5c\x00\x5d\x00\x5e\x00\x5f\x00\x60\x00\x61\x00\x62\x00\x63\x00\x64\x00\x65\x00\x66\x00\x67\x00\x68\x00\x69\x00\x6a\x00\x6b\x00\x6c\x00\x6d\x00\x6e\x00\x6f\x00\x70\x00\x71\x00\x72\x00\x73\x00\x74\x00\x75\x00\x76\x00\x77\x00\x78\x00\x79\x00\x7a\x00\xff\xff\x7c\x00\xff\xff\x7e\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x80\x00\x81\x00\x82\x00\x83\x00\x84\x00\x85\x00\x86\x00\x87\x00\x88\x00\x89\x00\x8a\x00\x8b\x00\x8c\x00\x8d\x00\x8e\x00\x8f\x00\x90\x00\x91\x00\x92\x00\x93\x00\x94\x00\x95\x00\x96\x00\x97\x00\x98\x00\x99\x00\x9a\x00\x9b\x00\x9c\x00\x9d\x00\x9e\x00\x9f\x00\xa0\x00\xa1\x00\xa2\x00\xa3\x00\xa4\x00\xa5\x00\xa6\x00\xa7\x00\xa8\x00\xa9\x00\xaa\x00\xab\x00\xac\x00\xad\x00\xae\x00\xaf\x00\xb0\x00\xb1\x00\xb2\x00\xb3\x00\xb4\x00\xb5\x00\xb6\x00\xb7\x00\xb8\x00\xb9\x00\xba\x00\xbb\x00\xbc\x00\xbd\x00\xbe\x00\xbf\x00\xc0\x00\xc1\x00\xc2\x00\xc3\x00\xc4\x00\xc5\x00\xc6\x00\xc7\x00\xc8\x00\xc9\x00\xca\x00\xcb\x00\xcc\x00\xcd\x00\xce\x00\xcf\x00\xd0\x00\xd1\x00\xd2\x00\xd3\x00\xd4\x00\xd5\x00\xd6\x00\xd7\x00\xd8\x00\xd9\x00\xda\x00\xdb\x00\xdc\x00\xdd\x00\xde\x00\xdf\x00\xe0\x00\xe1\x00\xe2\x00\xe3\x00\xe4\x00\xe5\x00\xe6\x00\xe7\x00\xe8\x00\xe9\x00\xea\x00\xeb\x00\xec\x00\xed\x00\xee\x00\xef\x00\xf0\x00\xf1\x00\xf2\x00\xf3\x00\xf4\x00\xf5\x00\xf6\x00\xf7\x00\xf8\x00\xf9\x00\xfa\x00\xfb\x00\xfc\x00\xfd\x00\xfe\x00\xff\x00\x00\x00\x01\x00\x02\x00\x03\x00\x04\x00\x05\x00\x06\x00\x07\x00\x08\x00\x09\x00\x0a\x00\x0b\x00\x0c\x00\x0d\x00\x0e\x00\x0f\x00\x10\x00\x11\x00\x12\x00\x13\x00\x14\x00\x15\x00\x16\x00\x17\x00\x18\x00\x19\x00\x1a\x00\x1b\x00\x1c\x00\x1d\x00\x1e\x00\x1f\x00\x20\x00\xff\xff\x22\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x28\x00\x29\x00\xff\xff\xff\xff\xff\xff\x2d\x00\x2e\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x3b\x00\xff\xff\xff\xff\xff\xff\xff\xff\x40\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x7b\x00\xff\xff\x7d\x00\xff\xff\x7f\x00\x80\x00\x81\x00\x82\x00\x83\x00\x84\x00\x85\x00\x86\x00\x87\x00\x88\x00\x89\x00\x8a\x00\x8b\x00\x8c\x00\x8d\x00\x8e\x00\x8f\x00\x90\x00\x91\x00\x92\x00\x93\x00\x94\x00\x95\x00\x96\x00\x97\x00\x98\x00\x99\x00\x9a\x00\x9b\x00\x9c\x00\x9d\x00\x9e\x00\x9f\x00\xa0\x00\xa1\x00\xa2\x00\xa3\x00\xa4\x00\xa5\x00\xa6\x00\xa7\x00\xa8\x00\xa9\x00\xaa\x00\xab\x00\xac\x00\xad\x00\xae\x00\xaf\x00\xb0\x00\xb1\x00\xb2\x00\xb3\x00\xb4\x00\xb5\x00\xb6\x00\xb7\x00\xb8\x00\xb9\x00\xba\x00\xbb\x00\xbc\x00\xbd\x00\xbe\x00\xbf\x00\xc0\x00\xc1\x00\xc2\x00\xc3\x00\xc4\x00\xc5\x00\xc6\x00\xc7\x00\xc8\x00\xc9\x00\xca\x00\xcb\x00\xcc\x00\xcd\x00\xce\x00\xcf\x00\xd0\x00\xd1\x00\xd2\x00\xd3\x00\xd4\x00\xd5\x00\xd6\x00\xd7\x00\xd8\x00\xd9\x00\xda\x00\xdb\x00\xdc\x00\xdd\x00\xde\x00\xdf\x00\xe0\x00\xe1\x00\xe2\x00\xe3\x00\xe4\x00\xe5\x00\xe6\x00\xe7\x00\xe8\x00\xe9\x00\xea\x00\xeb\x00\xec\x00\xed\x00\xee\x00\xef\x00\xf0\x00\xf1\x00\xf2\x00\xf3\x00\xf4\x00\xf5\x00\xf6\x00\xf7\x00\xf8\x00\xf9\x00\xfa\x00\xfb\x00\xfc\x00\xfd\x00\xfe\x00\xff\x00\x00\x00\x01\x00\x02\x00\x03\x00\x04\x00\x05\x00\x06\x00\x07\x00\x08\x00\x09\x00\x0a\x00\x0b\x00\x0c\x00\x0d\x00\x0e\x00\x0f\x00\x10\x00\x11\x00\x12\x00\x13\x00\x14\x00\x15\x00\x16\x00\x17\x00\x18\x00\x19\x00\x1a\x00\x1b\x00\x1c\x00\x1d\x00\x1e\x00\x1f\x00\x20\x00\xff\xff\x22\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x28\x00\x29\x00\xff\xff\xff\xff\xff\xff\x2d\x00\x2e\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x3b\x00\xff\xff\xff\xff\xff\xff\xff\xff\x40\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x7b\x00\xff\xff\x7d\x00\xff\xff\x7f\x00\x80\x00\x81\x00\x82\x00\x83\x00\x84\x00\x85\x00\x86\x00\x87\x00\x88\x00\x89\x00\x8a\x00\x8b\x00\x8c\x00\x8d\x00\x8e\x00\x8f\x00\x90\x00\x91\x00\x92\x00\x93\x00\x94\x00\x95\x00\x96\x00\x97\x00\x98\x00\x99\x00\x9a\x00\x9b\x00\x9c\x00\x9d\x00\x9e\x00\x9f\x00\xa0\x00\xa1\x00\xa2\x00\xa3\x00\xa4\x00\xa5\x00\xa6\x00\xa7\x00\xa8\x00\xa9\x00\xaa\x00\xab\x00\xac\x00\xad\x00\xae\x00\xaf\x00\xb0\x00\xb1\x00\xb2\x00\xb3\x00\xb4\x00\xb5\x00\xb6\x00\xb7\x00\xb8\x00\xb9\x00\xba\x00\xbb\x00\xbc\x00\xbd\x00\xbe\x00\xbf\x00\xc0\x00\xc1\x00\xc2\x00\xc3\x00\xc4\x00\xc5\x00\xc6\x00\xc7\x00\xc8\x00\xc9\x00\xca\x00\xcb\x00\xcc\x00\xcd\x00\xce\x00\xcf\x00\xd0\x00\xd1\x00\xd2\x00\xd3\x00\xd4\x00\xd5\x00\xd6\x00\xd7\x00\xd8\x00\xd9\x00\xda\x00\xdb\x00\xdc\x00\xdd\x00\xde\x00\xdf\x00\xe0\x00\xe1\x00\xe2\x00\xe3\x00\xe4\x00\xe5\x00\xe6\x00\xe7\x00\xe8\x00\xe9\x00\xea\x00\xeb\x00\xec\x00\xed\x00\xee\x00\xef\x00\xf0\x00\xf1\x00\xf2\x00\xf3\x00\xf4\x00\xf5\x00\xf6\x00\xf7\x00\xf8\x00\xf9\x00\xfa\x00\xfb\x00\xfc\x00\xfd\x00\xfe\x00\xff\x00\x0a\x00\x21\x00\xff\xff\x23\x00\x24\x00\x25\x00\x26\x00\x27\x00\xff\xff\xff\xff\x2a\x00\x2b\x00\x2c\x00\x2d\x00\x2e\x00\x2f\x00\x30\x00\x31\x00\x32\x00\x33\x00\x34\x00\x35\x00\x36\x00\x37\x00\x38\x00\x39\x00\x3a\x00\xff\xff\x3c\x00\x3d\x00\x3e\x00\x3f\x00\xff\xff\x41\x00\x42\x00\x43\x00\x44\x00\x45\x00\x46\x00\x47\x00\x48\x00\x49\x00\x4a\x00\x4b\x00\x4c\x00\x4d\x00\x4e\x00\x4f\x00\x50\x00\x51\x00\x52\x00\x53\x00\x54\x00\x55\x00\x56\x00\x57\x00\x58\x00\x59\x00\x5a\x00\x5b\x00\x5c\x00\x5d\x00\x5e\x00\x5f\x00\x60\x00\x61\x00\x62\x00\x63\x00\x64\x00\x65\x00\x66\x00\x67\x00\x68\x00\x69\x00\x6a\x00\x6b\x00\x6c\x00\x6d\x00\x6e\x00\x6f\x00\x70\x00\x71\x00\x72\x00\x73\x00\x74\x00\x75\x00\x76\x00\x77\x00\x78\x00\x79\x00\x7a\x00\xff\xff\x7c\x00\xff\xff\x7e\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x80\x00\x81\x00\x82\x00\x83\x00\x84\x00\x85\x00\x86\x00\x87\x00\x88\x00\x89\x00\x8a\x00\x8b\x00\x8c\x00\x8d\x00\x8e\x00\x8f\x00\x90\x00\x91\x00\x92\x00\x93\x00\x94\x00\x95\x00\x96\x00\x97\x00\x98\x00\x99\x00\x9a\x00\x9b\x00\x9c\x00\x9d\x00\x9e\x00\x9f\x00\xa0\x00\xa1\x00\xa2\x00\xa3\x00\xa4\x00\xa5\x00\xa6\x00\xa7\x00\xa8\x00\xa9\x00\xaa\x00\xab\x00\xac\x00\xad\x00\xae\x00\xaf\x00\xb0\x00\xb1\x00\xb2\x00\xb3\x00\xb4\x00\xb5\x00\xb6\x00\xb7\x00\xb8\x00\xb9\x00\xba\x00\xbb\x00\xbc\x00\xbd\x00\xbe\x00\xbf\x00\xc0\x00\xc1\x00\xc2\x00\xc3\x00\xc4\x00\xc5\x00\xc6\x00\xc7\x00\xc8\x00\xc9\x00\xca\x00\xcb\x00\xcc\x00\xcd\x00\xce\x00\xcf\x00\xd0\x00\xd1\x00\xd2\x00\xd3\x00\xd4\x00\xd5\x00\xd6\x00\xd7\x00\xd8\x00\xd9\x00\xda\x00\xdb\x00\xdc\x00\xdd\x00\xde\x00\xdf\x00\xe0\x00\xe1\x00\xe2\x00\xe3\x00\xe4\x00\xe5\x00\xe6\x00\xe7\x00\xe8\x00\xe9\x00\xea\x00\xeb\x00\xec\x00\xed\x00\xee\x00\xef\x00\xf0\x00\xf1\x00\xf2\x00\xf3\x00\xf4\x00\xf5\x00\xf6\x00\xf7\x00\xf8\x00\xf9\x00\xfa\x00\xfb\x00\xfc\x00\xfd\x00\xfe\x00\xff\x00\x00\x00\x01\x00\x02\x00\x03\x00\x04\x00\x05\x00\x06\x00\x07\x00\x08\x00\x09\x00\x0a\x00\x0b\x00\x0c\x00\x0d\x00\x0e\x00\x0f\x00\x10\x00\x11\x00\x12\x00\x13\x00\x14\x00\x15\x00\x16\x00\x17\x00\x18\x00\x19\x00\x1a\x00\x1b\x00\x1c\x00\x1d\x00\x1e\x00\x1f\x00\x20\x00\xff\xff\x22\x00\xff\xff\xff\xff\xff\xff\xff\xff\x27\x00\x28\x00\x29\x00\xff\xff\xff\xff\xff\xff\xff\xff\x2e\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x3b\x00\xff\xff\xff\xff\xff\xff\xff\xff\x40\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x5c\x00\xff\xff\xff\xff\x5f\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x7b\x00\xff\xff\x7d\x00\xff\xff\x7f\x00\x80\x00\x81\x00\x82\x00\x83\x00\x84\x00\x85\x00\x86\x00\x87\x00\x88\x00\x89\x00\x8a\x00\x8b\x00\x8c\x00\x8d\x00\x8e\x00\x8f\x00\x90\x00\x91\x00\x92\x00\x93\x00\x94\x00\x95\x00\x96\x00\x97\x00\x98\x00\x99\x00\x9a\x00\x9b\x00\x9c\x00\x9d\x00\x9e\x00\x9f\x00\xa0\x00\xa1\x00\xa2\x00\xa3\x00\xa4\x00\xa5\x00\xa6\x00\xa7\x00\xa8\x00\xa9\x00\xaa\x00\xab\x00\xac\x00\xad\x00\xae\x00\xaf\x00\xb0\x00\xb1\x00\xb2\x00\xb3\x00\xb4\x00\xb5\x00\xb6\x00\xb7\x00\xb8\x00\xb9\x00\xba\x00\xbb\x00\xbc\x00\xbd\x00\xbe\x00\xbf\x00\xc0\x00\xc1\x00\xc2\x00\xc3\x00\xc4\x00\xc5\x00\xc6\x00\xc7\x00\xc8\x00\xc9\x00\xca\x00\xcb\x00\xcc\x00\xcd\x00\xce\x00\xcf\x00\xd0\x00\xd1\x00\xd2\x00\xd3\x00\xd4\x00\xd5\x00\xd6\x00\xd7\x00\xd8\x00\xd9\x00\xda\x00\xdb\x00\xdc\x00\xdd\x00\xde\x00\xdf\x00\xe0\x00\xe1\x00\xe2\x00\xe3\x00\xe4\x00\xe5\x00\xe6\x00\xe7\x00\xe8\x00\xe9\x00\xea\x00\xeb\x00\xec\x00\xed\x00\xee\x00\xef\x00\xf0\x00\xf1\x00\xf2\x00\xf3\x00\xf4\x00\xf5\x00\xf6\x00\xf7\x00\xf8\x00\xf9\x00\xfa\x00\xfb\x00\xfc\x00\xfd\x00\xfe\x00\xff\x00\x0a\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x21\x00\xff\xff\x23\x00\x24\x00\x25\x00\x26\x00\x27\x00\xff\xff\xff\xff\x2a\x00\x2b\x00\x2c\x00\x2d\x00\xff\xff\x2f\x00\x30\x00\x31\x00\x32\x00\x33\x00\x34\x00\x35\x00\x36\x00\x37\x00\x38\x00\x39\x00\x3a\x00\xff\xff\x3c\x00\x3d\x00\x3e\x00\x3f\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x5b\x00\x5c\x00\x5d\x00\x5e\x00\xff\xff\x60\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x7c\x00\xff\xff\x7e\x00\xff\xff\x80\x00\x81\x00\x82\x00\x83\x00\x84\x00\x85\x00\x86\x00\x87\x00\x88\x00\x89\x00\x8a\x00\x8b\x00\x8c\x00\x8d\x00\x8e\x00\x8f\x00\x90\x00\x91\x00\x92\x00\x93\x00\x94\x00\x95\x00\x96\x00\x97\x00\x98\x00\x99\x00\x9a\x00\x9b\x00\x9c\x00\x9d\x00\x9e\x00\x9f\x00\xa0\x00\xa1\x00\xa2\x00\xa3\x00\xa4\x00\xa5\x00\xa6\x00\xa7\x00\xa8\x00\xa9\x00\xaa\x00\xab\x00\xac\x00\xad\x00\xae\x00\xaf\x00\xb0\x00\xb1\x00\xb2\x00\xb3\x00\xb4\x00\xb5\x00\xb6\x00\xb7\x00\xb8\x00\xb9\x00\xba\x00\xbb\x00\xbc\x00\xbd\x00\xbe\x00\xbf\x00\xc0\x00\xc1\x00\xc2\x00\xc3\x00\xc4\x00\xc5\x00\xc6\x00\xc7\x00\xc8\x00\xc9\x00\xca\x00\xcb\x00\xcc\x00\xcd\x00\xce\x00\xcf\x00\xd0\x00\xd1\x00\xd2\x00\xd3\x00\xd4\x00\xd5\x00\xd6\x00\xd7\x00\xd8\x00\xd9\x00\xda\x00\xdb\x00\xdc\x00\xdd\x00\xde\x00\xdf\x00\xe0\x00\xe1\x00\xe2\x00\xe3\x00\xe4\x00\xe5\x00\xe6\x00\xe7\x00\xe8\x00\xe9\x00\xea\x00\xeb\x00\xec\x00\xed\x00\xee\x00\xef\x00\xf0\x00\xf1\x00\xf2\x00\xf3\x00\xf4\x00\xf5\x00\xf6\x00\xf7\x00\xf8\x00\xf9\x00\xfa\x00\xfb\x00\xfc\x00\xfd\x00\xfe\x00\xff\x00\x00\x00\x01\x00\x02\x00\x03\x00\x04\x00\x05\x00\x06\x00\x07\x00\x08\x00\x09\x00\x0a\x00\x0b\x00\x0c\x00\x0d\x00\x0e\x00\x0f\x00\x10\x00\x11\x00\x12\x00\x13\x00\x14\x00\x15\x00\x16\x00\x17\x00\x18\x00\x19\x00\x1a\x00\x1b\x00\x1c\x00\x1d\x00\x1e\x00\x1f\x00\x20\x00\xff\xff\x22\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x28\x00\x29\x00\xff\xff\xff\xff\xff\xff\xff\xff\x2e\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x3b\x00\xff\xff\xff\xff\xff\xff\xff\xff\x40\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x7b\x00\xff\xff\x7d\x00\xff\xff\x7f\x00\x80\x00\x81\x00\x82\x00\x83\x00\x84\x00\x85\x00\x86\x00\x87\x00\x88\x00\x89\x00\x8a\x00\x8b\x00\x8c\x00\x8d\x00\x8e\x00\x8f\x00\x90\x00\x91\x00\x92\x00\x93\x00\x94\x00\x95\x00\x96\x00\x97\x00\x98\x00\x99\x00\x9a\x00\x9b\x00\x9c\x00\x9d\x00\x9e\x00\x9f\x00\xa0\x00\xa1\x00\xa2\x00\xa3\x00\xa4\x00\xa5\x00\xa6\x00\xa7\x00\xa8\x00\xa9\x00\xaa\x00\xab\x00\xac\x00\xad\x00\xae\x00\xaf\x00\xb0\x00\xb1\x00\xb2\x00\xb3\x00\xb4\x00\xb5\x00\xb6\x00\xb7\x00\xb8\x00\xb9\x00\xba\x00\xbb\x00\xbc\x00\xbd\x00\xbe\x00\xbf\x00\xc0\x00\xc1\x00\xc2\x00\xc3\x00\xc4\x00\xc5\x00\xc6\x00\xc7\x00\xc8\x00\xc9\x00\xca\x00\xcb\x00\xcc\x00\xcd\x00\xce\x00\xcf\x00\xd0\x00\xd1\x00\xd2\x00\xd3\x00\xd4\x00\xd5\x00\xd6\x00\xd7\x00\xd8\x00\xd9\x00\xda\x00\xdb\x00\xdc\x00\xdd\x00\xde\x00\xdf\x00\xe0\x00\xe1\x00\xe2\x00\xe3\x00\xe4\x00\xe5\x00\xe6\x00\xe7\x00\xe8\x00\xe9\x00\xea\x00\xeb\x00\xec\x00\xed\x00\xee\x00\xef\x00\xf0\x00\xf1\x00\xf2\x00\xf3\x00\xf4\x00\xf5\x00\xf6\x00\xf7\x00\xf8\x00\xf9\x00\xfa\x00\xfb\x00\xfc\x00\xfd\x00\xfe\x00\xff\x00\x00\x00\x01\x00\x02\x00\x03\x00\x04\x00\x05\x00\x06\x00\x07\x00\x08\x00\x09\x00\x0a\x00\x0b\x00\x0c\x00\x0d\x00\x0e\x00\x0f\x00\x10\x00\x11\x00\x12\x00\x13\x00\x14\x00\x15\x00\x16\x00\x17\x00\x18\x00\x19\x00\x1a\x00\x1b\x00\x1c\x00\x1d\x00\x1e\x00\x1f\x00\x20\x00\xff\xff\x22\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x28\x00\x29\x00\xff\xff\xff\xff\xff\xff\x2d\x00\x2e\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x3b\x00\xff\xff\xff\xff\xff\xff\xff\xff\x40\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x7b\x00\xff\xff\x7d\x00\xff\xff\x7f\x00\x80\x00\x81\x00\x82\x00\x83\x00\x84\x00\x85\x00\x86\x00\x87\x00\x88\x00\x89\x00\x8a\x00\x8b\x00\x8c\x00\x8d\x00\x8e\x00\x8f\x00\x90\x00\x91\x00\x92\x00\x93\x00\x94\x00\x95\x00\x96\x00\x97\x00\x98\x00\x99\x00\x9a\x00\x9b\x00\x9c\x00\x9d\x00\x9e\x00\x9f\x00\xa0\x00\xa1\x00\xa2\x00\xa3\x00\xa4\x00\xa5\x00\xa6\x00\xa7\x00\xa8\x00\xa9\x00\xaa\x00\xab\x00\xac\x00\xad\x00\xae\x00\xaf\x00\xb0\x00\xb1\x00\xb2\x00\xb3\x00\xb4\x00\xb5\x00\xb6\x00\xb7\x00\xb8\x00\xb9\x00\xba\x00\xbb\x00\xbc\x00\xbd\x00\xbe\x00\xbf\x00\xc0\x00\xc1\x00\xc2\x00\xc3\x00\xc4\x00\xc5\x00\xc6\x00\xc7\x00\xc8\x00\xc9\x00\xca\x00\xcb\x00\xcc\x00\xcd\x00\xce\x00\xcf\x00\xd0\x00\xd1\x00\xd2\x00\xd3\x00\xd4\x00\xd5\x00\xd6\x00\xd7\x00\xd8\x00\xd9\x00\xda\x00\xdb\x00\xdc\x00\xdd\x00\xde\x00\xdf\x00\xe0\x00\xe1\x00\xe2\x00\xe3\x00\xe4\x00\xe5\x00\xe6\x00\xe7\x00\xe8\x00\xe9\x00\xea\x00\xeb\x00\xec\x00\xed\x00\xee\x00\xef\x00\xf0\x00\xf1\x00\xf2\x00\xf3\x00\xf4\x00\xf5\x00\xf6\x00\xf7\x00\xf8\x00\xf9\x00\xfa\x00\xfb\x00\xfc\x00\xfd\x00\xfe\x00\xff\x00\x00\x00\x01\x00\x02\x00\x03\x00\x04\x00\x05\x00\x06\x00\x07\x00\x08\x00\x09\x00\x0a\x00\x0b\x00\x0c\x00\x0d\x00\x0e\x00\x0f\x00\x10\x00\x11\x00\x12\x00\x13\x00\x14\x00\x15\x00\x16\x00\x17\x00\x18\x00\x19\x00\x1a\x00\x1b\x00\x1c\x00\x1d\x00\x1e\x00\x1f\x00\x20\x00\xff\xff\x22\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x28\x00\x29\x00\xff\xff\xff\xff\xff\xff\x2d\x00\x2e\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x3b\x00\xff\xff\xff\xff\xff\xff\xff\xff\x40\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x7b\x00\xff\xff\x7d\x00\xff\xff\x7f\x00\x80\x00\x81\x00\x82\x00\x83\x00\x84\x00\x85\x00\x86\x00\x87\x00\x88\x00\x89\x00\x8a\x00\x8b\x00\x8c\x00\x8d\x00\x8e\x00\x8f\x00\x90\x00\x91\x00\x92\x00\x93\x00\x94\x00\x95\x00\x96\x00\x97\x00\x98\x00\x99\x00\x9a\x00\x9b\x00\x9c\x00\x9d\x00\x9e\x00\x9f\x00\xa0\x00\xa1\x00\xa2\x00\xa3\x00\xa4\x00\xa5\x00\xa6\x00\xa7\x00\xa8\x00\xa9\x00\xaa\x00\xab\x00\xac\x00\xad\x00\xae\x00\xaf\x00\xb0\x00\xb1\x00\xb2\x00\xb3\x00\xb4\x00\xb5\x00\xb6\x00\xb7\x00\xb8\x00\xb9\x00\xba\x00\xbb\x00\xbc\x00\xbd\x00\xbe\x00\xbf\x00\xc0\x00\xc1\x00\xc2\x00\xc3\x00\xc4\x00\xc5\x00\xc6\x00\xc7\x00\xc8\x00\xc9\x00\xca\x00\xcb\x00\xcc\x00\xcd\x00\xce\x00\xcf\x00\xd0\x00\xd1\x00\xd2\x00\xd3\x00\xd4\x00\xd5\x00\xd6\x00\xd7\x00\xd8\x00\xd9\x00\xda\x00\xdb\x00\xdc\x00\xdd\x00\xde\x00\xdf\x00\xe0\x00\xe1\x00\xe2\x00\xe3\x00\xe4\x00\xe5\x00\xe6\x00\xe7\x00\xe8\x00\xe9\x00\xea\x00\xeb\x00\xec\x00\xed\x00\xee\x00\xef\x00\xf0\x00\xf1\x00\xf2\x00\xf3\x00\xf4\x00\xf5\x00\xf6\x00\xf7\x00\xf8\x00\xf9\x00\xfa\x00\xfb\x00\xfc\x00\xfd\x00\xfe\x00\xff\x00\x00\x00\x01\x00\x02\x00\x03\x00\x04\x00\x05\x00\x06\x00\x07\x00\x08\x00\x09\x00\x0a\x00\x0b\x00\x0c\x00\x0d\x00\x0e\x00\x0f\x00\x10\x00\x11\x00\x12\x00\x13\x00\x14\x00\x15\x00\x16\x00\x17\x00\x18\x00\x19\x00\x1a\x00\x1b\x00\x1c\x00\x1d\x00\x1e\x00\x1f\x00\x20\x00\xff\xff\x22\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x28\x00\x29\x00\xff\xff\xff\xff\xff\xff\xff\xff\x2e\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x3b\x00\xff\xff\xff\xff\xff\xff\xff\xff\x40\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x7b\x00\xff\xff\x7d\x00\xff\xff\x7f\x00\x80\x00\x81\x00\x82\x00\x83\x00\x84\x00\x85\x00\x86\x00\x87\x00\x88\x00\x89\x00\x8a\x00\x8b\x00\x8c\x00\x8d\x00\x8e\x00\x8f\x00\x90\x00\x91\x00\x92\x00\x93\x00\x94\x00\x95\x00\x96\x00\x97\x00\x98\x00\x99\x00\x9a\x00\x9b\x00\x9c\x00\x9d\x00\x9e\x00\x9f\x00\xa0\x00\xa1\x00\xa2\x00\xa3\x00\xa4\x00\xa5\x00\xa6\x00\xa7\x00\xa8\x00\xa9\x00\xaa\x00\xab\x00\xac\x00\xad\x00\xae\x00\xaf\x00\xb0\x00\xb1\x00\xb2\x00\xb3\x00\xb4\x00\xb5\x00\xb6\x00\xb7\x00\xb8\x00\xb9\x00\xba\x00\xbb\x00\xbc\x00\xbd\x00\xbe\x00\xbf\x00\xc0\x00\xc1\x00\xc2\x00\xc3\x00\xc4\x00\xc5\x00\xc6\x00\xc7\x00\xc8\x00\xc9\x00\xca\x00\xcb\x00\xcc\x00\xcd\x00\xce\x00\xcf\x00\xd0\x00\xd1\x00\xd2\x00\xd3\x00\xd4\x00\xd5\x00\xd6\x00\xd7\x00\xd8\x00\xd9\x00\xda\x00\xdb\x00\xdc\x00\xdd\x00\xde\x00\xdf\x00\xe0\x00\xe1\x00\xe2\x00\xe3\x00\xe4\x00\xe5\x00\xe6\x00\xe7\x00\xe8\x00\xe9\x00\xea\x00\xeb\x00\xec\x00\xed\x00\xee\x00\xef\x00\xf0\x00\xf1\x00\xf2\x00\xf3\x00\xf4\x00\xf5\x00\xf6\x00\xf7\x00\xf8\x00\xf9\x00\xfa\x00\xfb\x00\xfc\x00\xfd\x00\xfe\x00\xff\x00\x21\x00\xff\xff\x23\x00\x24\x00\x25\x00\x26\x00\x27\x00\xff\xff\xff\xff\x2a\x00\x2b\x00\x2c\x00\x2d\x00\x2e\x00\x2f\x00\x30\x00\x31\x00\x32\x00\x33\x00\x34\x00\x35\x00\x36\x00\x37\x00\x38\x00\x39\x00\x3a\x00\xff\xff\x3c\x00\x3d\x00\x3e\x00\x3f\x00\xff\xff\x41\x00\x42\x00\x43\x00\x44\x00\x45\x00\x46\x00\x47\x00\x48\x00\x49\x00\x4a\x00\x4b\x00\x4c\x00\x4d\x00\x4e\x00\x4f\x00\x50\x00\x51\x00\x52\x00\x53\x00\x54\x00\x55\x00\x56\x00\x57\x00\x58\x00\x59\x00\x5a\x00\x5b\x00\x5c\x00\x5d\x00\x5e\x00\x5f\x00\x60\x00\x61\x00\x62\x00\x63\x00\x64\x00\x65\x00\x66\x00\x67\x00\x68\x00\x69\x00\x6a\x00\x6b\x00\x6c\x00\x6d\x00\x6e\x00\x6f\x00\x70\x00\x71\x00\x72\x00\x73\x00\x74\x00\x75\x00\x76\x00\x77\x00\x78\x00\x79\x00\x7a\x00\xff\xff\x7c\x00\x21\x00\x7e\x00\x23\x00\x24\x00\x25\x00\x26\x00\x27\x00\xff\xff\xff\xff\x2a\x00\x2b\x00\x2c\x00\x2d\x00\x2e\x00\x2f\x00\x30\x00\x31\x00\x32\x00\x33\x00\x34\x00\x35\x00\x36\x00\x37\x00\x38\x00\x39\x00\x3a\x00\xff\xff\x3c\x00\x3d\x00\x3e\x00\x3f\x00\xff\xff\x41\x00\x42\x00\x43\x00\x44\x00\x45\x00\x46\x00\x47\x00\x48\x00\x49\x00\x4a\x00\x4b\x00\x4c\x00\x4d\x00\x4e\x00\x4f\x00\x50\x00\x51\x00\x52\x00\x53\x00\x54\x00\x55\x00\x56\x00\x57\x00\x58\x00\x59\x00\x5a\x00\x5b\x00\x5c\x00\x5d\x00\x5e\x00\x5f\x00\x60\x00\x61\x00\x62\x00\x63\x00\x64\x00\x65\x00\x66\x00\x67\x00\x68\x00\x69\x00\x6a\x00\x6b\x00\x6c\x00\x6d\x00\x6e\x00\x6f\x00\x70\x00\x71\x00\x72\x00\x73\x00\x74\x00\x75\x00\x76\x00\x77\x00\x78\x00\x79\x00\x7a\x00\xff\xff\x7c\x00\x21\x00\x7e\x00\x23\x00\x24\x00\x25\x00\x26\x00\x27\x00\xff\xff\xff\xff\x2a\x00\x2b\x00\x2c\x00\x2d\x00\x2e\x00\x2f\x00\x30\x00\x31\x00\x32\x00\x33\x00\x34\x00\x35\x00\x36\x00\x37\x00\x38\x00\x39\x00\x3a\x00\xff\xff\x3c\x00\x3d\x00\x3e\x00\x3f\x00\xff\xff\x41\x00\x42\x00\x43\x00\x44\x00\x45\x00\x46\x00\x47\x00\x48\x00\x49\x00\x4a\x00\x4b\x00\x4c\x00\x4d\x00\x4e\x00\x4f\x00\x50\x00\x51\x00\x52\x00\x53\x00\x54\x00\x55\x00\x56\x00\x57\x00\x58\x00\x59\x00\x5a\x00\x5b\x00\x5c\x00\x5d\x00\x5e\x00\x5f\x00\x60\x00\x61\x00\x62\x00\x63\x00\x64\x00\x65\x00\x66\x00\x67\x00\x68\x00\x69\x00\x6a\x00\x6b\x00\x6c\x00\x6d\x00\x6e\x00\x6f\x00\x70\x00\x71\x00\x72\x00\x73\x00\x74\x00\x75\x00\x76\x00\x77\x00\x78\x00\x79\x00\x7a\x00\xff\xff\x7c\x00\x21\x00\x7e\x00\x23\x00\x24\x00\x25\x00\x26\x00\x27\x00\xff\xff\xff\xff\x2a\x00\x2b\x00\x2c\x00\x2d\x00\x2e\x00\x2f\x00\x30\x00\x31\x00\x32\x00\x33\x00\x34\x00\x35\x00\x36\x00\x37\x00\x38\x00\x39\x00\x3a\x00\xff\xff\x3c\x00\x3d\x00\x3e\x00\x3f\x00\xff\xff\x41\x00\x42\x00\x43\x00\x44\x00\x45\x00\x46\x00\x47\x00\x48\x00\x49\x00\x4a\x00\x4b\x00\x4c\x00\x4d\x00\x4e\x00\x4f\x00\x50\x00\x51\x00\x52\x00\x53\x00\x54\x00\x55\x00\x56\x00\x57\x00\x58\x00\x59\x00\x5a\x00\x5b\x00\x5c\x00\x5d\x00\x5e\x00\x5f\x00\x60\x00\x61\x00\x62\x00\x63\x00\x64\x00\x65\x00\x66\x00\x67\x00\x68\x00\x69\x00\x6a\x00\x6b\x00\x6c\x00\x6d\x00\x6e\x00\x6f\x00\x70\x00\x71\x00\x72\x00\x73\x00\x74\x00\x75\x00\x76\x00\x77\x00\x78\x00\x79\x00\x7a\x00\xff\xff\x7c\x00\x21\x00\x7e\x00\x23\x00\x24\x00\x25\x00\x26\x00\x27\x00\xff\xff\xff\xff\x2a\x00\x2b\x00\x2c\x00\x2d\x00\x2e\x00\x2f\x00\x30\x00\x31\x00\x32\x00\x33\x00\x34\x00\x35\x00\x36\x00\x37\x00\x38\x00\x39\x00\x3a\x00\xff\xff\x3c\x00\x3d\x00\x3e\x00\x3f\x00\xff\xff\x41\x00\x42\x00\x43\x00\x44\x00\x45\x00\x46\x00\x47\x00\x48\x00\x49\x00\x4a\x00\x4b\x00\x4c\x00\x4d\x00\x4e\x00\x4f\x00\x50\x00\x51\x00\x52\x00\x53\x00\x54\x00\x55\x00\x56\x00\x57\x00\x58\x00\x59\x00\x5a\x00\x5b\x00\x5c\x00\x5d\x00\x5e\x00\x5f\x00\x60\x00\x61\x00\x62\x00\x63\x00\x64\x00\x65\x00\x66\x00\x67\x00\x68\x00\x69\x00\x6a\x00\x6b\x00\x6c\x00\x6d\x00\x6e\x00\x6f\x00\x70\x00\x71\x00\x72\x00\x73\x00\x74\x00\x75\x00\x76\x00\x77\x00\x78\x00\x79\x00\x7a\x00\xff\xff\x7c\x00\x21\x00\x7e\x00\x23\x00\x24\x00\x25\x00\x26\x00\x27\x00\xff\xff\xff\xff\x2a\x00\x2b\x00\x2c\x00\x2d\x00\x2e\x00\x2f\x00\x30\x00\x31\x00\x32\x00\x33\x00\x34\x00\x35\x00\x36\x00\x37\x00\x38\x00\x39\x00\x3a\x00\xff\xff\x3c\x00\x3d\x00\x3e\x00\x3f\x00\xff\xff\x41\x00\x42\x00\x43\x00\x44\x00\x45\x00\x46\x00\x47\x00\x48\x00\x49\x00\x4a\x00\x4b\x00\x4c\x00\x4d\x00\x4e\x00\x4f\x00\x50\x00\x51\x00\x52\x00\x53\x00\x54\x00\x55\x00\x56\x00\x57\x00\x58\x00\x59\x00\x5a\x00\x5b\x00\x5c\x00\x5d\x00\x5e\x00\x5f\x00\x60\x00\x61\x00\x62\x00\x63\x00\x64\x00\x65\x00\x66\x00\x67\x00\x68\x00\x69\x00\x6a\x00\x6b\x00\x6c\x00\x6d\x00\x6e\x00\x6f\x00\x70\x00\x71\x00\x72\x00\x73\x00\x74\x00\x75\x00\x76\x00\x77\x00\x78\x00\x79\x00\x7a\x00\xff\xff\x7c\x00\x21\x00\x7e\x00\x23\x00\x24\x00\x25\x00\x26\x00\x27\x00\xff\xff\xff\xff\x2a\x00\x2b\x00\x2c\x00\x2d\x00\x2e\x00\x2f\x00\x30\x00\x31\x00\x32\x00\x33\x00\x34\x00\x35\x00\x36\x00\x37\x00\x38\x00\x39\x00\x3a\x00\xff\xff\x3c\x00\x3d\x00\x3e\x00\x3f\x00\xff\xff\x41\x00\x42\x00\x43\x00\x44\x00\x45\x00\x46\x00\x47\x00\x48\x00\x49\x00\x4a\x00\x4b\x00\x4c\x00\x4d\x00\x4e\x00\x4f\x00\x50\x00\x51\x00\x52\x00\x53\x00\x54\x00\x55\x00\x56\x00\x57\x00\x58\x00\x59\x00\x5a\x00\x5b\x00\x5c\x00\x5d\x00\x5e\x00\x5f\x00\x60\x00\x61\x00\x62\x00\x63\x00\x64\x00\x65\x00\x66\x00\x67\x00\x68\x00\x69\x00\x6a\x00\x6b\x00\x6c\x00\x6d\x00\x6e\x00\x6f\x00\x70\x00\x71\x00\x72\x00\x73\x00\x74\x00\x75\x00\x76\x00\x77\x00\x78\x00\x79\x00\x7a\x00\xff\xff\x7c\x00\x21\x00\x7e\x00\x23\x00\x24\x00\x25\x00\x26\x00\x27\x00\xff\xff\xff\xff\x2a\x00\x2b\x00\x2c\x00\x2d\x00\x2e\x00\x2f\x00\x30\x00\x31\x00\x32\x00\x33\x00\x34\x00\x35\x00\x36\x00\x37\x00\x38\x00\x39\x00\x3a\x00\xff\xff\x3c\x00\x3d\x00\x3e\x00\x3f\x00\xff\xff\x41\x00\x42\x00\x43\x00\x44\x00\x45\x00\x46\x00\x47\x00\x48\x00\x49\x00\x4a\x00\x4b\x00\x4c\x00\x4d\x00\x4e\x00\x4f\x00\x50\x00\x51\x00\x52\x00\x53\x00\x54\x00\x55\x00\x56\x00\x57\x00\x58\x00\x59\x00\x5a\x00\x5b\x00\x5c\x00\x5d\x00\x5e\x00\x5f\x00\x60\x00\x61\x00\x62\x00\x63\x00\x64\x00\x65\x00\x66\x00\x67\x00\x68\x00\x69\x00\x6a\x00\x6b\x00\x6c\x00\x6d\x00\x6e\x00\x6f\x00\x70\x00\x71\x00\x72\x00\x73\x00\x74\x00\x75\x00\x76\x00\x77\x00\x78\x00\x79\x00\x7a\x00\xff\xff\x7c\x00\x21\x00\x7e\x00\x23\x00\x24\x00\x25\x00\x26\x00\x27\x00\xff\xff\xff\xff\x2a\x00\x2b\x00\x2c\x00\x2d\x00\x2e\x00\x2f\x00\x30\x00\x31\x00\x32\x00\x33\x00\x34\x00\x35\x00\x36\x00\x37\x00\x38\x00\x39\x00\x3a\x00\xff\xff\x3c\x00\x3d\x00\x3e\x00\x3f\x00\xff\xff\x41\x00\x42\x00\x43\x00\x44\x00\x45\x00\x46\x00\x47\x00\x48\x00\x49\x00\x4a\x00\x4b\x00\x4c\x00\x4d\x00\x4e\x00\x4f\x00\x50\x00\x51\x00\x52\x00\x53\x00\x54\x00\x55\x00\x56\x00\x57\x00\x58\x00\x59\x00\x5a\x00\x5b\x00\x5c\x00\x5d\x00\x5e\x00\x5f\x00\x60\x00\x61\x00\x62\x00\x63\x00\x64\x00\x65\x00\x66\x00\x67\x00\x68\x00\x69\x00\x6a\x00\x6b\x00\x6c\x00\x6d\x00\x6e\x00\x6f\x00\x70\x00\x71\x00\x72\x00\x73\x00\x74\x00\x75\x00\x76\x00\x77\x00\x78\x00\x79\x00\x7a\x00\xff\xff\x7c\x00\x21\x00\x7e\x00\x23\x00\x24\x00\x25\x00\x26\x00\x27\x00\xff\xff\xff\xff\x2a\x00\x2b\x00\x2c\x00\x2d\x00\x2e\x00\x2f\x00\x30\x00\x31\x00\x32\x00\x33\x00\x34\x00\x35\x00\x36\x00\x37\x00\x38\x00\x39\x00\x3a\x00\xff\xff\x3c\x00\x3d\x00\x3e\x00\x3f\x00\xff\xff\x41\x00\x42\x00\x43\x00\x44\x00\x45\x00\x46\x00\x47\x00\x48\x00\x49\x00\x4a\x00\x4b\x00\x4c\x00\x4d\x00\x4e\x00\x4f\x00\x50\x00\x51\x00\x52\x00\x53\x00\x54\x00\x55\x00\x56\x00\x57\x00\x58\x00\x59\x00\x5a\x00\x5b\x00\x5c\x00\x5d\x00\x5e\x00\x5f\x00\x60\x00\x61\x00\x62\x00\x63\x00\x64\x00\x65\x00\x66\x00\x67\x00\x68\x00\x69\x00\x6a\x00\x6b\x00\x6c\x00\x6d\x00\x6e\x00\x6f\x00\x70\x00\x71\x00\x72\x00\x73\x00\x74\x00\x75\x00\x76\x00\x77\x00\x78\x00\x79\x00\x7a\x00\xff\xff\x7c\x00\x21\x00\x7e\x00\x23\x00\x24\x00\x25\x00\x26\x00\x27\x00\xff\xff\xff\xff\x2a\x00\x2b\x00\x2c\x00\x2d\x00\x2e\x00\x2f\x00\x30\x00\x31\x00\x32\x00\x33\x00\x34\x00\x35\x00\x36\x00\x37\x00\x38\x00\x39\x00\x3a\x00\xff\xff\x3c\x00\x3d\x00\x3e\x00\x3f\x00\xff\xff\x41\x00\x42\x00\x43\x00\x44\x00\x45\x00\x46\x00\x47\x00\x48\x00\x49\x00\x4a\x00\x4b\x00\x4c\x00\x4d\x00\x4e\x00\x4f\x00\x50\x00\x51\x00\x52\x00\x53\x00\x54\x00\x55\x00\x56\x00\x57\x00\x58\x00\x59\x00\x5a\x00\x5b\x00\x5c\x00\x5d\x00\x5e\x00\x5f\x00\x60\x00\x61\x00\x62\x00\x63\x00\x64\x00\x65\x00\x66\x00\x67\x00\x68\x00\x69\x00\x6a\x00\x6b\x00\x6c\x00\x6d\x00\x6e\x00\x6f\x00\x70\x00\x71\x00\x72\x00\x73\x00\x74\x00\x75\x00\x76\x00\x77\x00\x78\x00\x79\x00\x7a\x00\xff\xff\x7c\x00\x21\x00\x7e\x00\x23\x00\x24\x00\x25\x00\x26\x00\x27\x00\xff\xff\xff\xff\x2a\x00\x2b\x00\x2c\x00\x2d\x00\x2e\x00\x2f\x00\x30\x00\x31\x00\x32\x00\x33\x00\x34\x00\x35\x00\x36\x00\x37\x00\x38\x00\x39\x00\x3a\x00\xff\xff\x3c\x00\x3d\x00\x3e\x00\x3f\x00\xff\xff\x41\x00\x42\x00\x43\x00\x44\x00\x45\x00\x46\x00\x47\x00\x48\x00\x49\x00\x4a\x00\x4b\x00\x4c\x00\x4d\x00\x4e\x00\x4f\x00\x50\x00\x51\x00\x52\x00\x53\x00\x54\x00\x55\x00\x56\x00\x57\x00\x58\x00\x59\x00\x5a\x00\x5b\x00\x5c\x00\x5d\x00\x5e\x00\x5f\x00\x60\x00\x61\x00\x62\x00\x63\x00\x64\x00\x65\x00\x66\x00\x67\x00\x68\x00\x69\x00\x6a\x00\x6b\x00\x6c\x00\x6d\x00\x6e\x00\x6f\x00\x70\x00\x71\x00\x72\x00\x73\x00\x74\x00\x75\x00\x76\x00\x77\x00\x78\x00\x79\x00\x7a\x00\xff\xff\x7c\x00\x21\x00\x7e\x00\x23\x00\x24\x00\x25\x00\x26\x00\x27\x00\xff\xff\xff\xff\x2a\x00\x2b\x00\x2c\x00\x2d\x00\x2e\x00\x2f\x00\x30\x00\x31\x00\x32\x00\x33\x00\x34\x00\x35\x00\x36\x00\x37\x00\x38\x00\x39\x00\x3a\x00\xff\xff\x3c\x00\x3d\x00\x3e\x00\x3f\x00\xff\xff\x41\x00\x42\x00\x43\x00\x44\x00\x45\x00\x46\x00\x47\x00\x48\x00\x49\x00\x4a\x00\x4b\x00\x4c\x00\x4d\x00\x4e\x00\x4f\x00\x50\x00\x51\x00\x52\x00\x53\x00\x54\x00\x55\x00\x56\x00\x57\x00\x58\x00\x59\x00\x5a\x00\x5b\x00\x5c\x00\x5d\x00\x5e\x00\x5f\x00\x60\x00\x61\x00\x62\x00\x63\x00\x64\x00\x65\x00\x66\x00\x67\x00\x68\x00\x69\x00\x6a\x00\x6b\x00\x6c\x00\x6d\x00\x6e\x00\x6f\x00\x70\x00\x71\x00\x72\x00\x73\x00\x74\x00\x75\x00\x76\x00\x77\x00\x78\x00\x79\x00\x7a\x00\xff\xff\x7c\x00\x21\x00\x7e\x00\x23\x00\x24\x00\x25\x00\x26\x00\x27\x00\xff\xff\xff\xff\x2a\x00\x2b\x00\x2c\x00\x2d\x00\x2e\x00\x2f\x00\x30\x00\x31\x00\x32\x00\x33\x00\x34\x00\x35\x00\x36\x00\x37\x00\x38\x00\x39\x00\x3a\x00\xff\xff\x3c\x00\x3d\x00\x3e\x00\x3f\x00\xff\xff\x41\x00\x42\x00\x43\x00\x44\x00\x45\x00\x46\x00\x47\x00\x48\x00\x49\x00\x4a\x00\x4b\x00\x4c\x00\x4d\x00\x4e\x00\x4f\x00\x50\x00\x51\x00\x52\x00\x53\x00\x54\x00\x55\x00\x56\x00\x57\x00\x58\x00\x59\x00\x5a\x00\x5b\x00\x5c\x00\x5d\x00\x5e\x00\x5f\x00\x60\x00\x61\x00\x62\x00\x63\x00\x64\x00\x65\x00\x66\x00\x67\x00\x68\x00\x69\x00\x6a\x00\x6b\x00\x6c\x00\x6d\x00\x6e\x00\x6f\x00\x70\x00\x71\x00\x72\x00\x73\x00\x74\x00\x75\x00\x76\x00\x77\x00\x78\x00\x79\x00\x7a\x00\xff\xff\x7c\x00\x21\x00\x7e\x00\x23\x00\x24\x00\x25\x00\x26\x00\x27\x00\xff\xff\xff\xff\x2a\x00\x2b\x00\x2c\x00\x2d\x00\x2e\x00\x2f\x00\x30\x00\x31\x00\x32\x00\x33\x00\x34\x00\x35\x00\x36\x00\x37\x00\x38\x00\x39\x00\x3a\x00\xff\xff\x3c\x00\x3d\x00\x3e\x00\x3f\x00\xff\xff\x41\x00\x42\x00\x43\x00\x44\x00\x45\x00\x46\x00\x47\x00\x48\x00\x49\x00\x4a\x00\x4b\x00\x4c\x00\x4d\x00\x4e\x00\x4f\x00\x50\x00\x51\x00\x52\x00\x53\x00\x54\x00\x55\x00\x56\x00\x57\x00\x58\x00\x59\x00\x5a\x00\x5b\x00\x5c\x00\x5d\x00\x5e\x00\x5f\x00\x60\x00\x61\x00\x62\x00\x63\x00\x64\x00\x65\x00\x66\x00\x67\x00\x68\x00\x69\x00\x6a\x00\x6b\x00\x6c\x00\x6d\x00\x6e\x00\x6f\x00\x70\x00\x71\x00\x72\x00\x73\x00\x74\x00\x75\x00\x76\x00\x77\x00\x78\x00\x79\x00\x7a\x00\xff\xff\x7c\x00\x21\x00\x7e\x00\x23\x00\x24\x00\x25\x00\x26\x00\x27\x00\xff\xff\xff\xff\x2a\x00\x2b\x00\x2c\x00\x2d\x00\x2e\x00\x2f\x00\x30\x00\x31\x00\x32\x00\x33\x00\x34\x00\x35\x00\x36\x00\x37\x00\x38\x00\x39\x00\x3a\x00\xff\xff\x3c\x00\x3d\x00\x3e\x00\x3f\x00\xff\xff\x41\x00\x42\x00\x43\x00\x44\x00\x45\x00\x46\x00\x47\x00\x48\x00\x49\x00\x4a\x00\x4b\x00\x4c\x00\x4d\x00\x4e\x00\x4f\x00\x50\x00\x51\x00\x52\x00\x53\x00\x54\x00\x55\x00\x56\x00\x57\x00\x58\x00\x59\x00\x5a\x00\x5b\x00\x5c\x00\x5d\x00\x5e\x00\x5f\x00\x60\x00\x61\x00\x62\x00\x63\x00\x64\x00\x65\x00\x66\x00\x67\x00\x68\x00\x69\x00\x6a\x00\x6b\x00\x6c\x00\x6d\x00\x6e\x00\x6f\x00\x70\x00\x71\x00\x72\x00\x73\x00\x74\x00\x75\x00\x76\x00\x77\x00\x78\x00\x79\x00\x7a\x00\xff\xff\x7c\x00\x21\x00\x7e\x00\x23\x00\x24\x00\x25\x00\x26\x00\x27\x00\xff\xff\xff\xff\x2a\x00\x2b\x00\x2c\x00\x2d\x00\x2e\x00\x2f\x00\x30\x00\x31\x00\x32\x00\x33\x00\x34\x00\x35\x00\x36\x00\x37\x00\x38\x00\x39\x00\x3a\x00\xff\xff\x3c\x00\x3d\x00\x3e\x00\x3f\x00\xff\xff\x41\x00\x42\x00\x43\x00\x44\x00\x45\x00\x46\x00\x47\x00\x48\x00\x49\x00\x4a\x00\x4b\x00\x4c\x00\x4d\x00\x4e\x00\x4f\x00\x50\x00\x51\x00\x52\x00\x53\x00\x54\x00\x55\x00\x56\x00\x57\x00\x58\x00\x59\x00\x5a\x00\x5b\x00\x5c\x00\x5d\x00\x5e\x00\x5f\x00\x60\x00\x61\x00\x62\x00\x63\x00\x64\x00\x65\x00\x66\x00\x67\x00\x68\x00\x69\x00\x6a\x00\x6b\x00\x6c\x00\x6d\x00\x6e\x00\x6f\x00\x70\x00\x71\x00\x72\x00\x73\x00\x74\x00\x75\x00\x76\x00\x77\x00\x78\x00\x79\x00\x7a\x00\xff\xff\x7c\x00\x21\x00\x7e\x00\x23\x00\x24\x00\x25\x00\x26\x00\x27\x00\xff\xff\xff\xff\x2a\x00\x2b\x00\x2c\x00\x2d\x00\x2e\x00\x2f\x00\x30\x00\x31\x00\x32\x00\x33\x00\x34\x00\x35\x00\x36\x00\x37\x00\x38\x00\x39\x00\x3a\x00\xff\xff\x3c\x00\x3d\x00\x3e\x00\x3f\x00\xff\xff\x41\x00\x42\x00\x43\x00\x44\x00\x45\x00\x46\x00\x47\x00\x48\x00\x49\x00\x4a\x00\x4b\x00\x4c\x00\x4d\x00\x4e\x00\x4f\x00\x50\x00\x51\x00\x52\x00\x53\x00\x54\x00\x55\x00\x56\x00\x57\x00\x58\x00\x59\x00\x5a\x00\x5b\x00\x5c\x00\x5d\x00\x5e\x00\x5f\x00\x60\x00\x61\x00\x62\x00\x63\x00\x64\x00\x65\x00\x66\x00\x67\x00\x68\x00\x69\x00\x6a\x00\x6b\x00\x6c\x00\x6d\x00\x6e\x00\x6f\x00\x70\x00\x71\x00\x72\x00\x73\x00\x74\x00\x75\x00\x76\x00\x77\x00\x78\x00\x79\x00\x7a\x00\xff\xff\x7c\x00\x21\x00\x7e\x00\x23\x00\x24\x00\x25\x00\x26\x00\x27\x00\xff\xff\xff\xff\x2a\x00\x2b\x00\x2c\x00\x2d\x00\x2e\x00\x2f\x00\x30\x00\x31\x00\x32\x00\x33\x00\x34\x00\x35\x00\x36\x00\x37\x00\x38\x00\x39\x00\x3a\x00\xff\xff\x3c\x00\x3d\x00\x3e\x00\x3f\x00\xff\xff\x41\x00\x42\x00\x43\x00\x44\x00\x45\x00\x46\x00\x47\x00\x48\x00\x49\x00\x4a\x00\x4b\x00\x4c\x00\x4d\x00\x4e\x00\x4f\x00\x50\x00\x51\x00\x52\x00\x53\x00\x54\x00\x55\x00\x56\x00\x57\x00\x58\x00\x59\x00\x5a\x00\x5b\x00\x5c\x00\x5d\x00\x5e\x00\x5f\x00\x60\x00\x61\x00\x62\x00\x63\x00\x64\x00\x65\x00\x66\x00\x67\x00\x68\x00\x69\x00\x6a\x00\x6b\x00\x6c\x00\x6d\x00\x6e\x00\x6f\x00\x70\x00\x71\x00\x72\x00\x73\x00\x74\x00\x75\x00\x76\x00\x77\x00\x78\x00\x79\x00\x7a\x00\xff\xff\x7c\x00\x21\x00\x7e\x00\x23\x00\x24\x00\x25\x00\x26\x00\x27\x00\xff\xff\xff\xff\x2a\x00\x2b\x00\x2c\x00\x2d\x00\x2e\x00\x2f\x00\x30\x00\x31\x00\x32\x00\x33\x00\x34\x00\x35\x00\x36\x00\x37\x00\x38\x00\x39\x00\x3a\x00\xff\xff\x3c\x00\x3d\x00\x3e\x00\x3f\x00\xff\xff\x41\x00\x42\x00\x43\x00\x44\x00\x45\x00\x46\x00\x47\x00\x48\x00\x49\x00\x4a\x00\x4b\x00\x4c\x00\x4d\x00\x4e\x00\x4f\x00\x50\x00\x51\x00\x52\x00\x53\x00\x54\x00\x55\x00\x56\x00\x57\x00\x58\x00\x59\x00\x5a\x00\x5b\x00\x5c\x00\x5d\x00\x5e\x00\x5f\x00\x60\x00\x61\x00\x62\x00\x63\x00\x64\x00\x65\x00\x66\x00\x67\x00\x68\x00\x69\x00\x6a\x00\x6b\x00\x6c\x00\x6d\x00\x6e\x00\x6f\x00\x70\x00\x71\x00\x72\x00\x73\x00\x74\x00\x75\x00\x76\x00\x77\x00\x78\x00\x79\x00\x7a\x00\xff\xff\x7c\x00\x21\x00\x7e\x00\x23\x00\x24\x00\x25\x00\x26\x00\x27\x00\xff\xff\xff\xff\x2a\x00\x2b\x00\x2c\x00\x2d\x00\x2e\x00\x2f\x00\x30\x00\x31\x00\x32\x00\x33\x00\x34\x00\x35\x00\x36\x00\x37\x00\x38\x00\x39\x00\x3a\x00\xff\xff\x3c\x00\x3d\x00\x3e\x00\x3f\x00\xff\xff\x41\x00\x42\x00\x43\x00\x44\x00\x45\x00\x46\x00\x47\x00\x48\x00\x49\x00\x4a\x00\x4b\x00\x4c\x00\x4d\x00\x4e\x00\x4f\x00\x50\x00\x51\x00\x52\x00\x53\x00\x54\x00\x55\x00\x56\x00\x57\x00\x58\x00\x59\x00\x5a\x00\x5b\x00\x5c\x00\x5d\x00\x5e\x00\x5f\x00\x60\x00\x61\x00\x62\x00\x63\x00\x64\x00\x65\x00\x66\x00\x67\x00\x68\x00\x69\x00\x6a\x00\x6b\x00\x6c\x00\x6d\x00\x6e\x00\x6f\x00\x70\x00\x71\x00\x72\x00\x73\x00\x74\x00\x75\x00\x76\x00\x77\x00\x78\x00\x79\x00\x7a\x00\xff\xff\x7c\x00\x21\x00\x7e\x00\x23\x00\x24\x00\x25\x00\x26\x00\x27\x00\xff\xff\xff\xff\x2a\x00\x2b\x00\x2c\x00\x2d\x00\x2e\x00\x2f\x00\x30\x00\x31\x00\x32\x00\x33\x00\x34\x00\x35\x00\x36\x00\x37\x00\x38\x00\x39\x00\x3a\x00\xff\xff\x3c\x00\x3d\x00\x3e\x00\x3f\x00\xff\xff\x41\x00\x42\x00\x43\x00\x44\x00\x45\x00\x46\x00\x47\x00\x48\x00\x49\x00\x4a\x00\x4b\x00\x4c\x00\x4d\x00\x4e\x00\x4f\x00\x50\x00\x51\x00\x52\x00\x53\x00\x54\x00\x55\x00\x56\x00\x57\x00\x58\x00\x59\x00\x5a\x00\x5b\x00\x5c\x00\x5d\x00\x5e\x00\x5f\x00\x60\x00\x61\x00\x62\x00\x63\x00\x64\x00\x65\x00\x66\x00\x67\x00\x68\x00\x69\x00\x6a\x00\x6b\x00\x6c\x00\x6d\x00\x6e\x00\x6f\x00\x70\x00\x71\x00\x72\x00\x73\x00\x74\x00\x75\x00\x76\x00\x77\x00\x78\x00\x79\x00\x7a\x00\xff\xff\x7c\x00\x21\x00\x7e\x00\x23\x00\x24\x00\x25\x00\x26\x00\x27\x00\xff\xff\xff\xff\x2a\x00\x2b\x00\x2c\x00\x2d\x00\x2e\x00\x2f\x00\x30\x00\x31\x00\x32\x00\x33\x00\x34\x00\x35\x00\x36\x00\x37\x00\x38\x00\x39\x00\x3a\x00\xff\xff\x3c\x00\x3d\x00\x3e\x00\x3f\x00\xff\xff\x41\x00\x42\x00\x43\x00\x44\x00\x45\x00\x46\x00\x47\x00\x48\x00\x49\x00\x4a\x00\x4b\x00\x4c\x00\x4d\x00\x4e\x00\x4f\x00\x50\x00\x51\x00\x52\x00\x53\x00\x54\x00\x55\x00\x56\x00\x57\x00\x58\x00\x59\x00\x5a\x00\x5b\x00\x5c\x00\x5d\x00\x5e\x00\x5f\x00\x60\x00\x61\x00\x62\x00\x63\x00\x64\x00\x65\x00\x66\x00\x67\x00\x68\x00\x69\x00\x6a\x00\x6b\x00\x6c\x00\x6d\x00\x6e\x00\x6f\x00\x70\x00\x71\x00\x72\x00\x73\x00\x74\x00\x75\x00\x76\x00\x77\x00\x78\x00\x79\x00\x7a\x00\xff\xff\x7c\x00\x21\x00\x7e\x00\x23\x00\x24\x00\x25\x00\x26\x00\x27\x00\xff\xff\xff\xff\x2a\x00\x2b\x00\x2c\x00\x2d\x00\x2e\x00\x2f\x00\x30\x00\x31\x00\x32\x00\x33\x00\x34\x00\x35\x00\x36\x00\x37\x00\x38\x00\x39\x00\x3a\x00\xff\xff\x3c\x00\x3d\x00\x3e\x00\x3f\x00\xff\xff\x41\x00\x42\x00\x43\x00\x44\x00\x45\x00\x46\x00\x47\x00\x48\x00\x49\x00\x4a\x00\x4b\x00\x4c\x00\x4d\x00\x4e\x00\x4f\x00\x50\x00\x51\x00\x52\x00\x53\x00\x54\x00\x55\x00\x56\x00\x57\x00\x58\x00\x59\x00\x5a\x00\x5b\x00\x5c\x00\x5d\x00\x5e\x00\x5f\x00\x60\x00\x61\x00\x62\x00\x63\x00\x64\x00\x65\x00\x66\x00\x67\x00\x68\x00\x69\x00\x6a\x00\x6b\x00\x6c\x00\x6d\x00\x6e\x00\x6f\x00\x70\x00\x71\x00\x72\x00\x73\x00\x74\x00\x75\x00\x76\x00\x77\x00\x78\x00\x79\x00\x7a\x00\xff\xff\x7c\x00\x7d\x00\x7e\x00\x21\x00\xff\xff\x23\x00\x24\x00\x25\x00\x26\x00\x27\x00\xff\xff\xff\xff\x2a\x00\x2b\x00\x2c\x00\x2d\x00\x2e\x00\x2f\x00\x30\x00\x31\x00\x32\x00\x33\x00\x34\x00\x35\x00\x36\x00\x37\x00\x38\x00\x39\x00\x3a\x00\xff\xff\x3c\x00\x3d\x00\x3e\x00\x3f\x00\xff\xff\x41\x00\x42\x00\x43\x00\x44\x00\x45\x00\x46\x00\x47\x00\x48\x00\x49\x00\x4a\x00\x4b\x00\x4c\x00\x4d\x00\x4e\x00\x4f\x00\x50\x00\x51\x00\x52\x00\x53\x00\x54\x00\x55\x00\x56\x00\x57\x00\x58\x00\x59\x00\x5a\x00\x5b\x00\x5c\x00\x5d\x00\x5e\x00\x5f\x00\x60\x00\x61\x00\x62\x00\x63\x00\x64\x00\x65\x00\x66\x00\x67\x00\x68\x00\x69\x00\x6a\x00\x6b\x00\x6c\x00\x6d\x00\x6e\x00\x6f\x00\x70\x00\x71\x00\x72\x00\x73\x00\x74\x00\x75\x00\x76\x00\x77\x00\x78\x00\x79\x00\x7a\x00\xff\xff\x7c\x00\x7d\x00\x7e\x00\x21\x00\xff\xff\x23\x00\x24\x00\x25\x00\x26\x00\x27\x00\xff\xff\xff\xff\x2a\x00\x2b\x00\x2c\x00\x2d\x00\x2e\x00\x2f\x00\x30\x00\x31\x00\x32\x00\x33\x00\x34\x00\x35\x00\x36\x00\x37\x00\x38\x00\x39\x00\x3a\x00\xff\xff\x3c\x00\x3d\x00\x3e\x00\x3f\x00\xff\xff\x41\x00\x42\x00\x43\x00\x44\x00\x45\x00\x46\x00\x47\x00\x48\x00\x49\x00\x4a\x00\x4b\x00\x4c\x00\x4d\x00\x4e\x00\x4f\x00\x50\x00\x51\x00\x52\x00\x53\x00\x54\x00\x55\x00\x56\x00\x57\x00\x58\x00\x59\x00\x5a\x00\x5b\x00\x5c\x00\x5d\x00\x5e\x00\x5f\x00\x60\x00\x61\x00\x62\x00\x63\x00\x64\x00\x65\x00\x66\x00\x67\x00\x68\x00\x69\x00\x6a\x00\x6b\x00\x6c\x00\x6d\x00\x6e\x00\x6f\x00\x70\x00\x71\x00\x72\x00\x73\x00\x74\x00\x75\x00\x76\x00\x77\x00\x78\x00\x79\x00\x7a\x00\xff\xff\x7c\x00\x7d\x00\x7e\x00\x21\x00\xff\xff\x23\x00\x24\x00\x25\x00\x26\x00\x27\x00\xff\xff\xff\xff\x2a\x00\x2b\x00\x2c\x00\x2d\x00\x2e\x00\x2f\x00\x30\x00\x31\x00\x32\x00\x33\x00\x34\x00\x35\x00\x36\x00\x37\x00\x38\x00\x39\x00\x3a\x00\xff\xff\x3c\x00\x3d\x00\x3e\x00\x3f\x00\xff\xff\x41\x00\x42\x00\x43\x00\x44\x00\x45\x00\x46\x00\x47\x00\x48\x00\x49\x00\x4a\x00\x4b\x00\x4c\x00\x4d\x00\x4e\x00\x4f\x00\x50\x00\x51\x00\x52\x00\x53\x00\x54\x00\x55\x00\x56\x00\x57\x00\x58\x00\x59\x00\x5a\x00\x5b\x00\x5c\x00\x5d\x00\x5e\x00\x5f\x00\x60\x00\x61\x00\x62\x00\x63\x00\x64\x00\x65\x00\x66\x00\x67\x00\x68\x00\x69\x00\x6a\x00\x6b\x00\x6c\x00\x6d\x00\x6e\x00\x6f\x00\x70\x00\x71\x00\x72\x00\x73\x00\x74\x00\x75\x00\x76\x00\x77\x00\x78\x00\x79\x00\x7a\x00\xff\xff\x7c\x00\x7d\x00\x7e\x00\x21\x00\xff\xff\x23\x00\x24\x00\x25\x00\x26\x00\x27\x00\xff\xff\xff\xff\x2a\x00\x2b\x00\x2c\x00\x2d\x00\x2e\x00\x2f\x00\x30\x00\x31\x00\x32\x00\x33\x00\x34\x00\x35\x00\x36\x00\x37\x00\x38\x00\x39\x00\x3a\x00\xff\xff\x3c\x00\x3d\x00\x3e\x00\x3f\x00\xff\xff\x41\x00\x42\x00\x43\x00\x44\x00\x45\x00\x46\x00\x47\x00\x48\x00\x49\x00\x4a\x00\x4b\x00\x4c\x00\x4d\x00\x4e\x00\x4f\x00\x50\x00\x51\x00\x52\x00\x53\x00\x54\x00\x55\x00\x56\x00\x57\x00\x58\x00\x59\x00\x5a\x00\x5b\x00\x5c\x00\x5d\x00\x5e\x00\x5f\x00\x60\x00\x61\x00\x62\x00\x63\x00\x64\x00\x65\x00\x66\x00\x67\x00\x68\x00\x69\x00\x6a\x00\x6b\x00\x6c\x00\x6d\x00\x6e\x00\x6f\x00\x70\x00\x71\x00\x72\x00\x73\x00\x74\x00\x75\x00\x76\x00\x77\x00\x78\x00\x79\x00\x7a\x00\xff\xff\x7c\x00\x21\x00\x7e\x00\x23\x00\x24\x00\x25\x00\x26\x00\x27\x00\xff\xff\xff\xff\x2a\x00\x2b\x00\x2c\x00\x2d\x00\x2e\x00\x2f\x00\x30\x00\x31\x00\x32\x00\x33\x00\x34\x00\x35\x00\x36\x00\x37\x00\x38\x00\x39\x00\x3a\x00\xff\xff\x3c\x00\x3d\x00\x3e\x00\x3f\x00\xff\xff\x41\x00\x42\x00\x43\x00\x44\x00\x45\x00\x46\x00\x47\x00\x48\x00\x49\x00\x4a\x00\x4b\x00\x4c\x00\x4d\x00\x4e\x00\x4f\x00\x50\x00\x51\x00\x52\x00\x53\x00\x54\x00\x55\x00\x56\x00\x57\x00\x58\x00\x59\x00\x5a\x00\x5b\x00\x5c\x00\x5d\x00\x5e\x00\x5f\x00\x60\x00\x61\x00\x62\x00\x63\x00\x64\x00\x65\x00\x66\x00\x67\x00\x68\x00\x69\x00\x6a\x00\x6b\x00\x6c\x00\x6d\x00\x6e\x00\x6f\x00\x70\x00\x71\x00\x72\x00\x73\x00\x74\x00\x75\x00\x76\x00\x77\x00\x78\x00\x79\x00\x7a\x00\xff\xff\x7c\x00\x21\x00\x7e\x00\x23\x00\x24\x00\x25\x00\x26\x00\x27\x00\xff\xff\xff\xff\x2a\x00\x2b\x00\x2c\x00\x2d\x00\x2e\x00\x2f\x00\x30\x00\x31\x00\x32\x00\x33\x00\x34\x00\x35\x00\x36\x00\x37\x00\x38\x00\x39\x00\x3a\x00\xff\xff\x3c\x00\x3d\x00\x3e\x00\x3f\x00\xff\xff\x41\x00\x42\x00\x43\x00\x44\x00\x45\x00\x46\x00\x47\x00\x48\x00\x49\x00\x4a\x00\x4b\x00\x4c\x00\x4d\x00\x4e\x00\x4f\x00\x50\x00\x51\x00\x52\x00\x53\x00\x54\x00\x55\x00\x56\x00\x57\x00\x58\x00\x59\x00\x5a\x00\x5b\x00\x5c\x00\x5d\x00\x5e\x00\x5f\x00\x60\x00\x61\x00\x62\x00\x63\x00\x64\x00\x65\x00\x66\x00\x67\x00\x68\x00\x69\x00\x6a\x00\x6b\x00\x6c\x00\x6d\x00\x6e\x00\x6f\x00\x70\x00\x71\x00\x72\x00\x73\x00\x74\x00\x75\x00\x76\x00\x77\x00\x78\x00\x79\x00\x7a\x00\xff\xff\x7c\x00\x21\x00\x7e\x00\x23\x00\x24\x00\x25\x00\x26\x00\x27\x00\xff\xff\xff\xff\x2a\x00\x2b\x00\x2c\x00\x2d\x00\x2e\x00\x2f\x00\x30\x00\x31\x00\x32\x00\x33\x00\x34\x00\x35\x00\x36\x00\x37\x00\x38\x00\x39\x00\x3a\x00\xff\xff\x3c\x00\x3d\x00\x3e\x00\x3f\x00\xff\xff\x41\x00\x42\x00\x43\x00\x44\x00\x45\x00\x46\x00\x47\x00\x48\x00\x49\x00\x4a\x00\x4b\x00\x4c\x00\x4d\x00\x4e\x00\x4f\x00\x50\x00\x51\x00\x52\x00\x53\x00\x54\x00\x55\x00\x56\x00\x57\x00\x58\x00\x59\x00\x5a\x00\x5b\x00\x5c\x00\x5d\x00\x5e\x00\x5f\x00\x60\x00\x61\x00\x62\x00\x63\x00\x64\x00\x65\x00\x66\x00\x67\x00\x68\x00\x69\x00\x6a\x00\x6b\x00\x6c\x00\x6d\x00\x6e\x00\x6f\x00\x70\x00\x71\x00\x72\x00\x73\x00\x74\x00\x75\x00\x76\x00\x77\x00\x78\x00\x79\x00\x7a\x00\xff\xff\x7c\x00\x21\x00\x7e\x00\x23\x00\x24\x00\x25\x00\x26\x00\x27\x00\xff\xff\xff\xff\x2a\x00\x2b\x00\x2c\x00\x2d\x00\x2e\x00\x2f\x00\x30\x00\x31\x00\x32\x00\x33\x00\x34\x00\x35\x00\x36\x00\x37\x00\x38\x00\x39\x00\x3a\x00\xff\xff\x3c\x00\x3d\x00\x3e\x00\x3f\x00\xff\xff\x41\x00\x42\x00\x43\x00\x44\x00\x45\x00\x46\x00\x47\x00\x48\x00\x49\x00\x4a\x00\x4b\x00\x4c\x00\x4d\x00\x4e\x00\x4f\x00\x50\x00\x51\x00\x52\x00\x53\x00\x54\x00\x55\x00\x56\x00\x57\x00\x58\x00\x59\x00\x5a\x00\x5b\x00\x5c\x00\x5d\x00\x5e\x00\x5f\x00\x60\x00\x61\x00\x62\x00\x63\x00\x64\x00\x65\x00\x66\x00\x67\x00\x68\x00\x69\x00\x6a\x00\x6b\x00\x6c\x00\x6d\x00\x6e\x00\x6f\x00\x70\x00\x71\x00\x72\x00\x73\x00\x74\x00\x75\x00\x76\x00\x77\x00\x78\x00\x79\x00\x7a\x00\xff\xff\x7c\x00\x21\x00\x7e\x00\x23\x00\x24\x00\x25\x00\x26\x00\x27\x00\xff\xff\xff\xff\x2a\x00\x2b\x00\x2c\x00\x2d\x00\x2e\x00\x2f\x00\x30\x00\x31\x00\x32\x00\x33\x00\x34\x00\x35\x00\x36\x00\x37\x00\x38\x00\x39\x00\x3a\x00\xff\xff\x3c\x00\x3d\x00\x3e\x00\x3f\x00\xff\xff\x41\x00\x42\x00\x43\x00\x44\x00\x45\x00\x46\x00\x47\x00\x48\x00\x49\x00\x4a\x00\x4b\x00\x4c\x00\x4d\x00\x4e\x00\x4f\x00\x50\x00\x51\x00\x52\x00\x53\x00\x54\x00\x55\x00\x56\x00\x57\x00\x58\x00\x59\x00\x5a\x00\x5b\x00\x5c\x00\x5d\x00\x5e\x00\x5f\x00\x60\x00\x61\x00\x62\x00\x63\x00\x64\x00\x65\x00\x66\x00\x67\x00\x68\x00\x69\x00\x6a\x00\x6b\x00\x6c\x00\x6d\x00\x6e\x00\x6f\x00\x70\x00\x71\x00\x72\x00\x73\x00\x74\x00\x75\x00\x76\x00\x77\x00\x78\x00\x79\x00\x7a\x00\xff\xff\x7c\x00\x21\x00\x7e\x00\x23\x00\x24\x00\x25\x00\x26\x00\x27\x00\xff\xff\xff\xff\x2a\x00\x2b\x00\x2c\x00\x2d\x00\x2e\x00\x2f\x00\x30\x00\x31\x00\x32\x00\x33\x00\x34\x00\x35\x00\x36\x00\x37\x00\x38\x00\x39\x00\x3a\x00\xff\xff\x3c\x00\x3d\x00\x3e\x00\x3f\x00\xff\xff\x41\x00\x42\x00\x43\x00\x44\x00\x45\x00\x46\x00\x47\x00\x48\x00\x49\x00\x4a\x00\x4b\x00\x4c\x00\x4d\x00\x4e\x00\x4f\x00\x50\x00\x51\x00\x52\x00\x53\x00\x54\x00\x55\x00\x56\x00\x57\x00\x58\x00\x59\x00\x5a\x00\x5b\x00\x5c\x00\x5d\x00\x5e\x00\x5f\x00\x60\x00\x61\x00\x62\x00\x63\x00\x64\x00\x65\x00\x66\x00\x67\x00\x68\x00\x69\x00\x6a\x00\x6b\x00\x6c\x00\x6d\x00\x6e\x00\x6f\x00\x70\x00\x71\x00\x72\x00\x73\x00\x74\x00\x75\x00\x76\x00\x77\x00\x78\x00\x79\x00\x7a\x00\xff\xff\x7c\x00\x21\x00\x7e\x00\x23\x00\x24\x00\x25\x00\x26\x00\x27\x00\xff\xff\xff\xff\x2a\x00\x2b\x00\x2c\x00\x2d\x00\x2e\x00\x2f\x00\x30\x00\x31\x00\x32\x00\x33\x00\x34\x00\x35\x00\x36\x00\x37\x00\x38\x00\x39\x00\x3a\x00\xff\xff\x3c\x00\x3d\x00\x3e\x00\x3f\x00\xff\xff\x41\x00\x42\x00\x43\x00\x44\x00\x45\x00\x46\x00\x47\x00\x48\x00\x49\x00\x4a\x00\x4b\x00\x4c\x00\x4d\x00\x4e\x00\x4f\x00\x50\x00\x51\x00\x52\x00\x53\x00\x54\x00\x55\x00\x56\x00\x57\x00\x58\x00\x59\x00\x5a\x00\x5b\x00\x5c\x00\x5d\x00\x5e\x00\x5f\x00\x60\x00\x61\x00\x62\x00\x63\x00\x64\x00\x65\x00\x66\x00\x67\x00\x68\x00\x69\x00\x6a\x00\x6b\x00\x6c\x00\x6d\x00\x6e\x00\x6f\x00\x70\x00\x71\x00\x72\x00\x73\x00\x74\x00\x75\x00\x76\x00\x77\x00\x78\x00\x79\x00\x7a\x00\xff\xff\x7c\x00\x21\x00\x7e\x00\x23\x00\x24\x00\x25\x00\x26\x00\x27\x00\xff\xff\xff\xff\x2a\x00\x2b\x00\x2c\x00\x2d\x00\x2e\x00\x2f\x00\x30\x00\x31\x00\x32\x00\x33\x00\x34\x00\x35\x00\x36\x00\x37\x00\x38\x00\x39\x00\x3a\x00\xff\xff\x3c\x00\x3d\x00\x3e\x00\x3f\x00\xff\xff\x41\x00\x42\x00\x43\x00\x44\x00\x45\x00\x46\x00\x47\x00\x48\x00\x49\x00\x4a\x00\x4b\x00\x4c\x00\x4d\x00\x4e\x00\x4f\x00\x50\x00\x51\x00\x52\x00\x53\x00\x54\x00\x55\x00\x56\x00\x57\x00\x58\x00\x59\x00\x5a\x00\x5b\x00\x5c\x00\x5d\x00\x5e\x00\x5f\x00\x60\x00\x61\x00\x62\x00\x63\x00\x64\x00\x65\x00\x66\x00\x67\x00\x68\x00\x69\x00\x6a\x00\x6b\x00\x6c\x00\x6d\x00\x6e\x00\x6f\x00\x70\x00\x71\x00\x72\x00\x73\x00\x74\x00\x75\x00\x76\x00\x77\x00\x78\x00\x79\x00\x7a\x00\xff\xff\x7c\x00\x21\x00\x7e\x00\x23\x00\x24\x00\x25\x00\x26\x00\x27\x00\xff\xff\xff\xff\x2a\x00\x2b\x00\x2c\x00\x2d\x00\x2e\x00\x2f\x00\x30\x00\x31\x00\x32\x00\x33\x00\x34\x00\x35\x00\x36\x00\x37\x00\x38\x00\x39\x00\x3a\x00\xff\xff\x3c\x00\x3d\x00\x3e\x00\x3f\x00\xff\xff\x41\x00\x42\x00\x43\x00\x44\x00\x45\x00\x46\x00\x47\x00\x48\x00\x49\x00\x4a\x00\x4b\x00\x4c\x00\x4d\x00\x4e\x00\x4f\x00\x50\x00\x51\x00\x52\x00\x53\x00\x54\x00\x55\x00\x56\x00\x57\x00\x58\x00\x59\x00\x5a\x00\x5b\x00\x5c\x00\x5d\x00\x5e\x00\x5f\x00\x60\x00\x61\x00\x62\x00\x63\x00\x64\x00\x65\x00\x66\x00\x67\x00\x68\x00\x69\x00\x6a\x00\x6b\x00\x6c\x00\x6d\x00\x6e\x00\x6f\x00\x70\x00\x71\x00\x72\x00\x73\x00\x74\x00\x75\x00\x76\x00\x77\x00\x78\x00\x79\x00\x7a\x00\xff\xff\x7c\x00\x21\x00\x7e\x00\x23\x00\x24\x00\x25\x00\x26\x00\x27\x00\xff\xff\xff\xff\x2a\x00\x2b\x00\x2c\x00\x2d\x00\x2e\x00\x2f\x00\x30\x00\x31\x00\x32\x00\x33\x00\x34\x00\x35\x00\x36\x00\x37\x00\x38\x00\x39\x00\x3a\x00\xff\xff\x3c\x00\x3d\x00\x3e\x00\x3f\x00\xff\xff\x41\x00\x42\x00\x43\x00\x44\x00\x45\x00\x46\x00\x47\x00\x48\x00\x49\x00\x4a\x00\x4b\x00\x4c\x00\x4d\x00\x4e\x00\x4f\x00\x50\x00\x51\x00\x52\x00\x53\x00\x54\x00\x55\x00\x56\x00\x57\x00\x58\x00\x59\x00\x5a\x00\x5b\x00\x5c\x00\x5d\x00\x5e\x00\x5f\x00\x60\x00\x61\x00\x62\x00\x63\x00\x64\x00\x65\x00\x66\x00\x67\x00\x68\x00\x69\x00\x6a\x00\x6b\x00\x6c\x00\x6d\x00\x6e\x00\x6f\x00\x70\x00\x71\x00\x72\x00\x73\x00\x74\x00\x75\x00\x76\x00\x77\x00\x78\x00\x79\x00\x7a\x00\xff\xff\x7c\x00\x21\x00\x7e\x00\x23\x00\x24\x00\x25\x00\x26\x00\x27\x00\xff\xff\xff\xff\x2a\x00\x2b\x00\x2c\x00\x2d\x00\x2e\x00\x2f\x00\x30\x00\x31\x00\x32\x00\x33\x00\x34\x00\x35\x00\x36\x00\x37\x00\x38\x00\x39\x00\x3a\x00\xff\xff\x3c\x00\x3d\x00\x3e\x00\x3f\x00\xff\xff\x41\x00\x42\x00\x43\x00\x44\x00\x45\x00\x46\x00\x47\x00\x48\x00\x49\x00\x4a\x00\x4b\x00\x4c\x00\x4d\x00\x4e\x00\x4f\x00\x50\x00\x51\x00\x52\x00\x53\x00\x54\x00\x55\x00\x56\x00\x57\x00\x58\x00\x59\x00\x5a\x00\x5b\x00\x5c\x00\x5d\x00\x5e\x00\x5f\x00\x60\x00\x61\x00\x62\x00\x63\x00\x64\x00\x65\x00\x66\x00\x67\x00\x68\x00\x69\x00\x6a\x00\x6b\x00\x6c\x00\x6d\x00\x6e\x00\x6f\x00\x70\x00\x71\x00\x72\x00\x73\x00\x74\x00\x75\x00\x76\x00\x77\x00\x78\x00\x79\x00\x7a\x00\xff\xff\x7c\x00\x21\x00\x7e\x00\x23\x00\x24\x00\x25\x00\x26\x00\x27\x00\xff\xff\xff\xff\x2a\x00\x2b\x00\x2c\x00\x2d\x00\x2e\x00\x2f\x00\x30\x00\x31\x00\x32\x00\x33\x00\x34\x00\x35\x00\x36\x00\x37\x00\x38\x00\x39\x00\x3a\x00\xff\xff\x3c\x00\x3d\x00\x3e\x00\x3f\x00\xff\xff\x41\x00\x42\x00\x43\x00\x44\x00\x45\x00\x46\x00\x47\x00\x48\x00\x49\x00\x4a\x00\x4b\x00\x4c\x00\x4d\x00\x4e\x00\x4f\x00\x50\x00\x51\x00\x52\x00\x53\x00\x54\x00\x55\x00\x56\x00\x57\x00\x58\x00\x59\x00\x5a\x00\x5b\x00\x5c\x00\x5d\x00\x5e\x00\x5f\x00\x60\x00\x61\x00\x62\x00\x63\x00\x64\x00\x65\x00\x66\x00\x67\x00\x68\x00\x69\x00\x6a\x00\x6b\x00\x6c\x00\x6d\x00\x6e\x00\x6f\x00\x70\x00\x71\x00\x72\x00\x73\x00\x74\x00\x75\x00\x76\x00\x77\x00\x78\x00\x79\x00\x7a\x00\xff\xff\x7c\x00\x21\x00\x7e\x00\x23\x00\x24\x00\x25\x00\x26\x00\x27\x00\xff\xff\xff\xff\x2a\x00\x2b\x00\x2c\x00\x2d\x00\x2e\x00\x2f\x00\x30\x00\x31\x00\x32\x00\x33\x00\x34\x00\x35\x00\x36\x00\x37\x00\x38\x00\x39\x00\x3a\x00\xff\xff\x3c\x00\x3d\x00\x3e\x00\x3f\x00\xff\xff\x41\x00\x42\x00\x43\x00\x44\x00\x45\x00\x46\x00\x47\x00\x48\x00\x49\x00\x4a\x00\x4b\x00\x4c\x00\x4d\x00\x4e\x00\x4f\x00\x50\x00\x51\x00\x52\x00\x53\x00\x54\x00\x55\x00\x56\x00\x57\x00\x58\x00\x59\x00\x5a\x00\x5b\x00\x5c\x00\x5d\x00\x5e\x00\x5f\x00\x60\x00\x61\x00\x62\x00\x63\x00\x64\x00\x65\x00\x66\x00\x67\x00\x68\x00\x69\x00\x6a\x00\x6b\x00\x6c\x00\x6d\x00\x6e\x00\x6f\x00\x70\x00\x71\x00\x72\x00\x73\x00\x74\x00\x75\x00\x76\x00\x77\x00\x78\x00\x79\x00\x7a\x00\xff\xff\x7c\x00\x21\x00\x7e\x00\x23\x00\x24\x00\x25\x00\x26\x00\x27\x00\xff\xff\xff\xff\x2a\x00\x2b\x00\x2c\x00\x2d\x00\x2e\x00\x2f\x00\x30\x00\x31\x00\x32\x00\x33\x00\x34\x00\x35\x00\x36\x00\x37\x00\x38\x00\x39\x00\x3a\x00\xff\xff\x3c\x00\x3d\x00\x3e\x00\x3f\x00\xff\xff\x41\x00\x42\x00\x43\x00\x44\x00\x45\x00\x46\x00\x47\x00\x48\x00\x49\x00\x4a\x00\x4b\x00\x4c\x00\x4d\x00\x4e\x00\x4f\x00\x50\x00\x51\x00\x52\x00\x53\x00\x54\x00\x55\x00\x56\x00\x57\x00\x58\x00\x59\x00\x5a\x00\x5b\x00\x5c\x00\x5d\x00\x5e\x00\x5f\x00\x60\x00\x61\x00\x62\x00\x63\x00\x64\x00\x65\x00\x66\x00\x67\x00\x68\x00\x69\x00\x6a\x00\x6b\x00\x6c\x00\x6d\x00\x6e\x00\x6f\x00\x70\x00\x71\x00\x72\x00\x73\x00\x74\x00\x75\x00\x76\x00\x77\x00\x78\x00\x79\x00\x7a\x00\xff\xff\x7c\x00\x21\x00\x7e\x00\x23\x00\x24\x00\x25\x00\x26\x00\x27\x00\xff\xff\xff\xff\x2a\x00\x2b\x00\x2c\x00\x2d\x00\x2e\x00\x2f\x00\x30\x00\x31\x00\x32\x00\x33\x00\x34\x00\x35\x00\x36\x00\x37\x00\x38\x00\x39\x00\x3a\x00\xff\xff\x3c\x00\x3d\x00\x3e\x00\x3f\x00\xff\xff\x41\x00\x42\x00\x43\x00\x44\x00\x45\x00\x46\x00\x47\x00\x48\x00\x49\x00\x4a\x00\x4b\x00\x4c\x00\x4d\x00\x4e\x00\x4f\x00\x50\x00\x51\x00\x52\x00\x53\x00\x54\x00\x55\x00\x56\x00\x57\x00\x58\x00\x59\x00\x5a\x00\x5b\x00\x5c\x00\x5d\x00\x5e\x00\x5f\x00\x60\x00\x61\x00\x62\x00\x63\x00\x64\x00\x65\x00\x66\x00\x67\x00\x68\x00\x69\x00\x6a\x00\x6b\x00\x6c\x00\x6d\x00\x6e\x00\x6f\x00\x70\x00\x71\x00\x72\x00\x73\x00\x74\x00\x75\x00\x76\x00\x77\x00\x78\x00\x79\x00\x7a\x00\xff\xff\x7c\x00\x21\x00\x7e\x00\x23\x00\x24\x00\x25\x00\x26\x00\x27\x00\xff\xff\xff\xff\x2a\x00\x2b\x00\x2c\x00\x2d\x00\x2e\x00\x2f\x00\x30\x00\x31\x00\x32\x00\x33\x00\x34\x00\x35\x00\x36\x00\x37\x00\x38\x00\x39\x00\x3a\x00\xff\xff\x3c\x00\x3d\x00\x3e\x00\x3f\x00\xff\xff\x41\x00\x42\x00\x43\x00\x44\x00\x45\x00\x46\x00\x47\x00\x48\x00\x49\x00\x4a\x00\x4b\x00\x4c\x00\x4d\x00\x4e\x00\x4f\x00\x50\x00\x51\x00\x52\x00\x53\x00\x54\x00\x55\x00\x56\x00\x57\x00\x58\x00\x59\x00\x5a\x00\x5b\x00\x5c\x00\x5d\x00\x5e\x00\x5f\x00\x60\x00\x61\x00\x62\x00\x63\x00\x64\x00\x65\x00\x66\x00\x67\x00\x68\x00\x69\x00\x6a\x00\x6b\x00\x6c\x00\x6d\x00\x6e\x00\x6f\x00\x70\x00\x71\x00\x72\x00\x73\x00\x74\x00\x75\x00\x76\x00\x77\x00\x78\x00\x79\x00\x7a\x00\xff\xff\x7c\x00\x21\x00\x7e\x00\x23\x00\x24\x00\x25\x00\x26\x00\x27\x00\xff\xff\xff\xff\x2a\x00\x2b\x00\x2c\x00\x2d\x00\x2e\x00\x2f\x00\x30\x00\x31\x00\x32\x00\x33\x00\x34\x00\x35\x00\x36\x00\x37\x00\x38\x00\x39\x00\x3a\x00\xff\xff\x3c\x00\x3d\x00\x3e\x00\x3f\x00\xff\xff\x41\x00\x42\x00\x43\x00\x44\x00\x45\x00\x46\x00\x47\x00\x48\x00\x49\x00\x4a\x00\x4b\x00\x4c\x00\x4d\x00\x4e\x00\x4f\x00\x50\x00\x51\x00\x52\x00\x53\x00\x54\x00\x55\x00\x56\x00\x57\x00\x58\x00\x59\x00\x5a\x00\x5b\x00\x5c\x00\x5d\x00\x5e\x00\x5f\x00\x60\x00\x61\x00\x62\x00\x63\x00\x64\x00\x65\x00\x66\x00\x67\x00\x68\x00\x69\x00\x6a\x00\x6b\x00\x6c\x00\x6d\x00\x6e\x00\x6f\x00\x70\x00\x71\x00\x72\x00\x73\x00\x74\x00\x75\x00\x76\x00\x77\x00\x78\x00\x79\x00\x7a\x00\xff\xff\x7c\x00\x21\x00\x7e\x00\x23\x00\x24\x00\x25\x00\x26\x00\x27\x00\xff\xff\xff\xff\x2a\x00\x2b\x00\x2c\x00\x2d\x00\x2e\x00\x2f\x00\x30\x00\x31\x00\x32\x00\x33\x00\x34\x00\x35\x00\x36\x00\x37\x00\x38\x00\x39\x00\x3a\x00\xff\xff\x3c\x00\x3d\x00\x3e\x00\x3f\x00\xff\xff\x41\x00\x42\x00\x43\x00\x44\x00\x45\x00\x46\x00\x47\x00\x48\x00\x49\x00\x4a\x00\x4b\x00\x4c\x00\x4d\x00\x4e\x00\x4f\x00\x50\x00\x51\x00\x52\x00\x53\x00\x54\x00\x55\x00\x56\x00\x57\x00\x58\x00\x59\x00\x5a\x00\x5b\x00\x5c\x00\x5d\x00\x5e\x00\x5f\x00\x60\x00\x61\x00\x62\x00\x63\x00\x64\x00\x65\x00\x66\x00\x67\x00\x68\x00\x69\x00\x6a\x00\x6b\x00\x6c\x00\x6d\x00\x6e\x00\x6f\x00\x70\x00\x71\x00\x72\x00\x73\x00\x74\x00\x75\x00\x76\x00\x77\x00\x78\x00\x79\x00\x7a\x00\xff\xff\x7c\x00\x21\x00\x7e\x00\x23\x00\x24\x00\x25\x00\x26\x00\x27\x00\xff\xff\xff\xff\x2a\x00\x2b\x00\x2c\x00\x2d\x00\x2e\x00\x2f\x00\x30\x00\x31\x00\x32\x00\x33\x00\x34\x00\x35\x00\x36\x00\x37\x00\x38\x00\x39\x00\x3a\x00\xff\xff\x3c\x00\x3d\x00\x3e\x00\x3f\x00\xff\xff\x41\x00\x42\x00\x43\x00\x44\x00\x45\x00\x46\x00\x47\x00\x48\x00\x49\x00\x4a\x00\x4b\x00\x4c\x00\x4d\x00\x4e\x00\x4f\x00\x50\x00\x51\x00\x52\x00\x53\x00\x54\x00\x55\x00\x56\x00\x57\x00\x58\x00\x59\x00\x5a\x00\x5b\x00\x5c\x00\x5d\x00\x5e\x00\x5f\x00\x60\x00\x61\x00\x62\x00\x63\x00\x64\x00\x65\x00\x66\x00\x67\x00\x68\x00\x69\x00\x6a\x00\x6b\x00\x6c\x00\x6d\x00\x6e\x00\x6f\x00\x70\x00\x71\x00\x72\x00\x73\x00\x74\x00\x75\x00\x76\x00\x77\x00\x78\x00\x79\x00\x7a\x00\xff\xff\x7c\x00\x21\x00\x7e\x00\x23\x00\x24\x00\x25\x00\x26\x00\x27\x00\xff\xff\xff\xff\x2a\x00\x2b\x00\x2c\x00\x2d\x00\x2e\x00\x2f\x00\x30\x00\x31\x00\x32\x00\x33\x00\x34\x00\x35\x00\x36\x00\x37\x00\x38\x00\x39\x00\x3a\x00\xff\xff\x3c\x00\x3d\x00\x3e\x00\x3f\x00\xff\xff\x41\x00\x42\x00\x43\x00\x44\x00\x45\x00\x46\x00\x47\x00\x48\x00\x49\x00\x4a\x00\x4b\x00\x4c\x00\x4d\x00\x4e\x00\x4f\x00\x50\x00\x51\x00\x52\x00\x53\x00\x54\x00\x55\x00\x56\x00\x57\x00\x58\x00\x59\x00\x5a\x00\x5b\x00\x5c\x00\x5d\x00\x5e\x00\x5f\x00\x60\x00\x61\x00\x62\x00\x63\x00\x64\x00\x65\x00\x66\x00\x67\x00\x68\x00\x69\x00\x6a\x00\x6b\x00\x6c\x00\x6d\x00\x6e\x00\x6f\x00\x70\x00\x71\x00\x72\x00\x73\x00\x74\x00\x75\x00\x76\x00\x77\x00\x78\x00\x79\x00\x7a\x00\xff\xff\x7c\x00\x21\x00\x7e\x00\x23\x00\x24\x00\x25\x00\x26\x00\x27\x00\xff\xff\xff\xff\x2a\x00\x2b\x00\x2c\x00\x2d\x00\x2e\x00\x2f\x00\x30\x00\x31\x00\x32\x00\x33\x00\x34\x00\x35\x00\x36\x00\x37\x00\x38\x00\x39\x00\x3a\x00\xff\xff\x3c\x00\x3d\x00\x3e\x00\x3f\x00\xff\xff\x41\x00\x42\x00\x43\x00\x44\x00\x45\x00\x46\x00\x47\x00\x48\x00\x49\x00\x4a\x00\x4b\x00\x4c\x00\x4d\x00\x4e\x00\x4f\x00\x50\x00\x51\x00\x52\x00\x53\x00\x54\x00\x55\x00\x56\x00\x57\x00\x58\x00\x59\x00\x5a\x00\x5b\x00\x5c\x00\x5d\x00\x5e\x00\x5f\x00\x60\x00\x61\x00\x62\x00\x63\x00\x64\x00\x65\x00\x66\x00\x67\x00\x68\x00\x69\x00\x6a\x00\x6b\x00\x6c\x00\x6d\x00\x6e\x00\x6f\x00\x70\x00\x71\x00\x72\x00\x73\x00\x74\x00\x75\x00\x76\x00\x77\x00\x78\x00\x79\x00\x7a\x00\xff\xff\x7c\x00\x21\x00\x7e\x00\x23\x00\x24\x00\x25\x00\x26\x00\x27\x00\xff\xff\xff\xff\x2a\x00\x2b\x00\x2c\x00\x2d\x00\x2e\x00\x2f\x00\x30\x00\x31\x00\x32\x00\x33\x00\x34\x00\x35\x00\x36\x00\x37\x00\x38\x00\x39\x00\x3a\x00\xff\xff\x3c\x00\x3d\x00\x3e\x00\x3f\x00\xff\xff\x41\x00\x42\x00\x43\x00\x44\x00\x45\x00\x46\x00\x47\x00\x48\x00\x49\x00\x4a\x00\x4b\x00\x4c\x00\x4d\x00\x4e\x00\x4f\x00\x50\x00\x51\x00\x52\x00\x53\x00\x54\x00\x55\x00\x56\x00\x57\x00\x58\x00\x59\x00\x5a\x00\x5b\x00\x5c\x00\x5d\x00\x5e\x00\x5f\x00\x60\x00\x61\x00\x62\x00\x63\x00\x64\x00\x65\x00\x66\x00\x67\x00\x68\x00\x69\x00\x6a\x00\x6b\x00\x6c\x00\x6d\x00\x6e\x00\x6f\x00\x70\x00\x71\x00\x72\x00\x73\x00\x74\x00\x75\x00\x76\x00\x77\x00\x78\x00\x79\x00\x7a\x00\xff\xff\x7c\x00\x21\x00\x7e\x00\x23\x00\x24\x00\x25\x00\x26\x00\x27\x00\xff\xff\xff\xff\x2a\x00\x2b\x00\x2c\x00\x2d\x00\x2e\x00\x2f\x00\x30\x00\x31\x00\x32\x00\x33\x00\x34\x00\x35\x00\x36\x00\x37\x00\x38\x00\x39\x00\x3a\x00\xff\xff\x3c\x00\x3d\x00\x3e\x00\x3f\x00\xff\xff\x41\x00\x42\x00\x43\x00\x44\x00\x45\x00\x46\x00\x47\x00\x48\x00\x49\x00\x4a\x00\x4b\x00\x4c\x00\x4d\x00\x4e\x00\x4f\x00\x50\x00\x51\x00\x52\x00\x53\x00\x54\x00\x55\x00\x56\x00\x57\x00\x58\x00\x59\x00\x5a\x00\x5b\x00\x5c\x00\x5d\x00\x5e\x00\x5f\x00\x60\x00\x61\x00\x62\x00\x63\x00\x64\x00\x65\x00\x66\x00\x67\x00\x68\x00\x69\x00\x6a\x00\x6b\x00\x6c\x00\x6d\x00\x6e\x00\x6f\x00\x70\x00\x71\x00\x72\x00\x73\x00\x74\x00\x75\x00\x76\x00\x77\x00\x78\x00\x79\x00\x7a\x00\xff\xff\x7c\x00\x21\x00\x7e\x00\x23\x00\x24\x00\x25\x00\x26\x00\x27\x00\xff\xff\xff\xff\x2a\x00\x2b\x00\x2c\x00\x2d\x00\x2e\x00\x2f\x00\x30\x00\x31\x00\x32\x00\x33\x00\x34\x00\x35\x00\x36\x00\x37\x00\x38\x00\x39\x00\x3a\x00\xff\xff\x3c\x00\x3d\x00\x3e\x00\x3f\x00\xff\xff\x41\x00\x42\x00\x43\x00\x44\x00\x45\x00\x46\x00\x47\x00\x48\x00\x49\x00\x4a\x00\x4b\x00\x4c\x00\x4d\x00\x4e\x00\x4f\x00\x50\x00\x51\x00\x52\x00\x53\x00\x54\x00\x55\x00\x56\x00\x57\x00\x58\x00\x59\x00\x5a\x00\x5b\x00\x5c\x00\x5d\x00\x5e\x00\x5f\x00\x60\x00\x61\x00\x62\x00\x63\x00\x64\x00\x65\x00\x66\x00\x67\x00\x68\x00\x69\x00\x6a\x00\x6b\x00\x6c\x00\x6d\x00\x6e\x00\x6f\x00\x70\x00\x71\x00\x72\x00\x73\x00\x74\x00\x75\x00\x76\x00\x77\x00\x78\x00\x79\x00\x7a\x00\xff\xff\x7c\x00\x21\x00\x7e\x00\x23\x00\x24\x00\x25\x00\x26\x00\x27\x00\xff\xff\xff\xff\x2a\x00\x2b\x00\x2c\x00\x2d\x00\x2e\x00\x2f\x00\x30\x00\x31\x00\x32\x00\x33\x00\x34\x00\x35\x00\x36\x00\x37\x00\x38\x00\x39\x00\x3a\x00\xff\xff\x3c\x00\x3d\x00\x3e\x00\x3f\x00\xff\xff\x41\x00\x42\x00\x43\x00\x44\x00\x45\x00\x46\x00\x47\x00\x48\x00\x49\x00\x4a\x00\x4b\x00\x4c\x00\x4d\x00\x4e\x00\x4f\x00\x50\x00\x51\x00\x52\x00\x53\x00\x54\x00\x55\x00\x56\x00\x57\x00\x58\x00\x59\x00\x5a\x00\x5b\x00\x5c\x00\x5d\x00\x5e\x00\x5f\x00\x60\x00\x61\x00\x62\x00\x63\x00\x64\x00\x65\x00\x66\x00\x67\x00\x68\x00\x69\x00\x6a\x00\x6b\x00\x6c\x00\x6d\x00\x6e\x00\x6f\x00\x70\x00\x71\x00\x72\x00\x73\x00\x74\x00\x75\x00\x76\x00\x77\x00\x78\x00\x79\x00\x7a\x00\xff\xff\x7c\x00\x21\x00\x7e\x00\x23\x00\x24\x00\x25\x00\x26\x00\x27\x00\xff\xff\xff\xff\x2a\x00\x2b\x00\x2c\x00\x2d\x00\x2e\x00\x2f\x00\x30\x00\x31\x00\x32\x00\x33\x00\x34\x00\x35\x00\x36\x00\x37\x00\x38\x00\x39\x00\x3a\x00\xff\xff\x3c\x00\x3d\x00\x3e\x00\x3f\x00\xff\xff\x41\x00\x42\x00\x43\x00\x44\x00\x45\x00\x46\x00\x47\x00\x48\x00\x49\x00\x4a\x00\x4b\x00\x4c\x00\x4d\x00\x4e\x00\x4f\x00\x50\x00\x51\x00\x52\x00\x53\x00\x54\x00\x55\x00\x56\x00\x57\x00\x58\x00\x59\x00\x5a\x00\x5b\x00\x5c\x00\x5d\x00\x5e\x00\x5f\x00\x60\x00\x61\x00\x62\x00\x63\x00\x64\x00\x65\x00\x66\x00\x67\x00\x68\x00\x69\x00\x6a\x00\x6b\x00\x6c\x00\x6d\x00\x6e\x00\x6f\x00\x70\x00\x71\x00\x72\x00\x73\x00\x74\x00\x75\x00\x76\x00\x77\x00\x78\x00\x79\x00\x7a\x00\xff\xff\x7c\x00\x21\x00\x7e\x00\x23\x00\x24\x00\x25\x00\x26\x00\x27\x00\xff\xff\xff\xff\x2a\x00\x2b\x00\x2c\x00\x2d\x00\x2e\x00\x2f\x00\x30\x00\x31\x00\x32\x00\x33\x00\x34\x00\x35\x00\x36\x00\x37\x00\x38\x00\x39\x00\x3a\x00\xff\xff\x3c\x00\x3d\x00\x3e\x00\x3f\x00\xff\xff\x41\x00\x42\x00\x43\x00\x44\x00\x45\x00\x46\x00\x47\x00\x48\x00\x49\x00\x4a\x00\x4b\x00\x4c\x00\x4d\x00\x4e\x00\x4f\x00\x50\x00\x51\x00\x52\x00\x53\x00\x54\x00\x55\x00\x56\x00\x57\x00\x58\x00\x59\x00\x5a\x00\x5b\x00\x5c\x00\x5d\x00\x5e\x00\x5f\x00\x60\x00\x61\x00\x62\x00\x63\x00\x64\x00\x65\x00\x66\x00\x67\x00\x68\x00\x69\x00\x6a\x00\x6b\x00\x6c\x00\x6d\x00\x6e\x00\x6f\x00\x70\x00\x71\x00\x72\x00\x73\x00\x74\x00\x75\x00\x76\x00\x77\x00\x78\x00\x79\x00\x7a\x00\xff\xff\x7c\x00\x21\x00\x7e\x00\x23\x00\x24\x00\x25\x00\x26\x00\x27\x00\xff\xff\xff\xff\x2a\x00\x2b\x00\x2c\x00\x2d\x00\x2e\x00\x2f\x00\x30\x00\x31\x00\x32\x00\x33\x00\x34\x00\x35\x00\x36\x00\x37\x00\x38\x00\x39\x00\x3a\x00\xff\xff\x3c\x00\x3d\x00\x3e\x00\x3f\x00\xff\xff\x41\x00\x42\x00\x43\x00\x44\x00\x45\x00\x46\x00\x47\x00\x48\x00\x49\x00\x4a\x00\x4b\x00\x4c\x00\x4d\x00\x4e\x00\x4f\x00\x50\x00\x51\x00\x52\x00\x53\x00\x54\x00\x55\x00\x56\x00\x57\x00\x58\x00\x59\x00\x5a\x00\x5b\x00\x5c\x00\x5d\x00\x5e\x00\x5f\x00\x60\x00\x61\x00\x62\x00\x63\x00\x64\x00\x65\x00\x66\x00\x67\x00\x68\x00\x69\x00\x6a\x00\x6b\x00\x6c\x00\x6d\x00\x6e\x00\x6f\x00\x70\x00\x71\x00\x72\x00\x73\x00\x74\x00\x75\x00\x76\x00\x77\x00\x78\x00\x79\x00\x7a\x00\xff\xff\x7c\x00\x21\x00\x7e\x00\x23\x00\x24\x00\x25\x00\x26\x00\x27\x00\xff\xff\xff\xff\x2a\x00\x2b\x00\x2c\x00\x2d\x00\x2e\x00\x2f\x00\x30\x00\x31\x00\x32\x00\x33\x00\x34\x00\x35\x00\x36\x00\x37\x00\x38\x00\x39\x00\x3a\x00\xff\xff\x3c\x00\x3d\x00\x3e\x00\x3f\x00\xff\xff\x41\x00\x42\x00\x43\x00\x44\x00\x45\x00\x46\x00\x47\x00\x48\x00\x49\x00\x4a\x00\x4b\x00\x4c\x00\x4d\x00\x4e\x00\x4f\x00\x50\x00\x51\x00\x52\x00\x53\x00\x54\x00\x55\x00\x56\x00\x57\x00\x58\x00\x59\x00\x5a\x00\x5b\x00\x5c\x00\x5d\x00\x5e\x00\x5f\x00\x60\x00\x61\x00\x62\x00\x63\x00\x64\x00\x65\x00\x66\x00\x67\x00\x68\x00\x69\x00\x6a\x00\x6b\x00\x6c\x00\x6d\x00\x6e\x00\x6f\x00\x70\x00\x71\x00\x72\x00\x73\x00\x74\x00\x75\x00\x76\x00\x77\x00\x78\x00\x79\x00\x7a\x00\xff\xff\x7c\x00\x21\x00\x7e\x00\x23\x00\x24\x00\x25\x00\x26\x00\x27\x00\xff\xff\xff\xff\x2a\x00\x2b\x00\x2c\x00\x2d\x00\x2e\x00\x2f\x00\x30\x00\x31\x00\x32\x00\x33\x00\x34\x00\x35\x00\x36\x00\x37\x00\x38\x00\x39\x00\x3a\x00\xff\xff\x3c\x00\x3d\x00\x3e\x00\x3f\x00\xff\xff\x41\x00\x42\x00\x43\x00\x44\x00\x45\x00\x46\x00\x47\x00\x48\x00\x49\x00\x4a\x00\x4b\x00\x4c\x00\x4d\x00\x4e\x00\x4f\x00\x50\x00\x51\x00\x52\x00\x53\x00\x54\x00\x55\x00\x56\x00\x57\x00\x58\x00\x59\x00\x5a\x00\x5b\x00\x5c\x00\x5d\x00\x5e\x00\x5f\x00\x60\x00\x61\x00\x62\x00\x63\x00\x64\x00\x65\x00\x66\x00\x67\x00\x68\x00\x69\x00\x6a\x00\x6b\x00\x6c\x00\x6d\x00\x6e\x00\x6f\x00\x70\x00\x71\x00\x72\x00\x73\x00\x74\x00\x75\x00\x76\x00\x77\x00\x78\x00\x79\x00\x7a\x00\xff\xff\x7c\x00\x21\x00\x7e\x00\x23\x00\x24\x00\x25\x00\x26\x00\x27\x00\xff\xff\xff\xff\x2a\x00\x2b\x00\x2c\x00\x2d\x00\x2e\x00\x2f\x00\x30\x00\x31\x00\x32\x00\x33\x00\x34\x00\x35\x00\x36\x00\x37\x00\x38\x00\x39\x00\x3a\x00\xff\xff\x3c\x00\x3d\x00\x3e\x00\x3f\x00\xff\xff\x41\x00\x42\x00\x43\x00\x44\x00\x45\x00\x46\x00\x47\x00\x48\x00\x49\x00\x4a\x00\x4b\x00\x4c\x00\x4d\x00\x4e\x00\x4f\x00\x50\x00\x51\x00\x52\x00\x53\x00\x54\x00\x55\x00\x56\x00\x57\x00\x58\x00\x59\x00\x5a\x00\x5b\x00\x5c\x00\x5d\x00\x5e\x00\x5f\x00\x60\x00\x61\x00\x62\x00\x63\x00\x64\x00\x65\x00\x66\x00\x67\x00\x68\x00\x69\x00\x6a\x00\x6b\x00\x6c\x00\x6d\x00\x6e\x00\x6f\x00\x70\x00\x71\x00\x72\x00\x73\x00\x74\x00\x75\x00\x76\x00\x77\x00\x78\x00\x79\x00\x7a\x00\xff\xff\x7c\x00\x21\x00\x7e\x00\x23\x00\x24\x00\x25\x00\x26\x00\x27\x00\xff\xff\xff\xff\x2a\x00\x2b\x00\x2c\x00\x2d\x00\x2e\x00\x2f\x00\x30\x00\x31\x00\x32\x00\x33\x00\x34\x00\x35\x00\x36\x00\x37\x00\x38\x00\x39\x00\x3a\x00\xff\xff\x3c\x00\x3d\x00\x3e\x00\x3f\x00\xff\xff\x41\x00\x42\x00\x43\x00\x44\x00\x45\x00\x46\x00\x47\x00\x48\x00\x49\x00\x4a\x00\x4b\x00\x4c\x00\x4d\x00\x4e\x00\x4f\x00\x50\x00\x51\x00\x52\x00\x53\x00\x54\x00\x55\x00\x56\x00\x57\x00\x58\x00\x59\x00\x5a\x00\x5b\x00\x5c\x00\x5d\x00\x5e\x00\x5f\x00\x60\x00\x61\x00\x62\x00\x63\x00\x64\x00\x65\x00\x66\x00\x67\x00\x68\x00\x69\x00\x6a\x00\x6b\x00\x6c\x00\x6d\x00\x6e\x00\x6f\x00\x70\x00\x71\x00\x72\x00\x73\x00\x74\x00\x75\x00\x76\x00\x77\x00\x78\x00\x79\x00\x7a\x00\xff\xff\x7c\x00\x21\x00\x7e\x00\x23\x00\x24\x00\x25\x00\x26\x00\x27\x00\xff\xff\xff\xff\x2a\x00\x2b\x00\x2c\x00\x2d\x00\x2e\x00\x2f\x00\x30\x00\x31\x00\x32\x00\x33\x00\x34\x00\x35\x00\x36\x00\x37\x00\x38\x00\x39\x00\x3a\x00\xff\xff\x3c\x00\x3d\x00\x3e\x00\x3f\x00\xff\xff\x41\x00\x42\x00\x43\x00\x44\x00\x45\x00\x46\x00\x47\x00\x48\x00\x49\x00\x4a\x00\x4b\x00\x4c\x00\x4d\x00\x4e\x00\x4f\x00\x50\x00\x51\x00\x52\x00\x53\x00\x54\x00\x55\x00\x56\x00\x57\x00\x58\x00\x59\x00\x5a\x00\x5b\x00\x5c\x00\x5d\x00\x5e\x00\x5f\x00\x60\x00\x61\x00\x62\x00\x63\x00\x64\x00\x65\x00\x66\x00\x67\x00\x68\x00\x69\x00\x6a\x00\x6b\x00\x6c\x00\x6d\x00\x6e\x00\x6f\x00\x70\x00\x71\x00\x72\x00\x73\x00\x74\x00\x75\x00\x76\x00\x77\x00\x78\x00\x79\x00\x7a\x00\xff\xff\x7c\x00\x21\x00\x7e\x00\x23\x00\x24\x00\x25\x00\x26\x00\x27\x00\xff\xff\xff\xff\x2a\x00\x2b\x00\x2c\x00\x2d\x00\x2e\x00\x2f\x00\x30\x00\x31\x00\x32\x00\x33\x00\x34\x00\x35\x00\x36\x00\x37\x00\x38\x00\x39\x00\x3a\x00\xff\xff\x3c\x00\x3d\x00\x3e\x00\x3f\x00\xff\xff\x41\x00\x42\x00\x43\x00\x44\x00\x45\x00\x46\x00\x47\x00\x48\x00\x49\x00\x4a\x00\x4b\x00\x4c\x00\x4d\x00\x4e\x00\x4f\x00\x50\x00\x51\x00\x52\x00\x53\x00\x54\x00\x55\x00\x56\x00\x57\x00\x58\x00\x59\x00\x5a\x00\x5b\x00\x5c\x00\x5d\x00\x5e\x00\x5f\x00\x60\x00\x61\x00\x62\x00\x63\x00\x64\x00\x65\x00\x66\x00\x67\x00\x68\x00\x69\x00\x6a\x00\x6b\x00\x6c\x00\x6d\x00\x6e\x00\x6f\x00\x70\x00\x71\x00\x72\x00\x73\x00\x74\x00\x75\x00\x76\x00\x77\x00\x78\x00\x79\x00\x7a\x00\xff\xff\x7c\x00\x21\x00\x7e\x00\x23\x00\x24\x00\x25\x00\x26\x00\x27\x00\xff\xff\xff\xff\x2a\x00\x2b\x00\x2c\x00\x2d\x00\x2e\x00\x2f\x00\x30\x00\x31\x00\x32\x00\x33\x00\x34\x00\x35\x00\x36\x00\x37\x00\x38\x00\x39\x00\x3a\x00\xff\xff\x3c\x00\x3d\x00\x3e\x00\x3f\x00\xff\xff\x41\x00\x42\x00\x43\x00\x44\x00\x45\x00\x46\x00\x47\x00\x48\x00\x49\x00\x4a\x00\x4b\x00\x4c\x00\x4d\x00\x4e\x00\x4f\x00\x50\x00\x51\x00\x52\x00\x53\x00\x54\x00\x55\x00\x56\x00\x57\x00\x58\x00\x59\x00\x5a\x00\x5b\x00\x5c\x00\x5d\x00\x5e\x00\x5f\x00\x60\x00\x61\x00\x62\x00\x63\x00\x64\x00\x65\x00\x66\x00\x67\x00\x68\x00\x69\x00\x6a\x00\x6b\x00\x6c\x00\x6d\x00\x6e\x00\x6f\x00\x70\x00\x71\x00\x72\x00\x73\x00\x74\x00\x75\x00\x76\x00\x77\x00\x78\x00\x79\x00\x7a\x00\xff\xff\x7c\x00\x21\x00\x7e\x00\x23\x00\x24\x00\x25\x00\x26\x00\x27\x00\xff\xff\xff\xff\x2a\x00\x2b\x00\x2c\x00\x2d\x00\x2e\x00\x2f\x00\x30\x00\x31\x00\x32\x00\x33\x00\x34\x00\x35\x00\x36\x00\x37\x00\x38\x00\x39\x00\x3a\x00\xff\xff\x3c\x00\x3d\x00\x3e\x00\x3f\x00\xff\xff\x41\x00\x42\x00\x43\x00\x44\x00\x45\x00\x46\x00\x47\x00\x48\x00\x49\x00\x4a\x00\x4b\x00\x4c\x00\x4d\x00\x4e\x00\x4f\x00\x50\x00\x51\x00\x52\x00\x53\x00\x54\x00\x55\x00\x56\x00\x57\x00\x58\x00\x59\x00\x5a\x00\x5b\x00\x5c\x00\x5d\x00\x5e\x00\x5f\x00\x60\x00\x61\x00\x62\x00\x63\x00\x64\x00\x65\x00\x66\x00\x67\x00\x68\x00\x69\x00\x6a\x00\x6b\x00\x6c\x00\x6d\x00\x6e\x00\x6f\x00\x70\x00\x71\x00\x72\x00\x73\x00\x74\x00\x75\x00\x76\x00\x77\x00\x78\x00\x79\x00\x7a\x00\xff\xff\x7c\x00\x21\x00\x7e\x00\x23\x00\x24\x00\x25\x00\x26\x00\x27\x00\xff\xff\xff\xff\x2a\x00\x2b\x00\x2c\x00\x2d\x00\x2e\x00\x2f\x00\x30\x00\x31\x00\x32\x00\x33\x00\x34\x00\x35\x00\x36\x00\x37\x00\x38\x00\x39\x00\x3a\x00\xff\xff\x3c\x00\x3d\x00\x3e\x00\x3f\x00\xff\xff\x41\x00\x42\x00\x43\x00\x44\x00\x45\x00\x46\x00\x47\x00\x48\x00\x49\x00\x4a\x00\x4b\x00\x4c\x00\x4d\x00\x4e\x00\x4f\x00\x50\x00\x51\x00\x52\x00\x53\x00\x54\x00\x55\x00\x56\x00\x57\x00\x58\x00\x59\x00\x5a\x00\x5b\x00\x5c\x00\x5d\x00\x5e\x00\x5f\x00\x60\x00\x61\x00\x62\x00\x63\x00\x64\x00\x65\x00\x66\x00\x67\x00\x68\x00\x69\x00\x6a\x00\x6b\x00\x6c\x00\x6d\x00\x6e\x00\x6f\x00\x70\x00\x71\x00\x72\x00\x73\x00\x74\x00\x75\x00\x76\x00\x77\x00\x78\x00\x79\x00\x7a\x00\xff\xff\x7c\x00\x21\x00\x7e\x00\x23\x00\x24\x00\x25\x00\x26\x00\x27\x00\xff\xff\xff\xff\x2a\x00\x2b\x00\x2c\x00\x2d\x00\x2e\x00\x2f\x00\x30\x00\x31\x00\x32\x00\x33\x00\x34\x00\x35\x00\x36\x00\x37\x00\x38\x00\x39\x00\x3a\x00\xff\xff\x3c\x00\x3d\x00\x3e\x00\x3f\x00\xff\xff\x41\x00\x42\x00\x43\x00\x44\x00\x45\x00\x46\x00\x47\x00\x48\x00\x49\x00\x4a\x00\x4b\x00\x4c\x00\x4d\x00\x4e\x00\x4f\x00\x50\x00\x51\x00\x52\x00\x53\x00\x54\x00\x55\x00\x56\x00\x57\x00\x58\x00\x59\x00\x5a\x00\x5b\x00\x5c\x00\x5d\x00\x5e\x00\x5f\x00\x60\x00\x61\x00\x62\x00\x63\x00\x64\x00\x65\x00\x66\x00\x67\x00\x68\x00\x69\x00\x6a\x00\x6b\x00\x6c\x00\x6d\x00\x6e\x00\x6f\x00\x70\x00\x71\x00\x72\x00\x73\x00\x74\x00\x75\x00\x76\x00\x77\x00\x78\x00\x79\x00\x7a\x00\xff\xff\x7c\x00\x21\x00\x7e\x00\x23\x00\x24\x00\x25\x00\x26\x00\x27\x00\xff\xff\xff\xff\x2a\x00\x2b\x00\x2c\x00\x2d\x00\x2e\x00\x2f\x00\x30\x00\x31\x00\x32\x00\x33\x00\x34\x00\x35\x00\x36\x00\x37\x00\x38\x00\x39\x00\x3a\x00\xff\xff\x3c\x00\x3d\x00\x3e\x00\x3f\x00\xff\xff\x41\x00\x42\x00\x43\x00\x44\x00\x45\x00\x46\x00\x47\x00\x48\x00\x49\x00\x4a\x00\x4b\x00\x4c\x00\x4d\x00\x4e\x00\x4f\x00\x50\x00\x51\x00\x52\x00\x53\x00\x54\x00\x55\x00\x56\x00\x57\x00\x58\x00\x59\x00\x5a\x00\x5b\x00\x5c\x00\x5d\x00\x5e\x00\x5f\x00\x60\x00\x61\x00\x62\x00\x63\x00\x64\x00\x65\x00\x66\x00\x67\x00\x68\x00\x69\x00\x6a\x00\x6b\x00\x6c\x00\x6d\x00\x6e\x00\x6f\x00\x70\x00\x71\x00\x72\x00\x73\x00\x74\x00\x75\x00\x76\x00\x77\x00\x78\x00\x79\x00\x7a\x00\xff\xff\x7c\x00\x21\x00\x7e\x00\x23\x00\x24\x00\x25\x00\x26\x00\x27\x00\xff\xff\xff\xff\x2a\x00\x2b\x00\x2c\x00\x2d\x00\x2e\x00\x2f\x00\x30\x00\x31\x00\x32\x00\x33\x00\x34\x00\x35\x00\x36\x00\x37\x00\x38\x00\x39\x00\x3a\x00\xff\xff\x3c\x00\x3d\x00\x3e\x00\x3f\x00\xff\xff\x41\x00\x42\x00\x43\x00\x44\x00\x45\x00\x46\x00\x47\x00\x48\x00\x49\x00\x4a\x00\x4b\x00\x4c\x00\x4d\x00\x4e\x00\x4f\x00\x50\x00\x51\x00\x52\x00\x53\x00\x54\x00\x55\x00\x56\x00\x57\x00\x58\x00\x59\x00\x5a\x00\x5b\x00\x5c\x00\x5d\x00\x5e\x00\x5f\x00\x60\x00\x61\x00\x62\x00\x63\x00\x64\x00\x65\x00\x66\x00\x67\x00\x68\x00\x69\x00\x6a\x00\x6b\x00\x6c\x00\x6d\x00\x6e\x00\x6f\x00\x70\x00\x71\x00\x72\x00\x73\x00\x74\x00\x75\x00\x76\x00\x77\x00\x78\x00\x79\x00\x7a\x00\xff\xff\x7c\x00\x21\x00\x7e\x00\x23\x00\x24\x00\x25\x00\x26\x00\x27\x00\xff\xff\xff\xff\x2a\x00\x2b\x00\x2c\x00\x2d\x00\x2e\x00\x2f\x00\x30\x00\x31\x00\x32\x00\x33\x00\x34\x00\x35\x00\x36\x00\x37\x00\x38\x00\x39\x00\x3a\x00\xff\xff\x3c\x00\x3d\x00\x3e\x00\x3f\x00\xff\xff\x41\x00\x42\x00\x43\x00\x44\x00\x45\x00\x46\x00\x47\x00\x48\x00\x49\x00\x4a\x00\x4b\x00\x4c\x00\x4d\x00\x4e\x00\x4f\x00\x50\x00\x51\x00\x52\x00\x53\x00\x54\x00\x55\x00\x56\x00\x57\x00\x58\x00\x59\x00\x5a\x00\x5b\x00\x5c\x00\x5d\x00\x5e\x00\x5f\x00\x60\x00\x61\x00\x62\x00\x63\x00\x64\x00\x65\x00\x66\x00\x67\x00\x68\x00\x69\x00\x6a\x00\x6b\x00\x6c\x00\x6d\x00\x6e\x00\x6f\x00\x70\x00\x71\x00\x72\x00\x73\x00\x74\x00\x75\x00\x76\x00\x77\x00\x78\x00\x79\x00\x7a\x00\xff\xff\x7c\x00\x21\x00\x7e\x00\x23\x00\x24\x00\x25\x00\x26\x00\x27\x00\xff\xff\xff\xff\x2a\x00\x2b\x00\x2c\x00\x2d\x00\x2e\x00\x2f\x00\x30\x00\x31\x00\x32\x00\x33\x00\x34\x00\x35\x00\x36\x00\x37\x00\x38\x00\x39\x00\x3a\x00\xff\xff\x3c\x00\x3d\x00\x3e\x00\x3f\x00\xff\xff\x41\x00\x42\x00\x43\x00\x44\x00\x45\x00\x46\x00\x47\x00\x48\x00\x49\x00\x4a\x00\x4b\x00\x4c\x00\x4d\x00\x4e\x00\x4f\x00\x50\x00\x51\x00\x52\x00\x53\x00\x54\x00\x55\x00\x56\x00\x57\x00\x58\x00\x59\x00\x5a\x00\x5b\x00\x5c\x00\x5d\x00\x5e\x00\x5f\x00\x60\x00\x61\x00\x62\x00\x63\x00\x64\x00\x65\x00\x66\x00\x67\x00\x68\x00\x69\x00\x6a\x00\x6b\x00\x6c\x00\x6d\x00\x6e\x00\x6f\x00\x70\x00\x71\x00\x72\x00\x73\x00\x74\x00\x75\x00\x76\x00\x77\x00\x78\x00\x79\x00\x7a\x00\xff\xff\x7c\x00\x21\x00\x7e\x00\x23\x00\x24\x00\x25\x00\x26\x00\x27\x00\xff\xff\xff\xff\x2a\x00\x2b\x00\x2c\x00\x2d\x00\x2e\x00\x2f\x00\x30\x00\x31\x00\x32\x00\x33\x00\x34\x00\x35\x00\x36\x00\x37\x00\x38\x00\x39\x00\x3a\x00\xff\xff\x3c\x00\x3d\x00\x3e\x00\x3f\x00\xff\xff\x41\x00\x42\x00\x43\x00\x44\x00\x45\x00\x46\x00\x47\x00\x48\x00\x49\x00\x4a\x00\x4b\x00\x4c\x00\x4d\x00\x4e\x00\x4f\x00\x50\x00\x51\x00\x52\x00\x53\x00\x54\x00\x55\x00\x56\x00\x57\x00\x58\x00\x59\x00\x5a\x00\x5b\x00\x5c\x00\x5d\x00\x5e\x00\x5f\x00\x60\x00\x61\x00\x62\x00\x63\x00\x64\x00\x65\x00\x66\x00\x67\x00\x68\x00\x69\x00\x6a\x00\x6b\x00\x6c\x00\x6d\x00\x6e\x00\x6f\x00\x70\x00\x71\x00\x72\x00\x73\x00\x74\x00\x75\x00\x76\x00\x77\x00\x78\x00\x79\x00\x7a\x00\xff\xff\x7c\x00\x21\x00\x7e\x00\x23\x00\x24\x00\x25\x00\x26\x00\x27\x00\xff\xff\xff\xff\x2a\x00\x2b\x00\x2c\x00\x2d\x00\x2e\x00\x2f\x00\x30\x00\x31\x00\x32\x00\x33\x00\x34\x00\x35\x00\x36\x00\x37\x00\x38\x00\x39\x00\x3a\x00\xff\xff\x3c\x00\x3d\x00\x3e\x00\x3f\x00\xff\xff\x41\x00\x42\x00\x43\x00\x44\x00\x45\x00\x46\x00\x47\x00\x48\x00\x49\x00\x4a\x00\x4b\x00\x4c\x00\x4d\x00\x4e\x00\x4f\x00\x50\x00\x51\x00\x52\x00\x53\x00\x54\x00\x55\x00\x56\x00\x57\x00\x58\x00\x59\x00\x5a\x00\x5b\x00\x5c\x00\x5d\x00\x5e\x00\x5f\x00\x60\x00\x61\x00\x62\x00\x63\x00\x64\x00\x65\x00\x66\x00\x67\x00\x68\x00\x69\x00\x6a\x00\x6b\x00\x6c\x00\x6d\x00\x6e\x00\x6f\x00\x70\x00\x71\x00\x72\x00\x73\x00\x74\x00\x75\x00\x76\x00\x77\x00\x78\x00\x79\x00\x7a\x00\xff\xff\x7c\x00\x21\x00\x7e\x00\x23\x00\x24\x00\x25\x00\x26\x00\x27\x00\xff\xff\xff\xff\x2a\x00\x2b\x00\x2c\x00\x2d\x00\x2e\x00\x2f\x00\x30\x00\x31\x00\x32\x00\x33\x00\x34\x00\x35\x00\x36\x00\x37\x00\x38\x00\x39\x00\x3a\x00\xff\xff\x3c\x00\x3d\x00\x3e\x00\x3f\x00\xff\xff\x41\x00\x42\x00\x43\x00\x44\x00\x45\x00\x46\x00\x47\x00\x48\x00\x49\x00\x4a\x00\x4b\x00\x4c\x00\x4d\x00\x4e\x00\x4f\x00\x50\x00\x51\x00\x52\x00\x53\x00\x54\x00\x55\x00\x56\x00\x57\x00\x58\x00\x59\x00\x5a\x00\x5b\x00\x5c\x00\x5d\x00\x5e\x00\x5f\x00\x60\x00\x61\x00\x62\x00\x63\x00\x64\x00\x65\x00\x66\x00\x67\x00\x68\x00\x69\x00\x6a\x00\x6b\x00\x6c\x00\x6d\x00\x6e\x00\x6f\x00\x70\x00\x71\x00\x72\x00\x73\x00\x74\x00\x75\x00\x76\x00\x77\x00\x78\x00\x79\x00\x7a\x00\xff\xff\x7c\x00\x21\x00\x7e\x00\x23\x00\x24\x00\x25\x00\x26\x00\x27\x00\xff\xff\xff\xff\x2a\x00\x2b\x00\x2c\x00\x2d\x00\x2e\x00\x2f\x00\x30\x00\x31\x00\x32\x00\x33\x00\x34\x00\x35\x00\x36\x00\x37\x00\x38\x00\x39\x00\x3a\x00\xff\xff\x3c\x00\x3d\x00\x3e\x00\x3f\x00\xff\xff\x41\x00\x42\x00\x43\x00\x44\x00\x45\x00\x46\x00\x47\x00\x48\x00\x49\x00\x4a\x00\x4b\x00\x4c\x00\x4d\x00\x4e\x00\x4f\x00\x50\x00\x51\x00\x52\x00\x53\x00\x54\x00\x55\x00\x56\x00\x57\x00\x58\x00\x59\x00\x5a\x00\x5b\x00\x5c\x00\x5d\x00\x5e\x00\x5f\x00\x60\x00\x61\x00\x62\x00\x63\x00\x64\x00\x65\x00\x66\x00\x67\x00\x68\x00\x69\x00\x6a\x00\x6b\x00\x6c\x00\x6d\x00\x6e\x00\x6f\x00\x70\x00\x71\x00\x72\x00\x73\x00\x74\x00\x75\x00\x76\x00\x77\x00\x78\x00\x79\x00\x7a\x00\xff\xff\x7c\x00\x21\x00\x7e\x00\x23\x00\x24\x00\x25\x00\x26\x00\x27\x00\xff\xff\xff\xff\x2a\x00\x2b\x00\x2c\x00\x2d\x00\x2e\x00\x2f\x00\x30\x00\x31\x00\x32\x00\x33\x00\x34\x00\x35\x00\x36\x00\x37\x00\x38\x00\x39\x00\x3a\x00\xff\xff\x3c\x00\x3d\x00\x3e\x00\x3f\x00\xff\xff\x41\x00\x42\x00\x43\x00\x44\x00\x45\x00\x46\x00\x47\x00\x48\x00\x49\x00\x4a\x00\x4b\x00\x4c\x00\x4d\x00\x4e\x00\x4f\x00\x50\x00\x51\x00\x52\x00\x53\x00\x54\x00\x55\x00\x56\x00\x57\x00\x58\x00\x59\x00\x5a\x00\x5b\x00\x5c\x00\x5d\x00\x5e\x00\x5f\x00\x60\x00\x61\x00\x62\x00\x63\x00\x64\x00\x65\x00\x66\x00\x67\x00\x68\x00\x69\x00\x6a\x00\x6b\x00\x6c\x00\x6d\x00\x6e\x00\x6f\x00\x70\x00\x71\x00\x72\x00\x73\x00\x74\x00\x75\x00\x76\x00\x77\x00\x78\x00\x79\x00\x7a\x00\xff\xff\x7c\x00\x21\x00\x7e\x00\x23\x00\x24\x00\x25\x00\x26\x00\x27\x00\xff\xff\xff\xff\x2a\x00\x2b\x00\x2c\x00\x2d\x00\x2e\x00\x2f\x00\x30\x00\x31\x00\x32\x00\x33\x00\x34\x00\x35\x00\x36\x00\x37\x00\x38\x00\x39\x00\x3a\x00\xff\xff\x3c\x00\x3d\x00\x3e\x00\x3f\x00\xff\xff\x41\x00\x42\x00\x43\x00\x44\x00\x45\x00\x46\x00\x47\x00\x48\x00\x49\x00\x4a\x00\x4b\x00\x4c\x00\x4d\x00\x4e\x00\x4f\x00\x50\x00\x51\x00\x52\x00\x53\x00\x54\x00\x55\x00\x56\x00\x57\x00\x58\x00\x59\x00\x5a\x00\x5b\x00\x5c\x00\x5d\x00\x5e\x00\x5f\x00\x60\x00\x61\x00\x62\x00\x63\x00\x64\x00\x65\x00\x66\x00\x67\x00\x68\x00\x69\x00\x6a\x00\x6b\x00\x6c\x00\x6d\x00\x6e\x00\x6f\x00\x70\x00\x71\x00\x72\x00\x73\x00\x74\x00\x75\x00\x76\x00\x77\x00\x78\x00\x79\x00\x7a\x00\xff\xff\x7c\x00\x21\x00\x7e\x00\x23\x00\x24\x00\x25\x00\x26\x00\x27\x00\xff\xff\xff\xff\x2a\x00\x2b\x00\x2c\x00\x2d\x00\x2e\x00\x2f\x00\x30\x00\x31\x00\x32\x00\x33\x00\x34\x00\x35\x00\x36\x00\x37\x00\x38\x00\x39\x00\x3a\x00\xff\xff\x3c\x00\x3d\x00\x3e\x00\x3f\x00\xff\xff\x41\x00\x42\x00\x43\x00\x44\x00\x45\x00\x46\x00\x47\x00\x48\x00\x49\x00\x4a\x00\x4b\x00\x4c\x00\x4d\x00\x4e\x00\x4f\x00\x50\x00\x51\x00\x52\x00\x53\x00\x54\x00\x55\x00\x56\x00\x57\x00\x58\x00\x59\x00\x5a\x00\x5b\x00\x5c\x00\x5d\x00\x5e\x00\x5f\x00\x60\x00\x61\x00\x62\x00\x63\x00\x64\x00\x65\x00\x66\x00\x67\x00\x68\x00\x69\x00\x6a\x00\x6b\x00\x6c\x00\x6d\x00\x6e\x00\x6f\x00\x70\x00\x71\x00\x72\x00\x73\x00\x74\x00\x75\x00\x76\x00\x77\x00\x78\x00\x79\x00\x7a\x00\xff\xff\x7c\x00\x21\x00\x7e\x00\x23\x00\x24\x00\x25\x00\x26\x00\x27\x00\xff\xff\xff\xff\x2a\x00\x2b\x00\x2c\x00\x2d\x00\x2e\x00\x2f\x00\x30\x00\x31\x00\x32\x00\x33\x00\x34\x00\x35\x00\x36\x00\x37\x00\x38\x00\x39\x00\x3a\x00\xff\xff\x3c\x00\x3d\x00\x3e\x00\x3f\x00\xff\xff\x41\x00\x42\x00\x43\x00\x44\x00\x45\x00\x46\x00\x47\x00\x48\x00\x49\x00\x4a\x00\x4b\x00\x4c\x00\x4d\x00\x4e\x00\x4f\x00\x50\x00\x51\x00\x52\x00\x53\x00\x54\x00\x55\x00\x56\x00\x57\x00\x58\x00\x59\x00\x5a\x00\x5b\x00\x5c\x00\x5d\x00\x5e\x00\x5f\x00\x60\x00\x61\x00\x62\x00\x63\x00\x64\x00\x65\x00\x66\x00\x67\x00\x68\x00\x69\x00\x6a\x00\x6b\x00\x6c\x00\x6d\x00\x6e\x00\x6f\x00\x70\x00\x71\x00\x72\x00\x73\x00\x74\x00\x75\x00\x76\x00\x77\x00\x78\x00\x79\x00\x7a\x00\xff\xff\x7c\x00\x21\x00\x7e\x00\x23\x00\x24\x00\x25\x00\x26\x00\x27\x00\xff\xff\xff\xff\x2a\x00\x2b\x00\x2c\x00\x2d\x00\x2e\x00\x2f\x00\x30\x00\x31\x00\x32\x00\x33\x00\x34\x00\x35\x00\x36\x00\x37\x00\x38\x00\x39\x00\x3a\x00\xff\xff\x3c\x00\x3d\x00\x3e\x00\x3f\x00\xff\xff\x41\x00\x42\x00\x43\x00\x44\x00\x45\x00\x46\x00\x47\x00\x48\x00\x49\x00\x4a\x00\x4b\x00\x4c\x00\x4d\x00\x4e\x00\x4f\x00\x50\x00\x51\x00\x52\x00\x53\x00\x54\x00\x55\x00\x56\x00\x57\x00\x58\x00\x59\x00\x5a\x00\x5b\x00\x5c\x00\x5d\x00\x5e\x00\x5f\x00\x60\x00\x61\x00\x62\x00\x63\x00\x64\x00\x65\x00\x66\x00\x67\x00\x68\x00\x69\x00\x6a\x00\x6b\x00\x6c\x00\x6d\x00\x6e\x00\x6f\x00\x70\x00\x71\x00\x72\x00\x73\x00\x74\x00\x75\x00\x76\x00\x77\x00\x78\x00\x79\x00\x7a\x00\xff\xff\x7c\x00\x21\x00\x7e\x00\x23\x00\x24\x00\x25\x00\x26\x00\x27\x00\xff\xff\xff\xff\x2a\x00\x2b\x00\x2c\x00\x2d\x00\x2e\x00\x2f\x00\x30\x00\x31\x00\x32\x00\x33\x00\x34\x00\x35\x00\x36\x00\x37\x00\x38\x00\x39\x00\x3a\x00\xff\xff\x3c\x00\x3d\x00\x3e\x00\x3f\x00\xff\xff\x41\x00\x42\x00\x43\x00\x44\x00\x45\x00\x46\x00\x47\x00\x48\x00\x49\x00\x4a\x00\x4b\x00\x4c\x00\x4d\x00\x4e\x00\x4f\x00\x50\x00\x51\x00\x52\x00\x53\x00\x54\x00\x55\x00\x56\x00\x57\x00\x58\x00\x59\x00\x5a\x00\x5b\x00\x5c\x00\x5d\x00\x5e\x00\x5f\x00\x60\x00\x61\x00\x62\x00\x63\x00\x64\x00\x65\x00\x66\x00\x67\x00\x68\x00\x69\x00\x6a\x00\x6b\x00\x6c\x00\x6d\x00\x6e\x00\x6f\x00\x70\x00\x71\x00\x72\x00\x73\x00\x74\x00\x75\x00\x76\x00\x77\x00\x78\x00\x79\x00\x7a\x00\xff\xff\x7c\x00\x21\x00\x7e\x00\x23\x00\x24\x00\x25\x00\x26\x00\x27\x00\xff\xff\xff\xff\x2a\x00\x2b\x00\x2c\x00\x2d\x00\x2e\x00\x2f\x00\x30\x00\x31\x00\x32\x00\x33\x00\x34\x00\x35\x00\x36\x00\x37\x00\x38\x00\x39\x00\x3a\x00\xff\xff\x3c\x00\x3d\x00\x3e\x00\x3f\x00\xff\xff\x41\x00\x42\x00\x43\x00\x44\x00\x45\x00\x46\x00\x47\x00\x48\x00\x49\x00\x4a\x00\x4b\x00\x4c\x00\x4d\x00\x4e\x00\x4f\x00\x50\x00\x51\x00\x52\x00\x53\x00\x54\x00\x55\x00\x56\x00\x57\x00\x58\x00\x59\x00\x5a\x00\x5b\x00\x5c\x00\x5d\x00\x5e\x00\x5f\x00\x60\x00\x61\x00\x62\x00\x63\x00\x64\x00\x65\x00\x66\x00\x67\x00\x68\x00\x69\x00\x6a\x00\x6b\x00\x6c\x00\x6d\x00\x6e\x00\x6f\x00\x70\x00\x71\x00\x72\x00\x73\x00\x74\x00\x75\x00\x76\x00\x77\x00\x78\x00\x79\x00\x7a\x00\xff\xff\x7c\x00\x21\x00\x7e\x00\x23\x00\x24\x00\x25\x00\x26\x00\x27\x00\xff\xff\xff\xff\x2a\x00\x2b\x00\x2c\x00\x2d\x00\x2e\x00\x2f\x00\x30\x00\x31\x00\x32\x00\x33\x00\x34\x00\x35\x00\x36\x00\x37\x00\x38\x00\x39\x00\x3a\x00\xff\xff\x3c\x00\x3d\x00\x3e\x00\x3f\x00\xff\xff\x41\x00\x42\x00\x43\x00\x44\x00\x45\x00\x46\x00\x47\x00\x48\x00\x49\x00\x4a\x00\x4b\x00\x4c\x00\x4d\x00\x4e\x00\x4f\x00\x50\x00\x51\x00\x52\x00\x53\x00\x54\x00\x55\x00\x56\x00\x57\x00\x58\x00\x59\x00\x5a\x00\x5b\x00\x5c\x00\x5d\x00\x5e\x00\x5f\x00\x60\x00\x61\x00\x62\x00\x63\x00\x64\x00\x65\x00\x66\x00\x67\x00\x68\x00\x69\x00\x6a\x00\x6b\x00\x6c\x00\x6d\x00\x6e\x00\x6f\x00\x70\x00\x71\x00\x72\x00\x73\x00\x74\x00\x75\x00\x76\x00\x77\x00\x78\x00\x79\x00\x7a\x00\xff\xff\x7c\x00\x21\x00\x7e\x00\x23\x00\x24\x00\x25\x00\x26\x00\x27\x00\xff\xff\xff\xff\x2a\x00\x2b\x00\x2c\x00\x2d\x00\x2e\x00\x2f\x00\x30\x00\x31\x00\x32\x00\x33\x00\x34\x00\x35\x00\x36\x00\x37\x00\x38\x00\x39\x00\x3a\x00\xff\xff\x3c\x00\x3d\x00\x3e\x00\x3f\x00\xff\xff\x41\x00\x42\x00\x43\x00\x44\x00\x45\x00\x46\x00\x47\x00\x48\x00\x49\x00\x4a\x00\x4b\x00\x4c\x00\x4d\x00\x4e\x00\x4f\x00\x50\x00\x51\x00\x52\x00\x53\x00\x54\x00\x55\x00\x56\x00\x57\x00\x58\x00\x59\x00\x5a\x00\x5b\x00\x5c\x00\x5d\x00\x5e\x00\x5f\x00\x60\x00\x61\x00\x62\x00\x63\x00\x64\x00\x65\x00\x66\x00\x67\x00\x68\x00\x69\x00\x6a\x00\x6b\x00\x6c\x00\x6d\x00\x6e\x00\x6f\x00\x70\x00\x71\x00\x72\x00\x73\x00\x74\x00\x75\x00\x76\x00\x77\x00\x78\x00\x79\x00\x7a\x00\xff\xff\x7c\x00\x21\x00\x7e\x00\x23\x00\x24\x00\x25\x00\x26\x00\x27\x00\xff\xff\xff\xff\x2a\x00\x2b\x00\x2c\x00\x2d\x00\x2e\x00\x2f\x00\x30\x00\x31\x00\x32\x00\x33\x00\x34\x00\x35\x00\x36\x00\x37\x00\x38\x00\x39\x00\x3a\x00\xff\xff\x3c\x00\x3d\x00\x3e\x00\x3f\x00\xff\xff\x41\x00\x42\x00\x43\x00\x44\x00\x45\x00\x46\x00\x47\x00\x48\x00\x49\x00\x4a\x00\x4b\x00\x4c\x00\x4d\x00\x4e\x00\x4f\x00\x50\x00\x51\x00\x52\x00\x53\x00\x54\x00\x55\x00\x56\x00\x57\x00\x58\x00\x59\x00\x5a\x00\x5b\x00\x5c\x00\x5d\x00\x5e\x00\x5f\x00\x60\x00\x61\x00\x62\x00\x63\x00\x64\x00\x65\x00\x66\x00\x67\x00\x68\x00\x69\x00\x6a\x00\x6b\x00\x6c\x00\x6d\x00\x6e\x00\x6f\x00\x70\x00\x71\x00\x72\x00\x73\x00\x74\x00\x75\x00\x76\x00\x77\x00\x78\x00\x79\x00\x7a\x00\xff\xff\x7c\x00\x21\x00\x7e\x00\x23\x00\x24\x00\x25\x00\x26\x00\x27\x00\xff\xff\xff\xff\x2a\x00\x2b\x00\x2c\x00\x2d\x00\x2e\x00\x2f\x00\x30\x00\x31\x00\x32\x00\x33\x00\x34\x00\x35\x00\x36\x00\x37\x00\x38\x00\x39\x00\x3a\x00\xff\xff\x3c\x00\x3d\x00\x3e\x00\x3f\x00\xff\xff\x41\x00\x42\x00\x43\x00\x44\x00\x45\x00\x46\x00\x47\x00\x48\x00\x49\x00\x4a\x00\x4b\x00\x4c\x00\x4d\x00\x4e\x00\x4f\x00\x50\x00\x51\x00\x52\x00\x53\x00\x54\x00\x55\x00\x56\x00\x57\x00\x58\x00\x59\x00\x5a\x00\x5b\x00\x5c\x00\x5d\x00\x5e\x00\x5f\x00\x60\x00\x61\x00\x62\x00\x63\x00\x64\x00\x65\x00\x66\x00\x67\x00\x68\x00\x69\x00\x6a\x00\x6b\x00\x6c\x00\x6d\x00\x6e\x00\x6f\x00\x70\x00\x71\x00\x72\x00\x73\x00\x74\x00\x75\x00\x76\x00\x77\x00\x78\x00\x79\x00\x7a\x00\xff\xff\x7c\x00\x21\x00\x7e\x00\x23\x00\x24\x00\x25\x00\x26\x00\x27\x00\xff\xff\xff\xff\x2a\x00\x2b\x00\x2c\x00\x2d\x00\x2e\x00\x2f\x00\x30\x00\x31\x00\x32\x00\x33\x00\x34\x00\x35\x00\x36\x00\x37\x00\x38\x00\x39\x00\x3a\x00\xff\xff\x3c\x00\x3d\x00\x3e\x00\x3f\x00\xff\xff\x41\x00\x42\x00\x43\x00\x44\x00\x45\x00\x46\x00\x47\x00\x48\x00\x49\x00\x4a\x00\x4b\x00\x4c\x00\x4d\x00\x4e\x00\x4f\x00\x50\x00\x51\x00\x52\x00\x53\x00\x54\x00\x55\x00\x56\x00\x57\x00\x58\x00\x59\x00\x5a\x00\x5b\x00\x5c\x00\x5d\x00\x5e\x00\x5f\x00\x60\x00\x61\x00\x62\x00\x63\x00\x64\x00\x65\x00\x66\x00\x67\x00\x68\x00\x69\x00\x6a\x00\x6b\x00\x6c\x00\x6d\x00\x6e\x00\x6f\x00\x70\x00\x71\x00\x72\x00\x73\x00\x74\x00\x75\x00\x76\x00\x77\x00\x78\x00\x79\x00\x7a\x00\xff\xff\x7c\x00\x21\x00\x7e\x00\x23\x00\x24\x00\x25\x00\x26\x00\x27\x00\xff\xff\xff\xff\x2a\x00\x2b\x00\x2c\x00\x2d\x00\x2e\x00\x2f\x00\x30\x00\x31\x00\x32\x00\x33\x00\x34\x00\x35\x00\x36\x00\x37\x00\x38\x00\x39\x00\x3a\x00\xff\xff\x3c\x00\x3d\x00\x3e\x00\x3f\x00\xff\xff\x41\x00\x42\x00\x43\x00\x44\x00\x45\x00\x46\x00\x47\x00\x48\x00\x49\x00\x4a\x00\x4b\x00\x4c\x00\x4d\x00\x4e\x00\x4f\x00\x50\x00\x51\x00\x52\x00\x53\x00\x54\x00\x55\x00\x56\x00\x57\x00\x58\x00\x59\x00\x5a\x00\x5b\x00\x5c\x00\x5d\x00\x5e\x00\x5f\x00\x60\x00\x61\x00\x62\x00\x63\x00\x64\x00\x65\x00\x66\x00\x67\x00\x68\x00\x69\x00\x6a\x00\x6b\x00\x6c\x00\x6d\x00\x6e\x00\x6f\x00\x70\x00\x71\x00\x72\x00\x73\x00\x74\x00\x75\x00\x76\x00\x77\x00\x78\x00\x79\x00\x7a\x00\xff\xff\x7c\x00\x21\x00\x7e\x00\x23\x00\x24\x00\x25\x00\x26\x00\x27\x00\xff\xff\xff\xff\x2a\x00\x2b\x00\x2c\x00\x2d\x00\x2e\x00\x2f\x00\x30\x00\x31\x00\x32\x00\x33\x00\x34\x00\x35\x00\x36\x00\x37\x00\x38\x00\x39\x00\x3a\x00\xff\xff\x3c\x00\x3d\x00\x3e\x00\x3f\x00\xff\xff\x41\x00\x42\x00\x43\x00\x44\x00\x45\x00\x46\x00\x47\x00\x48\x00\x49\x00\x4a\x00\x4b\x00\x4c\x00\x4d\x00\x4e\x00\x4f\x00\x50\x00\x51\x00\x52\x00\x53\x00\x54\x00\x55\x00\x56\x00\x57\x00\x58\x00\x59\x00\x5a\x00\x5b\x00\x5c\x00\x5d\x00\x5e\x00\x5f\x00\x60\x00\x61\x00\x62\x00\x63\x00\x64\x00\x65\x00\x66\x00\x67\x00\x68\x00\x69\x00\x6a\x00\x6b\x00\x6c\x00\x6d\x00\x6e\x00\x6f\x00\x70\x00\x71\x00\x72\x00\x73\x00\x74\x00\x75\x00\x76\x00\x77\x00\x78\x00\x79\x00\x7a\x00\xff\xff\x7c\x00\x21\x00\x7e\x00\x23\x00\x24\x00\x25\x00\x26\x00\x27\x00\xff\xff\xff\xff\x2a\x00\x2b\x00\x2c\x00\x2d\x00\x2e\x00\x2f\x00\x30\x00\x31\x00\x32\x00\x33\x00\x34\x00\x35\x00\x36\x00\x37\x00\x38\x00\x39\x00\x3a\x00\xff\xff\x3c\x00\x3d\x00\x3e\x00\x3f\x00\xff\xff\x41\x00\x42\x00\x43\x00\x44\x00\x45\x00\x46\x00\x47\x00\x48\x00\x49\x00\x4a\x00\x4b\x00\x4c\x00\x4d\x00\x4e\x00\x4f\x00\x50\x00\x51\x00\x52\x00\x53\x00\x54\x00\x55\x00\x56\x00\x57\x00\x58\x00\x59\x00\x5a\x00\x5b\x00\x5c\x00\x5d\x00\x5e\x00\x5f\x00\x60\x00\x61\x00\x62\x00\x63\x00\x64\x00\x65\x00\x66\x00\x67\x00\x68\x00\x69\x00\x6a\x00\x6b\x00\x6c\x00\x6d\x00\x6e\x00\x6f\x00\x70\x00\x71\x00\x72\x00\x73\x00\x74\x00\x75\x00\x76\x00\x77\x00\x78\x00\x79\x00\x7a\x00\xff\xff\x7c\x00\x21\x00\x7e\x00\x23\x00\x24\x00\x25\x00\x26\x00\x27\x00\xff\xff\xff\xff\x2a\x00\x2b\x00\x2c\x00\x2d\x00\x2e\x00\x2f\x00\x30\x00\x31\x00\x32\x00\x33\x00\x34\x00\x35\x00\x36\x00\x37\x00\x38\x00\x39\x00\x3a\x00\xff\xff\x3c\x00\x3d\x00\x3e\x00\x3f\x00\xff\xff\x41\x00\x42\x00\x43\x00\x44\x00\x45\x00\x46\x00\x47\x00\x48\x00\x49\x00\x4a\x00\x4b\x00\x4c\x00\x4d\x00\x4e\x00\x4f\x00\x50\x00\x51\x00\x52\x00\x53\x00\x54\x00\x55\x00\x56\x00\x57\x00\x58\x00\x59\x00\x5a\x00\x5b\x00\x5c\x00\x5d\x00\x5e\x00\x5f\x00\x60\x00\x61\x00\x62\x00\x63\x00\x64\x00\x65\x00\x66\x00\x67\x00\x68\x00\x69\x00\x6a\x00\x6b\x00\x6c\x00\x6d\x00\x6e\x00\x6f\x00\x70\x00\x71\x00\x72\x00\x73\x00\x74\x00\x75\x00\x76\x00\x77\x00\x78\x00\x79\x00\x7a\x00\xff\xff\x7c\x00\x21\x00\x7e\x00\x23\x00\x24\x00\x25\x00\x26\x00\x27\x00\xff\xff\xff\xff\x2a\x00\x2b\x00\x2c\x00\x2d\x00\x2e\x00\x2f\x00\x30\x00\x31\x00\x32\x00\x33\x00\x34\x00\x35\x00\x36\x00\x37\x00\x38\x00\x39\x00\x3a\x00\xff\xff\x3c\x00\x3d\x00\x3e\x00\x3f\x00\xff\xff\x41\x00\x42\x00\x43\x00\x44\x00\x45\x00\x46\x00\x47\x00\x48\x00\x49\x00\x4a\x00\x4b\x00\x4c\x00\x4d\x00\x4e\x00\x4f\x00\x50\x00\x51\x00\x52\x00\x53\x00\x54\x00\x55\x00\x56\x00\x57\x00\x58\x00\x59\x00\x5a\x00\x5b\x00\x5c\x00\x5d\x00\x5e\x00\x5f\x00\x60\x00\x61\x00\x62\x00\x63\x00\x64\x00\x65\x00\x66\x00\x67\x00\x68\x00\x69\x00\x6a\x00\x6b\x00\x6c\x00\x6d\x00\x6e\x00\x6f\x00\x70\x00\x71\x00\x72\x00\x73\x00\x74\x00\x75\x00\x76\x00\x77\x00\x78\x00\x79\x00\x7a\x00\xff\xff\x7c\x00\x21\x00\x7e\x00\x23\x00\x24\x00\x25\x00\x26\x00\x27\x00\xff\xff\xff\xff\x2a\x00\x2b\x00\x2c\x00\x2d\x00\x2e\x00\x2f\x00\x30\x00\x31\x00\x32\x00\x33\x00\x34\x00\x35\x00\x36\x00\x37\x00\x38\x00\x39\x00\x3a\x00\xff\xff\x3c\x00\x3d\x00\x3e\x00\x3f\x00\xff\xff\x41\x00\x42\x00\x43\x00\x44\x00\x45\x00\x46\x00\x47\x00\x48\x00\x49\x00\x4a\x00\x4b\x00\x4c\x00\x4d\x00\x4e\x00\x4f\x00\x50\x00\x51\x00\x52\x00\x53\x00\x54\x00\x55\x00\x56\x00\x57\x00\x58\x00\x59\x00\x5a\x00\x5b\x00\x5c\x00\x5d\x00\x5e\x00\x5f\x00\x60\x00\x61\x00\x62\x00\x63\x00\x64\x00\x65\x00\x66\x00\x67\x00\x68\x00\x69\x00\x6a\x00\x6b\x00\x6c\x00\x6d\x00\x6e\x00\x6f\x00\x70\x00\x71\x00\x72\x00\x73\x00\x74\x00\x75\x00\x76\x00\x77\x00\x78\x00\x79\x00\x7a\x00\xff\xff\x7c\x00\x21\x00\x7e\x00\x23\x00\x24\x00\x25\x00\x26\x00\x27\x00\xff\xff\xff\xff\x2a\x00\x2b\x00\x2c\x00\x2d\x00\x2e\x00\x2f\x00\x30\x00\x31\x00\x32\x00\x33\x00\x34\x00\x35\x00\x36\x00\x37\x00\x38\x00\x39\x00\x3a\x00\xff\xff\x3c\x00\x3d\x00\x3e\x00\x3f\x00\xff\xff\x41\x00\x42\x00\x43\x00\x44\x00\x45\x00\x46\x00\x47\x00\x48\x00\x49\x00\x4a\x00\x4b\x00\x4c\x00\x4d\x00\x4e\x00\x4f\x00\x50\x00\x51\x00\x52\x00\x53\x00\x54\x00\x55\x00\x56\x00\x57\x00\x58\x00\x59\x00\x5a\x00\x5b\x00\x5c\x00\x5d\x00\x5e\x00\x5f\x00\x60\x00\x61\x00\x62\x00\x63\x00\x64\x00\x65\x00\x66\x00\x67\x00\x68\x00\x69\x00\x6a\x00\x6b\x00\x6c\x00\x6d\x00\x6e\x00\x6f\x00\x70\x00\x71\x00\x72\x00\x73\x00\x74\x00\x75\x00\x76\x00\x77\x00\x78\x00\x79\x00\x7a\x00\xff\xff\x7c\x00\x21\x00\x7e\x00\x23\x00\x24\x00\x25\x00\x26\x00\x27\x00\xff\xff\xff\xff\x2a\x00\x2b\x00\x2c\x00\x2d\x00\x2e\x00\x2f\x00\x30\x00\x31\x00\x32\x00\x33\x00\x34\x00\x35\x00\x36\x00\x37\x00\x38\x00\x39\x00\x3a\x00\xff\xff\x3c\x00\x3d\x00\x3e\x00\x3f\x00\xff\xff\x41\x00\x42\x00\x43\x00\x44\x00\x45\x00\x46\x00\x47\x00\x48\x00\x49\x00\x4a\x00\x4b\x00\x4c\x00\x4d\x00\x4e\x00\x4f\x00\x50\x00\x51\x00\x52\x00\x53\x00\x54\x00\x55\x00\x56\x00\x57\x00\x58\x00\x59\x00\x5a\x00\x5b\x00\x5c\x00\x5d\x00\x5e\x00\x5f\x00\x60\x00\x61\x00\x62\x00\x63\x00\x64\x00\x65\x00\x66\x00\x67\x00\x68\x00\x69\x00\x6a\x00\x6b\x00\x6c\x00\x6d\x00\x6e\x00\x6f\x00\x70\x00\x71\x00\x72\x00\x73\x00\x74\x00\x75\x00\x76\x00\x77\x00\x78\x00\x79\x00\x7a\x00\xff\xff\x7c\x00\x21\x00\x7e\x00\x23\x00\x24\x00\x25\x00\x26\x00\x27\x00\xff\xff\xff\xff\x2a\x00\x2b\x00\x2c\x00\x2d\x00\x2e\x00\x2f\x00\x30\x00\x31\x00\x32\x00\x33\x00\x34\x00\x35\x00\x36\x00\x37\x00\x38\x00\x39\x00\x3a\x00\xff\xff\x3c\x00\x3d\x00\x3e\x00\x3f\x00\xff\xff\x41\x00\x42\x00\x43\x00\x44\x00\x45\x00\x46\x00\x47\x00\x48\x00\x49\x00\x4a\x00\x4b\x00\x4c\x00\x4d\x00\x4e\x00\x4f\x00\x50\x00\x51\x00\x52\x00\x53\x00\x54\x00\x55\x00\x56\x00\x57\x00\x58\x00\x59\x00\x5a\x00\x5b\x00\x5c\x00\x5d\x00\x5e\x00\x5f\x00\x60\x00\x61\x00\x62\x00\x63\x00\x64\x00\x65\x00\x66\x00\x67\x00\x68\x00\x69\x00\x6a\x00\x6b\x00\x6c\x00\x6d\x00\x6e\x00\x6f\x00\x70\x00\x71\x00\x72\x00\x73\x00\x74\x00\x75\x00\x76\x00\x77\x00\x78\x00\x79\x00\x7a\x00\xff\xff\x7c\x00\x21\x00\x7e\x00\x23\x00\x24\x00\x25\x00\x26\x00\x27\x00\xff\xff\xff\xff\x2a\x00\x2b\x00\x2c\x00\x2d\x00\x2e\x00\x2f\x00\x30\x00\x31\x00\x32\x00\x33\x00\x34\x00\x35\x00\x36\x00\x37\x00\x38\x00\x39\x00\x3a\x00\xff\xff\x3c\x00\x3d\x00\x3e\x00\x3f\x00\xff\xff\x41\x00\x42\x00\x43\x00\x44\x00\x45\x00\x46\x00\x47\x00\x48\x00\x49\x00\x4a\x00\x4b\x00\x4c\x00\x4d\x00\x4e\x00\x4f\x00\x50\x00\x51\x00\x52\x00\x53\x00\x54\x00\x55\x00\x56\x00\x57\x00\x58\x00\x59\x00\x5a\x00\x5b\x00\x5c\x00\x5d\x00\x5e\x00\x5f\x00\x60\x00\x61\x00\x62\x00\x63\x00\x64\x00\x65\x00\x66\x00\x67\x00\x68\x00\x69\x00\x6a\x00\x6b\x00\x6c\x00\x6d\x00\x6e\x00\x6f\x00\x70\x00\x71\x00\x72\x00\x73\x00\x74\x00\x75\x00\x76\x00\x77\x00\x78\x00\x79\x00\x7a\x00\xff\xff\x7c\x00\x21\x00\x7e\x00\x23\x00\x24\x00\x25\x00\x26\x00\x27\x00\xff\xff\xff\xff\x2a\x00\x2b\x00\x2c\x00\x2d\x00\x2e\x00\x2f\x00\x30\x00\x31\x00\x32\x00\x33\x00\x34\x00\x35\x00\x36\x00\x37\x00\x38\x00\x39\x00\x3a\x00\xff\xff\x3c\x00\x3d\x00\x3e\x00\x3f\x00\xff\xff\x41\x00\x42\x00\x43\x00\x44\x00\x45\x00\x46\x00\x47\x00\x48\x00\x49\x00\x4a\x00\x4b\x00\x4c\x00\x4d\x00\x4e\x00\x4f\x00\x50\x00\x51\x00\x52\x00\x53\x00\x54\x00\x55\x00\x56\x00\x57\x00\x58\x00\x59\x00\x5a\x00\x5b\x00\x5c\x00\x5d\x00\x5e\x00\x5f\x00\x60\x00\x61\x00\x62\x00\x63\x00\x64\x00\x65\x00\x66\x00\x67\x00\x68\x00\x69\x00\x6a\x00\x6b\x00\x6c\x00\x6d\x00\x6e\x00\x6f\x00\x70\x00\x71\x00\x72\x00\x73\x00\x74\x00\x75\x00\x76\x00\x77\x00\x78\x00\x79\x00\x7a\x00\xff\xff\x7c\x00\x21\x00\x7e\x00\x23\x00\x24\x00\x25\x00\x26\x00\x27\x00\xff\xff\xff\xff\x2a\x00\x2b\x00\x2c\x00\x2d\x00\x2e\x00\x2f\x00\x30\x00\x31\x00\x32\x00\x33\x00\x34\x00\x35\x00\x36\x00\x37\x00\x38\x00\x39\x00\x3a\x00\xff\xff\x3c\x00\x3d\x00\x3e\x00\x3f\x00\xff\xff\x41\x00\x42\x00\x43\x00\x44\x00\x45\x00\x46\x00\x47\x00\x48\x00\x49\x00\x4a\x00\x4b\x00\x4c\x00\x4d\x00\x4e\x00\x4f\x00\x50\x00\x51\x00\x52\x00\x53\x00\x54\x00\x55\x00\x56\x00\x57\x00\x58\x00\x59\x00\x5a\x00\x5b\x00\x5c\x00\x5d\x00\x5e\x00\x5f\x00\x60\x00\x61\x00\x62\x00\x63\x00\x64\x00\x65\x00\x66\x00\x67\x00\x68\x00\x69\x00\x6a\x00\x6b\x00\x6c\x00\x6d\x00\x6e\x00\x6f\x00\x70\x00\x71\x00\x72\x00\x73\x00\x74\x00\x75\x00\x76\x00\x77\x00\x78\x00\x79\x00\x7a\x00\xff\xff\x7c\x00\x21\x00\x7e\x00\x23\x00\x24\x00\x25\x00\x26\x00\x27\x00\xff\xff\xff\xff\x2a\x00\x2b\x00\x2c\x00\x2d\x00\x2e\x00\x2f\x00\x30\x00\x31\x00\x32\x00\x33\x00\x34\x00\x35\x00\x36\x00\x37\x00\x38\x00\x39\x00\x3a\x00\xff\xff\x3c\x00\x3d\x00\x3e\x00\x3f\x00\xff\xff\x41\x00\x42\x00\x43\x00\x44\x00\x45\x00\x46\x00\x47\x00\x48\x00\x49\x00\x4a\x00\x4b\x00\x4c\x00\x4d\x00\x4e\x00\x4f\x00\x50\x00\x51\x00\x52\x00\x53\x00\x54\x00\x55\x00\x56\x00\x57\x00\x58\x00\x59\x00\x5a\x00\x5b\x00\x5c\x00\x5d\x00\x5e\x00\x5f\x00\x60\x00\x61\x00\x62\x00\x63\x00\x64\x00\x65\x00\x66\x00\x67\x00\x68\x00\x69\x00\x6a\x00\x6b\x00\x6c\x00\x6d\x00\x6e\x00\x6f\x00\x70\x00\x71\x00\x72\x00\x73\x00\x74\x00\x75\x00\x76\x00\x77\x00\x78\x00\x79\x00\x7a\x00\xff\xff\x7c\x00\x21\x00\x7e\x00\x23\x00\x24\x00\x25\x00\x26\x00\x27\x00\xff\xff\xff\xff\x2a\x00\x2b\x00\x2c\x00\x2d\x00\x2e\x00\x2f\x00\x30\x00\x31\x00\x32\x00\x33\x00\x34\x00\x35\x00\x36\x00\x37\x00\x38\x00\x39\x00\x3a\x00\xff\xff\x3c\x00\x3d\x00\x3e\x00\x3f\x00\xff\xff\x41\x00\x42\x00\x43\x00\x44\x00\x45\x00\x46\x00\x47\x00\x48\x00\x49\x00\x4a\x00\x4b\x00\x4c\x00\x4d\x00\x4e\x00\x4f\x00\x50\x00\x51\x00\x52\x00\x53\x00\x54\x00\x55\x00\x56\x00\x57\x00\x58\x00\x59\x00\x5a\x00\x5b\x00\x5c\x00\x5d\x00\x5e\x00\x5f\x00\x60\x00\x61\x00\x62\x00\x63\x00\x64\x00\x65\x00\x66\x00\x67\x00\x68\x00\x69\x00\x6a\x00\x6b\x00\x6c\x00\x6d\x00\x6e\x00\x6f\x00\x70\x00\x71\x00\x72\x00\x73\x00\x74\x00\x75\x00\x76\x00\x77\x00\x78\x00\x79\x00\x7a\x00\xff\xff\x7c\x00\x21\x00\x7e\x00\x23\x00\x24\x00\x25\x00\x26\x00\x27\x00\xff\xff\xff\xff\x2a\x00\x2b\x00\x2c\x00\x2d\x00\x2e\x00\x2f\x00\x30\x00\x31\x00\x32\x00\x33\x00\x34\x00\x35\x00\x36\x00\x37\x00\x38\x00\x39\x00\x3a\x00\xff\xff\x3c\x00\x3d\x00\x3e\x00\x3f\x00\xff\xff\x41\x00\x42\x00\x43\x00\x44\x00\x45\x00\x46\x00\x47\x00\x48\x00\x49\x00\x4a\x00\x4b\x00\x4c\x00\x4d\x00\x4e\x00\x4f\x00\x50\x00\x51\x00\x52\x00\x53\x00\x54\x00\x55\x00\x56\x00\x57\x00\x58\x00\x59\x00\x5a\x00\x5b\x00\x5c\x00\x5d\x00\x5e\x00\x5f\x00\x60\x00\x61\x00\x62\x00\x63\x00\x64\x00\x65\x00\x66\x00\x67\x00\x68\x00\x69\x00\x6a\x00\x6b\x00\x6c\x00\x6d\x00\x6e\x00\x6f\x00\x70\x00\x71\x00\x72\x00\x73\x00\x74\x00\x75\x00\x76\x00\x77\x00\x78\x00\x79\x00\x7a\x00\xff\xff\x7c\x00\x21\x00\x7e\x00\x23\x00\x24\x00\x25\x00\x26\x00\x27\x00\xff\xff\xff\xff\x2a\x00\x2b\x00\x2c\x00\x2d\x00\x2e\x00\x2f\x00\x30\x00\x31\x00\x32\x00\x33\x00\x34\x00\x35\x00\x36\x00\x37\x00\x38\x00\x39\x00\x3a\x00\xff\xff\x3c\x00\x3d\x00\x3e\x00\x3f\x00\xff\xff\x41\x00\x42\x00\x43\x00\x44\x00\x45\x00\x46\x00\x47\x00\x48\x00\x49\x00\x4a\x00\x4b\x00\x4c\x00\x4d\x00\x4e\x00\x4f\x00\x50\x00\x51\x00\x52\x00\x53\x00\x54\x00\x55\x00\x56\x00\x57\x00\x58\x00\x59\x00\x5a\x00\x5b\x00\x5c\x00\x5d\x00\x5e\x00\x5f\x00\x60\x00\x61\x00\x62\x00\x63\x00\x64\x00\x65\x00\x66\x00\x67\x00\x68\x00\x69\x00\x6a\x00\x6b\x00\x6c\x00\x6d\x00\x6e\x00\x6f\x00\x70\x00\x71\x00\x72\x00\x73\x00\x74\x00\x75\x00\x76\x00\x77\x00\x78\x00\x79\x00\x7a\x00\xff\xff\x7c\x00\x21\x00\x7e\x00\x23\x00\x24\x00\x25\x00\x26\x00\x27\x00\xff\xff\xff\xff\x2a\x00\x2b\x00\x2c\x00\x2d\x00\x2e\x00\x2f\x00\x30\x00\x31\x00\x32\x00\x33\x00\x34\x00\x35\x00\x36\x00\x37\x00\x38\x00\x39\x00\x3a\x00\xff\xff\x3c\x00\x3d\x00\x3e\x00\x3f\x00\xff\xff\x41\x00\x42\x00\x43\x00\x44\x00\x45\x00\x46\x00\x47\x00\x48\x00\x49\x00\x4a\x00\x4b\x00\x4c\x00\x4d\x00\x4e\x00\x4f\x00\x50\x00\x51\x00\x52\x00\x53\x00\x54\x00\x55\x00\x56\x00\x57\x00\x58\x00\x59\x00\x5a\x00\x5b\x00\x5c\x00\x5d\x00\x5e\x00\x5f\x00\x60\x00\x61\x00\x62\x00\x63\x00\x64\x00\x65\x00\x66\x00\x67\x00\x68\x00\x69\x00\x6a\x00\x6b\x00\x6c\x00\x6d\x00\x6e\x00\x6f\x00\x70\x00\x71\x00\x72\x00\x73\x00\x74\x00\x75\x00\x76\x00\x77\x00\x78\x00\x79\x00\x7a\x00\xff\xff\x7c\x00\x21\x00\x7e\x00\x23\x00\x24\x00\x25\x00\x26\x00\x27\x00\xff\xff\xff\xff\x2a\x00\x2b\x00\x2c\x00\x2d\x00\x2e\x00\x2f\x00\x30\x00\x31\x00\x32\x00\x33\x00\x34\x00\x35\x00\x36\x00\x37\x00\x38\x00\x39\x00\x3a\x00\xff\xff\x3c\x00\x3d\x00\x3e\x00\x3f\x00\xff\xff\x41\x00\x42\x00\x43\x00\x44\x00\x45\x00\x46\x00\x47\x00\x48\x00\x49\x00\x4a\x00\x4b\x00\x4c\x00\x4d\x00\x4e\x00\x4f\x00\x50\x00\x51\x00\x52\x00\x53\x00\x54\x00\x55\x00\x56\x00\x57\x00\x58\x00\x59\x00\x5a\x00\x5b\x00\x5c\x00\x5d\x00\x5e\x00\x5f\x00\x60\x00\x61\x00\x62\x00\x63\x00\x64\x00\x65\x00\x66\x00\x67\x00\x68\x00\x69\x00\x6a\x00\x6b\x00\x6c\x00\x6d\x00\x6e\x00\x6f\x00\x70\x00\x71\x00\x72\x00\x73\x00\x74\x00\x75\x00\x76\x00\x77\x00\x78\x00\x79\x00\x7a\x00\xff\xff\x7c\x00\x21\x00\x7e\x00\x23\x00\x24\x00\x25\x00\x26\x00\x27\x00\xff\xff\xff\xff\x2a\x00\x2b\x00\x2c\x00\x2d\x00\x2e\x00\x2f\x00\x30\x00\x31\x00\x32\x00\x33\x00\x34\x00\x35\x00\x36\x00\x37\x00\x38\x00\x39\x00\x3a\x00\xff\xff\x3c\x00\x3d\x00\x3e\x00\x3f\x00\xff\xff\x41\x00\x42\x00\x43\x00\x44\x00\x45\x00\x46\x00\x47\x00\x48\x00\x49\x00\x4a\x00\x4b\x00\x4c\x00\x4d\x00\x4e\x00\x4f\x00\x50\x00\x51\x00\x52\x00\x53\x00\x54\x00\x55\x00\x56\x00\x57\x00\x58\x00\x59\x00\x5a\x00\x5b\x00\x5c\x00\x5d\x00\x5e\x00\x5f\x00\x60\x00\x61\x00\x62\x00\x63\x00\x64\x00\x65\x00\x66\x00\x67\x00\x68\x00\x69\x00\x6a\x00\x6b\x00\x6c\x00\x6d\x00\x6e\x00\x6f\x00\x70\x00\x71\x00\x72\x00\x73\x00\x74\x00\x75\x00\x76\x00\x77\x00\x78\x00\x79\x00\x7a\x00\xff\xff\x7c\x00\x21\x00\x7e\x00\x23\x00\x24\x00\x25\x00\x26\x00\x27\x00\xff\xff\xff\xff\x2a\x00\x2b\x00\x2c\x00\x2d\x00\x2e\x00\x2f\x00\x30\x00\x31\x00\x32\x00\x33\x00\x34\x00\x35\x00\x36\x00\x37\x00\x38\x00\x39\x00\x3a\x00\xff\xff\x3c\x00\x3d\x00\x3e\x00\x3f\x00\xff\xff\x41\x00\x42\x00\x43\x00\x44\x00\x45\x00\x46\x00\x47\x00\x48\x00\x49\x00\x4a\x00\x4b\x00\x4c\x00\x4d\x00\x4e\x00\x4f\x00\x50\x00\x51\x00\x52\x00\x53\x00\x54\x00\x55\x00\x56\x00\x57\x00\x58\x00\x59\x00\x5a\x00\x5b\x00\x5c\x00\x5d\x00\x5e\x00\x5f\x00\x60\x00\x61\x00\x62\x00\x63\x00\x64\x00\x65\x00\x66\x00\x67\x00\x68\x00\x69\x00\x6a\x00\x6b\x00\x6c\x00\x6d\x00\x6e\x00\x6f\x00\x70\x00\x71\x00\x72\x00\x73\x00\x74\x00\x75\x00\x76\x00\x77\x00\x78\x00\x79\x00\x7a\x00\xff\xff\x7c\x00\x21\x00\x7e\x00\x23\x00\x24\x00\x25\x00\x26\x00\x27\x00\xff\xff\xff\xff\x2a\x00\x2b\x00\x2c\x00\x2d\x00\x2e\x00\x2f\x00\x30\x00\x31\x00\x32\x00\x33\x00\x34\x00\x35\x00\x36\x00\x37\x00\x38\x00\x39\x00\x3a\x00\xff\xff\x3c\x00\x3d\x00\x3e\x00\x3f\x00\xff\xff\x41\x00\x42\x00\x43\x00\x44\x00\x45\x00\x46\x00\x47\x00\x48\x00\x49\x00\x4a\x00\x4b\x00\x4c\x00\x4d\x00\x4e\x00\x4f\x00\x50\x00\x51\x00\x52\x00\x53\x00\x54\x00\x55\x00\x56\x00\x57\x00\x58\x00\x59\x00\x5a\x00\x5b\x00\x5c\x00\x5d\x00\x5e\x00\x5f\x00\x60\x00\x61\x00\x62\x00\x63\x00\x64\x00\x65\x00\x66\x00\x67\x00\x68\x00\x69\x00\x6a\x00\x6b\x00\x6c\x00\x6d\x00\x6e\x00\x6f\x00\x70\x00\x71\x00\x72\x00\x73\x00\x74\x00\x75\x00\x76\x00\x77\x00\x78\x00\x79\x00\x7a\x00\xff\xff\x7c\x00\x21\x00\x7e\x00\x23\x00\x24\x00\x25\x00\x26\x00\x27\x00\xff\xff\xff\xff\x2a\x00\x2b\x00\x2c\x00\x2d\x00\x2e\x00\x2f\x00\x30\x00\x31\x00\x32\x00\x33\x00\x34\x00\x35\x00\x36\x00\x37\x00\x38\x00\x39\x00\x3a\x00\xff\xff\x3c\x00\x3d\x00\x3e\x00\x3f\x00\xff\xff\x41\x00\x42\x00\x43\x00\x44\x00\x45\x00\x46\x00\x47\x00\x48\x00\x49\x00\x4a\x00\x4b\x00\x4c\x00\x4d\x00\x4e\x00\x4f\x00\x50\x00\x51\x00\x52\x00\x53\x00\x54\x00\x55\x00\x56\x00\x57\x00\x58\x00\x59\x00\x5a\x00\x5b\x00\x5c\x00\x5d\x00\x5e\x00\x5f\x00\x60\x00\x61\x00\x62\x00\x63\x00\x64\x00\x65\x00\x66\x00\x67\x00\x68\x00\x69\x00\x6a\x00\x6b\x00\x6c\x00\x6d\x00\x6e\x00\x6f\x00\x70\x00\x71\x00\x72\x00\x73\x00\x74\x00\x75\x00\x76\x00\x77\x00\x78\x00\x79\x00\x7a\x00\xff\xff\x7c\x00\x21\x00\x7e\x00\x23\x00\x24\x00\x25\x00\x26\x00\x27\x00\xff\xff\xff\xff\x2a\x00\x2b\x00\x2c\x00\x2d\x00\x2e\x00\x2f\x00\x30\x00\x31\x00\x32\x00\x33\x00\x34\x00\x35\x00\x36\x00\x37\x00\x38\x00\x39\x00\x3a\x00\xff\xff\x3c\x00\x3d\x00\x3e\x00\x3f\x00\xff\xff\x41\x00\x42\x00\x43\x00\x44\x00\x45\x00\x46\x00\x47\x00\x48\x00\x49\x00\x4a\x00\x4b\x00\x4c\x00\x4d\x00\x4e\x00\x4f\x00\x50\x00\x51\x00\x52\x00\x53\x00\x54\x00\x55\x00\x56\x00\x57\x00\x58\x00\x59\x00\x5a\x00\x5b\x00\x5c\x00\x5d\x00\x5e\x00\x5f\x00\x60\x00\x61\x00\x62\x00\x63\x00\x64\x00\x65\x00\x66\x00\x67\x00\x68\x00\x69\x00\x6a\x00\x6b\x00\x6c\x00\x6d\x00\x6e\x00\x6f\x00\x70\x00\x71\x00\x72\x00\x73\x00\x74\x00\x75\x00\x76\x00\x77\x00\x78\x00\x79\x00\x7a\x00\xff\xff\x7c\x00\x21\x00\x7e\x00\x23\x00\x24\x00\x25\x00\x26\x00\x27\x00\xff\xff\xff\xff\x2a\x00\x2b\x00\x2c\x00\x2d\x00\x2e\x00\x2f\x00\x30\x00\x31\x00\x32\x00\x33\x00\x34\x00\x35\x00\x36\x00\x37\x00\x38\x00\x39\x00\x3a\x00\xff\xff\x3c\x00\x3d\x00\x3e\x00\x3f\x00\xff\xff\x41\x00\x42\x00\x43\x00\x44\x00\x45\x00\x46\x00\x47\x00\x48\x00\x49\x00\x4a\x00\x4b\x00\x4c\x00\x4d\x00\x4e\x00\x4f\x00\x50\x00\x51\x00\x52\x00\x53\x00\x54\x00\x55\x00\x56\x00\x57\x00\x58\x00\x59\x00\x5a\x00\x5b\x00\x5c\x00\x5d\x00\x5e\x00\x5f\x00\x60\x00\x61\x00\x62\x00\x63\x00\x64\x00\x65\x00\x66\x00\x67\x00\x68\x00\x69\x00\x6a\x00\x6b\x00\x6c\x00\x6d\x00\x6e\x00\x6f\x00\x70\x00\x71\x00\x72\x00\x73\x00\x74\x00\x75\x00\x76\x00\x77\x00\x78\x00\x79\x00\x7a\x00\xff\xff\x7c\x00\x21\x00\x7e\x00\x23\x00\x24\x00\x25\x00\x26\x00\x27\x00\xff\xff\xff\xff\x2a\x00\x2b\x00\x2c\x00\x2d\x00\x2e\x00\x2f\x00\x30\x00\x31\x00\x32\x00\x33\x00\x34\x00\x35\x00\x36\x00\x37\x00\x38\x00\x39\x00\x3a\x00\xff\xff\x3c\x00\x3d\x00\x3e\x00\x3f\x00\xff\xff\x41\x00\x42\x00\x43\x00\x44\x00\x45\x00\x46\x00\x47\x00\x48\x00\x49\x00\x4a\x00\x4b\x00\x4c\x00\x4d\x00\x4e\x00\x4f\x00\x50\x00\x51\x00\x52\x00\x53\x00\x54\x00\x55\x00\x56\x00\x57\x00\x58\x00\x59\x00\x5a\x00\x5b\x00\x5c\x00\x5d\x00\x5e\x00\x5f\x00\x60\x00\x61\x00\x62\x00\x63\x00\x64\x00\x65\x00\x66\x00\x67\x00\x68\x00\x69\x00\x6a\x00\x6b\x00\x6c\x00\x6d\x00\x6e\x00\x6f\x00\x70\x00\x71\x00\x72\x00\x73\x00\x74\x00\x75\x00\x76\x00\x77\x00\x78\x00\x79\x00\x7a\x00\xff\xff\x7c\x00\x21\x00\x7e\x00\x23\x00\x24\x00\x25\x00\x26\x00\x27\x00\xff\xff\xff\xff\x2a\x00\x2b\x00\x2c\x00\x2d\x00\x2e\x00\x2f\x00\x30\x00\x31\x00\x32\x00\x33\x00\x34\x00\x35\x00\x36\x00\x37\x00\x38\x00\x39\x00\x3a\x00\xff\xff\x3c\x00\x3d\x00\x3e\x00\x3f\x00\xff\xff\x41\x00\x42\x00\x43\x00\x44\x00\x45\x00\x46\x00\x47\x00\x48\x00\x49\x00\x4a\x00\x4b\x00\x4c\x00\x4d\x00\x4e\x00\x4f\x00\x50\x00\x51\x00\x52\x00\x53\x00\x54\x00\x55\x00\x56\x00\x57\x00\x58\x00\x59\x00\x5a\x00\x5b\x00\x5c\x00\x5d\x00\x5e\x00\x5f\x00\x60\x00\x61\x00\x62\x00\x63\x00\x64\x00\x65\x00\x66\x00\x67\x00\x68\x00\x69\x00\x6a\x00\x6b\x00\x6c\x00\x6d\x00\x6e\x00\x6f\x00\x70\x00\x71\x00\x72\x00\x73\x00\x74\x00\x75\x00\x76\x00\x77\x00\x78\x00\x79\x00\x7a\x00\xff\xff\x7c\x00\x21\x00\x7e\x00\x23\x00\x24\x00\x25\x00\x26\x00\x27\x00\xff\xff\xff\xff\x2a\x00\x2b\x00\x2c\x00\x2d\x00\x2e\x00\x2f\x00\x30\x00\x31\x00\x32\x00\x33\x00\x34\x00\x35\x00\x36\x00\x37\x00\x38\x00\x39\x00\x3a\x00\xff\xff\x3c\x00\x3d\x00\x3e\x00\x3f\x00\xff\xff\x41\x00\x42\x00\x43\x00\x44\x00\x45\x00\x46\x00\x47\x00\x48\x00\x49\x00\x4a\x00\x4b\x00\x4c\x00\x4d\x00\x4e\x00\x4f\x00\x50\x00\x51\x00\x52\x00\x53\x00\x54\x00\x55\x00\x56\x00\x57\x00\x58\x00\x59\x00\x5a\x00\x5b\x00\x5c\x00\x5d\x00\x5e\x00\x5f\x00\x60\x00\x61\x00\x62\x00\x63\x00\x64\x00\x65\x00\x66\x00\x67\x00\x68\x00\x69\x00\x6a\x00\x6b\x00\x6c\x00\x6d\x00\x6e\x00\x6f\x00\x70\x00\x71\x00\x72\x00\x73\x00\x74\x00\x75\x00\x76\x00\x77\x00\x78\x00\x79\x00\x7a\x00\xff\xff\x7c\x00\x21\x00\x7e\x00\x23\x00\x24\x00\x25\x00\x26\x00\x27\x00\xff\xff\xff\xff\x2a\x00\x2b\x00\x2c\x00\x2d\x00\x2e\x00\x2f\x00\x30\x00\x31\x00\x32\x00\x33\x00\x34\x00\x35\x00\x36\x00\x37\x00\x38\x00\x39\x00\x3a\x00\xff\xff\x3c\x00\x3d\x00\x3e\x00\x3f\x00\xff\xff\x41\x00\x42\x00\x43\x00\x44\x00\x45\x00\x46\x00\x47\x00\x48\x00\x49\x00\x4a\x00\x4b\x00\x4c\x00\x4d\x00\x4e\x00\x4f\x00\x50\x00\x51\x00\x52\x00\x53\x00\x54\x00\x55\x00\x56\x00\x57\x00\x58\x00\x59\x00\x5a\x00\x5b\x00\x5c\x00\x5d\x00\x5e\x00\x5f\x00\x60\x00\x61\x00\x62\x00\x63\x00\x64\x00\x65\x00\x66\x00\x67\x00\x68\x00\x69\x00\x6a\x00\x6b\x00\x6c\x00\x6d\x00\x6e\x00\x6f\x00\x70\x00\x71\x00\x72\x00\x73\x00\x74\x00\x75\x00\x76\x00\x77\x00\x78\x00\x79\x00\x7a\x00\xff\xff\x7c\x00\x21\x00\x7e\x00\x23\x00\x24\x00\x25\x00\x26\x00\x27\x00\xff\xff\xff\xff\x2a\x00\x2b\x00\x2c\x00\x2d\x00\x2e\x00\x2f\x00\x30\x00\x31\x00\x32\x00\x33\x00\x34\x00\x35\x00\x36\x00\x37\x00\x38\x00\x39\x00\x3a\x00\xff\xff\x3c\x00\x3d\x00\x3e\x00\x3f\x00\xff\xff\x41\x00\x42\x00\x43\x00\x44\x00\x45\x00\x46\x00\x47\x00\x48\x00\x49\x00\x4a\x00\x4b\x00\x4c\x00\x4d\x00\x4e\x00\x4f\x00\x50\x00\x51\x00\x52\x00\x53\x00\x54\x00\x55\x00\x56\x00\x57\x00\x58\x00\x59\x00\x5a\x00\x5b\x00\x5c\x00\x5d\x00\x5e\x00\x5f\x00\x60\x00\x61\x00\x62\x00\x63\x00\x64\x00\x65\x00\x66\x00\x67\x00\x68\x00\x69\x00\x6a\x00\x6b\x00\x6c\x00\x6d\x00\x6e\x00\x6f\x00\x70\x00\x71\x00\x72\x00\x73\x00\x74\x00\x75\x00\x76\x00\x77\x00\x78\x00\x79\x00\x7a\x00\xff\xff\x7c\x00\x21\x00\x7e\x00\x23\x00\x24\x00\x25\x00\x26\x00\x27\x00\xff\xff\xff\xff\x2a\x00\x2b\x00\x2c\x00\x2d\x00\x2e\x00\x2f\x00\x30\x00\x31\x00\x32\x00\x33\x00\x34\x00\x35\x00\x36\x00\x37\x00\x38\x00\x39\x00\x3a\x00\xff\xff\x3c\x00\x3d\x00\x3e\x00\x3f\x00\xff\xff\x41\x00\x42\x00\x43\x00\x44\x00\x45\x00\x46\x00\x47\x00\x48\x00\x49\x00\x4a\x00\x4b\x00\x4c\x00\x4d\x00\x4e\x00\x4f\x00\x50\x00\x51\x00\x52\x00\x53\x00\x54\x00\x55\x00\x56\x00\x57\x00\x58\x00\x59\x00\x5a\x00\x5b\x00\x5c\x00\x5d\x00\x5e\x00\x5f\x00\x60\x00\x61\x00\x62\x00\x63\x00\x64\x00\x65\x00\x66\x00\x67\x00\x68\x00\x69\x00\x6a\x00\x6b\x00\x6c\x00\x6d\x00\x6e\x00\x6f\x00\x70\x00\x71\x00\x72\x00\x73\x00\x74\x00\x75\x00\x76\x00\x77\x00\x78\x00\x79\x00\x7a\x00\xff\xff\x7c\x00\x21\x00\x7e\x00\x23\x00\x24\x00\x25\x00\x26\x00\x27\x00\xff\xff\xff\xff\x2a\x00\x2b\x00\x2c\x00\x2d\x00\x2e\x00\x2f\x00\x30\x00\x31\x00\x32\x00\x33\x00\x34\x00\x35\x00\x36\x00\x37\x00\x38\x00\x39\x00\x3a\x00\xff\xff\x3c\x00\x3d\x00\x3e\x00\x3f\x00\xff\xff\x41\x00\x42\x00\x43\x00\x44\x00\x45\x00\x46\x00\x47\x00\x48\x00\x49\x00\x4a\x00\x4b\x00\x4c\x00\x4d\x00\x4e\x00\x4f\x00\x50\x00\x51\x00\x52\x00\x53\x00\x54\x00\x55\x00\x56\x00\x57\x00\x58\x00\x59\x00\x5a\x00\x5b\x00\x5c\x00\x5d\x00\x5e\x00\x5f\x00\x60\x00\x61\x00\x62\x00\x63\x00\x64\x00\x65\x00\x66\x00\x67\x00\x68\x00\x69\x00\x6a\x00\x6b\x00\x6c\x00\x6d\x00\x6e\x00\x6f\x00\x70\x00\x71\x00\x72\x00\x73\x00\x74\x00\x75\x00\x76\x00\x77\x00\x78\x00\x79\x00\x7a\x00\xff\xff\x7c\x00\x21\x00\x7e\x00\x23\x00\x24\x00\x25\x00\x26\x00\x27\x00\xff\xff\xff\xff\x2a\x00\x2b\x00\x2c\x00\x2d\x00\x2e\x00\x2f\x00\x30\x00\x31\x00\x32\x00\x33\x00\x34\x00\x35\x00\x36\x00\x37\x00\x38\x00\x39\x00\x3a\x00\xff\xff\x3c\x00\x3d\x00\x3e\x00\x3f\x00\xff\xff\x41\x00\x42\x00\x43\x00\x44\x00\x45\x00\x46\x00\x47\x00\x48\x00\x49\x00\x4a\x00\x4b\x00\x4c\x00\x4d\x00\x4e\x00\x4f\x00\x50\x00\x51\x00\x52\x00\x53\x00\x54\x00\x55\x00\x56\x00\x57\x00\x58\x00\x59\x00\x5a\x00\x5b\x00\x5c\x00\x5d\x00\x5e\x00\x5f\x00\x60\x00\x61\x00\x62\x00\x63\x00\x64\x00\x65\x00\x66\x00\x67\x00\x68\x00\x69\x00\x6a\x00\x6b\x00\x6c\x00\x6d\x00\x6e\x00\x6f\x00\x70\x00\x71\x00\x72\x00\x73\x00\x74\x00\x75\x00\x76\x00\x77\x00\x78\x00\x79\x00\x7a\x00\xff\xff\x7c\x00\x21\x00\x7e\x00\x23\x00\x24\x00\x25\x00\x26\x00\x27\x00\xff\xff\xff\xff\x2a\x00\x2b\x00\x2c\x00\x2d\x00\x2e\x00\x2f\x00\x30\x00\x31\x00\x32\x00\x33\x00\x34\x00\x35\x00\x36\x00\x37\x00\x38\x00\x39\x00\x3a\x00\xff\xff\x3c\x00\x3d\x00\x3e\x00\x3f\x00\xff\xff\x41\x00\x42\x00\x43\x00\x44\x00\x45\x00\x46\x00\x47\x00\x48\x00\x49\x00\x4a\x00\x4b\x00\x4c\x00\x4d\x00\x4e\x00\x4f\x00\x50\x00\x51\x00\x52\x00\x53\x00\x54\x00\x55\x00\x56\x00\x57\x00\x58\x00\x59\x00\x5a\x00\x5b\x00\x5c\x00\x5d\x00\x5e\x00\x5f\x00\x60\x00\x61\x00\x62\x00\x63\x00\x64\x00\x65\x00\x66\x00\x67\x00\x68\x00\x69\x00\x6a\x00\x6b\x00\x6c\x00\x6d\x00\x6e\x00\x6f\x00\x70\x00\x71\x00\x72\x00\x73\x00\x74\x00\x75\x00\x76\x00\x77\x00\x78\x00\x79\x00\x7a\x00\xff\xff\x7c\x00\x21\x00\x7e\x00\x23\x00\x24\x00\x25\x00\x26\x00\x27\x00\xff\xff\xff\xff\x2a\x00\x2b\x00\x2c\x00\x2d\x00\x2e\x00\x2f\x00\x30\x00\x31\x00\x32\x00\x33\x00\x34\x00\x35\x00\x36\x00\x37\x00\x38\x00\x39\x00\x3a\x00\xff\xff\x3c\x00\x3d\x00\x3e\x00\x3f\x00\xff\xff\x41\x00\x42\x00\x43\x00\x44\x00\x45\x00\x46\x00\x47\x00\x48\x00\x49\x00\x4a\x00\x4b\x00\x4c\x00\x4d\x00\x4e\x00\x4f\x00\x50\x00\x51\x00\x52\x00\x53\x00\x54\x00\x55\x00\x56\x00\x57\x00\x58\x00\x59\x00\x5a\x00\x5b\x00\x5c\x00\x5d\x00\x5e\x00\x5f\x00\x60\x00\x61\x00\x62\x00\x63\x00\x64\x00\x65\x00\x66\x00\x67\x00\x68\x00\x69\x00\x6a\x00\x6b\x00\x6c\x00\x6d\x00\x6e\x00\x6f\x00\x70\x00\x71\x00\x72\x00\x73\x00\x74\x00\x75\x00\x76\x00\x77\x00\x78\x00\x79\x00\x7a\x00\xff\xff\x7c\x00\x21\x00\x7e\x00\x23\x00\x24\x00\x25\x00\x26\x00\x27\x00\xff\xff\xff\xff\x2a\x00\x2b\x00\x2c\x00\x2d\x00\x2e\x00\x2f\x00\x30\x00\x31\x00\x32\x00\x33\x00\x34\x00\x35\x00\x36\x00\x37\x00\x38\x00\x39\x00\x3a\x00\xff\xff\x3c\x00\x3d\x00\x3e\x00\x3f\x00\xff\xff\x41\x00\x42\x00\x43\x00\x44\x00\x45\x00\x46\x00\x47\x00\x48\x00\x49\x00\x4a\x00\x4b\x00\x4c\x00\x4d\x00\x4e\x00\x4f\x00\x50\x00\x51\x00\x52\x00\x53\x00\x54\x00\x55\x00\x56\x00\x57\x00\x58\x00\x59\x00\x5a\x00\x5b\x00\x5c\x00\x5d\x00\x5e\x00\x5f\x00\x60\x00\x61\x00\x62\x00\x63\x00\x64\x00\x65\x00\x66\x00\x67\x00\x68\x00\x69\x00\x6a\x00\x6b\x00\x6c\x00\x6d\x00\x6e\x00\x6f\x00\x70\x00\x71\x00\x72\x00\x73\x00\x74\x00\x75\x00\x76\x00\x77\x00\x78\x00\x79\x00\x7a\x00\xff\xff\x7c\x00\x21\x00\x7e\x00\x23\x00\x24\x00\x25\x00\x26\x00\x27\x00\xff\xff\xff\xff\x2a\x00\x2b\x00\x2c\x00\x2d\x00\x2e\x00\x2f\x00\x30\x00\x31\x00\x32\x00\x33\x00\x34\x00\x35\x00\x36\x00\x37\x00\x38\x00\x39\x00\x3a\x00\xff\xff\x3c\x00\x3d\x00\x3e\x00\x3f\x00\xff\xff\x41\x00\x42\x00\x43\x00\x44\x00\x45\x00\x46\x00\x47\x00\x48\x00\x49\x00\x4a\x00\x4b\x00\x4c\x00\x4d\x00\x4e\x00\x4f\x00\x50\x00\x51\x00\x52\x00\x53\x00\x54\x00\x55\x00\x56\x00\x57\x00\x58\x00\x59\x00\x5a\x00\x5b\x00\x5c\x00\x5d\x00\x5e\x00\x5f\x00\x60\x00\x61\x00\x62\x00\x63\x00\x64\x00\x65\x00\x66\x00\x67\x00\x68\x00\x69\x00\x6a\x00\x6b\x00\x6c\x00\x6d\x00\x6e\x00\x6f\x00\x70\x00\x71\x00\x72\x00\x73\x00\x74\x00\x75\x00\x76\x00\x77\x00\x78\x00\x79\x00\x7a\x00\xff\xff\x7c\x00\x21\x00\x7e\x00\x23\x00\x24\x00\x25\x00\x26\x00\x27\x00\xff\xff\xff\xff\x2a\x00\x2b\x00\x2c\x00\x2d\x00\x2e\x00\x2f\x00\x30\x00\x31\x00\x32\x00\x33\x00\x34\x00\x35\x00\x36\x00\x37\x00\x38\x00\x39\x00\x3a\x00\xff\xff\x3c\x00\x3d\x00\x3e\x00\x3f\x00\xff\xff\x41\x00\x42\x00\x43\x00\x44\x00\x45\x00\x46\x00\x47\x00\x48\x00\x49\x00\x4a\x00\x4b\x00\x4c\x00\x4d\x00\x4e\x00\x4f\x00\x50\x00\x51\x00\x52\x00\x53\x00\x54\x00\x55\x00\x56\x00\x57\x00\x58\x00\x59\x00\x5a\x00\x5b\x00\x5c\x00\x5d\x00\x5e\x00\x5f\x00\x60\x00\x61\x00\x62\x00\x63\x00\x64\x00\x65\x00\x66\x00\x67\x00\x68\x00\x69\x00\x6a\x00\x6b\x00\x6c\x00\x6d\x00\x6e\x00\x6f\x00\x70\x00\x71\x00\x72\x00\x73\x00\x74\x00\x75\x00\x76\x00\x77\x00\x78\x00\x79\x00\x7a\x00\xff\xff\x7c\x00\x21\x00\x7e\x00\x23\x00\x24\x00\x25\x00\x26\x00\x27\x00\xff\xff\xff\xff\x2a\x00\x2b\x00\x2c\x00\x2d\x00\x2e\x00\x2f\x00\x30\x00\x31\x00\x32\x00\x33\x00\x34\x00\x35\x00\x36\x00\x37\x00\x38\x00\x39\x00\x3a\x00\xff\xff\x3c\x00\x3d\x00\x3e\x00\x3f\x00\xff\xff\x41\x00\x42\x00\x43\x00\x44\x00\x45\x00\x46\x00\x47\x00\x48\x00\x49\x00\x4a\x00\x4b\x00\x4c\x00\x4d\x00\x4e\x00\x4f\x00\x50\x00\x51\x00\x52\x00\x53\x00\x54\x00\x55\x00\x56\x00\x57\x00\x58\x00\x59\x00\x5a\x00\x5b\x00\x5c\x00\x5d\x00\x5e\x00\x5f\x00\x60\x00\x61\x00\x62\x00\x63\x00\x64\x00\x65\x00\x66\x00\x67\x00\x68\x00\x69\x00\x6a\x00\x6b\x00\x6c\x00\x6d\x00\x6e\x00\x6f\x00\x70\x00\x71\x00\x72\x00\x73\x00\x74\x00\x75\x00\x76\x00\x77\x00\x78\x00\x79\x00\x7a\x00\xff\xff\x7c\x00\x21\x00\x7e\x00\x23\x00\x24\x00\x25\x00\x26\x00\x27\x00\xff\xff\xff\xff\x2a\x00\x2b\x00\x2c\x00\x2d\x00\x2e\x00\x2f\x00\x30\x00\x31\x00\x32\x00\x33\x00\x34\x00\x35\x00\x36\x00\x37\x00\x38\x00\x39\x00\x3a\x00\xff\xff\x3c\x00\x3d\x00\x3e\x00\x3f\x00\xff\xff\x41\x00\x42\x00\x43\x00\x44\x00\x45\x00\x46\x00\x47\x00\x48\x00\x49\x00\x4a\x00\x4b\x00\x4c\x00\x4d\x00\x4e\x00\x4f\x00\x50\x00\x51\x00\x52\x00\x53\x00\x54\x00\x55\x00\x56\x00\x57\x00\x58\x00\x59\x00\x5a\x00\x5b\x00\x5c\x00\x5d\x00\x5e\x00\x5f\x00\x60\x00\x61\x00\x62\x00\x63\x00\x64\x00\x65\x00\x66\x00\x67\x00\x68\x00\x69\x00\x6a\x00\x6b\x00\x6c\x00\x6d\x00\x6e\x00\x6f\x00\x70\x00\x71\x00\x72\x00\x73\x00\x74\x00\x75\x00\x76\x00\x77\x00\x78\x00\x79\x00\x7a\x00\xff\xff\x7c\x00\x21\x00\x7e\x00\x23\x00\x24\x00\x25\x00\x26\x00\x27\x00\xff\xff\xff\xff\x2a\x00\x2b\x00\x2c\x00\x2d\x00\x2e\x00\x2f\x00\x30\x00\x31\x00\x32\x00\x33\x00\x34\x00\x35\x00\x36\x00\x37\x00\x38\x00\x39\x00\x3a\x00\xff\xff\x3c\x00\x3d\x00\x3e\x00\x3f\x00\xff\xff\x41\x00\x42\x00\x43\x00\x44\x00\x45\x00\x46\x00\x47\x00\x48\x00\x49\x00\x4a\x00\x4b\x00\x4c\x00\x4d\x00\x4e\x00\x4f\x00\x50\x00\x51\x00\x52\x00\x53\x00\x54\x00\x55\x00\x56\x00\x57\x00\x58\x00\x59\x00\x5a\x00\x5b\x00\x5c\x00\x5d\x00\x5e\x00\x5f\x00\x60\x00\x61\x00\x62\x00\x63\x00\x64\x00\x65\x00\x66\x00\x67\x00\x68\x00\x69\x00\x6a\x00\x6b\x00\x6c\x00\x6d\x00\x6e\x00\x6f\x00\x70\x00\x71\x00\x72\x00\x73\x00\x74\x00\x75\x00\x76\x00\x77\x00\x78\x00\x79\x00\x7a\x00\xff\xff\x7c\x00\x21\x00\x7e\x00\x23\x00\x24\x00\x25\x00\x26\x00\x27\x00\xff\xff\xff\xff\x2a\x00\x2b\x00\x2c\x00\x2d\x00\x2e\x00\x2f\x00\x30\x00\x31\x00\x32\x00\x33\x00\x34\x00\x35\x00\x36\x00\x37\x00\x38\x00\x39\x00\x3a\x00\xff\xff\x3c\x00\x3d\x00\x3e\x00\x3f\x00\xff\xff\x41\x00\x42\x00\x43\x00\x44\x00\x45\x00\x46\x00\x47\x00\x48\x00\x49\x00\x4a\x00\x4b\x00\x4c\x00\x4d\x00\x4e\x00\x4f\x00\x50\x00\x51\x00\x52\x00\x53\x00\x54\x00\x55\x00\x56\x00\x57\x00\x58\x00\x59\x00\x5a\x00\x5b\x00\x5c\x00\x5d\x00\x5e\x00\x5f\x00\x60\x00\x61\x00\x62\x00\x63\x00\x64\x00\x65\x00\x66\x00\x67\x00\x68\x00\x69\x00\x6a\x00\x6b\x00\x6c\x00\x6d\x00\x6e\x00\x6f\x00\x70\x00\x71\x00\x72\x00\x73\x00\x74\x00\x75\x00\x76\x00\x77\x00\x78\x00\x79\x00\x7a\x00\xff\xff\x7c\x00\x21\x00\x7e\x00\x23\x00\x24\x00\x25\x00\x26\x00\x27\x00\xff\xff\xff\xff\x2a\x00\x2b\x00\x2c\x00\x2d\x00\x2e\x00\x2f\x00\x30\x00\x31\x00\x32\x00\x33\x00\x34\x00\x35\x00\x36\x00\x37\x00\x38\x00\x39\x00\x3a\x00\xff\xff\x3c\x00\x3d\x00\x3e\x00\x3f\x00\xff\xff\x41\x00\x42\x00\x43\x00\x44\x00\x45\x00\x46\x00\x47\x00\x48\x00\x49\x00\x4a\x00\x4b\x00\x4c\x00\x4d\x00\x4e\x00\x4f\x00\x50\x00\x51\x00\x52\x00\x53\x00\x54\x00\x55\x00\x56\x00\x57\x00\x58\x00\x59\x00\x5a\x00\x5b\x00\x5c\x00\x5d\x00\x5e\x00\x5f\x00\x60\x00\x61\x00\x62\x00\x63\x00\x64\x00\x65\x00\x66\x00\x67\x00\x68\x00\x69\x00\x6a\x00\x6b\x00\x6c\x00\x6d\x00\x6e\x00\x6f\x00\x70\x00\x71\x00\x72\x00\x73\x00\x74\x00\x75\x00\x76\x00\x77\x00\x78\x00\x79\x00\x7a\x00\xff\xff\x7c\x00\x21\x00\x7e\x00\x23\x00\x24\x00\x25\x00\x26\x00\x27\x00\xff\xff\xff\xff\x2a\x00\x2b\x00\x2c\x00\x2d\x00\x2e\x00\x2f\x00\x30\x00\x31\x00\x32\x00\x33\x00\x34\x00\x35\x00\x36\x00\x37\x00\x38\x00\x39\x00\x3a\x00\xff\xff\x3c\x00\x3d\x00\x3e\x00\x3f\x00\xff\xff\x41\x00\x42\x00\x43\x00\x44\x00\x45\x00\x46\x00\x47\x00\x48\x00\x49\x00\x4a\x00\x4b\x00\x4c\x00\x4d\x00\x4e\x00\x4f\x00\x50\x00\x51\x00\x52\x00\x53\x00\x54\x00\x55\x00\x56\x00\x57\x00\x58\x00\x59\x00\x5a\x00\x5b\x00\x5c\x00\x5d\x00\x5e\x00\x5f\x00\x60\x00\x61\x00\x62\x00\x63\x00\x64\x00\x65\x00\x66\x00\x67\x00\x68\x00\x69\x00\x6a\x00\x6b\x00\x6c\x00\x6d\x00\x6e\x00\x6f\x00\x70\x00\x71\x00\x72\x00\x73\x00\x74\x00\x75\x00\x76\x00\x77\x00\x78\x00\x79\x00\x7a\x00\xff\xff\x7c\x00\x21\x00\x7e\x00\x23\x00\x24\x00\x25\x00\x26\x00\x27\x00\xff\xff\xff\xff\x2a\x00\x2b\x00\x2c\x00\x2d\x00\x2e\x00\x2f\x00\x30\x00\x31\x00\x32\x00\x33\x00\x34\x00\x35\x00\x36\x00\x37\x00\x38\x00\x39\x00\x3a\x00\xff\xff\x3c\x00\x3d\x00\x3e\x00\x3f\x00\xff\xff\x41\x00\x42\x00\x43\x00\x44\x00\x45\x00\x46\x00\x47\x00\x48\x00\x49\x00\x4a\x00\x4b\x00\x4c\x00\x4d\x00\x4e\x00\x4f\x00\x50\x00\x51\x00\x52\x00\x53\x00\x54\x00\x55\x00\x56\x00\x57\x00\x58\x00\x59\x00\x5a\x00\x5b\x00\x5c\x00\x5d\x00\x5e\x00\x5f\x00\x60\x00\x61\x00\x62\x00\x63\x00\x64\x00\x65\x00\x66\x00\x67\x00\x68\x00\x69\x00\x6a\x00\x6b\x00\x6c\x00\x6d\x00\x6e\x00\x6f\x00\x70\x00\x71\x00\x72\x00\x73\x00\x74\x00\x75\x00\x76\x00\x77\x00\x78\x00\x79\x00\x7a\x00\xff\xff\x7c\x00\x21\x00\x7e\x00\x23\x00\x24\x00\x25\x00\x26\x00\x27\x00\xff\xff\xff\xff\x2a\x00\x2b\x00\x2c\x00\x2d\x00\x2e\x00\x2f\x00\x30\x00\x31\x00\x32\x00\x33\x00\x34\x00\x35\x00\x36\x00\x37\x00\x38\x00\x39\x00\x3a\x00\xff\xff\x3c\x00\x3d\x00\x3e\x00\x3f\x00\xff\xff\x41\x00\x42\x00\x43\x00\x44\x00\x45\x00\x46\x00\x47\x00\x48\x00\x49\x00\x4a\x00\x4b\x00\x4c\x00\x4d\x00\x4e\x00\x4f\x00\x50\x00\x51\x00\x52\x00\x53\x00\x54\x00\x55\x00\x56\x00\x57\x00\x58\x00\x59\x00\x5a\x00\x5b\x00\x5c\x00\x5d\x00\x5e\x00\x5f\x00\x60\x00\x61\x00\x62\x00\x63\x00\x64\x00\x65\x00\x66\x00\x67\x00\x68\x00\x69\x00\x6a\x00\x6b\x00\x6c\x00\x6d\x00\x6e\x00\x6f\x00\x70\x00\x71\x00\x72\x00\x73\x00\x74\x00\x75\x00\x76\x00\x77\x00\x78\x00\x79\x00\x7a\x00\xff\xff\x7c\x00\x21\x00\x7e\x00\x23\x00\x24\x00\x25\x00\x26\x00\x27\x00\xff\xff\xff\xff\x2a\x00\x2b\x00\x2c\x00\x2d\x00\x2e\x00\x2f\x00\x30\x00\x31\x00\x32\x00\x33\x00\x34\x00\x35\x00\x36\x00\x37\x00\x38\x00\x39\x00\x3a\x00\xff\xff\x3c\x00\x3d\x00\x3e\x00\x3f\x00\xff\xff\x41\x00\x42\x00\x43\x00\x44\x00\x45\x00\x46\x00\x47\x00\x48\x00\x49\x00\x4a\x00\x4b\x00\x4c\x00\x4d\x00\x4e\x00\x4f\x00\x50\x00\x51\x00\x52\x00\x53\x00\x54\x00\x55\x00\x56\x00\x57\x00\x58\x00\x59\x00\x5a\x00\x5b\x00\x5c\x00\x5d\x00\x5e\x00\x5f\x00\x60\x00\x61\x00\x62\x00\x63\x00\x64\x00\x65\x00\x66\x00\x67\x00\x68\x00\x69\x00\x6a\x00\x6b\x00\x6c\x00\x6d\x00\x6e\x00\x6f\x00\x70\x00\x71\x00\x72\x00\x73\x00\x74\x00\x75\x00\x76\x00\x77\x00\x78\x00\x79\x00\x7a\x00\xff\xff\x7c\x00\x21\x00\x7e\x00\x23\x00\x24\x00\x25\x00\x26\x00\x27\x00\xff\xff\xff\xff\x2a\x00\x2b\x00\x2c\x00\x2d\x00\x2e\x00\x2f\x00\x30\x00\x31\x00\x32\x00\x33\x00\x34\x00\x35\x00\x36\x00\x37\x00\x38\x00\x39\x00\x3a\x00\xff\xff\x3c\x00\x3d\x00\x3e\x00\x3f\x00\xff\xff\x41\x00\x42\x00\x43\x00\x44\x00\x45\x00\x46\x00\x47\x00\x48\x00\x49\x00\x4a\x00\x4b\x00\x4c\x00\x4d\x00\x4e\x00\x4f\x00\x50\x00\x51\x00\x52\x00\x53\x00\x54\x00\x55\x00\x56\x00\x57\x00\x58\x00\x59\x00\x5a\x00\x5b\x00\x5c\x00\x5d\x00\x5e\x00\x5f\x00\x60\x00\x61\x00\x62\x00\x63\x00\x64\x00\x65\x00\x66\x00\x67\x00\x68\x00\x69\x00\x6a\x00\x6b\x00\x6c\x00\x6d\x00\x6e\x00\x6f\x00\x70\x00\x71\x00\x72\x00\x73\x00\x74\x00\x75\x00\x76\x00\x77\x00\x78\x00\x79\x00\x7a\x00\xff\xff\x7c\x00\x21\x00\x7e\x00\x23\x00\x24\x00\x25\x00\x26\x00\x27\x00\xff\xff\xff\xff\x2a\x00\x2b\x00\x2c\x00\x2d\x00\x2e\x00\x2f\x00\x30\x00\x31\x00\x32\x00\x33\x00\x34\x00\x35\x00\x36\x00\x37\x00\x38\x00\x39\x00\x3a\x00\xff\xff\x3c\x00\x3d\x00\x3e\x00\x3f\x00\xff\xff\x41\x00\x42\x00\x43\x00\x44\x00\x45\x00\x46\x00\x47\x00\x48\x00\x49\x00\x4a\x00\x4b\x00\x4c\x00\x4d\x00\x4e\x00\x4f\x00\x50\x00\x51\x00\x52\x00\x53\x00\x54\x00\x55\x00\x56\x00\x57\x00\x58\x00\x59\x00\x5a\x00\x5b\x00\x5c\x00\x5d\x00\x5e\x00\x5f\x00\x60\x00\x61\x00\x62\x00\x63\x00\x64\x00\x65\x00\x66\x00\x67\x00\x68\x00\x69\x00\x6a\x00\x6b\x00\x6c\x00\x6d\x00\x6e\x00\x6f\x00\x70\x00\x71\x00\x72\x00\x73\x00\x74\x00\x75\x00\x76\x00\x77\x00\x78\x00\x79\x00\x7a\x00\xff\xff\x7c\x00\x21\x00\x7e\x00\x23\x00\x24\x00\x25\x00\x26\x00\x27\x00\xff\xff\xff\xff\x2a\x00\x2b\x00\x2c\x00\x2d\x00\x2e\x00\x2f\x00\x30\x00\x31\x00\x32\x00\x33\x00\x34\x00\x35\x00\x36\x00\x37\x00\x38\x00\x39\x00\x3a\x00\xff\xff\x3c\x00\x3d\x00\x3e\x00\x3f\x00\xff\xff\x41\x00\x42\x00\x43\x00\x44\x00\x45\x00\x46\x00\x47\x00\x48\x00\x49\x00\x4a\x00\x4b\x00\x4c\x00\x4d\x00\x4e\x00\x4f\x00\x50\x00\x51\x00\x52\x00\x53\x00\x54\x00\x55\x00\x56\x00\x57\x00\x58\x00\x59\x00\x5a\x00\x5b\x00\x5c\x00\x5d\x00\x5e\x00\x5f\x00\x60\x00\x61\x00\x62\x00\x63\x00\x64\x00\x65\x00\x66\x00\x67\x00\x68\x00\x69\x00\x6a\x00\x6b\x00\x6c\x00\x6d\x00\x6e\x00\x6f\x00\x70\x00\x71\x00\x72\x00\x73\x00\x74\x00\x75\x00\x76\x00\x77\x00\x78\x00\x79\x00\x7a\x00\xff\xff\x7c\x00\x21\x00\x7e\x00\x23\x00\x24\x00\x25\x00\x26\x00\x27\x00\xff\xff\xff\xff\x2a\x00\x2b\x00\x2c\x00\x2d\x00\x2e\x00\x2f\x00\x30\x00\x31\x00\x32\x00\x33\x00\x34\x00\x35\x00\x36\x00\x37\x00\x38\x00\x39\x00\x3a\x00\xff\xff\x3c\x00\x3d\x00\x3e\x00\x3f\x00\xff\xff\x41\x00\x42\x00\x43\x00\x44\x00\x45\x00\x46\x00\x47\x00\x48\x00\x49\x00\x4a\x00\x4b\x00\x4c\x00\x4d\x00\x4e\x00\x4f\x00\x50\x00\x51\x00\x52\x00\x53\x00\x54\x00\x55\x00\x56\x00\x57\x00\x58\x00\x59\x00\x5a\x00\x5b\x00\x5c\x00\x5d\x00\x5e\x00\x5f\x00\x60\x00\x61\x00\x62\x00\x63\x00\x64\x00\x65\x00\x66\x00\x67\x00\x68\x00\x69\x00\x6a\x00\x6b\x00\x6c\x00\x6d\x00\x6e\x00\x6f\x00\x70\x00\x71\x00\x72\x00\x73\x00\x74\x00\x75\x00\x76\x00\x77\x00\x78\x00\x79\x00\x7a\x00\xff\xff\x7c\x00\x21\x00\x7e\x00\x23\x00\x24\x00\x25\x00\x26\x00\x27\x00\xff\xff\xff\xff\x2a\x00\x2b\x00\x2c\x00\x2d\x00\x2e\x00\x2f\x00\x30\x00\x31\x00\x32\x00\x33\x00\x34\x00\x35\x00\x36\x00\x37\x00\x38\x00\x39\x00\x3a\x00\xff\xff\x3c\x00\x3d\x00\x3e\x00\x3f\x00\xff\xff\x41\x00\x42\x00\x43\x00\x44\x00\x45\x00\x46\x00\x47\x00\x48\x00\x49\x00\x4a\x00\x4b\x00\x4c\x00\x4d\x00\x4e\x00\x4f\x00\x50\x00\x51\x00\x52\x00\x53\x00\x54\x00\x55\x00\x56\x00\x57\x00\x58\x00\x59\x00\x5a\x00\x5b\x00\x5c\x00\x5d\x00\x5e\x00\x5f\x00\x60\x00\x61\x00\x62\x00\x63\x00\x64\x00\x65\x00\x66\x00\x67\x00\x68\x00\x69\x00\x6a\x00\x6b\x00\x6c\x00\x6d\x00\x6e\x00\x6f\x00\x70\x00\x71\x00\x72\x00\x73\x00\x74\x00\x75\x00\x76\x00\x77\x00\x78\x00\x79\x00\x7a\x00\xff\xff\x7c\x00\x21\x00\x7e\x00\x23\x00\x24\x00\x25\x00\x26\x00\x27\x00\xff\xff\xff\xff\x2a\x00\x2b\x00\x2c\x00\x2d\x00\x2e\x00\x2f\x00\x30\x00\x31\x00\x32\x00\x33\x00\x34\x00\x35\x00\x36\x00\x37\x00\x38\x00\x39\x00\x3a\x00\xff\xff\x3c\x00\x3d\x00\x3e\x00\x3f\x00\xff\xff\x41\x00\x42\x00\x43\x00\x44\x00\x45\x00\x46\x00\x47\x00\x48\x00\x49\x00\x4a\x00\x4b\x00\x4c\x00\x4d\x00\x4e\x00\x4f\x00\x50\x00\x51\x00\x52\x00\x53\x00\x54\x00\x55\x00\x56\x00\x57\x00\x58\x00\x59\x00\x5a\x00\x5b\x00\x5c\x00\x5d\x00\x5e\x00\x5f\x00\x60\x00\x61\x00\x62\x00\x63\x00\x64\x00\x65\x00\x66\x00\x67\x00\x68\x00\x69\x00\x6a\x00\x6b\x00\x6c\x00\x6d\x00\x6e\x00\x6f\x00\x70\x00\x71\x00\x72\x00\x73\x00\x74\x00\x75\x00\x76\x00\x77\x00\x78\x00\x79\x00\x7a\x00\xff\xff\x7c\x00\x21\x00\x7e\x00\x23\x00\x24\x00\x25\x00\x26\x00\x27\x00\xff\xff\xff\xff\x2a\x00\x2b\x00\x2c\x00\x2d\x00\x2e\x00\x2f\x00\x30\x00\x31\x00\x32\x00\x33\x00\x34\x00\x35\x00\x36\x00\x37\x00\x38\x00\x39\x00\x3a\x00\xff\xff\x3c\x00\x3d\x00\x3e\x00\x3f\x00\xff\xff\x41\x00\x42\x00\x43\x00\x44\x00\x45\x00\x46\x00\x47\x00\x48\x00\x49\x00\x4a\x00\x4b\x00\x4c\x00\x4d\x00\x4e\x00\x4f\x00\x50\x00\x51\x00\x52\x00\x53\x00\x54\x00\x55\x00\x56\x00\x57\x00\x58\x00\x59\x00\x5a\x00\x5b\x00\x5c\x00\x5d\x00\x5e\x00\x5f\x00\x60\x00\x61\x00\x62\x00\x63\x00\x64\x00\x65\x00\x66\x00\x67\x00\x68\x00\x69\x00\x6a\x00\x6b\x00\x6c\x00\x6d\x00\x6e\x00\x6f\x00\x70\x00\x71\x00\x72\x00\x73\x00\x74\x00\x75\x00\x76\x00\x77\x00\x78\x00\x79\x00\x7a\x00\xff\xff\x7c\x00\x21\x00\x7e\x00\x23\x00\x24\x00\x25\x00\x26\x00\x27\x00\xff\xff\xff\xff\x2a\x00\x2b\x00\x2c\x00\x2d\x00\x2e\x00\x2f\x00\x30\x00\x31\x00\x32\x00\x33\x00\x34\x00\x35\x00\x36\x00\x37\x00\x38\x00\x39\x00\x3a\x00\xff\xff\x3c\x00\x3d\x00\x3e\x00\x3f\x00\xff\xff\x41\x00\x42\x00\x43\x00\x44\x00\x45\x00\x46\x00\x47\x00\x48\x00\x49\x00\x4a\x00\x4b\x00\x4c\x00\x4d\x00\x4e\x00\x4f\x00\x50\x00\x51\x00\x52\x00\x53\x00\x54\x00\x55\x00\x56\x00\x57\x00\x58\x00\x59\x00\x5a\x00\x5b\x00\x5c\x00\x5d\x00\x5e\x00\x5f\x00\x60\x00\x61\x00\x62\x00\x63\x00\x64\x00\x65\x00\x66\x00\x67\x00\x68\x00\x69\x00\x6a\x00\x6b\x00\x6c\x00\x6d\x00\x6e\x00\x6f\x00\x70\x00\x71\x00\x72\x00\x73\x00\x74\x00\x75\x00\x76\x00\x77\x00\x78\x00\x79\x00\x7a\x00\xff\xff\x7c\x00\x21\x00\x7e\x00\x23\x00\x24\x00\x25\x00\x26\x00\x27\x00\xff\xff\xff\xff\x2a\x00\x2b\x00\x2c\x00\x2d\x00\x2e\x00\x2f\x00\x30\x00\x31\x00\x32\x00\x33\x00\x34\x00\x35\x00\x36\x00\x37\x00\x38\x00\x39\x00\x3a\x00\xff\xff\x3c\x00\x3d\x00\x3e\x00\x3f\x00\xff\xff\x41\x00\x42\x00\x43\x00\x44\x00\x45\x00\x46\x00\x47\x00\x48\x00\x49\x00\x4a\x00\x4b\x00\x4c\x00\x4d\x00\x4e\x00\x4f\x00\x50\x00\x51\x00\x52\x00\x53\x00\x54\x00\x55\x00\x56\x00\x57\x00\x58\x00\x59\x00\x5a\x00\x5b\x00\x5c\x00\x5d\x00\x5e\x00\x5f\x00\x60\x00\x61\x00\x62\x00\x63\x00\x64\x00\x65\x00\x66\x00\x67\x00\x68\x00\x69\x00\x6a\x00\x6b\x00\x6c\x00\x6d\x00\x6e\x00\x6f\x00\x70\x00\x71\x00\x72\x00\x73\x00\x74\x00\x75\x00\x76\x00\x77\x00\x78\x00\x79\x00\x7a\x00\xff\xff\x7c\x00\x21\x00\x7e\x00\x23\x00\x24\x00\x25\x00\x26\x00\x27\x00\xff\xff\xff\xff\x2a\x00\x2b\x00\x2c\x00\x2d\x00\x2e\x00\x2f\x00\x30\x00\x31\x00\x32\x00\x33\x00\x34\x00\x35\x00\x36\x00\x37\x00\x38\x00\x39\x00\x3a\x00\xff\xff\x3c\x00\x3d\x00\x3e\x00\x3f\x00\xff\xff\x41\x00\x42\x00\x43\x00\x44\x00\x45\x00\x46\x00\x47\x00\x48\x00\x49\x00\x4a\x00\x4b\x00\x4c\x00\x4d\x00\x4e\x00\x4f\x00\x50\x00\x51\x00\x52\x00\x53\x00\x54\x00\x55\x00\x56\x00\x57\x00\x58\x00\x59\x00\x5a\x00\x5b\x00\x5c\x00\x5d\x00\x5e\x00\x5f\x00\x60\x00\x61\x00\x62\x00\x63\x00\x64\x00\x65\x00\x66\x00\x67\x00\x68\x00\x69\x00\x6a\x00\x6b\x00\x6c\x00\x6d\x00\x6e\x00\x6f\x00\x70\x00\x71\x00\x72\x00\x73\x00\x74\x00\x75\x00\x76\x00\x77\x00\x78\x00\x79\x00\x7a\x00\xff\xff\x7c\x00\x21\x00\x7e\x00\x23\x00\x24\x00\x25\x00\x26\x00\x27\x00\xff\xff\xff\xff\x2a\x00\x2b\x00\x2c\x00\x2d\x00\x2e\x00\x2f\x00\x30\x00\x31\x00\x32\x00\x33\x00\x34\x00\x35\x00\x36\x00\x37\x00\x38\x00\x39\x00\x3a\x00\xff\xff\x3c\x00\x3d\x00\x3e\x00\x3f\x00\xff\xff\x41\x00\x42\x00\x43\x00\x44\x00\x45\x00\x46\x00\x47\x00\x48\x00\x49\x00\x4a\x00\x4b\x00\x4c\x00\x4d\x00\x4e\x00\x4f\x00\x50\x00\x51\x00\x52\x00\x53\x00\x54\x00\x55\x00\x56\x00\x57\x00\x58\x00\x59\x00\x5a\x00\x5b\x00\x5c\x00\x5d\x00\x5e\x00\x5f\x00\x60\x00\x61\x00\x62\x00\x63\x00\x64\x00\x65\x00\x66\x00\x67\x00\x68\x00\x69\x00\x6a\x00\x6b\x00\x6c\x00\x6d\x00\x6e\x00\x6f\x00\x70\x00\x71\x00\x72\x00\x73\x00\x74\x00\x75\x00\x76\x00\x77\x00\x78\x00\x79\x00\x7a\x00\xff\xff\x7c\x00\x21\x00\x7e\x00\x23\x00\x24\x00\x25\x00\x26\x00\x27\x00\xff\xff\xff\xff\x2a\x00\x2b\x00\x2c\x00\x2d\x00\x2e\x00\x2f\x00\x30\x00\x31\x00\x32\x00\x33\x00\x34\x00\x35\x00\x36\x00\x37\x00\x38\x00\x39\x00\x3a\x00\xff\xff\x3c\x00\x3d\x00\x3e\x00\x3f\x00\xff\xff\x41\x00\x42\x00\x43\x00\x44\x00\x45\x00\x46\x00\x47\x00\x48\x00\x49\x00\x4a\x00\x4b\x00\x4c\x00\x4d\x00\x4e\x00\x4f\x00\x50\x00\x51\x00\x52\x00\x53\x00\x54\x00\x55\x00\x56\x00\x57\x00\x58\x00\x59\x00\x5a\x00\x5b\x00\x5c\x00\x5d\x00\x5e\x00\x5f\x00\x60\x00\x61\x00\x62\x00\x63\x00\x64\x00\x65\x00\x66\x00\x67\x00\x68\x00\x69\x00\x6a\x00\x6b\x00\x6c\x00\x6d\x00\x6e\x00\x6f\x00\x70\x00\x71\x00\x72\x00\x73\x00\x74\x00\x75\x00\x76\x00\x77\x00\x78\x00\x79\x00\x7a\x00\xff\xff\x7c\x00\x21\x00\x7e\x00\x23\x00\x24\x00\x25\x00\x26\x00\x27\x00\xff\xff\xff\xff\x2a\x00\x2b\x00\x2c\x00\x2d\x00\x2e\x00\x2f\x00\x30\x00\x31\x00\x32\x00\x33\x00\x34\x00\x35\x00\x36\x00\x37\x00\x38\x00\x39\x00\x3a\x00\xff\xff\x3c\x00\x3d\x00\x3e\x00\x3f\x00\xff\xff\x41\x00\x42\x00\x43\x00\x44\x00\x45\x00\x46\x00\x47\x00\x48\x00\x49\x00\x4a\x00\x4b\x00\x4c\x00\x4d\x00\x4e\x00\x4f\x00\x50\x00\x51\x00\x52\x00\x53\x00\x54\x00\x55\x00\x56\x00\x57\x00\x58\x00\x59\x00\x5a\x00\x5b\x00\x5c\x00\x5d\x00\x5e\x00\x5f\x00\x60\x00\x61\x00\x62\x00\x63\x00\x64\x00\x65\x00\x66\x00\x67\x00\x68\x00\x69\x00\x6a\x00\x6b\x00\x6c\x00\x6d\x00\x6e\x00\x6f\x00\x70\x00\x71\x00\x72\x00\x73\x00\x74\x00\x75\x00\x76\x00\x77\x00\x78\x00\x79\x00\x7a\x00\xff\xff\x7c\x00\x21\x00\x7e\x00\x23\x00\x24\x00\x25\x00\x26\x00\x27\x00\xff\xff\xff\xff\x2a\x00\x2b\x00\x2c\x00\x2d\x00\x2e\x00\x2f\x00\x30\x00\x31\x00\x32\x00\x33\x00\x34\x00\x35\x00\x36\x00\x37\x00\x38\x00\x39\x00\x3a\x00\xff\xff\x3c\x00\x3d\x00\x3e\x00\x3f\x00\xff\xff\x41\x00\x42\x00\x43\x00\x44\x00\x45\x00\x46\x00\x47\x00\x48\x00\x49\x00\x4a\x00\x4b\x00\x4c\x00\x4d\x00\x4e\x00\x4f\x00\x50\x00\x51\x00\x52\x00\x53\x00\x54\x00\x55\x00\x56\x00\x57\x00\x58\x00\x59\x00\x5a\x00\x5b\x00\x5c\x00\x5d\x00\x5e\x00\x5f\x00\x60\x00\x61\x00\x62\x00\x63\x00\x64\x00\x65\x00\x66\x00\x67\x00\x68\x00\x69\x00\x6a\x00\x6b\x00\x6c\x00\x6d\x00\x6e\x00\x6f\x00\x70\x00\x71\x00\x72\x00\x73\x00\x74\x00\x75\x00\x76\x00\x77\x00\x78\x00\x79\x00\x7a\x00\xff\xff\x7c\x00\x21\x00\x7e\x00\x23\x00\x24\x00\x25\x00\x26\x00\x27\x00\xff\xff\xff\xff\x2a\x00\x2b\x00\x2c\x00\x2d\x00\x2e\x00\x2f\x00\x30\x00\x31\x00\x32\x00\x33\x00\x34\x00\x35\x00\x36\x00\x37\x00\x38\x00\x39\x00\x3a\x00\xff\xff\x3c\x00\x3d\x00\x3e\x00\x3f\x00\xff\xff\x41\x00\x42\x00\x43\x00\x44\x00\x45\x00\x46\x00\x47\x00\x48\x00\x49\x00\x4a\x00\x4b\x00\x4c\x00\x4d\x00\x4e\x00\x4f\x00\x50\x00\x51\x00\x52\x00\x53\x00\x54\x00\x55\x00\x56\x00\x57\x00\x58\x00\x59\x00\x5a\x00\x5b\x00\x5c\x00\x5d\x00\x5e\x00\x5f\x00\x60\x00\x61\x00\x62\x00\x63\x00\x64\x00\x65\x00\x66\x00\x67\x00\x68\x00\x69\x00\x6a\x00\x6b\x00\x6c\x00\x6d\x00\x6e\x00\x6f\x00\x70\x00\x71\x00\x72\x00\x73\x00\x74\x00\x75\x00\x76\x00\x77\x00\x78\x00\x79\x00\x7a\x00\xff\xff\x7c\x00\x21\x00\x7e\x00\x23\x00\x24\x00\x25\x00\x26\x00\x27\x00\xff\xff\xff\xff\x2a\x00\x2b\x00\x2c\x00\x2d\x00\x2e\x00\x2f\x00\x30\x00\x31\x00\x32\x00\x33\x00\x34\x00\x35\x00\x36\x00\x37\x00\x38\x00\x39\x00\x3a\x00\xff\xff\x3c\x00\x3d\x00\x3e\x00\x3f\x00\xff\xff\x41\x00\x42\x00\x43\x00\x44\x00\x45\x00\x46\x00\x47\x00\x48\x00\x49\x00\x4a\x00\x4b\x00\x4c\x00\x4d\x00\x4e\x00\x4f\x00\x50\x00\x51\x00\x52\x00\x53\x00\x54\x00\x55\x00\x56\x00\x57\x00\x58\x00\x59\x00\x5a\x00\x5b\x00\x5c\x00\x5d\x00\x5e\x00\x5f\x00\x60\x00\x61\x00\x62\x00\x63\x00\x64\x00\x65\x00\x66\x00\x67\x00\x68\x00\x69\x00\x6a\x00\x6b\x00\x6c\x00\x6d\x00\x6e\x00\x6f\x00\x70\x00\x71\x00\x72\x00\x73\x00\x74\x00\x75\x00\x76\x00\x77\x00\x78\x00\x79\x00\x7a\x00\xff\xff\x7c\x00\x21\x00\x7e\x00\x23\x00\x24\x00\x25\x00\x26\x00\x27\x00\xff\xff\xff\xff\x2a\x00\x2b\x00\x2c\x00\x2d\x00\x2e\x00\x2f\x00\x30\x00\x31\x00\x32\x00\x33\x00\x34\x00\x35\x00\x36\x00\x37\x00\x38\x00\x39\x00\x3a\x00\xff\xff\x3c\x00\x3d\x00\x3e\x00\x3f\x00\xff\xff\x41\x00\x42\x00\x43\x00\x44\x00\x45\x00\x46\x00\x47\x00\x48\x00\x49\x00\x4a\x00\x4b\x00\x4c\x00\x4d\x00\x4e\x00\x4f\x00\x50\x00\x51\x00\x52\x00\x53\x00\x54\x00\x55\x00\x56\x00\x57\x00\x58\x00\x59\x00\x5a\x00\x5b\x00\x5c\x00\x5d\x00\x5e\x00\x5f\x00\x60\x00\x61\x00\x62\x00\x63\x00\x64\x00\x65\x00\x66\x00\x67\x00\x68\x00\x69\x00\x6a\x00\x6b\x00\x6c\x00\x6d\x00\x6e\x00\x6f\x00\x70\x00\x71\x00\x72\x00\x73\x00\x74\x00\x75\x00\x76\x00\x77\x00\x78\x00\x79\x00\x7a\x00\xff\xff\x7c\x00\x21\x00\x7e\x00\x23\x00\x24\x00\x25\x00\x26\x00\x27\x00\xff\xff\xff\xff\x2a\x00\x2b\x00\x2c\x00\x2d\x00\x2e\x00\x2f\x00\x30\x00\x31\x00\x32\x00\x33\x00\x34\x00\x35\x00\x36\x00\x37\x00\x38\x00\x39\x00\x3a\x00\xff\xff\x3c\x00\x3d\x00\x3e\x00\x3f\x00\xff\xff\x41\x00\x42\x00\x43\x00\x44\x00\x45\x00\x46\x00\x47\x00\x48\x00\x49\x00\x4a\x00\x4b\x00\x4c\x00\x4d\x00\x4e\x00\x4f\x00\x50\x00\x51\x00\x52\x00\x53\x00\x54\x00\x55\x00\x56\x00\x57\x00\x58\x00\x59\x00\x5a\x00\x5b\x00\x5c\x00\x5d\x00\x5e\x00\x5f\x00\x60\x00\x61\x00\x62\x00\x63\x00\x64\x00\x65\x00\x66\x00\x67\x00\x68\x00\x69\x00\x6a\x00\x6b\x00\x6c\x00\x6d\x00\x6e\x00\x6f\x00\x70\x00\x71\x00\x72\x00\x73\x00\x74\x00\x75\x00\x76\x00\x77\x00\x78\x00\x79\x00\x7a\x00\xff\xff\x7c\x00\x21\x00\x7e\x00\x23\x00\x24\x00\x25\x00\x26\x00\x27\x00\xff\xff\xff\xff\x2a\x00\x2b\x00\x2c\x00\x2d\x00\x2e\x00\x2f\x00\x30\x00\x31\x00\x32\x00\x33\x00\x34\x00\x35\x00\x36\x00\x37\x00\x38\x00\x39\x00\x3a\x00\xff\xff\x3c\x00\x3d\x00\x3e\x00\x3f\x00\xff\xff\x41\x00\x42\x00\x43\x00\x44\x00\x45\x00\x46\x00\x47\x00\x48\x00\x49\x00\x4a\x00\x4b\x00\x4c\x00\x4d\x00\x4e\x00\x4f\x00\x50\x00\x51\x00\x52\x00\x53\x00\x54\x00\x55\x00\x56\x00\x57\x00\x58\x00\x59\x00\x5a\x00\x5b\x00\x5c\x00\x5d\x00\x5e\x00\x5f\x00\x60\x00\x61\x00\x62\x00\x63\x00\x64\x00\x65\x00\x66\x00\x67\x00\x68\x00\x69\x00\x6a\x00\x6b\x00\x6c\x00\x6d\x00\x6e\x00\x6f\x00\x70\x00\x71\x00\x72\x00\x73\x00\x74\x00\x75\x00\x76\x00\x77\x00\x78\x00\x79\x00\x7a\x00\xff\xff\x7c\x00\x21\x00\x7e\x00\x23\x00\x24\x00\x25\x00\x26\x00\x27\x00\xff\xff\xff\xff\x2a\x00\x2b\x00\x2c\x00\x2d\x00\x2e\x00\x2f\x00\x30\x00\x31\x00\x32\x00\x33\x00\x34\x00\x35\x00\x36\x00\x37\x00\x38\x00\x39\x00\x3a\x00\xff\xff\x3c\x00\x3d\x00\x3e\x00\x3f\x00\xff\xff\x41\x00\x42\x00\x43\x00\x44\x00\x45\x00\x46\x00\x47\x00\x48\x00\x49\x00\x4a\x00\x4b\x00\x4c\x00\x4d\x00\x4e\x00\x4f\x00\x50\x00\x51\x00\x52\x00\x53\x00\x54\x00\x55\x00\x56\x00\x57\x00\x58\x00\x59\x00\x5a\x00\x5b\x00\x5c\x00\x5d\x00\x5e\x00\x5f\x00\x60\x00\x61\x00\x62\x00\x63\x00\x64\x00\x65\x00\x66\x00\x67\x00\x68\x00\x69\x00\x6a\x00\x6b\x00\x6c\x00\x6d\x00\x6e\x00\x6f\x00\x70\x00\x71\x00\x72\x00\x73\x00\x74\x00\x75\x00\x76\x00\x77\x00\x78\x00\x79\x00\x7a\x00\xff\xff\x7c\x00\x21\x00\x7e\x00\x23\x00\x24\x00\x25\x00\x26\x00\x27\x00\xff\xff\xff\xff\x2a\x00\x2b\x00\x2c\x00\x2d\x00\x2e\x00\x2f\x00\x30\x00\x31\x00\x32\x00\x33\x00\x34\x00\x35\x00\x36\x00\x37\x00\x38\x00\x39\x00\x3a\x00\xff\xff\x3c\x00\x3d\x00\x3e\x00\x3f\x00\xff\xff\x41\x00\x42\x00\x43\x00\x44\x00\x45\x00\x46\x00\x47\x00\x48\x00\x49\x00\x4a\x00\x4b\x00\x4c\x00\x4d\x00\x4e\x00\x4f\x00\x50\x00\x51\x00\x52\x00\x53\x00\x54\x00\x55\x00\x56\x00\x57\x00\x58\x00\x59\x00\x5a\x00\x5b\x00\x5c\x00\x5d\x00\x5e\x00\x5f\x00\x60\x00\x61\x00\x62\x00\x63\x00\x64\x00\x65\x00\x66\x00\x67\x00\x68\x00\x69\x00\x6a\x00\x6b\x00\x6c\x00\x6d\x00\x6e\x00\x6f\x00\x70\x00\x71\x00\x72\x00\x73\x00\x74\x00\x75\x00\x76\x00\x77\x00\x78\x00\x79\x00\x7a\x00\xff\xff\x7c\x00\x21\x00\x7e\x00\x23\x00\x24\x00\x25\x00\x26\x00\x27\x00\xff\xff\xff\xff\x2a\x00\x2b\x00\x2c\x00\x2d\x00\x2e\x00\x2f\x00\x30\x00\x31\x00\x32\x00\x33\x00\x34\x00\x35\x00\x36\x00\x37\x00\x38\x00\x39\x00\x3a\x00\xff\xff\x3c\x00\x3d\x00\x3e\x00\x3f\x00\xff\xff\x41\x00\x42\x00\x43\x00\x44\x00\x45\x00\x46\x00\x47\x00\x48\x00\x49\x00\x4a\x00\x4b\x00\x4c\x00\x4d\x00\x4e\x00\x4f\x00\x50\x00\x51\x00\x52\x00\x53\x00\x54\x00\x55\x00\x56\x00\x57\x00\x58\x00\x59\x00\x5a\x00\x5b\x00\x5c\x00\x5d\x00\x5e\x00\x5f\x00\x60\x00\x61\x00\x62\x00\x63\x00\x64\x00\x65\x00\x66\x00\x67\x00\x68\x00\x69\x00\x6a\x00\x6b\x00\x6c\x00\x6d\x00\x6e\x00\x6f\x00\x70\x00\x71\x00\x72\x00\x73\x00\x74\x00\x75\x00\x76\x00\x77\x00\x78\x00\x79\x00\x7a\x00\xff\xff\x7c\x00\x21\x00\x7e\x00\x23\x00\x24\x00\x25\x00\x26\x00\x27\x00\xff\xff\xff\xff\x2a\x00\x2b\x00\x2c\x00\x2d\x00\x2e\x00\x2f\x00\x30\x00\x31\x00\x32\x00\x33\x00\x34\x00\x35\x00\x36\x00\x37\x00\x38\x00\x39\x00\x3a\x00\xff\xff\x3c\x00\x3d\x00\x3e\x00\x3f\x00\xff\xff\x41\x00\x42\x00\x43\x00\x44\x00\x45\x00\x46\x00\x47\x00\x48\x00\x49\x00\x4a\x00\x4b\x00\x4c\x00\x4d\x00\x4e\x00\x4f\x00\x50\x00\x51\x00\x52\x00\x53\x00\x54\x00\x55\x00\x56\x00\x57\x00\x58\x00\x59\x00\x5a\x00\x5b\x00\x5c\x00\x5d\x00\x5e\x00\x5f\x00\x60\x00\x61\x00\x62\x00\x63\x00\x64\x00\x65\x00\x66\x00\x67\x00\x68\x00\x69\x00\x6a\x00\x6b\x00\x6c\x00\x6d\x00\x6e\x00\x6f\x00\x70\x00\x71\x00\x72\x00\x73\x00\x74\x00\x75\x00\x76\x00\x77\x00\x78\x00\x79\x00\x7a\x00\xff\xff\x7c\x00\x21\x00\x7e\x00\x23\x00\x24\x00\x25\x00\x26\x00\x27\x00\xff\xff\xff\xff\x2a\x00\x2b\x00\x2c\x00\x2d\x00\x2e\x00\x2f\x00\x30\x00\x31\x00\x32\x00\x33\x00\x34\x00\x35\x00\x36\x00\x37\x00\x38\x00\x39\x00\x3a\x00\xff\xff\x3c\x00\x3d\x00\x3e\x00\x3f\x00\xff\xff\x41\x00\x42\x00\x43\x00\x44\x00\x45\x00\x46\x00\x47\x00\x48\x00\x49\x00\x4a\x00\x4b\x00\x4c\x00\x4d\x00\x4e\x00\x4f\x00\x50\x00\x51\x00\x52\x00\x53\x00\x54\x00\x55\x00\x56\x00\x57\x00\x58\x00\x59\x00\x5a\x00\x5b\x00\x5c\x00\x5d\x00\x5e\x00\x5f\x00\x60\x00\x61\x00\x62\x00\x63\x00\x64\x00\x65\x00\x66\x00\x67\x00\x68\x00\x69\x00\x6a\x00\x6b\x00\x6c\x00\x6d\x00\x6e\x00\x6f\x00\x70\x00\x71\x00\x72\x00\x73\x00\x74\x00\x75\x00\x76\x00\x77\x00\x78\x00\x79\x00\x7a\x00\xff\xff\x7c\x00\x21\x00\x7e\x00\x23\x00\x24\x00\x25\x00\x26\x00\x27\x00\xff\xff\xff\xff\x2a\x00\x2b\x00\x2c\x00\x2d\x00\x2e\x00\x2f\x00\x30\x00\x31\x00\x32\x00\x33\x00\x34\x00\x35\x00\x36\x00\x37\x00\x38\x00\x39\x00\x3a\x00\xff\xff\x3c\x00\x3d\x00\x3e\x00\x3f\x00\xff\xff\x41\x00\x42\x00\x43\x00\x44\x00\x45\x00\x46\x00\x47\x00\x48\x00\x49\x00\x4a\x00\x4b\x00\x4c\x00\x4d\x00\x4e\x00\x4f\x00\x50\x00\x51\x00\x52\x00\x53\x00\x54\x00\x55\x00\x56\x00\x57\x00\x58\x00\x59\x00\x5a\x00\x5b\x00\x5c\x00\x5d\x00\x5e\x00\x5f\x00\x60\x00\x61\x00\x62\x00\x63\x00\x64\x00\x65\x00\x66\x00\x67\x00\x68\x00\x69\x00\x6a\x00\x6b\x00\x6c\x00\x6d\x00\x6e\x00\x6f\x00\x70\x00\x71\x00\x72\x00\x73\x00\x74\x00\x75\x00\x76\x00\x77\x00\x78\x00\x79\x00\x7a\x00\xff\xff\x7c\x00\x21\x00\x7e\x00\x23\x00\x24\x00\x25\x00\x26\x00\x27\x00\xff\xff\xff\xff\x2a\x00\x2b\x00\x2c\x00\x2d\x00\x2e\x00\x2f\x00\x30\x00\x31\x00\x32\x00\x33\x00\x34\x00\x35\x00\x36\x00\x37\x00\x38\x00\x39\x00\x3a\x00\xff\xff\x3c\x00\x3d\x00\x3e\x00\x3f\x00\xff\xff\x41\x00\x42\x00\x43\x00\x44\x00\x45\x00\x46\x00\x47\x00\x48\x00\x49\x00\x4a\x00\x4b\x00\x4c\x00\x4d\x00\x4e\x00\x4f\x00\x50\x00\x51\x00\x52\x00\x53\x00\x54\x00\x55\x00\x56\x00\x57\x00\x58\x00\x59\x00\x5a\x00\x5b\x00\x5c\x00\x5d\x00\x5e\x00\x5f\x00\x60\x00\x61\x00\x62\x00\x63\x00\x64\x00\x65\x00\x66\x00\x67\x00\x68\x00\x69\x00\x6a\x00\x6b\x00\x6c\x00\x6d\x00\x6e\x00\x6f\x00\x70\x00\x71\x00\x72\x00\x73\x00\x74\x00\x75\x00\x76\x00\x77\x00\x78\x00\x79\x00\x7a\x00\xff\xff\x7c\x00\x21\x00\x7e\x00\x23\x00\x24\x00\x25\x00\x26\x00\x27\x00\xff\xff\xff\xff\x2a\x00\x2b\x00\x2c\x00\x2d\x00\x2e\x00\x2f\x00\x30\x00\x31\x00\x32\x00\x33\x00\x34\x00\x35\x00\x36\x00\x37\x00\x38\x00\x39\x00\x3a\x00\xff\xff\x3c\x00\x3d\x00\x3e\x00\x3f\x00\xff\xff\x41\x00\x42\x00\x43\x00\x44\x00\x45\x00\x46\x00\x47\x00\x48\x00\x49\x00\x4a\x00\x4b\x00\x4c\x00\x4d\x00\x4e\x00\x4f\x00\x50\x00\x51\x00\x52\x00\x53\x00\x54\x00\x55\x00\x56\x00\x57\x00\x58\x00\x59\x00\x5a\x00\x5b\x00\x5c\x00\x5d\x00\x5e\x00\x5f\x00\x60\x00\x61\x00\x62\x00\x63\x00\x64\x00\x65\x00\x66\x00\x67\x00\x68\x00\x69\x00\x6a\x00\x6b\x00\x6c\x00\x6d\x00\x6e\x00\x6f\x00\x70\x00\x71\x00\x72\x00\x73\x00\x74\x00\x75\x00\x76\x00\x77\x00\x78\x00\x79\x00\x7a\x00\xff\xff\x7c\x00\x21\x00\x7e\x00\x23\x00\x24\x00\x25\x00\x26\x00\x27\x00\xff\xff\xff\xff\x2a\x00\x2b\x00\x2c\x00\x2d\x00\x2e\x00\x2f\x00\x30\x00\x31\x00\x32\x00\x33\x00\x34\x00\x35\x00\x36\x00\x37\x00\x38\x00\x39\x00\x3a\x00\xff\xff\x3c\x00\x3d\x00\x3e\x00\x3f\x00\xff\xff\x41\x00\x42\x00\x43\x00\x44\x00\x45\x00\x46\x00\x47\x00\x48\x00\x49\x00\x4a\x00\x4b\x00\x4c\x00\x4d\x00\x4e\x00\x4f\x00\x50\x00\x51\x00\x52\x00\x53\x00\x54\x00\x55\x00\x56\x00\x57\x00\x58\x00\x59\x00\x5a\x00\x5b\x00\x5c\x00\x5d\x00\x5e\x00\x5f\x00\x60\x00\x61\x00\x62\x00\x63\x00\x64\x00\x65\x00\x66\x00\x67\x00\x68\x00\x69\x00\x6a\x00\x6b\x00\x6c\x00\x6d\x00\x6e\x00\x6f\x00\x70\x00\x71\x00\x72\x00\x73\x00\x74\x00\x75\x00\x76\x00\x77\x00\x78\x00\x79\x00\x7a\x00\xff\xff\x7c\x00\x21\x00\x7e\x00\x23\x00\x24\x00\x25\x00\x26\x00\x27\x00\xff\xff\xff\xff\x2a\x00\x2b\x00\x2c\x00\x2d\x00\x2e\x00\x2f\x00\x30\x00\x31\x00\x32\x00\x33\x00\x34\x00\x35\x00\x36\x00\x37\x00\x38\x00\x39\x00\x3a\x00\xff\xff\x3c\x00\x3d\x00\x3e\x00\x3f\x00\xff\xff\x41\x00\x42\x00\x43\x00\x44\x00\x45\x00\x46\x00\x47\x00\x48\x00\x49\x00\x4a\x00\x4b\x00\x4c\x00\x4d\x00\x4e\x00\x4f\x00\x50\x00\x51\x00\x52\x00\x53\x00\x54\x00\x55\x00\x56\x00\x57\x00\x58\x00\x59\x00\x5a\x00\x5b\x00\x5c\x00\x5d\x00\x5e\x00\x5f\x00\x60\x00\x61\x00\x62\x00\x63\x00\x64\x00\x65\x00\x66\x00\x67\x00\x68\x00\x69\x00\x6a\x00\x6b\x00\x6c\x00\x6d\x00\x6e\x00\x6f\x00\x70\x00\x71\x00\x72\x00\x73\x00\x74\x00\x75\x00\x76\x00\x77\x00\x78\x00\x79\x00\x7a\x00\xff\xff\x7c\x00\x21\x00\x7e\x00\x23\x00\x24\x00\x25\x00\x26\x00\x27\x00\xff\xff\xff\xff\x2a\x00\x2b\x00\x2c\x00\x2d\x00\x2e\x00\x2f\x00\x30\x00\x31\x00\x32\x00\x33\x00\x34\x00\x35\x00\x36\x00\x37\x00\x38\x00\x39\x00\x3a\x00\xff\xff\x3c\x00\x3d\x00\x3e\x00\x3f\x00\xff\xff\x41\x00\x42\x00\x43\x00\x44\x00\x45\x00\x46\x00\x47\x00\x48\x00\x49\x00\x4a\x00\x4b\x00\x4c\x00\x4d\x00\x4e\x00\x4f\x00\x50\x00\x51\x00\x52\x00\x53\x00\x54\x00\x55\x00\x56\x00\x57\x00\x58\x00\x59\x00\x5a\x00\x5b\x00\x5c\x00\x5d\x00\x5e\x00\x5f\x00\x60\x00\x61\x00\x62\x00\x63\x00\x64\x00\x65\x00\x66\x00\x67\x00\x68\x00\x69\x00\x6a\x00\x6b\x00\x6c\x00\x6d\x00\x6e\x00\x6f\x00\x70\x00\x71\x00\x72\x00\x73\x00\x74\x00\x75\x00\x76\x00\x77\x00\x78\x00\x79\x00\x7a\x00\xff\xff\x7c\x00\x21\x00\x7e\x00\x23\x00\x24\x00\x25\x00\x26\x00\x27\x00\xff\xff\xff\xff\x2a\x00\x2b\x00\x2c\x00\x2d\x00\x2e\x00\x2f\x00\x30\x00\x31\x00\x32\x00\x33\x00\x34\x00\x35\x00\x36\x00\x37\x00\x38\x00\x39\x00\x3a\x00\xff\xff\x3c\x00\x3d\x00\x3e\x00\x3f\x00\xff\xff\x41\x00\x42\x00\x43\x00\x44\x00\x45\x00\x46\x00\x47\x00\x48\x00\x49\x00\x4a\x00\x4b\x00\x4c\x00\x4d\x00\x4e\x00\x4f\x00\x50\x00\x51\x00\x52\x00\x53\x00\x54\x00\x55\x00\x56\x00\x57\x00\x58\x00\x59\x00\x5a\x00\x5b\x00\x5c\x00\x5d\x00\x5e\x00\x5f\x00\x60\x00\x61\x00\x62\x00\x63\x00\x64\x00\x65\x00\x66\x00\x67\x00\x68\x00\x69\x00\x6a\x00\x6b\x00\x6c\x00\x6d\x00\x6e\x00\x6f\x00\x70\x00\x71\x00\x72\x00\x73\x00\x74\x00\x75\x00\x76\x00\x77\x00\x78\x00\x79\x00\x7a\x00\xff\xff\x7c\x00\x21\x00\x7e\x00\x23\x00\x24\x00\x25\x00\x26\x00\x27\x00\xff\xff\xff\xff\x2a\x00\x2b\x00\x2c\x00\x2d\x00\x2e\x00\x2f\x00\x30\x00\x31\x00\x32\x00\x33\x00\x34\x00\x35\x00\x36\x00\x37\x00\x38\x00\x39\x00\x3a\x00\xff\xff\x3c\x00\x3d\x00\x3e\x00\x3f\x00\xff\xff\x41\x00\x42\x00\x43\x00\x44\x00\x45\x00\x46\x00\x47\x00\x48\x00\x49\x00\x4a\x00\x4b\x00\x4c\x00\x4d\x00\x4e\x00\x4f\x00\x50\x00\x51\x00\x52\x00\x53\x00\x54\x00\x55\x00\x56\x00\x57\x00\x58\x00\x59\x00\x5a\x00\x5b\x00\x5c\x00\x5d\x00\x5e\x00\x5f\x00\x60\x00\x61\x00\x62\x00\x63\x00\x64\x00\x65\x00\x66\x00\x67\x00\x68\x00\x69\x00\x6a\x00\x6b\x00\x6c\x00\x6d\x00\x6e\x00\x6f\x00\x70\x00\x71\x00\x72\x00\x73\x00\x74\x00\x75\x00\x76\x00\x77\x00\x78\x00\x79\x00\x7a\x00\xff\xff\x7c\x00\x21\x00\x7e\x00\x23\x00\x24\x00\x25\x00\x26\x00\x27\x00\xff\xff\xff\xff\x2a\x00\x2b\x00\x2c\x00\x2d\x00\x2e\x00\x2f\x00\x30\x00\x31\x00\x32\x00\x33\x00\x34\x00\x35\x00\x36\x00\x37\x00\x38\x00\x39\x00\x3a\x00\xff\xff\x3c\x00\x3d\x00\x3e\x00\x3f\x00\xff\xff\x41\x00\x42\x00\x43\x00\x44\x00\x45\x00\x46\x00\x47\x00\x48\x00\x49\x00\x4a\x00\x4b\x00\x4c\x00\x4d\x00\x4e\x00\x4f\x00\x50\x00\x51\x00\x52\x00\x53\x00\x54\x00\x55\x00\x56\x00\x57\x00\x58\x00\x59\x00\x5a\x00\x5b\x00\x5c\x00\x5d\x00\x5e\x00\x5f\x00\x60\x00\x61\x00\x62\x00\x63\x00\x64\x00\x65\x00\x66\x00\x67\x00\x68\x00\x69\x00\x6a\x00\x6b\x00\x6c\x00\x6d\x00\x6e\x00\x6f\x00\x70\x00\x71\x00\x72\x00\x73\x00\x74\x00\x75\x00\x76\x00\x77\x00\x78\x00\x79\x00\x7a\x00\xff\xff\x7c\x00\x21\x00\x7e\x00\x23\x00\x24\x00\x25\x00\x26\x00\x27\x00\xff\xff\xff\xff\x2a\x00\x2b\x00\x2c\x00\x2d\x00\x2e\x00\x2f\x00\x30\x00\x31\x00\x32\x00\x33\x00\x34\x00\x35\x00\x36\x00\x37\x00\x38\x00\x39\x00\x3a\x00\xff\xff\x3c\x00\x3d\x00\x3e\x00\x3f\x00\xff\xff\x41\x00\x42\x00\x43\x00\x44\x00\x45\x00\x46\x00\x47\x00\x48\x00\x49\x00\x4a\x00\x4b\x00\x4c\x00\x4d\x00\x4e\x00\x4f\x00\x50\x00\x51\x00\x52\x00\x53\x00\x54\x00\x55\x00\x56\x00\x57\x00\x58\x00\x59\x00\x5a\x00\x5b\x00\x5c\x00\x5d\x00\x5e\x00\x5f\x00\x60\x00\x61\x00\x62\x00\x63\x00\x64\x00\x65\x00\x66\x00\x67\x00\x68\x00\x69\x00\x6a\x00\x6b\x00\x6c\x00\x6d\x00\x6e\x00\x6f\x00\x70\x00\x71\x00\x72\x00\x73\x00\x74\x00\x75\x00\x76\x00\x77\x00\x78\x00\x79\x00\x7a\x00\xff\xff\x7c\x00\x21\x00\x7e\x00\x23\x00\x24\x00\x25\x00\x26\x00\x27\x00\xff\xff\xff\xff\x2a\x00\x2b\x00\x2c\x00\x2d\x00\x2e\x00\x2f\x00\x30\x00\x31\x00\x32\x00\x33\x00\x34\x00\x35\x00\x36\x00\x37\x00\x38\x00\x39\x00\x3a\x00\xff\xff\x3c\x00\x3d\x00\x3e\x00\x3f\x00\xff\xff\x41\x00\x42\x00\x43\x00\x44\x00\x45\x00\x46\x00\x47\x00\x48\x00\x49\x00\x4a\x00\x4b\x00\x4c\x00\x4d\x00\x4e\x00\x4f\x00\x50\x00\x51\x00\x52\x00\x53\x00\x54\x00\x55\x00\x56\x00\x57\x00\x58\x00\x59\x00\x5a\x00\x5b\x00\x5c\x00\x5d\x00\x5e\x00\x5f\x00\x60\x00\x61\x00\x62\x00\x63\x00\x64\x00\x65\x00\x66\x00\x67\x00\x68\x00\x69\x00\x6a\x00\x6b\x00\x6c\x00\x6d\x00\x6e\x00\x6f\x00\x70\x00\x71\x00\x72\x00\x73\x00\x74\x00\x75\x00\x76\x00\x77\x00\x78\x00\x79\x00\x7a\x00\xff\xff\x7c\x00\x21\x00\x7e\x00\x23\x00\x24\x00\x25\x00\x26\x00\x27\x00\xff\xff\xff\xff\x2a\x00\x2b\x00\x2c\x00\x2d\x00\x2e\x00\x2f\x00\x30\x00\x31\x00\x32\x00\x33\x00\x34\x00\x35\x00\x36\x00\x37\x00\x38\x00\x39\x00\x3a\x00\xff\xff\x3c\x00\x3d\x00\x3e\x00\x3f\x00\xff\xff\x41\x00\x42\x00\x43\x00\x44\x00\x45\x00\x46\x00\x47\x00\x48\x00\x49\x00\x4a\x00\x4b\x00\x4c\x00\x4d\x00\x4e\x00\x4f\x00\x50\x00\x51\x00\x52\x00\x53\x00\x54\x00\x55\x00\x56\x00\x57\x00\x58\x00\x59\x00\x5a\x00\x5b\x00\x5c\x00\x5d\x00\x5e\x00\x5f\x00\x60\x00\x61\x00\x62\x00\x63\x00\x64\x00\x65\x00\x66\x00\x67\x00\x68\x00\x69\x00\x6a\x00\x6b\x00\x6c\x00\x6d\x00\x6e\x00\x6f\x00\x70\x00\x71\x00\x72\x00\x73\x00\x74\x00\x75\x00\x76\x00\x77\x00\x78\x00\x79\x00\x7a\x00\xff\xff\x7c\x00\x21\x00\x7e\x00\x23\x00\x24\x00\x25\x00\x26\x00\x27\x00\xff\xff\xff\xff\x2a\x00\x2b\x00\x2c\x00\x2d\x00\x2e\x00\x2f\x00\x30\x00\x31\x00\x32\x00\x33\x00\x34\x00\x35\x00\x36\x00\x37\x00\x38\x00\x39\x00\x3a\x00\xff\xff\x3c\x00\x3d\x00\x3e\x00\x3f\x00\xff\xff\x41\x00\x42\x00\x43\x00\x44\x00\x45\x00\x46\x00\x47\x00\x48\x00\x49\x00\x4a\x00\x4b\x00\x4c\x00\x4d\x00\x4e\x00\x4f\x00\x50\x00\x51\x00\x52\x00\x53\x00\x54\x00\x55\x00\x56\x00\x57\x00\x58\x00\x59\x00\x5a\x00\x5b\x00\x5c\x00\x5d\x00\x5e\x00\x5f\x00\x60\x00\x61\x00\x62\x00\x63\x00\x64\x00\x65\x00\x66\x00\x67\x00\x68\x00\x69\x00\x6a\x00\x6b\x00\x6c\x00\x6d\x00\x6e\x00\x6f\x00\x70\x00\x71\x00\x72\x00\x73\x00\x74\x00\x75\x00\x76\x00\x77\x00\x78\x00\x79\x00\x7a\x00\xff\xff\x7c\x00\x21\x00\x7e\x00\x23\x00\x24\x00\x25\x00\x26\x00\x27\x00\xff\xff\xff\xff\x2a\x00\x2b\x00\x2c\x00\x2d\x00\x2e\x00\x2f\x00\x30\x00\x31\x00\x32\x00\x33\x00\x34\x00\x35\x00\x36\x00\x37\x00\x38\x00\x39\x00\x3a\x00\xff\xff\x3c\x00\x3d\x00\x3e\x00\x3f\x00\xff\xff\x41\x00\x42\x00\x43\x00\x44\x00\x45\x00\x46\x00\x47\x00\x48\x00\x49\x00\x4a\x00\x4b\x00\x4c\x00\x4d\x00\x4e\x00\x4f\x00\x50\x00\x51\x00\x52\x00\x53\x00\x54\x00\x55\x00\x56\x00\x57\x00\x58\x00\x59\x00\x5a\x00\x5b\x00\x5c\x00\x5d\x00\x5e\x00\x5f\x00\x60\x00\x61\x00\x62\x00\x63\x00\x64\x00\x65\x00\x66\x00\x67\x00\x68\x00\x69\x00\x6a\x00\x6b\x00\x6c\x00\x6d\x00\x6e\x00\x6f\x00\x70\x00\x71\x00\x72\x00\x73\x00\x74\x00\x75\x00\x76\x00\x77\x00\x78\x00\x79\x00\x7a\x00\xff\xff\x7c\x00\x21\x00\x7e\x00\x23\x00\x24\x00\x25\x00\x26\x00\x27\x00\xff\xff\xff\xff\x2a\x00\x2b\x00\x2c\x00\x2d\x00\x2e\x00\x2f\x00\x30\x00\x31\x00\x32\x00\x33\x00\x34\x00\x35\x00\x36\x00\x37\x00\x38\x00\x39\x00\x3a\x00\xff\xff\x3c\x00\x3d\x00\x3e\x00\x3f\x00\xff\xff\x41\x00\x42\x00\x43\x00\x44\x00\x45\x00\x46\x00\x47\x00\x48\x00\x49\x00\x4a\x00\x4b\x00\x4c\x00\x4d\x00\x4e\x00\x4f\x00\x50\x00\x51\x00\x52\x00\x53\x00\x54\x00\x55\x00\x56\x00\x57\x00\x58\x00\x59\x00\x5a\x00\x5b\x00\x5c\x00\x5d\x00\x5e\x00\x5f\x00\x60\x00\x61\x00\x62\x00\x63\x00\x64\x00\x65\x00\x66\x00\x67\x00\x68\x00\x69\x00\x6a\x00\x6b\x00\x6c\x00\x6d\x00\x6e\x00\x6f\x00\x70\x00\x71\x00\x72\x00\x73\x00\x74\x00\x75\x00\x76\x00\x77\x00\x78\x00\x79\x00\x7a\x00\xff\xff\x7c\x00\x21\x00\x7e\x00\x23\x00\x24\x00\x25\x00\x26\x00\x27\x00\xff\xff\xff\xff\x2a\x00\x2b\x00\x2c\x00\x2d\x00\x2e\x00\x2f\x00\x30\x00\x31\x00\x32\x00\x33\x00\x34\x00\x35\x00\x36\x00\x37\x00\x38\x00\x39\x00\x3a\x00\xff\xff\x3c\x00\x3d\x00\x3e\x00\x3f\x00\xff\xff\x41\x00\x42\x00\x43\x00\x44\x00\x45\x00\x46\x00\x47\x00\x48\x00\x49\x00\x4a\x00\x4b\x00\x4c\x00\x4d\x00\x4e\x00\x4f\x00\x50\x00\x51\x00\x52\x00\x53\x00\x54\x00\x55\x00\x56\x00\x57\x00\x58\x00\x59\x00\x5a\x00\x5b\x00\x5c\x00\x5d\x00\x5e\x00\x5f\x00\x60\x00\x61\x00\x62\x00\x63\x00\x64\x00\x65\x00\x66\x00\x67\x00\x68\x00\x69\x00\x6a\x00\x6b\x00\x6c\x00\x6d\x00\x6e\x00\x6f\x00\x70\x00\x71\x00\x72\x00\x73\x00\x74\x00\x75\x00\x76\x00\x77\x00\x78\x00\x79\x00\x7a\x00\xff\xff\x7c\x00\x21\x00\x7e\x00\x23\x00\x24\x00\x25\x00\x26\x00\x27\x00\xff\xff\xff\xff\x2a\x00\x2b\x00\x2c\x00\x2d\x00\x2e\x00\x2f\x00\x30\x00\x31\x00\x32\x00\x33\x00\x34\x00\x35\x00\x36\x00\x37\x00\x38\x00\x39\x00\x3a\x00\xff\xff\x3c\x00\x3d\x00\x3e\x00\x3f\x00\xff\xff\x41\x00\x42\x00\x43\x00\x44\x00\x45\x00\x46\x00\x47\x00\x48\x00\x49\x00\x4a\x00\x4b\x00\x4c\x00\x4d\x00\x4e\x00\x4f\x00\x50\x00\x51\x00\x52\x00\x53\x00\x54\x00\x55\x00\x56\x00\x57\x00\x58\x00\x59\x00\x5a\x00\x5b\x00\x5c\x00\x5d\x00\x5e\x00\x5f\x00\x60\x00\x61\x00\x62\x00\x63\x00\x64\x00\x65\x00\x66\x00\x67\x00\x68\x00\x69\x00\x6a\x00\x6b\x00\x6c\x00\x6d\x00\x6e\x00\x6f\x00\x70\x00\x71\x00\x72\x00\x73\x00\x74\x00\x75\x00\x76\x00\x77\x00\x78\x00\x79\x00\x7a\x00\xff\xff\x7c\x00\x21\x00\x7e\x00\x23\x00\x24\x00\x25\x00\x26\x00\x27\x00\xff\xff\xff\xff\x2a\x00\x2b\x00\x2c\x00\x2d\x00\x2e\x00\x2f\x00\x30\x00\x31\x00\x32\x00\x33\x00\x34\x00\x35\x00\x36\x00\x37\x00\x38\x00\x39\x00\x3a\x00\xff\xff\x3c\x00\x3d\x00\x3e\x00\x3f\x00\xff\xff\x41\x00\x42\x00\x43\x00\x44\x00\x45\x00\x46\x00\x47\x00\x48\x00\x49\x00\x4a\x00\x4b\x00\x4c\x00\x4d\x00\x4e\x00\x4f\x00\x50\x00\x51\x00\x52\x00\x53\x00\x54\x00\x55\x00\x56\x00\x57\x00\x58\x00\x59\x00\x5a\x00\x5b\x00\x5c\x00\x5d\x00\x5e\x00\x5f\x00\x60\x00\x61\x00\x62\x00\x63\x00\x64\x00\x65\x00\x66\x00\x67\x00\x68\x00\x69\x00\x6a\x00\x6b\x00\x6c\x00\x6d\x00\x6e\x00\x6f\x00\x70\x00\x71\x00\x72\x00\x73\x00\x74\x00\x75\x00\x76\x00\x77\x00\x78\x00\x79\x00\x7a\x00\xff\xff\x7c\x00\x21\x00\x7e\x00\x23\x00\x24\x00\x25\x00\x26\x00\x27\x00\xff\xff\xff\xff\x2a\x00\x2b\x00\x2c\x00\x2d\x00\x2e\x00\x2f\x00\x30\x00\x31\x00\x32\x00\x33\x00\x34\x00\x35\x00\x36\x00\x37\x00\x38\x00\x39\x00\x3a\x00\xff\xff\x3c\x00\x3d\x00\x3e\x00\x3f\x00\xff\xff\x41\x00\x42\x00\x43\x00\x44\x00\x45\x00\x46\x00\x47\x00\x48\x00\x49\x00\x4a\x00\x4b\x00\x4c\x00\x4d\x00\x4e\x00\x4f\x00\x50\x00\x51\x00\x52\x00\x53\x00\x54\x00\x55\x00\x56\x00\x57\x00\x58\x00\x59\x00\x5a\x00\x5b\x00\x5c\x00\x5d\x00\x5e\x00\x5f\x00\x60\x00\x61\x00\x62\x00\x63\x00\x64\x00\x65\x00\x66\x00\x67\x00\x68\x00\x69\x00\x6a\x00\x6b\x00\x6c\x00\x6d\x00\x6e\x00\x6f\x00\x70\x00\x71\x00\x72\x00\x73\x00\x74\x00\x75\x00\x76\x00\x77\x00\x78\x00\x79\x00\x7a\x00\xff\xff\x7c\x00\x21\x00\x7e\x00\x23\x00\x24\x00\x25\x00\x26\x00\x27\x00\xff\xff\xff\xff\x2a\x00\x2b\x00\x2c\x00\x2d\x00\x2e\x00\x2f\x00\x30\x00\x31\x00\x32\x00\x33\x00\x34\x00\x35\x00\x36\x00\x37\x00\x38\x00\x39\x00\x3a\x00\xff\xff\x3c\x00\x3d\x00\x3e\x00\x3f\x00\xff\xff\x41\x00\x42\x00\x43\x00\x44\x00\x45\x00\x46\x00\x47\x00\x48\x00\x49\x00\x4a\x00\x4b\x00\x4c\x00\x4d\x00\x4e\x00\x4f\x00\x50\x00\x51\x00\x52\x00\x53\x00\x54\x00\x55\x00\x56\x00\x57\x00\x58\x00\x59\x00\x5a\x00\x5b\x00\x5c\x00\x5d\x00\x5e\x00\x5f\x00\x60\x00\x61\x00\x62\x00\x63\x00\x64\x00\x65\x00\x66\x00\x67\x00\x68\x00\x69\x00\x6a\x00\x6b\x00\x6c\x00\x6d\x00\x6e\x00\x6f\x00\x70\x00\x71\x00\x72\x00\x73\x00\x74\x00\x75\x00\x76\x00\x77\x00\x78\x00\x79\x00\x7a\x00\xff\xff\x7c\x00\x21\x00\x7e\x00\x23\x00\x24\x00\x25\x00\x26\x00\x27\x00\xff\xff\xff\xff\x2a\x00\x2b\x00\x2c\x00\x2d\x00\x2e\x00\x2f\x00\x30\x00\x31\x00\x32\x00\x33\x00\x34\x00\x35\x00\x36\x00\x37\x00\x38\x00\x39\x00\x3a\x00\xff\xff\x3c\x00\x3d\x00\x3e\x00\x3f\x00\xff\xff\x41\x00\x42\x00\x43\x00\x44\x00\x45\x00\x46\x00\x47\x00\x48\x00\x49\x00\x4a\x00\x4b\x00\x4c\x00\x4d\x00\x4e\x00\x4f\x00\x50\x00\x51\x00\x52\x00\x53\x00\x54\x00\x55\x00\x56\x00\x57\x00\x58\x00\x59\x00\x5a\x00\x5b\x00\x5c\x00\x5d\x00\x5e\x00\x5f\x00\x60\x00\x61\x00\x62\x00\x63\x00\x64\x00\x65\x00\x66\x00\x67\x00\x68\x00\x69\x00\x6a\x00\x6b\x00\x6c\x00\x6d\x00\x6e\x00\x6f\x00\x70\x00\x71\x00\x72\x00\x73\x00\x74\x00\x75\x00\x76\x00\x77\x00\x78\x00\x79\x00\x7a\x00\xff\xff\x7c\x00\x21\x00\x7e\x00\x23\x00\x24\x00\x25\x00\x26\x00\x27\x00\xff\xff\xff\xff\x2a\x00\x2b\x00\x2c\x00\x2d\x00\x2e\x00\x2f\x00\x30\x00\x31\x00\x32\x00\x33\x00\x34\x00\x35\x00\x36\x00\x37\x00\x38\x00\x39\x00\x3a\x00\xff\xff\x3c\x00\x3d\x00\x3e\x00\x3f\x00\xff\xff\x41\x00\x42\x00\x43\x00\x44\x00\x45\x00\x46\x00\x47\x00\x48\x00\x49\x00\x4a\x00\x4b\x00\x4c\x00\x4d\x00\x4e\x00\x4f\x00\x50\x00\x51\x00\x52\x00\x53\x00\x54\x00\x55\x00\x56\x00\x57\x00\x58\x00\x59\x00\x5a\x00\x5b\x00\x5c\x00\x5d\x00\x5e\x00\x5f\x00\x60\x00\x61\x00\x62\x00\x63\x00\x64\x00\x65\x00\x66\x00\x67\x00\x68\x00\x69\x00\x6a\x00\x6b\x00\x6c\x00\x6d\x00\x6e\x00\x6f\x00\x70\x00\x71\x00\x72\x00\x73\x00\x74\x00\x75\x00\x76\x00\x77\x00\x78\x00\x79\x00\x7a\x00\xff\xff\x7c\x00\x21\x00\x7e\x00\x23\x00\x24\x00\x25\x00\x26\x00\x27\x00\xff\xff\xff\xff\x2a\x00\x2b\x00\x2c\x00\x2d\x00\x2e\x00\x2f\x00\x30\x00\x31\x00\x32\x00\x33\x00\x34\x00\x35\x00\x36\x00\x37\x00\x38\x00\x39\x00\x3a\x00\xff\xff\x3c\x00\x3d\x00\x3e\x00\x3f\x00\xff\xff\x41\x00\x42\x00\x43\x00\x44\x00\x45\x00\x46\x00\x47\x00\x48\x00\x49\x00\x4a\x00\x4b\x00\x4c\x00\x4d\x00\x4e\x00\x4f\x00\x50\x00\x51\x00\x52\x00\x53\x00\x54\x00\x55\x00\x56\x00\x57\x00\x58\x00\x59\x00\x5a\x00\x5b\x00\x5c\x00\x5d\x00\x5e\x00\x5f\x00\x60\x00\x61\x00\x62\x00\x63\x00\x64\x00\x65\x00\x66\x00\x67\x00\x68\x00\x69\x00\x6a\x00\x6b\x00\x6c\x00\x6d\x00\x6e\x00\x6f\x00\x70\x00\x71\x00\x72\x00\x73\x00\x74\x00\x75\x00\x76\x00\x77\x00\x78\x00\x79\x00\x7a\x00\xff\xff\x7c\x00\x21\x00\x7e\x00\x23\x00\x24\x00\x25\x00\x26\x00\x27\x00\xff\xff\xff\xff\x2a\x00\x2b\x00\x2c\x00\x2d\x00\x2e\x00\x2f\x00\x30\x00\x31\x00\x32\x00\x33\x00\x34\x00\x35\x00\x36\x00\x37\x00\x38\x00\x39\x00\x3a\x00\xff\xff\x3c\x00\x3d\x00\x3e\x00\x3f\x00\xff\xff\x41\x00\x42\x00\x43\x00\x44\x00\x45\x00\x46\x00\x47\x00\x48\x00\x49\x00\x4a\x00\x4b\x00\x4c\x00\x4d\x00\x4e\x00\x4f\x00\x50\x00\x51\x00\x52\x00\x53\x00\x54\x00\x55\x00\x56\x00\x57\x00\x58\x00\x59\x00\x5a\x00\x5b\x00\x5c\x00\x5d\x00\x5e\x00\x5f\x00\x60\x00\x61\x00\x62\x00\x63\x00\x64\x00\x65\x00\x66\x00\x67\x00\x68\x00\x69\x00\x6a\x00\x6b\x00\x6c\x00\x6d\x00\x6e\x00\x6f\x00\x70\x00\x71\x00\x72\x00\x73\x00\x74\x00\x75\x00\x76\x00\x77\x00\x78\x00\x79\x00\x7a\x00\xff\xff\x7c\x00\x21\x00\x7e\x00\x23\x00\x24\x00\x25\x00\x26\x00\x27\x00\xff\xff\xff\xff\x2a\x00\x2b\x00\x2c\x00\x2d\x00\x2e\x00\x2f\x00\x30\x00\x31\x00\x32\x00\x33\x00\x34\x00\x35\x00\x36\x00\x37\x00\x38\x00\x39\x00\x3a\x00\xff\xff\x3c\x00\x3d\x00\x3e\x00\x3f\x00\xff\xff\x41\x00\x42\x00\x43\x00\x44\x00\x45\x00\x46\x00\x47\x00\x48\x00\x49\x00\x4a\x00\x4b\x00\x4c\x00\x4d\x00\x4e\x00\x4f\x00\x50\x00\x51\x00\x52\x00\x53\x00\x54\x00\x55\x00\x56\x00\x57\x00\x58\x00\x59\x00\x5a\x00\x5b\x00\x5c\x00\x5d\x00\x5e\x00\x5f\x00\x60\x00\x61\x00\x62\x00\x63\x00\x64\x00\x65\x00\x66\x00\x67\x00\x68\x00\x69\x00\x6a\x00\x6b\x00\x6c\x00\x6d\x00\x6e\x00\x6f\x00\x70\x00\x71\x00\x72\x00\x73\x00\x74\x00\x75\x00\x76\x00\x77\x00\x78\x00\x79\x00\x7a\x00\xff\xff\x7c\x00\x21\x00\x7e\x00\x23\x00\x24\x00\x25\x00\x26\x00\x27\x00\xff\xff\xff\xff\x2a\x00\x2b\x00\x2c\x00\x2d\x00\x2e\x00\x2f\x00\x30\x00\x31\x00\x32\x00\x33\x00\x34\x00\x35\x00\x36\x00\x37\x00\x38\x00\x39\x00\x3a\x00\xff\xff\x3c\x00\x3d\x00\x3e\x00\x3f\x00\xff\xff\x41\x00\x42\x00\x43\x00\x44\x00\x45\x00\x46\x00\x47\x00\x48\x00\x49\x00\x4a\x00\x4b\x00\x4c\x00\x4d\x00\x4e\x00\x4f\x00\x50\x00\x51\x00\x52\x00\x53\x00\x54\x00\x55\x00\x56\x00\x57\x00\x58\x00\x59\x00\x5a\x00\x5b\x00\x5c\x00\x5d\x00\x5e\x00\x5f\x00\x60\x00\x61\x00\x62\x00\x63\x00\x64\x00\x65\x00\x66\x00\x67\x00\x68\x00\x69\x00\x6a\x00\x6b\x00\x6c\x00\x6d\x00\x6e\x00\x6f\x00\x70\x00\x71\x00\x72\x00\x73\x00\x74\x00\x75\x00\x76\x00\x77\x00\x78\x00\x79\x00\x7a\x00\xff\xff\x7c\x00\x21\x00\x7e\x00\x23\x00\x24\x00\x25\x00\x26\x00\x27\x00\xff\xff\xff\xff\x2a\x00\x2b\x00\x2c\x00\x2d\x00\x2e\x00\x2f\x00\x30\x00\x31\x00\x32\x00\x33\x00\x34\x00\x35\x00\x36\x00\x37\x00\x38\x00\x39\x00\x3a\x00\xff\xff\x3c\x00\x3d\x00\x3e\x00\x3f\x00\xff\xff\x41\x00\x42\x00\x43\x00\x44\x00\x45\x00\x46\x00\x47\x00\x48\x00\x49\x00\x4a\x00\x4b\x00\x4c\x00\x4d\x00\x4e\x00\x4f\x00\x50\x00\x51\x00\x52\x00\x53\x00\x54\x00\x55\x00\x56\x00\x57\x00\x58\x00\x59\x00\x5a\x00\x5b\x00\x5c\x00\x5d\x00\x5e\x00\x5f\x00\x60\x00\x61\x00\x62\x00\x63\x00\x64\x00\x65\x00\x66\x00\x67\x00\x68\x00\x69\x00\x6a\x00\x6b\x00\x6c\x00\x6d\x00\x6e\x00\x6f\x00\x70\x00\x71\x00\x72\x00\x73\x00\x74\x00\x75\x00\x76\x00\x77\x00\x78\x00\x79\x00\x7a\x00\xff\xff\x7c\x00\x21\x00\x7e\x00\x23\x00\x24\x00\x25\x00\x26\x00\x27\x00\xff\xff\xff\xff\x2a\x00\x2b\x00\x2c\x00\x2d\x00\x2e\x00\x2f\x00\x30\x00\x31\x00\x32\x00\x33\x00\x34\x00\x35\x00\x36\x00\x37\x00\x38\x00\x39\x00\x3a\x00\xff\xff\x3c\x00\x3d\x00\x3e\x00\x3f\x00\xff\xff\x41\x00\x42\x00\x43\x00\x44\x00\x45\x00\x46\x00\x47\x00\x48\x00\x49\x00\x4a\x00\x4b\x00\x4c\x00\x4d\x00\x4e\x00\x4f\x00\x50\x00\x51\x00\x52\x00\x53\x00\x54\x00\x55\x00\x56\x00\x57\x00\x58\x00\x59\x00\x5a\x00\x5b\x00\x5c\x00\x5d\x00\x5e\x00\x5f\x00\x60\x00\x61\x00\x62\x00\x63\x00\x64\x00\x65\x00\x66\x00\x67\x00\x68\x00\x69\x00\x6a\x00\x6b\x00\x6c\x00\x6d\x00\x6e\x00\x6f\x00\x70\x00\x71\x00\x72\x00\x73\x00\x74\x00\x75\x00\x76\x00\x77\x00\x78\x00\x79\x00\x7a\x00\xff\xff\x7c\x00\x21\x00\x7e\x00\x23\x00\x24\x00\x25\x00\x26\x00\x27\x00\xff\xff\xff\xff\x2a\x00\x2b\x00\x2c\x00\x2d\x00\x2e\x00\x2f\x00\x30\x00\x31\x00\x32\x00\x33\x00\x34\x00\x35\x00\x36\x00\x37\x00\x38\x00\x39\x00\x3a\x00\xff\xff\x3c\x00\x3d\x00\x3e\x00\x3f\x00\xff\xff\x41\x00\x42\x00\x43\x00\x44\x00\x45\x00\x46\x00\x47\x00\x48\x00\x49\x00\x4a\x00\x4b\x00\x4c\x00\x4d\x00\x4e\x00\x4f\x00\x50\x00\x51\x00\x52\x00\x53\x00\x54\x00\x55\x00\x56\x00\x57\x00\x58\x00\x59\x00\x5a\x00\x5b\x00\x5c\x00\x5d\x00\x5e\x00\x5f\x00\x60\x00\x61\x00\x62\x00\x63\x00\x64\x00\x65\x00\x66\x00\x67\x00\x68\x00\x69\x00\x6a\x00\x6b\x00\x6c\x00\x6d\x00\x6e\x00\x6f\x00\x70\x00\x71\x00\x72\x00\x73\x00\x74\x00\x75\x00\x76\x00\x77\x00\x78\x00\x79\x00\x7a\x00\xff\xff\x7c\x00\x21\x00\x7e\x00\x23\x00\x24\x00\x25\x00\x26\x00\x27\x00\xff\xff\xff\xff\x2a\x00\x2b\x00\x2c\x00\x2d\x00\x2e\x00\x2f\x00\x30\x00\x31\x00\x32\x00\x33\x00\x34\x00\x35\x00\x36\x00\x37\x00\x38\x00\x39\x00\x3a\x00\xff\xff\x3c\x00\x3d\x00\x3e\x00\x3f\x00\xff\xff\x41\x00\x42\x00\x43\x00\x44\x00\x45\x00\x46\x00\x47\x00\x48\x00\x49\x00\x4a\x00\x4b\x00\x4c\x00\x4d\x00\x4e\x00\x4f\x00\x50\x00\x51\x00\x52\x00\x53\x00\x54\x00\x55\x00\x56\x00\x57\x00\x58\x00\x59\x00\x5a\x00\x5b\x00\x5c\x00\x5d\x00\x5e\x00\x5f\x00\x60\x00\x61\x00\x62\x00\x63\x00\x64\x00\x65\x00\x66\x00\x67\x00\x68\x00\x69\x00\x6a\x00\x6b\x00\x6c\x00\x6d\x00\x6e\x00\x6f\x00\x70\x00\x71\x00\x72\x00\x73\x00\x74\x00\x75\x00\x76\x00\x77\x00\x78\x00\x79\x00\x7a\x00\xff\xff\x7c\x00\x21\x00\x7e\x00\x23\x00\x24\x00\x25\x00\x26\x00\x27\x00\xff\xff\xff\xff\x2a\x00\x2b\x00\x2c\x00\x2d\x00\x2e\x00\x2f\x00\x30\x00\x31\x00\x32\x00\x33\x00\x34\x00\x35\x00\x36\x00\x37\x00\x38\x00\x39\x00\x3a\x00\xff\xff\x3c\x00\x3d\x00\x3e\x00\x3f\x00\xff\xff\x41\x00\x42\x00\x43\x00\x44\x00\x45\x00\x46\x00\x47\x00\x48\x00\x49\x00\x4a\x00\x4b\x00\x4c\x00\x4d\x00\x4e\x00\x4f\x00\x50\x00\x51\x00\x52\x00\x53\x00\x54\x00\x55\x00\x56\x00\x57\x00\x58\x00\x59\x00\x5a\x00\x5b\x00\x5c\x00\x5d\x00\x5e\x00\x5f\x00\x60\x00\x61\x00\x62\x00\x63\x00\x64\x00\x65\x00\x66\x00\x67\x00\x68\x00\x69\x00\x6a\x00\x6b\x00\x6c\x00\x6d\x00\x6e\x00\x6f\x00\x70\x00\x71\x00\x72\x00\x73\x00\x74\x00\x75\x00\x76\x00\x77\x00\x78\x00\x79\x00\x7a\x00\xff\xff\x7c\x00\x21\x00\x7e\x00\x23\x00\x24\x00\x25\x00\x26\x00\x27\x00\xff\xff\xff\xff\x2a\x00\x2b\x00\x2c\x00\x2d\x00\x2e\x00\x2f\x00\x30\x00\x31\x00\x32\x00\x33\x00\x34\x00\x35\x00\x36\x00\x37\x00\x38\x00\x39\x00\x3a\x00\xff\xff\x3c\x00\x3d\x00\x3e\x00\x3f\x00\xff\xff\x41\x00\x42\x00\x43\x00\x44\x00\x45\x00\x46\x00\x47\x00\x48\x00\x49\x00\x4a\x00\x4b\x00\x4c\x00\x4d\x00\x4e\x00\x4f\x00\x50\x00\x51\x00\x52\x00\x53\x00\x54\x00\x55\x00\x56\x00\x57\x00\x58\x00\x59\x00\x5a\x00\x5b\x00\x5c\x00\x5d\x00\x5e\x00\x5f\x00\x60\x00\x61\x00\x62\x00\x63\x00\x64\x00\x65\x00\x66\x00\x67\x00\x68\x00\x69\x00\x6a\x00\x6b\x00\x6c\x00\x6d\x00\x6e\x00\x6f\x00\x70\x00\x71\x00\x72\x00\x73\x00\x74\x00\x75\x00\x76\x00\x77\x00\x78\x00\x79\x00\x7a\x00\xff\xff\x7c\x00\x21\x00\x7e\x00\x23\x00\x24\x00\x25\x00\x26\x00\x27\x00\xff\xff\xff\xff\x2a\x00\x2b\x00\x2c\x00\x2d\x00\x2e\x00\x2f\x00\x30\x00\x31\x00\x32\x00\x33\x00\x34\x00\x35\x00\x36\x00\x37\x00\x38\x00\x39\x00\x3a\x00\xff\xff\x3c\x00\x3d\x00\x3e\x00\x3f\x00\xff\xff\x41\x00\x42\x00\x43\x00\x44\x00\x45\x00\x46\x00\x47\x00\x48\x00\x49\x00\x4a\x00\x4b\x00\x4c\x00\x4d\x00\x4e\x00\x4f\x00\x50\x00\x51\x00\x52\x00\x53\x00\x54\x00\x55\x00\x56\x00\x57\x00\x58\x00\x59\x00\x5a\x00\x5b\x00\x5c\x00\x5d\x00\x5e\x00\x5f\x00\x60\x00\x61\x00\x62\x00\x63\x00\x64\x00\x65\x00\x66\x00\x67\x00\x68\x00\x69\x00\x6a\x00\x6b\x00\x6c\x00\x6d\x00\x6e\x00\x6f\x00\x70\x00\x71\x00\x72\x00\x73\x00\x74\x00\x75\x00\x76\x00\x77\x00\x78\x00\x79\x00\x7a\x00\xff\xff\x7c\x00\x21\x00\x7e\x00\x23\x00\x24\x00\x25\x00\x26\x00\x27\x00\xff\xff\xff\xff\x2a\x00\x2b\x00\x2c\x00\x2d\x00\x2e\x00\x2f\x00\x30\x00\x31\x00\x32\x00\x33\x00\x34\x00\x35\x00\x36\x00\x37\x00\x38\x00\x39\x00\x3a\x00\xff\xff\x3c\x00\x3d\x00\x3e\x00\x3f\x00\xff\xff\x41\x00\x42\x00\x43\x00\x44\x00\x45\x00\x46\x00\x47\x00\x48\x00\x49\x00\x4a\x00\x4b\x00\x4c\x00\x4d\x00\x4e\x00\x4f\x00\x50\x00\x51\x00\x52\x00\x53\x00\x54\x00\x55\x00\x56\x00\x57\x00\x58\x00\x59\x00\x5a\x00\x5b\x00\x5c\x00\x5d\x00\x5e\x00\x5f\x00\x60\x00\x61\x00\x62\x00\x63\x00\x64\x00\x65\x00\x66\x00\x67\x00\x68\x00\x69\x00\x6a\x00\x6b\x00\x6c\x00\x6d\x00\x6e\x00\x6f\x00\x70\x00\x71\x00\x72\x00\x73\x00\x74\x00\x75\x00\x76\x00\x77\x00\x78\x00\x79\x00\x7a\x00\xff\xff\x7c\x00\x21\x00\x7e\x00\x23\x00\x24\x00\x25\x00\x26\x00\x27\x00\xff\xff\xff\xff\x2a\x00\x2b\x00\x2c\x00\x2d\x00\x2e\x00\x2f\x00\x30\x00\x31\x00\x32\x00\x33\x00\x34\x00\x35\x00\x36\x00\x37\x00\x38\x00\x39\x00\x3a\x00\xff\xff\x3c\x00\x3d\x00\x3e\x00\x3f\x00\xff\xff\x41\x00\x42\x00\x43\x00\x44\x00\x45\x00\x46\x00\x47\x00\x48\x00\x49\x00\x4a\x00\x4b\x00\x4c\x00\x4d\x00\x4e\x00\x4f\x00\x50\x00\x51\x00\x52\x00\x53\x00\x54\x00\x55\x00\x56\x00\x57\x00\x58\x00\x59\x00\x5a\x00\x5b\x00\x5c\x00\x5d\x00\x5e\x00\x5f\x00\x60\x00\x61\x00\x62\x00\x63\x00\x64\x00\x65\x00\x66\x00\x67\x00\x68\x00\x69\x00\x6a\x00\x6b\x00\x6c\x00\x6d\x00\x6e\x00\x6f\x00\x70\x00\x71\x00\x72\x00\x73\x00\x74\x00\x75\x00\x76\x00\x77\x00\x78\x00\x79\x00\x7a\x00\xff\xff\x7c\x00\x21\x00\x7e\x00\x23\x00\x24\x00\x25\x00\x26\x00\x27\x00\xff\xff\xff\xff\x2a\x00\x2b\x00\x2c\x00\x2d\x00\x2e\x00\x2f\x00\x30\x00\x31\x00\x32\x00\x33\x00\x34\x00\x35\x00\x36\x00\x37\x00\x38\x00\x39\x00\x3a\x00\xff\xff\x3c\x00\x3d\x00\x3e\x00\x3f\x00\xff\xff\x41\x00\x42\x00\x43\x00\x44\x00\x45\x00\x46\x00\x47\x00\x48\x00\x49\x00\x4a\x00\x4b\x00\x4c\x00\x4d\x00\x4e\x00\x4f\x00\x50\x00\x51\x00\x52\x00\x53\x00\x54\x00\x55\x00\x56\x00\x57\x00\x58\x00\x59\x00\x5a\x00\x5b\x00\x5c\x00\x5d\x00\x5e\x00\x5f\x00\x60\x00\x61\x00\x62\x00\x63\x00\x64\x00\x65\x00\x66\x00\x67\x00\x68\x00\x69\x00\x6a\x00\x6b\x00\x6c\x00\x6d\x00\x6e\x00\x6f\x00\x70\x00\x71\x00\x72\x00\x73\x00\x74\x00\x75\x00\x76\x00\x77\x00\x78\x00\x79\x00\x7a\x00\xff\xff\x7c\x00\x21\x00\x7e\x00\x23\x00\x24\x00\x25\x00\x26\x00\x27\x00\xff\xff\xff\xff\x2a\x00\x2b\x00\x2c\x00\x2d\x00\x2e\x00\x2f\x00\x30\x00\x31\x00\x32\x00\x33\x00\x34\x00\x35\x00\x36\x00\x37\x00\x38\x00\x39\x00\x3a\x00\xff\xff\x3c\x00\x3d\x00\x3e\x00\x3f\x00\xff\xff\x41\x00\x42\x00\x43\x00\x44\x00\x45\x00\x46\x00\x47\x00\x48\x00\x49\x00\x4a\x00\x4b\x00\x4c\x00\x4d\x00\x4e\x00\x4f\x00\x50\x00\x51\x00\x52\x00\x53\x00\x54\x00\x55\x00\x56\x00\x57\x00\x58\x00\x59\x00\x5a\x00\x5b\x00\x5c\x00\x5d\x00\x5e\x00\x5f\x00\x60\x00\x61\x00\x62\x00\x63\x00\x64\x00\x65\x00\x66\x00\x67\x00\x68\x00\x69\x00\x6a\x00\x6b\x00\x6c\x00\x6d\x00\x6e\x00\x6f\x00\x70\x00\x71\x00\x72\x00\x73\x00\x74\x00\x75\x00\x76\x00\x77\x00\x78\x00\x79\x00\x7a\x00\xff\xff\x7c\x00\x21\x00\x7e\x00\x23\x00\x24\x00\x25\x00\x26\x00\x27\x00\xff\xff\xff\xff\x2a\x00\x2b\x00\x2c\x00\x2d\x00\x2e\x00\x2f\x00\x30\x00\x31\x00\x32\x00\x33\x00\x34\x00\x35\x00\x36\x00\x37\x00\x38\x00\x39\x00\x3a\x00\xff\xff\x3c\x00\x3d\x00\x3e\x00\x3f\x00\xff\xff\x41\x00\x42\x00\x43\x00\x44\x00\x45\x00\x46\x00\x47\x00\x48\x00\x49\x00\x4a\x00\x4b\x00\x4c\x00\x4d\x00\x4e\x00\x4f\x00\x50\x00\x51\x00\x52\x00\x53\x00\x54\x00\x55\x00\x56\x00\x57\x00\x58\x00\x59\x00\x5a\x00\x5b\x00\x5c\x00\x5d\x00\x5e\x00\x5f\x00\x60\x00\x61\x00\x62\x00\x63\x00\x64\x00\x65\x00\x66\x00\x67\x00\x68\x00\x69\x00\x6a\x00\x6b\x00\x6c\x00\x6d\x00\x6e\x00\x6f\x00\x70\x00\x71\x00\x72\x00\x73\x00\x74\x00\x75\x00\x76\x00\x77\x00\x78\x00\x79\x00\x7a\x00\xff\xff\x7c\x00\x21\x00\x7e\x00\x23\x00\x24\x00\x25\x00\x26\x00\x27\x00\xff\xff\xff\xff\x2a\x00\x2b\x00\x2c\x00\x2d\x00\x2e\x00\x2f\x00\x30\x00\x31\x00\x32\x00\x33\x00\x34\x00\x35\x00\x36\x00\x37\x00\x38\x00\x39\x00\x3a\x00\xff\xff\x3c\x00\x3d\x00\x3e\x00\x3f\x00\xff\xff\x41\x00\x42\x00\x43\x00\x44\x00\x45\x00\x46\x00\x47\x00\x48\x00\x49\x00\x4a\x00\x4b\x00\x4c\x00\x4d\x00\x4e\x00\x4f\x00\x50\x00\x51\x00\x52\x00\x53\x00\x54\x00\x55\x00\x56\x00\x57\x00\x58\x00\x59\x00\x5a\x00\x5b\x00\x5c\x00\x5d\x00\x5e\x00\x5f\x00\x60\x00\x61\x00\x62\x00\x63\x00\x64\x00\x65\x00\x66\x00\x67\x00\x68\x00\x69\x00\x6a\x00\x6b\x00\x6c\x00\x6d\x00\x6e\x00\x6f\x00\x70\x00\x71\x00\x72\x00\x73\x00\x74\x00\x75\x00\x76\x00\x77\x00\x78\x00\x79\x00\x7a\x00\xff\xff\x7c\x00\x21\x00\x7e\x00\x23\x00\x24\x00\x25\x00\x26\x00\x27\x00\xff\xff\xff\xff\x2a\x00\x2b\x00\x2c\x00\x2d\x00\x2e\x00\x2f\x00\x30\x00\x31\x00\x32\x00\x33\x00\x34\x00\x35\x00\x36\x00\x37\x00\x38\x00\x39\x00\x3a\x00\xff\xff\x3c\x00\x3d\x00\x3e\x00\x3f\x00\xff\xff\x41\x00\x42\x00\x43\x00\x44\x00\x45\x00\x46\x00\x47\x00\x48\x00\x49\x00\x4a\x00\x4b\x00\x4c\x00\x4d\x00\x4e\x00\x4f\x00\x50\x00\x51\x00\x52\x00\x53\x00\x54\x00\x55\x00\x56\x00\x57\x00\x58\x00\x59\x00\x5a\x00\x5b\x00\x5c\x00\x5d\x00\x5e\x00\x5f\x00\x60\x00\x61\x00\x62\x00\x63\x00\x64\x00\x65\x00\x66\x00\x67\x00\x68\x00\x69\x00\x6a\x00\x6b\x00\x6c\x00\x6d\x00\x6e\x00\x6f\x00\x70\x00\x71\x00\x72\x00\x73\x00\x74\x00\x75\x00\x76\x00\x77\x00\x78\x00\x79\x00\x7a\x00\xff\xff\x7c\x00\x21\x00\x7e\x00\x23\x00\x24\x00\x25\x00\x26\x00\x27\x00\xff\xff\xff\xff\x2a\x00\x2b\x00\x2c\x00\x2d\x00\x2e\x00\x2f\x00\x30\x00\x31\x00\x32\x00\x33\x00\x34\x00\x35\x00\x36\x00\x37\x00\x38\x00\x39\x00\x3a\x00\xff\xff\x3c\x00\x3d\x00\x3e\x00\x3f\x00\xff\xff\x41\x00\x42\x00\x43\x00\x44\x00\x45\x00\x46\x00\x47\x00\x48\x00\x49\x00\x4a\x00\x4b\x00\x4c\x00\x4d\x00\x4e\x00\x4f\x00\x50\x00\x51\x00\x52\x00\x53\x00\x54\x00\x55\x00\x56\x00\x57\x00\x58\x00\x59\x00\x5a\x00\x5b\x00\x5c\x00\x5d\x00\x5e\x00\x5f\x00\x60\x00\x61\x00\x62\x00\x63\x00\x64\x00\x65\x00\x66\x00\x67\x00\x68\x00\x69\x00\x6a\x00\x6b\x00\x6c\x00\x6d\x00\x6e\x00\x6f\x00\x70\x00\x71\x00\x72\x00\x73\x00\x74\x00\x75\x00\x76\x00\x77\x00\x78\x00\x79\x00\x7a\x00\xff\xff\x7c\x00\x21\x00\x7e\x00\x23\x00\x24\x00\x25\x00\x26\x00\x27\x00\xff\xff\xff\xff\x2a\x00\x2b\x00\x2c\x00\x2d\x00\x2e\x00\x2f\x00\x30\x00\x31\x00\x32\x00\x33\x00\x34\x00\x35\x00\x36\x00\x37\x00\x38\x00\x39\x00\x3a\x00\xff\xff\x3c\x00\x3d\x00\x3e\x00\x3f\x00\xff\xff\x41\x00\x42\x00\x43\x00\x44\x00\x45\x00\x46\x00\x47\x00\x48\x00\x49\x00\x4a\x00\x4b\x00\x4c\x00\x4d\x00\x4e\x00\x4f\x00\x50\x00\x51\x00\x52\x00\x53\x00\x54\x00\x55\x00\x56\x00\x57\x00\x58\x00\x59\x00\x5a\x00\x5b\x00\x5c\x00\x5d\x00\x5e\x00\x5f\x00\x60\x00\x61\x00\x62\x00\x63\x00\x64\x00\x65\x00\x66\x00\x67\x00\x68\x00\x69\x00\x6a\x00\x6b\x00\x6c\x00\x6d\x00\x6e\x00\x6f\x00\x70\x00\x71\x00\x72\x00\x73\x00\x74\x00\x75\x00\x76\x00\x77\x00\x78\x00\x79\x00\x7a\x00\xff\xff\x7c\x00\x21\x00\x7e\x00\x23\x00\x24\x00\x25\x00\x26\x00\x27\x00\xff\xff\xff\xff\x2a\x00\x2b\x00\x2c\x00\x2d\x00\x2e\x00\x2f\x00\x30\x00\x31\x00\x32\x00\x33\x00\x34\x00\x35\x00\x36\x00\x37\x00\x38\x00\x39\x00\x3a\x00\xff\xff\x3c\x00\x3d\x00\x3e\x00\x3f\x00\xff\xff\x41\x00\x42\x00\x43\x00\x44\x00\x45\x00\x46\x00\x47\x00\x48\x00\x49\x00\x4a\x00\x4b\x00\x4c\x00\x4d\x00\x4e\x00\x4f\x00\x50\x00\x51\x00\x52\x00\x53\x00\x54\x00\x55\x00\x56\x00\x57\x00\x58\x00\x59\x00\x5a\x00\x5b\x00\x5c\x00\x5d\x00\x5e\x00\x5f\x00\x60\x00\x61\x00\x62\x00\x63\x00\x64\x00\x65\x00\x66\x00\x67\x00\x68\x00\x69\x00\x6a\x00\x6b\x00\x6c\x00\x6d\x00\x6e\x00\x6f\x00\x70\x00\x71\x00\x72\x00\x73\x00\x74\x00\x75\x00\x76\x00\x77\x00\x78\x00\x79\x00\x7a\x00\xff\xff\x7c\x00\x21\x00\x7e\x00\x23\x00\x24\x00\x25\x00\x26\x00\x27\x00\xff\xff\xff\xff\x2a\x00\x2b\x00\x2c\x00\x2d\x00\x2e\x00\x2f\x00\x30\x00\x31\x00\x32\x00\x33\x00\x34\x00\x35\x00\x36\x00\x37\x00\x38\x00\x39\x00\x3a\x00\xff\xff\x3c\x00\x3d\x00\x3e\x00\x3f\x00\xff\xff\x41\x00\x42\x00\x43\x00\x44\x00\x45\x00\x46\x00\x47\x00\x48\x00\x49\x00\x4a\x00\x4b\x00\x4c\x00\x4d\x00\x4e\x00\x4f\x00\x50\x00\x51\x00\x52\x00\x53\x00\x54\x00\x55\x00\x56\x00\x57\x00\x58\x00\x59\x00\x5a\x00\x5b\x00\x5c\x00\x5d\x00\x5e\x00\x5f\x00\x60\x00\x61\x00\x62\x00\x63\x00\x64\x00\x65\x00\x66\x00\x67\x00\x68\x00\x69\x00\x6a\x00\x6b\x00\x6c\x00\x6d\x00\x6e\x00\x6f\x00\x70\x00\x71\x00\x72\x00\x73\x00\x74\x00\x75\x00\x76\x00\x77\x00\x78\x00\x79\x00\x7a\x00\xff\xff\x7c\x00\x21\x00\x7e\x00\x23\x00\x24\x00\x25\x00\x26\x00\x27\x00\xff\xff\xff\xff\x2a\x00\x2b\x00\x2c\x00\x2d\x00\x2e\x00\x2f\x00\x30\x00\x31\x00\x32\x00\x33\x00\x34\x00\x35\x00\x36\x00\x37\x00\x38\x00\x39\x00\x3a\x00\xff\xff\x3c\x00\x3d\x00\x3e\x00\x3f\x00\xff\xff\x41\x00\x42\x00\x43\x00\x44\x00\x45\x00\x46\x00\x47\x00\x48\x00\x49\x00\x4a\x00\x4b\x00\x4c\x00\x4d\x00\x4e\x00\x4f\x00\x50\x00\x51\x00\x52\x00\x53\x00\x54\x00\x55\x00\x56\x00\x57\x00\x58\x00\x59\x00\x5a\x00\x5b\x00\x5c\x00\x5d\x00\x5e\x00\x5f\x00\x60\x00\x61\x00\x62\x00\x63\x00\x64\x00\x65\x00\x66\x00\x67\x00\x68\x00\x69\x00\x6a\x00\x6b\x00\x6c\x00\x6d\x00\x6e\x00\x6f\x00\x70\x00\x71\x00\x72\x00\x73\x00\x74\x00\x75\x00\x76\x00\x77\x00\x78\x00\x79\x00\x7a\x00\xff\xff\x7c\x00\x21\x00\x7e\x00\x23\x00\x24\x00\x25\x00\x26\x00\x27\x00\xff\xff\xff\xff\x2a\x00\x2b\x00\x2c\x00\x2d\x00\x2e\x00\x2f\x00\x30\x00\x31\x00\x32\x00\x33\x00\x34\x00\x35\x00\x36\x00\x37\x00\x38\x00\x39\x00\x3a\x00\xff\xff\x3c\x00\x3d\x00\x3e\x00\x3f\x00\xff\xff\x41\x00\x42\x00\x43\x00\x44\x00\x45\x00\x46\x00\x47\x00\x48\x00\x49\x00\x4a\x00\x4b\x00\x4c\x00\x4d\x00\x4e\x00\x4f\x00\x50\x00\x51\x00\x52\x00\x53\x00\x54\x00\x55\x00\x56\x00\x57\x00\x58\x00\x59\x00\x5a\x00\x5b\x00\x5c\x00\x5d\x00\x5e\x00\x5f\x00\x60\x00\x61\x00\x62\x00\x63\x00\x64\x00\x65\x00\x66\x00\x67\x00\x68\x00\x69\x00\x6a\x00\x6b\x00\x6c\x00\x6d\x00\x6e\x00\x6f\x00\x70\x00\x71\x00\x72\x00\x73\x00\x74\x00\x75\x00\x76\x00\x77\x00\x78\x00\x79\x00\x7a\x00\xff\xff\x7c\x00\x21\x00\x7e\x00\x23\x00\x24\x00\x25\x00\x26\x00\x27\x00\xff\xff\xff\xff\x2a\x00\x2b\x00\x2c\x00\x2d\x00\x2e\x00\x2f\x00\x30\x00\x31\x00\x32\x00\x33\x00\x34\x00\x35\x00\x36\x00\x37\x00\x38\x00\x39\x00\x3a\x00\xff\xff\x3c\x00\x3d\x00\x3e\x00\x3f\x00\xff\xff\x41\x00\x42\x00\x43\x00\x44\x00\x45\x00\x46\x00\x47\x00\x48\x00\x49\x00\x4a\x00\x4b\x00\x4c\x00\x4d\x00\x4e\x00\x4f\x00\x50\x00\x51\x00\x52\x00\x53\x00\x54\x00\x55\x00\x56\x00\x57\x00\x58\x00\x59\x00\x5a\x00\x5b\x00\x5c\x00\x5d\x00\x5e\x00\x5f\x00\x60\x00\x61\x00\x62\x00\x63\x00\x64\x00\x65\x00\x66\x00\x67\x00\x68\x00\x69\x00\x6a\x00\x6b\x00\x6c\x00\x6d\x00\x6e\x00\x6f\x00\x70\x00\x71\x00\x72\x00\x73\x00\x74\x00\x75\x00\x76\x00\x77\x00\x78\x00\x79\x00\x7a\x00\xff\xff\x7c\x00\x21\x00\x7e\x00\x23\x00\x24\x00\x25\x00\x26\x00\x27\x00\xff\xff\xff\xff\x2a\x00\x2b\x00\x2c\x00\x2d\x00\x2e\x00\x2f\x00\x30\x00\x31\x00\x32\x00\x33\x00\x34\x00\x35\x00\x36\x00\x37\x00\x38\x00\x39\x00\x3a\x00\xff\xff\x3c\x00\x3d\x00\x3e\x00\x3f\x00\xff\xff\x41\x00\x42\x00\x43\x00\x44\x00\x45\x00\x46\x00\x47\x00\x48\x00\x49\x00\x4a\x00\x4b\x00\x4c\x00\x4d\x00\x4e\x00\x4f\x00\x50\x00\x51\x00\x52\x00\x53\x00\x54\x00\x55\x00\x56\x00\x57\x00\x58\x00\x59\x00\x5a\x00\x5b\x00\x5c\x00\x5d\x00\x5e\x00\x5f\x00\x60\x00\x61\x00\x62\x00\x63\x00\x64\x00\x65\x00\x66\x00\x67\x00\x68\x00\x69\x00\x6a\x00\x6b\x00\x6c\x00\x6d\x00\x6e\x00\x6f\x00\x70\x00\x71\x00\x72\x00\x73\x00\x74\x00\x75\x00\x76\x00\x77\x00\x78\x00\x79\x00\x7a\x00\xff\xff\x7c\x00\x21\x00\x7e\x00\x23\x00\x24\x00\x25\x00\x26\x00\x27\x00\xff\xff\xff\xff\x2a\x00\x2b\x00\x2c\x00\x2d\x00\x2e\x00\x2f\x00\x30\x00\x31\x00\x32\x00\x33\x00\x34\x00\x35\x00\x36\x00\x37\x00\x38\x00\x39\x00\x3a\x00\xff\xff\x3c\x00\x3d\x00\x3e\x00\x3f\x00\xff\xff\x41\x00\x42\x00\x43\x00\x44\x00\x45\x00\x46\x00\x47\x00\x48\x00\x49\x00\x4a\x00\x4b\x00\x4c\x00\x4d\x00\x4e\x00\x4f\x00\x50\x00\x51\x00\x52\x00\x53\x00\x54\x00\x55\x00\x56\x00\x57\x00\x58\x00\x59\x00\x5a\x00\x5b\x00\x5c\x00\x5d\x00\x5e\x00\x5f\x00\x60\x00\x61\x00\x62\x00\x63\x00\x64\x00\x65\x00\x66\x00\x67\x00\x68\x00\x69\x00\x6a\x00\x6b\x00\x6c\x00\x6d\x00\x6e\x00\x6f\x00\x70\x00\x71\x00\x72\x00\x73\x00\x74\x00\x75\x00\x76\x00\x77\x00\x78\x00\x79\x00\x7a\x00\xff\xff\x7c\x00\xff\xff\x7e\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff"# alex_deflt :: AlexAddr alex_deflt = AlexA# "\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xae\x00\x4d\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x2c\x00\x2c\x00\x2e\x00\x2e\x00\xff\xff\x30\x00\x30\x00\x32\x00\x32\x00\x37\x00\x37\x00\x3a\x00\x3a\x00\x3d\x00\x3d\x00\x42\x00\x42\x00\xff\xff\xe2\x00\xe2\x00\xe2\x00\xae\x00\xae\x00\xae\x00\x4d\x00\x4d\x00\x4d\x00\x43\x00\xff\xff\x43\x00\x43\x00\x43\x00\xff\xff\x4d\x00\x4d\x00\x4d\x00\x4d\x00\x4d\x00\x4d\x00\x4d\x00\x4d\x00\x4d\x00\x4d\x00\x4d\x00\x4d\x00\x4d\x00\x4d\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xae\x00\xae\x00\xae\x00\xae\x00\xae\x00\xae\x00\xae\x00\xae\x00\xae\x00\xae\x00\xae\x00\xae\x00\xae\x00\xae\x00\xae\x00\xae\x00\xae\x00\xae\x00\xae\x00\xae\x00\xae\x00\xae\x00\xae\x00\xae\x00\xae\x00\xae\x00\xae\x00\xae\x00\xae\x00\xae\x00\xae\x00\xae\x00\xae\x00\xae\x00\xae\x00\xae\x00\xae\x00\xae\x00\xae\x00\xae\x00\xae\x00\xae\x00\xae\x00\xae\x00\xae\x00\xae\x00\xae\x00\xae\x00\xae\x00\xae\x00\xae\x00\xae\x00\xae\x00\xae\x00\xae\x00\xae\x00\xae\x00\xae\x00\xae\x00\xae\x00\xae\x00\xae\x00\xae\x00\xae\x00\xae\x00\xae\x00\xae\x00\xae\x00\xae\x00\xae\x00\xae\x00\xae\x00\xae\x00\xae\x00\xae\x00\xae\x00\xae\x00\xae\x00\xae\x00\xae\x00\xae\x00\xae\x00\xae\x00\xae\x00\xae\x00\xae\x00\xae\x00\xae\x00\xae\x00\xae\x00\xae\x00\xae\x00\xae\x00\xae\x00\xae\x00\xae\x00\xae\x00\xae\x00\xae\x00\xae\x00\xae\x00\xae\x00\xae\x00\xae\x00\xae\x00\xae\x00\xae\x00\xae\x00\xae\x00\xae\x00\xae\x00\xae\x00\xae\x00\xae\x00\xae\x00\xae\x00\xae\x00\xae\x00\xae\x00\xae\x00\xae\x00\xae\x00\xae\x00\xae\x00\xae\x00\xae\x00\xae\x00\xae\x00\xae\x00\xae\x00\xae\x00\xae\x00\xff\xff\xff\xff\xff\xff\xff\xff\xe2\x00\xe1\x00\xe1\x00\xe2\x00\xe8\x00\xe2\x00\xe8\x00\xe7\x00\xe7\x00\xe8\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff"# alex_accept = listArray (0::Int,497) [AlexAccNone,AlexAccPred (alex_action_37) ( not' eof )(AlexAccNone),AlexAccNone,AlexAcc (alex_action_40),AlexAccNone,AlexAcc (alex_action_39),AlexAccNone,AlexAccPred (alex_action_4) ( eof )(AlexAccNone),AlexAccNone,AlexAccNone,AlexAccNone,AlexAccNone,AlexAccNone,AlexAccNone,AlexAccNone,AlexAccNone,AlexAccNone,AlexAccNone,AlexAccNone,AlexAccNone,AlexAccNone,AlexAccNone,AlexAccNone,AlexAccNone,AlexAccNone,AlexAccNone,AlexAccNone,AlexAccNone,AlexAccNone,AlexAccNone,AlexAccNone,AlexAccNone,AlexAccNone,AlexAccNone,AlexAccNone,AlexAccNone,AlexAccNone,AlexAccNone,AlexAccNone,AlexAccNone,AlexAccNone,AlexAccNone,AlexAccNone,AlexAccNone,AlexAccNone,AlexAccNone,AlexAccNone,AlexAccNone,AlexAccNone,AlexAccNone,AlexAccNone,AlexAccNone,AlexAccNone,AlexAccNone,AlexAccNone,AlexAccNone,AlexAccNone,AlexAccNone,AlexAccNone,AlexAccNone,AlexAccNone,AlexAccNone,AlexAccNone,AlexAccNone,AlexAccNone,AlexAccNone,AlexAccNone,AlexAccSkip,AlexAccPred (alex_action_0) (alexRightContext 63)(AlexAccPred (alex_action_1) ( keepComments )(AlexAccSkip)),AlexAccPred (alex_action_1) ( keepComments )(AlexAccSkip),AlexAccPred (alex_action_1) ( keepComments )(AlexAccSkip),AlexAccPred (alex_action_1) ( keepComments )(AlexAccSkip),AlexAccPred (alex_action_1) ( keepComments )(AlexAccSkip),AlexAccPred (alex_action_1) ( keepComments )(AlexAccSkip),AlexAccPred (alex_action_1) ( keepComments )(AlexAccSkip),AlexAccPred (alex_action_1) ( keepComments )(AlexAccSkip),AlexAccPred (alex_action_1) ( keepComments )(AlexAccSkip),AlexAccPred (alex_action_1) ( keepComments )(AlexAccSkip),AlexAccPred (alex_action_1) ( keepComments )(AlexAccSkip),AlexAccPred (alex_action_1) ( keepComments )(AlexAccSkip),AlexAccPred (alex_action_1) ( keepComments )(AlexAccSkip),AlexAccPred (alex_action_1) ( keepComments )(AlexAccSkip),AlexAccSkip,AlexAccPred (alex_action_5) ( inState code )(AlexAccNone),AlexAccSkip,AlexAccSkip,AlexAcc (alex_action_8),AlexAcc (alex_action_9),AlexAcc (alex_action_10),AlexAcc (alex_action_11),AlexAcc (alex_action_12),AlexAcc (alex_action_13),AlexAcc (alex_action_14),AlexAcc (alex_action_15),AlexAcc (alex_action_16),AlexAcc (alex_action_17),AlexAcc (alex_action_18),AlexAcc (alex_action_19),AlexAcc (alex_action_20),AlexAcc (alex_action_21),AlexAcc (alex_action_22),AlexAcc (alex_action_23),AlexAcc (alex_action_24),AlexAcc (alex_action_25),AlexAcc (alex_action_26),AlexAcc (alex_action_27),AlexAcc (alex_action_28),AlexAcc (alex_action_29),AlexAcc (alex_action_29),AlexAcc (alex_action_29),AlexAcc (alex_action_29),AlexAcc (alex_action_29),AlexAcc (alex_action_29),AlexAcc (alex_action_29),AlexAcc (alex_action_29),AlexAcc (alex_action_29),AlexAcc (alex_action_29),AlexAcc (alex_action_29),AlexAcc (alex_action_29),AlexAcc (alex_action_29),AlexAcc (alex_action_29),AlexAcc (alex_action_29),AlexAcc (alex_action_29),AlexAcc (alex_action_29),AlexAcc (alex_action_29),AlexAcc (alex_action_29),AlexAcc (alex_action_29),AlexAcc (alex_action_29),AlexAcc (alex_action_29),AlexAcc (alex_action_29),AlexAcc (alex_action_29),AlexAcc (alex_action_29),AlexAcc (alex_action_29),AlexAcc (alex_action_29),AlexAcc (alex_action_29),AlexAcc (alex_action_29),AlexAcc (alex_action_29),AlexAcc (alex_action_29),AlexAcc (alex_action_29),AlexAcc (alex_action_29),AlexAcc (alex_action_29),AlexAcc (alex_action_29),AlexAcc (alex_action_29),AlexAcc (alex_action_29),AlexAcc (alex_action_29),AlexAcc (alex_action_29),AlexAcc (alex_action_29),AlexAcc (alex_action_29),AlexAcc (alex_action_29),AlexAcc (alex_action_29),AlexAcc (alex_action_29),AlexAcc (alex_action_29),AlexAcc (alex_action_29),AlexAcc (alex_action_29),AlexAcc (alex_action_29),AlexAcc (alex_action_29),AlexAcc (alex_action_29),AlexAcc (alex_action_29),AlexAcc (alex_action_29),AlexAcc (alex_action_29),AlexAcc (alex_action_29),AlexAcc (alex_action_29),AlexAcc (alex_action_29),AlexAcc (alex_action_29),AlexAcc (alex_action_29),AlexAcc (alex_action_29),AlexAcc (alex_action_29),AlexAcc (alex_action_29),AlexAcc (alex_action_29),AlexAcc (alex_action_29),AlexAcc (alex_action_29),AlexAcc (alex_action_29),AlexAcc (alex_action_29),AlexAcc (alex_action_29),AlexAcc (alex_action_29),AlexAcc (alex_action_29),AlexAcc (alex_action_29),AlexAcc (alex_action_29),AlexAcc (alex_action_29),AlexAcc (alex_action_29),AlexAcc (alex_action_29),AlexAcc (alex_action_29),AlexAcc (alex_action_29),AlexAcc (alex_action_29),AlexAcc (alex_action_29),AlexAcc (alex_action_29),AlexAcc (alex_action_29),AlexAcc (alex_action_29),AlexAcc (alex_action_29),AlexAcc (alex_action_29),AlexAcc (alex_action_29),AlexAcc (alex_action_29),AlexAcc (alex_action_29),AlexAcc (alex_action_29),AlexAcc (alex_action_29),AlexAcc (alex_action_29),AlexAcc (alex_action_29),AlexAcc (alex_action_29),AlexAcc (alex_action_29),AlexAcc (alex_action_29),AlexAcc (alex_action_29),AlexAcc (alex_action_29),AlexAcc (alex_action_29),AlexAcc (alex_action_29),AlexAcc (alex_action_29),AlexAcc (alex_action_29),AlexAcc (alex_action_29),AlexAcc (alex_action_29),AlexAcc (alex_action_29),AlexAcc (alex_action_29),AlexAcc (alex_action_29),AlexAcc (alex_action_29),AlexAcc (alex_action_29),AlexAcc (alex_action_29),AlexAcc (alex_action_29),AlexAcc (alex_action_29),AlexAcc (alex_action_29),AlexAcc (alex_action_29),AlexAcc (alex_action_29),AlexAccPred (alex_action_30) ( not' (followedBy '#') )(AlexAccNone),AlexAccPred (alex_action_30) ( not' (followedBy '#') )(AlexAccNone),AlexAcc (alex_action_31),AlexAcc (alex_action_32),AlexAcc (alex_action_32),AlexAccPred (alex_action_33) ( keepComments .&&. (followedBy '\n' .||. eof) )(AlexAccSkipPred ( followedBy '\n' .||. eof )(AlexAccNone)),AlexAccPred (alex_action_33) ( keepComments .&&. (followedBy '\n' .||. eof) )(AlexAccSkipPred ( followedBy '\n' .||. eof )(AlexAccNone)),AlexAccPred (alex_action_33) ( keepComments .&&. (followedBy '\n' .||. eof) )(AlexAccSkipPred ( followedBy '\n' .||. eof )(AlexAccNone)),AlexAccPred (alex_action_33) ( keepComments .&&. (followedBy '\n' .||. eof) )(AlexAccSkipPred ( followedBy '\n' .||. eof )(AlexAccNone)),AlexAccPred (alex_action_33) ( keepComments .&&. (followedBy '\n' .||. eof) )(AlexAccSkipPred ( followedBy '\n' .||. eof )(AlexAccNone)),AlexAccPred (alex_action_33) ( keepComments .&&. (followedBy '\n' .||. eof) )(AlexAccSkipPred ( followedBy '\n' .||. eof )(AlexAccNone)),AlexAccPred (alex_action_33) ( keepComments .&&. (followedBy '\n' .||. eof) )(AlexAccSkipPred ( followedBy '\n' .||. eof )(AlexAcc (alex_action_105))),AlexAccPred (alex_action_33) ( keepComments .&&. (followedBy '\n' .||. eof) )(AlexAccSkipPred ( followedBy '\n' .||. eof )(AlexAcc (alex_action_105))),AlexAccPred (alex_action_33) ( keepComments .&&. (followedBy '\n' .||. eof) )(AlexAccSkipPred ( followedBy '\n' .||. eof )(AlexAcc (alex_action_105))),AlexAcc (alex_action_35),AlexAccSkip,AlexAccSkip,AlexAcc (alex_action_41),AlexAcc (alex_action_42),AlexAcc (alex_action_43),AlexAcc (alex_action_44),AlexAcc (alex_action_45),AlexAcc (alex_action_46),AlexAcc (alex_action_47),AlexAcc (alex_action_48),AlexAcc (alex_action_49),AlexAcc (alex_action_50),AlexAcc (alex_action_51),AlexAcc (alex_action_52),AlexAcc (alex_action_53),AlexAcc (alex_action_54),AlexAcc (alex_action_55),AlexAcc (alex_action_56),AlexAcc (alex_action_57),AlexAcc (alex_action_58),AlexAcc (alex_action_59),AlexAcc (alex_action_60),AlexAcc (alex_action_61),AlexAcc (alex_action_62),AlexAcc (alex_action_63),AlexAcc (alex_action_64),AlexAcc (alex_action_65),AlexAcc (alex_action_66),AlexAcc (alex_action_67),AlexAcc (alex_action_68),AlexAcc (alex_action_68),AlexAcc (alex_action_68),AlexAcc (alex_action_69),AlexAcc (alex_action_70),AlexAcc (alex_action_71),AlexAcc (alex_action_72),AlexAcc (alex_action_73),AlexAcc (alex_action_74),AlexAcc (alex_action_75),AlexAcc (alex_action_76),AlexAcc (alex_action_77),AlexAcc (alex_action_78),AlexAcc (alex_action_79),AlexAcc (alex_action_80),AlexAcc (alex_action_81),AlexAcc (alex_action_82),AlexAcc (alex_action_83),AlexAcc (alex_action_84),AlexAcc (alex_action_85),AlexAcc (alex_action_86),AlexAcc (alex_action_87),AlexAcc (alex_action_88),AlexAcc (alex_action_89),AlexAcc (alex_action_90),AlexAcc (alex_action_91),AlexAcc (alex_action_92),AlexAcc (alex_action_93),AlexAcc (alex_action_94),AlexAcc (alex_action_95),AlexAcc (alex_action_96),AlexAcc (alex_action_97),AlexAccPred (alex_action_98) (alexRightContext 64)(AlexAccNone),AlexAcc (alex_action_99),AlexAcc (alex_action_100),AlexAcc (alex_action_101),AlexAcc (alex_action_102),AlexAcc (alex_action_103),AlexAcc (alex_action_103),AlexAcc (alex_action_103),AlexAcc (alex_action_103),AlexAcc (alex_action_103),AlexAcc (alex_action_104),AlexAcc (alex_action_104),AlexAcc (alex_action_104),AlexAcc (alex_action_104),AlexAcc (alex_action_104),AlexAcc (alex_action_104),AlexAcc (alex_action_104),AlexAcc (alex_action_104),AlexAcc (alex_action_104),AlexAcc (alex_action_104),AlexAcc (alex_action_104),AlexAcc (alex_action_105),AlexAcc (alex_action_105),AlexAcc (alex_action_105),AlexAcc (alex_action_105),AlexAcc (alex_action_105),AlexAcc (alex_action_105),AlexAcc (alex_action_105),AlexAcc (alex_action_105),AlexAcc (alex_action_105),AlexAcc (alex_action_105),AlexAcc (alex_action_105),AlexAcc (alex_action_105),AlexAcc (alex_action_105),AlexAcc (alex_action_105),AlexAcc (alex_action_105),AlexAcc (alex_action_105),AlexAcc (alex_action_105),AlexAcc (alex_action_105),AlexAcc (alex_action_105),AlexAcc (alex_action_105),AlexAcc (alex_action_105),AlexAcc (alex_action_105),AlexAcc (alex_action_105),AlexAcc (alex_action_105),AlexAcc (alex_action_105),AlexAcc (alex_action_105),AlexAcc (alex_action_105),AlexAcc (alex_action_105),AlexAcc (alex_action_105),AlexAcc (alex_action_105),AlexAcc (alex_action_105),AlexAcc (alex_action_105),AlexAcc (alex_action_105),AlexAcc (alex_action_105),AlexAcc (alex_action_105),AlexAcc (alex_action_105),AlexAcc (alex_action_105),AlexAcc (alex_action_105),AlexAcc (alex_action_105),AlexAcc (alex_action_105),AlexAcc (alex_action_105),AlexAcc (alex_action_105),AlexAcc (alex_action_105),AlexAcc (alex_action_105),AlexAcc (alex_action_105),AlexAcc (alex_action_105),AlexAcc (alex_action_105),AlexAcc (alex_action_105),AlexAcc (alex_action_105),AlexAcc (alex_action_105),AlexAcc (alex_action_105),AlexAcc (alex_action_105),AlexAcc (alex_action_105),AlexAcc (alex_action_105),AlexAcc (alex_action_105),AlexAcc (alex_action_105),AlexAcc (alex_action_105),AlexAcc (alex_action_105),AlexAcc (alex_action_105),AlexAcc (alex_action_105),AlexAcc (alex_action_105),AlexAcc (alex_action_105),AlexAcc (alex_action_105),AlexAcc (alex_action_105),AlexAcc (alex_action_105),AlexAcc (alex_action_105),AlexAcc (alex_action_105),AlexAcc (alex_action_105),AlexAcc (alex_action_105),AlexAcc (alex_action_105),AlexAcc (alex_action_105),AlexAcc (alex_action_105),AlexAcc (alex_action_105),AlexAcc (alex_action_105),AlexAcc (alex_action_105),AlexAcc (alex_action_105),AlexAcc (alex_action_105),AlexAcc (alex_action_105),AlexAcc (alex_action_105),AlexAcc (alex_action_105),AlexAcc (alex_action_105),AlexAcc (alex_action_105),AlexAcc (alex_action_105),AlexAcc (alex_action_105),AlexAcc (alex_action_105),AlexAcc (alex_action_105),AlexAcc (alex_action_105),AlexAcc (alex_action_105),AlexAcc (alex_action_105),AlexAcc (alex_action_105),AlexAcc (alex_action_105),AlexAcc (alex_action_105),AlexAcc (alex_action_105),AlexAcc (alex_action_105),AlexAcc (alex_action_105),AlexAcc (alex_action_105),AlexAcc (alex_action_105),AlexAcc (alex_action_105),AlexAcc (alex_action_105),AlexAcc (alex_action_105),AlexAcc (alex_action_105),AlexAcc (alex_action_105),AlexAcc (alex_action_105),AlexAcc (alex_action_105),AlexAcc (alex_action_105),AlexAcc (alex_action_105),AlexAcc (alex_action_105),AlexAcc (alex_action_105),AlexAcc (alex_action_105),AlexAcc (alex_action_105),AlexAcc (alex_action_105),AlexAcc (alex_action_105),AlexAcc (alex_action_105),AlexAcc (alex_action_105),AlexAcc (alex_action_105),AlexAcc (alex_action_105),AlexAcc (alex_action_105),AlexAcc (alex_action_105),AlexAcc (alex_action_105),AlexAcc (alex_action_105),AlexAcc (alex_action_105),AlexAcc (alex_action_105),AlexAcc (alex_action_105),AlexAcc (alex_action_105),AlexAcc (alex_action_105),AlexAcc (alex_action_105),AlexAcc (alex_action_105),AlexAcc (alex_action_105),AlexAcc (alex_action_105),AlexAcc (alex_action_105),AlexAcc (alex_action_105),AlexAcc (alex_action_105),AlexAcc (alex_action_105),AlexAcc (alex_action_105),AlexAcc (alex_action_105),AlexAcc (alex_action_105),AlexAcc (alex_action_105),AlexAcc (alex_action_105),AlexAcc (alex_action_105),AlexAcc (alex_action_105),AlexAcc (alex_action_105),AlexAcc (alex_action_105),AlexAcc (alex_action_105),AlexAcc (alex_action_105),AlexAcc (alex_action_105),AlexAcc (alex_action_105),AlexAcc (alex_action_105),AlexAcc (alex_action_105),AlexAcc (alex_action_105),AlexAcc (alex_action_105),AlexAcc (alex_action_105),AlexAcc (alex_action_105),AlexAcc (alex_action_105),AlexAcc (alex_action_105),AlexAcc (alex_action_105),AlexAcc (alex_action_105),AlexAcc (alex_action_105),AlexAcc (alex_action_105),AlexAcc (alex_action_105),AlexAcc (alex_action_105),AlexAcc (alex_action_105),AlexAcc (alex_action_105),AlexAcc (alex_action_105),AlexAcc (alex_action_105),AlexAcc (alex_action_105),AlexAcc (alex_action_105),AlexAcc (alex_action_105),AlexAcc (alex_action_105),AlexAcc (alex_action_105),AlexAcc (alex_action_105),AlexAcc (alex_action_105),AlexAcc (alex_action_105),AlexAcc (alex_action_105),AlexAcc (alex_action_105),AlexAcc (alex_action_105),AlexAcc (alex_action_105),AlexAcc (alex_action_105),AlexAcc (alex_action_105),AlexAcc (alex_action_105),AlexAcc (alex_action_105),AlexAcc (alex_action_105),AlexAcc (alex_action_105)] {-# LINE 236 "src/full/Agda/Syntax/Parser/Lexer.x" #-} -- | This is the initial state for parsing a literate file. Code blocks -- should be enclosed in @\\begin{code}@ @\\end{code}@ pairs. literate :: LexState literate = tex -- | This is the initial state for parsing a regular, non-literate file. normal :: LexState normal = 0 {-| The layout state. Entered when we see a layout keyword ('withLayout') and exited either when seeing an open brace ('openBrace') or at the next token ('newLayoutContext'). Update: we don't use braces for layout anymore. -} layout :: LexState layout = layout_ {-| The state inside a pragma. -} pragma :: LexState pragma = pragma_ {-| We enter this state from 'newLayoutContext' when the token following a layout keyword is to the left of (or at the same column as) the current layout context. Example: > data Empty : Set where > foo : Empty -> Nat Here the second line is not part of the @where@ clause since it is has the same indentation as the @data@ definition. What we have to do is insert an empty layout block @{}@ after the @where@. The only thing that can happen in this state is that 'emptyLayout' is executed, generating the closing brace. The open brace is generated when entering by 'newLayoutContext'. -} empty_layout :: LexState empty_layout = empty_layout_ -- | This state is entered at the beginning of each line. You can't lex -- anything in this state, and to exit you have to check the layout rule. -- Done with 'offsideRule'. bol :: LexState bol = bol_ -- | This state can only be entered by the parser. In this state you can only -- lex the keywords @using@, @hiding@, @renaming@ and @to@. Moreover they are -- only keywords in this particular state. The lexer will never enter this -- state by itself, that has to be done in the parser. imp_dir :: LexState imp_dir = imp_dir_ -- | Return the next token. This is the function used by Happy in the parser. -- -- @lexer k = 'lexToken' >>= k@ lexer :: (Token -> Parser a) -> Parser a lexer k = lexToken >>= k -- | Do not use this function; it sets the 'ParseFlags' to -- 'undefined'. alexScan :: AlexInput -> Int -> AlexReturn (LexAction Token) -- | This is the main lexing function generated by Alex. alexScanUser :: ([LexState], ParseFlags) -> AlexInput -> Int -> AlexReturn (LexAction Token) bol_,code,empty_layout_,imp_dir_,layout_,pragma_,tex :: Int bol_ = 1 code = 2 empty_layout_ = 3 imp_dir_ = 4 layout_ = 5 pragma_ = 6 tex = 7 alex_action_0 = end_ alex_action_1 = withInterval TokTeX alex_action_4 = end_ alex_action_5 = begin_ tex alex_action_8 = begin pragma alex_action_9 = symbol SymOpenPragma alex_action_10 = endWith $ symbol SymClosePragma alex_action_11 = keyword KwOPTIONS alex_action_12 = keyword KwBUILTIN alex_action_13 = keyword KwREWRITE alex_action_14 = keyword KwCOMPILED_DATA alex_action_15 = keyword KwCOMPILED_TYPE alex_action_16 = keyword KwCOMPILED alex_action_17 = keyword KwCOMPILED_EXPORT alex_action_18 = keyword KwCOMPILED_EPIC alex_action_19 = keyword KwCOMPILED_JS alex_action_20 = keyword KwSTATIC alex_action_21 = keyword KwIMPORT alex_action_22 = keyword KwIMPOSSIBLE alex_action_23 = keyword KwETA alex_action_24 = keyword KwNO_TERMINATION_CHECK alex_action_25 = keyword KwNON_TERMINATING alex_action_26 = keyword KwTERMINATING alex_action_27 = keyword KwMEASURE alex_action_28 = keyword KwLINE alex_action_29 = withInterval $ TokString alex_action_30 = nestedComment alex_action_31 = symbol SymEndComment alex_action_32 = symbol SymEndComment alex_action_33 = withInterval TokComment alex_action_35 = begin bol_ alex_action_37 = offsideRule alex_action_39 = endWith newLayoutContext alex_action_40 = emptyLayout alex_action_41 = keyword KwLet alex_action_42 = keyword KwIn alex_action_43 = keyword KwWhere alex_action_44 = keyword KwField alex_action_45 = keyword KwWith alex_action_46 = keyword KwRewrite alex_action_47 = keyword KwPostulate alex_action_48 = keyword KwPrimitive alex_action_49 = keyword KwOpen alex_action_50 = keyword KwImport alex_action_51 = keyword KwModule alex_action_52 = keyword KwData alex_action_53 = keyword KwCoData alex_action_54 = keyword KwRecord alex_action_55 = keyword KwConstructor alex_action_56 = keyword KwInductive alex_action_57 = keyword KwCoInductive alex_action_58 = keyword KwInfix alex_action_59 = keyword KwInfixL alex_action_60 = keyword KwInfixR alex_action_61 = keyword KwMutual alex_action_62 = keyword KwAbstract alex_action_63 = keyword KwPrivate alex_action_64 = keyword KwInstance alex_action_65 = keyword KwSet alex_action_66 = keyword KwProp alex_action_67 = keyword KwForall alex_action_68 = withInterval' (read . drop 3) TokSetN alex_action_69 = keyword KwQuoteGoal alex_action_70 = keyword KwQuoteContext alex_action_71 = keyword KwQuote alex_action_72 = keyword KwQuoteTerm alex_action_73 = keyword KwUnquote alex_action_74 = keyword KwUnquoteDecl alex_action_75 = keyword KwTactic alex_action_76 = keyword KwSyntax alex_action_77 = keyword KwPatternSyn alex_action_78 = keyword KwUsing alex_action_79 = keyword KwHiding alex_action_80 = keyword KwRenaming alex_action_81 = endWith $ keyword KwTo alex_action_82 = keyword KwPublic alex_action_83 = hole alex_action_84 = symbol SymEllipsis alex_action_85 = symbol SymDotDot alex_action_86 = symbol SymDot alex_action_87 = symbol SymSemi alex_action_88 = symbol SymColon alex_action_89 = symbol SymEqual alex_action_90 = symbol SymUnderscore alex_action_91 = symbol SymQuestionMark alex_action_92 = symbol SymBar alex_action_93 = symbol SymOpenParen alex_action_94 = symbol SymCloseParen alex_action_95 = symbol SymArrow alex_action_96 = symbol SymLambda alex_action_97 = symbol SymAs alex_action_98 = symbol SymDoubleOpenBrace alex_action_99 = symbol SymOpenBrace alex_action_100 = symbol SymCloseBrace alex_action_101 = litChar alex_action_102 = litString alex_action_103 = literal LitInt alex_action_104 = literal LitFloat alex_action_105 = identifier {-# LINE 1 "templates/GenericTemplate.hs" #-} {-# LINE 1 "templates/GenericTemplate.hs" #-} {-# LINE 1 "" #-} {-# LINE 1 "" #-} {-# LINE 9 "" #-} {-# LINE 1 "/usr/local/stow/ghc-7.10.3/lib/ghc-7.10.3/include/ghcversion.h" #-} {-# LINE 9 "" #-} {-# LINE 1 "templates/GenericTemplate.hs" #-} -- ----------------------------------------------------------------------------- -- ALEX TEMPLATE -- -- This code is in the PUBLIC DOMAIN; you may copy it freely and use -- it for any purpose whatsoever. -- ----------------------------------------------------------------------------- -- INTERNALS and main scanner engine {-# LINE 21 "templates/GenericTemplate.hs" #-} -- Do not remove this comment. Required to fix CPP parsing when using GCC and a clang-compiled alex. #if __GLASGOW_HASKELL__ > 706 #define GTE(n,m) (tagToEnum# (n >=# m)) #define EQ(n,m) (tagToEnum# (n ==# m)) #else #define GTE(n,m) (n >=# m) #define EQ(n,m) (n ==# m) #endif {-# LINE 51 "templates/GenericTemplate.hs" #-} data AlexAddr = AlexA# Addr# -- Do not remove this comment. Required to fix CPP parsing when using GCC and a clang-compiled alex. #if __GLASGOW_HASKELL__ < 503 uncheckedShiftL# = shiftL# #endif {-# INLINE alexIndexInt16OffAddr #-} alexIndexInt16OffAddr (AlexA# arr) off = #ifdef WORDS_BIGENDIAN narrow16Int# i where i = word2Int# ((high `uncheckedShiftL#` 8#) `or#` low) high = int2Word# (ord# (indexCharOffAddr# arr (off' +# 1#))) low = int2Word# (ord# (indexCharOffAddr# arr off')) off' = off *# 2# #else indexInt16OffAddr# arr off #endif {-# INLINE alexIndexInt32OffAddr #-} alexIndexInt32OffAddr (AlexA# arr) off = #ifdef WORDS_BIGENDIAN narrow32Int# i where i = word2Int# ((b3 `uncheckedShiftL#` 24#) `or#` (b2 `uncheckedShiftL#` 16#) `or#` (b1 `uncheckedShiftL#` 8#) `or#` b0) b3 = int2Word# (ord# (indexCharOffAddr# arr (off' +# 3#))) b2 = int2Word# (ord# (indexCharOffAddr# arr (off' +# 2#))) b1 = int2Word# (ord# (indexCharOffAddr# arr (off' +# 1#))) b0 = int2Word# (ord# (indexCharOffAddr# arr off')) off' = off *# 4# #else indexInt32OffAddr# arr off #endif #if __GLASGOW_HASKELL__ < 503 quickIndex arr i = arr ! i #else -- GHC >= 503, unsafeAt is available from Data.Array.Base. quickIndex = unsafeAt #endif -- ----------------------------------------------------------------------------- -- Main lexing routines data AlexReturn a = AlexEOF | AlexError !AlexInput | AlexSkip !AlexInput !Int | AlexToken !AlexInput !Int a -- alexScan :: AlexInput -> StartCode -> AlexReturn a alexScan input (I# (sc)) = alexScanUser undefined input (I# (sc)) alexScanUser user input (I# (sc)) = case alex_scan_tkn user input 0# input sc AlexNone of (AlexNone, input') -> case alexGetByte input of Nothing -> AlexEOF Just _ -> AlexError input' (AlexLastSkip input'' len, _) -> AlexSkip input'' len (AlexLastAcc k input''' len, _) -> AlexToken input''' len k -- Push the input through the DFA, remembering the most recent accepting -- state it encountered. alex_scan_tkn user orig_input len input s last_acc = input `seq` -- strict in the input let new_acc = (check_accs (alex_accept `quickIndex` (I# (s)))) in new_acc `seq` case alexGetByte input of Nothing -> (new_acc, input) Just (c, new_input) -> case fromIntegral c of { (I# (ord_c)) -> let base = alexIndexInt32OffAddr alex_base s offset = (base +# ord_c) check = alexIndexInt16OffAddr alex_check offset new_s = if GTE(offset,0#) && EQ(check,ord_c) then alexIndexInt16OffAddr alex_table offset else alexIndexInt16OffAddr alex_deflt s in case new_s of -1# -> (new_acc, input) -- on an error, we want to keep the input *before* the -- character that failed, not after. _ -> alex_scan_tkn user orig_input (if c < 0x80 || c >= 0xC0 then (len +# 1#) else len) -- note that the length is increased ONLY if this is the 1st byte in a char encoding) new_input new_s new_acc } where check_accs (AlexAccNone) = last_acc check_accs (AlexAcc a ) = AlexLastAcc a input (I# (len)) check_accs (AlexAccSkip) = AlexLastSkip input (I# (len)) check_accs (AlexAccPred a predx rest) | predx user orig_input (I# (len)) input = AlexLastAcc a input (I# (len)) | otherwise = check_accs rest check_accs (AlexAccSkipPred predx rest) | predx user orig_input (I# (len)) input = AlexLastSkip input (I# (len)) | otherwise = check_accs rest data AlexLastAcc a = AlexNone | AlexLastAcc a !AlexInput !Int | AlexLastSkip !AlexInput !Int instance Functor AlexLastAcc where fmap _ AlexNone = AlexNone fmap f (AlexLastAcc x y z) = AlexLastAcc (f x) y z fmap _ (AlexLastSkip x y) = AlexLastSkip x y data AlexAcc a user = AlexAccNone | AlexAcc a | AlexAccSkip | AlexAccPred a (AlexAccPred user) (AlexAcc a user) | AlexAccSkipPred (AlexAccPred user) (AlexAcc a user) type AlexAccPred user = user -> AlexInput -> Int -> AlexInput -> Bool -- ----------------------------------------------------------------------------- -- Predicates on a rule alexAndPred p1 p2 user in1 len in2 = p1 user in1 len in2 && p2 user in1 len in2 --alexPrevCharIsPred :: Char -> AlexAccPred _ alexPrevCharIs c _ input _ _ = c == alexInputPrevChar input alexPrevCharMatches f _ input _ _ = f (alexInputPrevChar input) --alexPrevCharIsOneOfPred :: Array Char Bool -> AlexAccPred _ alexPrevCharIsOneOf arr _ input _ _ = arr ! alexInputPrevChar input --alexRightContext :: Int -> AlexAccPred _ alexRightContext (I# (sc)) user _ _ input = case alex_scan_tkn user input 0# input sc AlexNone of (AlexNone, _) -> False _ -> True -- TODO: there's no need to find the longest -- match when checking the right context, just -- the first match will do. Agda-2.4.2.5/src/0000755000000000000000000000000012635075266011507 5ustar0000000000000000Agda-2.4.2.5/src/main/0000755000000000000000000000000012635075266012433 5ustar0000000000000000Agda-2.4.2.5/src/main/Main.hs0000644000000000000000000000035612635075266013657 0ustar0000000000000000-- | Wrapper for "Agda.Main". -- -- Agda is installed as a library. This module is used to build the -- executable. module Main (main) where import qualified Agda.Main ( main ) import Prelude ( IO ) main :: IO () main = Agda.Main.main Agda-2.4.2.5/src/agda-mode/0000755000000000000000000000000012635075266013325 5ustar0000000000000000Agda-2.4.2.5/src/agda-mode/Main.hs0000644000000000000000000001673012635075266014554 0ustar0000000000000000-- | A program which either tries to add setup code for Agda's Emacs -- mode to the users .emacs file, or provides information to Emacs -- about where the Emacs mode is installed. module Main (main) where import Control.Applicative import Control.Exception import Control.Monad import Data.Char import Data.List import Data.Maybe import Data.Version import Numeric import System.Directory import System.Environment import System.Exit import System.FilePath import System.IO import System.Process import Paths_Agda (getDataDir, version) -- | The program. main :: IO () main = do prog <- getProgName args <- getArgs case args of [arg] | arg == locateFlag -> printEmacsModeFile | arg == setupFlag -> do dotEmacs <- findDotEmacs setupDotEmacs (Files { thisProgram = prog , dotEmacs = dotEmacs }) | arg == compileFlag -> compileElispFiles _ -> do inform usage exitFailure -- Command line options. setupFlag = "setup" locateFlag = "locate" compileFlag = "compile" -- | Usage information. usage :: String usage = unlines [ "This program, which is part of Agda version " ++ ver ++ ", can be run" , "in three modes, depending on which option it is invoked with:" , "" , setupFlag , "" , " The program tries to add setup code for Agda's Emacs mode to the" , " current user's .emacs file. It is assumed that the .emacs file" , " uses the character encoding specified by the locale." , "" , locateFlag , "" , " The path to the Emacs mode's main file is printed on standard" , " output (using the UTF-8 character encoding and no trailing" , " newline)." , "" , compileFlag , "" , " The program tries to compile Agda's Emacs mode's source files." , "" , " WARNING: If you reinstall the Agda mode without recompiling the Emacs" , " Lisp files, then Emacs may continue using the old, compiled files." ] -- | The current version of Agda. ver :: String ver = intercalate "." $ map show $ versionBranch version ------------------------------------------------------------------------ -- Locating the Agda mode -- | Prints out the path to the Agda mode's main file (using UTF-8 and -- without any trailing newline). printEmacsModeFile :: IO () printEmacsModeFile = do dataDir <- getDataDir let path = dataDir "emacs-mode" "agda2.el" hSetEncoding stdout utf8 putStr path ------------------------------------------------------------------------ -- Setting up the .emacs file data Files = Files { dotEmacs :: FilePath -- ^ The .emacs file. , thisProgram :: FilePath -- ^ The name of the current program. } -- | Tries to set up the Agda mode in the given .emacs file. setupDotEmacs :: Files -> IO () setupDotEmacs files = do informLn $ "The .emacs file used: " ++ dotEmacs files already <- alreadyInstalled files if already then informLn "It seems as if setup has already been performed." else do appendFile (dotEmacs files) (setupString files) inform $ unlines $ [ "Setup done. Try to (re)start Emacs and open an Agda file." , "The following text was appended to the .emacs file:" ] ++ lines (setupString files) -- | Tries to find the user's .emacs file by querying Emacs. findDotEmacs :: IO FilePath findDotEmacs = askEmacs "(insert (expand-file-name user-init-file))" -- | Has the Agda mode already been set up? alreadyInstalled :: Files -> IO Bool alreadyInstalled files = do exists <- doesFileExist (dotEmacs files) if not exists then return False else withFile (dotEmacs files) ReadMode $ \h -> evaluate . (identifier files `isInfixOf`) =<< hGetContents h -- Uses evaluate to ensure that the file is not closed -- prematurely. -- | If this string occurs in the .emacs file, then it is assumed that -- setup has already been performed. identifier :: Files -> String identifier files = takeFileName (thisProgram files) ++ " " ++ locateFlag -- | The string appended to the end of the .emacs file. setupString :: Files -> String setupString files = unlines [ "" , "(load-file (let ((coding-system-for-read 'utf-8))" , " (shell-command-to-string \"" ++ identifier files ++ "\")))" ] ------------------------------------------------------------------------ -- Querying Emacs -- | Evaluates the given Elisp command using Emacs. The output of the -- command (whatever was written into the current buffer) is returned. -- -- Note: The input is not checked. The input is assumed to come from a -- trusted source. askEmacs :: String -> IO String askEmacs query = do tempDir <- getTemporaryDirectory bracket (openTempFile tempDir "askEmacs") (removeFile . fst) $ \(file, h) -> do hClose h exit <- rawSystem "emacs" [ "--no-desktop", "--no-window-system", "--no-splash" -- Andreas, 2014-01-11: ^ try a leaner startup of emacs , "--eval" , "(with-temp-file " ++ escape file ++ " " ++ query ++ ")" , "--kill" ] unless (exit == ExitSuccess) $ do informLn "Unable to query Emacs." exitFailure withFile file ReadMode $ \h -> do result <- hGetContents h evaluate (length result) -- Uses evaluate to ensure that the file is not closed -- prematurely. return result -- | Escapes the string so that Emacs can parse it as an Elisp string. escape :: FilePath -> FilePath escape s = "\"" ++ concatMap esc s ++ "\"" where esc c | c `elem` ['\\', '"'] = '\\' : [c] | isAscii c && isPrint c = [c] | otherwise = "\\x" ++ showHex (fromEnum c) "\\ " ------------------------------------------------------------------------ -- Compiling Emacs Lisp files -- | The Agda mode's Emacs Lisp files, given in the order in which -- they should be compiled. emacsLispFiles :: [FilePath] emacsLispFiles = [ "agda2-abbrevs.el" , "annotation.el" , "agda2-queue.el" , "eri.el" , "agda2.el" , "agda-input.el" , "agda2-highlight.el" , "agda2-mode.el" ] -- | Tries to compile the Agda mode's Emacs Lisp files. compileElispFiles :: IO () compileElispFiles = do dataDir <- ( "emacs-mode") <$> getDataDir let elFiles = map (dataDir ) emacsLispFiles elFiles <- filterM doesFileExist elFiles results <- mapM (compile dataDir) elFiles case catMaybes results of [] -> return () fs -> do informLn "Unable to compile the following Emacs Lisp files:" mapM_ (informLn . (" " ++)) fs exitFailure where compile dataDir f = do exit <- rawSystem "emacs" $ [ "--no-init-file", "--no-site-file" , "--directory", dataDir , "--batch" , "--eval" , "(progn \ \(setq byte-compile-error-on-warn t) \ \(byte-compile-disable-warning 'cl-functions) \ \(batch-byte-compile))" , f ] return $ if exit == ExitSuccess then Nothing else Just f ------------------------------------------------------------------------ -- Helper functions -- These functions inform the user about something by printing on -- stderr. inform = hPutStr stderr informLn = hPutStrLn stderr Agda-2.4.2.5/src/full/0000755000000000000000000000000012635075266012451 5ustar0000000000000000Agda-2.4.2.5/src/full/undefined.h0000644000000000000000000000020712635075266014562 0ustar0000000000000000#define __IMPOSSIBLE__ (throwImpossible (Impossible __FILE__ __LINE__)) #define __IMPOSSIBLE_TERM__ (impossibleTerm __FILE__ __LINE__) Agda-2.4.2.5/src/full/Agda/0000755000000000000000000000000012635075266013305 5ustar0000000000000000Agda-2.4.2.5/src/full/Agda/Main.hs0000644000000000000000000001456212635075266014535 0ustar0000000000000000{-# LANGUAGE CPP #-} {-| Agda main module. -} module Agda.Main where import Control.Monad.State import Control.Applicative import Data.Maybe import System.Environment import System.Exit import Agda.Syntax.Concrete.Pretty () import Agda.Syntax.Abstract.Name (toTopLevelModuleName) import Agda.Interaction.CommandLine import Agda.Interaction.Options import Agda.Interaction.Monad import Agda.Interaction.EmacsTop (mimicGHCi) import Agda.Interaction.Imports (MaybeWarnings(..)) import qualified Agda.Interaction.Imports as Imp import qualified Agda.Interaction.Highlighting.Dot as Dot import qualified Agda.Interaction.Highlighting.LaTeX as LaTeX import Agda.Interaction.Highlighting.HTML import Agda.TypeChecking.Monad import qualified Agda.TypeChecking.Monad.Benchmark as Bench import Agda.TypeChecking.Errors import Agda.TypeChecking.Pretty import Agda.Compiler.MAlonzo.Compiler as MAlonzo import Agda.Compiler.Epic.Compiler as Epic import Agda.Compiler.JS.Compiler as JS import Agda.Utils.Lens import Agda.Utils.Monad import Agda.Utils.String import Agda.Tests import Agda.Version import Agda.Utils.Except ( MonadError(catchError, throwError) ) import Agda.Utils.Impossible #include "undefined.h" -- | The main function runAgda :: TCM () runAgda = do progName <- liftIO getProgName argv <- liftIO getArgs let opts = parseStandardOptions argv case opts of Left err -> liftIO $ optionError err Right opts -> runAgdaWithOptions generateHTML progName opts -- | Run Agda with parsed command line options and with a custom HTML generator runAgdaWithOptions :: TCM () -- ^ HTML generating action -> String -- ^ program name -> CommandLineOptions -- ^ parsed command line options -> TCM () runAgdaWithOptions generateHTML progName opts | optShowHelp opts = liftIO printUsage | optShowVersion opts = liftIO printVersion | optRunTests opts = liftIO $ do ok <- testSuite unless ok exitFailure | isNothing (optInputFile opts) && not (optInteractive opts) && not (optGHCiInteraction opts) = liftIO printUsage | otherwise = do setCommandLineOptions opts -- Main function. -- Bill everything to root of Benchmark trie. Bench.billTo [] $ checkFile -- Print benchmarks. Bench.print -- Print accumulated statistics. printStatistics 20 Nothing =<< use lensAccumStatistics where checkFile :: TCM () checkFile = do i <- optInteractive <$> liftTCM commandLineOptions ghci <- optGHCiInteraction <$> liftTCM commandLineOptions compile <- optCompile <$> liftTCM commandLineOptions compileNoMain <- optCompileNoMain <$> liftTCM commandLineOptions epic <- optEpicCompile <$> liftTCM commandLineOptions js <- optJSCompile <$> liftTCM commandLineOptions when i $ liftIO $ putStr splashScreen let failIfNoInt (Just i) = return i -- The allowed combinations of command-line -- options should rule out Nothing here. failIfNoInt Nothing = __IMPOSSIBLE__ failIfInt x Nothing = x failIfInt _ (Just _) = __IMPOSSIBLE__ interaction :: TCM (Maybe Interface) -> TCM () interaction | i = runIM . interactionLoop | ghci = (failIfInt mimicGHCi =<<) | compile && compileNoMain = (MAlonzo.compilerMain False =<<) . (failIfNoInt =<<) | compile = (MAlonzo.compilerMain True =<<) . (failIfNoInt =<<) | epic = (Epic.compilerMain =<<) . (failIfNoInt =<<) | js = (JS.compilerMain =<<) . (failIfNoInt =<<) | otherwise = (() <$) interaction $ do hasFile <- hasInputFile -- Andreas, 2013-10-30 The following 'resetState' kills the -- verbosity options. That does not make sense (see fail/Issue641). -- 'resetState' here does not seem to serve any purpose, -- thus, I am removing it. -- resetState if not hasFile then return Nothing else do file <- getInputFile (i, mw) <- Imp.typeCheckMain file unsolvedOK <- optAllowUnsolved <$> pragmaOptions -- Reported unsolved problems as error unless unsolvedOK. -- An interface is only generated if NoWarnings. result <- case mw of -- Unsolved metas. SomeWarnings (Warnings w@(_:_) _) | not unsolvedOK -> typeError $ UnsolvedMetas w -- Unsolved constraints. SomeWarnings (Warnings _ w@(_:_)) | not unsolvedOK -> typeError $ UnsolvedConstraints w -- Unsolved metas, unsolved constraints, or -- interaction points left whose metas have been solved -- automatically. (See Issue 1296). SomeWarnings (Warnings _ _) -> return Nothing NoWarnings -> return $ Just i reportSDoc "main" 50 $ pretty i whenM (optGenerateHTML <$> commandLineOptions) $ generateHTML whenM (isJust . optDependencyGraph <$> commandLineOptions) $ Dot.generateDot $ i whenM (optGenerateLaTeX <$> commandLineOptions) $ LaTeX.generateLaTeX (toTopLevelModuleName $ iModuleName i) (iHighlighting i) return result -- | Print usage information. printUsage :: IO () printUsage = do progName <- getProgName putStr $ usage standardOptions_ [] progName -- | Print version information. printVersion :: IO () printVersion = putStrLn $ "Agda version " ++ version -- | What to do for bad options. optionError :: String -> IO () optionError err = do putStrLn $ "Error: " ++ err printUsage exitFailure -- | Run a TCM action in IO; catch and pretty print errors. runTCMPrettyErrors :: TCM () -> IO () runTCMPrettyErrors tcm = do r <- runTCMTop $ tcm `catchError` \err -> do s <- prettyError err liftIO $ putStrLn s throwError err case r of Right _ -> exitSuccess Left _ -> exitFailure `catchImpossible` \e -> do putStr $ show e exitFailure -- | Main main :: IO () main = runTCMPrettyErrors runAgda Agda-2.4.2.5/src/full/Agda/TheTypeChecker.hs0000644000000000000000000000024112635075266016505 0ustar0000000000000000module Agda.TheTypeChecker ( checkDecls, checkDecl , inferExpr, checkExpr ) where import Agda.TypeChecking.Rules.Decl import Agda.TypeChecking.Rules.Term Agda-2.4.2.5/src/full/Agda/Tests.hs0000644000000000000000000000615112635075266014746 0ustar0000000000000000-- | Responsible for running all internal tests. module Agda.Tests (testSuite) where import Agda.Utils.TestHelpers import Agda.Compiler.MAlonzo.Encode as CompEnco (tests) import Agda.Interaction.Highlighting.Emacs as InteEmac (tests) import Agda.Interaction.Highlighting.Generate as InteGene (tests) import Agda.Interaction.Highlighting.Precise as IntePrec (tests) import Agda.Interaction.Highlighting.Range as InteRang (tests) import Agda.Interaction.Options as InteOpti (tests) import Agda.Syntax.Parser.Parser as SyntPars (tests) import Agda.Syntax.Position as SyntPosi (tests) import Agda.Termination.CallGraph as TermCall (tests) import Agda.Termination.CallMatrix as TermCM (tests) -- import Agda.Termination.Lexicographic as TermLex (tests) -- import Agda.Termination.Matrix as TermMatrix (tests) import Agda.Termination.Order as TermOrd (tests) import Agda.Termination.Semiring as TermRing (tests) import Agda.Termination.SparseMatrix as TermSparse (tests) import Agda.Termination.Termination as TermTerm (tests) import Agda.TypeChecking.Free.Tests as Free (tests) import Agda.TypeChecking.Irrelevance as Irrel (tests) import Agda.TypeChecking.Positivity.Tests as Positivity (tests) import Agda.TypeChecking.Positivity.Occurrence as Occurrence (tests) import Agda.TypeChecking.Tests as TypeChck (tests) import Agda.TypeChecking.SizedTypes.Tests as SizedTypes (tests) import Agda.Utils.Bag as UtilBag (tests) import Agda.Utils.BiMap as UtilBiMap (tests) import Agda.Utils.Cluster as UtilClust (tests) import Agda.Utils.Either as UtilEith (tests) import Agda.Utils.Favorites as UtilFav (tests) import Agda.Utils.FileName as UtilFile (tests) import Agda.Utils.Graph.AdjacencyMap.Unidirectional.Tests as UtilGraphUni (tests) import Agda.Utils.List as UtilList (tests) import Agda.Utils.ListT.Tests as UtilListT (tests) import Agda.Utils.PartialOrd as UtilPOrd (tests) import Agda.Utils.Permutation.Tests as UtilPerm (tests) import Agda.Utils.Warshall as UtilWarsh (tests) testSuite :: IO Bool testSuite = runTests "QuickCheck test suite:" [ Free.tests , Irrel.tests , SizedTypes.tests , UtilFav.tests , UtilListT.tests , UtilPerm.tests , UtilPOrd.tests , CompEnco.tests , InteEmac.tests , InteGene.tests , IntePrec.tests , InteRang.tests , InteOpti.tests , SyntPars.tests , SyntPosi.tests , TermCall.tests , TermCM.tests -- , TermLex.tests -- , TermMatrix.tests , TermOrd.tests , TermRing.tests , TermSparse.tests , TermTerm.tests , Positivity.tests , Occurrence.tests , TypeChck.tests , UtilBag.tests , UtilBiMap.tests , UtilClust.tests , UtilEith.tests , UtilFile.tests , UtilGraphUni.tests , UtilList.tests , UtilWarsh.tests ] Agda-2.4.2.5/src/full/Agda/ImpossibleTest.hs0000644000000000000000000000024112635075266016604 0ustar0000000000000000{-# LANGUAGE CPP #-} module Agda.ImpossibleTest where #include "undefined.h" import Agda.Utils.Impossible impossibleTest :: a impossibleTest = __IMPOSSIBLE__ Agda-2.4.2.5/src/full/Agda/Version.hs0000644000000000000000000000033512635075266015267 0ustar0000000000000000module Agda.Version where import Data.Version import Data.List import qualified Paths_Agda as PA -- | The version of Agda. version :: String version = intercalate "." $ map show $ versionBranch PA.version Agda-2.4.2.5/src/full/Agda/Benchmarking.hs0000644000000000000000000000553712635075266016243 0ustar0000000000000000{-# LANGUAGE CPP #-} {-# LANGUAGE FunctionalDependencies #-} {-# LANGUAGE IncoherentInstances #-} {-# LANGUAGE MultiParamTypeClasses #-} {-# LANGUAGE NoMonomorphismRestriction #-} #if __GLASGOW_HASKELL__ <= 708 {-# LANGUAGE OverlappingInstances #-} #endif {-# OPTIONS_GHC -fno-warn-orphans #-} -- | Agda-specific benchmarking structure. module Agda.Benchmarking where import Control.Monad.IO.Class import qualified Control.Exception as E import Data.IORef import System.IO.Unsafe import Agda.Utils.Benchmark (MonadBench(..)) import qualified Agda.Utils.Benchmark as B import Agda.Utils.Null import Agda.Utils.Pretty -- | Phases to allocate CPU time to. data Phase = Parsing -- ^ Happy parsing and operator parsing. | Import -- ^ Import chasing. | Deserialization -- ^ Reading interface files. | Scoping -- ^ Scope checking and translation to abstract syntax. | Typing -- ^ Type checking and translation to internal syntax. | Termination -- ^ Termination checking. | Positivity -- ^ Positivity checking and polarity computation. | Injectivity -- ^ Injectivity checking. | ProjectionLikeness -- ^ Checking for projection likeness. | Coverage -- ^ Coverage checking and compilation to case trees. | Highlighting -- ^ Generating highlighting info. | Serialization -- ^ Writing interface files. | Graph -- ^ Subphase for 'Termination'. | RecCheck -- ^ Subphase for 'Termination'. | Reduce -- ^ Subphase for 'Termination'. | Level -- ^ Subphase for 'Termination'. | Compare -- ^ Subphase for 'Termination'. | With -- ^ Subphase for 'Termination'. | ModuleName -- ^ Subphase for 'Import'. | Sort -- ^ Subphase for 'Serialize'. | BinaryEncode -- ^ Subphase for 'Serialize'. | Compress -- ^ Subphase for 'Serialize'. | Operators -- ^ Subphase for 'Parsing'. | Free -- ^ Subphase for 'Typing': free variable computation. | OccursCheck -- ^ Subphase for 'Typing': occurs check for solving metas. | InverseScopeLookup -- ^ Pretty printing names. deriving (Eq, Ord, Show, Enum, Bounded) instance Pretty Phase where pretty = text . show type Benchmark = B.Benchmark Phase type Account = B.Account Phase -- * Benchmarking in the IO monad. -- | Global variable to store benchmark statistics. {-# NOINLINE benchmarks #-} benchmarks :: IORef Benchmark benchmarks = unsafePerformIO $ newIORef empty instance MonadBench Phase IO where getBenchmark = readIORef benchmarks putBenchmark = writeIORef benchmarks finally = E.finally -- | Benchmark an IO computation and bill it to the given account. billToIO :: Account -> IO a -> IO a billToIO = B.billTo -- | Benchmark a pure computation and bill it to the given account. billToPure :: Account -> a -> a billToPure acc a = unsafePerformIO $ billToIO acc $ return a Agda-2.4.2.5/src/full/Agda/Utils/0000755000000000000000000000000012635075266014405 5ustar0000000000000000Agda-2.4.2.5/src/full/Agda/Utils/ReadP.hs0000644000000000000000000004023212635075266015735 0ustar0000000000000000{-# LANGUAGE DeriveFunctor #-} {-# LANGUAGE MagicHash #-} {-# LANGUAGE Rank2Types #-} ----------------------------------------------------------------------------- -- | -- This is a modified version of the ReadP module from the standard libraries. -- The changes are: -- 1) ReadP is parameterised over the token type (hard-wired to 'Char' in the library). -- 2) Added the functions 'parse' and 'parse'' which run parsers. -- 3) Removed Read instances. -- Module : "Text.ParserCombinators.ReadP" -- Copyright : (c) The University of Glasgow 2002 -- License : BSD-style (see the file libraries/base/LICENSE) -- -- Maintainer : libraries@haskell.org -- Stability : provisional -- Portability : non-portable (local universal quantification) -- -- This is a library of parser combinators, originally written by Koen Claessen. -- It parses all alternatives in parallel, so it never keeps hold of -- the beginning of the input string, a common source of space leaks with -- other parsers. The '(+++)' choice combinator is genuinely commutative; -- it makes no difference which branch is \"shorter\". ----------------------------------------------------------------------------- module Agda.Utils.ReadP ( -- * The 'ReadP' type ReadP, -- :: * -> *; instance Functor, Monad, MonadPlus -- * Primitive operations get, -- :: ReadP Char look, -- :: ReadP String (+++), -- :: ReadP a -> ReadP a -> ReadP a (<++), -- :: ReadP a -> ReadP a -> ReadP a gather, -- :: ReadP a -> ReadP (String, a) -- * Parse parse, -- :: ReadP tok a -> [tok] -> [a] parse', -- :: ReadP tok a -> [tok] -> Either a [tok] -- * Other operations pfail, -- :: ReadP a satisfy, -- :: (Char -> Bool) -> ReadP Char char, -- :: Char -> ReadP Char string, -- :: String -> ReadP String munch, -- :: (Char -> Bool) -> ReadP String munch1, -- :: (Char -> Bool) -> ReadP String skipSpaces, -- :: ReadP () choice, -- :: [ReadP a] -> ReadP a count, -- :: Int -> ReadP a -> ReadP [a] between, -- :: ReadP open -> ReadP close -> ReadP a -> ReadP a option, -- :: a -> ReadP a -> ReadP a optional, -- :: ReadP a -> ReadP () many, -- :: ReadP a -> ReadP [a] many1, -- :: ReadP a -> ReadP [a] skipMany, -- :: ReadP a -> ReadP () skipMany1, -- :: ReadP a -> ReadP () sepBy, -- :: ReadP a -> ReadP sep -> ReadP [a] sepBy1, -- :: ReadP a -> ReadP sep -> ReadP [a] endBy, -- :: ReadP a -> ReadP sep -> ReadP [a] endBy1, -- :: ReadP a -> ReadP sep -> ReadP [a] chainr, -- :: ReadP a -> ReadP (a -> a -> a) -> a -> ReadP a chainl, -- :: ReadP a -> ReadP (a -> a -> a) -> a -> ReadP a chainl1, -- :: ReadP a -> ReadP (a -> a -> a) -> ReadP a chainr1, -- :: ReadP a -> ReadP (a -> a -> a) -> ReadP a manyTill, -- :: ReadP a -> ReadP end -> ReadP [a] -- * Properties -- $properties ) where import Control.Applicative (Applicative(..),Alternative(empty,(<|>))) import Control.Monad import GHC.Exts import Data.Char infixr 5 +++, <++ -- --------------------------------------------------------------------------- -- The P type -- is representation type -- should be kept abstract data P t a = Get (t -> P t a) | Look ([t] -> P t a) | Fail | Result a (P t a) | Final [(a,[t])] -- invariant: list is non-empty! deriving (Functor) -- Monad, MonadPlus instance Applicative (P t) where pure = return (<*>) = ap instance Monad (P t) where return x = Result x Fail (Get f) >>= k = Get (\c -> f c >>= k) (Look f) >>= k = Look (\s -> f s >>= k) Fail >>= k = Fail (Result x p) >>= k = k x `mplus` (p >>= k) (Final r) >>= k = final [ys' | (x,s) <- r, ys' <- run (k x) s] fail _ = Fail instance Alternative (P t) where empty = mzero (<|>) = mplus instance MonadPlus (P t) where mzero = Fail -- most common case: two gets are combined Get f1 `mplus` Get f2 = Get (\c -> f1 c `mplus` f2 c) -- results are delivered as soon as possible Result x p `mplus` q = Result x (p `mplus` q) p `mplus` Result x q = Result x (p `mplus` q) -- fail disappears Fail `mplus` p = p p `mplus` Fail = p -- two finals are combined -- final + look becomes one look and one final (=optimization) -- final + sthg else becomes one look and one final Final r `mplus` Final t = Final (r ++ t) Final r `mplus` Look f = Look (\s -> Final (r ++ run (f s) s)) Final r `mplus` p = Look (\s -> Final (r ++ run p s)) Look f `mplus` Final r = Look (\s -> Final (run (f s) s ++ r)) p `mplus` Final r = Look (\s -> Final (run p s ++ r)) -- two looks are combined (=optimization) -- look + sthg else floats upwards Look f `mplus` Look g = Look (\s -> f s `mplus` g s) Look f `mplus` p = Look (\s -> f s `mplus` p) p `mplus` Look f = Look (\s -> p `mplus` f s) -- --------------------------------------------------------------------------- -- The ReadP type newtype ReadP t a = R (forall b . (a -> P t b) -> P t b) -- Functor, Monad, MonadPlus instance Functor (ReadP t) where fmap h (R f) = R (\k -> f (k . h)) instance Applicative (ReadP t) where pure = return (<*>) = ap instance Monad (ReadP t) where return x = R (\k -> k x) fail _ = R (\_ -> Fail) R m >>= f = R (\k -> m (\a -> let R m' = f a in m' k)) instance Alternative (ReadP t) where empty = mzero (<|>) = mplus instance MonadPlus (ReadP t) where mzero = pfail mplus = (+++) -- --------------------------------------------------------------------------- -- Operations over P final :: [(a,[t])] -> P t a -- Maintains invariant for Final constructor final [] = Fail final r = Final r run :: P t a -> [t] -> [(a,[t])] run (Get f) (c:s) = run (f c) s run (Look f) s = run (f s) s run (Result x p) s = (x,s) : run p s run (Final r) _ = r run _ _ = [] -- --------------------------------------------------------------------------- -- Operations over ReadP -- | Run a parser on a list of tokens. Returns the list of complete matches. parse :: ReadP t a -> [t] -> [a] parse p ts = case complete p of R f -> map fst $ run (f return) ts get :: ReadP t t -- ^ Consumes and returns the next character. -- Fails if there is no input left. get = R Get look :: ReadP t [t] -- ^ Look-ahead: returns the part of the input that is left, without -- consuming it. look = R Look pfail :: ReadP t a -- ^ Always fails. pfail = R (\_ -> Fail) (+++) :: ReadP t a -> ReadP t a -> ReadP t a -- ^ Symmetric choice. R f1 +++ R f2 = R (\k -> f1 k `mplus` f2 k) (<++) :: ReadP t a -> ReadP t a -> ReadP t a -- ^ Local, exclusive, left-biased choice: If left parser -- locally produces any result at all, then right parser is -- not used. R f <++ q = do s <- look probe (f return) s 0# where probe (Get f) (c:s) n = probe (f c) s (n+#1#) probe (Look f) s n = probe (f s) s n probe p@(Result _ _) _ n = discard n >> R (p >>=) probe (Final r) _ _ = R (Final r >>=) probe _ _ _ = q discard 0# = return () discard n = get >> discard (n-#1#) gather :: ReadP t a -> ReadP t ([t], a) -- ^ Transforms a parser into one that does the same, but -- in addition returns the exact characters read. -- IMPORTANT NOTE: 'gather' gives a runtime error if its first argument -- is built using any occurrences of readS_to_P. gather (R m) = R (\k -> gath id (m (\a -> return (\s -> k (s,a))))) where gath l (Get f) = Get (\c -> gath (l.(c:)) (f c)) gath l Fail = Fail gath l (Look f) = Look (\s -> gath l (f s)) gath l (Result k p) = k (l []) `mplus` gath l p gath l (Final r) = error "do not use readS_to_P in gather!" -- --------------------------------------------------------------------------- -- Derived operations satisfy :: (t -> Bool) -> ReadP t t -- ^ Consumes and returns the next character, if it satisfies the -- specified predicate. satisfy p = do c <- get; if p c then return c else pfail char :: Eq t => t-> ReadP t t -- ^ Parses and returns the specified character. char c = satisfy (c ==) string :: Eq t => [t] -> ReadP t [t] -- ^ Parses and returns the specified string. string this = do s <- look; scan this s where scan [] _ = do return this scan (x:xs) (y:ys) | x == y = do _ <- get; scan xs ys scan _ _ = do pfail eof :: ReadP tok () eof = do ts <- look unless (null ts) pfail complete :: ReadP tok a -> ReadP tok a complete p = do x <- p eof return x munch :: (t -> Bool) -> ReadP t [t] -- ^ Parses the first zero or more characters satisfying the predicate. munch p = do s <- look scan s where scan (c:cs) | p c = do _ <- get; s <- scan cs; return (c:s) scan _ = do return [] munch1 :: (t -> Bool) -> ReadP t [t] -- ^ Parses the first one or more characters satisfying the predicate. munch1 p = do c <- get if p c then do s <- munch p; return (c:s) else pfail choice :: [ReadP t a] -> ReadP t a -- ^ Combines all parsers in the specified list. choice [] = pfail choice [p] = p choice (p:ps) = p +++ choice ps skipSpaces :: ReadP Char () -- ^ Skips all whitespace. skipSpaces = do s <- look skip s where skip (c:s) | isSpace c = do _ <- get; skip s skip _ = do return () count :: Int -> ReadP t a -> ReadP t [a] -- ^ @count n p@ parses @n@ occurrences of @p@ in sequence. A list of -- results is returned. count n p = sequence (replicate n p) between :: ReadP t open -> ReadP t close -> ReadP t a -> ReadP t a -- ^ @between open close p@ parses @open@, followed by @p@ and finally -- @close@. Only the value of @p@ is returned. between open close p = do _ <- open x <- p _ <- close return x option :: a -> ReadP t a -> ReadP t a -- ^ @option x p@ will either parse @p@ or return @x@ without consuming -- any input. option x p = p +++ return x optional :: ReadP t a -> ReadP t () -- ^ @optional p@ optionally parses @p@ and always returns @()@. optional p = (p >> return ()) +++ return () many :: ReadP t a -> ReadP t [a] -- ^ Parses zero or more occurrences of the given parser. many p = return [] +++ many1 p many1 :: ReadP t a -> ReadP t [a] -- ^ Parses one or more occurrences of the given parser. many1 p = liftM2 (:) p (many p) skipMany :: ReadP t a -> ReadP t () -- ^ Like 'many', but discards the result. skipMany p = many p >> return () skipMany1 :: ReadP t a -> ReadP t () -- ^ Like 'many1', but discards the result. skipMany1 p = p >> skipMany p sepBy :: ReadP t a -> ReadP t sep -> ReadP t [a] -- ^ @sepBy p sep@ parses zero or more occurrences of @p@, separated by @sep@. -- Returns a list of values returned by @p@. sepBy p sep = sepBy1 p sep +++ return [] sepBy1 :: ReadP t a -> ReadP t sep -> ReadP t [a] -- ^ @sepBy1 p sep@ parses one or more occurrences of @p@, separated by @sep@. -- Returns a list of values returned by @p@. sepBy1 p sep = liftM2 (:) p (many (sep >> p)) endBy :: ReadP t a -> ReadP t sep -> ReadP t [a] -- ^ @endBy p sep@ parses zero or more occurrences of @p@, separated and ended -- by @sep@. endBy p sep = many (do x <- p ; _ <- sep ; return x) endBy1 :: ReadP t a -> ReadP t sep -> ReadP t [a] -- ^ @endBy p sep@ parses one or more occurrences of @p@, separated and ended -- by @sep@. endBy1 p sep = many1 (do x <- p ; _ <- sep ; return x) chainr :: ReadP t a -> ReadP t (a -> a -> a) -> a -> ReadP t a -- ^ @chainr p op x@ parses zero or more occurrences of @p@, separated by @op@. -- Returns a value produced by a /right/ associative application of all -- functions returned by @op@. If there are no occurrences of @p@, @x@ is -- returned. chainr p op x = chainr1 p op +++ return x chainl :: ReadP t a -> ReadP t (a -> a -> a) -> a -> ReadP t a -- ^ @chainl p op x@ parses zero or more occurrences of @p@, separated by @op@. -- Returns a value produced by a /left/ associative application of all -- functions returned by @op@. If there are no occurrences of @p@, @x@ is -- returned. chainl p op x = chainl1 p op +++ return x chainr1 :: ReadP t a -> ReadP t (a -> a -> a) -> ReadP t a -- ^ Like 'chainr', but parses one or more occurrences of @p@. chainr1 p op = scan where scan = p >>= rest rest x = do f <- op y <- scan return (f x y) +++ return x chainl1 :: ReadP t a -> ReadP t (a -> a -> a) -> ReadP t a -- ^ Like 'chainl', but parses one or more occurrences of @p@. chainl1 p op = p >>= rest where rest x = do f <- op y <- p rest (f x y) +++ return x manyTill :: ReadP t a -> ReadP t end -> ReadP t [a] -- ^ @manyTill p end@ parses zero or more occurrences of @p@, until @end@ -- succeeds. Returns a list of values returned by @p@. manyTill p end = scan where scan = (end >> return []) <++ (liftM2 (:) p scan) -- --------------------------------------------------------------------------- -- Converting between ReadP and Read readP_to_S :: ReadP Char a -> ReadS a -- ^ Converts a parser into a Haskell ReadS-style function. -- This is the main way in which you can \"run\" a 'ReadP' parser: -- the expanded type is -- @ readP_to_S :: ReadP a -> String -> [(a,String)] @ readP_to_S (R f) = run (f return) readS_to_P :: ReadS a -> ReadP Char a -- ^ Converts a Haskell ReadS-style function into a parser. -- Warning: This introduces local backtracking in the resulting -- parser, and therefore a possible inefficiency. readS_to_P r = R (\k -> Look (\s -> final [bs'' | (a,s') <- r s, bs'' <- run (k a) s'])) -- --------------------------------------------------------------------------- -- A variant on parse which returns either a result, or the unparseable text. run' :: P t a -> [t] -> Either a [t] run' (Get f) (c:s) = run' (f c) s run' (Look f) s = run' (f s) s run' (Result x _) _ = Left x run' (Final ((x,_):_)) _ = Left x run' _ s = Right s parse' :: ReadP t a -> [t] -> Either a [t] parse' p ts = case complete p of R f -> run' (f return) ts -- --------------------------------------------------------------------------- -- QuickCheck properties that hold for the combinators {- $properties The following are QuickCheck specifications of what the combinators do. These can be seen as formal specifications of the behavior of the combinators. We use bags to give semantics to the combinators. > type Bag a = [a] Equality on bags does not care about the order of elements. > (=~) :: Ord a => Bag a -> Bag a -> Bool > xs =~ ys = sort xs == sort ys A special equality operator to avoid unresolved overloading when testing the properties. > (=~.) :: Bag (Int,String) -> Bag (Int,String) -> Bool > (=~.) = (=~) Here follow the properties: > prop_Get_Nil = > readP_to_S get [] =~ [] > > prop_Get_Cons c s = > readP_to_S get (c:s) =~ [(c,s)] > > prop_Look s = > readP_to_S look s =~ [(s,s)] > > prop_Fail s = > readP_to_S pfail s =~. [] > > prop_Return x s = > readP_to_S (return x) s =~. [(x,s)] > > prop_Bind p k s = > readP_to_S (p >>= k) s =~. > [ ys'' > | (x,s') <- readP_to_S p s > , ys'' <- readP_to_S (k (x::Int)) s' > ] > > prop_Plus p q s = > readP_to_S (p +++ q) s =~. > (readP_to_S p s ++ readP_to_S q s) > > prop_LeftPlus p q s = > readP_to_S (p <++ q) s =~. > (readP_to_S p s +<+ readP_to_S q s) > where > [] +<+ ys = ys > xs +<+ _ = xs > > prop_Gather s = > forAll readPWithoutReadS $ \p -> > readP_to_S (gather p) s =~ > [ ((pre,x::Int),s') > | (x,s') <- readP_to_S p s > , let pre = take (length s - length s') s > ] > > prop_String_Yes this s = > readP_to_S (string this) (this ++ s) =~ > [(this,s)] > > prop_String_Maybe this s = > readP_to_S (string this) s =~ > [(this, drop (length this) s) | this `isPrefixOf` s] > > prop_Munch p s = > readP_to_S (munch p) s =~ > [(takeWhile p s, dropWhile p s)] > > prop_Munch1 p s = > readP_to_S (munch1 p) s =~ > [(res,s') | let (res,s') = (takeWhile p s, dropWhile p s), not (null res)] > > prop_Choice ps s = > readP_to_S (choice ps) s =~. > readP_to_S (foldr (+++) pfail ps) s > > prop_ReadS r s = > readP_to_S (readS_to_P r) s =~. r s -} Agda-2.4.2.5/src/full/Agda/Utils/Benchmark.hs0000644000000000000000000001234012635075266016633 0ustar0000000000000000{-# LANGUAGE FlexibleInstances #-} {-# LANGUAGE FunctionalDependencies #-} {-# LANGUAGE MultiParamTypeClasses #-} {-# LANGUAGE NoMonomorphismRestriction #-} {-# LANGUAGE UndecidableInstances #-} {-# LANGUAGE TupleSections #-} -- | Tools for benchmarking and accumulating results. -- Nothing Agda-specific in here. module Agda.Utils.Benchmark where import Prelude hiding (null) import qualified Control.Exception as E (evaluate) import Control.Monad.Reader import Control.Monad.State import Data.Functor import qualified Data.List as List import qualified Text.PrettyPrint.Boxes as Boxes import Agda.Utils.Null import Agda.Utils.Monad hiding (finally) import qualified Agda.Utils.Maybe.Strict as Strict import Agda.Utils.Pretty import Agda.Utils.Time import Agda.Utils.Trie (Trie) import qualified Agda.Utils.Trie as Trie -- * Benchmark trie -- | Account we can bill computation time to. type Account a = [a] -- | Record when we started billing the current account. type CurrentAccount a = Strict.Maybe (Account a, CPUTime) type Timings a = Trie a CPUTime -- | Benchmark structure is a trie, mapping accounts (phases and subphases) -- to CPU time spent on their performance. data Benchmark a = Benchmark { benchmarkOn :: !Bool -- ^ Are we benchmarking at all? , currentAccount :: !(CurrentAccount a) -- ^ What are we billing to currently? , timings :: !(Timings a) -- ^ The accounts and their accumulated timing bill. } -- | Initial benchmark structure (empty). instance Null (Benchmark a) where empty = Benchmark { benchmarkOn = False , currentAccount = Strict.Nothing , timings = empty } null = null . timings -- | Semantic editor combinator. mapBenchmarkOn :: (Bool -> Bool) -> Benchmark a -> Benchmark a mapBenchmarkOn f b = b { benchmarkOn = f $ benchmarkOn b } -- | Semantic editor combinator. mapCurrentAccount :: (CurrentAccount a -> CurrentAccount a) -> Benchmark a -> Benchmark a mapCurrentAccount f b = b { currentAccount = f (currentAccount b) } -- | Semantic editor combinator. mapTimings :: (Timings a -> Timings a) -> Benchmark a -> Benchmark a mapTimings f b = b { timings = f (timings b) } -- | Add to specified CPU time account. addCPUTime :: Ord a => Account a -> CPUTime -> Benchmark a -> Benchmark a addCPUTime acc t = mapTimings (Trie.insertWith (+) acc t) -- | Print benchmark as two-column table with totals. instance (Ord a, Pretty a) => Pretty (Benchmark a) where pretty b = text $ Boxes.render table where (accounts, times) = unzip $ Trie.toList $ timings b -- Generate a table. table = Boxes.hsep 1 Boxes.left [col1, col2] -- First column: Accounts. col1 = Boxes.vcat Boxes.left $ map Boxes.text $ "Total" : map showAccount accounts -- Second column: Times. col2 = Boxes.vcat Boxes.right $ map (Boxes.text . prettyShow) $ sum times : times showAccount [] = "Miscellaneous" showAccount ks = List.intercalate "." $ map prettyShow ks -- * Benchmarking monad. -- | Monad with access to benchmarking data. class (Ord a, Functor m, MonadIO m) => MonadBench a m | m -> a where getBenchmark :: m (Benchmark a) getsBenchmark :: (Benchmark a -> c) -> m c getsBenchmark f = f <$> getBenchmark putBenchmark :: Benchmark a -> m () putBenchmark b = modifyBenchmark $ const b modifyBenchmark :: (Benchmark a -> Benchmark a) -> m () modifyBenchmark f = do b <- getBenchmark putBenchmark $! f b -- | We need to be able to terminate benchmarking in case of an exception. finally :: m b -> m c -> m b -- needs UndecidableInstances because of weakness of FunctionalDependencies instance MonadBench a m => MonadBench a (ReaderT r m) where getBenchmark = lift $ getBenchmark putBenchmark = lift . putBenchmark modifyBenchmark = lift . modifyBenchmark finally m f = ReaderT $ \ r -> finally (m `runReaderT` r) (f `runReaderT` r) -- | Turn benchmarking on/off. setBenchmarking :: MonadBench a m => Bool -> m () setBenchmarking b = modifyBenchmark $ mapBenchmarkOn $ const b -- | Bill current account with time up to now. -- Switch to new account. -- Return old account (if any). switchBenchmarking :: MonadBench a m => Strict.Maybe (Account a) -- ^ Maybe new account. -> m (Strict.Maybe (Account a)) -- ^ Maybe old account. switchBenchmarking newAccount = do now <- liftIO $ getCPUTime -- Stop and bill current benchmarking. oldAccount <- getsBenchmark currentAccount Strict.whenJust oldAccount $ \ (acc, start) -> modifyBenchmark $ addCPUTime acc $ now - start -- Switch to new account. modifyBenchmark $ mapCurrentAccount $ const $ (, now) <$> newAccount return $ fst <$> oldAccount -- | Bill a computation to a specific account. -- Works even if the computation is aborted by an exception. billTo :: MonadBench a m => Account a -> m c -> m c billTo account m = ifNotM (getsBenchmark benchmarkOn) m $ do -- Switch to new account. old <- switchBenchmarking $ Strict.Just account -- Compute and switch back to old account. (liftIO . E.evaluate =<< m) `finally` switchBenchmarking old -- | Bill a pure computation to a specific account. billPureTo :: MonadBench a m => Account a -> c -> m c billPureTo account = billTo account . return Agda-2.4.2.5/src/full/Agda/Utils/Either.hs0000644000000000000000000000646112635075266016170 0ustar0000000000000000------------------------------------------------------------------------ -- | Utilities for the 'Either' type ------------------------------------------------------------------------ module Agda.Utils.Either ( whileLeft, caseEitherM , mapEither, mapLeft, mapRight , traverseEither , isLeft, isRight , fromLeft, fromRight , maybeLeft, maybeRight , allLeft, allRight , tests ) where import Control.Applicative import Agda.Utils.QuickCheck import Agda.Utils.TestHelpers -- | Loop while we have an exception. whileLeft :: Monad m => (a -> Either b c) -> (a -> b -> m a) -> (a -> c -> m d) -> a -> m d whileLeft test left right = loop where loop a = case test a of Left b -> loop =<< left a b Right c -> right a c -- | Monadic version of 'either' with a different argument ordering. caseEitherM :: Monad m => m (Either a b) -> (a -> m c) -> (b -> m c) -> m c caseEitherM mm f g = either f g =<< mm -- | 'Either' is a bifunctor. mapEither :: (a -> c) -> (b -> d) -> Either a b -> Either c d mapEither f g = either (Left . f) (Right . g) -- | 'Either _ b' is a functor. mapLeft :: (a -> c) -> Either a b -> Either c b mapLeft f = mapEither f id -- | 'Either a' is a functor. mapRight :: (b -> d) -> Either a b -> Either a d mapRight = mapEither id -- | 'Either' is bitraversable. traverseEither :: Functor f => (a -> f c) -> (b -> f d) -> Either a b -> f (Either c d) traverseEither f g = either (fmap Left . f) (fmap Right . g) -- | Returns 'True' iff the argument is @'Right' x@ for some @x@. -- Note: from @base >= 4.7.0.0@ already present in @Data.Either@. isRight :: Either a b -> Bool isRight (Right _) = True isRight (Left _) = False -- | Returns 'True' iff the argument is @'Left' x@ for some @x@. -- Note: from @base >= 4.7.0.0@ already present in @Data.Either@. isLeft :: Either a b -> Bool isLeft (Right _) = False isLeft (Left _) = True -- | Analogue of 'Data.Maybe.fromMaybe'. fromLeft :: (b -> a) -> Either a b -> a fromLeft = either id -- | Analogue of 'Data.Maybe.fromMaybe'. fromRight :: (a -> b) -> Either a b -> b fromRight f = either f id -- | Safe projection from 'Left'. -- @ -- maybeLeft (Left a) = Just a -- maybeLeft Right{} = Nothing -- @ maybeLeft :: Either a b -> Maybe a maybeLeft = either Just (const Nothing) -- | Safe projection from 'Right'. -- @ -- maybeRight (Right b) = Just b -- maybeRight Left{} = Nothing -- @ maybeRight :: Either a b -> Maybe b maybeRight = either (const Nothing) Just -- | Returns @'Just' @ if all elements are -- to the 'Left', and otherwise 'Nothing'. allLeft :: [Either a b] -> Maybe [a] allLeft = mapM maybeLeft -- | Returns @'Just' @ if all elements are -- to the right, and otherwise 'Nothing'. -- -- @ -- allRight xs == -- if all isRight xs then -- Just (map (\(Right x) -> x) xs) -- else -- Nothing -- @ allRight :: [Either a b] -> Maybe [b] allRight = mapM maybeRight prop_allRight :: Eq b => [Either t b] -> Bool prop_allRight xs = allRight xs == if all isRight xs then Just $ map (\ (Right x) -> x) xs else Nothing ------------------------------------------------------------------------ -- All tests tests :: IO Bool tests = runTests "Agda.Utils.Either" [ quickCheck' (prop_allRight :: [Either Integer Bool] -> Bool) ] Agda-2.4.2.5/src/full/Agda/Utils/Warshall.hs0000644000000000000000000004244512635075266016527 0ustar0000000000000000{-# LANGUAGE GeneralizedNewtypeDeriving #-} {- | Construct a graph from constraints @ x + n <= y becomes x ---(-n)---> y x <= n + y becomes x ---(+n)---> y @ the default edge (= no edge) is labelled with infinity. Building the graph involves keeping track of the node names. We do this in a finite map, assigning consecutive numbers to nodes. -} module Agda.Utils.Warshall where import Control.Applicative import Control.Monad.State import Data.Maybe import Data.Array import Data.List import Data.Map (Map) import qualified Data.Map as Map import Test.QuickCheck import Agda.Syntax.Common (Nat) import Agda.Utils.TestHelpers import Agda.Utils.SemiRing type Matrix a = Array (Int,Int) a -- assuming a square matrix warshall :: SemiRing a => Matrix a -> Matrix a warshall a0 = loop r a0 where b@((r,c),(r',c')) = bounds a0 -- assuming r == c and r' == c' loop k a | k <= r' = loop (k+1) (array b [ ((i,j), (a!(i,j)) `oplus` ((a!(i,k)) `otimes` (a!(k,j)))) | i <- [r..r'], j <- [c..c'] ]) | otherwise = a type AdjList node edge = Map node [(node, edge)] -- | Warshall's algorithm on a graph represented as an adjacency list. warshallG :: (SemiRing edge, Ord node) => AdjList node edge -> AdjList node edge warshallG g = fromMatrix $ warshall m where nodes = zip (nub $ Map.keys g ++ map fst (concat $ Map.elems g)) [0..] len = length nodes b = ((0,0), (len - 1,len - 1)) edge i j = do es <- Map.lookup i g foldr oplus Nothing [ Just v | (j', v) <- es, j == j' ] m = array b [ ((n, m), edge i j) | (i, n) <- nodes, (j, m) <- nodes ] fromMatrix matrix = Map.fromList $ do (i, n) <- nodes let es = [ (fst (nodes !! m), e) | m <- [0..len - 1] , Just e <- [matrix ! (n, m)] ] return (i, es) -- | Edge weight in the graph, forming a semi ring. data Weight = Finite Int | Infinite deriving (Eq) inc :: Weight -> Int -> Weight inc Infinite n = Infinite inc (Finite k) n = Finite (k + n) instance Show Weight where show (Finite i) = show i show Infinite = "." instance Ord Weight where a <= Infinite = True Infinite <= b = False Finite a <= Finite b = a <= b instance SemiRing Weight where ozero = Infinite oone = Finite 0 oplus = min otimes Infinite _ = Infinite otimes _ Infinite = Infinite otimes (Finite a) (Finite b) = Finite (a + b) -- constraints --------------------------------------------------- -- | Nodes of the graph are either -- - flexible variables (with identifiers drawn from @Int@), -- - rigid variables (also identified by @Int@s), or -- - constants (like 0, infinity, or anything between). data Node = Rigid Rigid | Flex FlexId deriving (Eq, Ord) data Rigid = RConst Weight | RVar RigidId deriving (Eq, Ord, Show) type NodeId = Int type RigidId = Int type FlexId = Int type Scope = RigidId -> Bool -- ^ Which rigid variables a flex may be instatiated to. instance Show Node where show (Flex i) = "?" ++ show i show (Rigid (RVar i)) = "v" ++ show i show (Rigid (RConst Infinite)) = "#" show (Rigid (RConst (Finite n))) = show n infinite :: Rigid -> Bool infinite (RConst Infinite) = True infinite _ = False -- | @isBelow r w r'@ -- checks, if @r@ and @r'@ are connected by @w@ (meaning @w@ not infinite), -- whether @r + w <= r'@. -- Precondition: not the same rigid variable. isBelow :: Rigid -> Weight -> Rigid -> Bool isBelow _ Infinite _ = True isBelow _ n (RConst Infinite) = True isBelow (RConst (Finite i)) (Finite n) (RConst (Finite j)) = i + n <= j isBelow _ _ _ = False -- rigid variables are not related -- | A constraint is an edge in the graph. data Constraint = NewFlex FlexId Scope | Arc Node Int Node -- ^ For @Arc v1 k v2@ at least one of @v1@ or @v2@ is a @MetaV@ (Flex), -- the other a @MetaV@ or a @Var@ (Rigid). -- If @k <= 0@ this means @suc^(-k) v1 <= v2@ -- otherwise @v1 <= suc^k v3@. instance Show Constraint where show (NewFlex i s) = "SizeMeta(?" ++ show i ++ ")" show (Arc v1 k v2) | k == 0 = show v1 ++ "<=" ++ show v2 | k < 0 = show v1 ++ "+" ++ show (-k) ++ "<=" ++ show v2 | otherwise = show v1 ++ "<=" ++ show v2 ++ "+" ++ show k type Constraints = [Constraint] emptyConstraints :: Constraints emptyConstraints = [] -- graph (matrix) ------------------------------------------------ data Graph = Graph { flexScope :: Map FlexId Scope -- ^ Scope for each flexible var. , nodeMap :: Map Node NodeId -- ^ Node labels to node numbers. , intMap :: Map NodeId Node -- ^ Node numbers to node labels. , nextNode :: NodeId -- ^ Number of nodes @n@. , graph :: NodeId -> NodeId -> Weight -- ^ The edges (restrict to @[0..n[@). } -- | The empty graph: no nodes, edges are all undefined (infinity weight). initGraph :: Graph initGraph = Graph Map.empty Map.empty Map.empty 0 (\ x y -> Infinite) -- | The Graph Monad, for constructing a graph iteratively. type GM = State Graph -- | Add a size meta node. addFlex :: FlexId -> Scope -> GM () addFlex x scope = do modify $ \ st -> st { flexScope = Map.insert x scope (flexScope st) } _ <- addNode (Flex x) return () -- | Lookup identifier of a node. -- If not present, it is added first. addNode :: Node -> GM Int addNode n = do st <- get case Map.lookup n (nodeMap st) of Just i -> return i Nothing -> do let i = nextNode st put $ st { nodeMap = Map.insert n i (nodeMap st) , intMap = Map.insert i n (intMap st) , nextNode = i + 1 } return i -- | @addEdge n1 k n2@ -- improves the weight of egde @n1->n2@ to be at most @k@. -- Also adds nodes if not yet present. addEdge :: Node -> Int -> Node -> GM () addEdge n1 k n2 = do i1 <- addNode n1 i2 <- addNode n2 st <- get let graph' x y = if (x,y) == (i1,i2) then Finite k `oplus` (graph st) x y else graph st x y put $ st { graph = graph' } addConstraint :: Constraint -> GM () addConstraint (NewFlex x scope) = addFlex x scope addConstraint (Arc n1 k n2) = addEdge n1 k n2 buildGraph :: Constraints -> Graph buildGraph cs = execState (mapM_ addConstraint cs) initGraph mkMatrix :: Int -> (Int -> Int -> Weight) -> Matrix Weight mkMatrix n g = array ((0,0),(n-1,n-1)) [ ((i,j), g i j) | i <- [0..n-1], j <- [0..n-1]] -- displaying matrices with row and column labels -------------------- -- | A matrix with row descriptions in @b@ and column descriptions in @c@. data LegendMatrix a b c = LegendMatrix { matrix :: Matrix a , rowdescr :: Int -> b , coldescr :: Int -> c } instance (Show a, Show b, Show c) => Show (LegendMatrix a b c) where show (LegendMatrix m rd cd) = -- first show column description let ((r,c),(r',c')) = bounds m in foldr (\ j s -> "\t" ++ show (cd j) ++ s) "" [c .. c'] ++ -- then output rows foldr (\ i s -> "\n" ++ show (rd i) ++ foldr (\ j t -> "\t" ++ show (m!(i,j)) ++ t) (s) [c .. c']) "" [r .. r'] -- solving the constraints ------------------------------------------- -- | A solution assigns to each flexible variable a size expression -- which is either a constant or a @v + n@ for a rigid variable @v@. type Solution = Map Int SizeExpr emptySolution :: Solution emptySolution = Map.empty extendSolution :: Solution -> Int -> SizeExpr -> Solution extendSolution subst k v = Map.insert k v subst data SizeExpr = SizeVar RigidId Int -- ^ e.g. x + 5 | SizeConst Weight -- ^ a number or infinity instance Show SizeExpr where show (SizeVar n 0) = show (Rigid (RVar n)) show (SizeVar n k) = show (Rigid (RVar n)) ++ "+" ++ show k show (SizeConst w) = show w -- | @sizeRigid r n@ returns the size expression corresponding to @r + n@ sizeRigid :: Rigid -> Int -> SizeExpr sizeRigid (RConst k) n = SizeConst (inc k n) sizeRigid (RVar i) n = SizeVar i n {- apply :: SizeExpr -> Solution -> SizeExpr apply e@(SizeExpr (Rigid _) _) phi = e apply e@(SizeExpr (Flex x) i) phi = case Map.lookup x phi of Nothing -> e Just (SizeExpr v j) -> SizeExpr v (i + j) after :: Solution -> Solution -> Solution after psi phi = Map.map (\ e -> e `apply` phi) psi -} {- compute solution a solution CANNOT exist if v < v for a rigid variable v -- Andreas, 2012-09-19 OUTDATED are: -- v <= v' for rigid variables v,v' -- x < v for a flexible variable x and a rigid variable v thus, for each flexible x, only one of the following cases is possible r+n <= x+m <= infty for a unique rigid r (meaning r --(m-n)--> x) x <= r+n for a unique rigid r (meaning x --(n)--> r) we are looking for the least values for flexible variables that solve the constraints. Algorithm while flexible variables and rigid rows left find a rigid variable row i for all flexible columns j if i --n--> j with n<=0 (meaning i+n <= j) then j = i + n while flexible variables j left search the row j for entry i if j --n--> i with n >= 0 (meaning j <= i + n) then j = i + n -} solve :: Constraints -> Maybe Solution solve cs = -- trace (show cs) $ -- trace (show lm0) $ -- trace (show lm) $ -- trace (show d) $ let solution = if solvable then loop1 flexs rigids emptySolution else Nothing in -- trace (show solution) $ solution where -- compute the graph and its transitive closure m gr = buildGraph cs n = nextNode gr -- number of nodes m0 = mkMatrix n (graph gr) m = warshall m0 -- tracing only: build output version of transitive graph legend i = fromJust $ Map.lookup i (intMap gr) -- trace only lm0 = LegendMatrix m0 legend legend -- trace only lm = LegendMatrix m legend legend -- trace only -- compute the sets of flexible and rigid node numbers ns = Map.keys (nodeMap gr) -- a set of flexible variables flexs = foldl' (\ l k -> case k of (Flex i) -> i : l (Rigid _) -> l) [] ns -- a set of rigid variables rigids = foldl' (\ l k -> case k of (Flex _) -> l (Rigid i) -> i : l) [] ns -- rigid matrix indices rInds = foldl' (\ l r -> let Just i = Map.lookup (Rigid r) (nodeMap gr) in i : l) [] rigids -- check whether there is a solution -- d = [ m!(i,i) | i <- [0 .. (n-1)] ] -- diagonal -- a rigid variable might not be less than it self, so no -.. on the -- rigid part of the diagonal solvable = all (\ x -> x >= Finite 0) [ m!(i,i) | i <- rInds ] && True {- Andreas, 2012-09-19 We now can have constraints between rigid variables, like i < j. Thus we skip the following two test. However, a solution must be checked for consistency with the constraints on rigid vars. -- a rigid variable might not be bounded below by infinity or -- bounded above by a constant -- it might not be related to another rigid variable all (\ (r, r') -> r == r' || let Just row = (Map.lookup (Rigid r) (nodeMap gr)) Just col = (Map.lookup (Rigid r') (nodeMap gr)) edge = m!(row,col) in isBelow r edge r' ) [ (r,r') | r <- rigids, r' <- rigids ] && -- a flexible variable might not be strictly below a rigid variable all (\ (x, v) -> let Just row = (Map.lookup (Flex x) (nodeMap gr)) Just col = (Map.lookup (Rigid (RVar v)) (nodeMap gr)) edge = m!(row,col) in edge >= Finite 0) [ (x,v) | x <- flexs, (RVar v) <- rigids ] -} inScope :: FlexId -> Rigid -> Bool inScope x (RConst _) = True inScope x (RVar v) = scope v where Just scope = Map.lookup x (flexScope gr) {- loop1 while flexible variables and rigid rows left find a rigid variable row i for all flexible columns j if i --n--> j with n<=0 (meaning i + n <= j) then j = i + n -} loop1 :: [FlexId] -> [Rigid] -> Solution -> Maybe Solution loop1 [] rgds subst = Just subst loop1 flxs [] subst = loop2 flxs subst loop1 flxs (r:rgds) subst = let row = fromJust $ Map.lookup (Rigid r) (nodeMap gr) (flxs',subst') = foldl' (\ (flx,sub) f -> let col = fromJust $ Map.lookup (Flex f) (nodeMap gr) in case (inScope f r, m!(row,col)) of -- Finite z | z <= 0 -> (True, Finite z) -> let trunc z | z >= 0 = 0 | otherwise = -z in (flx, extendSolution sub f (sizeRigid r (trunc z))) _ -> (f : flx, sub) ) ([], subst) flxs in loop1 flxs' rgds subst' {- loop2 while flexible variables j left search the row j for entry i if j --n--> i with n >= 0 (meaning j <= i + n) then j = i -} loop2 :: [FlexId] -> Solution -> Maybe Solution loop2 [] subst = Just subst loop2 (f:flxs) subst = loop3 0 subst where row = fromJust $ Map.lookup (Flex f) (nodeMap gr) loop3 col subst | col >= n = -- default to infinity loop2 flxs (extendSolution subst f (SizeConst Infinite)) loop3 col subst = case Map.lookup col (intMap gr) of Just (Rigid r) | not (infinite r) -> case (inScope f r, m!(row,col)) of (True, Finite z) | z >= 0 -> loop2 flxs (extendSolution subst f (sizeRigid r z)) (_, Infinite) -> loop3 (col+1) subst _ -> -- trace ("unusable rigid: " ++ show r ++ " for flex " ++ show f) Nothing -- NOT: loop3 (col+1) subst _ -> loop3 (col+1) subst -- Testing ---------------------------------------------------------------- genGraph :: Ord node => Float -> Gen edge -> [node] -> Gen (AdjList node edge) genGraph density edge nodes = do Map.fromList . concat <$> mapM neighbours nodes where k = round (100 * density) neighbours n = do ns <- concat <$> mapM neighbour nodes case ns of [] -> elements [[(n, [])], []] _ -> return [(n, ns)] neighbour n = frequency [ (k, do e <- edge ns <- neighbour n return ((n, e):ns)) , (100 - k, return []) ] type Distance = Weight genGraph_ :: Nat -> Gen (AdjList Nat Distance) genGraph_ n = genGraph 0.2 (Finite <$> natural) [0..n - 1] lookupEdge :: Ord n => n -> n -> AdjList n e -> Maybe e lookupEdge i j g = lookup j =<< Map.lookup i g edges :: Ord n => AdjList n e -> [(n,n,e)] edges g = do (i, ns) <- Map.toList g (j, e) <- ns return (i, j, e) -- | Check that no edges get longer when completing a graph. prop_smaller :: Nat -> Property prop_smaller n' = forAll (genGraph_ n) $ \g -> let g' = warshallG g in and [ lookupEdge i j g' =< e | (i, j, e) <- edges g ] where n = abs (div n' 2) Nothing =< _ = False Just x =< y = x <= y newEdge :: Nat -> Nat -> Distance -> AdjList Nat Distance -> AdjList Nat Distance newEdge i j e = Map.insertWith (++) i [(j, e)] genPath :: Nat -> Nat -> Nat -> AdjList Nat Distance -> Gen (AdjList Nat Distance) genPath n i j g = do es <- listOf $ (,) <$> node <*> edge v <- edge return $ addPath i (es ++ [(j, v)]) g where edge :: Gen Distance edge = Finite <$> natural node :: Gen Nat node = choose (0, n - 1) addPath :: Nat -> [(Nat, Distance)] -> AdjList Nat Distance -> AdjList Nat Distance addPath _ [] g = g addPath i ((j, v):es) g = newEdge i j v $ addPath j es g -- | Check that all transitive edges are added. prop_path :: Nat -> Property prop_path n' = forAll (genGraph_ n) $ \g -> forAll (two $ choose (0, n - 1)) $ \(i, j) -> forAll (genPath n i j g) $ \g' -> isJust (lookupEdge i j $ warshallG g') where n = abs (div n' 2) + 1 mapNodes :: (Ord node, Ord node') => (node -> node') -> AdjList node edge -> AdjList node' edge mapNodes f = Map.map f' . Map.mapKeys f where f' es = [ (f n, e) | (n,e) <- es ] -- | Check that no edges are added between components. prop_disjoint :: Nat -> Property prop_disjoint n' = forAll (two $ genGraph_ n) $ \(g1, g2) -> let g = Map.union (mapNodes Left g1) (mapNodes Right g2) g' = warshallG g in all disjoint (Map.assocs g') where n = abs (div n' 3) disjoint (Left i, es) = all (isLeft . fst) es disjoint (Right i, es) = all (isRight . fst) es isLeft = either (const True) (const False) isRight = not . isLeft prop_stable :: Nat -> Property prop_stable n' = forAll (genGraph_ n) $ \g -> let g' = warshallG g in g' =~= warshallG g' where n = abs (div n' 2) g =~= g' = sort (edges g) == sort (edges g') tests :: IO Bool tests = runTests "Agda.Utils.Warshall" [] Agda-2.4.2.5/src/full/Agda/Utils/AssocList.hs0000644000000000000000000000437612635075266016657 0ustar0000000000000000{-# LANGUAGE CPP #-} {-# LANGUAGE TupleSections #-} -- | Additional functions for association lists. module Agda.Utils.AssocList where import Prelude hiding (lookup) import Control.Applicative import Data.Functor import qualified Data.List as List import Agda.Utils.Tuple #include "undefined.h" import Agda.Utils.Impossible -- | A finite map, represented as a set of pairs. -- -- Invariant: at most one value per key. type AssocList k v = [(k,v)] -- | O(n). -- Reexport 'List.lookup'. lookup :: Eq k => k -> AssocList k v -> Maybe v lookup = List.lookup -- | O(n). -- Get the domain (list of keys) of the finite map. keys :: AssocList k v -> [k] keys = map fst -- | O(1). -- Add a new binding. -- Assumes the binding is not yet in the list. insert :: k -> v -> AssocList k v -> AssocList k v insert k v = ((k,v) :) -- | O(n). -- Update the value at a key. -- The key must be in the domain of the finite map. -- Otherwise, an internal error is raised. update :: Eq k => k -> v -> AssocList k v -> AssocList k v update k v = updateAt k $ const v -- | O(n). -- Update the value at a key with a certain function. -- The key must be in the domain of the finite map. -- Otherwise, an internal error is raised. updateAt :: Eq k => k -> (v -> v) -> AssocList k v -> AssocList k v updateAt k f = loop where loop [] = __IMPOSSIBLE__ loop (p@(k',v) : ps) | k == k' = (k, f v) : ps | otherwise = p : loop ps -- | O(n). -- Map over an association list, preserving the order. mapWithKey :: (k -> v -> v) -> AssocList k v -> AssocList k v mapWithKey f = map $ \ (k,v) -> (k, f k v) -- | O(n). -- If called with a effect-producing function, violation of the invariant -- could matter here (duplicating effects). mapWithKeyM :: (Functor m, Applicative m) => (k -> v -> m v) -> AssocList k v -> m (AssocList k v) mapWithKeyM f = mapM $ \ (k,v) -> (k,) <$> f k v where -- mapM is applicative! mapM g [] = pure [] mapM g (x : xs) = (:) <$> g x <*> mapM g xs -- | O(n). -- Named in analogy to 'Data.Map.mapKeysMonotonic'. -- To preserve the invariant, it is sufficient that the key -- transformation is injective (rather than monotonic). mapKeysMonotonic :: (k -> k') -> AssocList k v -> AssocList k' v mapKeysMonotonic f = map $ mapFst f Agda-2.4.2.5/src/full/Agda/Utils/Hash.hs0000644000000000000000000000173712635075266015634 0ustar0000000000000000{-| Instead of checking time-stamps we compute a hash of the module source and store it in the interface file. This module contains the functions to do that. -} module Agda.Utils.Hash where import Data.ByteString as B import Data.Word import qualified Data.Hash as H import qualified Data.List as L import Agda.Utils.FileName type Hash = Word64 hashByteString :: ByteString -> Hash hashByteString = H.asWord64 . B.foldl' (\h b -> H.combine h (H.hashWord8 b)) (H.hashWord8 0) hashFile :: AbsolutePath -> IO Hash hashFile file = do s <- B.readFile (filePath file) return $ hashByteString s combineHashes :: [Hash] -> Hash combineHashes hs = H.asWord64 $ L.foldl' H.combine (H.hashWord8 0) $ L.map H.hash hs -- | Hashing a module name for unique identifiers. hashString :: String -> Integer hashString = Prelude.foldr step 0 where step c n = mod (fromIntegral (fromEnum c) * prime1 + n * prime2) prime3 prime1 = 1230371 prime2 = 446441 prime3 = 275604541 Agda-2.4.2.5/src/full/Agda/Utils/Char.hs0000644000000000000000000000340112635075266015614 0ustar0000000000000000module Agda.Utils.Char where import Data.Char -- | Convert a character in @'0'..'9'@ into the corresponding digit @0..9@. decDigit :: Char -> Int decDigit c = ord c - ord '0' -- | Convert a character in @'0'..'9','A'..'F','a'..'f'@ -- into the corresponding digit @0..15@. hexDigit :: Char -> Int hexDigit c | isDigit c = decDigit c | otherwise = ord (toLower c) - ord 'a' + 10 -- | Convert a character in @'0'..'7'@ into the corresponding digit @0..7@. octDigit :: Char -> Int octDigit = decDigit ------------------------------------------------------------------------ -- * Unicode exploration ------------------------------------------------------------------------ -- | Unicode characters are divided into letters, numbers, marks, -- punctuation, symbols, separators (including spaces) and others -- (including control characters). -- -- These are the tests that 'Data.Char' offers data UnicodeTest = IsControl | IsSpace | IsLower | IsUpper | IsAlpha | IsAlphaNum | IsPrint | IsDigit | IsOctDigit | IsHexDigit | IsLetter | IsMark | IsNumber | IsPunctuation | IsSymbol | IsSeparator deriving (Eq, Ord, Show) -- | Test names paired with their implementation. unicodeTests :: [(UnicodeTest, Char -> Bool)] unicodeTests = [ (IsControl, isControl), (IsSpace, isSpace) , (IsLower, isLower), (IsUpper, isUpper), (IsAlpha, isAlpha) , (IsAlphaNum, isAlphaNum) , (IsPrint, isPrint) , (IsDigit, isDigit), (IsOctDigit, isOctDigit), (IsHexDigit, isHexDigit) , (IsLetter, isLetter), (IsMark, isMark) , (IsNumber, isNumber), (IsPunctuation, isPunctuation), (IsSymbol, isSymbol) , (IsSeparator, isSeparator) ] -- | Find out which tests a character satisfies. testChar :: Char -> [UnicodeTest] testChar c = map fst $ filter (($ c) . snd) unicodeTests Agda-2.4.2.5/src/full/Agda/Utils/SemiRing.hs0000644000000000000000000000133612635075266016461 0ustar0000000000000000module Agda.Utils.SemiRing where -- | Semirings (). class SemiRing a where ozero :: a oone :: a oplus :: a -> a -> a otimes :: a -> a -> a instance SemiRing a => SemiRing (Maybe a) where ozero = Nothing oone = Just oone oplus Nothing y = y oplus x Nothing = x oplus (Just x) (Just y) = Just (oplus x y) otimes Nothing _ = Nothing otimes _ Nothing = Nothing otimes (Just x) (Just y) = Just (otimes x y) -- | Star semirings -- (). class SemiRing a => StarSemiRing a where ostar :: a -> a instance StarSemiRing a => StarSemiRing (Maybe a) where ostar Nothing = oone ostar (Just x) = Just (ostar x) Agda-2.4.2.5/src/full/Agda/Utils/Size.hs0000644000000000000000000000355212635075266015660 0ustar0000000000000000-- | Collection size. -- -- For 'TermSize' see "Agda.Syntax.Internal". module Agda.Utils.Size ( Sized(..) , SizedThing(..) , sizeThing ) where import Prelude hiding (null) import Data.HashMap.Strict (HashMap) import qualified Data.HashMap.Strict as HashMap import Data.HashSet (HashSet) import qualified Data.HashSet as HashSet import Data.IntMap (IntMap) import qualified Data.IntMap as IntMap import Data.IntSet (IntSet) import qualified Data.IntSet as IntSet import Data.Map (Map) import qualified Data.Map as Map import Data.Set (Set) import qualified Data.Set as Set import Data.Sequence (Seq) import qualified Data.Sequence as Seq import qualified Data.List as List import Agda.Utils.Null -- | The size of a collection (i.e., its length). -- -- Should fit into an @Int@. TODO: change to @Int@. class Sized a where size :: Integral n => a -> n instance Sized [a] where size = List.genericLength instance Sized (IntMap a) where size = fromIntegral . IntMap.size instance Sized IntSet where size = fromIntegral . IntSet.size instance Sized (Map k a) where size = fromIntegral . Map.size instance Sized (Set a) where size = fromIntegral . Set.size instance Sized (HashMap k a) where size = fromIntegral . HashMap.size instance Sized (HashSet a) where size = fromIntegral . HashSet.size instance Sized (Seq a) where size = fromIntegral . Seq.length -- | Thing decorated with its size. -- The thing should fit into main memory, thus, the size is an @Int@. data SizedThing a = SizedThing { theSize :: !Int , sizedThing :: a } -- | Cache the size of an object. sizeThing :: Sized a => a -> SizedThing a sizeThing a = SizedThing (size a) a -- | Return the cached size. instance Sized (SizedThing a) where size = fromIntegral . theSize instance Null a => Null (SizedThing a) where empty = SizedThing 0 empty null = null . sizedThing Agda-2.4.2.5/src/full/Agda/Utils/Pointer.hs0000644000000000000000000000357112635075266016367 0ustar0000000000000000{-# LANGUAGE DeriveDataTypeable #-} module Agda.Utils.Pointer ( Ptr, newPtr, derefPtr, setPtr , updatePtr, updatePtrM ) where import Control.Applicative import Control.DeepSeq import Control.Concurrent.MVar import Data.Foldable import Data.Function import Data.Hashable import Data.IORef import Data.Traversable import System.IO.Unsafe import Data.Typeable ( Typeable ) data Ptr a = Ptr { ptrTag :: !Integer , ptrRef :: !(IORef a) } deriving (Typeable) {-# NOINLINE freshVar #-} freshVar :: MVar Integer freshVar = unsafePerformIO $ newMVar 0 fresh :: IO Integer fresh = do x <- takeMVar freshVar putMVar freshVar $! x + 1 return x {-# NOINLINE newPtr #-} newPtr :: a -> Ptr a newPtr x = unsafePerformIO $ do i <- fresh Ptr i <$> newIORef x derefPtr :: Ptr a -> a derefPtr p = unsafePerformIO $ readIORef $ ptrRef p {-# NOINLINE updatePtr #-} updatePtr :: (a -> a) -> Ptr a -> Ptr a updatePtr f p = unsafePerformIO $ p <$ modifyIORef (ptrRef p) f setPtr :: a -> Ptr a -> Ptr a setPtr x = updatePtr (const x) -- | If @f a@ contains many copies of @a@ they will all be the same pointer in -- the result. If the function is well-behaved (i.e. preserves the implicit -- equivalence, this shouldn't matter). updatePtrM :: Functor f => (a -> f a) -> Ptr a -> f (Ptr a) updatePtrM f p = flip setPtr p <$> f (derefPtr p) instance Show a => Show (Ptr a) where show p = "#" ++ show (ptrTag p) ++ "{" ++ show (derefPtr p) ++ "}" instance Functor Ptr where fmap f = newPtr . f . derefPtr instance Foldable Ptr where foldMap f = f . derefPtr instance Traversable Ptr where traverse f p = newPtr <$> f (derefPtr p) instance Eq (Ptr a) where (==) = (==) `on` ptrTag instance Ord (Ptr a) where compare = compare `on` ptrTag instance Hashable (Ptr a) where hashWithSalt salt = (hashWithSalt salt) . ptrTag instance NFData (Ptr a) where rnf x = seq x () Agda-2.4.2.5/src/full/Agda/Utils/Function.hs0000644000000000000000000001020012635075266016517 0ustar0000000000000000{-# LANGUAGE TupleSections #-} module Agda.Utils.Function where -- | Repeat a state transition @f :: a -> (b, a)@ with output @b@ -- while condition @cond@ on the output is true. -- Return all intermediate results and the final result -- where @cond@ is @False@. -- -- Postconditions (when it terminates): -- @fst (last (iterWhile cond f a)) == False@. -- @all fst (init (interWhile cond f a))@. iterWhile :: (b -> Bool) -> (a -> (b, a)) -> a -> [(b,a)] iterWhile cond f = loop where loop a = r : if cond b then loop a' else [] where r@(b, a') = f a -- | Repeat something while a condition on some state is true. -- Return the last state (including the changes of the last -- transition, even if the condition became false then). repeatWhile :: (a -> (Bool, a)) -> a -> a repeatWhile f = loop where loop a = if again then loop a' else a' where (again, a') = f a -- | Monadic version of 'repeatWhile'. repeatWhileM :: (Monad m) => (a -> m (Bool, a)) -> a -> m a repeatWhileM f = loop where loop a = do (again, a') <- f a if again then loop a' else return a' -- | A version of the trampoline function. -- -- The usual function iterates @f :: a -> Maybe a@ as long -- as @Just{}@ is returned, and returns the last value of @a@ -- upon @Nothing@. -- -- @usualTrampoline f = trampolineWhile $ \ a -> maybe (False,a) (True,) (f a)@. -- -- @trampolineWhile@ is very similar to @repeatWhile@, only that -- it discards the state on which the condition went @False@, -- and returns the last state on which the condition was @True@. trampolineWhile :: (a -> (Bool, a)) -> a -> a trampolineWhile f = repeatWhile $ \ a -> let (again, a') = f a in (again,) $ if again then a' else a -- | Monadic version of 'trampolineWhile'. trampolineWhileM :: (Monad m) => (a -> m (Bool, a)) -> a -> m a trampolineWhileM f = repeatWhileM $ \ a -> do (again, a') <- f a return $ (again,) $ if again then a' else a -- | More general trampoline, which allows some final computation -- from iteration state @a@ into result type @b@. trampoline :: (a -> Either b a) -> a -> b trampoline f = loop where loop a = either id loop $ f a -- | Monadic version of 'trampoline'. trampolineM :: Monad m => (a -> m (Either b a)) -> a -> m b trampolineM f = loop where loop a = either return loop =<< f a -- | Iteration to fixed-point. -- -- @iterateUntil r f a0@ iterates endofunction @f@, starting with @a0@, -- until @r@ relates its result to its input, i.e., @f a `r` a@. -- -- This is the generic pattern behind saturation algorithms. -- -- If @f@ is monotone with regard to @r@, -- meaning @a `r` b@ implies @f a `r` f b@, -- and @f@-chains starting with @a0@ are finite -- then iteration is guaranteed to terminate. -- -- A typical instance will work on sets, and @r@ could be set inclusion, -- and @a0@ the empty set, and @f@ the step function of a saturation algorithm. iterateUntil :: (a -> a -> Bool) -> (a -> a) -> a -> a iterateUntil r f = loop where loop a = if r a' a then a' else loop a' where a' = f a -- | Monadic version of 'iterateUntil'. iterateUntilM :: Monad m => (a -> a -> Bool) -> (a -> m a) -> a -> m a iterateUntilM r f = loop where loop a = do a' <- f a if r a' a then return a' else loop a' -- | @'iterate'' n f x@ applies @f@ to @x@ @n@ times and returns the -- result. -- -- The applications are calculated strictly. iterate' :: Integral i => i -> (a -> a) -> a -> a iterate' 0 f x = x iterate' n f x | n > 0 = iterate' (n - 1) f $! f x | otherwise = error "iterate': Negative input." -- * Iteration over Booleans. -- | @applyWhen b f a@ applies @f@ to @a@ when @b@. applyWhen :: Bool -> (a -> a) -> a -> a applyWhen b f = if b then f else id -- | @applyUnless b f a@ applies @f@ to @a@ unless @b@. applyUnless :: Bool -> (a -> a) -> a -> a applyUnless b f = if b then id else f -- | Monadic version of @applyWhen@ applyWhenM :: (Monad m) => m Bool -> (m a -> m a) -> m a -> m a applyWhenM mb f x = mb >>= \ b -> applyWhen b f x -- | Monadic version of @applyUnless@ applyUnlessM :: (Monad m) => m Bool -> (m a -> m a) -> m a -> m a applyUnlessM mb f x = mb >>= \ b -> applyUnless b f x Agda-2.4.2.5/src/full/Agda/Utils/FileName.hs0000644000000000000000000001116612635075266016426 0ustar0000000000000000{-# LANGUAGE CPP #-} {-# LANGUAGE DeriveDataTypeable #-} {-# LANGUAGE GeneralizedNewtypeDeriving #-} {-| Operations on file names. -} module Agda.Utils.FileName ( AbsolutePath , filePath , rootName , mkAbsolute , absolute , (===) , doesFileExistCaseSensitive , tests ) where import Control.Applicative import System.Directory import System.FilePath #if mingw32_HOST_OS import Control.Exception (bracket) import System.Win32 (findFirstFile, findClose, getFindDataFileName) #endif import Data.ByteString.Char8 (ByteString) import qualified Data.ByteString.Char8 as ByteString import Data.Function import Data.Hashable import Data.Typeable (Typeable) import Agda.Utils.Pretty import Agda.Utils.TestHelpers import Agda.Utils.QuickCheck #include "undefined.h" import Agda.Utils.Impossible -- | Paths which are known to be absolute. -- -- Note that the 'Eq' and 'Ord' instances do not check if different -- paths point to the same files or directories. -- -- Andreas, 2014-03-30: -- For efficiency of serialization, 'AbsolutePath' is implemented -- as 'ByteString' which short-cuts equality testing using -- pointer equality. This saves 20% of the serialization time -- of the standard library! newtype AbsolutePath = AbsolutePath { byteStringPath :: ByteString } deriving (Eq, Ord, Typeable, Hashable) -- | Extract the 'AbsolutePath' to be used as 'FilePath'. filePath :: AbsolutePath -> FilePath filePath = ByteString.unpack . byteStringPath -- TODO: 'Show' should output Haskell-parseable representations. -- The following instance is deprecated, and Pretty should be used -- instead. Later, simply derive Show for this type. instance Show AbsolutePath where show = filePath instance Pretty AbsolutePath where pretty = text . filePath -- | The paths have to be absolute, valid and normalised, without -- trailing path separators. absolutePathInvariant :: AbsolutePath -> Bool absolutePathInvariant x = isAbsolute f && isValid f && f == normalise f && f == dropTrailingPathSeparator f where f = filePath x -- | Constructs 'AbsolutePath's. -- -- Precondition: The path must be absolute and valid. mkAbsolute :: FilePath -> AbsolutePath mkAbsolute f | isAbsolute f = AbsolutePath $ ByteString.pack $ dropTrailingPathSeparator $ normalise f | otherwise = __IMPOSSIBLE__ #if mingw32_HOST_OS prop_mkAbsolute :: FilePath -> Property #else prop_mkAbsolute :: FilePath -> Bool #endif prop_mkAbsolute f = let path = rootPath ++ f in #if mingw32_HOST_OS isValid path ==> #endif absolutePathInvariant $ mkAbsolute $ path rootPath :: FilePath #if mingw32_HOST_OS rootPath = joinDrive "C:" [pathSeparator] #else rootPath = [pathSeparator] #endif -- | maps @/bla/bla/bla/foo.bar.xxx@ to @foo.bar@. rootName :: AbsolutePath -> String rootName = dropExtension . snd . splitFileName . filePath -- | Makes the path absolute. -- -- This function may raise an @\_\_IMPOSSIBLE\_\_@ error if -- 'canonicalizePath' does not return an absolute path. absolute :: FilePath -> IO AbsolutePath absolute f = mkAbsolute <$> do -- canonicalizePath sometimes truncates paths pointing to -- non-existing files/directories. ex <- doesFileExist f .||. doesDirectoryExist f if ex then canonicalizePath f else do cwd <- getCurrentDirectory return (cwd f) where m1 .||. m2 = do b1 <- m1 if b1 then return True else m2 -- | Tries to establish if the two file paths point to the same file -- (or directory). infix 4 === (===) :: AbsolutePath -> AbsolutePath -> Bool (===) = equalFilePath `on` filePath -- | Case-sensitive doesFileExist for Windows. -- This is case-sensitive only on the file name part, not on the directory part. -- (Ideally, path components coming from module name components should be -- checked case-sensitively and the other path components should be checked -- case insenstively.) doesFileExistCaseSensitive :: FilePath -> IO Bool #if mingw32_HOST_OS doesFileExistCaseSensitive f = do ex <- doesFileExist f if ex then bracket (findFirstFile f) (findClose . fst) $ fmap (takeFileName f ==) . getFindDataFileName . snd else return False #else doesFileExistCaseSensitive f = doesFileExist f #endif ------------------------------------------------------------------------ -- Generators instance Arbitrary AbsolutePath where arbitrary = mk . take 3 . map (take 2) <$> listOf (listOf1 (elements "a1")) where mk ps = mkAbsolute (joinPath $ rootPath : ps) ------------------------------------------------------------------------ -- All tests tests :: IO Bool tests = runTests "Agda.Utils.FileName" [ quickCheck' absolutePathInvariant , quickCheck' prop_mkAbsolute ] Agda-2.4.2.5/src/full/Agda/Utils/Favorites.hs0000644000000000000000000001552712635075266016715 0ustar0000000000000000{-# LANGUAGE CPP #-} {-# LANGUAGE DeriveFoldable #-} {-# LANGUAGE GeneralizedNewtypeDeriving #-} {-# LANGUAGE ScopedTypeVariables #-} {-# LANGUAGE TemplateHaskell #-} -- | Maintaining a list of favorites of some partially ordered type. -- Only the best elements are kept. -- -- To avoid name clashes, import this module qualified, as in -- @ -- import Agda.Utils.Favorites (Favorites) -- import qualified Agda.Utils.Favorites as Fav -- @ module Agda.Utils.Favorites where import Prelude hiding ( null ) import Control.Monad import Data.Bool import Data.Eq import Data.Ord import Data.Foldable (Foldable) import Data.Functor import Data.Function import Data.Monoid import Data.List (all, (++)) import qualified Data.List as List import Data.Set (Set) import qualified Data.Set as Set import Data.Tuple (uncurry) import System.IO import Text.Show import Test.QuickCheck.All import Agda.Utils.Null import Agda.Utils.PartialOrd hiding (tests) import Agda.Utils.QuickCheck import Agda.Utils.Singleton import Agda.Utils.TestHelpers import Agda.Utils.Tuple #include "undefined.h" import Agda.Utils.Impossible -- | A list of incomparable favorites. newtype Favorites a = Favorites { toList :: [a] } deriving (Foldable, Show, CoArbitrary, Null, Singleton a) -- | Equality checking is a bit expensive, since we need to sort! -- Maybe use a 'Set' of favorites in the first place? instance Ord a => Eq (Favorites a) where as == bs = Set.fromList (toList as) == Set.fromList (toList bs) -- | Result of comparing a candidate with the current favorites. data CompareResult a = Dominates { dominated :: [a], notDominated :: [a] } -- ^ Great, you are dominating a possibly (empty list of favorites) -- but there is also a rest that is not dominated. -- If @null dominated@, then @notDominated@ is necessarily the -- complete list of favorites. | IsDominated { dominator :: a } -- ^ Sorry, but you are dominated by that favorite. -- | Gosh, got some pretty @a@ here, compare with my current favorites! -- Discard it if there is already one that is better or equal. -- (Skewed conservatively: faithful to the old favorites.) -- If there is no match for it, add it, and -- dispose of all that are worse than @a@. -- -- We require a partial ordering. Less is better! (Maybe paradoxically.) compareWithFavorites :: PartialOrd a => a -> Favorites a -> CompareResult a compareWithFavorites a favs = loop $ toList favs where loop [] = Dominates [] [] loop as@(b : bs) = case comparable a b of POLT -> dominates b $ loop bs -- @a@ is a new favorite, bye-bye, @b@ POLE -> dominates b $ loop bs -- ditto POEQ -> IsDominated b -- @b@ is as least as good as @a@, bye-bye, @a@ POGE -> IsDominated b -- ditto POGT -> IsDominated b -- ditto POAny -> doesnotd b $ loop bs -- don't know, compare with my other favorites -- add an outperformed favorite dominates b (Dominates bs as) = Dominates (b : bs) as dominates b r@IsDominated{} = r -- add an uncomparable favorite doesnotd b (Dominates as bs) = Dominates as (b : bs) doesnotd b r@IsDominated{} = r -- | Compare a new set of favorites to an old one and discard -- the new favorites that are dominated by the old ones -- and vice verse. -- (Skewed conservatively: faithful to the old favorites.) -- -- @compareFavorites new old = (new', old')@ compareFavorites :: PartialOrd a => Favorites a -> Favorites a -> (Favorites a, Favorites a) compareFavorites new old = mapFst Favorites $ loop (toList new) old where loop [] old = ([], old) loop (a : new) old = case compareWithFavorites a old of -- Better: Discard all @old@ ones that @a@ dominates and keep @a@ Dominates _ old -> mapFst (a:) $ loop new (Favorites old) -- Not better: Discard @a@ IsDominated{} -> loop new old unionCompared :: PartialOrd a => (Favorites a, Favorites a) -> Favorites a unionCompared (Favorites new, Favorites old) = Favorites $ new ++ old -- | After comparing, do the actual insertion. insertCompared :: PartialOrd a => a -> Favorites a -> CompareResult a -> Favorites a insertCompared a _ (Dominates _ as) = Favorites (a : as) insertCompared _ l IsDominated{} = l -- | Compare, then insert accordingly. -- @insert a l = insertCompared a l (compareWithFavorites a l)@ insert :: PartialOrd a => a -> Favorites a -> Favorites a insert a l = insertCompared a l (compareWithFavorites a l) -- | Insert all the favorites from the first list into the second. union :: PartialOrd a => Favorites a -> Favorites a -> Favorites a union (Favorites as) bs = List.foldr insert bs as -- | Construct favorites from elements of a partial order. -- The result depends on the order of the list if it -- contains equal elements, since earlier seen elements -- are favored over later seen equals. -- The first element of the list is seen first. fromList :: PartialOrd a => [a] -> Favorites a fromList = List.foldl' (flip insert) empty -- | 'Favorites' forms a 'Monoid' under 'empty' and 'union. instance PartialOrd a => Monoid (Favorites a) where mempty = empty mappend = union ------------------------------------------------------------------------ -- * Properties ------------------------------------------------------------------------ instance (PartialOrd a, Arbitrary a) => Arbitrary (Favorites a) where arbitrary = fromList <$> arbitrary property_null_empty :: Bool property_null_empty = null (empty :: Favorites ()) property_not_null_singleton :: forall a. a -> Bool property_not_null_singleton x = not $ null (singleton x :: Favorites a) -- Remember: less is better! prop_compareWithFavorites :: ISet -> Favorites ISet -> Bool prop_compareWithFavorites a@ISet{} as = case compareWithFavorites a as of Dominates dominated notDominated -> all (related a POLT) dominated && all (related a POAny) notDominated IsDominated dominator -> related a POGE dominator prop_fromList_after_toList :: Favorites ISet -> Bool prop_fromList_after_toList as = fromList (toList as) == as -- | A second way to compute the 'union' is to use 'compareFavorites'. prop_union_union2 :: Favorites ISet -> Favorites ISet -> Bool prop_union_union2 as bs = union as bs == union2 as bs where union2 as bs = unionCompared $ compareFavorites as bs ------------------------------------------------------------------------ -- * All tests ------------------------------------------------------------------------ -- Template Haskell hack to make the following $quickCheckAll work -- under ghc-7.8. return [] -- KEEP! -- | All tests as collected by 'quickCheckAll'. -- -- Using 'quickCheckAll' is convenient and superior to the manual -- enumeration of tests, since the name of the property is -- added automatically. tests :: IO Bool tests = do putStrLn "Agda.Utils.Favorites" $quickCheckAll Agda-2.4.2.5/src/full/Agda/Utils/Cluster.hs0000644000000000000000000001127012635075266016363 0ustar0000000000000000-- {-# LANGUAGE FlexibleInstances #-} {-# LANGUAGE TemplateHaskell #-} -- {-# LANGUAGE TupleSections #-} -- | Create clusters of non-overlapping things. module Agda.Utils.Cluster ( cluster , cluster' , tests ) where import Control.Monad -- An imperative union-find library: import Data.Equivalence.Monad import Data.Char import Data.Functor import qualified Data.IntMap as IntMap import Data.List import Test.QuickCheck import Test.QuickCheck.All import Test.QuickCheck.Function import Text.Show.Functions -- | Characteristic identifiers. type C = Int -- | Given a function @f :: a -> (C,[C])@ which returns a non-empty list of -- characteristics @C@ of @a@, partition a list of @a@s into groups -- such that each element in a group shares at least one characteristic -- with at least one other element of the group. cluster :: (a -> (C,[C])) -> [a] -> [[a]] cluster f as = cluster' $ map (\ a -> (a, f a)) as -- | Partition a list of @a@s paired with a non-empty list of -- characteristics $C$ into groups -- such that each element in a group shares at least one characteristic -- with at least one other element of the group. cluster' :: [(a,(C,[C]))] -> [[a]] cluster' acs = runEquivM id const $ do -- Construct the equivalence classes of characteristics. forM_ acs $ \ (_,(c,cs)) -> equateAll $ c:cs -- Pair each element with its class. cas <- forM acs $ \ (a,(c,_)) -> (`IntMap.singleton` [a]) <$> classDesc c -- Create a map from class to elements. let m = IntMap.unionsWith (++) cas -- Return the values of the map return $ IntMap.elems m ------------------------------------------------------------------------ -- * Properties ------------------------------------------------------------------------ -- instance Show (Int -> (C, [C])) where -- show f = "function " ++ show (map (\ x -> (x, f x)) [-10..10]) -- Fundamental properties: soundness and completeness -- | Not too many clusters. (Algorithm equated all it could.) -- -- Each element in a cluster shares a characteristic with at least one -- other element in the same cluster. prop_cluster_complete :: Fun Int (C, [C]) -> [Int] -> Bool prop_cluster_complete (Fun _ f) as = (`all` cluster f as) $ \ cl -> (`all` cl) $ \ a -> let csa = uncurry (:) $ f a in let cl' = delete a cl in -- Either a is the single element of the cluster, or it shares a characteristic c -- with some other element b of the same cluster. null cl' || not (null [ (b,c) | b <- cl', c <- uncurry (:) (f b), c `elem` csa ]) -- | Not too few clusters. (Algorithm did not equate too much.) -- -- Elements of different clusters share no characteristics. prop_cluster_sound :: Fun Int (C, [C]) -> [Int] -> Bool prop_cluster_sound (Fun _ f) as = (`all` [ (c, d) | let cs = cluster f as, c <- cs, d <- cs, c /= d]) $ \ (c, d) -> (`all` c) $ \ a -> (`all` d) $ \ b -> null $ (uncurry (:) $ f a) `intersect` (uncurry (:) $ f b) neToList :: (a, [a]) -> [a] neToList = uncurry (:) isSingleton, exactlyTwo, atLeastTwo :: [a] -> Bool isSingleton x = length x == 1 exactlyTwo x = length x == 2 atLeastTwo x = length x >= 2 prop_cluster_empty :: Bool prop_cluster_empty = null (cluster (const (0,[])) []) prop_cluster_permutation :: Fun Int (C, [C]) -> [Int] -> Bool prop_cluster_permutation (Fun _ f) as = sort as == sort (concat (cluster f as)) prop_cluster_single :: a -> [a] -> Bool prop_cluster_single a as = isSingleton $ cluster (const (0,[])) $ (a:as) prop_cluster_idem :: Fun a (C, [C]) -> a -> [a] -> Bool prop_cluster_idem (Fun _ f) a as = isSingleton $ cluster f $ head $ cluster f (a:as) prop_two_clusters :: [Int] -> Bool prop_two_clusters as = atLeastTwo $ cluster (\ x -> (x, [x])) (-1:1:as) -- | An example. -- -- "anabel" is related to "babel" (common letter 'a' in 2-letter prefix) -- which is related to "bond" (common letter 'b'). -- -- "hurz", "furz", and "kurz" are all related (common letter 'u'). test :: [[String]] test = cluster (\ (x:y:_) -> (ord x,[ord y])) ["anabel","bond","babel","hurz","furz","kurz"] prop_test :: Bool prop_test = test == [["anabel","bond","babel"],["hurz","furz","kurz"]] -- | Modified example (considering only the first letter). test1 :: [[String]] test1 = cluster (\ (x:_:_) -> (ord x,[])) ["anabel","bond","babel","hurz","furz","kurz"] prop_test1 :: Bool prop_test1 = test1 == [["anabel"],["bond","babel"],["furz"],["hurz"],["kurz"]] ------------------------------------------------------------------------ -- * All tests ------------------------------------------------------------------------ -- Template Haskell hack to make the following $quickCheckAll work -- under ghc-7.8. return [] -- KEEP! tests :: IO Bool tests = do putStrLn "Agda.Utils.Cluster" $quickCheckAll Agda-2.4.2.5/src/full/Agda/Utils/Bag.hs0000644000000000000000000001533612635075266015442 0ustar0000000000000000{-# LANGUAGE CPP #-} {-# LANGUAGE ScopedTypeVariables #-} {-# LANGUAGE TemplateHaskell #-} -- | A simple overlay over Data.Map to manage unordered sets with duplicates. module Agda.Utils.Bag where import Prelude hiding (null, map) import Control.Applicative hiding (empty) import Text.Show.Functions () import Data.Foldable (Foldable(foldMap)) import Data.Functor.Identity import qualified Data.List as List import Data.Map (Map) import qualified Data.Map as Map import Data.Monoid import Data.Set (Set) import qualified Data.Set as Set import Data.Traversable import Agda.Utils.Functor import Agda.Utils.QuickCheck #include "undefined.h" import Agda.Utils.Impossible -- | A set with duplicates. -- Faithfully stores elements which are equal with regard to (==). newtype Bag a = Bag { bag :: Map a [a] } deriving (Eq, Ord) -- The list contains all occurrences of @a@ (not just the duplicates!). -- Hence the invariant: the list is never empty! -- -- This is slightly wasteful, but much easier to implement -- in terms of Map as the alternative, which is to store -- only the duplicates in the list. -- See, e.g., implementation of 'union' which would be impossible -- to do in the other representation. We would need a -- 'Map.unionWithKey' that passes us *both* keys. -- But Map works under the assumption that Eq for keys is identity, -- it does not honor information in keys that goes beyond Ord. ------------------------------------------------------------------------ -- * Query ------------------------------------------------------------------------ null :: Bag a -> Bool null = Map.null . bag size :: Bag a -> Int size = getSum . foldMap (Sum . length) . bag -- | @bag ! a@ finds all elements equal to @a@. (!) :: Ord a => Bag a -> a -> [a] Bag b ! a = Map.findWithDefault [] a b member :: Ord a => a -> Bag a -> Bool member a = not . notMember a notMember :: Ord a => a -> Bag a -> Bool notMember a b = List.null (b ! a) -- | Return the multiplicity of the given element. count :: Ord a => a -> Bag a -> Int count a b = length (b ! a) ------------------------------------------------------------------------ -- * Construction ------------------------------------------------------------------------ empty :: Bag a empty = Bag $ Map.empty singleton :: a -> Bag a singleton a = Bag $ Map.singleton a [a] union :: Ord a => Bag a -> Bag a -> Bag a union (Bag b) (Bag c) = Bag $ Map.unionWith (++) b c unions :: Ord a => [Bag a] -> Bag a unions = Bag . Map.unionsWith (++) . List.map bag -- | @insert a b = union b (singleton a)@ insert :: Ord a => a -> Bag a -> Bag a insert a = Bag . Map.insertWith (++) a [a] . bag -- | @fromList = unions . map singleton@ fromList :: Ord a => [a] -> Bag a fromList = Bag . Map.fromListWith (++) . List.map (\ a -> (a,[a])) ------------------------------------------------------------------------ -- * Destruction ------------------------------------------------------------------------ -- | Returns the elements of the bag, grouped by equality (==). groups :: Bag a -> [[a]] groups = Map.elems . bag -- | Returns the bag, with duplicates. toList :: Bag a -> [a] toList = concat . groups -- | Returns the bag without duplicates. keys :: Bag a -> [a] keys = Map.keys . bag -- Works because of the invariant! -- keys = catMaybes . map headMaybe . Map.elems . bag -- -- Map.keys does not work, as zero copies @(a,[])@ -- -- should count as not present in the bag. -- | Returns the bag, with duplicates. elems :: Bag a -> [a] elems = toList toAscList :: Bag a -> [a] toAscList = toList ------------------------------------------------------------------------ -- * Traversal ------------------------------------------------------------------------ map :: (Ord a, Ord b) => (a -> b) -> Bag a -> Bag b map f = Bag . Map.fromListWith (++) . List.map ff . Map.elems . bag where ff (a : as) = (b, b : List.map f as) where b = f a ff [] = __IMPOSSIBLE__ traverse' :: forall a b m . (Applicative m, Ord b) => (a -> m b) -> Bag a -> m (Bag b) traverse' f = (Bag . Map.fromListWith (++)) <.> traverse trav . Map.elems . bag where trav :: [a] -> m (b, [b]) trav (a : as) = (\ b bs -> (b, b:bs)) <$> f a <*> traverse f as trav [] = __IMPOSSIBLE__ ------------------------------------------------------------------------ -- * Instances ------------------------------------------------------------------------ instance Show a => Show (Bag a) where showsPrec _ (Bag b) = ("Agda.Utils.Bag.Bag (" ++) . showsPrec 0 b . (')':) instance Ord a => Monoid (Bag a) where mempty = empty mappend = union mconcat = unions instance Foldable Bag where foldMap f = foldMap f . toList -- not a Functor (only works for 'Ord'ered types) -- not Traversable (only works for 'Ord'ered types) ------------------------------------------------------------------------ -- * Properties ------------------------------------------------------------------------ instance (Ord a, Arbitrary a) => Arbitrary (Bag a) where arbitrary = fromList <$> arbitrary prop_count_empty :: Ord a => a -> Bool prop_count_empty a = count a empty == 0 prop_count_singleton :: Ord a => a -> Bool prop_count_singleton a = count a (singleton a) == 1 prop_count_insert :: Ord a => a -> Bag a -> Bool prop_count_insert a b = count a (insert a b) == 1 + count a b prop_size_union :: Ord a => Bag a -> Bag a -> Bool prop_size_union b c = size (b `union` c) == size b + size c prop_size_fromList :: Ord a => [a] -> Bool prop_size_fromList l = size (fromList l) == length l prop_fromList_toList :: Ord a => Bag a -> Bool prop_fromList_toList b = fromList (toList b) == b prop_toList_fromList :: Ord a => [a] -> Bool prop_toList_fromList l = toList (fromList l) == List.sort l prop_keys_fromList :: Ord a => [a] -> Bool prop_keys_fromList l = keys (fromList l) == Set.toList (Set.fromList l) prop_nonempty_groups :: Bag a -> Bool prop_nonempty_groups b = all (not . List.null) $ groups b prop_map_id :: Ord a => Bag a -> Bool prop_map_id b = map id b == b prop_map_compose :: (Ord a, Ord b, Ord c) => (b -> c) -> (a -> b) -> Bag a -> Bool prop_map_compose f g b = map f (map g b) == map (f . g) b prop_traverse_id :: Ord a => Bag a -> Bool prop_traverse_id b = traverse' Identity b == Identity b ------------------------------------------------------------------------ -- * All tests ------------------------------------------------------------------------ -- Template Haskell hack to make the following $quickCheckAll work -- under ghc-7.8. return [] -- KEEP! -- | All tests as collected by 'quickCheckAll'. -- -- Using 'quickCheckAll' is convenient and superior to the manual -- enumeration of tests, since the name of the property is -- added automatically. tests :: IO Bool tests = do putStrLn "Agda.Utils.Favorites" $quickCheckAll Agda-2.4.2.5/src/full/Agda/Utils/Time.hs0000644000000000000000000000245512635075266015645 0ustar0000000000000000{-# LANGUAGE CPP #-} {-# LANGUAGE GeneralizedNewtypeDeriving #-} -- To avoid warning on derived Integral instance for CPUTime. {-# OPTIONS_GHC -fno-warn-identities #-} -- | Time-related utilities. module Agda.Utils.Time ( ClockTime , getClockTime , getCPUTime , measureTime , CPUTime(..) ) where import Control.Monad.Trans import qualified System.CPUTime as CPU import Data.Functor import qualified Data.Time import Agda.Utils.Pretty import Agda.Utils.String -- | Timestamps. type ClockTime = Data.Time.UTCTime -- | The current time. getClockTime :: IO ClockTime getClockTime = Data.Time.getCurrentTime -- | CPU time in pico (10^-12) seconds. newtype CPUTime = CPUTime Integer deriving (Eq, Show, Ord, Num, Real, Enum, Integral) -- | Print CPU time in milli (10^-3) seconds. instance Pretty CPUTime where pretty (CPUTime ps) = text $ showThousandSep (div ps 1000000000) ++ "ms" {-# SPECIALIZE getCPUTime :: IO CPUTime #-} getCPUTime :: MonadIO m => m CPUTime getCPUTime = liftIO $ CPUTime <$> CPU.getCPUTime -- | Measure the time of a computation. -- Of course, does not work with exceptions. measureTime :: MonadIO m => m a -> m (a, CPUTime) measureTime m = do start <- liftIO $ getCPUTime x <- m stop <- liftIO $ getCPUTime return (x, stop - start) Agda-2.4.2.5/src/full/Agda/Utils/BiMap.hs0000644000000000000000000000642312635075266015736 0ustar0000000000000000{-# LANGUAGE DeriveDataTypeable #-} {-# LANGUAGE FlexibleInstances #-} {-# LANGUAGE GeneralizedNewtypeDeriving #-} {-# LANGUAGE PatternGuards #-} {-# LANGUAGE TemplateHaskell #-} {-# LANGUAGE TupleSections #-} -- | Finite bijections (implemented as a pair of maps). module Agda.Utils.BiMap where import Prelude hiding (lookup, unzip) import Control.Applicative ((<*>)) import Data.Function import Data.Functor import qualified Data.List as List import Data.Map (Map) import qualified Data.Map as Map import Data.Maybe import Data.Tuple import Data.Typeable ( Typeable ) import Test.QuickCheck import Test.QuickCheck.All -- | Finite bijective map from @a@ to @b@. There, and back again. data BiMap a b = BiMap { biMapThere :: Map a b , biMapBack :: Map b a } deriving (Typeable) -- | Lookup. O(log n). lookup :: (Ord a, Ord b) => a -> BiMap a b -> Maybe b lookup a = Map.lookup a . biMapThere -- | Inverse lookup. O(log n). invLookup :: (Ord a, Ord b) => b -> BiMap a b -> Maybe a invLookup b = Map.lookup b . biMapBack -- | Empty bimap. O(1). empty :: (Ord a, Ord b) => BiMap a b empty = BiMap Map.empty Map.empty -- | Singleton bimap. O(1). singleton :: (Ord a, Ord b) => a -> b -> BiMap a b singleton a b = BiMap (Map.singleton a b) (Map.singleton b a) -- | Insert. Overwrites existing value if present. insert :: (Ord a, Ord b) => a -> b -> BiMap a b -> BiMap a b insert a b (BiMap t u) = BiMap (Map.insert a b t) (Map.insert b a u) -- | Left-biased Union. O(Map.union). union :: (Ord a, Ord b) => BiMap a b -> BiMap a b -> BiMap a b union (BiMap t1 b1) (BiMap t2 b2) = BiMap (Map.union t1 t2) (Map.union b1 b2) -- | Construct from a list of pairs. -- -- Does not check for actual bijectivity of constructed finite map. fromList :: (Ord a, Ord b) => [(a,b)] -> BiMap a b fromList = List.foldl' (flip (uncurry insert)) empty -- | Turn into list, sorted ascendingly by first value. toList :: (Ord a, Ord b) => BiMap a b -> [(a,b)] toList = Map.toAscList . biMapThere ------------------------------------------------------------------------ -- * Instances ------------------------------------------------------------------------ instance (Ord a, Ord b) => Eq (BiMap a b) where (==) = (==) `on` biMapThere instance (Ord a, Ord b) => Ord (BiMap a b) where compare = compare `on` biMapThere instance (Show a, Show b, Ord a, Ord b) => Show (BiMap a b) where show bimap = "Agda.Utils.BiMap.fromList " ++ show (toList bimap) instance (Ord a, Ord b, Arbitrary a, Arbitrary b) => Arbitrary (BiMap a b) where arbitrary = fromList <$> do List.zip <$> alist <*> blist where alist = List.nub <$> arbitrary blist = List.nub <$> arbitrary ------------------------------------------------------------------------ -- * Properties ------------------------------------------------------------------------ prop_BiMap_invariant :: (Ord a, Ord b) => BiMap a b -> Bool prop_BiMap_invariant (BiMap t u) = Map.toAscList t == List.sort (List.map swap (Map.toList u)) ------------------------------------------------------------------------ -- * All tests ------------------------------------------------------------------------ -- Template Haskell hack to make the following $quickCheckAll work -- under ghc-7.8. return [] -- KEEP! tests :: IO Bool tests = do putStrLn "Agda.Utils.BiMap" $quickCheckAll Agda-2.4.2.5/src/full/Agda/Utils/Except.hs0000644000000000000000000000414312635075266016173 0ustar0000000000000000{-# LANGUAGE CPP #-} {-# LANGUAGE FlexibleInstances #-} #if !(MIN_VERSION_mtl(2,2,1)) {-# OPTIONS_GHC -fno-warn-orphans #-} #endif ------------------------------------------------------------------------------ -- | Wrapper for Control.Monad.Except from the mtl package ------------------------------------------------------------------------------ module Agda.Utils.Except ( Error(noMsg, strMsg) , ExceptT , mkExceptT , MonadError(catchError, throwError) , runExceptT , mapExceptT ) where #include "undefined.h" import Agda.Utils.Impossible ------------------------------------------------------------------------ #if MIN_VERSION_mtl(2,2,1) -- New mtl, reexport ExceptT, define class Error for backward compat. ------------------------------------------------------------------------ import Control.Monad.Except -- | We cannot define data constructors synonymous, so we define the -- @mkExceptT@ function to be used instead of the data constructor -- @ExceptT@. mkExceptT :: m (Either e a) -> ExceptT e m a mkExceptT = ExceptT -- From Control.Monad.Trans.Error of transformers 0.3.0.0. class Error a where noMsg :: a strMsg :: String -> a noMsg = strMsg "" strMsg _ = noMsg -- | A string can be thrown as an error. instance Error String where strMsg = id ------------------------------------------------------------------------ #else -- Old mtl, need to define ExceptT from ErrorT ------------------------------------------------------------------------ import Control.Monad.Error type ExceptT = ErrorT -- | We cannot define data constructors synonymous, so we define the -- @mkExceptT@ function to be used instead of the data constructor -- @ErrorT@. mkExceptT :: m (Either e a) -> ExceptT e m a mkExceptT = ErrorT -- | 'runExcept' function using mtl 2.1.*. runExceptT :: ExceptT e m a -> m (Either e a) runExceptT = runErrorT mapExceptT :: (m (Either e a) -> m' (Either e' a')) -> ExceptT e m a -> ExceptT e' m' a' mapExceptT = mapErrorT #endif -- | To simulate @MaybeT@ by @ExceptT@. instance Error () where noMsg = () -- Stupid ErrorT! instance Error (a, b, c) where noMsg = __IMPOSSIBLE__ Agda-2.4.2.5/src/full/Agda/Utils/Null.hs0000644000000000000000000000603512635075266015657 0ustar0000000000000000{-# OPTIONS_GHC -fno-warn-orphans #-} {-# LANGUAGE CPP #-} {-# LANGUAGE DefaultSignatures #-} -- | Overloaded @null@ and @empty@ for collections and sequences. module Agda.Utils.Null where import Prelude hiding (null) import Control.Monad import Data.ByteString.Char8 (ByteString) import qualified Data.ByteString.Char8 as ByteString import Data.Function import Data.HashMap.Strict (HashMap) import qualified Data.HashMap.Strict as HashMap import Data.HashSet (HashSet) import qualified Data.HashSet as HashSet import Data.IntMap (IntMap) import qualified Data.IntMap as IntMap import Data.IntSet (IntSet) import qualified Data.IntSet as IntSet import qualified Data.List as List import Data.Map (Map) import qualified Data.Map as Map import Data.Monoid import Data.Sequence (Seq) import qualified Data.Sequence as Seq import Data.Set (Set) import qualified Data.Set as Set import Text.PrettyPrint (Doc, render) import Agda.Utils.Bag (Bag) import qualified Agda.Utils.Bag as Bag import Agda.Utils.Functor import Agda.Utils.Monad -- Andreas, 2015-06-24 orphan instance has to go here -- to be able to define instance Null Doc #if !MIN_VERSION_pretty(1,1,2) instance Eq Doc where (==) = (==) `on` render #endif class Null a where empty :: a null :: a -> Bool -- ^ Satisfying @null empty == True@. default null :: Eq a => a -> Bool null = (== empty) instance Null () where empty = () null _ = True instance (Null a, Null b) => Null (a,b) where empty = (empty, empty) null (a,b) = null a && null b instance Null ByteString where empty = ByteString.empty null = ByteString.null instance Null [a] where empty = [] null = List.null instance Null (Bag a) where empty = Bag.empty null = Bag.null instance Null (IntMap a) where empty = IntMap.empty null = IntMap.null instance Null IntSet where empty = IntSet.empty null = IntSet.null instance Null (Map k a) where empty = Map.empty null = Map.null instance Null (HashMap k a) where empty = HashMap.empty null = HashMap.null instance Null (HashSet a) where empty = HashSet.empty null = HashSet.null instance Null (Seq a) where empty = Seq.empty null = Seq.null instance Null (Set a) where empty = Set.empty null = Set.null -- | A 'Maybe' is 'null' when it corresponds to the empty list. instance Null (Maybe a) where empty = Nothing null Nothing = True null (Just a) = False instance Null Doc where empty = mempty null = (== mempty) -- * Testing for null. ifNull :: (Null a) => a -> b -> (a -> b) -> b ifNull a b k = if null a then b else k a ifNullM :: (Monad m, Null a) => m a -> m b -> (a -> m b) -> m b ifNullM ma mb k = ma >>= \ a -> ifNull a mb k whenNull :: (Monad m, Null a) => a -> m () -> m () whenNull = when . null unlessNull :: (Monad m, Null a) => a -> (a -> m ()) -> m () unlessNull a k = unless (null a) $ k a whenNullM :: (Monad m, Null a) => m a -> m () -> m () whenNullM ma k = ma >>= (`whenNull` k) unlessNullM :: (Monad m, Null a) => m a -> (a -> m ()) -> m () unlessNullM ma k = ma >>= (`unlessNull` k) Agda-2.4.2.5/src/full/Agda/Utils/ListT.hs0000644000000000000000000001134412635075266016003 0ustar0000000000000000{-# LANGUAGE CPP #-} {-# LANGUAGE DeriveFunctor #-} {-# LANGUAGE FlexibleInstances #-} {-# LANGUAGE MultiParamTypeClasses #-} {-# LANGUAGE TupleSections #-} {-# LANGUAGE UndecidableInstances #-} -- Due to limitations of funct.dep. -- | @ListT@ done right, -- see https://www.haskell.org/haskellwiki/ListT_done_right_alternative -- -- There is also the @list-t@ package on hackage (Nikita Volkov) -- but it again depends on other packages we do not use yet, -- so we rather implement the few bits we need afresh. module Agda.Utils.ListT where import Control.Applicative import Control.Arrow import Control.Monad import Control.Monad.Reader import Control.Monad.State import Control.Monad.Trans import Data.Functor import Data.Monoid import Agda.Utils.Maybe import Agda.Utils.Monad -- | Lazy monadic computation of a list of results. newtype ListT m a = ListT { runListT :: m (Maybe (a, ListT m a)) } deriving (Functor) -- * List operations -- | The empty lazy list. nilListT :: Monad m => ListT m a nilListT = ListT $ return Nothing -- | Consing a value to a lazy list. consListT :: Monad m => a -> ListT m a -> ListT m a consListT a l = ListT $ return $ Just (a, l) -- | Singleton lazy list. sgListT :: Monad m => a -> ListT m a sgListT a = consListT a nilListT -- | Case distinction over lazy list. caseListT :: Monad m => ListT m a -> m b -> (a -> ListT m a -> m b) -> m b caseListT l nil cons = caseMaybeM (runListT l) nil $ uncurry cons -- | Folding a lazy list, effects left-to-right. foldListT :: Monad m => (a -> m b -> m b) -> m b -> ListT m a -> m b foldListT cons nil = loop where loop l = caseListT l nil $ \ a l' -> cons a $ loop l' -- | The join operation of the @ListT m@ monad. concatListT :: Monad m => ListT m (ListT m a) -> ListT m a concatListT = ListT . foldListT append (return Nothing) where append l = runListT . mappend l . ListT -- * Monadic list operations. -- | We can ``run'' a computation of a 'ListT' as it is monadic itself. runMListT :: Monad m => m (ListT m a) -> ListT m a runMListT ml = ListT $ runListT =<< ml -- | Monadic cons. consMListT :: Monad m => m a -> ListT m a -> ListT m a consMListT ma l = ListT $ (Just . (,l)) `liftM` ma -- consMListT ma l = runMListT $ liftM (`consListT` l) ma -- simplification: -- consMListT ma l = ListT $ runListT =<< liftM (`consListT` l) ma -- consMListT ma l = ListT $ runListT =<< (`consListT` l) <$> ma -- consMListT ma l = ListT $ runListT =<< do a <- ma; return $ a `consListT` l -- consMListT ma l = ListT $ do a <- ma; runListT =<< do return $ a `consListT` l -- consMListT ma l = ListT $ do a <- ma; runListT $ a `consListT` l -- consMListT ma l = ListT $ do a <- ma; runListT $ ListT $ return $ Just (a, l) -- consMListT ma l = ListT $ do a <- ma; return $ Just (a, l) -- consMListT ma l = ListT $ Just . (,l) <$> ma -- | Monadic singleton. sgMListT :: Monad m => m a -> ListT m a sgMListT ma = consMListT ma nilListT -- | Extending a monadic function to 'ListT'. mapMListT :: ( Monad m #if __GLASGOW_HASKELL__ <= 708 , Functor m #endif ) => (a -> m b) -> ListT m a -> ListT m b mapMListT f (ListT ml) = ListT $ do caseMaybeM ml (return Nothing) $ \ (a, as) -> do b <- f a return $ Just (b , mapMListT f as) -- | Alternative implementation using 'foldListT'. mapMListT_alt :: ( Monad m #if __GLASGOW_HASKELL__ <= 708 , Functor m #endif ) => (a -> m b) -> ListT m a -> ListT m b mapMListT_alt f = runMListT . foldListT cons (return nilListT) where cons a ml = consMListT (f a) <$> ml -- Instances instance Monad m => Monoid (ListT m a) where mempty = nilListT mappend l1 l2 = ListT $ foldListT cons (runListT l2) l1 where cons a = runListT . consListT a . ListT instance (Functor m, Applicative m, Monad m) => Alternative (ListT m) where empty = mempty (<|>) = mappend instance (Functor m, Applicative m, Monad m) => MonadPlus (ListT m) where mzero = mempty mplus = mappend instance (Functor m, Applicative m, Monad m) => Applicative (ListT m) where pure = return (<*>) = ap -- Another Applicative, but not the canonical one. -- l1 <*> l2 = ListT $ loop <$> runListT l1 <*> runListT l2 -- where -- loop (Just (f, l1')) (Just (a, l2')) = Just (f a, l1' <*> l2') -- loop _ _ = Nothing instance (Functor m, Applicative m, Monad m) => Monad (ListT m) where return = sgListT l >>= k = concatListT $ k <$> l instance MonadTrans ListT where lift = sgMListT instance (Applicative m, MonadIO m) => MonadIO (ListT m) where liftIO = lift . liftIO instance (Applicative m, MonadReader r m) => MonadReader r (ListT m) where ask = lift ask local f = ListT . local f . runListT instance (Applicative m, MonadState s m) => MonadState s (ListT m) where get = lift get put = lift . put Agda-2.4.2.5/src/full/Agda/Utils/Monad.hs0000644000000000000000000001467512635075266016014 0ustar0000000000000000{-# LANGUAGE CPP #-} module Agda.Utils.Monad ( module Agda.Utils.Monad , when, unless, MonadPlus(..) , (<$>), (<*>) , (<$) #if MIN_VERSION_mtl(2,2,0) , Control.Monad.State.modify' #endif ) where import Prelude hiding (concat) import Control.Monad hiding (mapM, forM) import Control.Monad.State import Control.Monad.Writer import Control.Applicative import Data.Traversable as Trav hiding (for, sequence) import Data.Foldable as Fold import Data.Maybe import Agda.Utils.Except ( Error(noMsg, strMsg) , MonadError(catchError, throwError) ) import Agda.Utils.List #include "undefined.h" import Agda.Utils.Impossible -- | Binary bind. (==<<) :: Monad m => (a -> b -> m c) -> (m a, m b) -> m c k ==<< (ma, mb) = ma >>= \ a -> k a =<< mb -- Conditionals and monads ------------------------------------------------ -- | @when_@ is just @Control.Monad.when@ with a more general type. when_ :: Monad m => Bool -> m a -> m () when_ b m = when b $ m >> return () -- | @unless_@ is just @Control.Monad.unless@ with a more general type. unless_ :: Monad m => Bool -> m a -> m () unless_ b m = unless b $ m >> return () whenM :: Monad m => m Bool -> m a -> m () whenM c m = c >>= (`when_` m) unlessM :: Monad m => m Bool -> m a -> m () unlessM c m = c >>= (`unless_` m) -- whenJust, whenJustM moved to Utils.Maybe -- | Monadic if-then-else. ifM :: Monad m => m Bool -> m a -> m a -> m a ifM c m m' = do b <- c if b then m else m' -- | @ifNotM mc = ifM (not <$> mc)@ ifNotM :: Monad m => m Bool -> m a -> m a -> m a ifNotM c = flip $ ifM c -- | Lazy monadic conjunction. and2M :: Monad m => m Bool -> m Bool -> m Bool and2M ma mb = ifM ma mb (return False) andM :: Monad m => [m Bool] -> m Bool andM = Fold.foldl and2M (return True) -- | Lazy monadic disjunction. or2M :: Monad m => m Bool -> m Bool -> m Bool or2M ma mb = ifM ma (return True) mb orM :: Monad m => [m Bool] -> m Bool orM = Fold.foldl or2M (return False) -- | Lazy monadic disjunction with @Either@ truth values. altM1 :: Monad m => (a -> m (Either err b)) -> [a] -> m (Either err b) altM1 f [] = __IMPOSSIBLE__ altM1 f [a] = f a altM1 f (a : as) = either (const $ altM1 f as) (return . Right) =<< f a -- Loops gathering results in a Monoid ------------------------------------ -- | Generalized version of @mapM_ :: Monad m => (a -> m ()) -> [a] -> m ()@ -- Executes effects and collects results in left-to-right order. -- Works best with left-associative monoids. -- -- Note that there is an alternative -- -- @mapM' f t = foldr mappend mempty <$> mapM f t@ -- -- that collects results in right-to-left order -- (effects still left-to-right). -- It might be preferable for right associative monoids. mapM' :: (Foldable t, Monad m, Monoid b) => (a -> m b) -> t a -> m b mapM' f = Fold.foldl (\ mb a -> liftM2 mappend mb (f a)) (return mempty) -- | Generalized version of @forM_ :: Monad m => [a] -> (a -> m ()) -> m ()@ forM' :: (Foldable t, Monad m, Monoid b) => t a -> (a -> m b) -> m b forM' = flip mapM' -- Continuation monad ----------------------------------------------------- type Cont r a = (a -> r) -> r -- | 'Control.Monad.mapM' for the continuation monad. Terribly useful. thread :: (a -> Cont r b) -> [a] -> Cont r [b] thread f [] ret = ret [] thread f (x:xs) ret = f x $ \y -> thread f xs $ \ys -> ret (y:ys) -- Lists and monads ------------------------------------------------------- -- | Requires both lists to have the same lengths. zipWithM' :: Monad m => (a -> b -> m c) -> [a] -> [b] -> m [c] zipWithM' f xs ys = sequence (zipWith' f xs ys) -- | A monadic version of @'mapMaybe' :: (a -> Maybe b) -> [a] -> [b]@. mapMaybeM :: (Monad m, Functor m) => (a -> m (Maybe b)) -> [a] -> m [b] mapMaybeM f xs = catMaybes <$> Trav.mapM f xs -- | The @for@ version of 'mapMaybeM'. forMaybeM :: (Monad m, Functor m) => [a] -> (a -> m (Maybe b)) -> m [b] forMaybeM = flip mapMaybeM -- | A monadic version of @'dropWhile' :: (a -> Bool) -> [a] -> [a]@. dropWhileM :: Monad m => (a -> m Bool) -> [a] -> m [a] dropWhileM p [] = return [] dropWhileM p (x : xs) = ifM (p x) (dropWhileM p xs) (return (x : xs)) -- Error monad ------------------------------------------------------------ -- | Finally for the 'Error' class. Errors in the finally part take -- precedence over prior errors. finally :: (Error e, MonadError e m) => m a -> m b -> m a first `finally` after = do r <- catchError (liftM Right first) (return . Left) _ <- after case r of Left e -> throwError e Right r -> return r -- State monad ------------------------------------------------------------ -- | Bracket without failure. Typically used to preserve state. bracket_ :: Monad m => m a -- ^ Acquires resource. Run first. -> (a -> m c) -- ^ Releases resource. Run last. -> m b -- ^ Computes result. Run in-between. -> m b bracket_ acquire release compute = do resource <- acquire result <- compute _ <- release resource return result -- | Restore state after computation. localState :: MonadState s m => m a -> m a localState = bracket_ get put #if !MIN_VERSION_mtl(2,2,0) modify' :: MonadState s m => (s -> s) -> m () modify' f = do x <- get put $! f x #endif -- Read ------------------------------------------------------------------- readM :: (Error e, MonadError e m, Read a) => String -> m a readM s = case reads s of [(x,"")] -> return x _ -> throwError $ strMsg $ "readM: parse error string " ++ s -- RETIRED STUFF ---------------------------------------------------------- {- RETIRED, ASR, 09 September 2014. Not used. -- | Bracket for the 'Error' class. -- bracket :: (Error e, MonadError e m) -- => m a -- ^ Acquires resource. Run first. -- -> (a -> m c) -- ^ Releases resource. Run last. -- -> (a -> m b) -- ^ Computes result. Run in-between. -- -> m b -- bracket acquire release compute = do -- resource <- acquire -- compute resource `finally` release resource -} {- RETIRED, Andreas, 2012-04-30. Not used. concatMapM :: Applicative m => (a -> m [b]) -> [a] -> m [b] concatMapM f xs = concat <$> traverse f xs -- | Depending on the monad you have to look at the result for -- the force to be effective. For the 'IO' monad you do. forceM :: Monad m => [a] -> m () forceM xs = do () <- length xs `seq` return () return () commuteM :: (Traversable f, Applicative m) => f (m a) -> m (f a) commuteM = traverse id -} Agda-2.4.2.5/src/full/Agda/Utils/QuickCheck.hs0000644000000000000000000000076512635075266016763 0ustar0000000000000000module Agda.Utils.QuickCheck ( module Test.QuickCheck , module Agda.Utils.QuickCheck ) where import Test.QuickCheck hiding ((===)) import Test.QuickCheck.Property (Property(..)) isSuccess :: Result -> Bool isSuccess Success{} = True isSuccess _ = False quickCheck' :: Testable prop => prop -> IO Bool quickCheck' p = fmap isSuccess $ quickCheckResult p quickCheckWith' :: Testable prop => Args -> prop -> IO Bool quickCheckWith' args p = fmap isSuccess $ quickCheckWithResult args p Agda-2.4.2.5/src/full/Agda/Utils/Tuple.hs0000644000000000000000000000352712635075266016041 0ustar0000000000000000{-# LANGUAGE DeriveFunctor #-} {-# LANGUAGE DeriveFoldable #-} {-# LANGUAGE DeriveTraversable #-} {-# LANGUAGE GeneralizedNewtypeDeriving #-} {-# LANGUAGE TupleSections #-} module Agda.Utils.Tuple where import Control.Applicative import Data.Foldable import Data.Traversable infix 2 -*- infix 3 /\ -- backslashes at EOL interact badly with CPP... -- | Bifunctoriality for pairs. (-*-) :: (a -> c) -> (b -> d) -> (a,b) -> (c,d) (f -*- g) ~(x,y) = (f x, g y) -- | @mapFst f = f -*- id@ mapFst :: (a -> c) -> (a,b) -> (c,b) mapFst f ~(x,y) = (f x, y) -- | @mapSnd g = id -*- g@ mapSnd :: (b -> d) -> (a,b) -> (a,d) mapSnd g ~(x,y) = (x, g y) -- | Lifted pairing. (/\) :: (a -> b) -> (a -> c) -> a -> (b,c) (f /\ g) x = (f x, g x) -- | Swap. (Only in Data.Tuple from base-4.3) swap :: (a,b) -> (b,a) swap ~(a,b) = (b,a) -- * Triple (stolen from Data.Tuple.HT) {-# INLINE fst3 #-} fst3 :: (a,b,c) -> a fst3 ~(x,_,_) = x {-# INLINE snd3 #-} snd3 :: (a,b,c) -> b snd3 ~(_,x,_) = x {-# INLINE thd3 #-} thd3 :: (a,b,c) -> c thd3 ~(_,_,x) = x {-# INLINE uncurry3 #-} uncurry3 :: (a -> b -> c -> d) -> (a,b,c) -> d uncurry3 f ~(x,y,z) = f x y z {-# INLINE uncurry4 #-} uncurry4 :: (a -> b -> c -> d -> e) -> (a,b,c,d) -> e uncurry4 f ~(w,x,y,z) = f w x y z -- | Monadic version of '-*-'. mapPairM :: (Applicative m) => (a -> m c) -> (b -> m d) -> (a,b) -> m (c,d) mapPairM f g ~(a,b) = (,) <$> f a <*> g b -- | Monadic 'mapFst'. mapFstM :: (Applicative m) => (a -> m c) -> (a,b) -> m (c,b) mapFstM f ~(a,b) = (,b) <$> f a -- | Monadic 'mapSnd'. mapSndM :: (Applicative m) => (b -> m d) -> (a,b) -> m (a,d) mapSndM f ~(a,b) = (a,) <$> f b newtype List2 a = List2 { list2 :: (a,a) } deriving (Eq, Functor, Foldable, Traversable) instance Applicative List2 where pure a = List2 (a,a) (List2 (f,f')) <*> (List2 (a,a')) = List2 (f a, f' a') Agda-2.4.2.5/src/full/Agda/Utils/Pretty.hs0000644000000000000000000000375112635075266016236 0ustar0000000000000000{-# LANGUAGE CPP #-} {-# LANGUAGE FlexibleInstances #-} {-| Pretty printing functions. -} module Agda.Utils.Pretty ( module Agda.Utils.Pretty , module Text.PrettyPrint ) where import Data.Function import Data.Int ( Int32 ) import Data.Monoid import Text.PrettyPrint hiding (TextDetails(Str), empty) import Agda.Utils.Null -- * Pretty class -- | While 'Show' is for rendering data in Haskell syntax, -- 'Pretty' is for displaying data to the world, i.e., the -- user and the environment. -- -- Atomic data has no inner document structure, so just -- implement 'pretty' as @pretty a = text $ ... a ...@. class Pretty a where pretty :: a -> Doc prettyPrec :: Int -> a -> Doc pretty = prettyPrec 0 prettyPrec = const pretty -- | Use instead of 'show' when printing to world. prettyShow :: Pretty a => a -> String prettyShow = render . pretty -- | Space separated list of pretty things. prettyList :: Pretty a => [a] -> Doc prettyList = sep . map (prettyPrec 10000) -- * Pretty instances instance Pretty Bool where pretty = text . show instance Pretty Int where pretty = text . show instance Pretty Int32 where pretty = text . show instance Pretty Integer where pretty = text . show instance Pretty Char where pretty c = text [c] instance Pretty Doc where pretty = id instance Pretty String where pretty = text -- * 'Doc' utilities pwords :: String -> [Doc] pwords = map text . words fwords :: String -> Doc fwords = fsep . pwords mparens :: Bool -> Doc -> Doc mparens True = parens mparens False = id -- | @align max rows@ lays out the elements of @rows@ in two columns, -- with the second components aligned. The alignment column of the -- second components is at most @max@ characters to the right of the -- left-most column. -- -- Precondition: @max > 0@. align :: Int -> [(String, Doc)] -> Doc align max rows = vcat $ map (\(s, d) -> text s $$ nest (maxLen + 1) d) $ rows where maxLen = maximum $ 0 : filter (< max) (map (length . fst) rows) Agda-2.4.2.5/src/full/Agda/Utils/Singleton.hs0000644000000000000000000000414212635075266016704 0ustar0000000000000000{-# LANGUAGE FlexibleInstances #-} {-# LANGUAGE FunctionalDependencies #-} {-# LANGUAGE GeneralizedNewtypeDeriving #-} {-# LANGUAGE MultiParamTypeClasses #-} -- {-# LANGUAGE TypeFamilies #-} -- | Constructing singleton collections. module Agda.Utils.Singleton where import Data.Hashable (Hashable) import Data.HashMap.Strict (HashMap) import qualified Data.HashMap.Strict as HashMap import Data.HashSet (HashSet) import qualified Data.HashSet as HashSet import Data.IntMap (IntMap) import qualified Data.IntMap as IntMap import Data.IntSet (IntSet) import qualified Data.IntSet as IntSet import Data.Map (Map) import qualified Data.Map as Map import Data.Sequence (Seq) import qualified Data.Sequence as Seq import Data.Set (Set) import qualified Data.Set as Set class Singleton el coll | coll -> el where singleton :: el -> coll instance Singleton a (Maybe a) where singleton = Just instance Singleton a [a] where singleton = (:[]) instance Singleton a (Seq a) where singleton = Seq.singleton instance Singleton a (Set a) where singleton = Set.singleton instance Singleton Int IntSet where singleton = IntSet.singleton instance Singleton (k ,a) (Map k a) where singleton = uncurry Map.singleton instance Singleton (Int,a) (IntMap a) where singleton = uncurry IntMap.singleton instance Hashable a => Singleton a (HashSet a) where singleton = HashSet.singleton instance Hashable k => Singleton (k,a) (HashMap k a) where singleton = uncurry HashMap.singleton -- Testing newtype-deriving: -- newtype Wrap c = Wrap c -- deriving (Singleton k) -- Succeeds -- Type family version: -- class Singleton c where -- type Elem c -- singleton :: Elem c -> c -- instance Singleton [a] where -- type Elem [a] = a -- singleton = (:[]) -- instance Singleton (Maybe a) where -- type Elem (Maybe a) = a -- singleton = Just -- instance Singleton (Set a) where -- type Elem (Set a) = a -- singleton = Set.singleton -- instance Singleton (Map k a) where -- type Elem (Map k a) = (k,a) -- singleton = uncurry Map.singleton -- newtype Wrap a = Wrap a -- deriving (Singleton) -- Fails Agda-2.4.2.5/src/full/Agda/Utils/String.hs0000644000000000000000000000351212635075266016210 0ustar0000000000000000module Agda.Utils.String where import Data.Char import Data.List import Numeric import Agda.Utils.List -- | 'quote' adds double quotes around the string, replaces newline -- characters with @\n@, and escapes double quotes and backslashes -- within the string. This is different from the behaviour of 'show': -- -- @ -- \> 'putStrLn' $ 'show' \"\\x2200\" -- \"\\8704\" -- \> 'putStrLn' $ 'quote' \"\\x2200\" -- \"∀\" -- @ -- -- (The code examples above have been tested using version 4.2.0.0 of -- the base library.) quote :: String -> String quote s = "\"" ++ concatMap escape s ++ "\"" where escape c | c == '\n' = "\\n" | c `elem` escapeChars = ['\\', c] | otherwise = [c] escapeChars = "\"\\" -- | Shows a non-negative integer using the characters ₀-₉ instead of -- 0-9. showIndex :: (Show i, Integral i) => i -> String showIndex n = showIntAtBase 10 (\i -> toEnum (i + fromEnum '\x2080')) n "" -- | Adds a final newline if there is not already one. addFinalNewLine :: String -> String addFinalNewLine "" = "\n" addFinalNewLine s | last s == '\n' = s | otherwise = s ++ "\n" -- | Indents every line the given number of steps. indent :: Integral i => i -> String -> String indent i = unlines . map (genericReplicate i ' ' ++) . lines newtype Str = Str { unStr :: String } deriving Eq instance Show Str where show = unStr -- | Show a number using comma to separate powers of 1,000. showThousandSep :: Show a => a -> String showThousandSep = reverse . intercalate "," . chop 3 . reverse . show -- | Remove leading whitespace. ltrim :: String -> String ltrim = dropWhile isSpace -- | Remove trailing whitespace. rtrim :: String -> String rtrim = reverse . ltrim . reverse -- | Remove leading and trailing whitesapce. trim :: String -> String trim = rtrim . ltrim Agda-2.4.2.5/src/full/Agda/Utils/PartialOrd.hs0000644000000000000000000003335712635075266017015 0ustar0000000000000000{-# LANGUAGE DeriveFunctor #-} {-# LANGUAGE FlexibleInstances #-} {-# LANGUAGE GeneralizedNewtypeDeriving #-} {-# LANGUAGE TemplateHaskell #-} module Agda.Utils.PartialOrd where import Data.Functor import Data.Maybe import Data.Monoid import Data.List import Data.Set (Set) import qualified Data.Set as Set import Test.QuickCheck.All -- import Agda.Utils.List import Agda.Utils.SemiRing import Agda.Utils.TestHelpers import Agda.Utils.QuickCheck -- | The result of comparing two things (of the same type). data PartialOrdering = POLT -- ^ Less than. | POLE -- ^ Less or equal than. | POEQ -- ^ Equal | POGE -- ^ Greater or equal. | POGT -- ^ Greater than. | POAny -- ^ No information (incomparable). deriving (Eq, Show, Enum, Bounded) -- | Comparing the information content of two elements of -- 'PartialOrdering'. More precise information is smaller. -- -- Includes equality: @x `leqPO` x == True@. leqPO :: PartialOrdering -> PartialOrdering -> Bool leqPO _ POAny = True leqPO POLT POLT = True leqPO POLT POLE = True leqPO POLE POLE = True leqPO POEQ POLE = True leqPO POEQ POEQ = True leqPO POEQ POGE = True leqPO POGE POGE = True leqPO POGT POGT = True leqPO POGT POGE = True leqPO _ _ = False -- | Opposites. -- -- @related a po b@ iff @related b (oppPO po) a@. oppPO :: PartialOrdering -> PartialOrdering oppPO POLT = POGT oppPO POLE = POGE oppPO POEQ = POEQ oppPO POGE = POLE oppPO POGT = POLT oppPO POAny = POAny -- | Combining two pieces of information (picking the least information). -- Used for the dominance ordering on tuples. -- -- @orPO@ is associative, commutative, and idempotent. -- @orPO@ has dominant element @POAny@, but no neutral element. orPO :: PartialOrdering -> PartialOrdering -> PartialOrdering orPO POAny _ = POAny -- Shortcut if no information on first. orPO POLT POLT = POLT -- idempotent orPO POLT POLE = POLE orPO POLT POEQ = POLE orPO POLE POLT = POLE orPO POLE POLE = POLE -- idempotent orPO POLE POEQ = POLE orPO POEQ POLT = POLE orPO POEQ POLE = POLE orPO POEQ POEQ = POEQ -- idempotent orPO POEQ POGE = POGE orPO POEQ POGT = POGE orPO POGE POEQ = POGE orPO POGE POGE = POGE -- idempotent orPO POGE POGT = POGE orPO POGT POEQ = POGE orPO POGT POGE = POGE orPO POGT POGT = POGT -- idempotent orPO _ _ = POAny -- | Chains (transitivity) @x R y S z@. -- -- @seqPO@ is associative, commutative, and idempotent. -- @seqPO@ has dominant element @POAny@ and neutral element (unit) @POEQ@. seqPO :: PartialOrdering -> PartialOrdering -> PartialOrdering seqPO POAny _ = POAny -- Shortcut if no information on first. seqPO POEQ p = p -- No need to look at second if first is neutral. seqPO POLT POLT = POLT -- idempotent seqPO POLT POLE = POLT seqPO POLT POEQ = POLT -- unit seqPO POLE POLT = POLT seqPO POLE POLE = POLE -- idempotent seqPO POLE POEQ = POLE -- unit seqPO POGE POEQ = POGE -- unit seqPO POGE POGE = POGE -- idempotent seqPO POGE POGT = POGT seqPO POGT POEQ = POGT -- unit seqPO POGT POGE = POGT seqPO POGT POGT = POGT -- idempotent seqPO _ _ = POAny -- | Partial ordering forms a monoid under sequencing. instance Monoid PartialOrdering where mempty = POEQ mappend = seqPO -- | Embed 'Ordering'. fromOrdering :: Ordering -> PartialOrdering fromOrdering LT = POLT fromOrdering EQ = POEQ fromOrdering GT = POGT -- | Represent a non-empty disjunction of 'Ordering's as 'PartialOrdering'. fromOrderings :: [Ordering] -> PartialOrdering fromOrderings = foldr1 orPO . map fromOrdering -- | A 'PartialOrdering' information is a disjunction of 'Ordering' informations. toOrderings :: PartialOrdering -> [Ordering] toOrderings POLT = [LT] toOrderings POLE = [LT, EQ] toOrderings POEQ = [EQ] toOrderings POGE = [EQ, GT] toOrderings POGT = [GT] toOrderings POAny = [LT, EQ, GT] -- * Comparison with partial result type Comparable a = a -> a -> PartialOrdering -- | Decidable partial orderings. class PartialOrd a where comparable :: Comparable a -- | Any 'Ord' is a 'PartialOrd'. comparableOrd :: Ord a => Comparable a comparableOrd x y = fromOrdering $ compare x y -- | Are two elements related in a specific way? -- -- @related a o b@ holds iff @comparable a b@ is contained in @o@. related :: PartialOrd a => a -> PartialOrdering -> a -> Bool related a o b = comparable a b `leqPO` o -- * Totally ordered types. instance PartialOrd Int where comparable = comparableOrd instance PartialOrd Integer where comparable = comparableOrd -- * Generic partially ordered types. instance PartialOrd () where comparable _ _ = POEQ -- | 'Nothing' and @'Just' _@ are unrelated. -- -- Partial ordering for @Maybe a@ is the same as for @Either () a@. instance PartialOrd a => PartialOrd (Maybe a) where comparable mx my = case (mx, my) of (Nothing, Nothing) -> POEQ (Nothing, Just{} ) -> POAny (Just{} , Nothing) -> POAny (Just x , Just y ) -> comparable x y -- | Partial ordering for disjoint sums: @Left _@ and @Right _@ are unrelated. instance (PartialOrd a, PartialOrd b) => PartialOrd (Either a b) where comparable mx my = case (mx, my) of (Left x, Left y) -> comparable x y (Left _, Right _) -> POAny (Right _, Left _) -> POAny (Right x, Right y) -> comparable x y -- | Pointwise partial ordering for tuples. -- -- @related (x1,x2) o (y1,y2)@ iff @related x1 o x2@ and @related y1 o y2@. instance (PartialOrd a, PartialOrd b) => PartialOrd (a, b) where comparable (x1, x2) (y1, y2) = comparable x1 y1 `orPO` comparable x2 y2 -- | Pointwise comparison wrapper. newtype Pointwise a = Pointwise { pointwise :: a } deriving (Eq, Show, Functor) -- | The pointwise ordering for lists of the same length. -- -- There are other partial orderings for lists, -- e.g., prefix, sublist, subset, lexicographic, simultaneous order. instance PartialOrd a => PartialOrd (Pointwise [a]) where comparable (Pointwise xs) (Pointwise ys) = loop Nothing xs ys -- We need an accumulator since @orPO@ does not have a neutral element. where loop mo [] [] = fromMaybe POEQ mo loop _ [] ys = POAny loop _ xs [] = POAny loop mo (x:xs) (y:ys) = let o = comparable x y in case maybe o (orPO o) mo of POAny -> POAny o -> loop (Just o) xs ys -- | Inclusion comparison wrapper. newtype Inclusion a = Inclusion { inclusion :: a } deriving (Eq, Ord, Show, Functor) -- | Sublist for ordered lists. instance (Ord a) => PartialOrd (Inclusion [a]) where comparable (Inclusion xs) (Inclusion ys) = merge POEQ xs ys where -- We use an accumulator in order to short-cut computation -- once we know the lists are incomparable. merge' POAny xs ys = POAny merge' o xs ys = merge o xs ys merge o [] [] = o merge o [] ys = mappend o POLT merge o xs [] = mappend o POGT merge o xs@(x:xs') ys@(y:ys') = case compare x y of -- xs has an element that ys does not have => POGT LT -> merge' (mappend o POGT) xs' ys -- equal elements can be cancelled EQ -> merge o xs' ys' -- ys has an element that xs does not have => POLT GT -> merge' (mappend o POLT) xs ys' -- | Sets are partially ordered by inclusion. instance Ord a => PartialOrd (Inclusion (Set a)) where comparable s t = comparable (Set.toAscList <$> s) (Set.toAscList <$> t) -- * PartialOrdering is itself partially ordered! -- | Less is ``less general'' (i.e., more precise). instance PartialOrd PartialOrdering where -- working our way down: POAny is top comparable POAny POAny = POEQ comparable POAny _ = POGT comparable _ POAny = POLT -- next are the fuzzy notions POLE and POGE comparable POLE POLE = POEQ comparable POLE POLT = POGT comparable POLE POEQ = POGT comparable POGE POGE = POEQ comparable POGE POGT = POGT comparable POGE POEQ = POGT -- lowest are the precise notions POLT POEQ POGT comparable POLT POLT = POEQ comparable POLT POLE = POLT comparable POEQ POEQ = POEQ comparable POEQ POLE = POLT comparable POEQ POGE = POLT comparable POGT POGT = POEQ comparable POGT POGE = POLT -- anything horizontal is not comparable comparable _ _ = POAny -- * Properties instance Arbitrary PartialOrdering where arbitrary = arbitraryBoundedEnum -- | We test our properties on integer sets ordered by inclusion. newtype ISet = ISet { iset :: Inclusion (Set Int) } deriving (Eq, Ord, PartialOrd, Show) instance Arbitrary ISet where arbitrary = ISet . Inclusion . Set.fromList <$> listOf (choose (0, 8)) -- | Any two elements are 'related' in the way 'comparable' computes. prop_comparable_related :: ISet -> ISet -> Bool prop_comparable_related (ISet a) (ISet b) = related a o b where o = comparable a b -- | @flip comparable a b == oppPO (comparable a b)@ prop_oppPO :: ISet -> ISet -> Bool prop_oppPO (ISet a) (ISet b) = comparable a b == oppPO (comparable b a) -- | Auxiliary function: lists to sets = sorted duplicate-free lists. sortUniq :: [Ordering] -> [Ordering] sortUniq = Set.toAscList . Set.fromList -- | 'leqPO' is inclusion of the associated 'Ordering' sets. prop_leqPO_sound :: PartialOrdering -> PartialOrdering -> Bool prop_leqPO_sound p q = (p `leqPO` q) == null (toOrderings p \\ toOrderings q) -- | 'orPO' amounts to the union of the associated 'Ordering' sets. -- Except that 'orPO POLT POGT == POAny' which should also include 'POEQ'. prop_orPO_sound :: PartialOrdering -> PartialOrdering -> Bool prop_orPO_sound p q = (p `orPO` q) == fromOrderings (toOrderings p ++ toOrderings q) -- | 'orPO' is associative. prop_associative_orPO :: PartialOrdering -> PartialOrdering -> PartialOrdering -> Bool prop_associative_orPO = associative orPO -- | 'orPO' is commutative. prop_commutative_orPO :: PartialOrdering -> PartialOrdering -> Bool prop_commutative_orPO = commutative orPO -- | 'orPO' is idempotent. prop_idempotent_orPO :: PartialOrdering -> Bool prop_idempotent_orPO = idempotent orPO -- | The dominant element wrt. 'orPO' is 'POAny'. prop_zero_orPO :: PartialOrdering -> Bool prop_zero_orPO = isZero POAny orPO -- | Soundness of 'seqPO'. -- -- As QuickCheck test, this property is inefficient, see 'prop_seqPO'. property_seqPO :: ISet -> PartialOrdering -> ISet -> PartialOrdering -> ISet -> Property property_seqPO (ISet a) o (ISet b) p (ISet c) = related a o b && related b p c ==> related a (seqPO o p) c -- | A more efficient way of stating soundness of 'seqPO'. prop_seqPO :: ISet -> ISet -> ISet -> Bool prop_seqPO (ISet a) (ISet b) (ISet c) = related a o c where o = comparable a b `seqPO` comparable b c -- | The unit of 'seqPO' is 'POEQ'. prop_identity_seqPO :: PartialOrdering -> Bool prop_identity_seqPO = identity POEQ seqPO -- | The zero of 'seqPO' is 'POAny'. prop_zero_seqPO :: PartialOrdering -> Bool prop_zero_seqPO = isZero POAny seqPO -- | 'seqPO' is associative. prop_associative_seqPO :: PartialOrdering -> PartialOrdering -> PartialOrdering -> Bool prop_associative_seqPO = associative seqPO -- | 'seqPO' is also commutative. prop_commutative_seqPO :: PartialOrdering -> PartialOrdering -> Bool prop_commutative_seqPO = commutative seqPO -- | 'seqPO' is idempotent. prop_idempotent_seqPO :: PartialOrdering -> Bool prop_idempotent_seqPO = idempotent seqPO -- | 'seqPO' distributes over 'orPO'. prop_distributive_seqPO_orPO :: PartialOrdering -> PartialOrdering -> PartialOrdering -> Bool prop_distributive_seqPO_orPO = distributive seqPO orPO -- | The result of 'toOrderings' is a sorted list without duplicates. prop_sorted_toOrderings :: PartialOrdering -> Bool prop_sorted_toOrderings p = sortUniq os == os where os = toOrderings p -- | From 'Ordering' to 'PartialOrdering' and back is the identity. prop_toOrderings_after_fromOrdering :: Ordering -> Bool prop_toOrderings_after_fromOrdering o = toOrderings (fromOrdering o) == [o] -- | From 'PartialOrdering' to 'Orderings' and back is the identity. prop_fromOrderings_after_toOrderings :: PartialOrdering -> Bool prop_fromOrderings_after_toOrderings p = fromOrderings (toOrderings p) == p -- | From 'Orderings' to 'PartialOrdering' and back is the identity. -- Except for @[LT,GT]@ which is a non-canonical representative of 'POAny'. prop_toOrderings_after_fromOrderings :: NonEmptyList Ordering -> Bool prop_toOrderings_after_fromOrderings (NonEmpty os) = Set.fromList os `Set.isSubsetOf` Set.fromList (toOrderings (fromOrderings os)) -- | Pairs are related iff both components are related. prop_related_pair :: ISet -> ISet -> ISet -> ISet -> PartialOrdering -> Bool prop_related_pair (ISet x1) (ISet x2) (ISet y1) (ISet y2) o = related (x1,x2) o (y1,y2) == (related x1 o y1 && related x2 o y2) -- | Comparing 'PartialOrdering's amounts to compare their representation as -- 'Ordering' sets. prop_comparable_PartialOrdering :: PartialOrdering -> PartialOrdering -> Bool prop_comparable_PartialOrdering p q = comparable p q == comparable (to p) (to q) where to = Inclusion . toOrderings ------------------------------------------------------------------------ -- * All tests ------------------------------------------------------------------------ -- Template Haskell hack to make the following $quickCheckAll work -- under ghc-7.8. return [] -- KEEP! -- | All tests as collected by 'quickCheckAll'. -- -- Using 'quickCheckAll' is convenient and superior to the manual -- enumeration of tests, since the name of the property is -- added automatically. tests :: IO Bool tests = do putStrLn "Agda.Utils.PartialOrd" $quickCheckAll -- tests' :: IO Bool -- tests' = runTests "Agda.Utils.PartialOrd" -- [ quickCheck' prop_comparable_related -- , quickCheck' prop_oppPO -- , quickCheck' prop_seqPO -- , quickCheck' prop_assoc_seqPO -- , quickCheck' prop_related_pair -- ] Agda-2.4.2.5/src/full/Agda/Utils/Lens.hs0000644000000000000000000000415512635075266015647 0ustar0000000000000000{-# LANGUAGE RankNTypes #-} -- | A cut-down implementation of lenses, with names taken from -- Edward Kmett's lens package. module Agda.Utils.Lens ( module Agda.Utils.Lens , (<&>) -- reexported from Agda.Utils.Functor ) where import Control.Applicative ( Const(Const), getConst ) import Control.Monad.State import Control.Monad.Reader import Control.Monad.Writer import Data.Functor.Identity import Agda.Utils.Functor ((<&>)) -- * Type-preserving lenses. -- | Van Laarhoven style homogeneous lenses. -- Mnemoic: "Lens inner outer". type Lens' i o = forall f. Functor f => (i -> f i) -> o -> f o -- * Elementary lens operations. infixl 8 ^. -- | Get inner part @i@ of structure @o@ as designated by @Lens' i o@. (^.) :: o -> Lens' i o -> i o ^. l = getConst $ l Const o -- | Set inner part @i@ of structure @o@ as designated by @Lens' i o@. set :: Lens' i o -> i -> o -> o set l = over l . const -- | Modify inner part @i@ of structure @o@ using a function @i -> i@. over :: Lens' i o -> (i -> i) -> o -> o over l f o = runIdentity $ l (Identity . f) o -- * State accessors and modifiers. -- | Read a part of the state. use :: MonadState o m => Lens' i o -> m i use l = gets (^. l) infix 4 .= -- | Write a part of the state. (.=) :: MonadState o m => Lens' i o -> i -> m () l .= i = modify $ set l i infix 4 %= -- | Modify a part of the state. (%=) :: MonadState o m => Lens' i o -> (i -> i) -> m () l %= f = modify $ over l f infix 4 %== -- | Modify a part of the state monadically. (%==) :: (MonadState o m, Functor m) => Lens' i o -> (i -> m i) -> m () l %== f = put =<< l f =<< get infix 4 %%= -- | Modify a part of the state monadically, and return some result. (%%=) :: (MonadState o m, Functor m) => Lens' i o -> (i -> m (i, r)) -> m r l %%= f = do o <- get (o', r) <- runWriterT $ l (WriterT . f) o put o' return r -- * Read-only state accessors and modifiers. -- | Ask for part of read-only state. view :: MonadReader o m => Lens' i o -> m i view l = asks (^. l) -- | Modify a part of the state in a subcomputation. locally :: MonadReader o m => Lens' i o -> (i -> i) -> m a -> m a locally l = local . over l Agda-2.4.2.5/src/full/Agda/Utils/TestHelpers.hs0000644000000000000000000001003712635075266017204 0ustar0000000000000000-- | Some functions and generators suitable for writing QuickCheck -- properties. module Agda.Utils.TestHelpers ( -- * Algebraic properties associative , commutative , idempotent , isZero , identity , leftDistributive , rightDistributive , distributive -- * Generators , natural , positive , maybeGen , maybeCoGen , listOfElements , elementsUnlessEmpty , two , three -- * Test driver. , runTests ) where import Control.Monad import Data.Functor import Test.QuickCheck ------------------------------------------------------------------------ -- Algebraic properties -- | Is the operator associative? associative :: (Arbitrary a, Eq a, Show a) => (a -> a -> a) -> a -> a -> a -> Bool associative (+) = \x y z -> x + (y + z) == (x + y) + z -- | Is the operator commutative? commutative :: (Arbitrary a, Eq a, Show a) => (a -> a -> a) -> a -> a -> Bool commutative (+) = \x y -> x + y == y + x -- | Is the operator idempotent? idempotent :: (Arbitrary a, Eq a, Show a) => (a -> a -> a) -> a -> Bool idempotent (/\) = \ x -> (x /\ x) == x -- | Is the element a zero for the operator? isZero :: (Arbitrary a, Eq a, Show a) => a -> (a -> a -> a) -> a -> Bool isZero zer (*) = \x -> (zer * x == zer) && (x * zer == zer) -- | Is the element a unit for the operator? identity :: (Arbitrary a, Eq a, Show a) => a -> (a -> a -> a) -> a -> Bool identity one (*) = \x -> (one * x == x) && (x * one == x) -- | Does the first operator distribute (from the left) over the -- second one? leftDistributive :: (Arbitrary a, Eq a, Show a) => (a -> a -> a) -> (a -> a -> a) -> a -> a -> a -> Bool leftDistributive (*) (+) = \x y z -> x * (y + z) == (x * y) + (x * z) -- | Does the first operator distribute (from the right) over the -- second one? rightDistributive :: (Arbitrary a, Eq a, Show a) => (a -> a -> a) -> (a -> a -> a) -> a -> a -> a -> Bool rightDistributive (*) (+) = \x y z -> (x + y) * z == (x * z) + (y * z) -- | Does the first operator distribute over the second one? distributive :: (Arbitrary a, Eq a, Show a) => (a -> a -> a) -> (a -> a -> a) -> a -> a -> a -> Bool distributive (*) (+) = \ x y z -> leftDistributive (*) (+) x y z && rightDistributive (*) (+) x y z ------------------------------------------------------------------------ -- Generators -- | Generates natural numbers. natural :: (Integral i) => Gen i natural = fromInteger . abs <$> arbitrary -- | Generates positive numbers. positive :: (Integral i) => Gen i positive = succ <$> natural -- | Generates a list of elements picked from a given list. listOfElements :: [a] -> Gen [a] listOfElements [] = return [] listOfElements xs = listOf $ elements xs -- | If the given list is non-empty, then an element from the list is -- generated, and otherwise an arbitrary element is generated. elementsUnlessEmpty :: Arbitrary a => [a] -> Gen a elementsUnlessEmpty [] = arbitrary elementsUnlessEmpty xs = elements xs -- | Generates values of 'Maybe' type, using the given generator to -- generate the contents of the 'Just' constructor. maybeGen :: Gen a -> Gen (Maybe a) maybeGen gen = frequency [ (1, return Nothing) , (9, Just <$> gen) ] -- | 'Coarbitrary' \"generator\" for 'Maybe'. maybeCoGen :: (a -> Gen b -> Gen b) -> (Maybe a -> Gen b -> Gen b) maybeCoGen f Nothing = variant 0 maybeCoGen f (Just x) = variant 1 . f x -- | Generates two elements. two :: Gen a -> Gen (a, a) two gen = liftM2 (,) gen gen -- | Generates three elements. three :: Gen a -> Gen (a, a, a) three gen = liftM3 (,,) gen gen gen ------------------------------------------------------------------------ -- Test driver -- | Runs the tests, and returns 'True' if all tests were successful. runTests :: String -- ^ A label for the tests. Used for -- informational purposes. -> [IO Bool] -> IO Bool runTests name tests = do putStrLn name and <$> sequence tests Agda-2.4.2.5/src/full/Agda/Utils/Impossible.hs0000644000000000000000000000211412635075266017045 0ustar0000000000000000------------------------------------------------------------------------ -- | An interface for reporting \"impossible\" errors ------------------------------------------------------------------------ {-# LANGUAGE DeriveDataTypeable #-} module Agda.Utils.Impossible where import Control.Exception as E import Data.Typeable ( Typeable ) -- | \"Impossible\" errors, annotated with a file name and a line -- number corresponding to the source code location of the error. data Impossible = Impossible String Integer deriving Typeable instance Show Impossible where show (Impossible file line) = unlines [ "An internal error has occurred. Please report this as a bug." , "Location of the error: " ++ file ++ ":" ++ show line ] instance Exception Impossible -- | Abort by throwing an \"impossible\" error. You should not use -- this function directly. Instead use the macro in @undefined.h@. throwImpossible :: Impossible -> a throwImpossible = throw -- | Catch an \"impossible\" error, if possible. catchImpossible :: IO a -> (Impossible -> IO a) -> IO a catchImpossible = E.catch Agda-2.4.2.5/src/full/Agda/Utils/Geniplate.hs0000644000000000000000000000260012635075266016647 0ustar0000000000000000{-# LANGUAGE TemplateHaskell #-} -- | Utilities related to Geniplate. module Agda.Utils.Geniplate ( instanceUniverseBiT' , instanceTransformBiMT' , dontDescendInto ) where import Data.Generics.Geniplate import Data.Map (Map) import qualified Language.Haskell.TH as TH import qualified Agda.Syntax.Abstract.Name as A import qualified Agda.Syntax.Concrete.Name as C import qualified Agda.Syntax.Scope.Base as S -- | Types which Geniplate should not descend into. dontDescendInto :: [TH.TypeQ] dontDescendInto = [ [t| String |] , [t| A.QName |] , [t| A.Name |] , [t| C.Name |] , [t| S.ScopeInfo |] , [t| Map A.QName A.QName |] , [t| Map A.ModuleName A.ModuleName |] , [t| A.AmbiguousQName |] ] -- | A localised instance of 'instanceUniverseBiT'. The generated -- 'universeBi' functions neither descend into the types in -- 'dontDescendInto', nor into the types in the list argument. instanceUniverseBiT' :: [TH.TypeQ] -> TH.TypeQ -> TH.Q [TH.Dec] instanceUniverseBiT' ts p = instanceUniverseBiT (ts ++ dontDescendInto) p -- | A localised instance of 'instanceTransformBiMT'. The generated -- 'transformBiM' functions neither descend into the types in -- 'dontDescendInto', nor into the types in the list argument. instanceTransformBiMT' :: [TH.TypeQ] -> TH.TypeQ -> TH.TypeQ -> TH.Q [TH.Dec] instanceTransformBiMT' ts p = instanceTransformBiMT (ts ++ dontDescendInto) p Agda-2.4.2.5/src/full/Agda/Utils/Suffix.hs0000644000000000000000000000551412635075266016212 0ustar0000000000000000{-# LANGUAGE CPP #-} {-# LANGUAGE PatternGuards #-} module Agda.Utils.Suffix where import Data.Char import Agda.Utils.Function #include "undefined.h" import Agda.Utils.Impossible ------------------------------------------------------------------------ -- Subscript digits -- | Is the character one of the subscripts @'₀'@-@'₉'@? isSubscriptDigit :: Char -> Bool isSubscriptDigit c = '₀' <= c && c <= '₉' -- | Converts @'0'@-@'9'@ to @'₀'@-@'₉'@. -- -- Precondition: The digit needs to be in range. toSubscriptDigit :: Char -> Char toSubscriptDigit d | isDigit d = toEnum (fromEnum '₀' + (fromEnum d - fromEnum '0')) | otherwise = __IMPOSSIBLE__ -- | Converts @'₀'@-@'₉'@ to @'0'@-@'9'@. -- -- Precondition: The digit needs to be in range. fromSubscriptDigit :: Char -> Char fromSubscriptDigit d | isSubscriptDigit d = toEnum (fromEnum '0' + (fromEnum d - fromEnum '₀')) | otherwise = __IMPOSSIBLE__ ------------------------------------------------------------------------ -- Suffices -- | Classification of identifier variants. data Suffix = NoSuffix | Prime Int -- ^ Identifier ends in @Int@ many primes. | Index Int -- ^ Identifier ends in number @Int@ (ordinary digits). | Subscript Int -- ^ Identifier ends in number @Int@ (subscript digits). -- | Increase the suffix by one. If no suffix yet, put a subscript @1@. nextSuffix :: Suffix -> Suffix nextSuffix NoSuffix = Subscript 1 nextSuffix (Prime i) = Prime $ i + 1 nextSuffix (Index i) = Index $ i + 1 nextSuffix (Subscript i) = Subscript $ i + 1 -- | Parse suffix. suffixView :: String -> (String, Suffix) suffixView s | (ps@(_:_), s') <- span (=='\'') rs = (reverse s', Prime $ length ps) | (ns@(_:_), s') <- span isDigit rs = (reverse s', Index $ read $ reverse ns) | (ns@(_:_), s') <- span isSubscriptDigit rs = (reverse s', Subscript $ read $ map fromSubscriptDigit $ reverse ns) | otherwise = (s, NoSuffix) where rs = reverse s -- | Print suffix. addSuffix :: String -> Suffix -> String addSuffix s NoSuffix = s addSuffix s (Prime n) = s ++ replicate n '\'' addSuffix s (Index i) = s ++ show i addSuffix s (Subscript i) = s ++ map toSubscriptDigit (show i) -- | Add first available @Suffix@ to a name. nameVariant :: (String -> Bool) -- ^ Is the given name already taken? -> String -- ^ Name of which we want an available variant. -> String -- ^ Name extended by suffix that is not taken already. nameVariant taken x = addSuffix x $ trampoline step $ Prime 0 where -- if the current suffix is taken, repeat with next suffix, else done step s = if taken (addSuffix x s) then Right (nextSuffix s) else Left s Agda-2.4.2.5/src/full/Agda/Utils/VarSet.hs0000644000000000000000000000232112635075266016143 0ustar0000000000000000 -- | Var field implementation of sets of (small) natural numbers. module Agda.Utils.VarSet ( VarSet , union, unions, member, empty, delete, singleton , fromList, toList, toDescList , isSubsetOf, IntSet.null , intersection, difference , Agda.Utils.VarSet.subtract ) where import Data.IntSet (IntSet) import Data.IntSet as IntSet type VarSet = IntSet subtract :: Int -> VarSet -> VarSet subtract n = IntSet.map (Prelude.subtract n) {- import Data.Bits type VarSet = Integer type Var = Integer union :: VarSet -> VarSet -> VarSet union = (.|.) member :: Var -> VarSet -> Bool member b s = testVar s (fromIntegral b) empty :: VarSet empty = 0 delete :: Var -> VarSet -> VarSet delete b s = clearVar s (fromIntegral b) singleton :: Var -> VarSet singleton = bit subtract :: Int -> VarSet -> VarSet subtract n s = shiftR s n fromList :: [Var] -> VarSet fromList = foldr (union . singleton . fromIntegral) empty isSubsetOf :: VarSet -> VarSet -> Bool isSubsetOf s1 s2 = 0 == (s1 .&. complement s2) toList :: VarSet -> [Var] toList s = loop 0 s where loop i 0 = [] loop i n | testVar n 0 = fromIntegral i : (loop $! i + 1) (shiftR n 1) | otherwise = (loop $! i + 1) (shiftR n 1) -} Agda-2.4.2.5/src/full/Agda/Utils/Update.hs0000644000000000000000000001030212635075266016157 0ustar0000000000000000{-# LANGUAGE GeneralizedNewtypeDeriving #-} module Agda.Utils.Update ( Change , MonadChange(..) , runChange , Updater , sharing , runUpdater , dirty , ifDirty , Updater1(..) , Updater2(..) ) where import Control.Applicative import Control.Monad.Identity import Control.Monad.Trans import Control.Monad.Writer.Strict import Data.Traversable (Traversable(..), traverse) import Agda.Utils.Tuple -- * Change monad. -- | The class of change monads. class Monad m => MonadChange m where tellDirty :: m () -- ^ Mark computation as having changed something. listenDirty :: m a -> m (a, Bool) -- | The @ChangeT@ monad transformer. newtype ChangeT m a = ChangeT { fromChangeT :: WriterT Any m a } deriving (Functor, Applicative, Monad, MonadTrans) instance Monad m => MonadChange (ChangeT m) where tellDirty = ChangeT $ tell $ Any True listenDirty m = ChangeT $ do (a, Any dirty) <- listen (fromChangeT m) return (a, dirty) -- | A mock change monad. instance MonadChange Identity where tellDirty = Identity () listenDirty (Identity a) = Identity (a, True) -- * Pure endo function and updater type EndoFun a = a -> a type Updater a = a -> Change a -- BEGIN REAL STUFF -- | The @Change@ monad. newtype Change a = Change { fromChange :: Writer Any a } deriving (Functor, Applicative, Monad) instance MonadChange Change where tellDirty = Change $ tell $ Any True listenDirty m = Change $ do (a, Any dirty) <- listen (fromChange m) return (a, dirty) -- | Run a 'Change' computation, returning result plus change flag. runChange :: Change a -> (a, Bool) runChange = mapSnd getAny . runWriter . fromChange -- | Blindly run an updater. runUpdater :: Updater a -> a -> (a, Bool) runUpdater f a = runChange $ f a -- | Mark a computation as dirty. dirty :: Updater a dirty a = do tellDirty return a {-# SPECIALIZE ifDirty :: Change a -> (a -> Change b) -> (a -> Change b) -> Change b #-} {-# SPECIALIZE ifDirty :: Identity a -> (a -> Identity b) -> (a -> Identity b) -> Identity b #-} ifDirty :: MonadChange m => m a -> (a -> m b) -> (a -> m b) -> m b ifDirty m f g = do (a, dirty) <- listenDirty m if dirty then f a else g a -- * Proper updater (Q-combinators) -- | Replace result of updating with original input if nothing has changed. sharing :: Updater a -> Updater a sharing f a = do (a', changed) <- listenDirty $ f a return $ if changed then a' else a -- | Eval an updater (using 'sharing'). evalUpdater :: Updater a -> EndoFun a evalUpdater f a = fst $ runWriter $ fromChange $ sharing f a -- END REAL STUFF -- * Updater transformer classes -- ** Unary (functors) -- | Like 'Functor', but preserving sharing. class Traversable f => Updater1 f where updater1 :: Updater a -> Updater (f a) updates1 :: Updater a -> Updater (f a) -- ^ @= sharing . updater1@ update1 :: Updater a -> EndoFun (f a) updater1 = traverse updates1 f = sharing $ updater1 f update1 f = evalUpdater $ updater1 f instance Updater1 Maybe where instance Updater1 [] where updater1 f [] = return [] updater1 f (x : xs) = (:) <$> f x <*> updates1 f xs -- ** Binary (bifunctors) -- | Like 'Bifunctor', but preserving sharing. class Updater2 f where updater2 :: Updater a -> Updater b -> Updater (f a b) updates2 :: Updater a -> Updater b -> Updater (f a b) update2 :: Updater a -> Updater b -> EndoFun (f a b) updates2 f1 f2 = sharing $ updater2 f1 f2 update2 f1 f2 = evalUpdater $ updater2 f1 f2 instance Updater2 (,) where updater2 f1 f2 (a,b) = (,) <$> sharing f1 a <*> sharing f2 b instance Updater2 Either where updater2 f1 f2 (Left a) = Left <$> f1 a updater2 f1 f2 (Right b) = Right <$> f2 b {-- BEGIN MOCK -- * Mock updater type Change = Identity -- | Replace result of updating with original input if nothing has changed. {-# INLINE sharing #-} sharing :: Updater a -> Updater a sharing f a = f a -- | Run an updater. {-# INLINE evalUpdater #-} evalUpdater :: Updater a -> EndoFun a evalUpdater f a = runIdentity (f a) -- | Mark a computation as dirty. {-# INLINE dirty #-} dirty :: Updater a dirty = Identity {-# INLINE ifDirty #-} ifDirty :: Identity a -> (a -> Identity b) -> (a -> Identity b) -> Identity b ifDirty m f g = m >>= f -- END MOCK -} Agda-2.4.2.5/src/full/Agda/Utils/Permutation.hs0000644000000000000000000002245312635075266017256 0ustar0000000000000000{-# LANGUAGE CPP #-} {-# LANGUAGE DeriveDataTypeable #-} {-# LANGUAGE DeriveFoldable #-} {-# LANGUAGE DeriveFunctor #-} {-# LANGUAGE DeriveTraversable #-} {-# LANGUAGE FlexibleInstances #-} {-# LANGUAGE MultiParamTypeClasses #-} {-# LANGUAGE TupleSections #-} module Agda.Utils.Permutation where import Prelude hiding (drop, null) import Data.IntMap (IntMap) import qualified Data.IntMap as IntMap import Data.List hiding (drop, null) import qualified Data.List as List import Data.Maybe import Data.Foldable (Foldable) import Data.Traversable (Traversable) import Data.Typeable (Typeable) import Test.QuickCheck import Agda.Syntax.Position (KillRange(..)) import Agda.Utils.Functor import Agda.Utils.List ((!!!)) import Agda.Utils.Null import Agda.Utils.Size #include "undefined.h" import Agda.Utils.Impossible -- | Partial permutations. Examples: -- -- @permute [1,2,0] [x0,x1,x2] = [x1,x2,x0]@ (proper permutation). -- -- @permute [1,0] [x0,x1,x2] = [x1,x0]@ (partial permuation). -- -- @permute [1,0,1,2] [x0,x1,x2] = [x1,x0,x1,x2]@ (not a permutation because not invertible). -- -- Agda typing would be: -- @Perm : {m : Nat}(n : Nat) -> Vec (Fin n) m -> Permutation@ -- @m@ is the 'size' of the permutation. data Permutation = Perm { permRange :: Int, permPicks :: [Int] } deriving (Eq, Typeable) instance Show Permutation where show (Perm n xs) = showx [0..n - 1] ++ " -> " ++ showx xs where showx = showList "," (\ i -> "x" ++ show i) showList :: String -> (a -> String) -> [a] -> String showList sep f [] = "" showList sep f [e] = f e showList sep f (e:es) = f e ++ sep ++ showList sep f es instance Sized Permutation where size (Perm _ xs) = size xs instance Null Permutation where empty = Perm 0 [] null (Perm _ picks) = null picks instance KillRange Permutation where killRange = id -- | @permute [1,2,0] [x0,x1,x2] = [x1,x2,x0]@ -- More precisely, @permute indices list = sublist@, generates @sublist@ -- from @list@ by picking the elements of list as indicated by @indices@. -- @permute [1,3,0] [x0,x1,x2,x3] = [x1,x3,x0]@ -- -- Agda typing: -- @permute (Perm {m} n is) : Vec A m -> Vec A n@ permute :: Permutation -> [a] -> [a] permute p xs = map (fromMaybe __IMPOSSIBLE__) (safePermute p xs) safePermute :: Permutation -> [a] -> [Maybe a] safePermute (Perm _ is) xs = map (xs !!!!) is where xs !!!! n | n < 0 = Nothing | otherwise = xs !!! n -- | Invert a Permutation on a partial finite int map. -- @inversePermute perm f = f'@ -- such that @permute perm f' = f@ -- -- Example, with map represented as @[Maybe a]@: -- @ -- f = [Nothing, Just a, Just b ] -- perm = Perm 4 [3,0,2] -- f' = [ Just a , Nothing , Just b , Nothing ] -- @ -- Zipping @perm@ with @f@ gives @[(0,a),(2,b)]@, after compression -- with @catMaybes@. This is an @IntMap@ which can easily -- written out into a substitution again. class InversePermute a b where inversePermute :: Permutation -> a -> b instance InversePermute [Maybe a] [(Int,a)] where inversePermute (Perm n is) = catMaybes . zipWith (\ i ma -> (i,) <$> ma) is instance InversePermute [Maybe a] (IntMap a) where inversePermute p = IntMap.fromList . inversePermute p instance InversePermute [Maybe a] [Maybe a] where inversePermute p@(Perm n _) = tabulate . inversePermute p where tabulate m = for [0..n-1] $ \ i -> IntMap.lookup i m instance InversePermute (Int -> a) [Maybe a] where inversePermute (Perm n xs) f = for [0..n-1] $ \ x -> f <$> findIndex (x ==) xs -- | Identity permutation. idP :: Int -> Permutation idP n = Perm n [0..n - 1] -- | Restrict a permutation to work on @n@ elements, discarding picks @>=n@. takeP :: Int -> Permutation -> Permutation takeP n (Perm m xs) = Perm n $ filter (< n) xs -- | Pick the elements that are not picked by the permutation. droppedP :: Permutation -> Permutation droppedP (Perm n xs) = Perm n $ [0..n-1] \\ xs -- | @liftP k@ takes a @Perm {m} n@ to a @Perm {m+k} (n+k)@. -- Analogous to 'Agda.TypeChecking.Substitution.liftS', -- but Permutations operate on de Bruijn LEVELS, not indices. liftP :: Int -> Permutation -> Permutation liftP n (Perm m xs) = Perm (n + m) $ xs ++ [m..m+n-1] -- liftP n (Perm m xs) = Perm (n + m) $ [0..n-1] ++ map (n+) xs -- WRONG, works for indices, but not for levels -- | @permute (compose p1 p2) == permute p1 . permute p2@ composeP :: Permutation -> Permutation -> Permutation composeP p1 (Perm n xs) = Perm n $ permute p1 xs {- proof: permute (compose (Perm xs) (Perm ys)) zs == permute (Perm (permute (Perm xs) ys)) zs == map (zs !!) (permute (Perm xs) ys) == map (zs !!) (map (ys !!) xs) == map (zs !! . ys !!) xs == map (\x -> zs !! (ys !! x)) xs == map (\x -> map (zs !!) ys !! x) xs {- map f xs !! n == f (xs !! n) -} == map (map (zs !!) ys !!) xs == permute (Perm xs) (permute (Perm ys) zs) -} -- | @invertP err p@ is the inverse of @p@ where defined, -- otherwise defaults to @err@. -- @composeP p (invertP err p) == p@ invertP :: Int -> Permutation -> Permutation invertP err p@(Perm n xs) = Perm (size xs) $ map inv [0..n - 1] where inv x = fromMaybe err (findIndex (x ==) xs) -- | Turn a possible non-surjective permutation into a surjective permutation. compactP :: Permutation -> Permutation compactP (Perm n xs) = Perm m $ map adjust xs where m = genericLength xs missing = [0..n - 1] \\ xs holesBelow k = genericLength $ filter (< k) missing adjust k = k - holesBelow k -- | @permute (reverseP p) xs == -- reverse $ permute p $ reverse xs@ -- -- Example: -- @ -- permute (reverseP (Perm 4 [1,3,0])) [x0,x1,x2,x3] -- == permute (Perm 4 $ map (3-) [0,3,1]) [x0,x1,x2,x3] -- == permute (Perm 4 [3,0,2]) [x0,x1,x2,x3] -- == [x3,x0,x2] -- == reverse [x2,x0,x3] -- == reverse $ permute (Perm 4 [1,3,0]) [x3,x2,x1,x0] -- == reverse $ permute (Perm 4 [1,3,0]) $ reverse [x0,x1,x2,x3] -- @ -- -- With @reverseP@, you can convert a permutation on de Bruijn indices -- to one on de Bruijn levels, and vice versa. reverseP :: Permutation -> Permutation reverseP (Perm n xs) = Perm n $ map ((n - 1) -) $ reverse xs -- = flipP $ Perm n $ reverse xs -- | @permPicks (flipP p) = permute p (downFrom (permRange p))@ -- or -- @permute (flipP (Perm n xs)) [0..n-1] = permute (Perm n xs) (downFrom n)@ -- -- Can be use to turn a permutation from (de Bruijn) levels to levels -- to one from levels to indices. -- -- See 'Agda.Syntax.Internal.Patterns.numberPatVars'. flipP :: Permutation -> Permutation flipP (Perm n xs) = Perm n $ map (n - 1 -) xs -- | @expandP i n π@ in the domain of @π@ replace the /i/th element by /n/ elements. expandP :: Int -> Int -> Permutation -> Permutation expandP i n (Perm m xs) = Perm (m + n - 1) $ concatMap expand xs where expand j | j == i = [i..i + n - 1] | j < i = [j] | otherwise = [j + n - 1] -- | Stable topologic sort. The first argument decides whether its first -- argument is an immediate parent to its second argument. topoSort :: (a -> a -> Bool) -> [a] -> Maybe Permutation topoSort parent xs = fmap (Perm (size xs)) $ topo g where nodes = zip [0..] xs g = [ (n, parents x) | (n, x) <- nodes ] parents x = [ n | (n, y) <- nodes, parent y x ] topo :: Eq node => [(node, [node])] -> Maybe [node] topo [] = return [] topo g = case xs of [] -> fail "cycle detected" x : _ -> do ys <- topo $ remove x g return $ x : ys where xs = [ x | (x, []) <- g ] remove x g = [ (y, filter (/= x) ys) | (y, ys) <- g, x /= y ] ------------------------------------------------------------------------ -- * Drop (apply) and undrop (abstract) ------------------------------------------------------------------------ -- | Delayed dropping which allows undropping. data Drop a = Drop { dropN :: Int -- ^ Non-negative number of things to drop. , dropFrom :: a -- ^ Where to drop from. } deriving (Eq, Ord, Show, Typeable, Functor, Foldable, Traversable) instance KillRange a => KillRange (Drop a) where killRange = fmap killRange -- | Things that support delayed dropping. class DoDrop a where doDrop :: Drop a -> a -- ^ Perform the dropping. dropMore :: Int -> Drop a -> Drop a -- ^ Drop more. dropMore n (Drop m xs) = Drop (m + n) xs unDrop :: Int -> Drop a -> Drop a -- ^ Pick up dropped stuff. unDrop n (Drop m xs) | n <= m = Drop (m - n) xs | otherwise = __IMPOSSIBLE__ instance DoDrop [a] where doDrop (Drop m xs) = List.drop m xs instance DoDrop Permutation where doDrop (Drop k (Perm n xs)) = Perm (n + m) $ [0..m-1] ++ map (+ m) (List.drop k xs) where m = -k unDrop m = dropMore (-m) -- allow picking up more than dropped ------------------------------------------------------------------------ -- * Test data generator ------------------------------------------------------------------------ instance Arbitrary Permutation where arbitrary = do is <- nub . map getNonNegative <$> arbitrary NonNegative n <- arbitrary return $ Perm (if null is then n else maximum is + n + 1) is ------------------------------------------------------------------------ -- * Properties, see "Agda.Utils.Permutation.Tests". ------------------------------------------------------------------------ Agda-2.4.2.5/src/full/Agda/Utils/List.hs0000644000000000000000000003106312635075266015657 0ustar0000000000000000{-# OPTIONS_GHC -fno-warn-missing-signatures #-} {-# LANGUAGE CPP #-} {-# LANGUAGE PatternGuards #-} {-# LANGUAGE TemplateHaskell #-} {-| Utitlity functions on lists. -} module Agda.Utils.List where import Data.Functor ((<$>)) import Data.Function import Data.List import Data.Maybe import Data.Map (Map) import qualified Data.Map as Map import qualified Data.Set as Set import Text.Show.Functions () import Test.QuickCheck import Test.QuickCheck.All import Agda.Utils.Bag (Bag) import qualified Agda.Utils.Bag as Bag import Agda.Utils.TestHelpers -- import Agda.Utils.QuickCheck -- Andreas, 2014-04-27 Inconvenient -- because cabal-only CPP directive import Agda.Utils.Tuple #include "undefined.h" import Agda.Utils.Impossible -- | Case distinction for lists, with list first. -- Cf. 'Agda.Utils.Null.ifNull'. caseList :: [a] -> b -> (a -> [a] -> b) -> b caseList [] n c = n caseList (x:xs) n c = c x xs -- | Case distinction for lists, with list last. listCase :: b -> (a -> [a] -> b) -> [a] -> b listCase n c [] = n listCase n c (x:xs) = c x xs -- | Head function (safe). headMaybe :: [a] -> Maybe a headMaybe = listToMaybe -- | Head function (safe). Returns a value on empty lists. -- -- > headWithDefault 42 [] = 42 -- > headWithDefault 42 [1,2,3] = 1 headWithDefault :: a -> [a] -> a headWithDefault def = fromMaybe def . headMaybe -- | Last element (safe). lastMaybe :: [a] -> Maybe a lastMaybe [] = Nothing lastMaybe xs = Just $ last xs -- | Opposite of cons @(:)@, safe. uncons :: [a] -> Maybe (a, [a]) uncons [] = Nothing uncons (x:xs) = Just (x,xs) -- | Maybe cons. @mcons ma as = maybeToList ma ++ as@ mcons :: Maybe a -> [a] -> [a] mcons ma as = maybe as (:as) ma -- | 'init' and 'last' in one go, safe. initLast :: [a] -> Maybe ([a],a) initLast [] = Nothing initLast as = Just $ loop as where loop [] = __IMPOSSIBLE__ loop [a] = ([], a) loop (a : as) = mapFst (a:) $ loop as -- | Lookup function (partially safe). (!!!) :: [a] -> Int -> Maybe a _ !!! n | n < 0 = __IMPOSSIBLE__ [] !!! _ = Nothing (x : _) !!! 0 = Just x (_ : xs) !!! n = xs !!! (n - 1) -- | downFrom n = [n-1,..1,0] downFrom :: Integral a => a -> [a] downFrom n | n <= 0 = [] | otherwise = let n' = n-1 in n' : downFrom n' -- | Update the first element of a list, if it exists. updateHead :: (a -> a) -> [a] -> [a] updateHead f [] = [] updateHead f (a : as) = f a : as spec_updateHead f as = let (bs, cs) = splitAt 1 as in map f bs ++ cs prop_updateHead f as = updateHead f as == spec_updateHead f as -- | Update the last element of a list, if it exists. updateLast :: (a -> a) -> [a] -> [a] updateLast f [] = [] updateLast f [a] = [f a] updateLast f (a : as@(_ : _)) = a : updateLast f as spec_updateLast f as = let (bs, cs) = splitAt (length as - 1) as in bs ++ map f cs prop_updateLast f as = updateLast f as == spec_updateLast f as -- | Update nth element of a list, if it exists. -- Precondition: the index is >= 0. updateAt :: Int -> (a -> a) -> [a] -> [a] updateAt _ f [] = [] updateAt 0 f (a : as) = f a : as updateAt n f (a : as) = a : updateAt (n-1) f as spec_updateAt n f as = let (bs, cs) = splitAt n as in bs ++ updateHead f cs prop_updateAt (NonNegative n) f as = updateAt n f as == spec_updateAt n f as -- | A generalized version of @partition@. -- (Cf. @mapMaybe@ vs. @filter@). mapEither :: (a -> Either b c) -> [a] -> ([b],[c]) {-# INLINE mapEither #-} mapEither f xs = foldr (deal f) ([],[]) xs deal :: (a -> Either b c) -> a -> ([b],[c]) -> ([b],[c]) deal f a ~(bs,cs) = case f a of Left b -> (b:bs, cs) Right c -> (bs, c:cs) -- | A generalized version of @takeWhile@. -- (Cf. @mapMaybe@ vs. @filter@). takeWhileJust :: (a -> Maybe b) -> [a] -> [b] takeWhileJust p = loop where loop (a : as) | Just b <- p a = b : loop as loop _ = [] -- | A generalized version of @span@. spanJust :: (a -> Maybe b) -> [a] -> ([b], [a]) spanJust p = loop where loop (a : as) | Just b <- p a = mapFst (b :) $ loop as loop as = ([], as) -- | Partition a list into 'Nothing's and 'Just's. -- @'mapMaybe' f = snd . partitionMaybe f@. partitionMaybe :: (a -> Maybe b) -> [a] -> ([a], [b]) partitionMaybe f = loop where loop [] = ([], []) loop (a : as) = case f a of Nothing -> mapFst (a :) $ loop as Just b -> mapSnd (b :) $ loop as -- | Sublist relation. isSublistOf :: Eq a => [a] -> [a] -> Bool isSublistOf [] ys = True isSublistOf (x : xs) ys = case dropWhile (x /=) ys of [] -> False (_:ys) -> isSublistOf xs ys type Prefix a = [a] type Suffix a = [a] -- | Check if a list has a given prefix. If so, return the list -- minus the prefix. maybePrefixMatch :: Eq a => Prefix a -> [a] -> Maybe (Suffix a) maybePrefixMatch [] rest = Just rest maybePrefixMatch (_:_) [] = Nothing maybePrefixMatch (p:pat) (r:rest) | p == r = maybePrefixMatch pat rest | otherwise = Nothing -- | Result of 'preOrSuffix'. data PreOrSuffix a = IsPrefix a [a] -- ^ First list is prefix of second. | IsSuffix a [a] -- ^ First list is suffix of second. | IsBothfix -- ^ The lists are equal. | IsNofix -- ^ The lists are incomparable. -- | Compare lists with respect to prefix partial order. preOrSuffix :: Eq a => [a] -> [a] -> PreOrSuffix a preOrSuffix [] [] = IsBothfix preOrSuffix [] (b:bs) = IsPrefix b bs preOrSuffix (a:as) [] = IsSuffix a as preOrSuffix (a:as) (b:bs) | a == b = preOrSuffix as bs | otherwise = IsNofix -- | Split a list into sublists. Generalisation of the prelude function -- @words@. -- -- > words xs == wordsBy isSpace xs wordsBy :: (a -> Bool) -> [a] -> [[a]] wordsBy p xs = yesP xs where yesP xs = noP (dropWhile p xs) noP [] = [] noP xs = ys : yesP zs where (ys,zs) = break p xs -- | Chop up a list in chunks of a given length. chop :: Int -> [a] -> [[a]] chop _ [] = [] chop n xs = ys : chop n zs where (ys,zs) = splitAt n xs -- | All ways of removing one element from a list. holes :: [a] -> [(a, [a])] holes [] = [] holes (x:xs) = (x, xs) : map (id -*- (x:)) (holes xs) -- | Check whether a list is sorted. -- -- Assumes that the 'Ord' instance implements a partial order. sorted :: Ord a => [a] -> Bool sorted [] = True sorted xs = and $ zipWith (<=) xs (tail xs) -- | Check whether all elements in a list are distinct from each -- other. Assumes that the 'Eq' instance stands for an equivalence -- relation. distinct :: Eq a => [a] -> Bool distinct [] = True distinct (x:xs) = x `notElem` xs && distinct xs -- | An optimised version of 'distinct'. -- -- Precondition: The list's length must fit in an 'Int'. fastDistinct :: Ord a => [a] -> Bool fastDistinct xs = Set.size (Set.fromList xs) == length xs prop_distinct_fastDistinct :: [Integer] -> Bool prop_distinct_fastDistinct xs = distinct xs == fastDistinct xs -- | Checks if all the elements in the list are equal. Assumes that -- the 'Eq' instance stands for an equivalence relation. allEqual :: Eq a => [a] -> Bool allEqual [] = True allEqual (x : xs) = all (== x) xs -- | Returns an (arbitrary) representative for each list element -- that occurs more than once. duplicates :: Ord a => [a] -> [a] duplicates = mapMaybe dup . Bag.groups . Bag.fromList where dup (a : _ : _) = Just a dup _ = Nothing -- | A variant of 'groupBy' which applies the predicate to consecutive -- pairs. groupBy' :: (a -> a -> Bool) -> [a] -> [[a]] groupBy' _ [] = [] groupBy' p xxs@(x : xs) = grp x $ zipWith (\x y -> (p x y, y)) xxs xs where grp x ys = (x : map snd xs) : tail where (xs, rest) = span fst ys tail = case rest of [] -> [] ((_, z) : zs) -> grp z zs prop_groupBy' :: (Bool -> Bool -> Bool) -> [Bool] -> Property prop_groupBy' p xs = classify (length xs - length gs >= 3) "interesting" $ concat gs == xs && and [not (null zs) | zs <- gs] && and [and (pairInitTail zs zs) | zs <- gs] && (null gs || not (or (pairInitTail (map last gs) (map head gs)))) where gs = groupBy' p xs pairInitTail xs ys = zipWith p (init xs) (tail ys) -- | @'groupOn' f = 'groupBy' (('==') \`on\` f) '.' 'sortBy' ('compare' \`on\` f)@. groupOn :: Ord b => (a -> b) -> [a] -> [[a]] groupOn f = groupBy ((==) `on` f) . sortBy (compare `on` f) -- | @splitExactlyAt n xs = Just (ys, zs)@ iff @xs = ys ++ zs@ -- and @genericLength ys = n@. splitExactlyAt :: Integral n => n -> [a] -> Maybe ([a], [a]) splitExactlyAt 0 xs = return ([], xs) splitExactlyAt n [] = Nothing splitExactlyAt n (x : xs) = mapFst (x :) <$> splitExactlyAt (n-1) xs -- | @'extractNthElement' n xs@ gives the @n@-th element in @xs@ -- (counting from 0), plus the remaining elements (preserving order). extractNthElement' :: Integral i => i -> [a] -> ([a], a, [a]) extractNthElement' n xs = (left, el, right) where (left, el : right) = genericSplitAt n xs extractNthElement :: Integral i => i -> [a] -> (a, [a]) extractNthElement n xs = (el, left ++ right) where (left, el, right) = extractNthElement' n xs prop_extractNthElement :: Integer -> [Integer] -> Property prop_extractNthElement n xs = 0 <= n && n < genericLength xs ==> genericTake n rest ++ [elem] ++ genericDrop n rest == xs where (elem, rest) = extractNthElement n xs -- | A generalised variant of 'elemIndex'. genericElemIndex :: (Eq a, Integral i) => a -> [a] -> Maybe i genericElemIndex x xs = listToMaybe $ map fst $ filter snd $ zip [0..] $ map (== x) xs prop_genericElemIndex :: Integer -> [Integer] -> Property prop_genericElemIndex x xs = classify (x `elem` xs) "members" $ genericElemIndex x xs == elemIndex x xs -- | Requires both lists to have the same length. zipWith' :: (a -> b -> c) -> [a] -> [b] -> [c] zipWith' f [] [] = [] zipWith' f (x : xs) (y : ys) = f x y : zipWith' f xs ys zipWith' f [] (_ : _) = {- ' -} __IMPOSSIBLE__ zipWith' f (_ : _) [] = {- ' -} __IMPOSSIBLE__ prop_zipWith' :: (Integer -> Integer -> Integer) -> Property prop_zipWith' f = forAll natural $ \n -> forAll (two $ vector n) $ \(xs, ys) -> zipWith' f xs ys == zipWith f xs ys {- UNUSED; a better type would be zipWithTails :: (a -> b -> c) -> [a] -> [b] -> ([c], Either [a] [b]) -- | Like zipWith, but returns the leftover elements of the input lists. zipWithTails :: (a -> b -> c) -> [a] -> [b] -> ([c], [a] , [b]) zipWithTails f xs [] = ([], xs, []) zipWithTails f [] ys = ([], [] , ys) zipWithTails f (x : xs) (y : ys) = (f x y : zs , as , bs) where (zs , as , bs) = zipWithTails f xs ys -} -- | Efficient version of nub that sorts the list via a search tree ('Data.Map'). uniqOn :: Ord b => (a -> b) -> [a] -> [a] uniqOn key = Map.elems . Map.fromList . map (\ a -> (key a, a)) -- Andreas, 2014-10-09 RETIRED, the Map version is simpler, -- and possibly more efficient (discards duplicates early). -- -- | Efficient version of nub that sorts the list first. The tag function is -- -- assumed to be cheap. If it isn't pair up the elements with their tags and -- -- call uniqOn fst (or snd). -- uniqOn :: Ord b => (a -> b) -> [a] -> [a] -- uniqOn tag = -- map head -- . groupBy ((==) `on` tag) -- . sortBy (compare `on` tag) prop_uniqOn :: [Integer] -> Bool prop_uniqOn xs = sort (nub xs) == uniqOn id xs -- | Compute the common suffix of two lists. commonSuffix :: Eq a => [a] -> [a] -> [a] commonSuffix xs ys = reverse $ (commonPrefix `on` reverse) xs ys -- | Compute the common prefix of two lists. commonPrefix :: Eq a => [a] -> [a] -> [a] commonPrefix [] _ = [] commonPrefix _ [] = [] commonPrefix (x:xs) (y:ys) | x == y = x : commonPrefix xs ys | otherwise = [] prop_commonPrefix :: [Integer] -> [Integer] -> [Integer] -> Bool prop_commonPrefix xs ys zs = and [ isPrefixOf zs zs' , isPrefixOf zs' (zs ++ xs) , isPrefixOf zs' (zs ++ ys) ] where zs' = commonPrefix (zs ++ xs) (zs ++ ys) prop_commonSuffix :: [Integer] -> [Integer] -> [Integer] -> Bool prop_commonSuffix xs ys zs = and [ isSuffixOf zs zs' , isSuffixOf zs' (xs ++ zs) , isSuffixOf zs' (ys ++ zs) ] where zs' = commonSuffix (xs ++ zs) (ys ++ zs) -- Hack to make $quickCheckAll work under ghc-7.8 return [] ------------------------------------------------------------------------ -- All tests tests :: IO Bool tests = do putStrLn "Agda.Utils.List" $quickCheckAll -- tests = runTests "Agda.Utils.List" -- [ quickCheck' prop_distinct_fastDistinct -- , quickCheck' prop_groupBy' -- , quickCheck' prop_extractNthElement -- , quickCheck' prop_genericElemIndex -- , quickCheck' prop_zipWith' -- , quickCheck' prop_uniqOn -- ] Agda-2.4.2.5/src/full/Agda/Utils/HashMap.hs0000644000000000000000000000143012635075266016260 0ustar0000000000000000module Agda.Utils.HashMap ( module HashMap , mapMaybe , alter ) where import Data.Hashable import Data.HashMap.Strict as HashMap import qualified Data.Maybe as Maybe -- | Like 'Data.Map.Strict.mapMaybe'. -- This code has not been benchmarked. Other implementations may be -- more efficient. mapMaybe :: (a -> Maybe b) -> HashMap k a -> HashMap k b mapMaybe f = fmap Maybe.fromJust . HashMap.filter Maybe.isJust . fmap f -- | Like 'Data.Map.Strict.alter'. alter :: (Eq k, Hashable k) => (Maybe a -> Maybe a) -> k -> HashMap k a -> HashMap k a alter f k m = case HashMap.lookup k m of Nothing -> case f Nothing of Nothing -> m Just v -> HashMap.insert k v m Just v -> case f (Just v) of Nothing -> HashMap.delete k m Just v -> HashMap.insert k v m Agda-2.4.2.5/src/full/Agda/Utils/Empty.hs0000644000000000000000000000070112635075266016035 0ustar0000000000000000{-# LANGUAGE CPP #-} {-# LANGUAGE EmptyDataDecls #-} -- | An empty type with some useful instances. module Agda.Utils.Empty where import Agda.Utils.Impossible #include "undefined.h" data Empty instance Eq Empty where _ == _ = True instance Ord Empty where compare _ _ = EQ instance Show Empty where showsPrec p _ = showParen (p > 9) $ showString "error \"Agda.Utils.Empty.Empty\"" absurd :: Empty -> a absurd e = seq e __IMPOSSIBLE__ Agda-2.4.2.5/src/full/Agda/Utils/Map.hs0000644000000000000000000000334012635075266015456 0ustar0000000000000000{-# LANGUAGE CPP #-} module Agda.Utils.Map where import Prelude hiding (map, lookup, mapM) import Control.Applicative import Data.Map as Map import Data.Traversable import Agda.Utils.Tuple #include "undefined.h" import Agda.Utils.Impossible -- * Monadic map operations --------------------------------------------------------------------------- data EitherOrBoth a b = L a | B a b | R b -- | Not very efficient (goes via a list), but it'll do. unionWithM :: (Ord k, Functor m, Monad m) => (a -> a -> m a) -> Map k a -> Map k a -> m (Map k a) unionWithM f m1 m2 = fromList <$> mapM combine (toList m) where m = unionWith both (map L m1) (map R m2) both (L a) (R b) = B a b both _ _ = __IMPOSSIBLE__ combine (k, B a b) = (,) k <$> f a b combine (k, L a) = return (k, a) combine (k, R b) = return (k, b) insertWithKeyM :: (Ord k, Monad m) => (k -> a -> a -> m a) -> k -> a -> Map k a -> m (Map k a) insertWithKeyM clash k x m = case lookup k m of Just y -> do z <- clash k x y return $ insert k z m Nothing -> return $ insert k x m -- * Non-monadic map operations --------------------------------------------------------------------------- -- | Big conjunction over a map. allWithKey :: (k -> a -> Bool) -> Map k a -> Bool allWithKey f = Map.foldrWithKey (\ k a b -> f k a && b) True -- | Filter a map based on the keys. filterKeys :: Ord k => (k -> Bool) -> Map k a -> Map k a filterKeys p = filterWithKey (const . p) -- | Unzip a map. unzip :: Map k (a, b) -> (Map k a, Map k b) unzip m = (Map.map fst m, Map.map snd m) unzip3 :: Map k (a, b, c) -> (Map k a, Map k b, Map k c) unzip3 m = (Map.map fst3 m, Map.map snd3 m, Map.map thd3 m) Agda-2.4.2.5/src/full/Agda/Utils/IORef.hs0000644000000000000000000000054512635075266015711 0ustar0000000000000000{-# LANGUAGE CPP #-} -- | Utilities for Data.IORef. module Agda.Utils.IORef ( module Data.IORef , module Agda.Utils.IORef ) where import Data.IORef -- | Read 'IORef', modify it strictly, and return old value. readModifyIORef' :: IORef a -> (a -> a) -> IO a readModifyIORef' ref f = do x <- readIORef ref writeIORef ref $! f x return x Agda-2.4.2.5/src/full/Agda/Utils/Trie.hs0000644000000000000000000001016312635075266015645 0ustar0000000000000000{-# LANGUAGE CPP #-} {-# LANGUAGE BangPatterns #-} {-# LANGUAGE GeneralizedNewtypeDeriving #-} {-# LANGUAGE PatternGuards #-} {-# LANGUAGE TupleSections #-} -- | Strict tries (based on "Data.Map.Strict" and "Agda.Utils.Maybe.Strict"). module Agda.Utils.Trie ( Trie , empty, singleton, insert, insertWith, union, unionWith, adjust, delete , toList, toAscList , lookupPath ) where import Prelude hiding (Maybe(..), maybe, null) import qualified Prelude as Lazy import Data.Function import Data.Functor import Data.List (nubBy, sortBy, isPrefixOf) import Data.Map.Strict (Map) import qualified Data.Map.Strict as Map import Test.QuickCheck import Agda.Utils.List (mcons) import Agda.Utils.Maybe.Strict import Agda.Utils.Null -- | Finite map from @[k]@ to @v@. -- -- With the strict 'Maybe' type, 'Trie' is also strict in 'v'. data Trie k v = Trie !(Maybe v) !(Map k (Trie k v)) deriving Show -- | Empty trie. instance Null (Trie k v) where empty = Trie Nothing Map.empty null (Trie v t) = null v && null t -- | Singleton trie. singleton :: [k] -> v -> Trie k v singleton [] !v = Trie (Just v) Map.empty singleton (x:xs) !v = Trie Nothing $ Map.singleton x (singleton xs v) -- | Left biased union. -- -- @union = unionWith (\ new old -> new)@. union :: (Ord k) => Trie k v -> Trie k v -> Trie k v union = unionWith const -- | Pointwise union with merge function for values. unionWith :: (Ord k) => (v -> v -> v) -> Trie k v -> Trie k v -> Trie k v unionWith f (Trie v ss) (Trie w ts) = Trie (unionMaybeWith f v w) (Map.unionWith (unionWith f) ss ts) -- | Insert. Overwrites existing value if present. -- -- @insert = insertWith (\ new old -> new)@ insert :: (Ord k) => [k] -> v -> Trie k v -> Trie k v insert k v t = union (singleton k v) t -- | Insert with function merging new value with old value. insertWith :: (Ord k) => (v -> v -> v) -> [k] -> v -> Trie k v -> Trie k v insertWith f k v t = unionWith f (singleton k v) t -- | Delete value at key, but leave subtree intact. delete :: Ord k => [k] -> Trie k v -> Trie k v delete path = adjust path (const Nothing) -- | Adjust value at key, leave subtree intact. adjust :: Ord k => [k] -> (Maybe v -> Maybe v) -> Trie k v -> Trie k v adjust path f t@(Trie v ts) = case path of -- case: found the value we want to adjust: adjust it! [] -> Trie (f v) ts -- case: found the subtrie matching the first key: adjust recursively k : ks | Lazy.Just s <- Map.lookup k ts -> Trie v $ Map.insert k (adjust ks f s) ts -- case: subtrie not found: leave trie untouched _ -> t -- | Convert to ascending list. toList :: Ord k => Trie k v -> [([k],v)] toList = toAscList -- | Convert to ascending list. toAscList :: Ord k => Trie k v -> [([k],v)] toAscList (Trie mv ts) = maybeToList (([],) <$> mv) ++ [ (k:ks, v) | (k, t) <- Map.toAscList ts , (ks, v) <- toAscList t ] -- | Collect all values along a given path. lookupPath :: Ord k => [k] -> Trie k v -> [v] lookupPath xs (Trie v cs) = case xs of [] -> maybeToList v x : xs -> maybeToList v ++ Lazy.maybe [] (lookupPath xs) (Map.lookup x cs) -- Tests ------------------------------------------------------------------ newtype Key = Key Int deriving (Eq, Ord) newtype Val = Val Int deriving (Eq) newtype Model = Model [([Key], Val)] deriving (Eq, Show) instance Show Key where show (Key x) = show x instance Show Val where show (Val x) = show x instance Arbitrary Key where arbitrary = elements $ map Key [1..2] shrink (Key x) = Key <$> shrink x instance Arbitrary Val where arbitrary = elements $ map Val [1..3] shrink (Val x) = Val <$> shrink x instance Arbitrary Model where arbitrary = Model <$> arbitrary shrink (Model xs) = Model <$> shrink xs modelToTrie :: Model -> Trie Key Val modelToTrie (Model xs) = foldr (uncurry insert) empty xs modelPath :: [Key] -> Model -> [Val] modelPath ks (Model xs) = map snd $ sortBy (compare `on` length . fst) $ nubBy ((==) `on` fst) $ filter (flip isPrefixOf ks . fst) xs prop_path :: [Key] -> Model -> Property prop_path ks m = collect (length $ modelPath ks m) $ lookupPath ks (modelToTrie m) == modelPath ks m Agda-2.4.2.5/src/full/Agda/Utils/Maybe.hs0000644000000000000000000000746112635075266016006 0ustar0000000000000000{-# LANGUAGE CPP #-} -- | Extend 'Data.Maybe' by common operations for the 'Maybe' type. -- -- Note: since this module is usually imported unqualified, -- we do not use short names, but all names contain 'Maybe', -- 'Just', or 'Nothing. module Agda.Utils.Maybe ( module Agda.Utils.Maybe , module Data.Maybe ) where import Control.Monad import Control.Monad.Trans.Maybe import Data.Maybe import Data.Functor #include "undefined.h" import Agda.Utils.Impossible -- * Collection operations. -- | @unionWith@ for collections of size <= 1. unionMaybeWith :: (a -> a -> a) -> Maybe a -> Maybe a -> Maybe a unionMaybeWith f Nothing mb = mb unionMaybeWith f ma Nothing = ma unionMaybeWith f (Just a) (Just b) = Just $ f a b -- | Unzipping a list of length <= 1. unzipMaybe :: Maybe (a,b) -> (Maybe a, Maybe b) unzipMaybe Nothing = (Nothing, Nothing) unzipMaybe (Just (a,b)) = (Just a, Just b) -- | Filtering a singleton list. -- -- @filterMaybe p a = 'listToMaybe' ('filter' p [a])@ filterMaybe :: (a -> Bool) -> a -> Maybe a filterMaybe p a | p a = Just a | otherwise = Nothing -- * Conditionals and loops. -- | Version of 'mapMaybe' with different argument ordering. forMaybe :: [a] -> (a -> Maybe b) -> [b] forMaybe = flip mapMaybe -- | Version of 'maybe' with different argument ordering. -- Often, we want to case on a 'Maybe', do something interesting -- in the 'Just' case, but only a default action in the 'Nothing' -- case. Then, the argument ordering of @caseMaybe@ is preferable. -- -- @caseMaybe m d f = flip (maybe d) m f@ caseMaybe :: Maybe a -> b -> (a -> b) -> b caseMaybe m d f = maybe d f m -- * Monads and Maybe. -- | Monadic version of 'maybe'. maybeM :: Monad m => m b -> (a -> m b) -> m (Maybe a) -> m b maybeM n j mm = maybe n j =<< mm -- | Monadic version of 'fromMaybe'. fromMaybeM :: Monad m => m a -> m (Maybe a) -> m a fromMaybeM m mm = maybeM m return mm -- | Monadic version of 'caseMaybe'. -- That is, 'maybeM' with a different argument ordering. caseMaybeM :: Monad m => m (Maybe a) -> m b -> (a -> m b) -> m b caseMaybeM mm d f = maybeM d f mm -- | 'caseMaybeM' with flipped branches. ifJustM :: Monad m => m (Maybe a) -> (a -> m b) -> m b -> m b ifJustM mm = flip (caseMaybeM mm) -- | A more telling name for 'Traversable.forM_' for the 'Maybe' collection type. -- Or: 'caseMaybe' without the 'Nothing' case. whenJust :: Monad m => Maybe a -> (a -> m ()) -> m () whenJust m k = caseMaybe m (return ()) k -- | 'caseMaybe' without the 'Just' case. whenNothing :: Monad m => Maybe a -> m () -> m () whenNothing m d = caseMaybe m d (\_ -> return ()) -- | 'caseMaybeM' without the 'Nothing' case. whenJustM :: Monad m => m (Maybe a) -> (a -> m ()) -> m () whenJustM c m = c >>= (`whenJust` m) -- | 'caseMaybeM' without the 'Just' case. whenNothingM :: Monad m => m (Maybe a) -> m () -> m () whenNothingM mm d = mm >>= (`whenNothing` d) -- | Lazy version of @allJust <.> sequence@. -- (@allJust = mapM@ for the @Maybe@ monad.) -- Only executes monadic effect while @isJust@. allJustM :: Monad m => [m (Maybe a)] -> m (Maybe [a]) allJustM = runMaybeT . mapM MaybeT -- allJustM [] = return $ Just [] -- allJustM (mm : mms) = caseMaybeM mm (return Nothing) $ \ a -> -- fmap (a:) <$> allJust mms -- | Precondition: list not empty. -- @ -- allJustsOrNothings [Nothing, Nothing] = Just Nothing -- allJustsOrNothings [Just 0, Just 1] = Just $ Just [0,1] -- allJustsOrNothings [Just 0, Nothing] = Nothing -- @ allJustsOrNothings :: [Maybe a] -> Maybe (Maybe [a]) allJustsOrNothings [] = __IMPOSSIBLE__ allJustsOrNothings [ma] = return $ (:[]) <$> ma allJustsOrNothings (ma : mas) = do res <- allJustsOrNothings mas case (ma, res) of (Nothing, Nothing) -> return Nothing (Just a, Just as) -> return $ Just (a : as) _ -> mzero Agda-2.4.2.5/src/full/Agda/Utils/Functor.hs0000644000000000000000000000543312635075266016366 0ustar0000000000000000{-# LANGUAGE CPP #-} {-# LANGUAGE TupleSections #-} -- | Utilities for functors. module Agda.Utils.Functor ( module Agda.Utils.Functor , (<$>) -- from Data.Functor ) where import Control.Applicative ( Const(Const), getConst ) import Data.Functor import Data.Functor.Identity import Data.Functor.Compose import Data.Functor.Classes -- Andreas, 2015-05-06, see issue 1501. -- This instance can be obtained from transformers-compat. -- -- ASR (15 October 2014): See issue 1304. -- #if !MIN_VERSION_transformers(0,4,1) -- instance Eq a => Eq (Identity a) where -- Identity x == Identity x' = x == x' -- #endif infixr 4 $> ($>) :: Functor f => f a -> b -> f b ($>) = flip (<$) infixr 9 <.> -- | Composition: pure function after functorial (monadic) function. (<.>) :: Functor m => (b -> c) -> (a -> m b) -> a -> m c (f <.> g) a = f <$> g a -- | The true pure @for@ loop. -- 'Data.Traversable.for' is a misnomer, it should be @forA@. for :: Functor m => m a -> (a -> b) -> m b for = flip fmap infix 4 <&> -- | Infix version of 'for'. (<&>) :: Functor m => m a -> (a -> b) -> m b (<&>) = for -- | A decoration is a functor that is traversable into any functor. -- -- The 'Functor' superclass is given because of the limitations -- of the Haskell class system. -- @traverseF@ actually implies functoriality. -- -- Minimal complete definition: @traverseF@ or @distributeF@. class Functor t => Decoration t where -- | @traverseF@ is the defining property. traverseF :: Functor m => (a -> m b) -> t a -> m (t b) traverseF f = distributeF . fmap f -- | Decorations commute into any functor. distributeF :: (Functor m) => t (m a) -> m (t a) distributeF = traverseF id -- | Any decoration is traversable with @traverse = traverseF@. -- Just like any 'Traversable' is a functor, so is -- any decoration, given by just @traverseF@, a functor. dmap :: Decoration t => (a -> b) -> t a -> t b dmap f = runIdentity . traverseF (Identity . f) -- | Any decoration is a lens. @set@ is a special case of @dmap@. dget :: Decoration t => t a -> a dget = getConst . traverseF Const -- | The identity functor is a decoration. instance Decoration Identity where traverseF f (Identity x) = Identity <$> f x -- | Decorations compose. (Thus, they form a category.) instance (Decoration d, Decoration t) => Decoration (Compose d t) where -- traverseF . traverseF :: Functor m => (a -> m b) -> d (t a) -> m (d (t a)) traverseF f (Compose x) = Compose <$> traverseF (traverseF f) x -- Not a decoration are: -- -- * The constant functor. -- * Maybe. Can only be traversed into pointed functors. -- * Other disjoint sum types, like lists etc. -- (Can only be traversed into Applicative.) -- | A typical decoration is pairing with some stuff. instance Decoration ((,) a) where traverseF f (a, x) = (a,) <$> f x Agda-2.4.2.5/src/full/Agda/Utils/IO/0000755000000000000000000000000012635075266014714 5ustar0000000000000000Agda-2.4.2.5/src/full/Agda/Utils/IO/UTF8.hs0000644000000000000000000000401512635075266015776 0ustar0000000000000000-- | Text IO using the UTF8 character encoding. module Agda.Utils.IO.UTF8 ( readTextFile , Agda.Utils.IO.UTF8.hPutStr , Agda.Utils.IO.UTF8.writeFile ) where import qualified System.IO as IO import Control.Applicative -- | Converts many character sequences which may be interpreted as -- line or paragraph separators into '\n'. convertLineEndings :: String -> String -- ASCII: convertLineEndings ('\x000D' : '\x000A' : s) = '\n' : convertLineEndings s -- CR LF convertLineEndings ('\x000A' : s) = '\n' : convertLineEndings s -- LF (Line feed) convertLineEndings ('\x000D' : s) = '\n' : convertLineEndings s -- CR (Carriage return) convertLineEndings ('\x000C' : s) = '\n' : convertLineEndings s -- FF (Form feed) -- Unicode: convertLineEndings ('\x0085' : s) = '\n' : convertLineEndings s -- NEXT LINE convertLineEndings ('\x2028' : s) = '\n' : convertLineEndings s -- LINE SEPARATOR convertLineEndings ('\x2029' : s) = '\n' : convertLineEndings s -- PARAGRAPH SEPARATOR -- Not a line ending: convertLineEndings (c : s) = c : convertLineEndings s convertLineEndings "" = "" -- | Reads a UTF8-encoded text file and converts all Unicode line -- endings into '\n'. readTextFile :: FilePath -> IO String readTextFile file = convertLineEndings <$> do h <- IO.openFile file IO.ReadMode IO.hSetNewlineMode h IO.noNewlineTranslation IO.hSetEncoding h IO.utf8 IO.hGetContents h -- | Writes UTF8-encoded text to the handle, which should be opened -- for writing and in text mode. The native convention for line -- endings is used. -- -- The handle's text encoding is not necessarily preserved, it is -- changed to UTF8. hPutStr :: IO.Handle -> String -> IO () hPutStr h s = do IO.hSetEncoding h IO.utf8 IO.hPutStr h s -- | Writes a UTF8-encoded text file. The native convention for line -- endings is used. writeFile :: FilePath -> String -> IO () writeFile file s = IO.withFile file IO.WriteMode $ \h -> do hPutStr h s Agda-2.4.2.5/src/full/Agda/Utils/IO/Binary.hs0000644000000000000000000000056212635075266016477 0ustar0000000000000000-- | Binary IO. module Agda.Utils.IO.Binary ( readBinaryFile' ) where import System.IO import Data.ByteString.Lazy as BS -- | Returns a close function for the file together with the contents. readBinaryFile' :: FilePath -> IO (ByteString, IO ()) readBinaryFile' file = do h <- openBinaryFile file ReadMode s <- BS.hGetContents h return (s, hClose h) Agda-2.4.2.5/src/full/Agda/Utils/Permutation/0000755000000000000000000000000012635075266016714 5ustar0000000000000000Agda-2.4.2.5/src/full/Agda/Utils/Permutation/Tests.hs0000644000000000000000000000777012635075266020365 0ustar0000000000000000{-# LANGUAGE CPP #-} {-# LANGUAGE DeriveDataTypeable #-} {-# LANGUAGE DeriveFoldable #-} {-# LANGUAGE DeriveFunctor #-} {-# LANGUAGE DeriveTraversable #-} {-# LANGUAGE TemplateHaskell #-} {-# OPTIONS_GHC -fno-warn-missing-signatures #-} module Agda.Utils.Permutation.Tests (tests) where import Data.Functor import Data.List as List import Data.Maybe import Test.QuickCheck import Test.QuickCheck.All import Agda.Utils.List (downFrom) import Agda.Utils.Permutation ------------------------------------------------------------------------ -- * Properties ------------------------------------------------------------------------ data ComposablePermutations = ComposablePermutations Permutation Permutation deriving (Eq, Show) instance Arbitrary ComposablePermutations where arbitrary = do p2@(Perm n is) <- arbitrary let m = length is p1 <- Perm m . filter (< m) . map getNonNegative <$> arbitrary return $ ComposablePermutations p1 p2 type A = Int -- | Extend a list by indefinitely many elements. withStream :: Testable b => ([a] -> b) -- ^ Stream function. -> [a] -- ^ Initial segment. -> a -- ^ Default element, appended ad infinitum. -> b withStream k as a = k $ as ++ repeat a -- | Apply a permutation to a list which might be too short. -- Silently discard picks that go beyond the list's boundaries. permutePartial :: Permutation -> [a] -> [a] permutePartial perm xs = catMaybes $ permute perm $ map Just xs ++ repeat Nothing -- Note: we have to add @Nothing@s to make @permute@ total. -- | @perm([0..n-1]) == perm@ prop_permute_id_r :: Permutation -> Bool prop_permute_id_r perm@(Perm n picks) = permute perm [0..] == picks -- | @idP(xs) == xs@ prop_permute_id_l :: Int -> [A] -> A -> Bool prop_permute_id_l n = withStream $ \ xs -> permute (idP n) xs == take n xs -- | @takeP n perm = perm . take n@ prop_takeP :: Int -> Permutation -> [A] -> A -> Bool prop_takeP n perm = withStream $ \ xs -> permute (takeP n perm) xs == permutePartial perm (take n xs) -- Note: we have to add @Nothing@s to make @permute@ total. -- | @(droppedP perm)(xs) = xs \\ perm(xs)@ prop_droppedP :: Permutation -> [A] -> A -> Bool prop_droppedP perm@(Perm n _) = withStream $ \ xs -> let xs' = take n xs in sort (permute (droppedP perm) xs') == sort (xs' \\ permute perm xs') -- | @(p1 ∘ p2)(xs) = p1(p2(xs))@ prop_composeP :: ComposablePermutations -> [A] -> A -> Bool prop_composeP (ComposablePermutations p1 p2) = withStream $ \ xs -> permute (composeP p1 p2) xs == permutePartial p1 (permute p2 xs) prop_flipP :: Permutation -> Bool prop_flipP p = permPicks (flipP p) == permute p (downFrom $ permRange p) -- | @p ∘ p⁻¹ ∘ p = p@ prop_invertP_left :: Permutation -> Int -> [A] -> A -> Bool prop_invertP_left p err = withStream $ \ xs -> let ys = permute p xs in permute p (permute (invertP err p) ys) == ys -- NOT QUITE RIGHT YET: -- -- | @p⁻1 ∘ p ∘ p⁻¹ = p⁻¹@ -- prop_invertP_right :: Permutation -> Int -> [A] -> A -> Bool -- prop_invertP_right p err = withStream $ \ xs -> -- let pinv = invertP err p -- ys = permute pinv xs -- in permute pinv (permute p ys) == ys -- | @reverseP p = reverse . p . reverse@ prop_reverseP :: Permutation -> [A] -> A -> Bool prop_reverseP p@(Perm n _) = withStream $ \ xs0 -> let xs = take n xs0 in permute (reverseP p) xs == reverse (permute p (reverse xs)) -- | @permute p . inversePermute p = id@ prop_inversePermute :: Permutation -> [Maybe A] -> Maybe A -> Bool prop_inversePermute p@(Perm _ is) = withStream $ \ xs0 -> let xs = take (length is) xs0 ys = inversePermute p xs in permute p ys == xs prop_inversePermute_invertP :: Permutation -> Bool prop_inversePermute_invertP p = inversePermute p (id :: Int -> Int) == safePermute (invertP (-1) p) [(0::Int)..] -- Template Haskell hack to make the following $quickCheckAll work -- under ghc-7.8. return [] -- KEEP! -- | All tests as collected by 'quickCheckAll'. tests :: IO Bool tests = do putStrLn "Agda.Utils.Permutation" $quickCheckAll Agda-2.4.2.5/src/full/Agda/Utils/Maybe/0000755000000000000000000000000012635075266015442 5ustar0000000000000000Agda-2.4.2.5/src/full/Agda/Utils/Maybe/Strict.hs0000644000000000000000000001322712635075266017253 0ustar0000000000000000{-# LANGUAGE CPP #-} {-# LANGUAGE DeriveDataTypeable #-} #if __GLASGOW_HASKELL__ >= 706 {-# LANGUAGE DeriveGeneric #-} #endif {-# LANGUAGE MultiParamTypeClasses #-} {-# LANGUAGE StandaloneDeriving #-} {-# OPTIONS_GHC -fno-warn-orphans #-} -- | A strict version of the 'Maybe' type. -- -- Import qualified, as in -- @ -- import qualified Agda.Utils.Maybe.Strict as Strict -- @ -- -- Copyright : (c) 2006-2007 Roman Leshchinskiy -- (c) 2013 Simon Meier -- License : BSD-style (see the file LICENSE) -- -- Copyright : (c) 2014 Andreas Abel module Agda.Utils.Maybe.Strict ( module Data.Strict.Maybe , module Agda.Utils.Maybe.Strict ) where -- The following code is copied from -- http://hackage.haskell.org/package/strict-base-types-0.3.0/docs/src/Data-Maybe-Strict.html import Prelude hiding (Maybe (..), maybe, null) import qualified Prelude as Lazy import Control.Applicative (pure, (<$>)) import Control.DeepSeq (NFData (..)) import Data.Binary (Binary (..)) import Data.Data (Data (..)) import Data.Monoid (Monoid (..)) import Data.Foldable (Foldable (..)) import Data.Traversable (Traversable (..)) #if MIN_VERSION_base(4,7,0) import Data.Typeable (Typeable) #else import Data.Typeable (Typeable1) #endif import Data.Strict.Maybe (Maybe (Nothing, Just), fromJust, fromMaybe, isJust, isNothing, maybe) #if __GLASGOW_HASKELL__ >= 706 import GHC.Generics (Generic (..)) #endif import Test.QuickCheck (Arbitrary (..)) import Agda.Utils.Null toStrict :: Lazy.Maybe a -> Maybe a toStrict Lazy.Nothing = Nothing toStrict (Lazy.Just x) = Just x toLazy :: Maybe a -> Lazy.Maybe a toLazy Nothing = Lazy.Nothing toLazy (Just x) = Lazy.Just x deriving instance Data a => Data (Maybe a) #if MIN_VERSION_base(4,7,0) deriving instance Typeable Maybe #else deriving instance Typeable1 Maybe #endif #if __GLASGOW_HASKELL__ >= 706 deriving instance Generic (Maybe a) #endif instance Null (Maybe a) where empty = Nothing null = isNothing instance Monoid a => Monoid (Maybe a) where mempty = Nothing Nothing `mappend` _ = Nothing _ `mappend` Nothing = Nothing Just x1 `mappend` Just x2 = Just (x1 `mappend` x2) instance Foldable Maybe where foldMap _ Nothing = mempty foldMap f (Just x) = f x instance Traversable Maybe where traverse _ Nothing = pure Nothing traverse f (Just x) = Just <$> f x instance NFData a => NFData (Maybe a) where rnf = rnf . toLazy instance Binary a => Binary (Maybe a) where put = put . toLazy get = toStrict <$> get instance Arbitrary a => Arbitrary (Maybe a) where arbitrary = toStrict <$> arbitrary shrink = map toStrict . shrink . toLazy -- | Analogous to 'Lazy.listToMaybe' in "Data.Maybe". listToMaybe :: [a] -> Maybe a listToMaybe [] = Nothing listToMaybe (a:_) = Just a -- | Analogous to 'Lazy.maybeToList' in "Data.Maybe". maybeToList :: Maybe a -> [a] maybeToList Nothing = [] maybeToList (Just x) = [x] -- | Analogous to 'Lazy.catMaybes' in "Data.Maybe". catMaybes :: [Maybe a] -> [a] catMaybes ls = [x | Just x <- ls] -- | Analogous to 'Lazy.mapMaybe' in "Data.Maybe". mapMaybe :: (a -> Maybe b) -> [a] -> [b] mapMaybe _ [] = [] mapMaybe f (x:xs) = case f x of Nothing -> rs Just r -> r:rs where rs = mapMaybe f xs -- The remaining code is a copy of Agda.Utils.Maybe -- * Collection operations. -- | @unionWith@ for collections of size <= 1. unionMaybeWith :: (a -> a -> a) -> Maybe a -> Maybe a -> Maybe a unionMaybeWith f Nothing mb = mb unionMaybeWith f ma Nothing = ma unionMaybeWith f (Just a) (Just b) = Just $ f a b -- | Unzipping a list of length <= 1. unzipMaybe :: Maybe (a,b) -> (Maybe a, Maybe b) unzipMaybe Nothing = (Nothing, Nothing) unzipMaybe (Just (a,b)) = (Just a, Just b) -- | Filtering a singleton list. -- -- @filterMaybe p a = 'listToMaybe' ('filter' p [a])@ filterMaybe :: (a -> Bool) -> a -> Maybe a filterMaybe p a | p a = Just a | otherwise = Nothing -- * Conditionals and loops. -- | Version of 'mapMaybe' with different argument ordering. forMaybe :: [a] -> (a -> Maybe b) -> [b] forMaybe = flip mapMaybe -- | Version of 'maybe' with different argument ordering. -- Often, we want to case on a 'Maybe', do something interesting -- in the 'Just' case, but only a default action in the 'Nothing' -- case. Then, the argument ordering of @caseMaybe@ is preferable. -- -- @caseMaybe m err f = flip (maybe err) m f@ caseMaybe :: Maybe a -> b -> (a -> b) -> b caseMaybe m err f = maybe err f m -- * Monads and Maybe. -- | Monadic version of 'maybe'. maybeM :: Monad m => m b -> (a -> m b) -> m (Maybe a) -> m b maybeM n j mm = maybe n j =<< mm -- | Monadic version of 'fromMaybe'. fromMaybeM :: Monad m => m a -> m (Maybe a) -> m a fromMaybeM m mm = maybeM m return mm -- | Monadic version of 'caseMaybe'. -- That is, 'maybeM' with a different argument ordering. caseMaybeM :: Monad m => m (Maybe a) -> m b -> (a -> m b) -> m b caseMaybeM mm err f = maybeM err f mm -- | 'caseMaybeM' with flipped branches. ifJustM :: Monad m => m (Maybe a) -> (a -> m b) -> m b -> m b ifJustM mm = flip (caseMaybeM mm) -- | A more telling name for 'Traversable.forM' for the 'Maybe' collection type. -- Or: 'caseMaybe' without the 'Nothing' case. whenJust :: Monad m => Maybe a -> (a -> m ()) -> m () whenJust m k = caseMaybe m (return ()) k -- | 'caseMaybeM' without the 'Nothing' case. whenJustM :: Monad m => m (Maybe a) -> (a -> m ()) -> m () whenJustM c m = c >>= (`whenJust` m) Agda-2.4.2.5/src/full/Agda/Utils/Lens/0000755000000000000000000000000012635075266015306 5ustar0000000000000000Agda-2.4.2.5/src/full/Agda/Utils/Lens/Examples.hs0000644000000000000000000000071012635075266017416 0ustar0000000000000000-- | Examples how to use "Agda.Utils.Lens". module Agda.Utils.Lens.Examples where import Agda.Utils.Functor import Agda.Utils.Lens data Record a b = Record { field1 :: a , field2 :: b } -- | (View source:) This is how you implement a lens for a record field. lensField1 :: Lens' a (Record a b) lensField1 f r = f (field1 r) <&> \ a -> r { field1 = a } lensField2 :: Lens' b (Record a b) lensField2 f r = f (field2 r) <&> \ b -> r { field2 = b } Agda-2.4.2.5/src/full/Agda/Utils/ListT/0000755000000000000000000000000012635075266015444 5ustar0000000000000000Agda-2.4.2.5/src/full/Agda/Utils/ListT/Tests.hs0000644000000000000000000000223312635075266017102 0ustar0000000000000000{-# OPTIONS_GHC -fno-warn-missing-signatures #-} {-# LANGUAGE TemplateHaskell #-} -- | Quickcheck properties for 'Agda.Utils.ListT'. module Agda.Utils.ListT.Tests (tests) where import Control.Applicative import Data.Functor import Data.Functor.Identity import Test.QuickCheck import Test.QuickCheck.All import Agda.Utils.Functor import Agda.Utils.ListT -- * Identity monad instance of ListT (simply lists) type List = ListT Identity foldList :: (a -> b -> b) -> b -> List a -> b foldList cons nil l = runIdentity $ foldListT c (Identity nil) l where c a = Identity . cons a . runIdentity fromList :: [a] -> List a fromList = foldr consListT nilListT toList :: List a -> [a] toList = foldList (:) [] prop_concat xxs = toList (concatListT (fromList (map fromList xxs))) == concat xxs prop_idiom fs xs = toList (fromList fs <*> fromList xs) == (fs <*> xs) prop_concatMap f xs = toList (fromList . f =<< fromList xs) == (f =<< xs) -- Template Haskell hack to make the following $quickCheckAll work -- under ghc-7.8. return [] -- KEEP! -- | All tests as collected by 'quickCheckAll'. tests :: IO Bool tests = do putStrLn "Agda.Utils.Permutation" $quickCheckAll Agda-2.4.2.5/src/full/Agda/Utils/Graph/0000755000000000000000000000000012635075266015446 5ustar0000000000000000Agda-2.4.2.5/src/full/Agda/Utils/Graph/AdjacencyMap/0000755000000000000000000000000012635075266017765 5ustar0000000000000000Agda-2.4.2.5/src/full/Agda/Utils/Graph/AdjacencyMap/Unidirectional.hs0000644000000000000000000006632012635075266023301 0ustar0000000000000000{-# LANGUAGE BangPatterns #-} {-# LANGUAGE CPP #-} {-# LANGUAGE DeriveFunctor #-} {-# LANGUAGE DoAndIfThenElse #-} {-# LANGUAGE FlexibleInstances #-} {-# LANGUAGE GeneralizedNewtypeDeriving #-} {-# LANGUAGE ScopedTypeVariables #-} {-# LANGUAGE TupleSections #-} -- | Directed graphs (can of course simulate undirected graphs). -- -- Represented as adjacency maps in direction from source to target. -- -- Each source node maps to a adjacency map of outgoing edges, -- which is a map from target nodes to edges. -- -- This allows to get outgoing edges in O(log n) time where -- @n@ is the number of nodes in the graph. -- -- However, the set of incoming edges can only be obtained in -- @O(n log n)@ or @O(e)@ where @e@ is the total number of edges. module Agda.Utils.Graph.AdjacencyMap.Unidirectional ( Graph(..) , Edge(..) , transposeEdge , edges , edgesFrom , edgesTo , diagonal , lookup , neighbours, neighboursMap , sourceNodes, targetNodes , Nodes(..) , computeNodes, nodes , fromNodes , fromList, fromListWith , toList , discrete , clean , empty , singleton , insert, insertWith , insertEdge, insertEdgeWith , union , unionWith , unions, unionsWith , removeNode , removeEdge , filterEdges , unzip , mapWithEdge , sccs' , sccs , DAG(..) , dagInvariant , oppositeDAG , reachable , sccDAG' , sccDAG , acyclic , composeWith , complete , gaussJordanFloydWarshallMcNaughtonYamadaReference , gaussJordanFloydWarshallMcNaughtonYamada , findPath , allPaths -- , allTrails -- Exponential, don't use! See issue 1612. ) where import Prelude hiding (lookup, unzip, null) import Control.Applicative hiding (empty) import Control.Monad import qualified Data.Array.IArray as Array import Data.Function import qualified Data.Graph as Graph import Data.IntMap.Strict (IntMap) import qualified Data.IntMap.Strict as IntMap import qualified Data.IntSet as IntSet import qualified Data.List as List import qualified Data.Map.Strict as Map import Data.Map.Strict (Map) import qualified Data.Maybe as Maybe import Data.Maybe (maybeToList, fromMaybe, catMaybes) import qualified Data.Set as Set import Data.Set (Set) import qualified Data.Tree as Tree import Test.QuickCheck hiding (label) import Agda.Utils.Function import Agda.Utils.Functor import Agda.Utils.List (headMaybe) import Agda.Utils.Null (Null(null)) import qualified Agda.Utils.Null as Null import Agda.Utils.SemiRing import Agda.Utils.Singleton (Singleton) import qualified Agda.Utils.Singleton as Singleton import Agda.Utils.TestHelpers import Agda.Utils.Tuple #include "undefined.h" import Agda.Utils.Impossible -- | @Graph s t e@ is a directed graph with -- source nodes in @s@ -- target nodes in @t@ -- and edges in @e@. -- -- Admits at most one edge between any two nodes. -- Several edges can be modeled by using a collection type for @e@. -- -- Represented as "adjacency list", or rather, adjacency map. -- This allows to get all outgoing edges for a node -- in @O(log n)@ time where @n@ is the number of nodes of the graph. -- -- Incoming edges can only be computed in @O(n + e)@ time where -- @e@ is the number of edges. newtype Graph s t e = Graph { graph :: Map s (Map t e) -- ^ Forward edges. } deriving (Eq, Functor, Show) data Edge s t e = Edge { source :: s -- ^ Outgoing node. , target :: t -- ^ Incoming node. , label :: e -- ^ Edge label (weight). } deriving (Eq, Ord, Functor, Show) -- | Reverse an edge. transposeEdge :: Edge s t e -> Edge t s e transposeEdge (Edge s t e) = Edge t s e -- * Edge queries -- | Turn a graph into a list of edges. @O(n + e)@ edges :: (Ord s, Ord t) => Graph s t e -> [Edge s t e] edges (Graph g) = [ Edge s t e | (s, tes) <- Map.assocs g , (t, e) <- Map.assocs tes ] -- | All edges originating in the given nodes. -- (I.e., all outgoing edges for the given nodes.) -- -- Roughly linear in the length of the result list @O(result)@. edgesFrom :: (Ord s, Ord t) => Graph s t e -> [s] -> [Edge s t e] edgesFrom (Graph g) ss = [ Edge s t e | s <- ss , m <- maybeToList $ Map.lookup s g , (t, e) <- Map.assocs m ] -- | All edges ending in the given nodes. -- (I.e., all incoming edges for the given nodes.) -- -- Expensive: @O(n * |ts| * log n)@. edgesTo :: (Ord s, Ord t) => Graph s t e -> [t] -> [Edge s t e] edgesTo (Graph g) ts = [ Edge s t e | (s, m) <- Map.assocs g , t <- ts , e <- maybeToList $ Map.lookup t m ] -- | Get all self-loops. diagonal :: (Ord n) => Graph n n e -> [Edge n n e] diagonal (Graph g) = [ Edge s s e | (s, m) <- Map.assocs g , e <- maybeToList $ Map.lookup s m ] -- | Lookup label of an edge. lookup :: (Ord s, Ord t) => s -> t -> Graph s t e -> Maybe e lookup s t (Graph g) = Map.lookup t =<< Map.lookup s g -- | Get a list of outgoing edges with target. neighbours :: (Ord s, Ord t) => s -> Graph s t e -> [(t, e)] neighbours s (Graph g) = maybe [] Map.assocs $ Map.lookup s g -- | Get a list of outgoing edges with target. neighboursMap :: (Ord s, Ord t) => s -> Graph s t e -> Map t e neighboursMap s (Graph g) = fromMaybe Map.empty $ Map.lookup s g -- * Node queries -- | Returns all the nodes with outgoing edges. @O(n)@. sourceNodes :: (Ord s, Ord t) => Graph s t e -> Set s sourceNodes = Map.keysSet . graph -- | Returns all the nodes with incoming edges. Expensive! @O(e)@. targetNodes :: (Ord s, Ord t) => Graph s t e -> Set t targetNodes = Set.fromList . map target . edges -- | For homogeneous graphs, @(s = t)@ we can compute a set -- of all nodes. -- -- Structure @Nodes@ is for computing all nodes but also -- remembering which were incoming and which outgoing. -- This is mostly for efficiency reasons, to avoid recomputation -- when all three sets are needed. data Nodes n = Nodes { srcNodes :: Set n , tgtNodes :: Set n , allNodes :: Set n } computeNodes :: (Ord n) => Graph n n e -> Nodes n computeNodes g = Nodes srcs tgts (srcs `Set.union` tgts) where srcs = sourceNodes g tgts = targetNodes g -- | The set of all nodes (outgoing and incoming). nodes :: (Ord n) => Graph n n e -> Set n nodes = allNodes . computeNodes -- * Graph construction. -- | Constructs a completely disconnected graph containing the given -- nodes. @O(n)@. fromNodes :: Ord n => [n] -> Graph n n e fromNodes ns = Graph $ Map.fromList $ map (, Map.empty) ns -- | Constructs a graph from a list of edges. O(e log n) -- -- Later edges overwrite earlier edges. fromList :: (Ord s, Ord t) => [Edge s t e] -> Graph s t e fromList = fromListWith $ \ new old -> new -- | Constructs a graph from a list of edges. O(e log n) -- -- Later edges are combined with earlier edges using the supplied function. fromListWith :: (Ord s, Ord t) => (e -> e -> e) -> [Edge s t e] -> Graph s t e fromListWith f = List.foldl' (flip (insertEdgeWith f)) empty -- | Convert a graph into a list of edges. O(e) toList :: (Ord s, Ord t) => Graph s t e -> [Edge s t e] toList (Graph g) = [ Edge s t a | (s,m) <- Map.assocs g, (t,a) <- Map.assocs m ] -- | Check whether the graph is discrete (no edges). -- This could be seen as an empty graph. -- Worst-case (is discrete): @O(e)@. discrete :: Null e => Graph s t e -> Bool discrete = all' (all' null) . graph where all' p = List.all p . Map.elems -- | Remove 'Null' edges. clean :: (Ord s, Ord t, Null e) => Graph s t e -> Graph s t e clean = Graph . filt . fmap filt . graph where filt :: (Ord k, Null a) => Map k a -> Map k a filt = Map.fromAscList . List.filter (not . null . snd) . Map.toAscList -- | Empty graph (no nodes, no edges). empty :: Graph s t e empty = Graph Map.empty -- | A graph with two nodes and a single connecting edge. singleton :: (Ord s, Ord t) => s -> t -> e -> Graph s t e singleton s t e = Graph $ Map.singleton s (Map.singleton t e) -- | Insert an edge into the graph. insert :: (Ord s, Ord t) => s -> t -> e -> Graph s t e -> Graph s t e insert = insertWith $ \ new old -> new insertEdge :: (Ord s, Ord t) => Edge s t e -> Graph s t e -> Graph s t e insertEdge (Edge s t e) = insert s t e -- | Insert an edge, possibly combining @old@ edge weight with @new@ weight by -- given function @f@ into @f new old@. insertWith :: (Ord s, Ord t) => (e -> e -> e) -> s -> t -> e -> Graph s t e -> Graph s t e insertWith f s t e (Graph g) = Graph (Map.alter (Just . ins) s g) where ins Nothing = Map.singleton t e ins (Just m) = Map.insertWith f t e m insertEdgeWith :: (Ord s, Ord t) => (e -> e -> e) -> Edge s t e -> Graph s t e -> Graph s t e insertEdgeWith f (Edge s t e) = insertWith f s t e -- | Left-biased union. union :: (Ord s, Ord t) => Graph s t e -> Graph s t e -> Graph s t e union = unionWith $ \ left right -> left unionWith :: (Ord s, Ord t) => (e -> e -> e) -> Graph s t e -> Graph s t e -> Graph s t e unionWith f (Graph g) (Graph g') = Graph $ Map.unionWith (Map.unionWith f) g g' unions ::(Ord s, Ord t) => [Graph s t e] -> Graph s t e unions = unionsWith $ \ left right -> left unionsWith :: (Ord s, Ord t) => (e -> e -> e) -> [Graph s t e] -> Graph s t e unionsWith f = List.foldl' (unionWith f) empty -- * Graph reversal -- | The opposite graph (with all edges reversed). transpose :: (Ord s, Ord t) => Graph s t e -> Graph t s e transpose = fromList . map transposeEdge . edges -- * Graph deconstruction. -- | Auxiliary function to turn empty map into @Nothing@. discardEmpty :: Map k v -> Maybe (Map k v) discardEmpty m = if Map.null m then Nothing else Just m -- | Removes the given source node, and all corresponding edges, from the graph. -- -- O(log n). removeSourceNode :: Ord s => s -> Graph s t e -> Graph s t e removeSourceNode s (Graph g) = Graph $ Map.delete s g -- | Removes the given target node, and all corresponding edges, from the graph. -- -- Expensive! @O(n log n)@. removeTargetNode :: (Ord s, Ord t) => t -> Graph s t e -> Graph s t e removeTargetNode t (Graph g) = Graph $ Map.mapMaybe rem g where rem = discardEmpty . Map.delete t -- | Removes the given node, be it source or target, -- and all corresponding edges, from the graph. -- -- Expensive! @O(n log n)@. removeNode :: Ord n => n -> Graph n n e -> Graph n n e removeNode n = removeTargetNode n . removeSourceNode n -- | @removeEdge s t g@ removes the edge going from @s@ to @t@, if any. -- -- @O((log n)^2)@. removeEdge :: (Ord s, Ord t) => s -> t -> Graph s t e -> Graph s t e removeEdge s t (Graph g) = Graph $ Map.adjust (Map.delete t) s g -- | Keep only the edges that satisfy the predicate. @O(e).@ filterEdges :: (Ord s, Ord t) => (e -> Bool) -> Graph s t e -> Graph s t e filterEdges f (Graph g) = Graph $ Map.mapMaybe (discardEmpty . Map.filter f) g -- | Unzipping a graph (naive implementation using fmap). unzip :: Graph s t (e, e') -> (Graph s t e, Graph s t e') unzip g = (fst <$> g, snd <$> g) -- | Maps over a graph under availability of positional information, -- like 'Map.mapWithKey'. mapWithEdge :: (Ord s, Ord t) => (Edge s t e -> e') -> Graph s t e -> Graph s t e' mapWithEdge f (Graph g) = Graph $ flip Map.mapWithKey g $ \ s m -> flip Map.mapWithKey m $ \ t e -> f (Edge s t e) -- * Strongly connected components. -- | The graph's strongly connected components, in reverse topological -- order. sccs' :: Ord n => Graph n n e -> [Graph.SCC n] sccs' g = Graph.stronglyConnComp [ (n, n, map target (edgesFrom g [n])) | n <- Set.toList (nodes g) ] -- | The graph's strongly connected components, in reverse topological -- order. sccs :: Ord n => Graph n n e -> [[n]] sccs = map Graph.flattenSCC . sccs' -- | SCC DAGs. -- -- The maps map SCC indices to and from SCCs/nodes. data DAG n = DAG { dagGraph :: Graph.Graph , dagComponentMap :: IntMap (Graph.SCC n) , dagNodeMap :: Map n Int } -- | 'DAG' invariant. dagInvariant :: Ord n => DAG n -> Bool dagInvariant g = Set.fromList (concatMap Graph.flattenSCC (IntMap.elems (dagComponentMap g))) == Map.keysSet (dagNodeMap g) && IntSet.fromList (Map.elems (dagNodeMap g)) == IntMap.keysSet (dagComponentMap g) && and [ n `elem` Graph.flattenSCC (dagComponentMap g IntMap.! (dagNodeMap g Map.! n)) | n <- Map.keys (dagNodeMap g) ] && and [ dagNodeMap g Map.! n == i | i <- Graph.vertices (dagGraph g) , n <- Graph.flattenSCC (dagComponentMap g IntMap.! i) ] && IntSet.fromList (Graph.vertices (dagGraph g)) == IntMap.keysSet (dagComponentMap g) && all isAcyclic (Graph.scc (dagGraph g)) where isAcyclic (Tree.Node r []) = not (r `elem` (dagGraph g Array.! r)) isAcyclic _ = False -- | The opposite DAG. oppositeDAG :: DAG n -> DAG n oppositeDAG g = g { dagGraph = Graph.transposeG (dagGraph g) } -- | The nodes reachable from the given SCC. reachable :: Ord n => DAG n -> Graph.SCC n -> [n] reachable g scc = case scc of Graph.AcyclicSCC n -> List.delete n (reachable' n) Graph.CyclicSCC (n : _) -> reachable' n Graph.CyclicSCC [] -> __IMPOSSIBLE__ where lookup' g k = case IntMap.lookup k g of Nothing -> __IMPOSSIBLE__ Just x -> x lookup'' g k = case Map.lookup k g of Nothing -> __IMPOSSIBLE__ Just x -> x reachable' n = concatMap (Graph.flattenSCC . lookup' (dagComponentMap g)) $ Graph.reachable (dagGraph g) (lookup'' (dagNodeMap g) n) -- | Constructs a DAG containing the graph's strongly connected -- components. sccDAG' :: forall n e. Ord n => Graph n n e -> [Graph.SCC n] -- ^ The graph's strongly connected components. -> DAG n sccDAG' g sccs = DAG theDAG componentMap secondNodeMap where components :: [(Int, Graph.SCC n)] components = zip [1..] sccs firstNodeMap :: Map n Int firstNodeMap = Map.fromList [ (n, i) | (i, c) <- components , n <- Graph.flattenSCC c ] targets :: Int -> [n] -> [Int] targets i ns = IntSet.toList $ IntSet.fromList [ j | e <- edgesFrom g ns , let j = case Map.lookup (target e) firstNodeMap of Nothing -> __IMPOSSIBLE__ Just j -> j , j /= i ] (theDAG, _, toVertex) = Graph.graphFromEdges [ (i, i, targets i (Graph.flattenSCC c)) | (i, c) <- components ] convertInt :: Int -> Graph.Vertex convertInt i = case toVertex i of Nothing -> __IMPOSSIBLE__ Just i -> i componentMap :: IntMap (Graph.SCC n) componentMap = IntMap.fromList (map (mapFst convertInt) components) secondNodeMap :: Map n Int secondNodeMap = fmap convertInt firstNodeMap -- | Constructs a DAG containing the graph's strongly connected -- components. sccDAG :: Ord n => Graph n n e -> DAG n sccDAG g = sccDAG' g (sccs' g) -- | Returns @True@ iff the graph is acyclic. acyclic :: Ord n => Graph n n e -> Bool acyclic = all isAcyclic . sccs' where isAcyclic Graph.AcyclicSCC{} = True isAcyclic Graph.CyclicSCC{} = False -- * Graph composition -- | @composeWith times plus g g'@ finds all edges -- @s --c_i--> t_i --d_i--> u@ and constructs the -- result graph from @edge(s,u) = sum_i (c_i times d_i)@. -- -- Complexity: for each edge @s --> t@ in @g@ we lookup up -- all edges starting in with @t@ in @g'@. -- composeWith :: (Ord s, Ord t, Ord u) => (c -> d -> e) -> (e -> e -> e) -> Graph s t c -> Graph t u d -> Graph s u e composeWith times plus (Graph g) (Graph g') = Graph $ Map.mapMaybe (discardEmpty . comp) g where comp m = Map.fromListWith plus [ (u, c `times` d) | (t, c) <- Map.assocs m , m' <- maybeToList (Map.lookup t g') , (u, d) <- Map.assocs m' ] -- | Transitive closure ported from "Agda.Termination.CallGraph". -- -- Relatively efficient, see Issue 1560. complete :: (Eq e, Null e, SemiRing e, Ord n) => Graph n n e -> Graph n n e complete g = repeatWhile (mapFst (not . discrete) . combineNewOld' g) g where combineNewOld' new old = unzip $ unionWith comb new' old' where -- The following procedure allows us to check if anything new happened: -- Pair the composed graphs with an empty graph. -- The empty graph will remain empty. We only need it due to the typing -- of Map.unionWith. new' = (,Null.empty) <$> composeWith otimes oplus new old -- Pair an empty graph with the old graph. old' = (Null.empty,) <$> old -- Combine the pairs. -- Update 'old' with 'new'. This will be the new 'old'. No new 'new' if no change. comb (new, _) (_, old) = (if x == old then Null.empty else x, x) where x = old `oplus` new -- | Version of 'complete' that produces a list of intermediate results -- paired to the left with a difference that lead to the new intermediat result. -- -- The last element in the list is the transitive closure, paired with the empty graph. -- -- @complete g = snd $ last $ completeIter g@ completeIter :: (Eq e, Null e, SemiRing e, Ord n) => Graph n n e -> [(Graph n n e, Graph n n e)] completeIter g = iterWhile (not . discrete) (combineNewOld' g) g where combineNewOld' new old = unzip $ unionWith comb new' old' where -- The following procedure allows us to check if anything new happened: -- Pair the composed graphs with an empty graph. -- The empty graph will remain empty. We only need it due to the typing -- of Map.unionWith. new' = (,Null.empty) <$> composeWith otimes oplus new old -- Pair an empty graph with the old graph. old' = (Null.empty,) <$> old -- Combine the pairs. -- Update 'old' with 'new'. This will be the new 'old'. No new 'new' if no change. comb (new, _) (_, old) = (if x == old then Null.empty else x, x) where x = old `oplus` new -- | Computes the transitive closure of the graph. -- -- Uses the Gauss-Jordan-Floyd-Warshall-McNaughton-Yamada algorithm -- (as described by Russell O'Connor in \"A Very General Method of -- Computing Shortest Paths\" -- ), implemented using -- matrices. -- -- The resulting graph does not contain any zero edges. -- -- This algorithm should be seen as a reference implementation. In -- practice 'gaussJordanFloydWarshallMcNaughtonYamada' is likely to be -- more efficient. gaussJordanFloydWarshallMcNaughtonYamadaReference :: forall n e. (Ord n, Eq e, StarSemiRing e) => Graph n n e -> Graph n n e gaussJordanFloydWarshallMcNaughtonYamadaReference g = toGraph (foldr step initialMatrix nodeIndices) where indicesAndNodes = zip [1..] $ Set.toList $ nodes g nodeMap = Map.fromList $ map swap indicesAndNodes indexMap = Map.fromList indicesAndNodes noNodes = Map.size nodeMap nodeIndices = [1 .. noNodes] matrixBounds = ((1, 1), (noNodes, noNodes)) initialMatrix :: Array.Array (Int, Int) e initialMatrix = Array.accumArray oplus ozero matrixBounds [ ((nodeMap Map.! source e, nodeMap Map.! target e), label e) | e <- edges g ] rightStrictPair i !e = (i , e) step k !m = Array.array matrixBounds [ rightStrictPair (i, j) (oplus (m Array.! (i, j)) (otimes (m Array.! (i, k)) (otimes (ostar (m Array.! (k, k))) (m Array.! (k, j))))) | i <- nodeIndices, j <- nodeIndices ] toGraph m = fromList [ Edge (indexMap Map.! i) (indexMap Map.! j) e | ((i, j), e) <- Array.assocs m , e /= ozero ] -- | Computes the transitive closure of the graph. -- -- Uses the Gauss-Jordan-Floyd-Warshall-McNaughton-Yamada algorithm -- (as described by Russell O'Connor in \"A Very General Method of -- Computing Shortest Paths\" -- ), implemented using -- 'Graph', and with some shortcuts: -- -- * Zero edge differences are not added to the graph, thus avoiding -- some zero edges. -- -- * Strongly connected components are used to avoid computing some -- zero edges. gaussJordanFloydWarshallMcNaughtonYamada :: forall n e. (Ord n, Eq e, StarSemiRing e) => Graph n n e -> Graph n n e gaussJordanFloydWarshallMcNaughtonYamada g = loop components g where components = sccs' g forwardDAG = sccDAG' g components reverseDAG = oppositeDAG forwardDAG loop :: [Graph.SCC n] -> Graph n n e -> Graph n n e loop [] !g = g loop (scc : sccs) g = loop sccs (foldr step g (Graph.flattenSCC scc)) where -- All nodes that are reachable from the SCC. canBeReached = reachable forwardDAG scc -- All nodes that can reach the SCC. canReach = reachable reverseDAG scc step :: n -> Graph n n e -> Graph n n e step k !g = foldr (insertEdgeWith oplus) g [ Edge i j e | i <- canReach , j <- canBeReached , let e = otimes (lookup' i k) (starTimes (lookup' k j)) , e /= ozero ] where starTimes = otimes (ostar (lookup' k k)) lookup' s t = case lookup s t g of Nothing -> ozero Just e -> e -- | Find a path from a source node to a target node. -- -- The path must satisfy the given predicate @good :: e -> Bool@. findPath :: (SemiRing e, Ord n) => (e -> Bool) -> n -> n -> Graph n n e -> Maybe e findPath good a b g = headMaybe $ filter good $ allPaths good a b g -- | @allPaths classify a b g@ returns a list of pathes (accumulated edge weights) -- from node @a@ to node @b@ in @g@. -- Alternative intermediate pathes are only considered if they -- are distinguished by the @classify@ function. allPaths :: (SemiRing e, Ord n, Ord c) => (e -> c) -> n -> n -> Graph n n e -> [e] allPaths classify s t g = paths Set.empty s where paths visited s = do (s', e) <- neighbours s g let tag = (s', classify e) recurse = map (e `otimes`) (paths (Set.insert tag visited) s') if tag `Set.member` visited then [] else if s' == t then e : recurse else recurse -- THE FOLLOWING IMPLEMENTATION OF allTrails is in practice worse -- then the naive depth-first search with backtracking. -- -- | A trail is a non-empty list of consecutive edges with no duplicate. -- -- We store a set of edges for more efficient trail composition. -- -- -- -- Invariants for @Trail tr s@: -- -- -- -- 1. nonempty -- -- @not $ null tr@. -- -- -- -- 2. consecutive -- -- @List.and $ zipWith (\ (Edge _ t1 _) (Edge s2 _ _) -> t1 == s2) tr (tail tr)@. -- -- -- -- 3. coherence -- -- @Set.toAscList s == sort $ map (\ (Edges s t _) -> (s,t)) tr@. -- data Trail n e = Trail { trail :: [Edge n n e], trailEdgeSet :: Set (n, n) } -- deriving (Show) -- instance (Eq n, Eq e) => Eq (Trail n e) where -- (==) = (==) `on` trail -- instance (Ord n, Ord e) => Ord (Trail n e) where -- compare = compare `on` trail -- singletonTrail :: Edge n n e -> Trail n e -- singletonTrail e@(Edge s t _) = Trail [e] $ Set.singleton (s,t) -- trailSource :: Trail n e -> n -- trailSource (Trail (Edge s _ _ : _) _) = s -- trailSource _ = __IMPOSSIBLE__ -- trailTarget :: Trail n e -> n -- trailTarget (Trail (Edge _ t _ : _) _) = t -- trailTarget _ = __IMPOSSIBLE__ -- -- | Precondition for @composeTrails t1 t2@: -- -- @trailTarget t1 == trailSource t2@. -- composeTrails :: (Ord n) => Trail n e -> Trail n e -> Maybe (Trail n e) -- composeTrails (Trail t1 s1) (Trail t2 s2) = -- if null (Set.intersection s1 s2) then Just $ Trail (t1 ++ t2) $ Set.union s1 s2 -- else Nothing -- composeTrails_alt :: (Ord n) => Trail n e -> Trail n e -> Maybe (Trail n e) -- composeTrails_alt t (Trail [] _) = Just t -- composeTrails_alt (Trail [] _) t = Just t -- composeTrails_alt (Trail t1 s1) (Trail t2 s2) = -- foldr cons (return t2) t1 <&> \ t12 -> Trail t12 $ Set.union s1 s2 -- where -- cons e@(Edge s t _) mt12 = do -- t12 <- mt12 -- guard $ (s,t) `Set.notMember` s2 -- return $ e : t12 -- -- | A possibly empty set of trails with same source and same target. -- -- -- -- Invariants for @Tails ts@: -- -- Same source: @length (group (map trailSource ts)) == 1@. -- -- Same target: @length (group (map trailTarget ts)) == 1@. -- newtype Trails n e = Trails { trails :: Set (Trail n e) } -- deriving (Eq, Ord, Show, Null, Singleton (Trail n e)) -- instance (Ord n, Ord e) => SemiRing (Trails n e) where -- ozero = Null.empty -- oone = __IMPOSSIBLE__ -- oplus (Trails t1s) (Trails t2s) = Trails $ Set.union t1s t2s -- otimes (Trails t1s) (Trails t2s) = Trails $ Set.fromList $ -- catMaybes [ composeTrails t1 t2 | t1 <- Set.toList t1s, t2 <- Set.toList t2s ] -- -- | We compute @allTrails@ by a transitive closure algorithm. -- -- In practice, we are only interested in the first trail -- -- with a specific property, so it is important -- -- to compute @allTrails@ lazily. -- -- -- -- We use a graph with edges labelled by 'Trails'. -- allTrails :: forall e n. (Eq e, Ord e, SemiRing e, Ord n) => -- n -> n -> Graph n n e -> [e] -- allTrails s t g = map collapse st -- where -- -- Construct a graph of singleton trails -- init :: Graph n n (Trails n e) -- init = mapWithEdge (Singleton.singleton . singletonTrail) g -- -- Compute transitive closure iteratively and keep the diffs. -- diffs = init : map fst (completeIter init) -- -- Extract a sequence of trails from s to t from the diff sequence. -- -- Each diff may contain several or no trails from s to t. -- st = concat $ map (maybe [] (Set.toList . trails) . lookup s t) diffs -- -- Multiply the edge weights a long a trail. -- collapse (Trail tr _) = foldr1 otimes $ map label tr -- | @allTrails a b g@ returns all trails (walks where all edges are -- distinct) from node @a@ to node @b@ in @g@. The trails are returned -- in the form of accumulated edge weights. -- -- This definition can perhaps be optimised through the use of -- memoisation. -- -- Andreas, 2015-07-21 Issue 1612: This function is worst-case exponential -- as the @k@-complete graph has @k!@ many trails. DON'T USE! allTrails :: forall e n. (SemiRing e, Ord n) => n -> n -> Graph n n e -> [e] allTrails s t g = paths Set.empty s where paths :: Set (n, n) -> n -> [e] paths traversed s = do (s', e) <- neighbours s g let edge = (s, s') recurse = (e `otimes`) <$> paths (Set.insert edge traversed) s' if edge `Set.member` traversed then [] else if s' == t then e : recurse else recurse ------------------------------------------------------------------------ -- Generators instance (Arbitrary s, Arbitrary t, Arbitrary e) => Arbitrary (Edge s t e) where arbitrary = Edge <$> arbitrary <*> arbitrary <*> arbitrary instance (CoArbitrary s, CoArbitrary t, CoArbitrary e) => CoArbitrary (Edge s t e) where coarbitrary (Edge s t e) = coarbitrary s . coarbitrary t . coarbitrary e instance (Ord n, SemiRing e, Arbitrary n, Arbitrary e) => Arbitrary (Graph n n e) where arbitrary = do nodes <- sized $ \ n -> resize (2 * isqrt n) arbitrary edges <- mapM (\ (n1, n2) -> Edge n1 n2 <$> arbitrary) =<< listOfElements ((,) <$> nodes <*> nodes) let g1 = fromList edges g2 = g1 `union` fromNodes nodes elements [ g1 -- Does not contain empty outermost node maps. , g2 -- May contain empty outermost node maps. ] where isqrt :: Int -> Int isqrt = round . sqrt . fromIntegral shrink g = [ removeNode n g | n <- Set.toList $ nodes g ] ++ [ removeEdge n1 n2 g | Edge n1 n2 _ <- edges g ] Agda-2.4.2.5/src/full/Agda/Utils/Graph/AdjacencyMap/Unidirectional/0000755000000000000000000000000012635075266022736 5ustar0000000000000000Agda-2.4.2.5/src/full/Agda/Utils/Graph/AdjacencyMap/Unidirectional/Tests.hs0000644000000000000000000002622512635075266024403 0ustar0000000000000000{-# OPTIONS_GHC -fno-warn-missing-signatures #-} {-# LANGUAGE CPP #-} {-# LANGUAGE DoAndIfThenElse #-} {-# LANGUAGE FlexibleInstances #-} {-# LANGUAGE GeneralizedNewtypeDeriving #-} {-# LANGUAGE NoMonomorphismRestriction #-} {-# LANGUAGE TemplateHaskell #-} -- | Properties for graph library. module Agda.Utils.Graph.AdjacencyMap.Unidirectional.Tests (tests) where import Prelude hiding (null) import Control.Monad import Data.Function import qualified Data.Graph as Graph import qualified Data.List as List import Data.Maybe import Data.Map (Map) import qualified Data.Map as Map import Data.Set (Set) import qualified Data.Set as Set import Test.QuickCheck as QuickCheck import Agda.TypeChecking.Positivity.Occurrence hiding (tests) import Agda.Utils.Function (iterateUntil) import Agda.Utils.Functor import Agda.Utils.Graph.AdjacencyMap.Unidirectional as Graph import Agda.Utils.List (distinct) import Agda.Utils.Null as Null import Agda.Utils.SemiRing import Agda.Utils.Singleton (Singleton) import qualified Agda.Utils.Singleton as Singleton import Agda.Utils.TestHelpers #include "undefined.h" import Agda.Utils.Impossible ------------------------------------------------------------------------ -- * Generating random graphs ------------------------------------------------------------------------ -- | Generates a node from the graph. (Unless the graph is empty.) nodeIn :: (Ord n, Arbitrary n) => Graph n n e -> Gen n nodeIn g = elementsUnlessEmpty (Set.toList $ nodes g) -- | Generates an edge from the graph. (Unless the graph contains no -- edges.) edgeIn :: (Ord n, Arbitrary n, Arbitrary e) => Graph n n e -> Gen (Edge n n e) edgeIn g = elementsUnlessEmpty (edges g) -- | Sample graph type used to test some graph algorithms. type G = Graph N N E -- | Sample edge type used to test some graph algorithms. type E = Occurrence -- | Sample node type used to test some graph algorithms. newtype N = N (Positive Int) deriving (Arbitrary, Eq, Ord) n :: Int -> N n = N . Positive instance Show N where show (N (Positive n)) = "n " ++ show n -- | 'gaussJordanFloydWarshallMcNaughtonYamada' can be used to check -- if any two nodes in a graph are connected. data Connected = Disconnected | Connected deriving (Eq, Show) instance SemiRing Connected where ozero = Disconnected oone = Connected Disconnected `oplus` c = c Connected `oplus` _ = Connected Disconnected `otimes` _ = Disconnected Connected `otimes` c = c instance StarSemiRing Connected where ostar _ = Connected connectivityGraph :: Ord n => Graph n n e -> Graph n n Connected connectivityGraph = gaussJordanFloydWarshallMcNaughtonYamada . fmap (const oone) connected :: Ord n => Graph n n Connected -> n -> n -> Bool connected g i j = Graph.lookup i j g == Just Connected ------------------------------------------------------------------------ -- * Graph properties ------------------------------------------------------------------------ -- prop_neighbours :: (Ord s, Ord t, Eq e) => s -> Graph s t e -> Bool prop_neighbours :: N -> G -> Bool prop_neighbours s g = neighbours s g == map (\ (Edge s t e) -> (t, e)) (edgesFrom g [s]) -- prop_nodes_fromNodes :: Ord n => [n] -> Bool prop_nodes_fromNodes :: [N] -> Bool prop_nodes_fromNodes ns = sourceNodes (fromNodes ns) == Set.fromList ns prop_clean_discrete :: G -> Bool prop_clean_discrete g = discrete g == (null . graph . clean) g -- prop_insertWith :: (Eq e, Ord s, Ord t) => -- (e -> e -> e) -> s -> t -> e -> Graph s t e -> Bool prop_insertWith :: (E -> E -> E) -> N -> N -> E -> G -> Bool prop_insertWith f s t e g = insertWith f s t e g == unionWith (flip f) g (singleton s t e) -- -- This property only holds only if the edge is new. -- prop_insert :: (Ord s, Ord t) => s -> t -> e -> Graph s t e -> Bool -- prop_insert s t e g = insert s t e g == union g (singleton s t e) prop_sccs' :: G -> Bool prop_sccs' g = nodes g == Set.fromList (concat components) && all distinct components && all (not . null) components && disjoint (map Set.fromList components) && all stronglyConnected components' && noMissingStronglyConnectedNodes components && reverseTopologicalOrder where components' = sccs' g components = map Graph.flattenSCC components' disjoint [] = True disjoint (s : ss) = all (Set.null . Set.intersection s) ss && disjoint ss connected' = connected (connectivityGraph g) stronglyConnected (Graph.AcyclicSCC n) = not (connected' n n) stronglyConnected (Graph.CyclicSCC ns) = and [ connected' i j | i <- ns , j <- ns ] noMissingStronglyConnectedNodes [] = True noMissingStronglyConnectedNodes (ns : nss) = and [ not (connected' j i && connected' i j) | i <- ns , j <- concat nss ] && noMissingStronglyConnectedNodes nss reverseTopologicalOrder = and [ component i <= component j | Edge i j _ <- edges g ] where component k = head [ i | (i, ns) <- zip [1..] (reverse components) , k `elem` ns ] prop_sccDAG :: G -> Bool prop_sccDAG g = dagInvariant dag && nodes g == Map.keysSet (dagNodeMap dag) where dag = sccDAG g prop_oppositeDAG :: G -> Bool prop_oppositeDAG g = dagInvariant (oppositeDAG (sccDAG g)) -- | Computes the transitive closure of the graph. -- -- Note that this algorithm is not guaranteed to be correct (or -- terminate) for arbitrary semirings. -- -- This function operates on the entire graph at once. transitiveClosure1 :: (Eq e, SemiRing e, Ord n) => Graph n n e -> Graph n n e transitiveClosure1 = completeUntilWith (==) otimes oplus -- | Computes the transitive closure of the graph. -- -- Note that this algorithm is not guaranteed to be correct (or -- terminate) for arbitrary semirings. -- -- This function operates on the entire graph at once. completeUntilWith :: (Ord n) => (Graph n n e -> Graph n n e -> Bool) -> (e -> e -> e) -> (e -> e -> e) -> Graph n n e -> Graph n n e completeUntilWith done otimes oplus = iterateUntil done growGraph where -- @growGraph g@ unions @g@ with @(s --> t) `compose` g@ for each -- edge @s --> t@ in @g@ growGraph g = List.foldl' (unionWith oplus) g $ for (edges g) $ \ (Edge s t e) -> case Map.lookup t (graph g) of Just es -> Graph $ Map.singleton s $ Map.map (otimes e) es Nothing -> Graph.empty -- | Equality modulo empty edges. (~~) :: (Eq e, Ord s, Ord t, Null e) => Graph s t e -> Graph s t e -> Bool (~~) = (==) `on` clean prop_gaussJordanFloydWarshallMcNaughtonYamadaReference :: G -> Bool prop_gaussJordanFloydWarshallMcNaughtonYamadaReference g = gaussJordanFloydWarshallMcNaughtonYamadaReference g ~~ transitiveClosure1 g prop_gaussJordanFloydWarshallMcNaughtonYamada :: G -> Property prop_gaussJordanFloydWarshallMcNaughtonYamada g = QuickCheck.label sccInfo $ gaussJordanFloydWarshallMcNaughtonYamada g ~~ transitiveClosure1 g where sccInfo = (if noSCCs <= 3 then " " ++ show noSCCs else ">= 4") ++ " strongly connected component(s)" where noSCCs = length (sccs g) prop_complete :: G -> Bool prop_complete g = complete g ~~ transitiveClosure1 g -- Andreas, 2015-07-21 Issue 1612: -- May take forever due to exponential time of allTrails. -- -- prop_allTrails_existence :: Property -- prop_allTrails_existence = -- forAll (scale (`div` 2) arbitrary :: Gen G) $ \g -> -- forAll (nodeIn g) $ \i -> -- forAll (nodeIn g) $ \j -> -- null (allTrails i j g) -- == -- not (connected (connectivityGraph g) i j) -- | The 'Integer's should be non-negative. data ExtendedNatural = Finite Integer | Infinite deriving (Eq, Ord, Show) instance SemiRing ExtendedNatural where ozero = Finite 0 oone = Finite 1 oplus (Finite m) (Finite n) = Finite (m + n) oplus Infinite _ = Infinite oplus _ Infinite = Infinite otimes (Finite m) (Finite n) = Finite (m * n) otimes (Finite 0) _ = Finite 0 otimes _ (Finite 0) = Finite 0 otimes Infinite _ = Infinite otimes _ Infinite = Infinite instance StarSemiRing ExtendedNatural where ostar (Finite 0) = Finite 1 ostar _ = Infinite -- Andreas, 2015-07-21 Issue 1612: -- May take forever due to exponential time of allTrails. -- -- prop_allTrails_number :: Property -- prop_allTrails_number = -- forAll (scale (`div` 2) arbitrary :: Gen G) $ \g -> -- forAll (nodeIn g) $ \i -> -- forAll (nodeIn g) $ \j -> -- Finite (List.genericLength (allTrails i j g)) -- <= -- case Graph.lookup i j -- (gaussJordanFloydWarshallMcNaughtonYamada -- (fmap (const oone) g)) of -- Just n -> n -- Nothing -> Finite 0 -- Node 10 is unreachable, so @allTrails _ 10 g1612@ takes forever g1612 :: Graph N N E g1612 = Graph $ Map.fromList [ (n 1,Map.fromList [(n 1,Unused ),(n 9,StrictPos),(n 12,JustPos),(n 15,JustPos)]) , (n 3,Map.fromList [(n 3,Unused ),(n 8,StrictPos)]) , (n 8,Map.fromList [(n 1,GuardPos ),(n 3,Mixed ),(n 8,Unused),(n 9,JustPos),(n 11,StrictPos),(n 12,GuardPos),(n 15,JustPos)]) , (n 9,Map.fromList [(n 1,JustNeg ),(n 8,Mixed ),(n 9,JustNeg),(n 11,StrictPos),(n 12,StrictPos)]) , (n 10,Map.fromList [(n 1,JustPos ),(n 8,StrictPos)]) , (n 11,Map.fromList [(n 1,StrictPos),(n 8,JustNeg ),(n 9,JustNeg),(n 11,JustNeg)]) , (n 12,Map.fromList [(n 1,JustPos ),(n 15,StrictPos)]) , (n 15,Map.fromList [(n 1,JustPos ),(n 8,GuardPos ),(n 11,Mixed),(n 12,Mixed)]) ] -- t1612t = allTrails (n 9) (n 10) g1612 -- FOREVER g1612a = Graph $ Map.fromList [(n 1,Map.fromList [(n 2,JustNeg),(n 11,Mixed)]) ,(n 2,Map.fromList [(n 1,JustNeg),(n 2,GuardPos),(n 4,GuardPos),(n 8,Unused),(n 11,Unused)]) ,(n 4,Map.fromList [(n 2,GuardPos),(n 8,JustPos),(n 12,GuardPos)]) ,(n 6,Map.fromList [(n 1,StrictPos),(n 11,Unused),(n 12,JustNeg)]) ,(n 8,Map.fromList [(n 1,GuardPos),(n 4,JustPos),(n 8,JustPos)]) ,(n 11,Map.fromList [(n 4,GuardPos),(n 12,StrictPos)]) ,(n 12,Map.fromList [(n 1,Mixed),(n 4,Mixed),(n 11,Mixed)]) ] ------------------------------------------------------------------------ -- * All tests ------------------------------------------------------------------------ -- Template Haskell hack to make the following $quickCheckAll work -- under ghc-7.8. return [] -- KEEP! -- | All tests as collected by 'quickCheckAll'. -- -- Using 'quickCheckAll' is convenient and superior to the manual -- enumeration of tests, since the name of the property is -- added automatically. tests :: IO Bool tests = do putStrLn "Agda.Utils.Graph.AdjacencyMap.Unidirectional" $quickCheckAll -- Abbreviations for testing in interpreter g1, g2, g3, g4 :: Graph N N E g1 = Graph $ Map.fromList [ (n 1, Map.fromList [(n 2,Unused)]) , (n 2, Map.fromList [(n 1,Unused)]) ] g2 = Graph $ Map.fromList [ (n 1, Map.fromList [(n 2,StrictPos)]) , (n 2, Map.fromList [(n 1,StrictPos)]) ] g3 = Graph $ Map.fromList [ (n 1, Map.fromList [(n 2,StrictPos)]) , (n 2, Map.fromList []) , (n 4, Map.fromList [(n 1,StrictPos)]) ] g4 = Graph $ Map.fromList [ (n 1, Map.fromList [(n 6,Unused)]) , (n 6, Map.fromList [(n 8,StrictPos)]) , (n 8, Map.fromList [(n 3,Unused)]) ] Agda-2.4.2.5/src/full/Agda/Interaction/0000755000000000000000000000000012635075266015564 5ustar0000000000000000Agda-2.4.2.5/src/full/Agda/Interaction/InteractionTop.hs-boot0000644000000000000000000000016712635075266022027 0ustar0000000000000000module Agda.Interaction.InteractionTop where import Agda.TypeChecking.Monad.Base (TCM) showOpenMetas :: TCM [String] Agda-2.4.2.5/src/full/Agda/Interaction/Imports.hs-boot0000644000000000000000000000045312635075266020520 0ustar0000000000000000 module Agda.Interaction.Imports where import Agda.Syntax.Abstract.Name ( ModuleName ) import Agda.Syntax.Scope.Base ( Scope ) import Agda.TypeChecking.Monad.Base ( TCM ) import Data.Map ( Map ) scopeCheckImport :: ModuleName -> TCM (ModuleName, Map ModuleName Scope) Agda-2.4.2.5/src/full/Agda/Interaction/InteractionTop.hs0000644000000000000000000012613712635075266021074 0ustar0000000000000000{-# OPTIONS -fno-cse #-} {-# LANGUAGE CPP #-} {-# LANGUAGE DeriveFoldable #-} {-# LANGUAGE DeriveFunctor #-} {-# LANGUAGE DeriveTraversable #-} {-# LANGUAGE FlexibleInstances #-} {-# LANGUAGE MultiParamTypeClasses #-} {-# LANGUAGE Rank2Types #-} {-# LANGUAGE ScopedTypeVariables #-} {-# LANGUAGE TupleSections #-} {-# OPTIONS_GHC -fno-warn-orphans #-} module Agda.Interaction.InteractionTop ( module Agda.Interaction.InteractionTop ) where import Prelude hiding (null) import Control.Applicative hiding (empty) import qualified Control.Exception as E import Control.Monad.Identity import Control.Monad.Reader import Control.Monad.State import qualified Data.Char as Char import Data.Foldable (Foldable) import Data.Function import Data.List as List hiding (null) import Data.Maybe import Data.Map (Map) import qualified Data.Map as Map import Data.Monoid import Data.Traversable (Traversable) import qualified Data.Traversable as Trav import System.Directory import System.FilePath import Agda.TypeChecking.Monad as TM hiding (initState, setCommandLineOptions) import qualified Agda.TypeChecking.Monad as TM import qualified Agda.TypeChecking.Pretty as TCP import Agda.TypeChecking.Errors import Agda.Syntax.Fixity import Agda.Syntax.Position import Agda.Syntax.Parser import Agda.Syntax.Common import Agda.Syntax.Concrete as C import Agda.Syntax.Concrete.Generic as C import Agda.Syntax.Concrete.Pretty () import Agda.Syntax.Abstract as A import Agda.Syntax.Abstract.Pretty import Agda.Syntax.Info (mkDefInfo) import Agda.Syntax.Translation.ConcreteToAbstract import Agda.Syntax.Translation.AbstractToConcrete hiding (withScope) import Agda.Syntax.Scope.Base import Agda.Interaction.FindFile import Agda.Interaction.Options import Agda.Interaction.Options.Lenses as Lenses import Agda.Interaction.MakeCase import Agda.Interaction.Response hiding (Function, ExtendedLambda) import qualified Agda.Interaction.Response as R import qualified Agda.Interaction.BasicOps as B import Agda.Interaction.Highlighting.Precise hiding (Postulate) import qualified Agda.Interaction.Imports as Imp import Agda.Interaction.Highlighting.Generate import qualified Agda.Interaction.Highlighting.Range as H import qualified Agda.Compiler.Epic.Compiler as Epic import qualified Agda.Compiler.MAlonzo.Compiler as MAlonzo import qualified Agda.Compiler.JS.Compiler as JS import qualified Agda.Auto.Auto as Auto import Agda.Utils.Except ( ExceptT , mkExceptT , MonadError(catchError, throwError) , runExceptT ) import Agda.Utils.FileName import Agda.Utils.Hash import qualified Agda.Utils.HashMap as HMap import Agda.Utils.Lens import Agda.Utils.Maybe import Agda.Utils.Monad import Agda.Utils.Null import Agda.Utils.Pretty import Agda.Utils.String import Agda.Utils.Time #include "undefined.h" import Agda.Utils.Impossible ------------------------------------------ -- | Auxiliary state of an interactive computation. data CommandState = CommandState { theInteractionPoints :: [InteractionId] -- ^ The interaction points of the buffer, in the order in which -- they appear in the buffer. The interaction points are -- recorded in 'theTCState', but when new interaction points are -- added by give or refine Agda does not ensure that the ranges -- of later interaction points are updated. , theCurrentFile :: Maybe (AbsolutePath, ClockTime) -- ^ The file which the state applies to. Only stored if the -- module was successfully type checked (potentially with -- warnings). The 'ClockTime' is the modification time stamp of -- the file when it was last loaded. , optionsOnReload :: CommandLineOptions -- ^ Reset the options on each reload to these. , oldInteractionScopes :: OldInteractionScopes -- ^ We remember (the scope of) old interaction points to make it -- possible to parse and compute highlighting information for the -- expression that it got replaced by. } type OldInteractionScopes = Map InteractionId ScopeInfo -- | Initial auxiliary interaction state initCommandState :: CommandState initCommandState = CommandState { theInteractionPoints = [] , theCurrentFile = Nothing , optionsOnReload = defaultOptions , oldInteractionScopes = Map.empty } -- | Monad for computing answers to interactive commands. -- -- 'CommandM' is 'TCM' extended with state 'CommandState'. type CommandM = StateT CommandState TCM -- | Build an opposite action to 'lift' for state monads. revLift :: MonadState st m => (forall c . m c -> st -> k (c, st)) -- ^ run -> (forall b . k b -> m b) -- ^ lift -> (forall x . (m a -> k x) -> k x) -> m a -- ^ reverse lift in double negative position revLift run lift f = do st <- get (a, st) <- lift $ f (`run` st) put st return a -- | Opposite of 'liftIO' for 'CommandM'. -- Use only if main errors are already catched. commandMToIO :: (forall x . (CommandM a -> IO x) -> IO x) -> CommandM a commandMToIO ci_i = revLift runStateT lift $ \ct -> revLift runSafeTCM liftIO $ ci_i . (. ct) -- | Lift a TCM action transformer to a CommandM action transformer. liftCommandMT :: (forall a . TCM a -> TCM a) -> CommandM a -> CommandM a liftCommandMT f m = revLift runStateT lift $ f . ($ m) -- | Put a response by the callback function given by 'stInteractionOutputCallback'. putResponse :: Response -> CommandM () putResponse = lift . appInteractionOutputCallback -- | A Lens for 'theInteractionPoints'. modifyTheInteractionPoints :: ([InteractionId] -> [InteractionId]) -> CommandM () modifyTheInteractionPoints f = modify $ \ s -> s { theInteractionPoints = f (theInteractionPoints s) } -- * Operations for manipulating 'oldInteractionScopes'. -- | A Lens for 'oldInteractionScopes'. modifyOldInteractionScopes :: (OldInteractionScopes -> OldInteractionScopes) -> CommandM () modifyOldInteractionScopes f = modify $ \ s -> s { oldInteractionScopes = f $ oldInteractionScopes s } insertOldInteractionScope :: InteractionId -> ScopeInfo -> CommandM () insertOldInteractionScope ii scope = do lift $ reportSLn "interaction.scope" 20 $ "inserting old interaction scope " ++ show ii modifyOldInteractionScopes $ Map.insert ii scope removeOldInteractionScope :: InteractionId -> CommandM () removeOldInteractionScope ii = do lift $ reportSLn "interaction.scope" 20 $ "removing old interaction scope " ++ show ii modifyOldInteractionScopes $ Map.delete ii getOldInteractionScope :: InteractionId -> CommandM ScopeInfo getOldInteractionScope ii = do ms <- gets $ Map.lookup ii . oldInteractionScopes case ms of Nothing -> fail $ "not an old interaction point: " ++ show ii Just scope -> return scope -- | Run an 'IOTCM' value, catch the exceptions, emit output -- -- If an error happens the state of 'CommandM' does not change, -- but stPersistent may change (which contains successfully -- loaded interfaces for example). runInteraction :: IOTCM -> CommandM () runInteraction (IOTCM current highlighting highlightingMethod cmd) = handleNastyErrors $ inEmacs $ do current <- liftIO $ absolute current res <- (`catchErr` (return . Just)) $ do -- Raises an error if the given file is not the one currently -- loaded. cf <- gets theCurrentFile when (not (independent cmd) && Just current /= (fst <$> cf)) $ lift $ typeError $ GenericError "Error: First load the file." withCurrentFile $ interpret cmd cf <- gets theCurrentFile when (Just current == (fst <$> cf)) $ putResponse . Resp_InteractionPoints =<< gets theInteractionPoints return Nothing maybe (return ()) handleErr res where -- Preserves state so we can do unsolved meta highlighting catchErr :: CommandM a -> (TCErr -> CommandM a) -> CommandM a catchErr m h = do s <- get -- If an independent command fails we should reset theCurrentFile (Issue853). let sErr | independent cmd = s { theCurrentFile = Nothing } | otherwise = s (x, s') <- lift $ do disableDestructiveUpdate (runStateT m s) `catchError_` \ e -> runStateT (h e) sErr put s' return x inEmacs = liftCommandMT $ withEnv $ initEnv { envHighlightingLevel = highlighting , envHighlightingMethod = highlightingMethod } -- | Handle nasty errors like stack space overflow (issue 637) -- We assume that the input action handles other kind of errors. handleNastyErrors :: CommandM () -> CommandM () handleNastyErrors m = commandMToIO $ \ toIO -> toIO m `E.catch` \ (e :: E.SomeException) -> toIO $ handleErr $ Exception noRange $ text $ show e -- | Displays an error and instructs Emacs to jump to the site of the -- error. Because this function may switch the focus to another file -- the status information is also updated. handleErr e = do meta <- lift $ computeUnsolvedMetaWarnings constr <- lift $ computeUnsolvedConstraints err <- lift $ errorHighlighting e modFile <- lift $ use stModuleToSource let info = compress $ mconcat -- Errors take precedence over unsolved things. [err, meta, constr] s <- lift $ prettyError e x <- lift $ optShowImplicit <$> use stPragmaOptions mapM_ putResponse $ [ Resp_DisplayInfo $ Info_Error s ] ++ tellEmacsToJumpToError (getRange e) ++ [ Resp_HighlightingInfo info modFile ] ++ [ Resp_Status $ Status { sChecked = False , sShowImplicitArguments = x } ] ---------------------------------------------------------------------------- -- | An interactive computation. type Interaction = Interaction' Range data Interaction' range -- | @cmd_load m includes@ loads the module in file @m@, using -- @includes@ as the include directories. = Cmd_load FilePath [FilePath] -- | @cmd_compile b m includes@ compiles the module in file @m@ using -- the backend @b@, using @includes@ as the include directories. | Cmd_compile Backend FilePath [FilePath] | Cmd_constraints -- | Show unsolved metas. If there are no unsolved metas but unsolved constraints -- show those instead. | Cmd_metas -- | Shows all the top-level names in the given module, along with -- their types. Uses the top-level scope. | Cmd_show_module_contents_toplevel B.Rewrite String | Cmd_solveAll -- | Parse the given expression (as if it were defined at the -- top-level of the current module) and infer its type. | Cmd_infer_toplevel B.Rewrite -- Normalise the type? String -- | Parse and type check the given expression (as if it were defined -- at the top-level of the current module) and normalise it. | Cmd_compute_toplevel Bool -- Ignore abstract? String ------------------------------------------------------------------------ -- Syntax highlighting -- | @cmd_load_highlighting_info source@ loads syntax highlighting -- information for the module in @source@, and asks Emacs to apply -- highlighting info from this file. -- -- If the module does not exist, or its module name is malformed or -- cannot be determined, or the module has not already been visited, -- or the cached info is out of date, then no highlighting information -- is printed. -- -- This command is used to load syntax highlighting information when a -- new file is opened, and it would probably be annoying if jumping to -- the definition of an identifier reset the proof state, so this -- command tries not to do that. One result of this is that the -- command uses the current include directories, whatever they happen -- to be. | Cmd_load_highlighting_info FilePath -- | Tells Agda to compute highlighting information for the expression just -- spliced into an interaction point. | Cmd_highlight InteractionId range String ------------------------------------------------------------------------ -- Implicit arguments -- | Tells Agda whether or not to show implicit arguments. | ShowImplicitArgs Bool -- Show them? -- | Toggle display of implicit arguments. | ToggleImplicitArgs ------------------------------------------------------------------------ -- | Goal commands -- -- If the range is 'noRange', then the string comes from the -- minibuffer rather than the goal. | Cmd_give InteractionId range String | Cmd_refine InteractionId range String | Cmd_intro Bool InteractionId range String | Cmd_refine_or_intro Bool InteractionId range String | Cmd_auto InteractionId range String | Cmd_context B.Rewrite InteractionId range String | Cmd_helper_function B.Rewrite InteractionId range String | Cmd_infer B.Rewrite InteractionId range String | Cmd_goal_type B.Rewrite InteractionId range String -- | Displays the current goal and context. | Cmd_goal_type_context B.Rewrite InteractionId range String -- | Displays the current goal and context /and/ infers the type of an -- expression. | Cmd_goal_type_context_infer B.Rewrite InteractionId range String -- | Shows all the top-level names in the given module, along with -- their types. Uses the scope of the given goal. | Cmd_show_module_contents B.Rewrite InteractionId range String | Cmd_make_case InteractionId range String | Cmd_compute Bool -- Ignore abstract? InteractionId range String | Cmd_why_in_scope InteractionId range String | Cmd_why_in_scope_toplevel String -- | Displays version of the running Agda | Cmd_show_version deriving (Read, Functor, Foldable, Traversable) type IOTCM = IOTCM' Range data IOTCM' range = IOTCM FilePath -- -^ The current file. If this file does not match -- 'theCurrentFile, and the 'Interaction' is not -- \"independent\", then an error is raised. HighlightingLevel HighlightingMethod (Interaction' range) -- -^ What to do deriving (Read, Functor, Foldable, Traversable) --------------------------------------------------------- -- Read instances -- | The 'Parse' monad. -- 'StateT' state holds the remaining input. type Parse a = ExceptT String (StateT String Identity) a -- | Converter from the type of 'reads' to 'Parse' -- The first paramter is part of the error message -- in case the parse fails. readsToParse :: String -> (String -> Maybe (a, String)) -> Parse a readsToParse s f = do st <- lift get case f st of Nothing -> throwError s Just (a, st) -> do lift $ put st return a parseToReadsPrec :: Parse a -> Int -> String -> [(a, String)] parseToReadsPrec p i s = case runIdentity . flip runStateT s . runExceptT $ parens' p of (Right a, s) -> [(a,s)] _ -> [] -- | Demand an exact string. exact :: String -> Parse () exact s = readsToParse (show s) $ fmap (\x -> ((),x)) . stripPrefix s . dropWhile (==' ') readParse :: Read a => Parse a readParse = readsToParse "read failed" $ listToMaybe . reads parens' :: Parse a -> Parse a parens' p = do exact "(" x <- p exact ")" return x `mplus` p instance Read InteractionId where readsPrec = parseToReadsPrec $ fmap InteractionId readParse instance Read a => Read (Range' a) where readsPrec = parseToReadsPrec $ do exact "Range" fmap Range readParse `mplus` do exact "noRange" return noRange instance Read a => Read (Interval' a) where readsPrec = parseToReadsPrec $ do exact "Interval" liftM2 Interval readParse readParse instance Read AbsolutePath where readsPrec = parseToReadsPrec $ do exact "mkAbsolute" fmap mkAbsolute readParse instance Read a => Read (Position' a) where readsPrec = parseToReadsPrec $ do exact "Pn" liftM4 Pn readParse readParse readParse readParse --------------------------------------------------------- -- | Can the command run even if the relevant file has not been loaded -- into the state? independent :: Interaction -> Bool independent (Cmd_load {}) = True independent (Cmd_compile {}) = True independent (Cmd_load_highlighting_info {}) = True independent Cmd_show_version = True independent _ = False -- | Interpret an interaction interpret :: Interaction -> CommandM () interpret (Cmd_load m includes) = cmd_load' m includes True $ \_ -> interpret Cmd_metas interpret (Cmd_compile b file includes) = cmd_load' file includes False $ \(i, mw) -> do case mw of Imp.NoWarnings -> do lift $ case b of MAlonzo -> MAlonzo.compilerMain True i MAlonzoNoMain -> MAlonzo.compilerMain False i Epic -> Epic.compilerMain i JS -> JS.compilerMain i display_info $ Info_CompilationOk Imp.SomeWarnings w -> display_info $ Info_Error $ unlines [ "You can only compile modules without unsolved metavariables" , "or termination checking problems." ] interpret Cmd_constraints = display_info . Info_Constraints . unlines . map show =<< lift B.getConstraints interpret Cmd_metas = do -- CL.showMetas [] ms <- lift $ showOpenMetas -- If we do not have open metas, but open constaints, display those. ifM (return (null ms) `and2M` do not . null <$> lift B.getConstraints) {-then-} (interpret Cmd_constraints) {-else-} (display_info $ Info_AllGoals $ unlines ms) interpret (Cmd_show_module_contents_toplevel norm s) = liftCommandMT B.atTopLevel $ showModuleContents norm noRange s interpret Cmd_solveAll = do out <- lift $ mapM lowr =<< B.getSolvedInteractionPoints False -- only solve metas which have a proper instantiation, i.e., not another meta putResponse $ Resp_SolveAll out where lowr (i, m, e) = do mi <- getMetaInfo <$> lookupMeta m e <- withMetaInfo mi $ lowerMeta <$> abstractToConcreteCtx TopCtx e return (i, e) interpret (Cmd_infer_toplevel norm s) = parseAndDoAtToplevel (B.typeInCurrent norm) Info_InferredType s interpret (Cmd_compute_toplevel ignore s) = parseAndDoAtToplevel (allowNonTerminatingReductions . if ignore then ignoreAbstractMode . c else inConcreteMode . c) Info_NormalForm s where c = B.evalInCurrent interpret (ShowImplicitArgs showImpl) = do opts <- lift commandLineOptions setCommandLineOptions' $ opts { optPragmaOptions = (optPragmaOptions opts) { optShowImplicit = showImpl } } interpret ToggleImplicitArgs = do opts <- lift commandLineOptions let ps = optPragmaOptions opts setCommandLineOptions' $ opts { optPragmaOptions = ps { optShowImplicit = not $ optShowImplicit ps } } interpret (Cmd_load_highlighting_info source) = do -- Make sure that the include directories have -- been set. setCommandLineOptions' =<< lift commandLineOptions resp <- lift $ liftIO . tellToUpdateHighlighting =<< do ex <- liftIO $ doesFileExist source absSource <- liftIO $ absolute source case ex of False -> return Nothing True -> do mmi <- (getVisitedModule =<< moduleName absSource) `catchError` \_ -> return Nothing case mmi of Nothing -> return Nothing Just mi -> do sourceH <- liftIO $ hashFile absSource if sourceH == iSourceHash (miInterface mi) then do modFile <- use stModuleToSource return $ Just (iHighlighting $ miInterface mi, modFile) else return Nothing mapM_ putResponse resp interpret (Cmd_highlight ii rng s) = do scope <- getOldInteractionScope ii removeOldInteractionScope ii handle $ do e <- try ("Highlighting failed to parse expression in " ++ show ii) $ B.parseExpr rng s e <- try ("Highlighting failed to scope check expression in " ++ show ii) $ concreteToAbstract scope e lift $ printHighlightingInfo =<< generateTokenInfoFromString rng s lift $ highlightExpr e where handle :: ExceptT String TCM () -> CommandM () handle m = do res <- lift $ runExceptT m case res of Left s -> display_info $ Info_Error s Right _ -> return () try :: String -> TCM a -> ExceptT String TCM a try err m = mkExceptT $ do (Right <$> m) `catchError` \ _ -> return (Left err) interpret (Cmd_give ii rng s) = give_gen ii rng s Give interpret (Cmd_refine ii rng s) = give_gen ii rng s Refine interpret (Cmd_intro pmLambda ii rng _) = do ss <- lift $ B.introTactic pmLambda ii liftCommandMT (B.withInteractionId ii) $ case ss of [] -> do display_info $ Info_Intro $ text "No introduction forms found." [s] -> do interpret $ Cmd_refine ii rng s _:_:_ -> do display_info $ Info_Intro $ sep [ text "Don't know which constructor to introduce of" , let mkOr [] = [] mkOr [x, y] = [text x <+> text "or" <+> text y] mkOr (x:xs) = text x : mkOr xs in nest 2 $ fsep $ punctuate comma (mkOr ss) ] interpret (Cmd_refine_or_intro pmLambda ii r s) = interpret $ let s' = trim s in (if null s' then Cmd_intro pmLambda else Cmd_refine) ii r s' interpret (Cmd_auto ii rng s) = do -- Andreas, 2014-07-05 Issue 1226: -- Save the state to have access to even those interaction ids -- that Auto solves (since Auto gives the solution right away). st <- lift $ get (res, msg) <- lift $ Auto.auto ii rng s case res of Left xs -> do lift $ reportSLn "auto" 10 $ "Auto produced the following solutions " ++ show xs forM_ xs $ \(ii, s) -> do -- Andreas, 2014-07-05 Issue 1226: -- For highlighting, Resp_GiveAction needs to access -- the @oldInteractionScope@s of the interaction points solved by Auto. -- We dig them out from the state before Auto was invoked. insertOldInteractionScope ii =<< lift (localState (put st >> getInteractionScope ii)) -- Andreas, 2014-07-07: NOT TRUE: -- -- Andreas, 2014-07-05: The following should be obsolete, -- -- as Auto has removed the interaction points already: -- modifyTheInteractionPoints $ filter (/= ii) putResponse $ Resp_GiveAction ii $ Give_String s -- Andreas, 2014-07-07: Remove the interaction points in one go. modifyTheInteractionPoints (\\ (map fst xs)) case msg of Nothing -> interpret Cmd_metas Just msg -> display_info $ Info_Auto msg Right (Left cs) -> do case msg of Nothing -> return () Just msg -> display_info $ Info_Auto msg putResponse $ Resp_MakeCase R.Function cs Right (Right s) -> give_gen ii rng s Refine interpret (Cmd_context norm ii _ _) = display_info . Info_Context =<< lift (prettyContext norm False ii) interpret (Cmd_helper_function norm ii rng s) = display_info . Info_HelperFunction =<< lift (cmd_helper_function norm ii rng s) interpret (Cmd_infer norm ii rng s) = display_info . Info_InferredType =<< lift (B.withInteractionId ii (prettyATop =<< B.typeInMeta ii norm =<< B.parseExprIn ii rng s)) interpret (Cmd_goal_type norm ii _ _) = display_info . Info_CurrentGoal =<< lift (B.withInteractionId ii $ prettyTypeOfMeta norm ii) interpret (Cmd_goal_type_context norm ii rng s) = cmd_goal_type_context_and empty norm ii rng s interpret (Cmd_goal_type_context_infer norm ii rng s) = do -- In case of the empty expression to type, don't fail with -- a stupid parse error, but just fall back to -- Cmd_goal_type_context. have <- if all Char.isSpace s then return empty else do typ <- lift $ B.withInteractionId ii $ prettyATop =<< B.typeInMeta ii norm =<< B.parseExprIn ii rng s return $ text "Have:" <+> typ cmd_goal_type_context_and have norm ii rng s interpret (Cmd_show_module_contents norm ii rng s) = liftCommandMT (B.withInteractionId ii) $ showModuleContents norm rng s interpret (Cmd_why_in_scope_toplevel s) = liftCommandMT B.atTopLevel $ whyInScope s interpret (Cmd_why_in_scope ii rng s) = liftCommandMT (B.withInteractionId ii) $ whyInScope s interpret (Cmd_make_case ii rng s) = do (casectxt , cs) <- lift $ makeCase ii rng s liftCommandMT (B.withInteractionId ii) $ do hidden <- lift $ showImplicitArguments pcs <- lift $ mapM prettyA $ List.map (extlam_dropLLifted casectxt hidden) cs putResponse $ Resp_MakeCase (makeCaseVariant casectxt) (List.map (extlam_dropName casectxt . render) pcs) where render = renderStyle (style { mode = OneLineMode }) makeCaseVariant :: CaseContext -> MakeCaseVariant makeCaseVariant Nothing = R.Function makeCaseVariant Just{} = R.ExtendedLambda -- very dirty hack, string manipulation by dropping the function name -- and replacing the last " = " with " -> ". It's important not to replace -- the equal sign in named implicit with an arrow! extlam_dropName :: CaseContext -> String -> String extlam_dropName Nothing x = x extlam_dropName Just{} x = unwords $ reverse $ replEquals $ reverse $ drop 1 $ words x where replEquals ("=" : ws) = "→" : ws replEquals (w : ws) = w : replEquals ws replEquals [] = [] -- Drops pattern added to extended lambda functions when lambda lifting them extlam_dropLLifted :: CaseContext -> Bool -> A.Clause -> A.Clause extlam_dropLLifted Nothing _ x = x extlam_dropLLifted (Just (ExtLamInfo h nh)) hidden (A.Clause (A.LHS info A.LHSProj{} ps) rhs decl) = __IMPOSSIBLE__ extlam_dropLLifted (Just (ExtLamInfo h nh)) hidden (A.Clause (A.LHS info (A.LHSHead name nps) ps) rhs decl) = let n = if hidden then h + nh else nh in (A.Clause (A.LHS info (A.LHSHead name (drop n nps)) ps) rhs decl) interpret (Cmd_compute ignore ii rng s) = do e <- lift $ B.parseExprIn ii rng s d <- lift $ B.withInteractionId ii $ do let c = B.evalInCurrent e v <- if ignore then ignoreAbstractMode c else c prettyATop v display_info $ Info_NormalForm d interpret Cmd_show_version = display_info Info_Version -- | Print open metas nicely. showOpenMetas :: TCM [String] showOpenMetas = do ims <- B.typesOfVisibleMetas B.AsIs di <- forM ims $ \ i -> B.withInteractionId (B.outputFormId $ B.OutputForm noRange 0 i) $ showATop i -- Show unsolved implicit arguments simplified. dh <- mapM showA' =<< B.typesOfHiddenMetas B.Simplified return $ di ++ dh where metaId (B.OfType i _) = i metaId (B.JustType i) = i metaId (B.JustSort i) = i metaId (B.Assign i e) = i metaId _ = __IMPOSSIBLE__ showA' :: B.OutputConstraint A.Expr NamedMeta -> TCM String showA' m = do let i = nmid $ metaId m r <- getMetaRange i d <- B.withMetaId i (showATop m) return $ d ++ " [ at " ++ show r ++ " ]" -- | @cmd_load' file includes unsolvedOk cmd@ -- loads the module in file @file@, -- using @includes@ as the include directories. -- -- If type checking completes without any exceptions having been -- encountered then the command @cmd r@ is executed, where @r@ is the -- result of 'Imp.typeCheckMain'. cmd_load' :: FilePath -> [FilePath] -> Bool -- ^ Allow unsolved meta-variables? -> ((Interface, Imp.MaybeWarnings) -> CommandM ()) -> CommandM () cmd_load' file includes unsolvedOK cmd = do f <- liftIO $ absolute file ex <- liftIO $ doesFileExist $ filePath f lift $ TM.setIncludeDirs includes $ if ex then ProjectRoot f else CurrentDir -- Forget the previous "current file" and interaction points. modify $ \st -> st { theInteractionPoints = [] , theCurrentFile = Nothing } t <- liftIO $ getModificationTime file -- All options are reset when a file is reloaded, including the -- choice of whether or not to display implicit arguments. (At -- this point the include directories have already been set, so -- they are preserved.) opts <- lift $ commandLineOptions defaultOptions <- gets optionsOnReload setCommandLineOptions' $ Lenses.setIncludeDirs (optIncludeDirs opts) $ mapPragmaOptions (\ o -> o { optAllowUnsolved = unsolvedOK }) $ defaultOptions -- Reset the state, preserving options and decoded modules. Note -- that if the include directories have changed, then the decoded -- modules are reset when cmd_load' is run by ioTCM. lift resetState -- Clear the info buffer to make room for information about which -- module is currently being type-checked. putResponse Resp_ClearRunningInfo -- Remove any prior syntax highlighting. putResponse Resp_ClearHighlighting ok <- lift $ Imp.typeCheckMain f -- The module type checked. If the file was not changed while the -- type checker was running then the interaction points and the -- "current file" are stored. t' <- liftIO $ getModificationTime file when (t == t') $ do is <- lift $ sortInteractionPoints =<< getInteractionPoints modify $ \st -> st { theInteractionPoints = is , theCurrentFile = Just (f, t) } cmd ok -- | Set 'envCurrentPath' to 'theCurrentFile', if any. withCurrentFile :: CommandM a -> CommandM a withCurrentFile m = do mfile <- fmap fst <$> gets theCurrentFile local (\ e -> e { envCurrentPath = mfile }) m -- | Available backends. data Backend = MAlonzo | MAlonzoNoMain | Epic | JS deriving (Show, Read) data GiveRefine = Give | Refine deriving (Eq, Show) -- | A "give"-like action (give, refine, etc). -- -- @give_gen ii rng s give_ref mk_newtxt@ -- acts on interaction point @ii@ -- occupying range @rng@, -- placing the new content given by string @s@, -- and replacing @ii@ by the newly created interaction points -- in the state. give_gen :: InteractionId -> Range -> String -> GiveRefine -> CommandM () give_gen ii rng s0 giveRefine = do let s = trim s0 lift $ reportSLn "interaction.give" 20 $ "give_gen " ++ s -- Andreas, 2015-02-26 if string is empty do nothing rather -- than giving a parse error. unless (null s) $ do let give_ref = case giveRefine of Give -> B.give Refine -> B.refine -- save scope of the interaction point (for printing the given expr. later) scope <- lift $ getInteractionScope ii -- parse string and "give", obtaining an abstract expression -- and newly created interaction points (ae, iis) <- lift $ do mis <- getInteractionPoints reportSLn "interaction.give" 30 $ "interaction points before = " ++ show mis ae <- give_ref ii Nothing =<< B.parseExprIn ii rng s mis' <- getInteractionPoints reportSLn "interaction.give" 30 $ "interaction points after = " ++ show mis' return (ae, mis' \\ mis) -- favonia: backup the old scope for highlighting insertOldInteractionScope ii scope -- sort the new interaction points and put them into the state -- in replacement of the old interaction point iis <- lift $ sortInteractionPoints iis modifyTheInteractionPoints $ replace ii iis -- print abstract expr ce <- lift $ abstractToConcreteEnv (makeEnv scope) ae lift $ reportSLn "interaction.give" 30 $ "ce = " ++ show ce -- if the command was @Give@, use the literal user input; -- Andreas, 2014-01-15, see issue 1020: -- Refine could solve a goal by introducing the sole constructor -- without arguments. Then there are no interaction metas, but -- we still cannot just `give' the user string (which may be empty). -- WRONG: also, if no interaction metas were created by @Refine@ -- WRONG: let literally = (giveRefine == Give || null iis) && rng /= noRange let literally = giveRefine == Give && rng /= noRange -- Ulf, 2014-01-24: This works for give since we're highlighting the string -- that's already in the buffer. Doing it before the give action means that -- the highlighting is moved together with the text when the hole goes away. -- To make it work for refine we'd have to adjust the ranges. when literally $ lift $ do printHighlightingInfo =<< generateTokenInfoFromString rng s highlightExpr ae putResponse $ Resp_GiveAction ii $ mkNewTxt literally ce lift $ reportSLn "interaction.give" 30 $ "putResponse GiveAction passed" -- display new goal set interpret Cmd_metas lift $ reportSLn "interaction.give" 30 $ "interpret Cmd_metas passed" where -- Substitutes xs for x in ys. replace x xs ys = concatMap (\ y -> if y == x then xs else [y]) ys -- For @Give@ we can replace the ii by the user given input. mkNewTxt True C.Paren{} = Give_Paren mkNewTxt True _ = Give_NoParen -- Otherwise, we replace it by the reified value Agda computed. mkNewTxt False ce = Give_String $ show ce highlightExpr :: A.Expr -> TCM () highlightExpr e = local (\e -> e { envModuleNestingLevel = 0 , envHighlightingLevel = NonInteractive , envHighlightingMethod = Direct }) $ generateAndPrintSyntaxInfo decl Full where dummy = mkName_ (NameId 0 0) "dummy" info = mkDefInfo (nameConcrete dummy) defaultFixity' PublicAccess ConcreteDef (getRange e) decl = A.Axiom NoFunSig info defaultArgInfo (qnameFromList [dummy]) e -- | Sorts interaction points based on their ranges. sortInteractionPoints :: [InteractionId] -> TCM [InteractionId] sortInteractionPoints is = map fst . sortBy (compare `on` snd) <$> do forM is $ \ i -> do (i,) <$> getInteractionRange i -- | Pretty-prints the type of the meta-variable. prettyTypeOfMeta :: B.Rewrite -> InteractionId -> TCM Doc prettyTypeOfMeta norm ii = do form <- B.typeOfMeta norm ii case form of B.OfType _ e -> prettyATop e _ -> text <$> showATop form -- | Pretty-prints the context of the given meta-variable. prettyContext :: B.Rewrite -- ^ Normalise? -> Bool -- ^ Print the elements in reverse order? -> InteractionId -> TCM Doc prettyContext norm rev ii = B.withInteractionId ii $ do ctx <- B.contextOfMeta ii norm es <- mapM (prettyATop . B.ofExpr) ctx ns <- mapM (showATop . B.ofName) ctx let shuffle = if rev then reverse else id return $ align 10 $ filter (not . null. fst) $ shuffle $ zip ns (map (text ":" <+>) es) -- | Create type of application of new helper function that would solve the goal. cmd_helper_function :: B.Rewrite -> InteractionId -> Range -> String -> TCM Doc cmd_helper_function norm ii r s = B.withInteractionId ii $ inTopContext $ prettyATop =<< B.metaHelperType norm ii r s -- | Displays the current goal, the given document, and the current -- context. cmd_goal_type_context_and :: Doc -> B.Rewrite -> InteractionId -> Range -> String -> StateT CommandState (TCMT IO) () cmd_goal_type_context_and doc norm ii _ _ = do goal <- lift $ B.withInteractionId ii $ prettyTypeOfMeta norm ii ctx <- lift $ prettyContext norm True ii display_info $ Info_GoalType (text "Goal:" <+> goal $+$ doc $+$ text (replicate 60 '\x2014') $+$ ctx) -- | Shows all the top-level names in the given module, along with -- their types. showModuleContents :: B.Rewrite -> Range -> String -> CommandM () showModuleContents norm rng s = do (modules, types) <- lift $ B.moduleContents norm rng s types' <- lift $ forM types $ \ (x, t) -> do t <- TCP.prettyTCM t return (show x, text ":" <+> t) display_info $ Info_ModuleContents $ text "Modules" $$ nest 2 (vcat $ map (text . show) modules) $$ text "Names" $$ nest 2 (align 10 types') -- | Explain why something is in scope. whyInScope :: String -> CommandM () whyInScope s = do (v, xs, ms) <- lift $ B.whyInScope s cwd <- do Just (file, _) <- gets $ theCurrentFile return $ takeDirectory $ filePath file display_info . Info_WhyInScope =<< do lift $ explanation cwd v xs ms where explanation _ Nothing [] [] = TCP.text (s ++ " is not in scope.") explanation cwd v xs ms = TCP.vcat [ TCP.text (s ++ " is in scope as") , TCP.nest 2 $ TCP.vcat [variable v xs, modules ms] ] where prettyRange :: Range -> TCM Doc prettyRange r = text . show . (fmap . fmap) mkRel <$> do return r mkRel = Str . makeRelative cwd . filePath -- variable :: Maybe _ -> [_] -> TCM Doc variable Nothing xs = names xs variable (Just x) xs | null xs = asVar | otherwise = TCP.vcat [ TCP.sep [ asVar, TCP.nest 2 $ shadowing x] , TCP.nest 2 $ names xs ] where asVar :: TCM Doc asVar = do TCP.text "* a variable bound at" TCP.<+> TCP.prettyTCM (nameBindingSite $ localVar x) shadowing :: LocalVar -> TCM Doc shadowing LocalVar{} = TCP.text "shadowing" shadowing ShadowedVar{} = TCP.text "in conflict with" names xs = TCP.vcat $ map pName xs modules ms = TCP.vcat $ map pMod ms pKind DefName = TCP.text "defined name" pKind ConName = TCP.text "constructor" pKind FldName = TCP.text "record field" pKind PatternSynName = TCP.text "pattern synonym" pKind QuotableName = TCP.text "quotable name" pName :: AbstractName -> TCM Doc pName a = TCP.sep [ TCP.text "* a" TCP.<+> pKind (anameKind a) TCP.<+> TCP.text (prettyShow $ anameName a) , TCP.nest 2 $ TCP.text "brought into scope by" ] TCP.$$ TCP.nest 2 (pWhy (nameBindingSite $ qnameName $ anameName a) (anameLineage a)) pMod :: AbstractModule -> TCM Doc pMod a = TCP.sep [ TCP.text "* a module" TCP.<+> TCP.text (prettyShow $ amodName a) , TCP.nest 2 $ TCP.text "brought into scope by" ] TCP.$$ TCP.nest 2 (pWhy (nameBindingSite $ qnameName $ mnameToQName $ amodName a) (amodLineage a)) pWhy :: Range -> WhyInScope -> TCM Doc pWhy r Defined = TCP.text "- its definition at" TCP.<+> TCP.prettyTCM r pWhy r (Opened (C.QName x) w) | isNoName x = pWhy r w pWhy r (Opened m w) = TCP.text "- the opening of" TCP.<+> TCP.text (show m) TCP.<+> TCP.text "at" TCP.<+> TCP.prettyTCM (getRange m) TCP.$$ pWhy r w pWhy r (Applied m w) = TCP.text "- the application of" TCP.<+> TCP.text (show m) TCP.<+> TCP.text "at" TCP.<+> TCP.prettyTCM (getRange m) TCP.$$ pWhy r w -- | Sets the command line options and updates the status information. setCommandLineOptions' :: CommandLineOptions -> CommandM () setCommandLineOptions' opts = do lift $ TM.setCommandLineOptions opts displayStatus -- | Computes some status information. status :: CommandM Status status = do cf <- gets theCurrentFile showImpl <- lift showImplicitArguments -- Check if the file was successfully type checked, and has not -- changed since. Note: This code does not check if any dependencies -- have changed, and uses a time stamp to check for changes. checked <- lift $ case cf of Nothing -> return False Just (f, t) -> do t' <- liftIO $ getModificationTime $ filePath f case t == t' of False -> return False True -> do mm <- Map.lookup f <$> sourceToModule case mm of Nothing -> return False -- work-around for Issue1007 Just m -> not . miWarnings . fromMaybe __IMPOSSIBLE__ <$> getVisitedModule m return $ Status { sShowImplicitArguments = showImpl , sChecked = checked } -- | Displays\/updates status information. displayStatus :: CommandM () displayStatus = putResponse . Resp_Status =<< status -- | @display_info@ does what @'display_info'' False@ does, but -- additionally displays some status information (see 'status' and -- 'displayStatus'). display_info :: DisplayInfo -> CommandM () display_info info = do displayStatus putResponse $ Resp_DisplayInfo info -- UNUSED -- takenNameStr :: TCM [String] -- takenNameStr = do -- xss <- sequence [ List.map (fst . unDom) <$> getContext -- , Map.keys <$> asks envLetBindings -- , List.map qnameName . HMap.keys . sigDefinitions <$> getSignature -- ] -- return $ concat [ parts $ nameConcrete x | x <- concat xss] -- where -- parts x = [ s | Id s <- nameParts x ] refreshStr :: [String] -> String -> ([String], String) refreshStr taken s = go nameModifiers where go (m:mods) = let s' = s ++ m in if s' `elem` taken then go mods else (s':taken, s') go _ = __IMPOSSIBLE__ nameModifiers :: [String] nameModifiers = "" : "'" : "''" : [show i | i <-[3..]] -- | Kill meta numbers and ranges from all metas (@?@ and @_@). lowerMeta :: (C.ExprLike a) => a -> a lowerMeta = C.mapExpr kill where kill e = case e of C.QuestionMark{} -> preMeta C.Underscore{} -> preUscore C.App{} -> case appView e of C.AppView (C.QuestionMark _ _) _ -> preMeta C.AppView (C.Underscore _ _) _ -> preUscore _ -> e C.Paren r q@(C.QuestionMark _ Nothing) -> q _ -> e preMeta = C.QuestionMark noRange Nothing preUscore = C.Underscore noRange Nothing -- | Parses and scope checks an expression (using the \"inside scope\" -- as the scope), performs the given command with the expression as -- input, and displays the result. parseAndDoAtToplevel :: (A.Expr -> TCM A.Expr) -- ^ The command to perform. -> (Doc -> DisplayInfo) -- ^ The name to use for the buffer displaying the output. -> String -- ^ The expression to parse. -> CommandM () parseAndDoAtToplevel cmd title s = do e <- liftIO $ parse exprParser s doTime <- lift $ hasVerbosity "profile.interactive" 10 let work = lift (B.atTopLevel $ prettyA =<< cmd =<< concreteToAbstract_ e) res <- if not doTime then work else do (r, time) <- measureTime work return $ text "Time:" <+> pretty time $$ r display_info (title res) -- | Tell to highlight the code using the given highlighting -- info (unless it is @Nothing@). tellToUpdateHighlighting :: Maybe (HighlightingInfo, ModuleToSource) -> IO [Response] tellToUpdateHighlighting Nothing = return [] tellToUpdateHighlighting (Just (info, modFile)) = return [Resp_HighlightingInfo info modFile] -- | Tells the Emacs mode to go to the first error position (if any). tellEmacsToJumpToError :: Range -> [Response] tellEmacsToJumpToError r = case rStart r of Nothing -> [] Just (Pn { srcFile = Nothing }) -> [] Just (Pn { srcFile = Just f, posPos = p }) -> [ Resp_JumpToError (filePath f) p ] Agda-2.4.2.5/src/full/Agda/Interaction/Imports.hs0000644000000000000000000007142512635075266017566 0ustar0000000000000000{-# LANGUAGE CPP #-} {-# LANGUAGE TupleSections #-} #if __GLASGOW_HASKELL__ >= 710 {-# LANGUAGE FlexibleContexts #-} #endif {-| This module deals with finding imported modules and loading their interface files. -} module Agda.Interaction.Imports where import Prelude hiding (null) import Control.Arrow import Control.DeepSeq import Control.Monad.Reader import Control.Monad.State import qualified Control.Exception as E import Data.Function (on) import qualified Data.Map as Map import qualified Data.List as List import qualified Data.Set as Set import qualified Data.Foldable as Fold (toList) import Data.List hiding (null) import Data.Maybe import Data.Monoid (mempty, mappend) import Data.Map (Map) import Data.Set (Set) import System.Directory (doesFileExist, getModificationTime, removeFile) import System.FilePath (()) import qualified Text.PrettyPrint.Boxes as Boxes import Agda.Benchmarking import qualified Agda.Syntax.Abstract as A import qualified Agda.Syntax.Concrete as C import Agda.Syntax.Abstract.Name import Agda.Syntax.Parser import Agda.Syntax.Position import Agda.Syntax.Scope.Base import Agda.Syntax.Translation.ConcreteToAbstract import Agda.Syntax.Internal import Agda.TypeChecking.Errors import Agda.TypeChecking.Reduce import Agda.TypeChecking.Monad import Agda.TypeChecking.Serialise import Agda.TypeChecking.Telescope import Agda.TypeChecking.Primitive import qualified Agda.TypeChecking.Monad.Benchmark as Bench import Agda.TheTypeChecker import Agda.Interaction.FindFile import {-# SOURCE #-} Agda.Interaction.InteractionTop (showOpenMetas) import Agda.Interaction.Options import qualified Agda.Interaction.Options.Lenses as Lens import Agda.Interaction.Highlighting.Precise (HighlightingInfo) import Agda.Interaction.Highlighting.Generate import Agda.Interaction.Highlighting.Vim import Agda.Utils.Except ( MonadError(catchError, throwError) ) import Agda.Utils.FileName import Agda.Utils.Lens import Agda.Utils.Monad import Agda.Utils.Null import Agda.Utils.IO.Binary import Agda.Utils.Pretty import Agda.Utils.Time import Agda.Utils.Hash import qualified Agda.Utils.Trie as Trie #include "undefined.h" import Agda.Utils.Impossible -- | Are we loading the interface for the user-loaded file -- or for an import? data MainInterface = MainInterface -- ^ Interface for main file. | NotMainInterface -- ^ Interface for imported file. deriving (Eq, Show) -- | Merge an interface into the current proof state. mergeInterface :: Interface -> TCM () mergeInterface i = do let sig = iSignature i builtin = Map.toList $ iBuiltin i prim = [ x | (_,Prim x) <- builtin ] bi = Map.fromList [ (x,Builtin t) | (x,Builtin t) <- builtin ] bs <- gets stBuiltinThings reportSLn "import.iface.merge" 10 $ "Merging interface" reportSLn "import.iface.merge" 20 $ " Current builtins " ++ show (Map.keys bs) ++ "\n" ++ " New builtins " ++ show (Map.keys bi) let check b = case (b1, b2) of (Builtin x, Builtin y) | x == y -> return () | otherwise -> typeError $ DuplicateBuiltinBinding b x y _ -> __IMPOSSIBLE__ where Just b1 = Map.lookup b bs Just b2 = Map.lookup b bi mapM_ check (map fst $ Map.toList $ Map.intersection bs bi) addImportedThings sig bi (iHaskellImports i) (iPatternSyns i) reportSLn "import.iface.merge" 20 $ " Rebinding primitives " ++ show prim prim <- Map.fromList <$> mapM rebind prim stImportedBuiltins %= (`Map.union` prim) where rebind (x, q) = do PrimImpl _ pf <- lookupPrimitiveFunction x return (x, Prim $ pf { primFunName = q }) addImportedThings :: Signature -> BuiltinThings PrimFun -> Set String -> A.PatternSynDefns -> TCM () addImportedThings isig ibuiltin hsImports patsyns = do stImports %= \imp -> unionSignatures [imp, isig] stImportedBuiltins %= \imp -> Map.union imp ibuiltin stHaskellImports %= \imp -> Set.union imp hsImports stPatternSynImports %= \imp -> Map.union imp patsyns addSignatureInstances isig -- | Scope checks the given module. A proper version of the module -- name (with correct definition sites) is returned. scopeCheckImport :: ModuleName -> TCM (ModuleName, Map ModuleName Scope) scopeCheckImport x = do reportSLn "import.scope" 5 $ "Scope checking " ++ prettyShow x verboseS "import.scope" 10 $ do visited <- Map.keys <$> getVisitedModules reportSLn "import.scope" 10 $ " visited: " ++ intercalate ", " (map prettyShow visited) -- Since scopeCheckImport is called from the scope checker, -- we need to reimburse her account. i <- Bench.billTo [] $ getInterface x addImport x -- let s = publicModules $ iInsideScope i let s = iScope i return (iModuleName i `withRangesOfQ` mnameToConcrete x, s) data MaybeWarnings = NoWarnings | SomeWarnings Warnings hasWarnings :: MaybeWarnings -> Bool hasWarnings NoWarnings = False hasWarnings SomeWarnings{} = True -- | If the module has already been visited (without warnings), then -- its interface is returned directly. Otherwise the computation is -- used to find the interface and the computed interface is stored for -- potential later use. alreadyVisited :: C.TopLevelModuleName -> TCM (Interface, MaybeWarnings) -> TCM (Interface, MaybeWarnings) alreadyVisited x getIface = do mm <- getVisitedModule x case mm of -- A module with warnings should never be allowed to be -- imported from another module. Just mi | not (miWarnings mi) -> do reportSLn "import.visit" 10 $ " Already visited " ++ prettyShow x return (miInterface mi, NoWarnings) _ -> do reportSLn "import.visit" 5 $ " Getting interface for " ++ prettyShow x r@(i, wt) <- getIface reportSLn "import.visit" 5 $ " Now we've looked at " ++ prettyShow x visitModule $ ModuleInfo { miInterface = i , miWarnings = hasWarnings wt } return r -- | Type checks the main file of the interaction. -- This could be the file loaded in the interacting editor (emacs), -- or the file passed on the command line. -- -- First, the primitive modules are imported. -- Then, @getInterface'@ is called to do the main work. typeCheckMain :: AbsolutePath -> TCM (Interface, MaybeWarnings) typeCheckMain f = do -- liftIO $ putStrLn $ "This is typeCheckMain " ++ prettyShow f -- liftIO . putStrLn . show =<< getVerbosity reportSLn "import.main" 10 $ "Importing the primitive modules." libdir <- liftIO defaultLibDir reportSLn "import.main" 20 $ "Library dir = " ++ show libdir -- To allow posulating the built-ins, check the primitive module -- in unsafe mode _ <- bracket_ (gets $ Lens.getSafeMode) Lens.putSafeMode $ do Lens.putSafeMode False -- Turn off import-chasing messages. -- We have to modify the persistent verbosity setting, since -- getInterface resets the current verbosity settings to the persistent ones. bracket_ (gets $ Lens.getPersistentVerbosity) Lens.putPersistentVerbosity $ do Lens.modifyPersistentVerbosity (Trie.delete []) -- set root verbosity to 0 -- We don't want to generate highlighting information for Agda.Primitive. withHighlightingLevel None $ getInterface_ =<< do moduleName $ mkAbsolute $ libdir "prim" "Agda" "Primitive.agda" reportSLn "import.main" 10 $ "Done importing the primitive modules." -- Now do the type checking via getInterface. m <- moduleName f getInterface' m MainInterface -- | Tries to return the interface associated to the given (imported) module. -- The time stamp of the relevant interface file is also returned. -- Calls itself recursively for the imports of the given module. -- May type check the module. -- An error is raised if a warning is encountered. -- -- Do not use this for the main file, use 'typeCheckMain' instead. getInterface :: ModuleName -> TCM Interface getInterface = getInterface_ . toTopLevelModuleName -- | See 'getInterface'. getInterface_ :: C.TopLevelModuleName -> TCM Interface getInterface_ x = do (i, wt) <- getInterface' x NotMainInterface case wt of SomeWarnings w -> warningsToError w NoWarnings -> return i -- | A more precise variant of 'getInterface'. If warnings are -- encountered then they are returned instead of being turned into -- errors. getInterface' :: C.TopLevelModuleName -> MainInterface -- ^ If type checking is necessary, -- should all state changes inflicted by 'createInterface' be preserved? -> TCM (Interface, MaybeWarnings) getInterface' x isMain = do withIncreasedModuleNestingLevel $ do -- Preserve the pragma options unless includeStateChanges is True. bracket_ (use stPragmaOptions) (unless includeStateChanges . setPragmaOptions) $ do -- Forget the pragma options (locally). setCommandLineOptions . stPersistentOptions . stPersistentState =<< get alreadyVisited x $ addImportCycleCheck x $ do file <- findFile x -- requires source to exist reportSLn "import.iface" 10 $ " Check for cycle" checkForImportCycle uptodate <- Bench.billTo [Bench.Import] $ do ignore <- ignoreInterfaces cached <- isCached file -- if it's cached ignoreInterfaces has no effect -- to avoid typechecking a file more than once sourceH <- liftIO $ hashFile file ifaceH <- case cached of Nothing -> fmap fst <$> getInterfaceFileHashes (filePath $ toIFile file) Just i -> return $ Just $ iSourceHash i let unchanged = Just sourceH == ifaceH return $ unchanged && (not ignore || isJust cached) reportSLn "import.iface" 5 $ " " ++ prettyShow x ++ " is " ++ (if uptodate then "" else "not ") ++ "up-to-date." (stateChangesIncluded, (i, wt)) <- do -- -- Andreas, 2014-10-20 AIM XX: -- -- Always retype-check the main file to get the iInsideScope -- -- which is no longer serialized. -- let maySkip = isMain == NotMainInterface -- Andreas, 2015-07-13: Serialize iInsideScope again. let maySkip = True if uptodate && maySkip then skip file else typeCheckThe file -- Ensure that the given module name matches the one in the file. let topLevelName = toTopLevelModuleName $ iModuleName i unless (topLevelName == x) $ do -- Andreas, 2014-03-27 This check is now done in the scope checker. -- checkModuleName topLevelName file typeError $ OverlappingProjects file topLevelName x visited <- isVisited x reportSLn "import.iface" 5 $ if visited then " We've been here. Don't merge." else " New module. Let's check it out." unless (visited || stateChangesIncluded) $ do mergeInterface i Bench.billTo [Bench.Highlighting] $ ifTopLevelAndHighlightingLevelIs NonInteractive $ highlightFromInterface i file stCurrentModule .= Just (iModuleName i) -- Interfaces are only stored if no warnings were encountered. case wt of SomeWarnings w -> return () NoWarnings -> storeDecodedModule i return (i, wt) where includeStateChanges = isMain == MainInterface isCached file = do let ifile = filePath $ toIFile file exist <- liftIO $ doesFileExistCaseSensitive ifile if not exist then return Nothing else do h <- fmap snd <$> getInterfaceFileHashes ifile mm <- getDecodedModule x return $ case mm of Just mi | Just (iFullHash mi) == h -> Just mi _ -> Nothing -- Formats the "Checking", "Finished" and "Skipping" messages. chaseMsg kind file = do nesting <- envModuleNestingLevel <$> ask let s = genericReplicate nesting ' ' ++ kind ++ " " ++ prettyShow x ++ case file of Nothing -> "." Just f -> " (" ++ f ++ ")." reportSLn "import.chase" 1 s skip file = do -- Examine the hash of the interface file. If it is different from the -- stored version (in stDecodedModules), or if there is no stored version, -- read and decode it. Otherwise use the stored version. let ifile = filePath $ toIFile file h <- fmap snd <$> getInterfaceFileHashes ifile mm <- getDecodedModule x (cached, mi) <- Bench.billTo [Bench.Deserialization] $ case mm of Just mi -> if Just (iFullHash mi) /= h then do dropDecodedModule x reportSLn "import.iface" 50 $ " cached hash = " ++ show (iFullHash mi) reportSLn "import.iface" 50 $ " stored hash = " ++ show h reportSLn "import.iface" 5 $ " file is newer, re-reading " ++ ifile (False,) <$> readInterface ifile else do reportSLn "import.iface" 5 $ " using stored version of " ++ ifile return (True, Just mi) Nothing -> do reportSLn "import.iface" 5 $ " no stored version, reading " ++ ifile (False,) <$> readInterface ifile -- Check that it's the right version case mi of Nothing -> do reportSLn "import.iface" 5 $ " bad interface, re-type checking" typeCheckThe file Just i -> do reportSLn "import.iface" 5 $ " imports: " ++ show (iImportedModules i) hs <- map iFullHash <$> mapM getInterface (map fst $ iImportedModules i) -- If any of the imports are newer we need to retype check if hs /= map snd (iImportedModules i) then do -- liftIO close -- Close the interface file. See above. typeCheckThe file else do unless cached $ chaseMsg "Skipping" (Just ifile) -- We set the pragma options of the skipped file here, -- because if the top-level file is skipped we want the -- pragmas to apply to interactive commands in the UI. mapM_ setOptionsFromPragma (iPragmaOptions i) return (False, (i, NoWarnings)) typeCheckThe file = do let withMsgs = bracket_ (chaseMsg "Checking" $ Just $ filePath file) (const $ chaseMsg "Finished" Nothing) -- Do the type checking. if includeStateChanges then do r <- withMsgs $ createInterface file x -- Merge the signature with the signature for imported -- things. sig <- getSignature patsyns <- getPatternSyns addImportedThings sig Map.empty Set.empty patsyns setSignature emptySignature setPatternSyns Map.empty return (True, r) else do ms <- getImportPath nesting <- asks envModuleNestingLevel range <- asks envRange call <- asks envCall mf <- use stModuleToSource vs <- getVisitedModules ds <- getDecodedModules opts <- stPersistentOptions . stPersistentState <$> get isig <- getImportedSignature ibuiltin <- use stImportedBuiltins ipatsyns <- getPatternSynImports ho <- getInteractionOutputCallback -- Every interface is treated in isolation. Note: Changes -- to stDecodedModules are not preserved if an error is -- encountered in an imported module. -- Andreas, 2014-03-23: freshTCM spawns a new TCM computation -- with initial state and environment -- but on the same Benchmark accounts. r <- freshTCM $ withImportPath ms $ local (\e -> e { envModuleNestingLevel = nesting -- Andreas, 2014-08-18: -- Preserve the range of import statement -- for reporting termination errors in -- imported modules: , envRange = range , envCall = call }) $ do setDecodedModules ds setCommandLineOptions opts setInteractionOutputCallback ho stModuleToSource .= mf setVisitedModules vs addImportedThings isig ibuiltin Set.empty ipatsyns r <- withMsgs $ createInterface file x mf <- use stModuleToSource ds <- getDecodedModules return (r, do stModuleToSource .= mf setDecodedModules ds case r of (i, NoWarnings) -> storeDecodedModule i _ -> return () ) case r of Left err -> throwError err Right (r, update) -> do update case r of (_, NoWarnings) -> -- We skip the file which has just been type-checked to -- be able to forget some of the local state from -- checking the module. -- Note that this doesn't actually read the interface -- file, only the cached interface. skip file _ -> return (False, r) -- | Print the highlighting information contained in the given -- interface. highlightFromInterface :: Interface -> AbsolutePath -- ^ The corresponding file. -> TCM () highlightFromInterface i file = do reportSLn "import.iface" 5 $ "Generating syntax info for " ++ filePath file ++ " (read from interface)." printHighlightingInfo (iHighlighting i) readInterface :: FilePath -> TCM (Maybe Interface) readInterface file = do -- Decode the interface file (s, close) <- liftIO $ readBinaryFile' file do mi <- liftIO . E.evaluate =<< decodeInterface s -- Close the file. Note -- ⑴ that evaluate ensures that i is evaluated to WHNF (before -- the next IO operation is executed), and -- ⑵ that decode returns Nothing if an error is encountered, -- so it is safe to close the file here. liftIO close return $ constructIScope <$> mi -- Catch exceptions and close `catchError` \e -> liftIO close >> handler e -- Catch exceptions `catchError` handler where handler e = case e of IOException _ e -> do reportSLn "" 0 $ "IO exception: " ++ show e return Nothing -- Work-around for file locking bug. -- TODO: What does this refer to? Please -- document. _ -> throwError e -- | Writes the given interface to the given file. Returns the file's -- new modification time stamp, or 'Nothing' if the write failed. writeInterface :: FilePath -> Interface -> TCM () writeInterface file i = do reportSLn "import.iface.write" 5 $ "Writing interface file " ++ file ++ "." -- Andreas, 2015-07-13 -- After QName memoization (AIM XXI), scope serialization might be cheap enough. -- -- Andreas, Makoto, 2014-10-18 AIM XX: -- -- iInsideScope is bloating the interface files, so we do not serialize it? -- i <- return $ -- i { iInsideScope = emptyScopeInfo -- } i <- return $ i { iInsideScope = removePrivates $ iInsideScope i } encodeFile file i reportSLn "import.iface.write" 5 $ "Wrote interface file." reportSLn "import.iface.write" 50 $ " hash = " ++ show (iFullHash i) ++ "" `catchError` \e -> do reportSLn "" 1 $ "Failed to write interface " ++ file ++ "." liftIO $ whenM (doesFileExist file) $ removeFile file throwError e removePrivates :: ScopeInfo -> ScopeInfo removePrivates si = si { scopeModules = restrictPrivate <$> scopeModules si } -- | Tries to type check a module and write out its interface. The -- function only writes out an interface file if it does not encounter -- any warnings. -- -- If appropriate this function writes out syntax highlighting -- information. createInterface :: AbsolutePath -- ^ The file to type check. -> C.TopLevelModuleName -- ^ The expected module name. -> TCM (Interface, MaybeWarnings) createInterface file mname = local (\e -> e { envCurrentPath = Just file }) $ do modFile <- use stModuleToSource fileTokenInfo <- Bench.billTo [Bench.Highlighting] $ generateTokenInfo file stTokens .= fileTokenInfo reportSLn "import.iface.create" 5 $ "Creating interface for " ++ prettyShow mname ++ "." verboseS "import.iface.create" 10 $ do visited <- Map.keys <$> getVisitedModules reportSLn "import.iface.create" 10 $ " visited: " ++ intercalate ", " (map prettyShow visited) previousHsImports <- getHaskellImports -- Parsing. (pragmas, top) <- Bench.billTo [Bench.Parsing] $ liftIO $ parseFile' moduleParser file pragmas <- concat <$> concreteToAbstract_ pragmas -- identity for top-level pragmas at the moment let getOptions (A.OptionsPragma opts) = Just opts getOptions _ = Nothing options = catMaybes $ map getOptions pragmas mapM_ setOptionsFromPragma options -- Scope checking. reportSLn "import.iface.create" 7 $ "Starting scope checking." topLevel <- Bench.billTo [Bench.Scoping] $ concreteToAbstract_ (TopLevel file top) reportSLn "import.iface.create" 7 $ "Finished scope checking." let ds = topLevelDecls topLevel -- Highlighting from scope checker. reportSLn "import.iface.create" 7 $ "Starting highlighting from scope." Bench.billTo [Bench.Highlighting] $ do ifTopLevelAndHighlightingLevelIs NonInteractive $ do -- Generate and print approximate syntax highlighting info. printHighlightingInfo fileTokenInfo mapM_ (\ d -> generateAndPrintSyntaxInfo d Partial) ds reportSLn "import.iface.create" 7 $ "Finished highlighting from scope." -- Type checking. reportSLn "import.iface.create" 7 $ "Starting type checking." Bench.billTo [Bench.Typing] $ checkDecls ds reportSLn "import.iface.create" 7 $ "Finished type checking." -- Ulf, 2013-11-09: Since we're rethrowing the error, leave it up to the -- code that handles that error to reset the state. -- Ulf, 2013-11-13: Errors are now caught and highlighted in InteractionTop. -- catchError_ (checkDecls ds) $ \e -> do -- ifTopLevelAndHighlightingLevelIs NonInteractive $ -- printErrorInfo e -- throwError e unfreezeMetas -- Profiling: Count number of metas. verboseS "profile.metas" 10 $ do MetaId n <- fresh tickN "metas" (fromIntegral n) -- Highlighting from type checker. reportSLn "import.iface.create" 7 $ "Starting highlighting from type info." Bench.billTo [Bench.Highlighting] $ do -- Move any remaining token highlighting to stSyntaxInfo. toks <- use stTokens ifTopLevelAndHighlightingLevelIs NonInteractive $ printHighlightingInfo toks stTokens .= mempty stSyntaxInfo %= \inf -> inf `mappend` toks whenM (optGenerateVimFile <$> commandLineOptions) $ -- Generate Vim file. withScope_ (insideScope topLevel) $ generateVimFile $ filePath file reportSLn "import.iface.create" 7 $ "Finished highlighting from type info." setScope $ outsideScope topLevel reportSLn "scope.top" 50 $ "SCOPE " ++ show (insideScope topLevel) -- Serialization. reportSLn "import.iface.create" 7 $ "Starting serialization." syntaxInfo <- use stSyntaxInfo i <- Bench.billTo [Bench.Serialization] $ do buildInterface file topLevel syntaxInfo previousHsImports options reportSLn "import.iface.create" 7 $ "Finished serialization." -- TODO: It would be nice if unsolved things were highlighted -- after every mutual block. openMetas <- getOpenMetas unless (null openMetas) $ do reportSLn "import.metas" 10 . unlines =<< showOpenMetas unsolvedMetas <- List.nub <$> mapM getMetaRange openMetas unsolvedConstraints <- getAllConstraints interactionPoints <- getInteractionPoints ifTopLevelAndHighlightingLevelIs NonInteractive $ printUnsolvedInfo reportSLn "import.iface.create" 7 $ "Starting writing to interface file." r <- if and [ null unsolvedMetas, null unsolvedConstraints, null interactionPoints ] then Bench.billTo [Bench.Serialization] $ do -- The file was successfully type-checked (and no warnings were -- encountered), so the interface should be written out. let ifile = filePath $ toIFile file writeInterface ifile i return (i, NoWarnings) else do return (i, SomeWarnings $ Warnings unsolvedMetas unsolvedConstraints) reportSLn "import.iface.create" 7 $ "Finished writing to interface file." -- Profiling: Print statistics. printStatistics 30 (Just mname) =<< getStatistics -- Get the statistics of the current module -- and add it to the accumulated statistics. localStatistics <- getStatistics lensAccumStatistics %= Map.unionWith (+) localStatistics verboseS "profile" 1 $ do reportSLn "import.iface" 5 $ "Accumulated statistics." return $ first constructIScope r -- constructIScope :: ScopeInfo -> Map ModuleName Scope constructIScope :: Interface -> Interface constructIScope i = i{ iScope = billToPure [ Deserialization ] $ publicModules $ iInsideScope i } -- | Builds an interface for the current module, which should already -- have been successfully type checked. buildInterface :: AbsolutePath -> TopLevelInfo -- ^ 'TopLevelInfo' for the current module. -> HighlightingInfo -- ^ Syntax highlighting info for the module. -> Set String -- ^ Haskell modules imported in imported modules (transitively). -> [OptionsPragma] -- ^ Options set in @OPTIONS@ pragmas. -> TCM Interface buildInterface file topLevel syntaxInfo previousHsImports pragmas = do reportSLn "import.iface" 5 "Building interface..." let m = topLevelModuleName topLevel scope' <- getScope let scope = scope' { scopeCurrent = m } -- Andreas, 2014-05-03: killRange did not result in significant reduction -- of .agdai file size, and lost a few seconds performance on library-test. -- Andreas, Makoto, 2014-10-18 AIM XX: repeating the experiment -- with discarding also the nameBindingSite in QName: -- Saves 10% on serialization time (and file size)! sig <- killRange <$> getSignature builtin <- use stLocalBuiltins ms <- getImports mhs <- mapM (\ m -> (m,) <$> moduleHash m) $ Set.toList ms hsImps <- getHaskellImports -- Andreas, 2015-02-09 kill ranges in pattern synonyms before -- serialization to avoid error locations pointing to external files -- when expanding a pattern synoym. patsyns <- killRange <$> getPatternSyns h <- liftIO $ hashFile file let builtin' = Map.mapWithKey (\ x b -> (x,) . primFunName <$> b) builtin reportSLn "import.iface" 7 " instantiating all meta variables" i <- instantiateFull $ Interface { iSourceHash = h , iImportedModules = mhs , iModuleName = m , iScope = empty -- publicModules scope , iInsideScope = insideScope topLevel , iSignature = sig , iBuiltin = builtin' , iHaskellImports = hsImps `Set.difference` previousHsImports , iHighlighting = syntaxInfo , iPragmaOptions = pragmas , iPatternSyns = patsyns } reportSLn "import.iface" 7 " interface complete" return i -- | Returns (iSourceHash, iFullHash) getInterfaceFileHashes :: FilePath -> TCM (Maybe (Hash, Hash)) getInterfaceFileHashes ifile = do exist <- liftIO $ doesFileExist ifile if not exist then return Nothing else do (s, close) <- liftIO $ readBinaryFile' ifile let hs = decodeHashes s liftIO $ maybe 0 (uncurry (+)) hs `seq` close return hs moduleHash :: ModuleName -> TCM Hash moduleHash m = iFullHash <$> getInterface m -- | True if the first file is newer than the second file. If a file doesn't -- exist it is considered to be infinitely old. isNewerThan :: FilePath -> FilePath -> IO Bool isNewerThan new old = do newExist <- doesFileExist new oldExist <- doesFileExist old if not (newExist && oldExist) then return newExist else do newT <- getModificationTime new oldT <- getModificationTime old return $ newT >= oldT Agda-2.4.2.5/src/full/Agda/Interaction/CommandLine.hs0000644000000000000000000002373112635075266020314 0ustar0000000000000000{-# LANGUAGE CPP #-} module Agda.Interaction.CommandLine where import Control.Monad.Reader import Control.Applicative import Data.List as List import Data.Maybe import Agda.Interaction.BasicOps as BasicOps hiding (parseExpr) import Agda.Interaction.Monad import qualified Agda.Syntax.Abstract as A import Agda.Syntax.Common import qualified Agda.Syntax.Internal as I import Agda.Syntax.Parser import Agda.Syntax.Position import Agda.Syntax.Scope.Base import Agda.Syntax.Translation.ConcreteToAbstract import Agda.Syntax.Abstract.Pretty import Text.PrettyPrint import Agda.TheTypeChecker import Agda.TypeChecking.Constraints import Agda.TypeChecking.Monad import Agda.TypeChecking.Reduce import Agda.TypeChecking.Errors import Agda.TypeChecking.Pretty ( PrettyTCM(prettyTCM) ) import Agda.TypeChecking.Substitute import Agda.Utils.Except ( MonadError(catchError) ) import Agda.Utils.Monad #include "undefined.h" import Agda.Utils.Impossible data ExitCode a = Continue | ContinueIn TCEnv | Return a type Command a = (String, [String] -> TCM (ExitCode a)) matchCommand :: String -> [Command a] -> Either [String] ([String] -> TCM (ExitCode a)) matchCommand x cmds = case List.filter (isPrefixOf x . fst) cmds of [(_,m)] -> Right m xs -> Left $ List.map fst xs interaction :: String -> [Command a] -> (String -> TCM (ExitCode a)) -> IM a interaction prompt cmds eval = loop where go (Return x) = return x go Continue = loop go (ContinueIn env) = local (const env) loop loop = do ms <- readline prompt case fmap words ms of Nothing -> return $ error "** EOF **" Just [] -> loop Just ((':':cmd):args) -> do case matchCommand cmd cmds of Right c -> go =<< liftTCM (c args) Left [] -> do liftIO $ putStrLn $ "Unknown command '" ++ cmd ++ "'" loop Left xs -> do liftIO $ putStrLn $ "More than one command match: " ++ concat (intersperse ", " xs) loop Just _ -> do go =<< liftTCM (eval $ fromJust ms) `catchError` \e -> do s <- liftTCM $ prettyError e liftIO $ putStrLn s loop -- | The interaction loop. interactionLoop :: TCM (Maybe Interface) -> IM () interactionLoop doTypeCheck = do liftTCM reload interaction "Main> " commands evalTerm where reload = do mi <- doTypeCheck -- Note that mi is Nothing if (1) there is no input file or -- (2) the file type checked with unsolved metas and -- --allow-unsolved-metas was used. In the latter case the -- behaviour of agda -I may be surprising. If agda -I ever -- becomes properly supported again, then this behaviour -- should perhaps be fixed. setScope $ case mi of Just i -> iInsideScope i Nothing -> emptyScopeInfo `catchError` \e -> do s <- prettyError e liftIO $ putStrLn s liftIO $ putStrLn "Failed." commands = [ "quit" |> \_ -> return $ Return () , "?" |> \_ -> continueAfter $ liftIO $ help commands , "reload" |> \_ -> do reload ContinueIn <$> ask , "constraints" |> \args -> continueAfter $ showConstraints args , "Context" |> \args -> continueAfter $ showContext args , "give" |> \args -> continueAfter $ giveMeta args , "Refine" |> \args -> continueAfter $ refineMeta args , "metas" |> \args -> continueAfter $ showMetas args , "load" |> \args -> continueAfter $ loadFile reload args , "eval" |> \args -> continueAfter $ evalIn args , "typeOf" |> \args -> continueAfter $ typeOf args , "typeIn" |> \args -> continueAfter $ typeIn args , "wakeup" |> \_ -> continueAfter $ retryConstraints , "scope" |> \_ -> continueAfter $ showScope ] where (|>) = (,) continueAfter :: TCM a -> TCM (ExitCode b) continueAfter m = withCurrentFile $ do m >> return Continue -- | Set 'envCurrentPath' to 'optInputFile'. withCurrentFile :: TCM a -> TCM a withCurrentFile cont = do mpath <- getInputFile' local (\ e -> e { envCurrentPath = mpath }) cont loadFile :: TCM () -> [String] -> TCM () loadFile reload [file] = do setInputFile file withCurrentFile reload loadFile _ _ = liftIO $ putStrLn ":load file" showConstraints :: [String] -> TCM () showConstraints [] = do cs <- BasicOps.getConstraints liftIO $ putStrLn $ unlines (List.map show cs) showConstraints _ = liftIO $ putStrLn ":constraints [cid]" showMetas :: [String] -> TCM () showMetas [m] = do i <- InteractionId <$> readM m withInteractionId i $ do s <- typeOfMeta AsIs i r <- getInteractionRange i d <- showA s liftIO $ putStrLn $ d ++ " " ++ show r showMetas [m,"normal"] = do i <- InteractionId <$> readM m withInteractionId i $ do s <- showA =<< typeOfMeta Normalised i r <- getInteractionRange i liftIO $ putStrLn $ s ++ " " ++ show r showMetas [] = do interactionMetas <- typesOfVisibleMetas AsIs hiddenMetas <- typesOfHiddenMetas AsIs mapM_ (liftIO . putStrLn) =<< mapM showII interactionMetas mapM_ print' hiddenMetas where showII o = withInteractionId (outputFormId $ OutputForm noRange 0 o) $ showA o showM o = withMetaId (nmid $ outputFormId $ OutputForm noRange 0 o) $ showA o metaId (OfType i _) = i metaId (JustType i) = i metaId (JustSort i) = i metaId (Assign i e) = i metaId _ = __IMPOSSIBLE__ print' x = do r <- getMetaRange $ nmid $ metaId x d <- showM x liftIO $ putStrLn $ d ++ " [ at " ++ show r ++ " ]" showMetas _ = liftIO $ putStrLn $ ":meta [metaid]" showScope :: TCM () showScope = do scope <- getScope liftIO $ print scope metaParseExpr :: InteractionId -> String -> TCM A.Expr metaParseExpr ii s = do m <- lookupInteractionId ii scope <- getMetaScope <$> lookupMeta m r <- getRange <$> lookupMeta m --liftIO $ putStrLn $ show scope let pos = case rStart r of Nothing -> __IMPOSSIBLE__ Just pos -> pos e <- liftIO $ parsePosString exprParser pos s concreteToAbstract scope e actOnMeta :: [String] -> (InteractionId -> A.Expr -> TCM a) -> TCM a actOnMeta (is:es) f = do i <- readM is let ii = InteractionId i e <- metaParseExpr ii (unwords es) withInteractionId ii $ f ii e actOnMeta _ _ = __IMPOSSIBLE__ giveMeta :: [String] -> TCM () giveMeta s | length s >= 2 = do _ <- actOnMeta s (\ii -> \e -> give ii Nothing e) return () giveMeta _ = liftIO $ putStrLn $ ": give" ++ " metaid expr" refineMeta :: [String] -> TCM () refineMeta s | length s >= 2 = do _ <- actOnMeta s (\ii -> \e -> refine ii Nothing e) return () refineMeta _ = liftIO $ putStrLn $ ": refine" ++ " metaid expr" retryConstraints :: TCM () retryConstraints = liftTCM wakeupConstraints_ evalIn :: [String] -> TCM () evalIn s | length s >= 2 = do d <- actOnMeta s $ \_ e -> prettyA =<< evalInCurrent e liftIO $ print d evalIn _ = liftIO $ putStrLn ":eval metaid expr" parseExpr :: String -> TCM A.Expr parseExpr s = do e <- liftIO $ parse exprParser s localToAbstract e return evalTerm :: String -> TCM (ExitCode a) evalTerm s = do e <- parseExpr s v <- evalInCurrent e e <- prettyTCM v liftIO $ putStrLn $ show e return Continue where evalInCurrent e = do (v,t) <- inferExpr e v' <- normalise v return v' typeOf :: [String] -> TCM () typeOf s = do e <- parseExpr (unwords s) e0 <- typeInCurrent Normalised e e1 <- typeInCurrent AsIs e liftIO . putStrLn =<< showA e1 typeIn :: [String] -> TCM () typeIn s@(_:_:_) = actOnMeta s $ \i e -> do e1 <- typeInMeta i Normalised e e2 <- typeInMeta i AsIs e liftIO . putStrLn =<< showA e1 typeIn _ = liftIO $ putStrLn ":typeIn meta expr" showContext :: [String] -> TCM () showContext (meta:args) = do i <- InteractionId <$> readM meta mi <- lookupMeta =<< lookupInteractionId i withMetaInfo (getMetaInfo mi) $ do ctx <- List.map unDom . telToList <$> getContextTelescope zipWithM_ display ctx $ reverse $ zipWith const [1..] ctx where display (x, t) n = do t <- case args of ["normal"] -> normalise $ raise n t _ -> return $ raise n t d <- prettyTCM t liftIO $ print $ text (I.argNameToString x) <+> text ":" <+> d showContext _ = liftIO $ putStrLn ":Context meta" -- | The logo that prints when Agda is started in interactive mode. splashScreen :: String splashScreen = unlines [ " _ " , " ____ | |" , " / __ \\ | |" , " | |__| |___ __| | ___" , " | __ / _ \\/ _ |/ __\\ Agda Interactive" , " | | |/ /_\\ \\/_| / /_| \\" , " |_| |\\___ /____\\_____/ Type :? for help." , " __/ /" , " \\__/" , "" , "The interactive mode is no longer supported. Don't complain if it doesn't work." ] -- | The help message help :: [Command a] -> IO () help cs = putStr $ unlines $ [ "Command overview" ] ++ List.map explain cs ++ [ " Infer type of expression and evaluate it." ] where explain (x,_) = ":" ++ x Agda-2.4.2.5/src/full/Agda/Interaction/Monad.hs0000644000000000000000000000046012635075266017156 0ustar0000000000000000module Agda.Interaction.Monad (IM, runIM, readline) where import Control.Monad.Trans import System.Console.Haskeline import Agda.TypeChecking.Monad -- | Line reader. The line reader history is not stored between -- sessions. readline :: String -> IM (Maybe String) readline s = lift (getInputLine s) Agda-2.4.2.5/src/full/Agda/Interaction/MakeCase.hs0000644000000000000000000002347412635075266017603 0ustar0000000000000000{-# LANGUAGE CPP #-} {-# LANGUAGE DoAndIfThenElse #-} {-# LANGUAGE TupleSections #-} module Agda.Interaction.MakeCase where import Prelude hiding (mapM, mapM_, null) import Control.Applicative hiding (empty) import Control.Monad hiding (mapM, mapM_, forM) import Data.Maybe import Data.Traversable import Agda.Syntax.Common import Agda.Syntax.Position import qualified Agda.Syntax.Concrete as C import qualified Agda.Syntax.Abstract as A import qualified Agda.Syntax.Info as A import Agda.Syntax.Internal import Agda.Syntax.Scope.Monad (resolveName, ResolvedName(..)) import Agda.Syntax.Translation.ConcreteToAbstract import Agda.Syntax.Translation.InternalToAbstract import Agda.TypeChecking.Monad import Agda.TypeChecking.Coverage import Agda.TypeChecking.Pretty import Agda.TypeChecking.RecordPatterns import Agda.TypeChecking.Reduce import Agda.TypeChecking.Substitute import Agda.TypeChecking.Irrelevance import Agda.TypeChecking.Rules.LHS.Implicit import Agda.TheTypeChecker import Agda.Interaction.Options import Agda.Interaction.BasicOps import Agda.Utils.Functor import Agda.Utils.Lens import Agda.Utils.List import Agda.Utils.Monad import Agda.Utils.Null import qualified Agda.Utils.Pretty as P import Agda.Utils.Singleton import Agda.Utils.Size import qualified Agda.Utils.HashMap as HMap #include "undefined.h" import Agda.Utils.Impossible type CaseContext = Maybe ExtLamInfo -- | Find the clause whose right hand side is the given meta -- BY SEARCHING THE WHOLE SIGNATURE. Returns -- the original clause, before record patterns have been translated -- away. Raises an error if there is no matching clause. -- -- Andreas, 2010-09-21: This looks like a SUPER UGLY HACK to me. You are -- walking through the WHOLE signature to find an information you have -- thrown away earlier. (shutter with disgust). -- This code fails for record rhs because they have been eta-expanded, -- so the MVar is gone. findClause :: MetaId -> TCM (CaseContext, QName, Clause) findClause m = do sig <- getImportedSignature let res = do def <- HMap.elems $ sig ^. sigDefinitions Function{funClauses = cs, funExtLam = extlam} <- [theDef def] c <- cs unless (rhsIsm $ clauseBody c) [] return (extlam, defName def, c) case res of [] -> do reportSDoc "interaction.case" 10 $ vcat $ [ text "Interaction.MakeCase.findClause fails" , text "expected rhs to be meta var" <+> (text $ show m) , text "but could not find it in the signature" ] reportSDoc "interaction.case" 100 $ vcat $ map (text . show) (HMap.elems $ sig ^. sigDefinitions) -- you asked for it! ifM (isInstantiatedMeta m) -- Andreas, 2012-03-22 If the goal has been solved by eta expansion, further -- case splitting is pointless and `smart-ass Agda' will refuse. -- Maybe not the best solution, but the lazy alternative to replace this -- SUPER UGLY HACK. (typeError $ GenericError "Since goal is solved, further case distinction is not supported; try `Solve constraints' instead") (typeError $ GenericError "Right hand side must be a single hole when making a case distinction") [triple] -> return triple _ -> __IMPOSSIBLE__ where rhsIsm (Bind b) = rhsIsm $ unAbs b rhsIsm NoBody = False rhsIsm (Body e) = case ignoreSharing e of MetaV m' _ -> m == m' _ -> False -- | Parse variables (visible or hidden), returning their de Bruijn indices. -- Used in 'makeCase'. parseVariables :: InteractionId -> Range -> [String] -> TCM [Int] parseVariables ii rng ss = do -- Get into the context of the meta. mId <- lookupInteractionId ii updateMetaVarRange mId rng mi <- getMetaInfo <$> lookupMeta mId enterClosure mi $ \ r -> do -- Get printed representation of variables in context. n <- getContextSize xs <- forM (downFrom n) $ \ i -> do (,i) . P.render <$> prettyTCM (var i) -- Get number of module parameters. These cannot be split on. fv <- getCurrentModuleFreeVars let numSplittableVars = n - fv -- Resolve each string to a variable. forM ss $ \ s -> do let failNotVar = typeError $ GenericError $ "Not a (splittable) variable: " ++ s done i | i < numSplittableVars = return i | otherwise = failNotVar -- Note: the range in the concrete name is only approximate. resName <- resolveName $ C.QName $ C.Name r $ C.stringNameParts s case resName of -- Fail if s is a name, but not of a variable. DefinedName{} -> failNotVar FieldName{} -> failNotVar ConstructorName{} -> failNotVar PatternSynResName{} -> failNotVar -- If s is a variable name in scope, get its de Bruijn index -- via the type checker. VarName x -> do (v, _) <- getVarInfo x case ignoreSharing v of Var i [] -> done i _ -> failNotVar -- If s is not a name, compare it to the printed variable representation. -- This fallback is to enable splitting on hidden variables. UnknownName -> do case filter ((s ==) . fst) xs of [] -> typeError $ GenericError $ "Unbound variable " ++ s [(_,i)] -> done i -- Issue 1325: Variable names in context can be ambiguous. _ -> typeError $ GenericError $ "Ambiguous variable " ++ s -- | Entry point for case splitting tactic. makeCase :: InteractionId -> Range -> String -> TCM (CaseContext , [A.Clause]) makeCase hole rng s = withInteractionId hole $ do meta <- lookupInteractionId hole (casectxt, f, clause@(Clause{ clauseTel = tel, clausePerm = perm, namedClausePats = ps })) <- findClause meta reportSDoc "interaction.case" 10 $ vcat [ text "splitting clause:" , nest 2 $ vcat [ text "f =" <+> prettyTCM f , text "context =" <+> (prettyTCM =<< getContextTelescope) , text "tel =" <+> prettyTCM tel , text "perm =" <+> text (show perm) , text "ps =" <+> text (show ps) ] ] let vars = words s if null vars then do -- split result (piTel, sc) <- fixTarget $ clauseToSplitClause clause -- Andreas, 2015-05-05 If we introduced new function arguments -- do not split on result. This might be more what the user wants. -- To split on result, he can then C-c C-c again. -- Andreas, 2015-05-21 Issue 1516: However, if only hidden -- arguments are introduced, C-c C-c virtually does nothing -- (as they are not shown and get lost on the way to emacs and back). newPats <- if null piTel then return False else do -- If there were any pattern introduce, they will only have effect -- if any of them is shown by the printer imp <- optShowImplicit <$> pragmaOptions return $ imp || any visible (telToList piTel) scs <- if newPats then return [sc] else do res <- splitResult f sc case res of Nothing -> typeError $ GenericError $ "Cannot split on result here" Just cov -> ifNotM (optCopatterns <$> pragmaOptions) failNoCop $ {-else-} do mapM (snd <.> fixTarget) $ splitClauses cov (casectxt,) <$> mapM (makeAbstractClause f) scs else do -- split on variables vars <- parseVariables hole rng vars (casectxt,) <$> do split f vars $ clauseToSplitClause clause where failNoCop = typeError $ GenericError $ "OPTION --copatterns needed to split on result here" split :: QName -> [Nat] -> SplitClause -> TCM [A.Clause] split f [] clause = singleton <$> makeAbstractClause f clause split f (var : vars) clause = do z <- splitClauseWithAbsurd clause var case z of Left err -> typeError $ SplitError err Right (Left cl) -> (:[]) <$> makeAbsurdClause f cl Right (Right cov) | null vars -> mapM (makeAbstractClause f) $ splitClauses cov | otherwise -> concat <$> do forM (splitClauses cov) $ \ cl -> split f (mapMaybe (newVar cl) vars) cl -- Finds the new variable corresponding to an old one, if any. newVar :: SplitClause -> Nat -> Maybe Nat newVar c x = case ignoreSharing $ applySubst (scSubst c) (var x) of Var y [] -> Just y _ -> Nothing makeAbsurdClause :: QName -> SplitClause -> TCM A.Clause makeAbsurdClause f (SClause tel perm ps _ t) = do reportSDoc "interaction.case" 10 $ vcat [ text "Interaction.MakeCase.makeCase: split clause:" , nest 2 $ vcat [ text "context =" <+> (prettyTCM =<< getContextTelescope) , text "tel =" <+> prettyTCM tel , text "perm =" <+> text (show perm) , text "ps =" <+> text (show ps) ] ] withCurrentModule (qnameModule f) $ do -- Andreas, 2015-05-29 Issue 635 -- Contract implicit record patterns before printing. c <- translateRecordPatterns $ Clause noRange tel perm ps NoBody t -- Normalise the dot patterns ps <- addCtxTel tel $ normalise $ namedClausePats c inTopContext $ reify $ QNamed f $ c { namedClausePats = ps } -- | Make a clause with a question mark as rhs. makeAbstractClause :: QName -> SplitClause -> TCM A.Clause makeAbstractClause f cl = do A.Clause lhs _ _ <- makeAbsurdClause f cl let ii = __IMPOSSIBLE__ -- No interaction point since we never type check this let info = A.emptyMetaInfo -- metaNumber = Nothing in order to print as ?, not ?n return $ A.Clause lhs (A.RHS $ A.QuestionMark info ii) [] deBruijnIndex :: A.Expr -> TCM Nat deBruijnIndex e = do (v, _) <- -- Andreas, 2010-09-21 allow splitting on irrelevant (record) vars -- Context.wakeIrrelevantVars $ applyRelevanceToContext Irrelevant $ inferExpr e case ignoreSharing v of Var n _ -> return n _ -> typeError . GenericError . show =<< (fsep $ pwords "The scrutinee of a case distinction must be a variable," ++ [ prettyTCM v ] ++ pwords "isn't.") Agda-2.4.2.5/src/full/Agda/Interaction/Exceptions.hs0000644000000000000000000000111012635075266020232 0ustar0000000000000000{-| This module defines the exception handler. -} module Agda.Interaction.Exceptions where import Prelude import Control.Exception as E import Agda.Syntax.Position import Agda.Syntax.Parser ( ParseError(..) ) import Agda.Utils.Pretty handleParseException :: (ParseError -> IO a) -> ParseError -> IO a handleParseException crash e = crash e -- | Note that 'failOnException' only catches 'ParseError's. failOnException :: (Range -> Doc -> IO a) -> IO a -> IO a failOnException h m = m `E.catch` handleParseException handler where handler x = h (getRange x) (pretty x) Agda-2.4.2.5/src/full/Agda/Interaction/BasicOps.hs0000644000000000000000000010215712635075266017631 0ustar0000000000000000{-# LANGUAGE CPP #-} {-# LANGUAGE DeriveFunctor #-} {-# LANGUAGE FlexibleInstances #-} {-# LANGUAGE MultiParamTypeClasses #-} {-# LANGUAGE TupleSections #-} {-# LANGUAGE UndecidableInstances #-} {-# OPTIONS_GHC -fno-warn-orphans #-} module Agda.Interaction.BasicOps where import Control.Arrow ((***), first, second) import Control.Applicative import Control.Monad.Reader import Control.Monad.State import Control.Monad.Identity import qualified Data.Map as Map import Data.List import Data.Maybe import Data.Traversable hiding (mapM, forM) import qualified Agda.Syntax.Concrete as C -- ToDo: Remove with instance of ToConcrete import Agda.Syntax.Position import Agda.Syntax.Abstract as A hiding (Open, Apply) import Agda.Syntax.Abstract.Views as A import Agda.Syntax.Common import Agda.Syntax.Info (ExprInfo(..),MetaInfo(..),emptyMetaInfo) import qualified Agda.Syntax.Info as Info import Agda.Syntax.Internal as I import Agda.Syntax.Translation.InternalToAbstract import Agda.Syntax.Translation.AbstractToConcrete import Agda.Syntax.Translation.ConcreteToAbstract import Agda.Syntax.Scope.Base import Agda.Syntax.Scope.Monad import Agda.Syntax.Fixity(Precedence(..)) import Agda.Syntax.Parser import Agda.TheTypeChecker import Agda.TypeChecking.Conversion import Agda.TypeChecking.Monad as M hiding (MetaInfo) import Agda.TypeChecking.MetaVars import Agda.TypeChecking.Reduce import Agda.TypeChecking.Substitute import Agda.TypeChecking.Telescope import Agda.TypeChecking.With import Agda.TypeChecking.Coverage import Agda.TypeChecking.Records import Agda.TypeChecking.Irrelevance (wakeIrrelevantVars) import Agda.TypeChecking.Pretty (prettyTCM) import Agda.TypeChecking.Free import qualified Agda.TypeChecking.Pretty as TP import Agda.Utils.Except ( Error(strMsg), MonadError(catchError, throwError) ) import Agda.Utils.Functor import Agda.Utils.Lens import Agda.Utils.List import Agda.Utils.Maybe import Agda.Utils.Monad import Agda.Utils.Pretty import Agda.Utils.Permutation import Agda.Utils.Size #include "undefined.h" import Agda.Utils.Impossible -- | Parses an expression. parseExpr :: Range -> String -> TCM C.Expr parseExpr rng s = liftIO $ parsePosString exprParser pos s where pos = fromMaybe (startPos Nothing) $ rStart rng parseExprIn :: InteractionId -> Range -> String -> TCM Expr parseExprIn ii rng s = do mId <- lookupInteractionId ii updateMetaVarRange mId rng mi <- getMetaInfo <$> lookupMeta mId e <- parseExpr rng s concreteToAbstract (clScope mi) e giveExpr :: MetaId -> Expr -> TCM Expr -- When translator from internal to abstract is given, this function might return -- the expression returned by the type checker. giveExpr mi e = do mv <- lookupMeta mi -- In the context (incl. signature) of the meta variable, -- type check expression and assign meta withMetaInfo (getMetaInfo mv) $ do metaTypeCheck mv (mvJudgement mv) where metaTypeCheck mv IsSort{} = __IMPOSSIBLE__ metaTypeCheck mv (HasType _ t) = do reportSDoc "interaction.give" 20 $ TP.text "give: meta type =" TP.<+> prettyTCM t -- Here, we must be in the same context where the meta was created. -- Thus, we can safely apply its type to the context variables. ctx <- getContextArgs let t' = t `piApply` permute (takeP (length ctx) $ mvPermutation mv) ctx traceCall (CheckExprCall e t') $ do reportSDoc "interaction.give" 20 $ TP.text "give: instantiated meta type =" TP.<+> prettyTCM t' v <- checkExpr e t' case mvInstantiation mv of InstV xs v' -> unlessM ((Irrelevant ==) <$> asks envRelevance) $ do reportSDoc "interaction.give" 20 $ TP.sep [ TP.text "meta was already set to value v' = " TP.<+> prettyTCM v' TP.<+> TP.text " with free variables " TP.<+> return (fsep $ map pretty xs) , TP.text "now comparing it to given value v = " TP.<+> prettyTCM v , TP.text "in context " TP.<+> inTopContext (prettyTCM ctx) ] -- The number of free variables should be at least the size of the context -- (Ideally, if we implemented contextual type theory, it should be the same.) when (length xs < size ctx) __IMPOSSIBLE__ -- if there are more free variables than the context has -- we need to abstract over the additional ones (xs2) let (_xs1, xs2) = splitAt (size ctx) xs v' <- return $ foldr (\ (Arg ai x) -> I.Lam ai . I.Abs x) v' xs2 reportSDoc "interaction.give" 20 $ TP.sep [ TP.text "in meta context, v' = " TP.<+> prettyTCM v' ] equalTerm t' v v' -- Note: v' now lives in context of meta _ -> updateMeta mi v reify v -- | Try to fill hole by expression. -- -- Returns the given expression unchanged -- (for convenient generalization to @'refine'@). give :: InteractionId -- ^ Hole. -> Maybe Range -> Expr -- ^ The expression to give. -> TCM Expr -- ^ If successful, the very expression is returned unchanged. give ii mr e = liftTCM $ do -- if Range is given, update the range of the interaction meta mi <- lookupInteractionId ii whenJust mr $ updateMetaVarRange mi reportSDoc "interaction.give" 10 $ TP.text "giving expression" TP.<+> prettyTCM e reportSDoc "interaction.give" 50 $ TP.text $ show $ deepUnScope e -- Try to give mi := e _ <- catchError (giveExpr mi e) $ \ err -> case err of -- Turn PatternErr into proper error: PatternErr{} -> do err <- withInteractionId ii $ TP.text "Failed to give" TP.<+> prettyTCM e typeError $ GenericError $ show err _ -> throwError err removeInteractionPoint ii return e -- | Try to refine hole by expression @e@. -- -- This amounts to successively try to give @e@, @e ?@, @e ? ?@, ... -- Returns the successfully given expression. refine :: InteractionId -- ^ Hole. -> Maybe Range -> Expr -- ^ The expression to refine the hole with. -> TCM Expr -- ^ The successfully given expression. refine ii mr e = do mi <- lookupInteractionId ii mv <- lookupMeta mi let range = fromMaybe (getRange mv) mr scope = M.getMetaScope mv reportSDoc "interaction.refine" 10 $ TP.text "refining with expression" TP.<+> prettyTCM e reportSDoc "interaction.refine" 50 $ TP.text $ show $ deepUnScope e -- We try to append up to 10 meta variables tryRefine 10 range scope e where tryRefine :: Int -> Range -> ScopeInfo -> Expr -> TCM Expr tryRefine nrOfMetas r scope e = try nrOfMetas e where try :: Int -> Expr -> TCM Expr try 0 e = throwError $ strMsg "Cannot refine" try n e = give ii (Just r) e `catchError` (\_ -> try (n-1) =<< appMeta e) -- Apply A.Expr to a new meta appMeta :: Expr -> TCM Expr appMeta e = do let rng = rightMargin r -- Andreas, 2013-05-01 conflate range to its right margin to ensure that appended metas are last in numbering. This fixes issue 841. -- Make new interaction point ii <- registerInteractionPoint rng Nothing let info = Info.MetaInfo { Info.metaRange = rng , Info.metaScope = scope { scopePrecedence = ArgumentCtx } , metaNumber = Nothing -- in order to print just as ?, not ?n , metaNameSuggestion = "" } metaVar = QuestionMark info ii return $ App (ExprRange r) e $ defaultNamedArg metaVar --ToDo: The position of metaVar is not correct --ToDo: The fixity of metavars is not correct -- fixed? MT {-| Evaluate the given expression in the current environment -} evalInCurrent :: Expr -> TCM Expr evalInCurrent e = do (v, t) <- inferExpr e v' <- {- etaContract =<< -} normalise v reify v' evalInMeta :: InteractionId -> Expr -> TCM Expr evalInMeta ii e = do m <- lookupInteractionId ii mi <- getMetaInfo <$> lookupMeta m withMetaInfo mi $ evalInCurrent e data Rewrite = AsIs | Instantiated | HeadNormal | Simplified | Normalised deriving (Read) normalForm :: Rewrite -> Type -> TCM Type normalForm AsIs t = return t normalForm Instantiated t = return t -- reify does instantiation normalForm HeadNormal t = {- etaContract =<< -} reduce t normalForm Simplified t = {- etaContract =<< -} simplify t normalForm Normalised t = {- etaContract =<< -} normalise t data OutputForm a b = OutputForm Range ProblemId (OutputConstraint a b) deriving (Functor) data OutputConstraint a b = OfType b a | CmpInType Comparison a b b | CmpElim [Polarity] a [b] [b] | JustType b | CmpTypes Comparison b b | CmpLevels Comparison b b | CmpTeles Comparison b b | JustSort b | CmpSorts Comparison b b | Guard (OutputConstraint a b) ProblemId | Assign b a | TypedAssign b a a | PostponedCheckArgs b [a] a a | IsEmptyType a | SizeLtSat a | FindInScopeOF b a [(a,a)] deriving (Functor) -- | A subset of 'OutputConstraint'. data OutputConstraint' a b = OfType' { ofName :: b , ofExpr :: a } outputFormId :: OutputForm a b -> b outputFormId (OutputForm _ _ o) = out o where out o = case o of OfType i _ -> i CmpInType _ _ i _ -> i CmpElim _ _ (i:_) _ -> i CmpElim _ _ [] _ -> __IMPOSSIBLE__ JustType i -> i CmpLevels _ i _ -> i CmpTypes _ i _ -> i CmpTeles _ i _ -> i JustSort i -> i CmpSorts _ i _ -> i Guard o _ -> out o Assign i _ -> i TypedAssign i _ _ -> i PostponedCheckArgs i _ _ _ -> i IsEmptyType _ -> __IMPOSSIBLE__ -- Should never be used on IsEmpty constraints SizeLtSat{} -> __IMPOSSIBLE__ FindInScopeOF _ _ _ -> __IMPOSSIBLE__ instance Reify ProblemConstraint (Closure (OutputForm Expr Expr)) where reify (PConstr pid cl) = enterClosure cl $ \c -> buildClosure =<< (OutputForm (getRange c) pid <$> reify c) instance Reify Constraint (OutputConstraint Expr Expr) where reify (ValueCmp cmp t u v) = CmpInType cmp <$> reify t <*> reify u <*> reify v reify (ElimCmp cmp t v es1 es2) = CmpElim cmp <$> reify t <*> reify es1 <*> reify es2 reify (LevelCmp cmp t t') = CmpLevels cmp <$> reify t <*> reify t' reify (TypeCmp cmp t t') = CmpTypes cmp <$> reify t <*> reify t' reify (TelCmp a b cmp t t') = CmpTeles cmp <$> (ETel <$> reify t) <*> (ETel <$> reify t') reify (SortCmp cmp s s') = CmpSorts cmp <$> reify s <*> reify s' reify (Guarded c pid) = do o <- reify c return $ Guard o pid reify (UnBlock m) = do mi <- mvInstantiation <$> lookupMeta m m' <- reify (MetaV m []) case mi of BlockedConst t -> do e <- reify t return $ Assign m' e PostponedTypeCheckingProblem cl _ -> enterClosure cl $ \p -> case p of CheckExpr e a -> do a <- reify a return $ TypedAssign m' e a CheckLambda (Arg ai (xs, mt)) body target -> do domType <- maybe (return underscore) reify mt target <- reify target let bs = TypedBindings noRange $ Arg (mapArgInfoColors (const []) ai) $ TBind noRange xs domType e = A.Lam Info.exprNoRange (DomainFull bs) body return $ TypedAssign m' e target CheckArgs _ _ _ args t0 t1 _ -> do t0 <- reify t0 t1 <- reify t1 return $ PostponedCheckArgs m' (map (namedThing . unArg) args) t0 t1 Open{} -> __IMPOSSIBLE__ OpenIFS{} -> __IMPOSSIBLE__ InstS{} -> __IMPOSSIBLE__ InstV{} -> __IMPOSSIBLE__ reify (FindInScope m mcands) = FindInScopeOF <$> (reify $ MetaV m []) <*> (reify =<< getMetaType m) <*> (forM (fromMaybe [] mcands) $ \ (tm, ty) -> do (,) <$> reify tm <*> reify ty) reify (IsEmpty r a) = IsEmptyType <$> reify a reify (CheckSizeLtSat a) = SizeLtSat <$> reify a -- ASR TODO (28 December 2014): This function will be unnecessary when -- using a Pretty instance for OutputConstraint instead of the Show -- instance. showComparison :: Comparison -> String showComparison cmp = " " ++ prettyShow cmp ++ " " instance (Show a,Show b) => Show (OutputForm a b) where show o = case o of OutputForm r 0 c -> show c ++ range r OutputForm r pid c -> "[" ++ prettyShow pid ++ "] " ++ show c ++ range r where range r | null s = "" | otherwise = " [ at " ++ s ++ " ]" where s = show r instance (Show a,Show b) => Show (OutputConstraint a b) where show (OfType e t) = show e ++ " : " ++ show t show (JustType e) = "Type " ++ show e show (JustSort e) = "Sort " ++ show e show (CmpInType cmp t e e') = show e ++ showComparison cmp ++ show e' ++ " : " ++ show t show (CmpElim cmp t e e') = show e ++ " == " ++ show e' ++ " : " ++ show t show (CmpTypes cmp t t') = show t ++ showComparison cmp ++ show t' show (CmpLevels cmp t t') = show t ++ showComparison cmp ++ show t' show (CmpTeles cmp t t') = show t ++ showComparison cmp ++ show t' show (CmpSorts cmp s s') = show s ++ showComparison cmp ++ show s' show (Guard o pid) = show o ++ " [blocked by problem " ++ prettyShow pid ++ "]" show (Assign m e) = show m ++ " := " ++ show e show (TypedAssign m e a) = show m ++ " := " ++ show e ++ " :? " ++ show a show (PostponedCheckArgs m es t0 t1) = show m ++ " := (_ : " ++ show t0 ++ ") " ++ unwords (map (paren . show) es) ++ " : " ++ show t1 where paren s | elem ' ' s = "(" ++ s ++ ")" | otherwise = s show (IsEmptyType a) = "Is empty: " ++ show a show (SizeLtSat a) = "Not empty type of sizes: " ++ show a show (FindInScopeOF s t cs) = "Resolve instance argument " ++ showCand (s,t) ++ ".\n Candidates:\n [ " ++ intercalate "\n , " (map showCand cs) ++ " ]" where showCand (tm,ty) = indent 6 $ show tm ++ " : " ++ show ty indent n s = intercalate ("\n" ++ replicate n ' ') (l:ls) where l:ls = lines s instance (ToConcrete a c, ToConcrete b d) => ToConcrete (OutputForm a b) (OutputForm c d) where toConcrete (OutputForm r pid c) = OutputForm r pid <$> toConcrete c instance (ToConcrete a c, ToConcrete b d) => ToConcrete (OutputConstraint a b) (OutputConstraint c d) where toConcrete (OfType e t) = OfType <$> toConcrete e <*> toConcreteCtx TopCtx t toConcrete (JustType e) = JustType <$> toConcrete e toConcrete (JustSort e) = JustSort <$> toConcrete e toConcrete (CmpInType cmp t e e') = CmpInType cmp <$> toConcreteCtx TopCtx t <*> toConcreteCtx ArgumentCtx e <*> toConcreteCtx ArgumentCtx e' toConcrete (CmpElim cmp t e e') = CmpElim cmp <$> toConcreteCtx TopCtx t <*> toConcreteCtx TopCtx e <*> toConcreteCtx TopCtx e' toConcrete (CmpTypes cmp e e') = CmpTypes cmp <$> toConcreteCtx ArgumentCtx e <*> toConcreteCtx ArgumentCtx e' toConcrete (CmpLevels cmp e e') = CmpLevels cmp <$> toConcreteCtx ArgumentCtx e <*> toConcreteCtx ArgumentCtx e' toConcrete (CmpTeles cmp e e') = CmpTeles cmp <$> toConcrete e <*> toConcrete e' toConcrete (CmpSorts cmp e e') = CmpSorts cmp <$> toConcreteCtx ArgumentCtx e <*> toConcreteCtx ArgumentCtx e' toConcrete (Guard o pid) = Guard <$> toConcrete o <*> pure pid toConcrete (Assign m e) = noTakenNames $ Assign <$> toConcrete m <*> toConcreteCtx TopCtx e toConcrete (TypedAssign m e a) = TypedAssign <$> toConcrete m <*> toConcreteCtx TopCtx e <*> toConcreteCtx TopCtx a toConcrete (PostponedCheckArgs m args t0 t1) = PostponedCheckArgs <$> toConcrete m <*> toConcrete args <*> toConcrete t0 <*> toConcrete t1 toConcrete (IsEmptyType a) = IsEmptyType <$> toConcreteCtx TopCtx a toConcrete (SizeLtSat a) = SizeLtSat <$> toConcreteCtx TopCtx a toConcrete (FindInScopeOF s t cs) = FindInScopeOF <$> toConcrete s <*> toConcrete t <*> mapM (\(tm,ty) -> (,) <$> toConcrete tm <*> toConcrete ty) cs instance (Pretty a, Pretty b) => Pretty (OutputConstraint' a b) where pretty (OfType' e t) = pretty e <+> text ":" <+> pretty t instance (ToConcrete a c, ToConcrete b d) => ToConcrete (OutputConstraint' a b) (OutputConstraint' c d) where toConcrete (OfType' e t) = OfType' <$> toConcrete e <*> toConcreteCtx TopCtx t getConstraints :: TCM [OutputForm C.Expr C.Expr] getConstraints = liftTCM $ do cs <- M.getAllConstraints cs <- forM cs $ \c -> do cl <- reify c enterClosure cl abstractToConcrete_ ss <- mapM toOutputForm =<< getSolvedInteractionPoints True -- get all return $ ss ++ cs where toOutputForm (ii, mi, e) = do mv <- getMetaInfo <$> lookupMeta mi withMetaInfo mv $ do let m = QuestionMark emptyMetaInfo{ metaNumber = Just $ fromIntegral ii } ii abstractToConcrete_ $ OutputForm noRange 0 $ Assign m e -- | @getSolvedInteractionPoints True@ returns all solutions, -- even if just solved by another, non-interaction meta. -- -- @getSolvedInteractionPoints False@ only returns metas that -- are solved by a non-meta. getSolvedInteractionPoints :: Bool -> TCM [(InteractionId, MetaId, Expr)] getSolvedInteractionPoints all = concat <$> do mapM solution =<< getInteractionIdsAndMetas where solution (i, m) = do mv <- lookupMeta m withMetaInfo (getMetaInfo mv) $ do args <- getContextArgs scope <- getScope let sol v = do -- Andreas, 2014-02-17 exclude metas solved by metas v <- ignoreSharing <$> instantiate v let isMeta = case v of MetaV{} -> True; _ -> False if isMeta && not all then return [] else do e <- reify v return [(i, m, ScopedExpr scope e)] unsol = return [] case mvInstantiation mv of InstV{} -> sol (MetaV m $ map Apply args) InstS{} -> sol (Level $ Max [Plus 0 $ MetaLevel m $ map Apply args]) Open{} -> unsol OpenIFS{} -> unsol BlockedConst{} -> unsol PostponedTypeCheckingProblem{} -> unsol typeOfMetaMI :: Rewrite -> MetaId -> TCM (OutputConstraint Expr NamedMeta) typeOfMetaMI norm mi = do mv <- lookupMeta mi withMetaInfo (getMetaInfo mv) $ rewriteJudg mv (mvJudgement mv) where rewriteJudg :: MetaVariable -> Judgement MetaId -> TCM (OutputConstraint Expr NamedMeta) rewriteJudg mv (HasType i t) = do ms <- getMetaNameSuggestion i t <- normalForm norm t vs <- getContextArgs let x = NamedMeta ms i reportSDoc "interactive.meta" 10 $ TP.vcat [ TP.text $ unwords ["permuting", show i, "with", show $ mvPermutation mv] , TP.nest 2 $ TP.vcat [ TP.text "len =" TP.<+> TP.text (show $ length vs) , TP.text "args =" TP.<+> prettyTCM vs , TP.text "t =" TP.<+> prettyTCM t , TP.text "x =" TP.<+> TP.pretty x ] ] reportSDoc "interactive.meta.scope" 20 $ TP.text $ show $ getMetaScope mv OfType x <$> reify (t `piApply` permute (takeP (size vs) $ mvPermutation mv) vs) rewriteJudg mv (IsSort i t) = do ms <- getMetaNameSuggestion i return $ JustSort $ NamedMeta ms i typeOfMeta :: Rewrite -> InteractionId -> TCM (OutputConstraint Expr InteractionId) typeOfMeta norm ii = typeOfMeta' norm . (ii,) =<< lookupInteractionId ii typeOfMeta' :: Rewrite -> (InteractionId, MetaId) -> TCM (OutputConstraint Expr InteractionId) typeOfMeta' norm (ii, mi) = fmap (\_ -> ii) <$> typeOfMetaMI norm mi typesOfVisibleMetas :: Rewrite -> TCM [OutputConstraint Expr InteractionId] typesOfVisibleMetas norm = liftTCM $ mapM (typeOfMeta' norm) =<< getInteractionIdsAndMetas typesOfHiddenMetas :: Rewrite -> TCM [OutputConstraint Expr NamedMeta] typesOfHiddenMetas norm = liftTCM $ do is <- getInteractionMetas store <- Map.filterWithKey (openAndImplicit is) <$> getMetaStore mapM (typeOfMetaMI norm) $ Map.keys store where openAndImplicit is x m = case mvInstantiation m of M.InstV{} -> False M.InstS{} -> False M.Open -> x `notElem` is M.OpenIFS -> x `notElem` is -- OR: True !? M.BlockedConst{} -> True M.PostponedTypeCheckingProblem{} -> False metaHelperType :: Rewrite -> InteractionId -> Range -> String -> TCM (OutputConstraint' Expr Expr) metaHelperType norm ii rng s = case words s of [] -> fail "C-c C-h expects an argument of the form f e1 e2 .. en" f : _ -> do A.Application h args <- A.appView . getBody . deepUnScope <$> parseExprIn ii rng ("let " ++ f ++ " = _ in " ++ s) withInteractionId ii $ do cxtArgs <- getContextArgs -- cleanupType relies on with arguments being named 'w', -- so we'd better rename any actual 'w's to avoid confusion. tel <- runIdentity . onNamesTel unW <$> getContextTelescope a <- runIdentity . onNames unW . (`piApply` cxtArgs) <$> (getMetaType =<< lookupInteractionId ii) (vs, as) <- unzip <$> mapM (inferExpr . namedThing . unArg) args -- Remember the arity of a TelV atel _ <- telView a let arity = size atel (delta1, delta2, _, a', as', vs') = splitTelForWith tel a as vs a <- local (\e -> e { envPrintDomainFreePi = True }) $ do reify =<< cleanupType arity args =<< normalForm norm =<< withFunctionType delta1 vs' as' delta2 a' return (OfType' h a) where cleanupType arity args t = do -- Get the arity of t TelV ttel _ <- telView t -- Compute the number or pi-types subject to stripping. let n = size ttel - arity -- It cannot be negative, otherwise we would have performed a -- negative number of with-abstractions. unless (n >= 0) __IMPOSSIBLE__ return $ evalState (renameVars $ hiding args $ stripUnused n t) args getBody (A.Let _ _ e) = e getBody _ = __IMPOSSIBLE__ -- Strip the non-dependent abstractions from the first n abstractions. stripUnused n (El s v) = El s $ strip n v strip 0 v = v strip n v = case v of I.Pi a b -> case stripUnused (n-1) <$> b of b | absName b == "w" -> I.Pi a b NoAbs _ b -> unEl b Abs s b | 0 `freeIn` b -> I.Pi (hide a) (Abs s b) | otherwise -> strengthen __IMPOSSIBLE__ (unEl b) _ -> v -- todo: handle if goal type is a Pi -- renameVars = onNames (stringToArgName <.> renameVar . argNameToString) renameVars = onNames renameVar hiding args (El s v) = El s $ hidingTm args v hidingTm (arg:args) (I.Pi a b) | absName b == "w" = I.Pi (setHiding (getHiding arg) a) (hiding args <$> b) hidingTm args (I.Pi a b) = I.Pi a (hiding args <$> b) hidingTm _ a = a -- onNames :: Applicative m => (ArgName -> m ArgName) -> Type -> m Type onNames :: Applicative m => (String -> m String) -> Type -> m Type onNames f (El s v) = El s <$> onNamesTm f v -- onNamesTel :: Applicative f => (ArgName -> f ArgName) -> I.Telescope -> f I.Telescope onNamesTel :: Applicative f => (String -> f String) -> I.Telescope -> f I.Telescope onNamesTel f I.EmptyTel = pure I.EmptyTel onNamesTel f (I.ExtendTel a b) = I.ExtendTel <$> traverse (onNames f) a <*> onNamesAbs f onNamesTel b onNamesTm f v = case v of I.Var x es -> I.Var x <$> onNamesElims f es I.Def q es -> I.Def q <$> onNamesElims f es I.Con c args -> I.Con c <$> onNamesArgs f args I.Lam i b -> I.Lam i <$> onNamesAbs f onNamesTm b I.Pi a b -> I.Pi <$> traverse (onNames f) a <*> onNamesAbs f onNames b I.DontCare v -> I.DontCare <$> onNamesTm f v I.Lit{} -> pure v I.Sort{} -> pure v I.Level{} -> pure v I.MetaV{} -> pure v I.Shared{} -> pure v I.ExtLam{} -> __IMPOSSIBLE__ onNamesElims f = traverse $ traverse $ onNamesTm f onNamesArgs f = traverse $ traverse $ onNamesTm f onNamesAbs f = onNamesAbs' f (stringToArgName <.> f . argNameToString) onNamesAbs' f f' nd (Abs s x) = Abs <$> f' s <*> nd f x onNamesAbs' f f' nd (NoAbs s x) = NoAbs <$> f' s <*> nd f x unW "w" = return ".w" unW s = return s renameVar ('.':s) = pure s renameVar "w" = betterName renameVar s = pure s betterName = do arg : args <- get put args return $ case arg of Arg _ (Named _ (A.Var x)) -> show $ A.nameConcrete x Arg _ (Named (Just x) _) -> argNameToString $ rangedThing x _ -> "w" -- Gives a list of names and corresponding types. contextOfMeta :: InteractionId -> Rewrite -> TCM [OutputConstraint' Expr Name] contextOfMeta ii norm = do info <- getMetaInfo <$> (lookupMeta =<< lookupInteractionId ii) let localVars = map ctxEntry . envContext . clEnv $ info letVars = map (\(n, OpenThing _ (tm, (Dom c ty))) -> Dom c (n, ty)) $ Map.toDescList . envLetBindings . clEnv $ info withMetaInfo info $ gfilter visible <$> reifyContext (length letVars) (letVars ++ localVars) where gfilter p = catMaybes . map p visible (OfType x y) | not (isNoName x) = Just (OfType' x y) | otherwise = Nothing visible _ = __IMPOSSIBLE__ reifyContext skip xs = reverse <$> zipWithM out -- don't escape context for letvars (replicate skip 0 ++ [1..]) xs out i (Dom _ (x, t)) = escapeContext i $ do t' <- reify =<< normalForm norm t return $ OfType x t' -- | Returns the type of the expression in the current environment -- We wake up irrelevant variables just in case the user want to -- invoke that command in an irrelevant context. typeInCurrent :: Rewrite -> Expr -> TCM Expr typeInCurrent norm e = do (_,t) <- wakeIrrelevantVars $ inferExpr e v <- normalForm norm t reify v typeInMeta :: InteractionId -> Rewrite -> Expr -> TCM Expr typeInMeta ii norm e = do m <- lookupInteractionId ii mi <- getMetaInfo <$> lookupMeta m withMetaInfo mi $ typeInCurrent norm e withInteractionId :: InteractionId -> TCM a -> TCM a withInteractionId i ret = do m <- lookupInteractionId i withMetaId m ret withMetaId :: MetaId -> TCM a -> TCM a withMetaId m ret = do mv <- lookupMeta m withMetaInfo' mv ret -- The intro tactic -- Returns the terms (as strings) that can be -- used to refine the goal. Uses the coverage checker -- to find out which constructors are possible. introTactic :: Bool -> InteractionId -> TCM [String] introTactic pmLambda ii = do mi <- lookupInteractionId ii mv <- lookupMeta mi withMetaInfo (getMetaInfo mv) $ case mvJudgement mv of HasType _ t -> do t <- reduce =<< piApply t <$> getContextArgs -- Andreas, 2013-03-05 Issue 810: skip hidden domains in introduction -- of constructor. TelV tel' t <- telViewUpTo' (-1) notVisible t -- if we cannot introduce a constructor, we try a lambda let fallback = do TelV tel _ <- telView t reportSDoc "interaction.intro" 20 $ TP.sep [ TP.text "introTactic/fallback" , TP.text "tel' = " TP.<+> prettyTCM tel' , TP.text "tel = " TP.<+> prettyTCM tel ] case (tel', tel) of (EmptyTel, EmptyTel) -> return [] _ -> introFun (telToList tel' ++ telToList tel) case ignoreSharing $ unEl t of I.Def d _ -> do def <- getConstInfo d case theDef def of Datatype{} -> addCtxTel tel' $ introData t Record{ recNamedCon = name } | name -> addCtxTel tel' $ introData t | otherwise -> addCtxTel tel' $ introRec d _ -> fallback _ -> fallback `catchError` \_ -> return [] _ -> __IMPOSSIBLE__ where conName [p] = [ c | I.ConP c _ _ <- [namedArg p] ] conName _ = __IMPOSSIBLE__ showTCM v = show <$> prettyTCM v introFun tel = addCtxTel tel' $ do reportSDoc "interaction.intro" 10 $ do TP.text "introFun" TP.<+> prettyTCM (telFromList tel) imp <- showImplicitArguments let okHiding0 h = imp || h == NotHidden -- if none of the vars were displayed, we would get a parse error -- thus, we switch to displaying all allHidden = null (filter okHiding0 hs) okHiding = if allHidden then const True else okHiding0 vars <- -- setShowImplicitArguments (imp || allHidden) $ (if allHidden then withShowAllArguments else id) $ mapM showTCM [ setHiding h $ defaultArg $ var i :: I.Arg Term | (h, i) <- zip hs $ downFrom n , okHiding h ] if pmLambda then return [ unwords $ ["λ", "{"] ++ vars ++ ["→", "?", "}"] ] else return [ unwords $ ["λ"] ++ vars ++ ["→", "?"] ] where n = size tel hs = map getHiding tel tel' = telFromList [ fmap makeName b | b <- tel ] makeName ("_", t) = ("x", t) makeName (x, t) = (x, t) introData t = do let tel = telFromList [domFromArg $ defaultArg ("_", t)] pat = [defaultArg $ unnamed $ I.VarP "c"] r <- splitLast CoInductive tel pat case r of Left err -> return [] Right cov -> mapM showTCM $ concatMap (conName . scPats) $ splitClauses cov introRec :: QName -> TCM [String] introRec d = do hfs <- getRecordFieldNames d fs <- ifM showImplicitArguments (return $ map unArg hfs) (return [ unArg a | a <- hfs, getHiding a == NotHidden ]) let e = C.Rec noRange $ map (, C.QuestionMark noRange Nothing) fs return [ prettyShow e ] -- | Runs the given computation as if in an anonymous goal at the end -- of the top-level module. -- -- Sets up current module, scope, and context. atTopLevel :: TCM a -> TCM a atTopLevel m = inConcreteMode $ do let err = typeError $ GenericError "The file has not been loaded yet." caseMaybeM (use stCurrentModule) err $ \ current -> do caseMaybeM (getVisitedModule $ toTopLevelModuleName current) __IMPOSSIBLE__ $ \ mi -> do let scope = iInsideScope $ miInterface mi tel <- lookupSection current -- Get the names of the local variables from @scope@ -- and put them into the context. let names :: [A.Name] names = reverse $ map snd $ notShadowedLocals $ scopeLocals scope types :: [I.Dom I.Type] types = map (snd <$>) $ telToList tel gamma :: ListTel' A.Name gamma = zipWith' (\ x dom -> (x,) <$> dom) names types M.withCurrentModule current $ withScope_ scope $ addContext gamma $ m -- | Parse a name. parseName :: Range -> String -> TCM C.QName parseName r s = do m <- parseExpr r s case m of C.Ident m -> return m C.RawApp _ [C.Ident m] -> return m _ -> typeError $ GenericError $ "Not an identifier: " ++ show m ++ "." -- | Returns the contents of the given module. moduleContents :: Rewrite -- ^ How should the types be presented -> Range -- ^ The range of the next argument. -> String -- ^ The module name. -> TCM ([C.Name], [(C.Name, Type)]) -- ^ Module names, names paired up with -- corresponding types. moduleContents norm rng s = do m <- parseName rng s modScope <- getNamedScope . amodName =<< resolveModule m let modules :: ThingsInScope AbstractModule modules = exportedNamesInScope modScope names :: ThingsInScope AbstractName names = exportedNamesInScope modScope types <- mapM (\(x, n) -> do d <- getConstInfo $ anameName n t <- normalForm norm =<< (defType <$> instantiateDef d) return (x, t)) (concatMap (\(x, ns) -> map ((,) x) ns) $ Map.toList names) return (Map.keys modules, types) whyInScope :: String -> TCM (Maybe LocalVar, [AbstractName], [AbstractModule]) whyInScope s = do x <- parseName noRange s scope <- getScope return ( lookup x $ map (first C.QName) $ scopeLocals scope , scopeLookup x scope , scopeLookup x scope ) Agda-2.4.2.5/src/full/Agda/Interaction/FindFile.hs0000644000000000000000000001407512635075266017607 0ustar0000000000000000------------------------------------------------------------------------ -- | Functions which map between module names and file names. -- -- Note that file name lookups are cached in the 'TCState'. The code -- assumes that no Agda source files are added or removed from the -- include directories while the code is being type checked. ------------------------------------------------------------------------ module Agda.Interaction.FindFile ( toIFile , FindError(..), findErrorToTypeError , findFile, findFile', findFile'' , findInterfaceFile , checkModuleName , moduleName', moduleName , tests ) where import Control.Applicative import Control.Monad import Control.Monad.State.Class import Control.Monad.Trans import Data.List import Data.Map (Map) import qualified Data.Map as Map import System.FilePath import Agda.Syntax.Concrete import Agda.Syntax.Parser import Agda.TypeChecking.Monad.Base import Agda.TypeChecking.Monad.Benchmark (billTo) import qualified Agda.TypeChecking.Monad.Benchmark as Bench import {-# SOURCE #-} Agda.TypeChecking.Monad.Options (getIncludeDirs) import Agda.Utils.Except import Agda.Utils.FileName import Agda.Utils.Lens -- | Converts an Agda file name to the corresponding interface file -- name. toIFile :: AbsolutePath -> AbsolutePath toIFile f = mkAbsolute (replaceExtension (filePath f) ".agdai") -- | Errors which can arise when trying to find a source file. -- -- Invariant: All paths are absolute. data FindError = NotFound [AbsolutePath] -- ^ The file was not found. It should have had one of the given -- file names. | Ambiguous [AbsolutePath] -- ^ Several matching files were found. -- -- Invariant: The list of matching files has at least two -- elements. -- | Given the module name which the error applies to this function -- converts a 'FindError' to a 'TypeError'. findErrorToTypeError :: TopLevelModuleName -> FindError -> TypeError findErrorToTypeError m (NotFound files) = FileNotFound m files findErrorToTypeError m (Ambiguous files) = AmbiguousTopLevelModuleName m files -- | Finds the source file corresponding to a given top-level module -- name. The returned paths are absolute. -- -- Raises an error if the file cannot be found. findFile :: TopLevelModuleName -> TCM AbsolutePath findFile m = do mf <- findFile' m case mf of Left err -> typeError $ findErrorToTypeError m err Right f -> return f -- | Tries to find the source file corresponding to a given top-level -- module name. The returned paths are absolute. -- -- SIDE EFFECT: Updates 'stModuleToSource'. findFile' :: TopLevelModuleName -> TCM (Either FindError AbsolutePath) findFile' m = do dirs <- getIncludeDirs modFile <- use stModuleToSource (r, modFile) <- liftIO $ findFile'' dirs m modFile stModuleToSource .= modFile return r -- | A variant of 'findFile'' which does not require 'TCM'. findFile'' :: [AbsolutePath] -- ^ Include paths. -> TopLevelModuleName -> ModuleToSource -- ^ Cached invocations of 'findFile'''. An updated copy is returned. -> IO (Either FindError AbsolutePath, ModuleToSource) findFile'' dirs m modFile = case Map.lookup m modFile of Just f -> return (Right f, modFile) Nothing -> do files <- mapM absolute [ filePath dir file | dir <- dirs , file <- map (moduleNameToFileName m) [".agda", ".lagda"] ] existingFiles <- liftIO $ filterM (doesFileExistCaseSensitive . filePath) files return $ case nub existingFiles of [] -> (Left (NotFound files), modFile) [file] -> (Right file, Map.insert m file modFile) files -> (Left (Ambiguous files), modFile) -- | Finds the interface file corresponding to a given top-level -- module name. The returned paths are absolute. -- -- Raises an error if the source file cannot be found, and returns -- 'Nothing' if the source file can be found but not the interface -- file. findInterfaceFile :: TopLevelModuleName -> TCM (Maybe AbsolutePath) findInterfaceFile m = do f <- toIFile <$> findFile m ex <- liftIO $ doesFileExistCaseSensitive $ filePath f return $ if ex then Just f else Nothing -- | Ensures that the module name matches the file name. The file -- corresponding to the module name (according to the include path) -- has to be the same as the given file name. checkModuleName :: TopLevelModuleName -- ^ The name of the module. -> AbsolutePath -- ^ The file from which it was loaded. -> TCM () checkModuleName name file = do moduleShouldBeIn <- findFile' name case moduleShouldBeIn of Left (NotFound files) -> typeError $ ModuleNameDoesntMatchFileName name files Left (Ambiguous files) -> typeError $ AmbiguousTopLevelModuleName name files Right file' -> do file <- liftIO $ absolute (filePath file) if file === file' then return () else typeError $ ModuleDefinedInOtherFile name file file' -- | Computes the module name of the top-level module in the given file. -- -- Warning! Parses the whole file to get the module name out. -- Use wisely! moduleName' :: AbsolutePath -> TCM TopLevelModuleName moduleName' file = billTo [Bench.ModuleName] $ do name <- topLevelModuleName <$> liftIO (parseFile' moduleParser file) case name of TopLevelModuleName ["_"] -> do _ <- liftIO (parse moduleNameParser defaultName) `catchError` \_ -> typeError $ GenericError $ "Invalid file name: " ++ show file ++ "." return $ TopLevelModuleName [defaultName] _ -> return name where defaultName = rootName file -- | A variant of 'moduleName'' which raises an error if the file name -- does not match the module name. -- -- The file name is interpreted relative to the current working -- directory (unless it is absolute). moduleName :: AbsolutePath -> TCM TopLevelModuleName moduleName file = do m <- moduleName' file checkModuleName m file return m Agda-2.4.2.5/src/full/Agda/Interaction/FindFile.hs-boot0000644000000000000000000000033112635075266020536 0ustar0000000000000000module Agda.Interaction.FindFile where import Data.Map (Map) import Agda.Syntax.Concrete.Name (TopLevelModuleName) import Agda.Utils.FileName (AbsolutePath) type ModuleToSource = Map TopLevelModuleName AbsolutePath Agda-2.4.2.5/src/full/Agda/Interaction/EmacsCommand.hs0000644000000000000000000000442312635075266020452 0ustar0000000000000000{-# LANGUAGE FlexibleInstances #-} ------------------------------------------------------------------------ -- | Code for instructing Emacs to do things ------------------------------------------------------------------------ module Agda.Interaction.EmacsCommand ( Lisp(..) , response , putResponse , display_info' , clearRunningInfo , displayRunningInfo ) where import Agda.Utils.Pretty import Agda.Utils.String -- | Simple Emacs Lisp expressions. data Lisp a = A a -- ^ Atom. | Cons (Lisp a) (Lisp a) -- Cons cell. | L [Lisp a] -- ^ List. | Q (Lisp a) -- Quoted expression. instance Pretty a => Pretty (Lisp a) where pretty (A a ) = pretty a pretty (Cons a b) = parens (pretty a <+> text "." <+> pretty b) pretty (L xs) = parens (hsep (map pretty xs)) pretty (Q x) = text "'" <> pretty x instance Pretty a => Show (Lisp a) where show = show . pretty -- | Formats a response command. -- -- Replaces @'\n'@ with spaces to ensure that each command is a -- single line. response :: Lisp String -> String response = (++ "\n") . map replaceNewLines . show . pretty where replaceNewLines '\n' = ' ' replaceNewLines c = c -- | Writes a response command to standard output. putResponse :: Lisp String -> IO () putResponse = putStr . response -- | @display_info' append header content@ displays @content@ (with -- header @header@) in some suitable way. If @append@ is @True@, then -- the content is appended to previous content (if any), otherwise any -- previous content is deleted. display_info' :: Bool -> String -> String -> Lisp String display_info' append bufname content = L [ A "agda2-info-action" , A (quote bufname) , A (quote content) , A (if append then "t" else "nil") ] ------------------------------------------------------------------------ -- Running info -- | The name of the running info buffer. runningInfoBufferName :: String runningInfoBufferName = "*Type-checking*" -- | Clear the running info buffer. clearRunningInfo :: Lisp String clearRunningInfo = display_info' False runningInfoBufferName "" -- | Display running information about what the type-checker is up to. displayRunningInfo :: String -> Lisp String displayRunningInfo s = display_info' True runningInfoBufferName s Agda-2.4.2.5/src/full/Agda/Interaction/Options.hs0000644000000000000000000007005712635075266017564 0ustar0000000000000000{-# LANGUAGE CPP #-} module Agda.Interaction.Options ( CommandLineOptions(..) , PragmaOptions(..) , OptionsPragma , Flag , Verbosity , IncludeDirs , checkOpts , parseStandardOptions , parsePragmaOptions , parsePluginOptions , defaultOptions , defaultInteractionOptions , defaultVerbosity , defaultCutOff , standardOptions_ , unsafePragmaOptions , isLiterate , mapFlag , usage , tests , defaultLibDir -- Reused by PandocAgda , inputFlag , standardOptions , getOptSimple ) where import Control.Monad ( when ) -- base-4.7 defines the Functor instances for OptDescr and ArgDescr #if !(MIN_VERSION_base(4,7,0)) import Data.Orphans () #endif import Data.Maybe import Data.List ( isSuffixOf , intercalate ) import System.Console.GetOpt ( getOpt', usageInfo, ArgOrder(ReturnInOrder) , OptDescr(..), ArgDescr(..) ) import System.Directory ( doesDirectoryExist ) import Text.EditDistance import Agda.Termination.CutOff ( CutOff(..) ) import Agda.Utils.TestHelpers ( runTests ) import Agda.Utils.QuickCheck ( quickCheck' ) import Agda.Utils.FileName ( absolute, AbsolutePath, filePath ) import Agda.Utils.Monad ( ifM, readM ) import Agda.Utils.List ( groupOn, wordsBy ) import Agda.Utils.String ( indent ) import Agda.Utils.Trie ( Trie ) import qualified Agda.Utils.Trie as Trie import Agda.Utils.Except ( MonadError(catchError, throwError) ) -- Paths_Agda.hs is in $(BUILD_DIR)/build/autogen/. import Paths_Agda ( getDataFileName ) -- | This should probably go somewhere else. isLiterate :: FilePath -> Bool isLiterate file = ".lagda" `isSuffixOf` file -- OptDescr is a Functor -------------------------------------------------- type Verbosity = Trie String Int type IncludeDirs = Either [FilePath] [AbsolutePath] -- ^ 'Left' is used temporarily, before the paths have -- been made absolute. An empty 'Left' list is -- interpreted as @["."]@ (see -- 'Agda.TypeChecking.Monad.Options.makeIncludeDirsAbsolute'). data CommandLineOptions = Options { optProgramName :: String , optInputFile :: Maybe FilePath , optIncludeDirs :: IncludeDirs , optShowVersion :: Bool , optShowHelp :: Bool , optInteractive :: Bool , optRunTests :: Bool , optGHCiInteraction :: Bool , optCompile :: Bool , optCompileNoMain :: Bool , optEpicCompile :: Bool , optJSCompile :: Bool , optCompileDir :: Maybe FilePath -- ^ In the absence of a path the project root is used. , optGenerateVimFile :: Bool , optGenerateLaTeX :: Bool , optGenerateHTML :: Bool , optDependencyGraph :: Maybe FilePath , optLaTeXDir :: FilePath , optHTMLDir :: FilePath , optCSSFile :: Maybe FilePath , optIgnoreInterfaces :: Bool , optForcing :: Bool , optGhcFlags :: [String] , optPragmaOptions :: PragmaOptions , optEpicFlags :: [String] , optSafe :: Bool } deriving Show -- | Options which can be set in a pragma. data PragmaOptions = PragmaOptions { optShowImplicit :: Bool , optShowIrrelevant :: Bool , optVerbose :: Verbosity , optProofIrrelevance :: Bool , optAllowUnsolved :: Bool , optDisablePositivity :: Bool , optTerminationCheck :: Bool , optTerminationDepth :: CutOff -- ^ Cut off structural order comparison at some depth in termination checker? , optCompletenessCheck :: Bool , optUniverseCheck :: Bool , optSizedTypes :: Bool , optInjectiveTypeConstructors :: Bool , optGuardingTypeConstructors :: Bool , optUniversePolymorphism :: Bool , optIrrelevantProjections :: Bool , optExperimentalIrrelevance :: Bool -- ^ irrelevant levels, irrelevant data matching , optWithoutK :: Bool , optCopatterns :: Bool -- ^ Allow definitions by copattern matching? , optPatternMatching :: Bool -- ^ Is pattern matching allowed in the current file? , optRewriting :: Bool -- ^ Can rewrite rules be added and used? } deriving Show -- | The options from an @OPTIONS@ pragma. -- -- In the future it might be nice to switch to a more structured -- representation. Note that, currently, there is not a one-to-one -- correspondence between list elements and options. type OptionsPragma = [String] -- | Map a function over the long options. Also removes the short options. -- Will be used to add the plugin name to the plugin options. mapFlag :: (String -> String) -> OptDescr a -> OptDescr a mapFlag f (Option _ long arg descr) = Option [] (map f long) arg descr defaultVerbosity :: Verbosity defaultVerbosity = Trie.singleton [] 1 defaultInteractionOptions :: PragmaOptions defaultInteractionOptions = defaultPragmaOptions defaultOptions :: CommandLineOptions defaultOptions = Options { optProgramName = "agda" , optInputFile = Nothing , optIncludeDirs = Left [] , optShowVersion = False , optShowHelp = False , optInteractive = False , optRunTests = False , optGHCiInteraction = False , optCompile = False , optCompileNoMain = False , optEpicCompile = False , optJSCompile = False , optCompileDir = Nothing , optGenerateVimFile = False , optGenerateLaTeX = False , optGenerateHTML = False , optDependencyGraph = Nothing , optLaTeXDir = defaultLaTeXDir , optHTMLDir = defaultHTMLDir , optCSSFile = Nothing , optIgnoreInterfaces = False , optForcing = True , optGhcFlags = [] , optPragmaOptions = defaultPragmaOptions , optEpicFlags = [] , optSafe = False } defaultPragmaOptions :: PragmaOptions defaultPragmaOptions = PragmaOptions { optShowImplicit = False , optShowIrrelevant = False , optVerbose = defaultVerbosity , optProofIrrelevance = False , optExperimentalIrrelevance = False , optIrrelevantProjections = True , optAllowUnsolved = False , optDisablePositivity = False , optTerminationCheck = True , optTerminationDepth = defaultCutOff , optCompletenessCheck = True , optUniverseCheck = True , optSizedTypes = True , optInjectiveTypeConstructors = False , optGuardingTypeConstructors = False , optUniversePolymorphism = True , optWithoutK = False , optCopatterns = True , optPatternMatching = True , optRewriting = False } -- | The default termination depth. defaultCutOff :: CutOff defaultCutOff = CutOff 0 -- minimum value -- | The default output directory for LaTeX. defaultLaTeXDir :: String defaultLaTeXDir = "latex" -- | The default output directory for HTML. defaultHTMLDir :: String defaultHTMLDir = "html" prop_defaultOptions :: Bool prop_defaultOptions = case checkOpts defaultOptions of Left _ -> False Right _ -> True {- | @f :: Flag opts@ is an action on the option record that results from parsing an option. @f opts@ produces either an error message or an updated options record -} type Flag opts = opts -> Either String opts -- | Checks that the given options are consistent. checkOpts :: Flag CommandLineOptions checkOpts opts | not (atMostOne [optAllowUnsolved . p, \x -> optCompile x]) = Left "Unsolved meta variables are not allowed when compiling.\n" | optCompileNoMain opts && not (optCompile opts) = Left "--no-main only allowed in combination with --compile.\n" | not (atMostOne [optGHCiInteraction, isJust . optInputFile]) = Left "Choose at most one: input file or --interaction.\n" | not (atMostOne $ interactive ++ [\x -> optCompile x, optEpicCompile, optJSCompile]) = Left "Choose at most one: compilers/--interactive/--interaction.\n" | not (atMostOne $ interactive ++ [optGenerateHTML]) = Left "Choose at most one: --html/--interactive/--interaction.\n" | not (atMostOne $ interactive ++ [isJust . optDependencyGraph]) = Left "Choose at most one: --dependency-graph/--interactive/--interaction.\n" | not (atMostOne [ optUniversePolymorphism . p , not . optUniverseCheck . p ]) = Left "Cannot have both universe polymorphism and type in type.\n" | not (atMostOne $ interactive ++ [optGenerateLaTeX]) = Left "Choose at most one: --latex/--interactive/--interaction.\n" | (not . null . optEpicFlags $ opts) && not (optEpicCompile opts) = Left "Cannot set Epic flags without using the Epic backend.\n" | otherwise = Right opts where atMostOne bs = length (filter ($ opts) bs) <= 1 p = optPragmaOptions interactive = [optInteractive, optGHCiInteraction] -- | Check for unsafe pramas. Gives a list of used unsafe flags. unsafePragmaOptions :: PragmaOptions -> [String] unsafePragmaOptions opts = [ "--allow-unsolved-metas" | optAllowUnsolved opts ] ++ [ "--no-positivity-check" | optDisablePositivity opts ] ++ [ "--no-termination-check" | not (optTerminationCheck opts) ] ++ [ "--no-coverage-check" | not (optCompletenessCheck opts) ] ++ [ "--type-in-type" | not (optUniverseCheck opts) ] ++ -- [ "--sized-types" | optSizedTypes opts ] ++ [ "--injective-type-constructors" | optInjectiveTypeConstructors opts ] ++ [ "--guardedness-preserving-type-constructors" | optGuardingTypeConstructors opts ] ++ [ "--experimental-irrelevance" | optExperimentalIrrelevance opts ] ++ [ "--rewriting" | optRewriting opts ] ++ [] -- | The default pragma options should be considered safe. defaultPragmaOptionsSafe :: IO Bool defaultPragmaOptionsSafe | null unsafe = return True | otherwise = do putStrLn $ "Following pragmas are default but not safe: " ++ intercalate ", " unsafe return False where unsafe = unsafePragmaOptions defaultPragmaOptions inputFlag :: FilePath -> Flag CommandLineOptions inputFlag f o = case optInputFile o of Nothing -> return $ o { optInputFile = Just f } Just _ -> throwError "only one input file allowed" versionFlag :: Flag CommandLineOptions versionFlag o = return $ o { optShowVersion = True } helpFlag :: Flag CommandLineOptions helpFlag o = return $ o { optShowHelp = True } safeFlag :: Flag CommandLineOptions safeFlag o = return $ o { optSafe = True } proofIrrelevanceFlag :: Flag PragmaOptions proofIrrelevanceFlag o = return $ o { optProofIrrelevance = True } experimentalIrrelevanceFlag :: Flag PragmaOptions experimentalIrrelevanceFlag o = return $ o { optExperimentalIrrelevance = True } noIrrelevantProjectionsFlag :: Flag PragmaOptions noIrrelevantProjectionsFlag o = return $ o { optIrrelevantProjections = False } ignoreInterfacesFlag :: Flag CommandLineOptions ignoreInterfacesFlag o = return $ o { optIgnoreInterfaces = True } allowUnsolvedFlag :: Flag PragmaOptions allowUnsolvedFlag o = return $ o { optAllowUnsolved = True } showImplicitFlag :: Flag PragmaOptions showImplicitFlag o = return $ o { optShowImplicit = True } showIrrelevantFlag :: Flag PragmaOptions showIrrelevantFlag o = return $ o { optShowIrrelevant = True } runTestsFlag :: Flag CommandLineOptions runTestsFlag o = return $ o { optRunTests = True } ghciInteractionFlag :: Flag CommandLineOptions ghciInteractionFlag o = return $ o { optGHCiInteraction = True } vimFlag :: Flag CommandLineOptions vimFlag o = return $ o { optGenerateVimFile = True } latexFlag :: Flag CommandLineOptions latexFlag o = return $ o { optGenerateLaTeX = True } latexDirFlag :: FilePath -> Flag CommandLineOptions latexDirFlag d o = return $ o { optLaTeXDir = d } noPositivityFlag :: Flag PragmaOptions noPositivityFlag o = return $ o { optDisablePositivity = True } dontTerminationCheckFlag :: Flag PragmaOptions dontTerminationCheckFlag o = return $ o { optTerminationCheck = False } dontCompletenessCheckFlag :: Flag PragmaOptions dontCompletenessCheckFlag o = return $ o { optCompletenessCheck = False } dontUniverseCheckFlag :: Flag PragmaOptions dontUniverseCheckFlag o = return $ o { optUniverseCheck = False , optUniversePolymorphism = False } sizedTypes :: Flag PragmaOptions sizedTypes o = return $ o { optSizedTypes = True } noSizedTypes :: Flag PragmaOptions noSizedTypes o = return $ o { optSizedTypes = False } injectiveTypeConstructorFlag :: Flag PragmaOptions injectiveTypeConstructorFlag o = return $ o { optInjectiveTypeConstructors = True } guardingTypeConstructorFlag :: Flag PragmaOptions guardingTypeConstructorFlag o = return $ o { optGuardingTypeConstructors = True } universePolymorphismFlag :: Flag PragmaOptions universePolymorphismFlag o = return $ o { optUniversePolymorphism = True } noUniversePolymorphismFlag :: Flag PragmaOptions noUniversePolymorphismFlag o = return $ o { optUniversePolymorphism = False } noForcingFlag :: Flag CommandLineOptions noForcingFlag o = return $ o { optForcing = False } withKFlag :: Flag PragmaOptions withKFlag o = return $ o { optWithoutK = False } withoutKFlag :: Flag PragmaOptions withoutKFlag o = return $ o { optWithoutK = True } copatternsFlag :: Flag PragmaOptions copatternsFlag o = return $ o { optCopatterns = True } noCopatternsFlag :: Flag PragmaOptions noCopatternsFlag o = return $ o { optCopatterns = False } noPatternMatchingFlag :: Flag PragmaOptions noPatternMatchingFlag o = return $ o { optPatternMatching = False } rewritingFlag :: Flag PragmaOptions rewritingFlag o = return $ o { optRewriting = True } interactiveFlag :: Flag CommandLineOptions interactiveFlag o = return $ o { optInteractive = True , optPragmaOptions = (optPragmaOptions o) { optAllowUnsolved = True } } compileFlag :: Flag CommandLineOptions compileFlag o = return $ o { optCompile = True } compileFlagNoMain :: Flag CommandLineOptions compileFlagNoMain o = return $ o { optCompileNoMain = True } -- The Epic backend has been removed. See Issue 1481. compileEpicFlag :: Flag CommandLineOptions -- compileEpicFlag o = return $ o { optEpicCompile = True} compileEpicFlag o = throwError "the Epic backend has been disabled" compileJSFlag :: Flag CommandLineOptions compileJSFlag o = return $ o { optJSCompile = True } compileDirFlag :: FilePath -> Flag CommandLineOptions compileDirFlag f o = return $ o { optCompileDir = Just f } -- NOTE: Quadratic in number of flags. ghcFlag :: String -> Flag CommandLineOptions ghcFlag f o = return $ o { optGhcFlags = optGhcFlags o ++ [f] } -- NOTE: Quadratic in number of flags. -- The Epic backend has been removed. See Issue 1481. epicFlagsFlag :: String -> Flag CommandLineOptions -- epicFlagsFlag s o = return $ o { optEpicFlags = optEpicFlags o ++ [s] } epicFlagsFlag s o = throwError "the Epic backend has been disabled" htmlFlag :: Flag CommandLineOptions htmlFlag o = return $ o { optGenerateHTML = True } dependencyGraphFlag :: FilePath -> Flag CommandLineOptions dependencyGraphFlag f o = return $ o { optDependencyGraph = Just f } htmlDirFlag :: FilePath -> Flag CommandLineOptions htmlDirFlag d o = return $ o { optHTMLDir = d } cssFlag :: FilePath -> Flag CommandLineOptions cssFlag f o = return $ o { optCSSFile = Just f } includeFlag :: FilePath -> Flag CommandLineOptions includeFlag d o = return $ o { optIncludeDirs = Left (d : ds) } where ds = either id (const []) $ optIncludeDirs o verboseFlag :: String -> Flag PragmaOptions verboseFlag s o = do (k,n) <- parseVerbose s return $ o { optVerbose = Trie.insert k n $ optVerbose o } where parseVerbose s = case wordsBy (`elem` ":.") s of [] -> usage ss -> do n <- readM (last ss) `catchError` \_ -> usage return (init ss, n) usage = throwError "argument to verbose should be on the form x.y.z:N or N" terminationDepthFlag :: String -> Flag PragmaOptions terminationDepthFlag s o = do k <- readM s `catchError` \_ -> usage when (k < 1) $ usage -- or: turn termination checking off for 0 return $ o { optTerminationDepth = CutOff $ k-1 } where usage = throwError "argument to termination-depth should be >= 1" integerArgument :: String -> String -> Either String Int integerArgument flag s = readM s `catchError` \_ -> throwError $ "option '" ++ flag ++ "' requires an integer argument" standardOptions :: [OptDescr (Flag CommandLineOptions)] standardOptions = [ Option ['V'] ["version"] (NoArg versionFlag) "show version number" , Option ['?'] ["help"] (NoArg helpFlag) "show this help" , Option ['I'] ["interactive"] (NoArg interactiveFlag) "start in interactive mode" , Option [] ["interaction"] (NoArg ghciInteractionFlag) "for use with the Emacs mode" , Option ['c'] ["compile"] (NoArg compileFlag) "compile program using the MAlonzo backend (experimental)" , Option [] ["no-main"] (NoArg compileFlagNoMain) "when compiling using the MAlonzo backend (experimental), do not treat the requested module as the main module of a program" -- The Epic backend has been removed. See Issue 1481. , Option [] ["epic"] (NoArg compileEpicFlag) -- "compile program using the Epic backend" "the Epic backend has been removed" , Option [] ["js"] (NoArg compileJSFlag) "compile program using the JS backend" , Option [] ["compile-dir"] (ReqArg compileDirFlag "DIR") ("directory for compiler output (default: the project root)") , Option [] ["ghc-flag"] (ReqArg ghcFlag "GHC-FLAG") "give the flag GHC-FLAG to GHC when compiling using MAlonzo" -- The Epic backend has been removed. See Issue 1481. , Option [] ["epic-flag"] (ReqArg epicFlagsFlag "EPIC-FLAG") -- "give the flag EPIC-FLAG to Epic when compiling using Epic" "the Epic backend has been removed" , Option [] ["test"] (NoArg runTestsFlag) "run internal test suite" , Option [] ["vim"] (NoArg vimFlag) "generate Vim highlighting files" , Option [] ["latex"] (NoArg latexFlag) "generate LaTeX with highlighted source code" , Option [] ["latex-dir"] (ReqArg latexDirFlag "DIR") ("directory in which LaTeX files are placed (default: " ++ defaultLaTeXDir ++ ")") , Option [] ["html"] (NoArg htmlFlag) "generate HTML files with highlighted source code" , Option [] ["dependency-graph"] (ReqArg dependencyGraphFlag "FILE") "generate a Dot file with a module dependency graph" , Option [] ["html-dir"] (ReqArg htmlDirFlag "DIR") ("directory in which HTML files are placed (default: " ++ defaultHTMLDir ++ ")") , Option [] ["css"] (ReqArg cssFlag "URL") "the CSS file used by the HTML files (can be relative)" , Option [] ["ignore-interfaces"] (NoArg ignoreInterfacesFlag) "ignore interface files (re-type check everything)" , Option ['i'] ["include-path"] (ReqArg includeFlag "DIR") "look for imports in DIR" , Option [] ["no-forcing"] (NoArg noForcingFlag) "disable the forcing optimisation" , Option [] ["safe"] (NoArg safeFlag) "disable postulates, unsafe OPTION pragmas and primTrustMe" ] ++ map (fmap lift) pragmaOptions where lift :: Flag PragmaOptions -> Flag CommandLineOptions lift f = \opts -> do ps <- f (optPragmaOptions opts) return (opts { optPragmaOptions = ps }) pragmaOptions :: [OptDescr (Flag PragmaOptions)] pragmaOptions = [ Option [] ["show-implicit"] (NoArg showImplicitFlag) "show implicit arguments when printing" , Option [] ["show-irrelevant"] (NoArg showIrrelevantFlag) "show irrelevant arguments when printing" , Option ['v'] ["verbose"] (ReqArg verboseFlag "N") "set verbosity level to N" -- , Option [] ["proof-irrelevance"] (NoArg proofIrrelevanceFlag) -- "enable proof irrelevance (experimental feature)" , Option [] ["allow-unsolved-metas"] (NoArg allowUnsolvedFlag) "allow unsolved meta variables (only needed in batch mode)" , Option [] ["no-positivity-check"] (NoArg noPositivityFlag) "do not warn about not strictly positive data types" , Option [] ["no-termination-check"] (NoArg dontTerminationCheckFlag) "do not warn about possibly nonterminating code" , Option [] ["termination-depth"] (ReqArg terminationDepthFlag "N") "allow termination checker to count decrease/increase upto N (default N=1)" , Option [] ["no-coverage-check"] (NoArg dontCompletenessCheckFlag) "do not warn about possibly incomplete pattern matches" , Option [] ["type-in-type"] (NoArg dontUniverseCheckFlag) "ignore universe levels (this makes Agda inconsistent)" , Option [] ["sized-types"] (NoArg sizedTypes) "use sized types (default, inconsistent with `musical' coinduction)" , Option [] ["no-sized-types"] (NoArg noSizedTypes) "disable sized types" , Option [] ["injective-type-constructors"] (NoArg injectiveTypeConstructorFlag) "enable injective type constructors (makes Agda anti-classical and possibly inconsistent)" , Option [] ["guardedness-preserving-type-constructors"] (NoArg guardingTypeConstructorFlag) "treat type constructors as inductive constructors when checking productivity" , Option [] ["no-universe-polymorphism"] (NoArg noUniversePolymorphismFlag) "disable universe polymorphism" , Option [] ["universe-polymorphism"] (NoArg universePolymorphismFlag) "enable universe polymorphism (default)" , Option [] ["no-irrelevant-projections"] (NoArg noIrrelevantProjectionsFlag) "disable projection of irrelevant record fields" , Option [] ["experimental-irrelevance"] (NoArg experimentalIrrelevanceFlag) "enable potentially unsound irrelevance features (irrelevant levels, irrelevant data matching)" , Option [] ["with-K"] (NoArg withKFlag) "enable the K rule in pattern matching" , Option [] ["without-K"] (NoArg withoutKFlag) "disable the K rule in pattern matching" , Option [] ["copatterns"] (NoArg copatternsFlag) "enable definitions by copattern matching (default)" , Option [] ["no-copatterns"] (NoArg noCopatternsFlag) "disable definitions by copattern matching" , Option [] ["no-pattern-matching"] (NoArg noPatternMatchingFlag) "disable pattern matching completely" , Option [] ["rewriting"] (NoArg rewritingFlag) "enable declaration and use of REWRITE rules" ] -- | Used for printing usage info. standardOptions_ :: [OptDescr ()] standardOptions_ = map (fmap $ const ()) standardOptions -- | Simple interface for System.Console.GetOpt -- Could be moved to Agda.Utils.Options (does not exist yet) getOptSimple :: [String] -- ^ command line argument words -> [OptDescr (Flag opts)] -- ^ options handlers -> (String -> Flag opts) -- ^ handler of non-options (only one is allowed) -> Flag opts -- ^ combined opts data structure transformer getOptSimple argv opts fileArg = \ defaults -> case getOpt' (ReturnInOrder fileArg) opts argv of (o, _, [] , [] ) -> foldl (>>=) (return defaults) o (_, _, unrecognized, errs) -> throwError $ umsg ++ emsg where ucap = "Unrecognized " ++ plural unrecognized "option" ++ ":" ecap = plural errs "Option error" ++ ":" umsg = if null unrecognized then "" else unlines $ ucap : map suggest unrecognized emsg = if null errs then "" else unlines $ ecap : errs plural [_] x = x plural _ x = x ++ "s" -- Suggest alternatives that are at most 3 typos away longopts :: [String] longopts = map ("--" ++) $ concat $ map (\ (Option _ long _ _) -> long) opts dist :: String -> String -> Int dist s t = restrictedDamerauLevenshteinDistance defaultEditCosts s t close :: String -> String -> Maybe (Int, String) close s t = let d = dist s t in if d <= 3 then Just (d, t) else Nothing closeopts :: String -> [(Int, String)] closeopts s = mapMaybe (close s) longopts alts :: String -> [[String]] alts s = map (map snd) $ groupOn fst $ closeopts s suggest :: String -> String suggest s = case alts s of [] -> s as : _ -> s ++ " (did you mean " ++ sugs as ++ " ?)" sugs :: [String] -> String sugs [a] = a sugs as = "any of " ++ intercalate " " as -- | Parse the standard options. parseStandardOptions :: [String] -> Either String CommandLineOptions parseStandardOptions argv = checkOpts =<< getOptSimple argv standardOptions inputFlag defaultOptions -- | Parse options from an options pragma. parsePragmaOptions :: [String] -- ^ Pragma options. -> CommandLineOptions -- ^ Command-line options which should be updated. -> Either String PragmaOptions parsePragmaOptions argv opts = do ps <- getOptSimple argv pragmaOptions (\s _ -> throwError $ "Bad option in pragma: " ++ s) (optPragmaOptions opts) _ <- checkOpts (opts { optPragmaOptions = ps }) return ps -- | Parse options for a plugin. parsePluginOptions :: [String] -> [OptDescr (Flag opts)] -> Flag opts parsePluginOptions argv opts = getOptSimple argv opts (\s _ -> throwError $ "Internal error: Flag " ++ s ++ " passed to a plugin") -- | The usage info message. The argument is the program name (probably -- agda). usage :: [OptDescr ()] -> [(String, String, [String], [OptDescr ()])] -> String -> String usage options pluginInfos progName = usageInfo (header progName) options ++ "\nPlugins:\n" ++ indent 2 (concatMap pluginMsg pluginInfos) where header progName = unlines [ "Agda" , "" , "Usage: " ++ progName ++ " [OPTIONS...] [FILE]" ] pluginMsg (name, help, inherited, opts) | null opts && null inherited = optHeader | otherwise = usageInfo (optHeader ++ " Plugin-specific options:" ++ inheritedOptions inherited ) opts where optHeader = "\n" ++ name ++ "-plugin:\n" ++ indent 2 help inheritedOptions [] = "" inheritedOptions pls = "\n Inherits options from: " ++ unwords pls ------------------------------------------------------------------------ -- Some paths -- | Returns the absolute default lib dir. This directory is used to -- store the Primitive.agda file. defaultLibDir :: IO FilePath defaultLibDir = do libdir <- fmap filePath (absolute =<< getDataFileName "lib") ifM (doesDirectoryExist libdir) (return libdir) (error $ "The lib directory " ++ libdir ++ " does not exist") ------------------------------------------------------------------------ -- All tests tests :: IO Bool tests = runTests "Agda.Interaction.Options" [ quickCheck' prop_defaultOptions , defaultPragmaOptionsSafe ] Agda-2.4.2.5/src/full/Agda/Interaction/Response.hs0000644000000000000000000001063112635075266017717 0ustar0000000000000000{-# LANGUAGE CPP #-} {-# LANGUAGE FlexibleInstances #-} ------------------------------------------------------------------------ -- | Data type for all interactive responses ------------------------------------------------------------------------ module Agda.Interaction.Response ( Response (..) , MakeCaseVariant (..) , DisplayInfo (..) , Status (..) , GiveResult (..) , InteractionOutputCallback , defaultInteractionOutputCallback ) where import Agda.Interaction.Highlighting.Precise import {-# SOURCE #-} Agda.TypeChecking.Monad.Base import Agda.Syntax.Common (InteractionId(..)) import Agda.Syntax.Concrete (Expr) import Agda.Utils.Pretty import Control.Monad.Trans import Data.Int import System.IO #include "undefined.h" import Agda.Utils.Impossible -- | Responses for any interactive interface -- -- Note that the response is given in pieces and incrementally, -- so the user can have timely response even during long computations. data Response = Resp_HighlightingInfo HighlightingInfo ModuleToSource | Resp_Status Status | Resp_JumpToError FilePath Int32 | Resp_InteractionPoints [InteractionId] | Resp_GiveAction InteractionId GiveResult | Resp_MakeCase MakeCaseVariant [String] | Resp_SolveAll [(InteractionId, Expr)] | Resp_DisplayInfo DisplayInfo | Resp_RunningInfo Int String -- ^ The integer is the message's debug level. | Resp_ClearRunningInfo | Resp_ClearHighlighting -- | There are two kinds of \"make case\" commands. data MakeCaseVariant = Function | ExtendedLambda -- | Info to display at the end of an interactive command data DisplayInfo = Info_CompilationOk | Info_Constraints String | Info_AllGoals String | Info_Error String -- ^ When an error message is displayed this constructor should be -- used, if appropriate. | Info_Intro Doc -- ^ 'Info_Intro' denotes two different types of errors -- TODO: split these into separate constructors | Info_Auto String -- ^ 'Info_Auto' denotes either an error or a success (when 'Resp_GiveAction' is present) -- TODO: split these into separate constructors | Info_ModuleContents Doc | Info_WhyInScope Doc | Info_NormalForm Doc | Info_GoalType Doc | Info_CurrentGoal Doc | Info_InferredType Doc | Info_Context Doc | Info_HelperFunction Doc | Info_Version deriving Show -- | Status information. data Status = Status { sShowImplicitArguments :: Bool -- ^ Are implicit arguments displayed? , sChecked :: Bool -- ^ Has the module been successfully type checked? } -- | Give action result -- -- Comment derived from agda2-mode.el -- -- If 'GiveResult' is 'Give_String s', then the goal is replaced by 's', -- and otherwise the text inside the goal is retained (parenthesised -- if 'GiveResult' is 'Give_Paren'). data GiveResult = Give_String String | Give_Paren | Give_NoParen -- | Callback fuction to call when there is a response -- to give to the interactive frontend. -- -- Note that the response is given in pieces and incrementally, -- so the user can have timely response even during long computations. -- -- Typical 'InteractionOutputCallback' functions: -- -- * Convert the response into a 'String' representation and -- print it on standard output -- (suitable for inter-process communication). -- -- * Put the response into a mutable variable stored in the -- closure of the 'InteractionOutputCallback' function. -- (suitable for intra-process communication). type InteractionOutputCallback = Response -> TCM () -- | The default 'InteractionOutputCallback' function prints certain -- things to stdout (other things generate internal errors). defaultInteractionOutputCallback :: InteractionOutputCallback defaultInteractionOutputCallback r = case r of Resp_HighlightingInfo {} -> __IMPOSSIBLE__ Resp_Status {} -> __IMPOSSIBLE__ Resp_JumpToError {} -> __IMPOSSIBLE__ Resp_InteractionPoints {} -> __IMPOSSIBLE__ Resp_GiveAction {} -> __IMPOSSIBLE__ Resp_MakeCase {} -> __IMPOSSIBLE__ Resp_SolveAll {} -> __IMPOSSIBLE__ Resp_DisplayInfo {} -> __IMPOSSIBLE__ Resp_RunningInfo _ s -> liftIO $ do putStr s hFlush stdout Resp_ClearRunningInfo {} -> __IMPOSSIBLE__ Resp_ClearHighlighting {} -> __IMPOSSIBLE__ Agda-2.4.2.5/src/full/Agda/Interaction/EmacsTop.hs0000644000000000000000000001204012635075266017630 0ustar0000000000000000-- {-# LANGUAGE CPP #-} {-# LANGUAGE FlexibleInstances #-} module Agda.Interaction.EmacsTop ( mimicGHCi ) where import Control.Applicative import Control.Monad.State import Data.Char import Data.List import Data.Maybe import System.IO import Agda.Utils.Monad import Agda.Utils.Pretty import Agda.Utils.String import Agda.Syntax.Common import Agda.TypeChecking.Monad import Agda.Interaction.Response as R import Agda.Interaction.InteractionTop import Agda.Interaction.EmacsCommand import Agda.Interaction.Highlighting.Emacs import Agda.Version ---------------------------------- -- | 'mimicGHCi' is a fake ghci interpreter for the Emacs frontend -- and for interaction tests. -- -- 'mimicGHCi' reads the Emacs frontend commands from stdin, -- interprets them and print the result into stdout. mimicGHCi :: TCM () mimicGHCi = do liftIO $ do hSetBuffering stdout NoBuffering hSetEncoding stdout utf8 hSetEncoding stdin utf8 setInteractionOutputCallback $ liftIO . mapM_ print <=< lispifyResponse opts <- commandLineOptions _ <- interact' `runStateT` initCommandState { optionsOnReload = opts } return () where interact' :: CommandM () interact' = do liftIO $ putStr "Agda2> " unlessM (liftIO isEOF) $ do r <- liftIO getLine _ <- return $! length r -- force to read the full input line case dropWhile isSpace r of "" -> return () ('-':'-':_) -> return () _ -> case listToMaybe $ reads r of Just (x, "") -> runInteraction x Just (_, rem) -> liftIO $ putStrLn $ "not consumed: " ++ rem _ -> liftIO $ putStrLn $ "cannot read: " ++ r interact' -- | Convert Response to an elisp value for the interactive emacs frontend. lispifyResponse :: Response -> TCM [Lisp String] lispifyResponse (Resp_HighlightingInfo info modFile) = (:[]) <$> lispifyHighlightingInfo info modFile lispifyResponse (Resp_DisplayInfo info) = return $ case info of Info_CompilationOk -> f "The module was successfully compiled." "*Compilation result*" Info_Constraints s -> f s "*Constraints*" Info_AllGoals s -> f s "*All Goals*" Info_Auto s -> f s "*Auto*" Info_Error s -> f s "*Error*" Info_NormalForm s -> f (render s) "*Normal Form*" -- show? Info_InferredType s -> f (render s) "*Inferred Type*" Info_CurrentGoal s -> f (render s) "*Current Goal*" Info_GoalType s -> f (render s) "*Goal type etc.*" Info_ModuleContents s -> f (render s) "*Module contents*" Info_WhyInScope s -> f (render s) "*Scope Info*" Info_Context s -> f (render s) "*Context*" Info_HelperFunction s -> [ L [ A "agda2-info-action-and-copy" , A $ quote "*Helper function*" , A $ quote (render s ++ "\n") , A "nil" ] ] Info_Intro s -> f (render s) "*Intro*" Info_Version -> f ("Agda version " ++ version) "*Agda Version*" where f content bufname = [ display_info' False bufname content ] lispifyResponse Resp_ClearHighlighting = return [ L [ A "agda2-highlight-clear" ] ] lispifyResponse Resp_ClearRunningInfo = return [ clearRunningInfo ] lispifyResponse (Resp_RunningInfo n s) | n <= 1 = return [ displayRunningInfo s ] | otherwise = return [ L [A "agda2-verbose", A (quote s)] ] lispifyResponse (Resp_Status s) = return [ L [ A "agda2-status-action" , A (quote $ intercalate "," $ catMaybes [checked, showImpl]) ] ] where boolToMaybe b x = if b then Just x else Nothing checked = boolToMaybe (sChecked s) "Checked" showImpl = boolToMaybe (sShowImplicitArguments s) "ShowImplicit" lispifyResponse (Resp_JumpToError f p) = return [ lastTag 3 $ L [ A "agda2-goto", Q $ L [A (quote f), A ".", A (show p)] ] ] lispifyResponse (Resp_InteractionPoints is) = return [ lastTag 1 $ L [A "agda2-goals-action", Q $ L $ map showNumIId is] ] lispifyResponse (Resp_GiveAction ii s) = return [ L [ A "agda2-give-action", showNumIId ii, A s' ] ] where s' = case s of Give_String str -> quote str Give_Paren -> "'paren" Give_NoParen -> "'no-paren" lispifyResponse (Resp_MakeCase variant pcs) = return [ lastTag 2 $ L [ A cmd, Q $ L $ map (A . quote) pcs ] ] where cmd = case variant of R.Function -> "agda2-make-case-action" R.ExtendedLambda -> "agda2-make-case-action-extendlam" lispifyResponse (Resp_SolveAll ps) = return [ lastTag 2 $ L [ A "agda2-solveAll-action", Q . L $ concatMap prn ps ] ] where prn (ii,e)= [showNumIId ii, A $ quote $ show e] -- | Adds a \"last\" tag to a response. lastTag :: Integer -> Lisp String -> Lisp String lastTag n r = Cons (Cons (A "last") (A $ show n)) r -- | Show an iteraction point identifier as an elisp expression. showNumIId :: InteractionId -> Lisp String showNumIId = A . tail . show Agda-2.4.2.5/src/full/Agda/Interaction/Highlighting/0000755000000000000000000000000012635075266020171 5ustar0000000000000000Agda-2.4.2.5/src/full/Agda/Interaction/Highlighting/Emacs.hs0000644000000000000000000000713412635075266021562 0ustar0000000000000000{-# LANGUAGE CPP #-} -- | Functions which give precise syntax highlighting info to Emacs. module Agda.Interaction.Highlighting.Emacs ( lispifyHighlightingInfo , Agda.Interaction.Highlighting.Emacs.tests ) where import Agda.Interaction.FindFile import Agda.Interaction.Highlighting.Precise import Agda.Interaction.Highlighting.Range import Agda.Interaction.EmacsCommand import Agda.Syntax.Common import Agda.TypeChecking.Monad (TCM, envHighlightingMethod, HighlightingMethod(..), ModuleToSource) import Agda.Utils.FileName import qualified Agda.Utils.IO.UTF8 as UTF8 import Agda.Utils.String import Agda.Utils.TestHelpers import Control.Applicative import qualified Control.Exception as E import Control.Monad.Reader import Data.Char import qualified Data.Map as Map import Data.Maybe import Data.Monoid import qualified System.Directory as D import qualified System.IO as IO #include "undefined.h" import Agda.Utils.Impossible ------------------------------------------------------------------------ -- Read/show functions -- | Converts the 'aspect' and 'otherAspects' fields to atoms readable -- by the Emacs interface. toAtoms :: Aspects -> [String] toAtoms m = map toAtom (otherAspects m) ++ toAtoms' (aspect m) where toAtom x = map toLower (show x) kindToAtom (Constructor Inductive) = "inductiveconstructor" kindToAtom (Constructor CoInductive) = "coinductiveconstructor" kindToAtom k = toAtom k toAtoms' Nothing = [] toAtoms' (Just (Name mKind op)) = map kindToAtom (maybeToList mKind) ++ opAtom where opAtom | op = ["operator"] | otherwise = [] toAtoms' (Just a) = [toAtom a] -- | Shows meta information in such a way that it can easily be read -- by Emacs. showAspects :: ModuleToSource -- ^ Must contain a mapping for the definition site's module, if any. -> (Range, Aspects) -> Lisp String showAspects modFile (r, m) = L $ ((map (A . show) [from r, to r]) ++ [L $ map A $ toAtoms m] ++ (A $ maybe "nil" quote $ note m) : defSite) where defSite = case definitionSite m of Nothing -> [] Just (m, p) -> case Map.lookup m modFile of Nothing -> __IMPOSSIBLE__ Just f -> [Cons (A $ quote $ filePath f) (A $ show p)] -- | Turns syntax highlighting information into a list of -- S-expressions. lispifyHighlightingInfo :: HighlightingInfo -> ModuleToSource -- ^ Must contain a mapping for every definition site's module. -> TCM (Lisp String) lispifyHighlightingInfo h modFile = do method <- envHighlightingMethod <$> ask liftIO $ case ranges h of _ | method == Direct -> direct ((_, mi) : _) | otherAspects mi == [TypeChecks] || mi == mempty -> direct _ -> indirect where info = map (showAspects modFile) (ranges h) direct = return $ L (A "agda2-highlight-add-annotations" : map Q info) indirect = do dir <- D.getTemporaryDirectory f <- E.bracket (IO.openTempFile dir "agda2-mode") (IO.hClose . snd) $ \ (f, h) -> do UTF8.hPutStr h (show $ L info) return f return $ L [ A "agda2-highlight-load-and-delete-action" , A (quote f) ] ------------------------------------------------------------------------ -- All tests -- TODO: One could check that the show functions are invertible. -- | All the properties. tests :: IO Bool tests = runTests "Agda.Interaction.Highlighting.Emacs" [] Agda-2.4.2.5/src/full/Agda/Interaction/Highlighting/Precise.hs0000644000000000000000000003575212635075266022133 0ustar0000000000000000{-# LANGUAGE DeriveDataTypeable #-} -- | Types used for precise syntax highlighting. module Agda.Interaction.Highlighting.Precise ( -- * Files Aspect(..) , NameKind(..) , OtherAspect(..) , Aspects(..) , File , HighlightingInfo -- ** Creation , singleton , several -- ** Inspection , smallestPos , toMap -- * Compressed files , CompressedFile(..) , compressedFileInvariant , compress , decompress , noHighlightingInRange -- ** Creation , singletonC , severalC , splitAtC -- ** Inspection , smallestPosC -- * Tests , Agda.Interaction.Highlighting.Precise.tests ) where import Agda.Utils.TestHelpers import Agda.Utils.String import Agda.Utils.List hiding (tests) import Data.List import Data.Function import Data.Monoid import Control.Applicative ((<$>), (<*>)) import Control.Monad import Agda.Utils.QuickCheck import Data.IntMap (IntMap) import qualified Data.IntMap as IntMap import Data.Map (Map) import qualified Data.Map as Map import Data.Typeable (Typeable) import qualified Agda.Syntax.Common as Common import qualified Agda.Syntax.Concrete as SC import Agda.Interaction.Highlighting.Range ------------------------------------------------------------------------ -- Files -- | Syntactic aspects of the code. (These cannot overlap.) -- They can be obtained from the lexed tokens already, -- except for the 'NameKind'. data Aspect = Comment | Keyword | String | Number | Symbol -- ^ Symbols like forall, =, ->, etc. | PrimitiveType -- ^ Things like Set and Prop. | Name (Maybe NameKind) Bool -- ^ Is the name an operator part? deriving (Eq, Show, Typeable) -- | @NameKind@s are figured our during scope checking. data NameKind = Bound -- ^ Bound variable. | Constructor Common.Induction -- ^ Inductive or coinductive constructor. | Datatype | Field -- ^ Record field. | Function | Module -- ^ Module name. | Postulate | Primitive -- ^ Primitive. | Record -- ^ Record type. | Argument -- ^ Named argument, like x in {x = v} deriving (Eq, Show, Typeable) -- | Other aspects, generated by type checking. -- (These can overlap with each other and with 'Aspect's.) data OtherAspect = Error | DottedPattern | UnsolvedMeta | UnsolvedConstraint -- ^ Unsolved constraint not connected to meta-variable. This -- could for instance be an emptyness constraint. | TerminationProblem | IncompletePattern -- ^ When this constructor is used it is probably a good idea to -- include a 'note' explaining why the pattern is incomplete. | TypeChecks -- ^ Code which is being type-checked. deriving (Eq, Show, Enum, Bounded, Typeable) -- | Meta information which can be associated with a -- character\/character range. data Aspects = Aspects { aspect :: Maybe Aspect , otherAspects :: [OtherAspect] , note :: Maybe String -- ^ This note, if present, can be displayed as a tool-tip or -- something like that. It should contain useful information about -- the range (like the module containing a certain identifier, or -- the fixity of an operator). , definitionSite :: Maybe (SC.TopLevelModuleName, Int) -- ^ The definition site of the annotated thing, if applicable and -- known. File positions are counted from 1. } deriving (Eq, Show, Typeable) -- | A 'File' is a mapping from file positions to meta information. -- -- The first position in the file has number 1. newtype File = File { mapping :: IntMap Aspects } deriving (Eq, Show, Typeable) -- | Syntax highlighting information. type HighlightingInfo = CompressedFile ------------------------------------------------------------------------ -- Creation -- | @'singleton' rs m@ is a file whose positions are those in @rs@, -- and in which every position is associated with @m@. singleton :: Ranges -> Aspects -> File singleton rs m = File { mapping = IntMap.fromAscList [ (p, m) | p <- rangesToPositions rs ] } -- | Like 'singleton', but with several 'Ranges' instead of only one. several :: [Ranges] -> Aspects -> File several rs m = mconcat $ map (\r -> singleton r m) rs ------------------------------------------------------------------------ -- Merging -- | Merges meta information. mergeAspects :: Aspects -> Aspects -> Aspects mergeAspects m1 m2 = Aspects { aspect = (mplus `on` aspect) m1 m2 , otherAspects = nub $ ((++) `on` otherAspects) m1 m2 , note = case (note m1, note m2) of (Just n1, Just n2) -> Just $ if n1 == n2 then n1 else addFinalNewLine n1 ++ "----\n" ++ n2 (Just n1, Nothing) -> Just n1 (Nothing, Just n2) -> Just n2 (Nothing, Nothing) -> Nothing , definitionSite = (mplus `on` definitionSite) m1 m2 } instance Monoid Aspects where mempty = Aspects { aspect = Nothing , otherAspects = [] , note = Nothing , definitionSite = Nothing } mappend = mergeAspects -- | Merges files. merge :: File -> File -> File merge f1 f2 = File { mapping = (IntMap.unionWith mappend `on` mapping) f1 f2 } instance Monoid File where mempty = File { mapping = IntMap.empty } mappend = merge ------------------------------------------------------------------------ -- Inspection -- | Returns the smallest position, if any, in the 'File'. smallestPos :: File -> Maybe Int smallestPos = fmap (fst . fst) . IntMap.minViewWithKey . mapping -- | Convert the 'File' to a map from file positions (counting from 1) -- to meta information. toMap :: File -> IntMap Aspects toMap = mapping ------------------------------------------------------------------------ -- Compressed files -- | A compressed 'File', in which consecutive positions with the same -- 'Aspects' are stored together. newtype CompressedFile = CompressedFile { ranges :: [(Range, Aspects)] } deriving (Eq, Show, Typeable) -- | Invariant for compressed files. -- -- Note that these files are not required to be /maximally/ -- compressed, because ranges are allowed to be empty, and the -- 'Aspects's in adjacent ranges are allowed to be equal. compressedFileInvariant :: CompressedFile -> Bool compressedFileInvariant (CompressedFile []) = True compressedFileInvariant (CompressedFile f) = all rangeInvariant rs && all (not . empty) rs && and (zipWith (<=) (map to $ init rs) (map from $ tail rs)) where rs = map fst f -- | Compresses a file by merging consecutive positions with equal -- meta information into longer ranges. compress :: File -> CompressedFile compress f = CompressedFile $ map join $ groupBy' p (IntMap.toAscList $ mapping f) where p (pos1, m1) (pos2, m2) = pos2 == pos1 + 1 && m1 == m2 join pms = ( Range { from = head ps, to = last ps + 1 } , head ms ) where (ps, ms) = unzip pms -- | Decompresses a compressed file. decompress :: CompressedFile -> File decompress = File . IntMap.fromList . concat . map (\(r, m) -> [ (p, m) | p <- rangeToPositions r ]) . ranges prop_compress :: File -> Bool prop_compress f = compressedFileInvariant c && decompress c == f where c = compress f -- | Clear any highlighting info for the given ranges. Used to make sure -- unsolved meta highlighting overrides error highlighting. noHighlightingInRange :: Ranges -> CompressedFile -> CompressedFile noHighlightingInRange rs (CompressedFile hs) = CompressedFile $ concatMap clear hs where clear (r, i) = case minus (Ranges [r]) rs of Ranges [] -> [] Ranges rs -> [ (r, i) | r <- rs ] ------------------------------------------------------------------------ -- Operations that work directly with compressed files -- | @'singletonC' rs m@ is a file whose positions are those in @rs@, -- and in which every position is associated with @m@. singletonC :: Ranges -> Aspects -> CompressedFile singletonC (Ranges rs) m = CompressedFile [(r, m) | r <- rs, not (empty r)] prop_singleton :: Ranges -> Aspects -> Bool prop_singleton rs m = singleton rs m == decompress (singletonC rs m) -- | Like 'singletonR', but with a list of 'Ranges' instead of a -- single one. severalC :: [Ranges] -> Aspects -> CompressedFile severalC rss m = mconcat $ map (\rs -> singletonC rs m) rss prop_several :: [Ranges] -> Aspects -> Bool prop_several rss m = several rss m == decompress (severalC rss m) -- | Merges compressed files. mergeC :: CompressedFile -> CompressedFile -> CompressedFile mergeC (CompressedFile f1) (CompressedFile f2) = CompressedFile (mrg f1 f2) where mrg [] f2 = f2 mrg f1 [] = f1 mrg (p1@(i1,_):f1) (p2@(i2,_):f2) | to i1 <= from i2 = p1 : mrg f1 (p2:f2) | to i2 <= from i1 = p2 : mrg (p1:f1) f2 | to i1 <= to i2 = ps1 ++ mrg f1 (ps2 ++ f2) | otherwise = ps1 ++ mrg (ps2 ++ f1) f2 where (ps1, ps2) = fuse p1 p2 -- Precondition: The ranges are overlapping. fuse (i1, m1) (i2, m2) = ( fix [ (Range { from = a, to = b }, ma) , (Range { from = b, to = c }, mergeAspects m1 m2) ] , fix [ (Range { from = c, to = d }, md) ] ) where [(a, ma), (b, _), (c, _), (d, md)] = sortBy (compare `on` fst) [(from i1, m1), (to i1, m1), (from i2, m2), (to i2, m2)] fix = filter (not . empty . fst) prop_merge :: File -> File -> Bool prop_merge f1 f2 = merge f1 f2 == decompress (mergeC (compress f1) (compress f2)) instance Monoid CompressedFile where mempty = CompressedFile [] mappend = mergeC -- | @splitAtC p f@ splits the compressed file @f@ into @(f1, f2)@, -- where all the positions in @f1@ are @< p@, and all the positions -- in @f2@ are @>= p@. splitAtC :: Int -> CompressedFile -> (CompressedFile, CompressedFile) splitAtC p f = (CompressedFile f1, CompressedFile f2) where (f1, f2) = split $ ranges f split [] = ([], []) split (rx@(r,x) : f) | p <= from r = ([], rx:f) | to r <= p = (rx:f1, f2) | otherwise = ([ (toP, x) ], (fromP, x) : f) where (f1, f2) = split f toP = Range { from = from r, to = p } fromP = Range { from = p, to = to r } prop_splitAtC :: Int -> CompressedFile -> Bool prop_splitAtC p f = all (< p) (positions f1) && all (>= p) (positions f2) && decompress (mergeC f1 f2) == decompress f where (f1, f2) = splitAtC p f positions = IntMap.keys . toMap . decompress -- | Returns the smallest position, if any, in the 'CompressedFile'. smallestPosC :: CompressedFile -> Maybe Int smallestPosC (CompressedFile []) = Nothing smallestPosC (CompressedFile ((r, _) : _)) = Just (from r) prop_smallestPos :: CompressedFile -> Bool prop_smallestPos f = smallestPos (decompress f) == smallestPosC f ------------------------------------------------------------------------ -- Generators instance Arbitrary Aspect where arbitrary = frequency [ (3, elements [ Comment, Keyword, String, Number , Symbol, PrimitiveType ]) , (1, liftM2 Name (maybeGen arbitrary) arbitrary) ] shrink Name{} = [Comment] shrink _ = [] instance CoArbitrary Aspect where coarbitrary Comment = variant 0 coarbitrary Keyword = variant 1 coarbitrary String = variant 2 coarbitrary Number = variant 3 coarbitrary Symbol = variant 4 coarbitrary PrimitiveType = variant 5 coarbitrary (Name nk b) = variant 6 . maybeCoGen coarbitrary nk . coarbitrary b instance Arbitrary NameKind where arbitrary = oneof $ [liftM Constructor arbitrary] ++ map return [ Bound , Datatype , Field , Function , Module , Postulate , Primitive , Record ] shrink Constructor{} = [Bound] shrink _ = [] instance CoArbitrary NameKind where coarbitrary Bound = variant 0 coarbitrary (Constructor ind) = variant 1 . coarbitrary ind coarbitrary Datatype = variant 2 coarbitrary Field = variant 3 coarbitrary Function = variant 4 coarbitrary Module = variant 5 coarbitrary Postulate = variant 6 coarbitrary Primitive = variant 7 coarbitrary Record = variant 8 coarbitrary Argument = variant 9 instance Arbitrary OtherAspect where arbitrary = elements [minBound .. maxBound] instance CoArbitrary OtherAspect where coarbitrary = coarbitrary . fromEnum instance Arbitrary Aspects where arbitrary = do aspect <- arbitrary other <- arbitrary note <- maybeGen string defSite <- arbitrary return (Aspects { aspect = aspect, otherAspects = other , note = note, definitionSite = defSite }) where string = listOfElements "abcdefABCDEF/\\.\"'@()åäö\n" shrink (Aspects a o n d) = [ Aspects a o n d | a <- shrink a ] ++ [ Aspects a o n d | o <- shrink o ] ++ [ Aspects a o n d | n <- shrink n ] ++ [ Aspects a o n d | d <- shrink d ] instance CoArbitrary Aspects where coarbitrary (Aspects aspect otherAspects note defSite) = coarbitrary aspect . coarbitrary otherAspects . coarbitrary note . coarbitrary defSite instance Arbitrary File where arbitrary = fmap (File . IntMap.fromList) $ listOf arbitrary shrink = map (File . IntMap.fromList) . shrink . IntMap.toList . toMap instance CoArbitrary File where coarbitrary (File rs) = coarbitrary (IntMap.toAscList rs) instance Arbitrary CompressedFile where arbitrary = do rs <- (\ns1 ns2 -> toRanges $ sort $ ns1 ++ concatMap (\n -> [n, succ n]) (ns2 :: [Int])) <$> arbitrary <*> arbitrary CompressedFile <$> mapM (\r -> (,) r <$> arbitrary) rs where toRanges (f : t : rs) | f == t = toRanges (t : rs) | otherwise = Range { from = f, to = t } : toRanges (case rs of f : rs | t == f -> rs _ -> rs) toRanges _ = [] shrink (CompressedFile f) = CompressedFile <$> shrink f ------------------------------------------------------------------------ -- All tests -- | All the properties. tests :: IO Bool tests = runTests "Agda.Interaction.Highlighting.Precise" [ quickCheck' compressedFileInvariant , quickCheck' (all compressedFileInvariant . shrink) , quickCheck' (\r m -> compressedFileInvariant $ singletonC r m) , quickCheck' (\rs m -> compressedFileInvariant $ severalC rs m) , quickCheck' (\f1 f2 -> compressedFileInvariant $ mergeC f1 f2) , quickCheck' (\i f -> all compressedFileInvariant $ (\(f1, f2) -> [f1, f2]) $ splitAtC i f) , quickCheck' prop_compress , quickCheck' prop_singleton , quickCheck' prop_several , quickCheck' prop_merge , quickCheck' prop_splitAtC , quickCheck' prop_smallestPos ] Agda-2.4.2.5/src/full/Agda/Interaction/Highlighting/HTML.hs0000644000000000000000000001450412635075266021275 0ustar0000000000000000{-# LANGUAGE CPP #-} -- | Function for generating highlighted, hyperlinked HTML from Agda -- sources. module Agda.Interaction.Highlighting.HTML ( generateHTML -- Reused by PandocAgda , defaultCSSFile , generateHTMLWithPageGen , generatePage , page , tokenStream , code ) where import Control.Applicative import Control.Monad import Control.Monad.Trans import Control.Monad.State.Class import Data.Function import Data.Monoid import Data.Maybe import qualified Data.IntMap as IntMap import qualified Data.Map as Map import qualified Data.List as List import System.FilePath import System.Directory import Text.XHtml.Strict import Paths_Agda import Agda.Interaction.Highlighting.Precise import Agda.Interaction.Options import qualified Agda.Syntax.Abstract as A import qualified Agda.Syntax.Concrete as C import Agda.Syntax.Common import Agda.TypeChecking.Monad (TCM) import qualified Agda.TypeChecking.Monad as TCM import Agda.Utils.FileName (filePath) import Agda.Utils.Lens import qualified Agda.Utils.IO.UTF8 as UTF8 import Agda.Utils.Pretty import Agda.Utils.Tuple #include "undefined.h" import Agda.Utils.Impossible -- | The name of the default CSS file. defaultCSSFile :: FilePath defaultCSSFile = "Agda.css" -- | Generates HTML files from all the sources which have been -- visited during the type checking phase. -- -- This function should only be called after type checking has -- completed successfully. generateHTML :: TCM () generateHTML = generateHTMLWithPageGen pageGen where pageGen dir mod hinfo = generatePage renderer dir mod where renderer css _ contents = page css mod $ code $ tokenStream contents hinfo -- | Prepare information for HTML page generation. -- -- The page generator receives the file path of the module, -- the top level module name of the module -- and the highlighting information of the module. generateHTMLWithPageGen :: (FilePath -> C.TopLevelModuleName -> CompressedFile -> TCM ()) -- ^ Page generator -> TCM () generateHTMLWithPageGen generatePage = do options <- TCM.commandLineOptions -- There is a default directory given by 'defaultHTMLDir' let dir = optHTMLDir options liftIO $ createDirectoryIfMissing True dir -- If the default CSS file should be used, then it is copied to -- the output directory. liftIO $ when (isNothing $ optCSSFile options) $ do cssFile <- getDataFileName defaultCSSFile copyFile cssFile (dir defaultCSSFile) TCM.reportSLn "html" 1 $ unlines [ "" , "Warning: HTML is currently generated for ALL files which can be" , "reached from the given module, including library files." ] -- Pull highlighting info from the state and generate all the -- web pages. mapM_ (\(m, h) -> generatePage dir m h) =<< map (mapSnd $ TCM.iHighlighting . TCM.miInterface) . Map.toList <$> TCM.getVisitedModules -- | Converts module names to the corresponding HTML file names. modToFile :: C.TopLevelModuleName -> FilePath modToFile m = render (pretty m) <.> "html" -- | Generates a highlighted, hyperlinked version of the given module. generatePage :: (FilePath -> FilePath -> String -> String) -- ^ Page renderer -> FilePath -- ^ Directory in which to create files. -> C.TopLevelModuleName -- ^ Module to be highlighted. -> TCM () generatePage renderpage dir mod = do mf <- Map.lookup mod <$> use TCM.stModuleToSource case mf of Nothing -> __IMPOSSIBLE__ Just f -> do contents <- liftIO $ UTF8.readTextFile $ filePath f css <- maybe defaultCSSFile id . optCSSFile <$> TCM.commandLineOptions let html = renderpage css (filePath f) contents TCM.reportSLn "html" 1 $ "Generating HTML for " ++ render (pretty mod) ++ " (" ++ target ++ ")." liftIO $ UTF8.writeFile target html where target = dir modToFile mod -- | Constructs the web page, including headers. page :: FilePath -- ^ URL to the CSS file. -> C.TopLevelModuleName -- ^ Module to be highlighted. -> Html -> String page css modName pagecontent = renderHtml $ header (thetitle << render (pretty modName) +++ meta ! [ httpequiv "Content-Type" , content "text/html; charset=UTF-8" ] +++ meta ! [ httpequiv "Content-Style-Type" , content "text/css" ] +++ thelink noHtml ! [ href css , rel "stylesheet" , thetype "text/css" ]) +++ body << pre << pagecontent -- | Constructs token stream ready to print. tokenStream :: String -- ^ The contents of the module. -> CompressedFile -- ^ Highlighting information. -> [(Int, String, Aspects)] -- ^ (position, contents, info) tokenStream contents info = map (\cs -> case cs of (mi, (pos, _)) : _ -> (pos, map (snd . snd) cs, maybe mempty id mi) [] -> __IMPOSSIBLE__) $ List.groupBy ((==) `on` fst) $ map (\(pos, c) -> (IntMap.lookup pos infoMap, (pos, c))) $ zip [1..] contents where infoMap = toMap (decompress info) -- | Constructs the HTML displaying the code. code :: [(Int, String, Aspects)] -> Html code = mconcat . map (\(pos, s, mi) -> annotate pos mi (stringToHtml s)) where annotate :: Int -> Aspects -> Html -> Html annotate pos mi = anchor ! attributes where attributes = [name (show pos)] ++ maybe [] link (definitionSite mi) ++ (case classes of [] -> [] cs -> [theclass $ unwords cs]) classes = maybe [] noteClasses (note mi) ++ otherAspectClasses (otherAspects mi) ++ maybe [] aspectClasses (aspect mi) aspectClasses (Name mKind op) = kindClass ++ opClass where kindClass = maybe [] ((: []) . showKind) mKind showKind (Constructor Inductive) = "InductiveConstructor" showKind (Constructor CoInductive) = "CoinductiveConstructor" showKind k = show k opClass = if op then ["Operator"] else [] aspectClasses a = [show a] otherAspectClasses = map show -- Notes are not included. noteClasses s = [] link (m, pos) = [href $ modToFile m ++ "#" ++ show pos] Agda-2.4.2.5/src/full/Agda/Interaction/Highlighting/Generate.hs-boot0000644000000000000000000000032212635075266023215 0ustar0000000000000000module Agda.Interaction.Highlighting.Generate where import Agda.TypeChecking.Monad.Base import Agda.Syntax.Position (Range) highlightAsTypeChecked :: MonadTCM tcm => Range -> Range -> tcm a -> tcm a Agda-2.4.2.5/src/full/Agda/Interaction/Highlighting/Vim.hs0000644000000000000000000000544712635075266021272 0ustar0000000000000000-- {-# LANGUAGE CPP #-} module Agda.Interaction.Highlighting.Vim where import Control.Monad.Trans import Data.Function ( on ) import qualified Data.List as List import qualified Data.Map as Map import System.FilePath import Agda.Syntax.Scope.Base import Agda.Syntax.Common import Agda.Syntax.Concrete.Name as CName import Agda.TypeChecking.Monad import qualified Agda.Utils.IO.UTF8 as UTF8 import Agda.Utils.Tuple vimFile :: FilePath -> FilePath vimFile file = case splitFileName file of (path, name) -> path "" <.> name <.> "vim" escape :: String -> String escape = concatMap esc where escchars = "$\\^.*~[]" esc c | c `elem` escchars = ['\\',c] | otherwise = [c] wordBounded :: String -> String wordBounded s0 = concat ["\\<", s0, "\\>"] keyword :: String -> [String] -> String keyword _ [] = "" keyword cat ws = "syn keyword " ++ unwords (cat : ws) match :: String -> [String] -> String match _ [] = "" match cat ws = "syn match " ++ cat ++ " \"" ++ concat (List.intersperse "\\|" $ map (wordBounded . escape) ws) ++ "\"" matches :: [String] -> [String] -> [String] -> [String] -> [String] -> [String] -> [String] matches cons icons defs idefs flds iflds = map snd $ List.sortBy (compare `on` fst) $ cons' ++ defs' ++ icons' ++ idefs' where cons' = foo "agdaConstructor" $ classify length cons icons' = foo "agdaInfixConstructor" $ classify length icons defs' = foo "agdaFunction" $ classify length defs idefs' = foo "agdaInfixFunction" $ classify length idefs flds' = foo "agdaProjection" $ classify length flds iflds' = foo "agdaInfixProjection" $ classify length iflds classify f = List.groupBy ((==) `on` f) . List.sortBy (compare `on` f) foo :: String -> [[String]] -> [(Int, String)] foo cat = map (length . head /\ match cat) toVim :: NamesInScope -> String toVim ns = unlines $ matches mcons micons mdefs midefs mflds miflds where cons = [ x | (x, def:_) <- Map.toList ns, anameKind def == ConName ] defs = [ x | (x, def:_) <- Map.toList ns, anameKind def == DefName ] flds = [ x | (x, fld:_) <- Map.toList ns, anameKind fld == FldName ] mcons = map show cons mdefs = map show defs mflds = map show flds micons = concatMap parts cons midefs = concatMap parts defs miflds = concatMap parts flds parts (NoName _ _) = [] parts (Name _ [_]) = [] parts (Name _ ps) = [ rawNameToString x | Id x <- ps ] generateVimFile :: FilePath -> TCM () generateVimFile file = do scope <- getScope liftIO $ UTF8.writeFile (vimFile file) $ toVim $ names scope where names = nsNames . everythingInScope Agda-2.4.2.5/src/full/Agda/Interaction/Highlighting/LaTeX.hs0000644000000000000000000004127512635075266021513 0ustar0000000000000000{-# LANGUAGE CPP #-} {-# LANGUAGE ViewPatterns #-} -- | Function for generating highlighted and aligned LaTeX from literate -- Agda source. module Agda.Interaction.Highlighting.LaTeX ( generateLaTeX ) where import Prelude hiding (log) import Data.Char import Data.Maybe import Data.Function import Control.Monad.RWS import System.Directory import System.FilePath import Data.Text (Text) import qualified Data.Text as T import qualified Data.Text.IO as T import qualified Data.Text.Encoding as E import qualified Data.ByteString as BS import qualified Data.IntMap as IntMap import qualified Data.List as List import qualified Data.Map as Map import Paths_Agda import Agda.Syntax.Common import Agda.Syntax.Concrete (TopLevelModuleName, moduleNameParts) import qualified Agda.Interaction.FindFile as Find import Agda.Interaction.Highlighting.Precise import Agda.TypeChecking.Monad (TCM) import qualified Agda.TypeChecking.Monad as TCM import Agda.Interaction.Options import Agda.Compiler.CallCompiler import qualified Agda.Utils.IO.UTF8 as UTF8 import Agda.Utils.FileName (filePath) import Agda.Utils.Pretty (pretty, render) import Agda.Utils.Except ( ExceptT, MonadError(throwError), runExceptT ) #include "undefined.h" import Agda.Utils.Impossible ------------------------------------------------------------------------ -- * Datatypes. -- | The @LaTeX@ monad is a combination of @ExceptT@, @RWST@ and -- @IO@. The error part is just used to keep track whether we finished -- or not, the reader part isn't used, the writer is where the output -- goes and the state is for keeping track of the tokens and some other -- useful info, and the I/O part is used for printing debugging info. type LaTeX = ExceptT String (RWST () Text State IO) data State = State { tokens :: Tokens , column :: Int -- ^ Column number, used for polytable alignment. , indent :: Int -- ^ Indentation level, also for alignment. , indentPrev :: Int , inCode :: Bool -- ^ Keeps track of whether we are in a code -- block or not. , debugs :: [Debug] -- ^ Says what debug information should printed. } type Tokens = [Token] data Token = Token { text :: Text , info :: Aspects , position :: Int -- ^ Is not used currently, but could -- potentially be used for hyperlinks as in -- the HTML output? } deriving Show data Debug = MoveColumn | NonCode | Code | Spaces | Output deriving (Eq, Show) -- | Run function for the @LaTeX@ monad. runLaTeX :: LaTeX a -> () -> State -> IO (Either String a, State, Text) runLaTeX = runRWST . runExceptT emptyState :: State emptyState = State { tokens = [] , column = 0 , indent = 0 , indentPrev = 0 , inCode = False , debugs = [] } ------------------------------------------------------------------------ -- * Some helpers. (<+>) :: Text -> Text -> Text (<+>) = T.append isInfixOf' :: Text -> Text -> Maybe (Text, Text) isInfixOf' needle haystack = go (T.tails haystack) 0 where go [] n = Nothing go ((T.stripPrefix needle -> Just suf) : xss) n = Just (T.take n haystack, suf) go (_ : xss) n = go xss (n + 1) -- Same as above, but starts searching from the back rather than the -- front. isInfixOfRev :: Text -> Text -> Maybe (Text, Text) isInfixOfRev needle haystack = case T.reverse needle `isInfixOf'` T.reverse haystack of Nothing -> Nothing Just (pre, suf) -> Just (T.reverse suf, T.reverse pre) isSpaces :: Text -> Bool isSpaces = T.all isSpace isActualSpaces :: Text -> Bool isActualSpaces = T.all (== ' ') -- | Yields the next token, taking special care to begin/end code -- blocks. Junk occuring before and after the code blocks is separated -- into separate tokens, this makes it easier to keep track of whether -- we are in a code block or not. nextToken' :: LaTeX Token nextToken' = do toks <- gets tokens case toks of [] -> throwError "Done" -- Clean begin/end code block or a LaTeX comment. t : ts | text t == beginCode || text t == endCode || T.singleton '%' == T.take 1 (T.stripStart (text t)) -> do modify $ \s -> s { tokens = ts } return t t : ts -> do modify $ \s -> s { tokens = ts } inCode <- gets inCode let code = if inCode then endCode else beginCode case code `isInfixOf'` text t of Nothing -> do -- Spaces take care of their own column tracking. unless (isSpaces (text t)) $ do log MoveColumn $ text t moveColumn $ T.length $ text t return t Just (pre, suf) -> do let (textToReturn, textsToPutBack) = -- This bit fixes issue 954. -- Drop spaces up until and including the first trailing -- newline after begin code blocks. if code == beginCode && isSpaces suf then case T.singleton '\n' `isInfixOf'` suf of Nothing -> (pre, [ beginCode ]) Just (_, suf') -> (pre, [ beginCode, suf' ]) -- Do the converse thing for end code blocks. else if code == endCode && isSpaces pre then case T.singleton '\n' `isInfixOfRev` pre of Nothing -> (code, [ suf ]) Just (pre', suf') -> (pre' <+> T.dropWhile (`elem` [' ', '\t']) suf', [ code, suf ]) -- This case happens for example when you have two code -- blocks after each other, i.e. the begin code of the -- second ends up in the suffix of the first's end code. else (pre, [ code, suf ]) let tokToReturn = t { text = textToReturn } let toksToPutBack = map (\txt -> t { text = txt }) textsToPutBack unless (isSpaces pre) $ do log MoveColumn pre moveColumn $ T.length pre modify $ \s -> s { tokens = toksToPutBack ++ tokens s } return tokToReturn nextToken :: LaTeX Text nextToken = text `fmap` nextToken' resetColumn :: LaTeX () resetColumn = modify $ \s -> s { column = 0 } moveColumn :: Int -> LaTeX () moveColumn i = modify $ \s -> s { column = i + column s } setIndent :: Int -> LaTeX () setIndent i = modify $ \s -> s { indent = i } resetIndent :: LaTeX () resetIndent = modify $ \s -> s { indent = 0 } setIndentPrev :: Int -> LaTeX () setIndentPrev i = modify $ \s -> s { indentPrev = i } resetIndentPrev :: LaTeX () resetIndentPrev = modify $ \s -> s { indentPrev = 0 } setInCode :: LaTeX () setInCode = modify $ \s -> s { inCode = True } unsetInCode :: LaTeX () unsetInCode = modify $ \s -> s { inCode = False } logHelper :: Debug -> Text -> [String] -> LaTeX () logHelper debug text extra = do debugs <- gets debugs when (debug `elem` debugs) $ do lift $ lift $ T.putStrLn $ T.pack (show debug ++ ": ") <+> T.pack "'" <+> text <+> T.pack "' " <+> if null extra then T.empty else T.pack "(" <+> T.pack (unwords extra) <+> T.pack ")" log :: Debug -> Text -> LaTeX () log MoveColumn text = do ind <- gets indent logHelper MoveColumn text ["ind=", show ind] log Code text = do ind <- gets indent col <- gets column logHelper Code text ["ind=", show ind, "col=", show col] log debug text = logHelper debug text [] log' :: Debug -> String -> LaTeX () log' d = log d . T.pack output :: Text -> LaTeX () output text = do log Output text tell text ------------------------------------------------------------------------ -- * LaTeX and polytable strings. -- Polytable, http://www.ctan.org/pkg/polytable, is used for code -- alignment, similar to lhs2TeX's approach. nl, beginCode, endCode :: Text nl = T.pack "%\n" beginCode = T.pack "\\begin{code}" endCode = T.pack "\\end{code}" ptOpen :: Text ptOpen = T.pack "\\>" ptOpen' :: Show a => a -> Text ptOpen' i = ptOpen <+> T.pack ("[" ++ show i ++ "]") ptClose :: Text ptClose = T.pack "\\<" ptClose' :: Show a => a -> Text ptClose' i = ptClose <+> T.pack ("[" ++ show i ++ "]") ptNL :: Text ptNL = nl <+> T.pack "\\\\\n" cmdPrefix :: Text cmdPrefix = T.pack "\\Agda" cmdArg :: Text -> Text cmdArg x = T.singleton '{' <+> x <+> T.singleton '}' cmdIndent :: Show a => a -> Text cmdIndent i = cmdPrefix <+> T.pack "Indent" <+> cmdArg (T.pack (show i)) <+> cmdArg T.empty infixl', infix', infixr' :: Text infixl' = T.pack "infixl" infix' = T.pack "infix" infixr' = T.pack "infixr" ------------------------------------------------------------------------ -- * Automaton. -- | The start state, @nonCode@, prints non-code (the LaTeX part of -- literate Agda) until it sees a @beginBlock@. nonCode :: LaTeX () nonCode = do tok <- nextToken log NonCode tok if tok == beginCode then do output $ beginCode <+> nl resetColumn setInCode code else do output tok nonCode -- | Deals with code blocks. Every token, except spaces, is pretty -- printed as a LaTeX command. code :: LaTeX () code = do -- Get the column information before grabbing the token, since -- grabbing (possibly) moves the column. col <- gets column tok' <- nextToken' let tok = text tok' log Code tok when (tok == T.empty) code when (col == 0 && not (isActualSpaces tok)) $ do output ptOpen when (tok == endCode) $ do output $ ptClose <+> nl <+> endCode unsetInCode nonCode when (tok `elem` [ infixl', infix', infixr' ]) $ do output $ cmdPrefix <+> T.pack "Keyword" <+> cmdArg tok fixity code when (isSpaces tok) $ do spaces $ T.group tok code case aspect (info tok') of Nothing -> output $ escape tok -- Just a -> output $ cmdPrefix <+> T.pack (cmd a) <+> cmdArg (escape tok) -- Andreas, 2014-02-17 preliminary fix for issue 1062 Just a -> case cmd a of "" -> output $ escape tok s -> output $ cmdPrefix <+> T.pack s <+> cmdArg (escape tok) code where cmd :: Aspect -> String -- cmd (Name mKind _) = maybe __IMPOSSIBLE__ showKind mKind -- Andreas, 2014-02-17 preliminary fix for issue 1062 cmd (Name mKind _) = maybe "" showKind mKind where showKind :: NameKind -> String showKind (Constructor Inductive) = "InductiveConstructor" showKind (Constructor CoInductive) = "CoinductiveConstructor" -- Andreas, 2014-02-17 -- It might be boring boilerplate, but please spell out the -- remaining cases instead of using the brittle @show@ function. -- What if a constructor in @NameKind@ gets renamed? showKind k = show k cmd a = show a -- Escapes special characters. escape :: Text -> Text escape (T.uncons -> Nothing) = T.empty escape (T.uncons -> Just (c, s)) = T.pack (replace c) <+> escape s where replace :: Char -> String replace c = case c of '_' -> "\\_" '{' -> "\\{" '}' -> "\\}" '#' -> "\\#" '$' -> "\\$" '&' -> "\\&" '%' -> "\\%" '~' -> "\\textasciitilde" '^' -> "\\textasciicircum" '\\' -> "\\textbackslash" -- Escaping newlines seems to fix the problem caused by pattern -- synonyms. '\n' -> "\\<\\\\\n\\>" _ -> [ c ] escape _ = __IMPOSSIBLE__ -- | Fixity declarations need a special treatment. The operations in -- declarations like: -- -- infix num op1 op2 op3 -- -- are treated as comments and thus grouped together with the newlines -- that follow, which results incorrect LaTeX output -- the following -- state remedies the problem by breaking on newlines. fixity :: LaTeX () fixity = do tok <- nextToken case T.breakOn (T.pack "\n") tok of -- Spaces. (sps, nls) | nls == T.empty && isSpaces sps -> do spaces $ T.group sps fixity -- Fixity level. (num, nls) | nls == T.empty -> do output $ cmdPrefix <+> T.pack "Number" <+> cmdArg num fixity -- Operations followed by newlines. (ops, nls) | otherwise -> do output $ (T.pack " " <+>) $ T.unwords $ map ((cmdPrefix <+> T.pack "FixityOp" <+>) . cmdArg . escape) $ T.words ops spaces (T.group nls) -- | Spaces are grouped before processed, because multiple consecutive -- spaces determine the alignment of the code and consecutive newline -- characters need special treatment as well. spaces :: [Text] -> LaTeX () spaces [] = return () spaces ((T.uncons -> Nothing) : ss) = __IMPOSSIBLE__ -- Single spaces are ignored. spaces ((T.uncons -> Just (' ', s)) : []) | T.null s = do col <- gets column when (col == 0) $ do output ptOpen moveColumn 1 output $ T.singleton ' ' -- Multiple spaces. spaces (s@(T.uncons -> Just (' ', _)) : ss) = do let len = T.length s col <- gets column moveColumn len if col /= 0 then do log' Spaces "col /= 0" output $ T.singleton ' ' col <- gets column output $ ptClose' col <+> nl <+> ptOpen' col else do log' Spaces "col == 0" indent <- gets indent indentPrev <- gets indentPrev case compare len indent of GT -> do log' Spaces "GT" setIndent len setIndentPrev indent output $ ptOpen' indent output $ cmdIndent len output $ ptClose' len <+> nl <+> ptOpen' len EQ -> do log' Spaces "EQ" output $ ptOpen' indentPrev output $ cmdIndent len output $ ptClose' len <+> nl <+> ptOpen' len LT -> do log' Spaces "LT" setIndent len resetIndentPrev output $ ptOpen' 0 output $ cmdIndent len output $ ptClose' len <+> nl <+> ptOpen' len spaces ss -- Newlines. spaces (s@(T.uncons -> Just ('\n', _)) : ss) = do resetColumn output $ ptClose <+> T.replicate (T.length s) ptNL spaces ss -- Treat tabs as if they were spaces. spaces (s@(T.uncons -> Just ('\t', _)) : ss) = spaces $ T.replicate (T.length s) (T.singleton ' ') : ss spaces (_ : ss) = __IMPOSSIBLE__ ------------------------------------------------------------------------ -- * Main. defaultStyFile :: String defaultStyFile = "agda.sty" -- | The only exported function. It's (only) called in @Main.hs@. generateLaTeX :: TopLevelModuleName -> HighlightingInfo -> TCM () generateLaTeX mod hi = do options <- TCM.commandLineOptions -- There is a default directory given by 'defaultLaTeXDir'. let dir = optLaTeXDir options liftIO $ createDirectoryIfMissing True dir TCM.reportSLn "latex" 1 $ unlines [ "" , "Checking if " ++ defaultStyFile ++ " is found by the LaTeX environment." ] merrors <- callCompiler' "kpsewhich" [ "--path=" ++ dir, defaultStyFile ] when (isJust merrors) $ do TCM.reportSLn "latex" 1 $ unlines [ "" , defaultStyFile ++ " was not found. Copying a default version of " ++ defaultStyFile , "into the directory " ++ dir ++ "." ] liftIO $ do styFile <- getDataFileName defaultStyFile liftIO $ copyFile styFile (dir defaultStyFile) let outPath = modToFile mod inAbsPath <- liftM filePath (Find.findFile mod) liftIO $ do source <- UTF8.readTextFile inAbsPath latex <- E.encodeUtf8 `fmap` toLaTeX source hi createDirectoryIfMissing True $ dir takeDirectory outPath BS.writeFile (dir outPath) latex where modToFile :: TopLevelModuleName -> FilePath modToFile m = List.intercalate [pathSeparator] (moduleNameParts m) <.> "tex" -- | Transforms the source code into LaTeX. toLaTeX :: String -> HighlightingInfo -> IO Text toLaTeX source hi = processTokens -- Head the list (the grouped chars contain the same meta info) and -- collect the characters into a string. . map (\xs -> case xs of (mi, (pos, _)) : _ -> Token { text = T.pack $ map (\(_, (_, c)) -> c) xs , info = fromMaybe mempty mi , position = pos } [] -> __IMPOSSIBLE__) . List.groupBy ((==) `on` fst) -- Characters which share the same -- meta info are the same token, so -- group them together. -- Look up the meta info at each position in the highlighting info. . map (\(pos, char) -> (IntMap.lookup pos infoMap, (pos, char))) -- Add position in file to each character. . zip [1..] $ source where infoMap = toMap (decompress hi) processTokens :: Tokens -> IO Text processTokens ts = do (x, _, s) <- runLaTeX nonCode () (emptyState { tokens = ts }) case x of Left "Done" -> return s _ -> __IMPOSSIBLE__ Agda-2.4.2.5/src/full/Agda/Interaction/Highlighting/Dot.hs0000644000000000000000000000643512635075266021263 0ustar0000000000000000{-# LANGUAGE CPP #-} -- | Generate an import dependency graph for a given module. module Agda.Interaction.Highlighting.Dot where import Control.Applicative import Control.Monad.State import qualified Data.Map as M import Data.Map(Map) import Data.Maybe import Data.Monoid import qualified Data.Set as S import Data.Set (Set) import Agda.Interaction.Options import Agda.Syntax.Abstract import Agda.TypeChecking.Monad #include "undefined.h" import Agda.Utils.Impossible -- | Internal module identifiers for construction of dependency graph. type ModuleId = String data DotState = DotState { dsModules :: Map ModuleName ModuleId -- ^ Records already processed modules -- and maps them to an internal identifier. , dsNameSupply :: [ModuleId] -- ^ Supply of internal identifiers. , dsConnection :: Set (ModuleId, ModuleId) -- ^ Edges of dependency graph. } initialDotState :: DotState initialDotState = DotState { dsModules = mempty , dsNameSupply = map (('m':) . show) [0..] , dsConnection = mempty } type DotM = StateT DotState TCM -- | Translate a 'ModuleName' to an internal 'ModuleId'. -- Returns @True@ if the 'ModuleName' is new, i.e., has not been -- encountered before and is thus added to the map of processed modules. addModule :: ModuleName -> DotM (ModuleId, Bool) addModule m = do s <- get case M.lookup m (dsModules s) of Just r -> return (r, False) Nothing -> do let newName:nameSupply = dsNameSupply s put s { dsModules = M.insert m newName (dsModules s) , dsNameSupply = nameSupply } return (newName, True) -- | Add an arc from importer to imported. addConnection :: ModuleId -> ModuleId -> DotM () addConnection m1 m2 = modify $ \s -> s {dsConnection = S.insert (m1,m2) (dsConnection s)} -- | Recursively build import graph, starting from given 'Interface'. -- Modifies the state in 'DotM' and returns the 'ModuleId' of the 'Interface'. dottify :: Interface -> DotM ModuleId dottify inter = do let curModule = iModuleName inter (name, continue) <- addModule curModule -- If we have not visited this interface yet, -- process its imports recursively and -- add them as connections to the graph. when continue $ do importsifs <- lift $ map miInterface . catMaybes <$> mapM (getVisitedModule . toTopLevelModuleName . fst) (iImportedModules inter) imports <- mapM dottify importsifs mapM_ (addConnection name) imports return name -- | Generate a .dot file for the import graph starting with the -- given 'Interface' and write it to the file specified by the -- command line option. generateDot :: Interface -> TCM () generateDot inter = do (top, state) <- flip runStateT initialDotState $ do dottify inter fp <- fromMaybe __IMPOSSIBLE__ . optDependencyGraph <$> commandLineOptions liftIO $ writeFile fp $ mkDot state where mkDot :: DotState -> String mkDot st = unlines $ [ "digraph dependencies {" ] ++ [" " ++ repr ++ "[label=\"" ++ show (mnameToConcrete modulename) ++ "\"];" | (modulename, repr) <- M.toList (dsModules st)] ++ [" " ++ r1 ++ " -> " ++ r2 ++ ";" | (r1 , r2) <- S.toList (dsConnection st) ] ++ ["}"] Agda-2.4.2.5/src/full/Agda/Interaction/Highlighting/Generate.hs0000644000000000000000000006201112635075266022257 0ustar0000000000000000{-# LANGUAGE CPP #-} {-# LANGUAGE FlexibleContexts #-} {-# LANGUAGE RelaxedPolyRec #-} -- | Generates data used for precise syntax highlighting. module Agda.Interaction.Highlighting.Generate ( Level(..) , generateAndPrintSyntaxInfo , generateTokenInfo, generateTokenInfoFromString , printErrorInfo, errorHighlighting , printUnsolvedInfo , printHighlightingInfo , highlightAsTypeChecked , computeUnsolvedMetaWarnings , computeUnsolvedConstraints , storeDisambiguatedName , Agda.Interaction.Highlighting.Generate.tests ) where import Prelude hiding (null) import Control.Monad import Control.Monad.Trans import Control.Monad.State import Control.Monad.Reader import Control.Applicative import Control.Arrow ((***), first, second) import Data.Monoid import Data.Generics.Geniplate import Data.HashSet (HashSet) import qualified Data.HashSet as HSet import qualified Data.Map as Map import Data.Maybe import Data.List ((\\), isPrefixOf) import qualified Data.Foldable as Fold (toList, fold, foldMap) import Data.IntMap (IntMap) import qualified Data.IntMap as IntMap import Agda.Interaction.FindFile import Agda.Interaction.Response (Response(Resp_HighlightingInfo)) import Agda.Interaction.Highlighting.Precise hiding (tests) import Agda.Interaction.Highlighting.Range hiding (tests) import qualified Agda.TypeChecking.Errors as E import Agda.TypeChecking.MetaVars (isBlockedTerm) import Agda.TypeChecking.Monad hiding (MetaInfo, Primitive, Constructor, Record, Function, Datatype) import qualified Agda.TypeChecking.Monad as M import Agda.TypeChecking.Pretty import qualified Agda.TypeChecking.Reduce as R import qualified Agda.Syntax.Abstract as A import Agda.Syntax.Common (Delayed(..)) import qualified Agda.Syntax.Common as Common import qualified Agda.Syntax.Concrete as C import qualified Agda.Syntax.Info as SI import qualified Agda.Syntax.Internal as I import qualified Agda.Syntax.Literal as L import qualified Agda.Syntax.Parser as Pa import qualified Agda.Syntax.Parser.Tokens as T import qualified Agda.Syntax.Position as P import Agda.Utils.FileName import Agda.Utils.Functor import Agda.Utils.Lens import Agda.Utils.List import Agda.Utils.Maybe import Agda.Utils.Null import Agda.Utils.TestHelpers import Agda.Utils.HashMap (HashMap) import qualified Agda.Utils.HashMap as HMap #include "undefined.h" import Agda.Utils.Impossible -- | @highlightAsTypeChecked rPre r m@ runs @m@ and returns its -- result. Additionally, some code may be highlighted: -- -- * If @r@ is non-empty and not a sub-range of @rPre@ (after -- 'P.continuousPerLine' has been applied to both): @r@ is -- highlighted as being type-checked while @m@ is running (this -- highlighting is removed if @m@ completes /successfully/). -- -- * Otherwise: Highlighting is removed for @rPre - r@ before @m@ -- runs, and if @m@ completes successfully, then @rPre - r@ is -- highlighted as being type-checked. highlightAsTypeChecked :: MonadTCM tcm => P.Range -> P.Range -> tcm a -> tcm a highlightAsTypeChecked rPre r m | r /= P.noRange && delta == rPre' = wrap r' highlight clear | otherwise = wrap delta clear highlight where rPre' = rToR (P.continuousPerLine rPre) r' = rToR (P.continuousPerLine r) delta = rPre' `minus` r' clear = mempty highlight = mempty { otherAspects = [TypeChecks] } wrap rs x y = do p rs x v <- m p rs y return v where p rs x = printHighlightingInfo (singletonC rs x) -- | Lispify and print the given highlighting information. printHighlightingInfo :: MonadTCM tcm => HighlightingInfo -> tcm () printHighlightingInfo x = do modToSrc <- use stModuleToSource liftTCM $ reportSLn "highlighting" 50 $ "Printing highlighting info:\n" ++ show x ++ "\n" ++ " modToSrc = " ++ show modToSrc unless (null $ ranges x) $ do liftTCM $ appInteractionOutputCallback $ Resp_HighlightingInfo x modToSrc -- | Highlighting levels. data Level = Full -- ^ Full highlighting. Should only be used after typechecking has -- completed successfully. | Partial -- ^ Highlighting without disambiguation of overloaded -- constructors. -- | Generate syntax highlighting information for the given -- declaration, and (if appropriate) print it. If the -- 'HighlightingLevel' is @'Full'@, then the state is -- additionally updated with the new highlighting info (in case of a -- conflict new info takes precedence over old info). -- -- The procedure makes use of some of the token highlighting info in -- 'stTokens' (that corresponding to the interval covered by the -- declaration). If the 'HighlightingLevel' is @'Full'@, -- then this token highlighting info is additionally removed from -- 'stTokens'. generateAndPrintSyntaxInfo :: A.Declaration -> Level -> TCM () generateAndPrintSyntaxInfo decl _ | null $ P.getRange decl = return () generateAndPrintSyntaxInfo decl hlLevel = do file <- fromMaybe __IMPOSSIBLE__ <$> asks envCurrentPath reportSLn "import.iface.create" 15 $ "Generating syntax info for " ++ filePath file ++ ' ' : case hlLevel of Full {} -> "(final)" Partial {} -> "(first approximation)" ++ "." M.ignoreAbstractMode $ do modMap <- sourceToModule kinds <- nameKinds hlLevel decl let nameInfo = mconcat $ map (generate modMap file kinds) names -- Constructors are only highlighted after type checking, since they -- can be overloaded. constructorInfo <- case hlLevel of Full{} -> generateConstructorInfo modMap file kinds decl _ -> return mempty let (from, to) = case P.rangeToInterval (P.getRange decl) of Nothing -> __IMPOSSIBLE__ Just i -> ( fromIntegral $ P.posPos $ P.iStart i , fromIntegral $ P.posPos $ P.iEnd i) (prevTokens, (curTokens, postTokens)) <- (second (splitAtC to)) . splitAtC from <$> use stTokens -- theRest needs to be placed before nameInfo here since record -- field declarations contain QNames. constructorInfo also needs -- to be placed before nameInfo since, when typechecking is done, -- constructors are included in both lists. Finally the token -- information is placed last since token highlighting is more -- crude than the others. let syntaxInfo = compress (mconcat [ constructorInfo , theRest modMap file , nameInfo ]) `mappend` curTokens case hlLevel of Full{} -> do stSyntaxInfo %= mappend syntaxInfo stTokens .= prevTokens `mappend` postTokens _ -> return () ifTopLevelAndHighlightingLevelIs NonInteractive $ printHighlightingInfo syntaxInfo where -- All names mentioned in the syntax tree (not bound variables). names :: [A.AmbiguousQName] names = (map (A.AmbQ . (:[])) $ filter (not . extendedLambda) $ universeBi decl) ++ universeBi decl where extendedLambda :: A.QName -> Bool extendedLambda = (extendedLambdaName `isPrefixOf`) . show . A.nameConcrete . A.qnameName -- Bound variables, dotted patterns, record fields, module names, -- the "as" and "to" symbols. theRest modMap file = mconcat [ Fold.foldMap getFieldDecl $ universeBi decl , Fold.foldMap getVarAndField $ universeBi decl , Fold.foldMap getLet $ universeBi decl , Fold.foldMap getLam $ universeBi decl , Fold.foldMap getTyped $ universeBi decl , Fold.foldMap getPattern $ universeBi decl , Fold.foldMap getExpr $ universeBi decl , Fold.foldMap getPatSynArgs $ universeBi decl , Fold.foldMap getModuleName $ universeBi decl , Fold.foldMap getModuleInfo $ universeBi decl , Fold.foldMap getNamedArg $ universeBi decl ] where bound n = nameToFile modMap file [] (A.nameConcrete n) (\isOp -> mempty { aspect = Just $ Name (Just Bound) isOp }) (Just $ A.nameBindingSite n) patsyn n = nameToFileA modMap file n True $ \isOp -> mempty { aspect = Just $ Name (Just $ Constructor Common.Inductive) isOp } field m n = nameToFile modMap file m n (\isOp -> mempty { aspect = Just $ Name (Just Field) isOp }) Nothing asName n = nameToFile modMap file [] n (\isOp -> mempty { aspect = Just $ Name (Just Module) isOp }) Nothing mod isTopLevelModule n = nameToFile modMap file [] (A.nameConcrete n) (\isOp -> mempty { aspect = Just $ Name (Just Module) isOp }) (Just $ (if isTopLevelModule then P.beginningOfFile else id) (A.nameBindingSite n)) getVarAndField :: A.Expr -> File getVarAndField (A.Var x) = bound x getVarAndField (A.Rec _ fs) = mconcat $ map (field [] . fst) fs getVarAndField _ = mempty -- Ulf, 2014-04-09: It would be nicer to have it on Named_ a, but -- you can't have polymorphic functions in universeBi. getNamedArg :: Common.RString -> File getNamedArg x = singleton (rToR $ P.getRange x) mempty{ aspect = Just $ Name (Just Argument) False } getLet :: A.LetBinding -> File getLet (A.LetBind _ _ x _ _) = bound x getLet A.LetPatBind{} = mempty getLet A.LetApply{} = mempty getLet A.LetOpen{} = mempty getLam :: A.LamBinding -> File getLam (A.DomainFree _ x) = bound x getLam (A.DomainFull {}) = mempty getTyped :: A.TypedBinding -> File getTyped (A.TBind _ xs _) = mconcat $ map (bound . dget) xs getTyped A.TLet{} = mempty getPatSynArgs :: A.Declaration -> File getPatSynArgs (A.PatternSynDef _ xs _) = mconcat $ map (bound . Common.unArg) xs getPatSynArgs _ = mempty getPattern :: A.Pattern -> File getPattern (A.VarP x) = bound x getPattern (A.AsP _ x _) = bound x getPattern (A.DotP pi _) = singleton (rToR $ P.getRange pi) (mempty { otherAspects = [DottedPattern] }) getPattern (A.PatternSynP _ q _) = patsyn q getPattern _ = mempty getExpr :: A.Expr -> File getExpr (A.PatternSyn q) = patsyn q getExpr _ = mempty getFieldDecl :: A.Declaration -> File getFieldDecl (A.RecDef _ _ _ _ _ _ fs) = Fold.foldMap extractField fs where extractField (A.ScopedDecl _ ds) = Fold.foldMap extractField ds extractField (A.Field _ x _) = field (concreteQualifier x) (concreteBase x) extractField _ = mempty getFieldDecl _ = mempty getModuleName :: A.ModuleName -> File getModuleName m@(A.MName { A.mnameToList = xs }) = mconcat $ map (mod isTopLevelModule) xs where isTopLevelModule = case catMaybes $ map (join . fmap P.srcFile . P.rStart . A.nameBindingSite) xs of f : _ -> Map.lookup f modMap == Just (C.toTopLevelModuleName $ A.mnameToConcrete m) [] -> False getModuleInfo :: SI.ModuleInfo -> File getModuleInfo (SI.ModuleInfo { SI.minfoAsTo = asTo , SI.minfoAsName = name }) = singleton (rToR asTo) (mempty { aspect = Just Symbol }) `mappend` maybe mempty asName name -- | Generate and return the syntax highlighting information for the -- tokens in the given file. generateTokenInfo :: AbsolutePath -- ^ The module to highlight. -> TCM CompressedFile generateTokenInfo file = liftIO $ tokenHighlighting <$> Pa.parseFile' Pa.tokensParser file -- | Same as 'generateTokenInfo' but takes a string instead of a filename. generateTokenInfoFromString :: P.Range -> String -> TCM CompressedFile generateTokenInfoFromString r _ | r == P.noRange = return mempty generateTokenInfoFromString r s = do liftIO $ tokenHighlighting <$> Pa.parsePosString Pa.tokensParser p s where Just p = P.rStart r -- | Compute syntax highlighting for the given tokens. tokenHighlighting :: [T.Token] -> CompressedFile tokenHighlighting = merge . map tokenToCFile where -- Converts an aspect and a range to a file. aToF a r = singletonC (rToR r) (mempty { aspect = Just a }) -- Merges /sorted, non-overlapping/ compressed files. merge = CompressedFile . concat . map ranges tokenToCFile :: T.Token -> CompressedFile tokenToCFile (T.TokSetN (i, _)) = aToF PrimitiveType (P.getRange i) tokenToCFile (T.TokKeyword T.KwSet i) = aToF PrimitiveType (P.getRange i) tokenToCFile (T.TokKeyword T.KwProp i) = aToF PrimitiveType (P.getRange i) tokenToCFile (T.TokKeyword T.KwForall i) = aToF Symbol (P.getRange i) tokenToCFile (T.TokKeyword _ i) = aToF Keyword (P.getRange i) tokenToCFile (T.TokSymbol _ i) = aToF Symbol (P.getRange i) tokenToCFile (T.TokLiteral (L.LitInt r _)) = aToF Number r tokenToCFile (T.TokLiteral (L.LitFloat r _)) = aToF Number r tokenToCFile (T.TokLiteral (L.LitString r _)) = aToF String r tokenToCFile (T.TokLiteral (L.LitChar r _)) = aToF String r tokenToCFile (T.TokLiteral (L.LitQName r _)) = aToF String r tokenToCFile (T.TokComment (i, _)) = aToF Comment (P.getRange i) tokenToCFile (T.TokTeX (i, _)) = aToF Comment (P.getRange i) tokenToCFile (T.TokId {}) = mempty tokenToCFile (T.TokQId {}) = mempty tokenToCFile (T.TokString {}) = mempty tokenToCFile (T.TokDummy {}) = mempty tokenToCFile (T.TokEOF {}) = mempty -- | A function mapping names to the kind of name they stand for. type NameKinds = A.QName -> Maybe NameKind -- | Builds a 'NameKinds' function. nameKinds :: Level -- ^ This should only be @'Full'@ if -- type-checking completed successfully (without any -- errors). -> A.Declaration -> TCM NameKinds nameKinds hlLevel decl = do imported <- fix <$> use stImports local <- case hlLevel of Full{} -> fix <$> use stSignature _ -> return HMap.empty -- Traverses the syntax tree and constructs a map from qualified -- names to name kinds. TODO: Handle open public. let syntax = foldr ($) HMap.empty $ map declToKind $ universeBi decl let merged = HMap.unions [local, imported, syntax] return (\n -> HMap.lookup n merged) where fix = HMap.map (defnToKind . theDef) . (^. sigDefinitions) -- | The 'M.Axiom' constructor is used to represent various things -- which are not really axioms, so when maps are merged 'Postulate's -- are thrown away whenever possible. The 'declToKind' function -- below can return several explanations for one qualified name; the -- 'Postulate's are bogus. insert = HMap.insertWith dropPostulates where dropPostulates Postulate k = k dropPostulates k _ = k defnToKind :: Defn -> NameKind defnToKind M.Axiom{} = Postulate defnToKind d@M.Function{} | isProperProjection d = Field | otherwise = Function defnToKind M.Datatype{} = Datatype defnToKind M.Record{} = Record defnToKind M.Constructor{ M.conInd = i } = Constructor i defnToKind M.Primitive{} = Primitive declToKind :: A.Declaration -> HashMap A.QName NameKind -> HashMap A.QName NameKind declToKind (A.Axiom _ _ _ q _) = insert q Postulate declToKind (A.Field _ q _) = insert q Field -- Function -- Note that the name q can be used both as a field name and as a -- projection function. Highlighting of field names is taken care -- of by "theRest" above, which does not use NameKinds. declToKind (A.Primitive _ q _) = insert q Primitive declToKind (A.Mutual {}) = id declToKind (A.Section {}) = id declToKind (A.Apply {}) = id declToKind (A.Import {}) = id declToKind (A.Pragma {}) = id declToKind (A.ScopedDecl {}) = id declToKind (A.Open {}) = id declToKind (A.PatternSynDef q _ _) = insert q (Constructor Common.Inductive) declToKind (A.FunDef _ q _ _) = insert q Function declToKind (A.UnquoteDecl _ _ q _) = insert q Function declToKind (A.DataSig _ q _ _) = insert q Datatype declToKind (A.DataDef _ q _ cs) = \m -> insert q Datatype $ foldr (\d -> insert (A.axiomName d) (Constructor Common.Inductive)) m cs declToKind (A.RecSig _ q _ _) = insert q Record declToKind (A.RecDef _ q _ c _ _ _) = insert q Record . case c of Nothing -> id Just q -> insert q (Constructor Common.Inductive) -- | Generates syntax highlighting information for all constructors -- occurring in patterns and expressions in the given declaration. -- -- This function should only be called after type checking. -- Constructors can be overloaded, and the overloading is resolved by -- the type checker. generateConstructorInfo :: SourceToModule -- ^ Maps source file paths to module names. -> AbsolutePath -- ^ The module to highlight. -> NameKinds -> A.Declaration -> TCM File generateConstructorInfo modMap file kinds decl = do -- Get boundaries of current declaration. -- @noRange@ should be impossible, but in case of @noRange@ -- it makes sense to return the empty File. ifNull (P.getRange decl) (return mempty) $ \ (P.Range is) -> do let start = fromIntegral $ P.posPos $ P.iStart $ head is end = fromIntegral $ P.posPos $ P.iEnd $ last is -- Get all disambiguated names that fall within the range of decl. m0 <- use stDisambiguatedNames let (_, m1) = IntMap.split (pred start) m0 (m2, _) = IntMap.split end m1 constrs = IntMap.elems m2 -- Return suitable syntax highlighting information. let files = for constrs $ \ q -> generate modMap file kinds $ A.AmbQ [q] return $ Fold.fold files -- | Prints syntax highlighting info for an error. printErrorInfo :: TCErr -> TCM () printErrorInfo e = printHighlightingInfo . compress =<< errorHighlighting e -- | Generate highlighting for error. -- Does something special for termination errors. errorHighlighting :: TCErr -> TCM File errorHighlighting (TypeError s cl@(Closure sig env scope (TerminationCheckFailed termErrs))) = -- For termination errors, we keep the previous highlighting, -- just additionally mark the bad calls. return $ terminationErrorHighlighting termErrs errorHighlighting e = do -- Erase previous highlighting. let r = P.getRange e erase = singleton (rToR $ P.continuousPerLine r) mempty -- Print new highlighting. s <- E.prettyError e let error = singleton (rToR r) $ mempty { otherAspects = [Error] , note = Just s } return $ mconcat [ erase, error ] -- | Generate syntax highlighting for termination errors. terminationErrorHighlighting :: [TerminationError] -> File terminationErrorHighlighting termErrs = functionDefs `mappend` callSites where m = mempty { otherAspects = [TerminationProblem] } functionDefs = Fold.foldMap (\x -> singleton (rToR $ bindingSite x) m) $ concatMap M.termErrFunctions termErrs callSites = Fold.foldMap (\r -> singleton (rToR r) m) $ concatMap (map M.callInfoRange . M.termErrCalls) termErrs -- | Generates and prints syntax highlighting information for unsolved -- meta-variables and certain unsolved constraints. printUnsolvedInfo :: TCM () printUnsolvedInfo = do metaInfo <- computeUnsolvedMetaWarnings constraintInfo <- computeUnsolvedConstraints printHighlightingInfo (compress $ metaInfo `mappend` constraintInfo) -- | Generates syntax highlighting information for unsolved meta -- variables. computeUnsolvedMetaWarnings :: TCM File computeUnsolvedMetaWarnings = do is <- getInteractionMetas -- We don't want to highlight blocked terms, since -- * there is always at least one proper meta responsible for the blocking -- * in many cases the blocked term covers the highlighting for this meta let notBlocked m = not <$> isBlockedTerm m ms <- filterM notBlocked =<< getOpenMetas rs <- mapM getMetaRange (ms \\ is) return $ several (map (rToR . P.continuousPerLine) rs) (mempty { otherAspects = [UnsolvedMeta] }) -- | Generates syntax highlighting information for unsolved constraints -- that are not connected to a meta variable. computeUnsolvedConstraints :: TCM File computeUnsolvedConstraints = do cs <- getAllConstraints -- get ranges of emptyness constraints let rs = [ r | PConstr{ theConstraint = Closure{ clValue = IsEmpty r t }} <- cs ] return $ several (map (rToR . P.continuousPerLine) rs) (mempty { otherAspects = [UnsolvedConstraint] }) -- | Generates a suitable file for a possibly ambiguous name. generate :: SourceToModule -- ^ Maps source file paths to module names. -> AbsolutePath -- ^ The module to highlight. -> NameKinds -> A.AmbiguousQName -> File generate modMap file kinds (A.AmbQ qs) = mconcat $ map (\q -> nameToFileA modMap file q include m) qs where ks = map kinds qs -- Ulf, 2014-06-03: [issue1064] It's better to pick the first rather -- than doing no highlighting if there's an ambiguity between an -- inductive and coinductive constructor. kind = case [ k | Just k <- ks ] of k : _ -> Just k [] -> Nothing -- kind = case (allEqual ks, ks) of -- (True, Just k : _) -> Just k -- _ -> Nothing -- Note that all names in an AmbiguousQName should have the same -- concrete name, so either they are all operators, or none of -- them are. m isOp = mempty { aspect = Just $ Name kind isOp } include = allEqual (map bindingSite qs) -- | Converts names to suitable 'File's. nameToFile :: SourceToModule -- ^ Maps source file paths to module names. -> AbsolutePath -- ^ The file name of the current module. Used for -- consistency checking. -> [C.Name] -- ^ The name qualifier (may be empty). -> C.Name -- ^ The base name. -> (Bool -> Aspects) -- ^ Meta information to be associated with the name. -- The argument is 'True' iff the name is an operator. -> Maybe P.Range -- ^ The definition site of the name. The calculated -- meta information is extended with this information, -- if possible. -> File nameToFile modMap file xs x m mR = -- We don't care if we get any funny ranges. if all (== Just file) fileNames then several (map rToR rs) ((m $ C.isOperator x) { definitionSite = mFilePos }) else mempty where fileNames = catMaybes $ map (fmap P.srcFile . P.rStart . P.getRange) (x : xs) rs = map P.getRange (x : xs) mFilePos = do r <- mR P.Pn { P.srcFile = Just f, P.posPos = p } <- P.rStart r mod <- Map.lookup f modMap return (mod, fromIntegral p) -- | A variant of 'nameToFile' for qualified abstract names. nameToFileA :: SourceToModule -- ^ Maps source file paths to module names. -> AbsolutePath -- ^ The file name of the current module. Used for -- consistency checking. -> A.QName -- ^ The name. -> Bool -- ^ Should the binding site be included in the file? -> (Bool -> Aspects) -- ^ Meta information to be associated with the name. -- ^ The argument is 'True' iff the name is an operator. -> File nameToFileA modMap file x include m = nameToFile modMap file (concreteQualifier x) (concreteBase x) m (if include then Just $ bindingSite x else Nothing) concreteBase :: I.QName -> C.Name concreteBase = A.nameConcrete . A.qnameName concreteQualifier :: I.QName -> [C.Name] concreteQualifier = map A.nameConcrete . A.mnameToList . A.qnameModule bindingSite :: I.QName -> P.Range bindingSite = A.nameBindingSite . A.qnameName -- | Remember a name disambiguation (during type checking). -- To be used later during syntax highlighting. storeDisambiguatedName :: A.QName -> TCM () storeDisambiguatedName q = whenJust (start $ P.getRange q) $ \ i -> stDisambiguatedNames %= IntMap.insert i q where start (P.Range []) = Nothing start (P.Range (i:_)) = Just $ fromIntegral $ P.posPos $ P.iStart i -- TODO: Move start to Agda.Syntax.Position ------------------------------------------------------------------------ -- All tests -- | All the properties. tests :: IO Bool tests = runTests "Agda.Interaction.Highlighting.Generate" [] Agda-2.4.2.5/src/full/Agda/Interaction/Highlighting/Range.hs0000644000000000000000000000777212635075266021576 0ustar0000000000000000{-# LANGUAGE DeriveDataTypeable #-} -- | Ranges. module Agda.Interaction.Highlighting.Range ( Range(..) , rangeInvariant , Ranges(..) , rangesInvariant , overlapping , empty , rangeToPositions , rangesToPositions , rToR , minus , Agda.Interaction.Highlighting.Range.tests ) where import Control.Applicative ((<$>)) import Data.List import Data.Typeable (Typeable) import qualified Agda.Syntax.Position as P import Agda.Utils.List import Agda.Utils.TestHelpers import Agda.Utils.QuickCheck -- | Character ranges. The first character in the file has position 1. -- Note that the 'to' position is considered to be outside of the -- range. -- -- Invariant: @'from' '<=' 'to'@. data Range = Range { from, to :: Int } deriving (Eq, Ord, Show, Typeable) -- | The 'Range' invariant. rangeInvariant :: Range -> Bool rangeInvariant r = from r <= to r -- | Zero or more consecutive and separated ranges. newtype Ranges = Ranges [Range] deriving (Eq, Show) -- | The 'Ranges' invariant. rangesInvariant :: Ranges -> Bool rangesInvariant (Ranges []) = True rangesInvariant (Ranges rs) = and (zipWith (<) (map to $ init rs) (map from $ tail rs)) ------------------------------------------------------------------------ -- Queries -- | 'True' iff the ranges overlap. -- -- The ranges are assumed to be well-formed. overlapping :: Range -> Range -> Bool overlapping r1 r2 = not $ to r1 <= from r2 || to r2 <= from r1 -- | 'True' iff the range is empty. empty :: Range -> Bool empty r = to r <= from r ------------------------------------------------------------------------ -- Conversion -- | Converts a range to a list of positions. rangeToPositions :: Range -> [Int] rangeToPositions r = [from r .. to r - 1] -- | Converts several ranges to a list of positions. rangesToPositions :: Ranges -> [Int] rangesToPositions (Ranges rs) = concatMap rangeToPositions rs prop_rangesToPositions :: Ranges -> Bool prop_rangesToPositions rs = sorted (rangesToPositions rs) -- | Converts a 'P.Range' to a 'Ranges'. rToR :: P.Range -> Ranges rToR (P.Range is) = Ranges (map iToR is) where iToR (P.Interval { P.iStart = P.Pn { P.posPos = pos1 } , P.iEnd = P.Pn { P.posPos = pos2 } }) = Range { from = fromIntegral pos1, to = fromIntegral pos2 } ------------------------------------------------------------------------ -- Operations -- | @minus xs ys@ computes the difference between @xs@ and @ys@: the -- result contains those positions which are present in @xs@ but not -- in @ys@. -- -- Linear in the lengths of the input ranges. minus :: Ranges -> Ranges -> Ranges minus (Ranges rs1) (Ranges rs2) = Ranges (m rs1 rs2) where m [] _ = [] m xs [] = xs m (x:xs) (y:ys) | empty y = m (x:xs) ys | to x < from y = x : m xs (y:ys) | to y < from x = m (x:xs) ys | from x < from y = Range { from = from x, to = from y } : m (Range { from = from y, to = to x } : xs) (y:ys) | to y < to x = m (Range { from = to y, to = to x } : xs) ys | otherwise = m xs (y:ys) prop_minus :: Ranges -> Ranges -> Bool prop_minus xs ys = rangesToPositions (xs `minus` ys) == rangesToPositions xs \\ rangesToPositions ys ------------------------------------------------------------------------ -- Generators instance Arbitrary Range where arbitrary = do [from, to] <- fmap sort $ vectorOf 2 positive return $ Range { from = from, to = to } instance CoArbitrary Range where coarbitrary (Range f t) = coarbitrary f . coarbitrary t instance Arbitrary Ranges where arbitrary = rToR <$> arbitrary ------------------------------------------------------------------------ -- All tests -- | All the properties. tests :: IO Bool tests = runTests "Agda.Interaction.Highlighting.Range" [ quickCheck' rangeInvariant , quickCheck' rangesInvariant , quickCheck' (rangesInvariant . rToR) , quickCheck' (\r1 r2 -> rangesInvariant $ r1 `minus` r2) , quickCheck' prop_rangesToPositions , quickCheck' prop_minus ] Agda-2.4.2.5/src/full/Agda/Interaction/Options/0000755000000000000000000000000012635075266017217 5ustar0000000000000000Agda-2.4.2.5/src/full/Agda/Interaction/Options/Lenses.hs0000644000000000000000000001551612635075266021014 0ustar0000000000000000-- | Lenses for 'CommandLineOptions' and 'PragmaOptions'. -- -- Add as needed. -- -- Nothing smart happening here. module Agda.Interaction.Options.Lenses where import Control.Monad.State import Agda.TypeChecking.Monad.Base import Agda.TypeChecking.Monad.State import Agda.Interaction.Options import Agda.Utils.Lens --------------------------------------------------------------------------- -- * Pragma options --------------------------------------------------------------------------- class LensPragmaOptions a where getPragmaOptions :: a -> PragmaOptions setPragmaOptions :: PragmaOptions -> a -> a mapPragmaOptions :: (PragmaOptions -> PragmaOptions) -> a -> a -- default implementations setPragmaOptions = mapPragmaOptions . const mapPragmaOptions f a = setPragmaOptions (f $ getPragmaOptions a) a instance LensPragmaOptions CommandLineOptions where getPragmaOptions = optPragmaOptions setPragmaOptions opts st = st { optPragmaOptions = opts } instance LensPragmaOptions TCState where getPragmaOptions = (^.stPragmaOptions) setPragmaOptions = set stPragmaOptions modifyPragmaOptions :: (PragmaOptions -> PragmaOptions) -> TCM () modifyPragmaOptions = modify . mapPragmaOptions --------------------------------------------------------------------------- -- ** Verbosity in the local pragma options --------------------------------------------------------------------------- class LensVerbosity a where getVerbosity :: a -> Verbosity setVerbosity :: Verbosity -> a -> a mapVerbosity :: (Verbosity -> Verbosity) -> a -> a -- default implementations setVerbosity = mapVerbosity . const mapVerbosity f a = setVerbosity (f $ getVerbosity a) a instance LensVerbosity PragmaOptions where getVerbosity = optVerbose setVerbosity is opts = opts { optVerbose = is } instance LensVerbosity TCState where getVerbosity = getVerbosity . getPragmaOptions mapVerbosity = mapPragmaOptions . mapVerbosity modifyVerbosity :: (Verbosity -> Verbosity) -> TCM () modifyVerbosity = modify . mapVerbosity putVerbosity :: Verbosity -> TCM () putVerbosity = modify . setVerbosity --------------------------------------------------------------------------- -- * Command line options --------------------------------------------------------------------------- class LensCommandLineOptions a where getCommandLineOptions :: a -> CommandLineOptions setCommandLineOptions :: CommandLineOptions -> a -> a mapCommandLineOptions :: (CommandLineOptions -> CommandLineOptions) -> a -> a -- default implementations setCommandLineOptions = mapCommandLineOptions . const mapCommandLineOptions f a = setCommandLineOptions (f $ getCommandLineOptions a) a instance LensCommandLineOptions PersistentTCState where getCommandLineOptions = stPersistentOptions setCommandLineOptions opts st = st { stPersistentOptions = opts } instance LensCommandLineOptions TCState where getCommandLineOptions = getCommandLineOptions . stPersistentState mapCommandLineOptions = updatePersistentState . mapCommandLineOptions modifyCommandLineOptions :: (CommandLineOptions -> CommandLineOptions) -> TCM () modifyCommandLineOptions = modify . mapCommandLineOptions --------------------------------------------------------------------------- -- ** Safe mode --------------------------------------------------------------------------- type SafeMode = Bool class LensSafeMode a where getSafeMode :: a -> SafeMode setSafeMode :: SafeMode -> a -> a mapSafeMode :: (SafeMode -> SafeMode) -> a -> a -- default implementations setSafeMode = mapSafeMode . const mapSafeMode f a = setSafeMode (f $ getSafeMode a) a instance LensSafeMode CommandLineOptions where getSafeMode = optSafe setSafeMode is opts = opts { optSafe = is } instance LensSafeMode PersistentTCState where getSafeMode = getSafeMode . getCommandLineOptions mapSafeMode = mapCommandLineOptions . mapSafeMode instance LensSafeMode TCState where getSafeMode = getSafeMode . getCommandLineOptions mapSafeMode = mapCommandLineOptions . mapSafeMode modifySafeMode :: (SafeMode -> SafeMode) -> TCM () modifySafeMode = modify . mapSafeMode putSafeMode :: SafeMode -> TCM () putSafeMode = modify . setSafeMode --------------------------------------------------------------------------- -- ** Include directories --------------------------------------------------------------------------- class LensIncludeDirs a where getIncludeDirs :: a -> IncludeDirs setIncludeDirs :: IncludeDirs -> a -> a mapIncludeDirs :: (IncludeDirs -> IncludeDirs) -> a -> a -- default implementations setIncludeDirs = mapIncludeDirs . const mapIncludeDirs f a = setIncludeDirs (f $ getIncludeDirs a) a instance LensIncludeDirs CommandLineOptions where getIncludeDirs = optIncludeDirs setIncludeDirs is opts = opts { optIncludeDirs = is } instance LensIncludeDirs PersistentTCState where getIncludeDirs = getIncludeDirs . getCommandLineOptions mapIncludeDirs = mapCommandLineOptions . mapIncludeDirs instance LensIncludeDirs TCState where getIncludeDirs = getIncludeDirs . getCommandLineOptions mapIncludeDirs = mapCommandLineOptions . mapIncludeDirs modifyIncludeDirs :: (IncludeDirs -> IncludeDirs) -> TCM () modifyIncludeDirs = modify . mapIncludeDirs putIncludeDirs :: IncludeDirs -> TCM () putIncludeDirs = modify . setIncludeDirs --------------------------------------------------------------------------- -- ** Include directories --------------------------------------------------------------------------- type PersistentVerbosity = Verbosity class LensPersistentVerbosity a where getPersistentVerbosity :: a -> PersistentVerbosity setPersistentVerbosity :: PersistentVerbosity -> a -> a mapPersistentVerbosity :: (PersistentVerbosity -> PersistentVerbosity) -> a -> a -- default implementations setPersistentVerbosity = mapPersistentVerbosity . const mapPersistentVerbosity f a = setPersistentVerbosity (f $ getPersistentVerbosity a) a instance LensPersistentVerbosity PragmaOptions where getPersistentVerbosity = getVerbosity setPersistentVerbosity = setVerbosity instance LensPersistentVerbosity CommandLineOptions where getPersistentVerbosity = getPersistentVerbosity . getPragmaOptions mapPersistentVerbosity = mapPragmaOptions . mapPersistentVerbosity instance LensPersistentVerbosity PersistentTCState where getPersistentVerbosity = getPersistentVerbosity . getCommandLineOptions mapPersistentVerbosity = mapCommandLineOptions . mapPersistentVerbosity instance LensPersistentVerbosity TCState where getPersistentVerbosity = getPersistentVerbosity . getCommandLineOptions mapPersistentVerbosity = mapCommandLineOptions . mapPersistentVerbosity modifyPersistentVerbosity :: (PersistentVerbosity -> PersistentVerbosity) -> TCM () modifyPersistentVerbosity = modify . mapPersistentVerbosity putPersistentVerbosity :: PersistentVerbosity -> TCM () putPersistentVerbosity = modify . setPersistentVerbosity Agda-2.4.2.5/src/full/Agda/Termination/0000755000000000000000000000000012635075266015576 5ustar0000000000000000Agda-2.4.2.5/src/full/Agda/Termination/Termination.hs0000644000000000000000000002170312635075266020426 0ustar0000000000000000{-# LANGUAGE ImplicitParams #-} -- | Termination checker, based on -- \"A Predicative Analysis of Structural Recursion\" by -- Andreas Abel and Thorsten Altenkirch (JFP'01), -- and -- \"The Size-Change Principle for Program Termination\" by -- Chin Soon Lee, Neil Jones, and Amir Ben-Amram (POPL'01). module Agda.Termination.Termination ( terminates , terminatesFilter , endos , idempotent , Agda.Termination.Termination.tests ) where import Agda.Termination.CutOff import Agda.Termination.CallGraph hiding (tests) import Agda.Termination.CallMatrix hiding (tests, toList) import qualified Agda.Termination.CallMatrix as CMSet import Agda.Termination.Order hiding (tests) import Agda.Termination.SparseMatrix import Agda.Utils.Either import Agda.Utils.List import Agda.Utils.Maybe import Agda.Utils.TestHelpers hiding (idempotent) import Agda.Utils.QuickCheck import qualified Data.Array as Array import Data.Set (Set) import qualified Data.Set as Set import Data.Monoid import Data.List (partition) -- | TODO: This comment seems to be partly out of date. -- -- @'terminates' cs@ checks if the functions represented by @cs@ -- terminate. The call graph @cs@ should have one entry ('Call') per -- recursive function application. -- -- @'Right' perms@ is returned if the functions are size-change terminating. -- -- If termination can not be established, then @'Left' problems@ is -- returned instead. Here @problems@ contains an -- indication of why termination cannot be established. See 'lexOrder' -- for further details. -- -- Note that this function assumes that all data types are strictly -- positive. -- -- The termination criterion is taken from Jones et al. -- In the completed call graph, each idempotent call-matrix -- from a function to itself must have a decreasing argument. -- Idempotency is wrt. matrix multiplication. -- -- This criterion is strictly more liberal than searching for a -- lexicographic order (and easier to implement, but harder to justify). terminates :: (Monoid cinfo, ?cutoff :: CutOff) => CallGraph cinfo -> Either cinfo () terminates cs = checkIdems $ endos $ toList $ complete cs terminatesFilter :: (Monoid cinfo, ?cutoff :: CutOff) => (Node -> Bool) -> CallGraph cinfo -> Either cinfo () terminatesFilter f cs = checkIdems $ endos $ filter f' $ toList $ complete cs where f' c = f (source c) && f (target c) endos :: [Call cinfo] -> [CallMatrixAug cinfo] endos cs = [ m | c <- cs, source c == target c , m <- CMSet.toList $ callMatrixSet c ] checkIdems :: (Monoid cinfo, ?cutoff :: CutOff) => [CallMatrixAug cinfo] -> Either cinfo () checkIdems calls = caseMaybe (headMaybe offending) (Right ()) $ Left . augCallInfo where -- Every idempotent call must have decrease, otherwise it offends us. offending = filter (not . hasDecrease) $ filter idempotent calls checkIdem :: (?cutoff :: CutOff) => CallMatrixAug cinfo -> Bool checkIdem c = if idempotent c then hasDecrease c else True -- | A call @c@ is idempotent if it is an endo (@'source' == 'target'@) -- of order 1. -- (Endo-calls of higher orders are e.g. argument permutations). -- We can test idempotency by self-composition. -- Self-composition @c >*< c@ should not make any parameter-argument relation -- worse. idempotent :: (?cutoff :: CutOff) => CallMatrixAug cinfo -> Bool idempotent (CallMatrixAug m _) = (m >*< m) `notWorse` m hasDecrease :: (?cutoff :: CutOff) => CallMatrixAug cinfo -> Bool hasDecrease = any isDecr . diagonal ------------------------------------------------------------------------ -- Some examples {- Convention (see TermCheck): Guardedness flag is in position (0,0) of the matrix, it is always present even if the functions are all recursive. The examples below do not include the guardedness flag, though. -} -- | The call graph instantiation used by the examples below. type CG = CallGraph () -- | Constructs a call graph. No meta info. buildCallGraph :: [Call ()] -> CG buildCallGraph = fromList -- | The example from the JFP'02 paper. example1 :: CG example1 = buildCallGraph [c1, c2, c3] where flat = 1 aux = 2 c1 = mkCall' flat aux $ CallMatrix $ fromLists (Size 2 1) [ [lt] , [lt]] c2 = mkCall' aux aux $ CallMatrix $ fromLists (Size 2 2) [ [lt, unknown] , [unknown, le]] c3 = mkCall' aux flat $ CallMatrix $ fromLists (Size 1 2) [ [unknown, le]] prop_terminates_example1 :: (?cutoff :: CutOff) => Bool prop_terminates_example1 = isRight $ terminates example1 -- | An example which is now handled by this algorithm: argument -- swapping addition. -- -- @S x + y = S (y + x)@ -- -- @Z + y = y@ example2 :: CG example2 = buildCallGraph [c] where plus = 1 c = mkCall' plus plus $ CallMatrix $ fromLists (Size 2 2) [ [unknown, le] , [lt, unknown] ] prop_terminates_example2 :: (?cutoff :: CutOff) => Bool prop_terminates_example2 = isRight $ terminates example2 -- | A related example which is anyway handled: argument swapping addition -- using two alternating functions. -- -- @S x + y = S (y +' x)@ -- -- @Z + y = y@ -- -- @S x +' y = S (y + x)@ -- -- @Z +' y = y@ example3 :: CG example3 = buildCallGraph [c plus plus', c plus' plus] where plus = 1 plus' = 2 c f g = mkCall' f g $ CallMatrix $ fromLists (Size 2 2) [ [unknown, le] , [lt, unknown] ] prop_terminates_example3 :: (?cutoff :: CutOff) => Bool prop_terminates_example3 = isRight $ terminates example3 -- | A contrived example. -- -- @f (S x) y = f (S x) y + g x y@ -- -- @f Z y = y@ -- -- @g x y = f x y@ -- -- TODO: This example checks that the meta information is reported properly -- when an error is encountered. example4 :: CG example4 = buildCallGraph [c1, c2, c3] where f = 1 g = 2 c1 = mkCall' f f $ CallMatrix $ fromLists (Size 2 2) $ [ [le, unknown] , [unknown, le] ] c2 = mkCall' f g $ CallMatrix $ fromLists (Size 2 2) $ [ [lt, unknown] , [unknown, le] ] c3 = mkCall' g f $ CallMatrix $ fromLists (Size 2 2) $ [ [le, unknown] , [unknown, le] ] prop_terminates_example4 :: (?cutoff :: CutOff) => Bool prop_terminates_example4 = isLeft $ terminates example4 -- | This should terminate. -- -- @f (S x) (S y) = g x (S y) + f (S (S x)) y@ -- -- @g (S x) (S y) = f (S x) (S y) + g x (S y)@ example5 :: CG example5 = buildCallGraph [c1, c2, c3, c4] where f = 1 g = 2 c1 = mkCall' f g $ CallMatrix $ fromLists (Size 2 2) [ [lt, unknown] , [unknown, le] ] c2 = mkCall' f f $ CallMatrix $ fromLists (Size 2 2) [ [unknown, unknown] , [unknown, lt] ] c3 = mkCall' g f $ CallMatrix $ fromLists (Size 2 2) [ [le, unknown] , [unknown, le] ] c4 = mkCall' g g $ CallMatrix $ fromLists (Size 2 2) [ [lt, unknown] , [unknown, le] ] prop_terminates_example5 :: (?cutoff :: CutOff) => Bool prop_terminates_example5 = isRight $ terminates example5 -- | Another example which should fail. -- -- @f (S x) = f x + f (S x)@ -- -- @f x = f x@ -- -- TODO: This example checks that the meta information is reported properly -- when an error is encountered. example6 :: CG example6 = buildCallGraph [c1, c2, c3] where f = 1 c1 = mkCall' f f $ CallMatrix $ fromLists (Size 1 1) [ [lt] ] c2 = mkCall' f f $ CallMatrix $ fromLists (Size 1 1) [ [le] ] c3 = mkCall' f f $ CallMatrix $ fromLists (Size 1 1) [ [le] ] prop_terminates_example6 :: (?cutoff :: CutOff) => Bool prop_terminates_example6 = isLeft $ terminates example6 -- See issue 1055. -- (The following function was adapted from Lee, Jones, and Ben-Amram, -- POPL '01). -- -- p : ℕ → ℕ → ℕ → ℕ -- p m n (succ r) = p m r n -- p m (succ n) zero = p zero n m -- p m zero zero = m example7 :: CG example7 = buildCallGraph [call1, call2] where call1 = mkCall' 1 1 $ CallMatrix $ fromLists (Size 3 3) [ [le, le, le] , [un, lt, un] , [le, un, un] ] call2 = mkCall' 1 1 $ CallMatrix $ fromLists (Size 3 3) [ [le, un, un] , [un, un, lt] , [un, le, un] ] un = unknown prop_terminates_example7 :: (?cutoff :: CutOff) => Bool prop_terminates_example7 = isRight $ terminates example7 ------------------------------------------------------------------------ -- All tests tests :: IO Bool tests = runTests "Agda.Termination.Termination" [ quickCheck' prop_terminates_example1 , quickCheck' prop_terminates_example2 , quickCheck' prop_terminates_example3 , quickCheck' prop_terminates_example4 , quickCheck' prop_terminates_example5 , quickCheck' prop_terminates_example6 , quickCheck' prop_terminates_example7 ] where ?cutoff = CutOff 0 -- all these examples are with just lt,le,unknown Agda-2.4.2.5/src/full/Agda/Termination/CallMatrix.hs0000644000000000000000000002333312635075266020176 0ustar0000000000000000-- {-# LANGUAGE CPP #-} {-# LANGUAGE DeriveFoldable #-} {-# LANGUAGE DeriveFunctor #-} {-# LANGUAGE DeriveTraversable #-} {-# LANGUAGE FlexibleInstances #-} {-# LANGUAGE GeneralizedNewtypeDeriving #-} {-# LANGUAGE ImplicitParams #-} {-# LANGUAGE MultiParamTypeClasses #-} {-# LANGUAGE StandaloneDeriving #-} module Agda.Termination.CallMatrix where -- module Agda.Termination.CallMatrix -- ( CallMatrix'(..), CallMatrix -- , callMatrix -- , CallComb(..) -- , tests -- ) where import Data.List as List hiding (union, insert) import Data.Monoid import Data.Foldable (Foldable) import qualified Data.Foldable as Fold import Data.Traversable (Traversable) import qualified Data.Traversable as Trav import Agda.Termination.CutOff import Agda.Termination.Order as Order hiding (tests) import Agda.Termination.SparseMatrix as Matrix hiding (tests) import Agda.Termination.Semiring (HasZero(..), Semiring) import qualified Agda.Termination.Semiring as Semiring import Agda.Utils.Favorites (Favorites) import qualified Agda.Utils.Favorites as Fav import Agda.Utils.Monad import Agda.Utils.Null import Agda.Utils.PartialOrd hiding (tests) import Agda.Utils.Pretty hiding ((<>)) import Agda.Utils.QuickCheck import Agda.Utils.Singleton import Agda.Utils.TestHelpers ------------------------------------------------------------------------ -- * Call matrices ------------------------------------------------------------------------ -- | Call matrix indices = function argument indices. -- -- Machine integer 'Int' is sufficient, since we cannot index more arguments -- than we have addresses on our machine. type ArgumentIndex = Int -- | Call matrices. -- -- A call matrix for a call @f --> g@ has dimensions @ar(g) × ar(f)@. -- -- Each column corresponds to one formal argument of caller @f@. -- Each row corresponds to one argument in the call to @g@. -- -- In the presence of dot patterns, a call argument can be related -- to /several/ different formal arguments of @f@. -- -- See e.g. @test/succeed/DotPatternTermination.agda@: -- -- @ -- data D : Nat -> Set where -- cz : D zero -- c1 : forall n -> D n -> D (suc n) -- c2 : forall n -> D n -> D n -- -- f : forall n -> D n -> Nat -- f .zero cz = zero -- f .(suc n) (c1 n d) = f n (c2 n d) -- f n (c2 .n d) = f n d -- @ -- -- Call matrices (without guardedness) are -- -- @ -- -1 -1 n < suc n and n < c1 n d -- ? = c2 n d <= c1 n d -- -- = -1 n <= n and n < c2 n d -- ? -1 d < c2 n d -- @ -- -- Here is a part of the original documentation for call matrices -- (kept for historical reasons): -- -- This datatype encodes information about a single recursive -- function application. The columns of the call matrix stand for -- 'source' function arguments (patterns). The rows of the matrix stand for -- 'target' function arguments. Element @(i, j)@ in the matrix should -- be computed as follows: -- -- * 'Order.lt' (less than) if the @j@-th argument to the 'target' -- function is structurally strictly smaller than the @i@-th -- pattern. -- -- * 'Order.le' (less than or equal) if the @j@-th argument to the -- 'target' function is structurally smaller than the @i@-th -- pattern. -- -- * 'Order.unknown' otherwise. newtype CallMatrix' a = CallMatrix { mat :: Matrix ArgumentIndex a } deriving (Eq, Ord, Show, Functor, Foldable, Traversable, CoArbitrary, PartialOrd) type CallMatrix = CallMatrix' Order deriving instance NotWorse CallMatrix instance HasZero a => Diagonal (CallMatrix' a) a where diagonal = diagonal . mat -- | Call matrix multiplication and call combination. class CallComb a where (>*<) :: (?cutoff :: CutOff) => a -> a -> a -- | Call matrix multiplication. -- -- @f --(m1)--> g --(m2)--> h@ is combined to @f --(m2 `mul` m1)--> h@ -- -- Note the reversed order of multiplication: -- The matrix @c1@ of the second call @g-->h@ in the sequence -- @f-->g-->h@ is multiplied with the matrix @c2@ of the first call. -- -- Preconditions: -- @m1@ has dimensions @ar(g) × ar(f)@. -- @m2@ has dimensions @ar(h) × ar(g)@. -- -- Postcondition: -- @m1 >*< m2@ has dimensions @ar(h) × ar(f)@. instance CallComb CallMatrix where CallMatrix m1 >*< CallMatrix m2 = CallMatrix $ mul orderSemiring m2 m1 {- UNUSED, BUT DON'T REMOVE! -- | Call matrix addition = minimum = pick worst information. addCallMatrices :: (?cutoff :: CutOff) => CallMatrix -> CallMatrix -> CallMatrix addCallMatrices cm1 cm2 = CallMatrix $ add (Semiring.add orderSemiring) (mat cm1) (mat cm2) -} ------------------------------------------------------------------------ -- * Call matrix augmented with path information. ------------------------------------------------------------------------ -- | Call matrix augmented with path information. data CallMatrixAug cinfo = CallMatrixAug { augCallMatrix :: CallMatrix -- ^ The matrix of the (composed call). , augCallInfo :: cinfo -- ^ Meta info, like call path. } deriving (Eq, Show) instance Diagonal (CallMatrixAug cinfo) Order where diagonal = diagonal . augCallMatrix instance PartialOrd (CallMatrixAug cinfo) where comparable m m' = comparable (augCallMatrix m) (augCallMatrix m') instance NotWorse (CallMatrixAug cinfo) where c1 `notWorse` c2 = augCallMatrix c1 `notWorse` augCallMatrix c2 -- | Augmented call matrix multiplication. instance Monoid cinfo => CallComb (CallMatrixAug cinfo) where CallMatrixAug m1 p1 >*< CallMatrixAug m2 p2 = CallMatrixAug (m1 >*< m2) (mappend p1 p2) -- | Non-augmented call matrix. noAug :: Monoid cinfo => CallMatrix -> CallMatrixAug cinfo noAug m = CallMatrixAug m mempty ------------------------------------------------------------------------ -- * Sets of incomparable call matrices augmented with path information. ------------------------------------------------------------------------ -- | Sets of incomparable call matrices augmented with path information. -- Use overloaded 'null', 'empty', 'singleton', 'mappend'. newtype CMSet cinfo = CMSet { cmSet :: Favorites (CallMatrixAug cinfo) } deriving ( Show, Arbitrary, CoArbitrary , Monoid, Null, Singleton (CallMatrixAug cinfo) ) -- | Call matrix set product is the Cartesian product. instance Monoid cinfo => CallComb (CMSet cinfo) where CMSet as >*< CMSet bs = CMSet $ Fav.fromList $ [ a >*< b | a <- Fav.toList as, b <- Fav.toList bs ] -- | Insert into a call matrix set. insert :: CallMatrixAug cinfo -> CMSet cinfo -> CMSet cinfo insert a (CMSet as) = CMSet $ Fav.insert a as -- | Union two call matrix sets. union :: CMSet cinfo -> CMSet cinfo -> CMSet cinfo union = mappend -- union (CMSet as) (CMSet bs) = CMSet $ Fav.union as bs -- | Convert into a list of augmented call matrices. toList :: CMSet cinfo -> [CallMatrixAug cinfo] toList (CMSet as) = Fav.toList as ------------------------------------------------------------------------ -- * Printing ------------------------------------------------------------------------ instance Pretty CallMatrix where pretty (CallMatrix m) = pretty m instance Pretty cinfo => Pretty (CallMatrixAug cinfo) where pretty (CallMatrixAug m cinfo) = pretty cinfo $$ pretty m instance Pretty cinfo => Pretty (CMSet cinfo) where pretty = vcat . punctuate newLine . map pretty . toList where newLine = text "\n" ------------------------------------------------------------------------ -- * Generators and tests ------------------------------------------------------------------------ -- ** CallMatrix instance Arbitrary CallMatrix where arbitrary = callMatrix =<< arbitrary -- | Generates a call matrix of the given size. callMatrix :: Size ArgumentIndex -> Gen CallMatrix callMatrix sz = CallMatrix <$> matrix sz -- ** CallMatrixAug instance Arbitrary cinfo => Arbitrary (CallMatrixAug cinfo) where arbitrary = CallMatrixAug <$> arbitrary <*> arbitrary instance CoArbitrary cinfo => CoArbitrary (CallMatrixAug cinfo) where coarbitrary (CallMatrixAug m info) = coarbitrary m . coarbitrary info ------------------------------------------------------------------------ -- * All tests ------------------------------------------------------------------------ tests :: IO Bool tests = runTests "Agda.Termination.CallMatrix" [ ] where ?cutoff = DontCutOff -- CutOff 2 -- don't cut off in tests! -- RETIRED: LONG OUTDATED call matrix invariant -- -- | In a call matrix at most one element per row may be different -- -- from 'unknown'. -- callMatrixInvariant :: CallMatrix -> Bool -- callMatrixInvariant (CallMatrix m) = -- matrixInvariant m && -- all ((<= 1) . length . filter (/= unknown)) (toLists m) -- prop_Arbitrary_CallMatrix = callMatrixInvariant -- -- | Generates a call matrix of the given size. -- callMatrix :: Size ArgumentIndex -> Gen CallMatrix -- callMatrix sz = do -- m <- matrixUsingRowGen sz rowGen -- return $ CallMatrix { mat = m } -- where -- rowGen :: ArgumentIndex -> Gen [Order] -- rowGen 0 = return [] -- rowGen n = do -- x <- arbitrary -- i <- choose (0, n - 1) -- return $ genericReplicate i unknown ++ [x] ++ -- genericReplicate (n - 1 - i) unknown -- prop_callMatrix sz = -- forAll (callMatrix sz) $ \cm -> -- callMatrixInvariant cm -- && -- size (mat cm) == sz -- prop_cmMul sz = -- forAll natural $ \c2 -> -- forAll (callMatrix sz) $ \cm1 -> -- forAll (callMatrix $ Size { rows = cols sz, cols = c2 }) $ \cm2 -> -- callMatrixInvariant (cm1 >*< cm2) -- tests :: IO Bool -- tests = runTests "Agda.Termination.CallMatrix" -- [ quickCheck' callMatrixInvariant -- , quickCheck' prop_Arbitrary_CallMatrix -- , quickCheck' prop_callMatrix -- , quickCheck' prop_cmMul -- ] -- where ?cutoff = DontCutOff -- CutOff 2 -- don't cut off in tests! Agda-2.4.2.5/src/full/Agda/Termination/CutOff.hs0000644000000000000000000000106612635075266017323 0ustar0000000000000000-- | Defines 'CutOff' type which is used in "Agda.Interaction.Options". -- This module's purpose is to eliminate the dependency of -- "Agda.TypeChecking.Monad.Base" on the termination checker and -- everything it imports. module Agda.Termination.CutOff where -- | Cut off structural order comparison at some depth in termination checker? data CutOff = CutOff Int -- ^ @c >= 0@ means: record decrease up to including @c+1@. | DontCutOff deriving (Eq, Ord) instance Show CutOff where show (CutOff k) = show k show DontCutOff = "∞" -- That's it! Agda-2.4.2.5/src/full/Agda/Termination/RecCheck.hs0000644000000000000000000000360612635075266017606 0ustar0000000000000000{- Checking for recursion: - We detect truly (co)recursive definitions by computing the dependency graph and checking for cycles. - This is inexpensive and let us skip the termination check when there's no (co)recursion Original contribution by Andrea Vezzosi (sanzhiyan). This implementation by Andreas. -} module Agda.Termination.RecCheck ( recursive , anyDefs ) where import Control.Applicative import Data.Graph import Data.List (nub) import qualified Data.Map as Map import Agda.Syntax.Internal import Agda.Syntax.Internal.Defs import Agda.TypeChecking.Monad recursive :: [QName] -> TCM Bool recursive names = do graph <- zip names <$> mapM (\ d -> nub <$> recDef names d) names reportSLn "rec.graph" 20 $ show graph return $ cyclic graph -- | A graph is cyclic if it has any strongly connected component. cyclic :: [(QName, [QName])] -> Bool cyclic g = or [ True | CyclicSCC _ <- stronglyConnComp g' ] where g' = map (\ (n, ns) -> ((), n, ns)) g -- | @recDef names name@ returns all definitions from @names@ -- that are used in the body of @name@. recDef :: [QName] -> QName -> TCM [QName] recDef names name = do -- Retrieve definition def <- getConstInfo name case theDef def of Function{ funClauses = cls } -> anyDefs names cls _ -> return [] -- | @anysDef names a@ returns all definitions from @names@ -- that are used in @a@. anyDefs :: GetDefs a => [QName] -> a -> TCM [QName] anyDefs names a = do -- Prepare function to lookup metas outside of TCM st <- getMetaStore let lookup x = case mvInstantiation <$> Map.lookup x st of Just (InstV _ v) -> Just v -- TODO: ignoring the lambdas might be bad? _ -> Nothing -- we collect only those used definitions that are in @names@ emb d = if d `elem` names then [d] else [] -- get all the Defs that are in names return $ getDefs' lookup emb a Agda-2.4.2.5/src/full/Agda/Termination/TermCheck.hs0000644000000000000000000014303612635075266020006 0ustar0000000000000000{-# LANGUAGE CPP #-} {-# LANGUAGE FlexibleInstances #-} {-# LANGUAGE GeneralizedNewtypeDeriving #-} {-# LANGUAGE ImplicitParams #-} {-# LANGUAGE NamedFieldPuns #-} {-# LANGUAGE PatternGuards #-} {-# LANGUAGE StandaloneDeriving #-} {-# LANGUAGE TupleSections #-} {- Checking for Structural recursion Authors: Andreas Abel, Nils Anders Danielsson, Ulf Norell, Karl Mehltretter and others Created: 2007-05-28 Source : TypeCheck.Rules.Decl -} module Agda.Termination.TermCheck ( termDecl , Result, DeBruijnPat ) where import Prelude hiding (null) import Control.Applicative hiding (empty) import Control.Monad.State import Data.Foldable (toList) import Data.List hiding (null) import qualified Data.List as List import Data.Maybe (mapMaybe, isJust, fromMaybe) import Data.Monoid import qualified Data.Map as Map import Data.Set (Set) import qualified Data.Set as Set import Data.Traversable (traverse) import Agda.Syntax.Abstract (IsProjP(..), AllNames(..)) import qualified Agda.Syntax.Abstract as A import Agda.Syntax.Internal as I import Agda.Syntax.Internal.Generic import qualified Agda.Syntax.Info as Info import Agda.Syntax.Position import Agda.Syntax.Common as Common import Agda.Syntax.Literal (Literal(LitString)) import Agda.Termination.CutOff import Agda.Termination.Monad import Agda.Termination.CallGraph hiding (toList) import qualified Agda.Termination.CallGraph as CallGraph import Agda.Termination.CallMatrix hiding (toList) import Agda.Termination.Order as Order import qualified Agda.Termination.SparseMatrix as Matrix import Agda.Termination.Termination (endos, idempotent) import qualified Agda.Termination.Termination as Term import Agda.Termination.RecCheck import Agda.Termination.Inlining import Agda.TypeChecking.Monad import Agda.TypeChecking.Pretty import Agda.TypeChecking.Reduce (reduce, normalise, instantiate, instantiateFull) import Agda.TypeChecking.Records -- (isRecordConstructor, isInductiveRecord) import Agda.TypeChecking.Telescope import Agda.TypeChecking.EtaContract import Agda.TypeChecking.Monad.Builtin import Agda.TypeChecking.Substitute import Agda.TypeChecking.SizedTypes import Agda.TypeChecking.Datatypes import Agda.TypeChecking.Positivity.Occurrence import qualified Agda.Benchmarking as Benchmark import Agda.TypeChecking.Monad.Benchmark (billTo, billPureTo) import Agda.Interaction.Options import Agda.Utils.Either import Agda.Utils.Function import Agda.Utils.Functor (($>), (<.>)) import Agda.Utils.List import Agda.Utils.Size import Agda.Utils.Maybe import Agda.Utils.Monad -- (mapM', forM', ifM, or2M, and2M) import Agda.Utils.Null import Agda.Utils.Permutation import Agda.Utils.Pretty (render) import Agda.Utils.Singleton import Agda.Utils.VarSet (VarSet) import qualified Agda.Utils.VarSet as VarSet #include "undefined.h" import Agda.Utils.Impossible -- | Call graph with call info for composed calls. type Calls = CallGraph CallPath -- | The result of termination checking a module. -- Must be a 'Monoid' and have 'Singleton'. type Result = [TerminationError] -- | Entry point: Termination check a single declaration. termDecl :: A.Declaration -> TCM Result termDecl d = inTopContext $ ignoreAbstractMode $ termDecl' d -- | Termination check a sequence of declarations. termDecls :: [A.Declaration] -> TCM Result termDecls ds = concat <$> mapM termDecl' ds -- | Termination check a single declaration -- (without necessarily ignoring @abstract@). termDecl' :: A.Declaration -> TCM Result termDecl' d = case d of A.Axiom {} -> return mempty A.Field {} -> return mempty A.Primitive {} -> return mempty A.Mutual _ ds | [A.RecSig{}, A.RecDef _ _ _ _ _ _ rds] <- unscopeDefs ds -> termDecls rds A.Mutual i ds -> termMutual i ds A.Section _ _ _ ds -> termDecls ds -- section structure can be ignored as we are termination checking -- definitions lifted to the top-level A.Apply {} -> return mempty A.Import {} -> return mempty A.Pragma {} -> return mempty A.Open {} -> return mempty A.PatternSynDef {} -> return mempty -- open and pattern synonym defs are just artifacts from the concrete syntax A.ScopedDecl _ ds -> termDecls ds -- scope is irrelevant as we are termination checking Syntax.Internal A.RecSig{} -> return mempty A.RecDef _ r _ _ _ _ ds -> termDecls ds -- These should all be wrapped in mutual blocks A.FunDef{} -> __IMPOSSIBLE__ A.DataSig{} -> __IMPOSSIBLE__ A.DataDef{} -> __IMPOSSIBLE__ -- This should have been expanded to a proper declaration before termination checking A.UnquoteDecl{} -> __IMPOSSIBLE__ where unscopeDefs = concatMap unscopeDef unscopeDef (A.ScopedDecl _ ds) = unscopeDefs ds unscopeDef d = [d] -- | Termination check a bunch of mutually inductive recursive definitions. termMutual :: Info.MutualInfo -> [A.Declaration] -> TCM Result termMutual i ds = if names == [] then return mempty else -- We set the range to avoid panics when printing error messages. setCurrentRange i $ do -- Get set of mutually defined names from the TCM. -- This includes local and auxiliary functions introduced -- during type-checking. mutualBlock <- findMutualBlock (head names) let allNames = Set.elems mutualBlock -- Andreas, 2014-03-26 -- Keeping recursion check after experiments on the standard lib. -- Seems still to save 1s. -- skip = return False -- No need to term-check if the declarations are acyclic! skip = not <$> do billTo [Benchmark.Termination, Benchmark.RecCheck] $ recursive allNames reportSLn "term.mutual" 10 $ "Termination checking " ++ show allNames -- NO_TERMINATION_CHECK if (Info.mutualTermCheck i `elem` [ NoTerminationCheck, Terminating ]) then do reportSLn "term.warn.yes" 2 $ "Skipping termination check for " ++ show names forM_ allNames $ \ q -> setTerminates q True -- considered terminating! return mempty -- NON_TERMINATING else if (Info.mutualTermCheck i == NonTerminating) then do reportSLn "term.warn.yes" 2 $ "Considering as non-terminating: " ++ show names forM_ allNames $ \ q -> setTerminates q False return mempty -- Trivially terminating (non-recursive) else ifM skip (do reportSLn "term.warn.yes" 2 $ "Trivially terminating: " ++ show names forM_ allNames $ \ q -> setTerminates q True return mempty) $ {- else -} do -- Set the mutual names in the termination environment. let setNames e = e { terMutual = allNames , terUserNames = names } runTerm cont = runTerDefault $ do cutoff <- terGetCutOff reportSLn "term.top" 10 $ "Termination checking " ++ show names ++ " with cutoff=" ++ show cutoff ++ "..." terLocal setNames cont -- New check currently only makes a difference for copatterns. -- Since it is slow, only invoke it if -- any of the definitions uses copatterns. res <- ifM (orM $ map usesCopatterns allNames) -- Then: New check, one after another. (runTerm $ forM' allNames $ termFunction) -- Else: Old check, all at once. (runTerm $ termMutual') -- record result of termination check in signature let terminates = null res forM_ allNames $ \ q -> setTerminates q terminates return res where getName (A.FunDef i x delayed cs) = [x] getName (A.RecDef _ _ _ _ _ _ ds) = concatMap getName ds getName (A.Mutual _ ds) = concatMap getName ds getName (A.Section _ _ _ ds) = concatMap getName ds getName (A.ScopedDecl _ ds) = concatMap getName ds getName _ = [] -- the mutual names mentioned in the abstract syntax names = concatMap getName ds -- | @termMutual'@ checks all names of the current mutual block, -- henceforth called @allNames@, for termination. -- -- @allNames@ is taken from 'Internal' syntax, it contains also -- the definitions created by the type checker (e.g., with-functions). termMutual' :: TerM Result termMutual' = do -- collect all recursive calls in the block allNames <- terGetMutual let collect = forM' allNames termDef -- first try to termination check ignoring the dot patterns calls1 <- collect reportCalls "no " calls1 cutoff <- terGetCutOff let ?cutoff = cutoff r <- billToTerGraph $ Term.terminates calls1 r <- case r of r@Right{} -> return r Left{} -> do -- Try again, but include the dot patterns this time. calls2 <- terSetUseDotPatterns True $ collect reportCalls "" calls2 billToTerGraph $ Term.terminates calls2 -- @names@ is taken from the 'Abstract' syntax, so it contains only -- the names the user has declared. This is for error reporting. names <- terGetUserNames case r of Left calls -> return $ singleton $ terminationError names $ callInfos calls Right{} -> do liftTCM $ reportSLn "term.warn.yes" 2 $ show (names) ++ " does termination check" return mempty -- | Smart constructor for 'TerminationError'. -- Removes 'termErrFunctions' that are not mentioned in 'termErrCalls'. terminationError :: [QName] -> [CallInfo] -> TerminationError terminationError names calls = TerminationError names' calls where names' = names `intersect` toList (allNames calls) -- ASR (08 November 2014). The type of the function could be -- -- @Either a b -> TerM (Either a b)@. billToTerGraph :: a -> TerM a billToTerGraph a = liftTCM $ billPureTo [Benchmark.Termination, Benchmark.Graph] a -- | @reportCalls@ for debug printing. -- -- Replays the call graph completion for debugging. reportCalls :: String -> Calls -> TerM () reportCalls no calls = do cutoff <- terGetCutOff let ?cutoff = cutoff -- We work in TCM exclusively. liftTCM $ do reportS "term.lex" 20 $ unlines [ "Calls (" ++ no ++ "dot patterns): " ++ show calls ] -- Print the whole completion phase. verboseS "term.matrices" 40 $ do let header s = unlines [ replicate n '=' , replicate k '=' ++ s ++ replicate k' '=' , replicate n '=' ] where n = 70 r = n - length s k = r `div` 2 k' = r - k let report s cs = reportSDoc "term.matrices" 40 $ vcat [ text $ header s , nest 2 $ pretty cs ] cs0 = calls step cs = do let (new, cs') = completionStep cs0 cs report " New call matrices " new return $ if null new then Left () else Right cs' report " Initial call matrices " cs0 trampolineM step cs0 -- Print the result of completion. let calls' = CallGraph.complete calls idems = filter idempotent $ endos $ CallGraph.toList calls' -- TODO -- reportSDoc "term.behaviours" 20 $ vcat -- [ text $ "Recursion behaviours (" ++ no ++ "dot patterns):" -- , nest 2 $ return $ Term.prettyBehaviour calls' -- ] reportSDoc "term.matrices" 30 $ vcat [ text $ "Idempotent call matrices (" ++ no ++ "dot patterns):\n" , nest 2 $ vcat $ punctuate (text "\n") $ map pretty idems ] -- reportSDoc "term.matrices" 30 $ vcat -- [ text $ "Other call matrices (" ++ no ++ "dot patterns):" -- , nest 2 $ pretty $ CallGraph.fromList others -- ] return () -- | @termFunction name@ checks @name@ for termination. termFunction :: QName -> TerM Result termFunction name = do -- Function @name@ is henceforth referred to by its @index@ -- in the list of @allNames@ of the mutual block. allNames <- terGetMutual let index = fromMaybe __IMPOSSIBLE__ $ List.elemIndex name allNames -- Retrieve the target type of the function to check. target <- liftTCM $ do typeEndsInDef =<< typeOfConst name reportTarget target terSetTarget target $ do -- Collect the recursive calls in the block which (transitively) -- involve @name@, -- taking the target of @name@ into account for computing guardedness. let collect = (`trampolineM` (Set.singleton index, mempty, mempty)) $ \ (todo, done, calls) -> do if null todo then return $ Left calls else do -- Extract calls originating from indices in @todo@. new <- forM' todo $ \ i -> termDef $ fromMaybe __IMPOSSIBLE__ $ allNames !!! i -- Mark those functions as processed and add the calls to the result. let done' = done `mappend` todo calls' = new `mappend` calls -- Compute the new todo list: todo' = CallGraph.targetNodes new Set.\\ done' -- Jump the trampoline. return $ Right (todo', done', calls') -- First try to termination check ignoring the dot patterns calls1 <- terSetUseDotPatterns False $ collect reportCalls "no " calls1 r <- do cutoff <- terGetCutOff let ?cutoff = cutoff r <- billToTerGraph $ Term.terminatesFilter (== index) calls1 case r of Right () -> return $ Right () Left{} -> do -- Try again, but include the dot patterns this time. calls2 <- terSetUseDotPatterns True $ collect reportCalls "" calls2 billToTerGraph $ mapLeft callInfos $ Term.terminatesFilter (== index) calls2 names <- terGetUserNames case r of Left calls -> return $ singleton $ terminationError ([name] `intersect` names) calls Right () -> do liftTCM $ reportSLn "term.warn.yes" 2 $ show name ++ " does termination check" return mempty where reportTarget r = liftTCM $ reportSLn "term.target" 20 $ " target type " ++ caseMaybe r "not recognized" (\ q -> "ends in " ++ show q) -- | To process the target type. typeEndsInDef :: MonadTCM tcm => Type -> tcm (Maybe QName) typeEndsInDef t = liftTCM $ do TelV _ core <- telView t case ignoreSharing $ unEl core of Def d vs -> return $ Just d _ -> return Nothing -- | Termination check a definition by pattern matching. -- -- TODO: Refactor! -- As this function may be called twice, -- once disregarding dot patterns, -- the second time regarding dot patterns, -- it is better if we separated bare call extraction -- from computing the change in structural order. -- Only the latter depends on the choice whether we -- consider dot patterns or not. termDef :: QName -> TerM Calls termDef name = terSetCurrent name $ do -- Retrieve definition def <- liftTCM $ getConstInfo name let t = defType def liftTCM $ reportSDoc "term.def.fun" 5 $ sep [ text "termination checking body of" <+> prettyTCM name , nest 2 $ text ":" <+> prettyTCM t ] -- If --without-K, we disregard all arguments (and result) -- which are not of data or record type. withoutKEnabled <- liftTCM $ optWithoutK <$> pragmaOptions applyWhen withoutKEnabled (setMasks t) $ do -- If the result should be disregarded, set all calls to unguarded. applyWhenM terGetMaskResult terUnguarded $ do case theDef def of Function{ funClauses = cls, funDelayed = delayed } -> terSetDelayed delayed $ forM' cls $ termClause _ -> return empty -- | Mask arguments and result for termination checking -- according to type of function. -- Only arguments of types ending in data/record or Size are counted in. setMasks :: Type -> TerM a -> TerM a setMasks t cont = do (ds, d) <- liftTCM $ do TelV tel core <- telView t -- Check argument types ds <- forM (telToList tel) $ \ t -> do TelV _ t <- telView $ snd $ unDom t d <- (isNothing <$> isDataOrRecord (unEl t)) `or2M` (isJust <$> isSizeType t) when d $ reportSDoc "term.mask" 20 $ do text "argument type " <+> prettyTCM t <+> text " is not data or record type, ignoring structural descent for --without-K" return d -- Check result types d <- isNothing <.> isDataOrRecord . unEl $ core when d $ reportSLn "term.mask" 20 $ "result type is not data or record type, ignoring guardedness for --without-K" return (ds, d) terSetMaskArgs (ds ++ repeat True) $ terSetMaskResult d $ cont {- Termination check clauses: For instance f x (cons y nil) = g x y Clause [VarP "x", ConP "List.cons" [VarP "y", ConP "List.nil" []]] Bind (Abs { absName = "x" , absBody = Bind (Abs { absName = "y" , absBody = Def "g" [ Var 1 [] , Var 0 []]})}) Outline: - create "De Bruijn pattern" - collect recursive calls - going under a binder, lift de Bruijn pattern - compare arguments of recursive call to pattern -} -- | Is the current target type among the given ones? targetElem :: [Target] -> TerM Bool targetElem ds = maybe False (`elem` ds) <$> terGetTarget {- -- | The target type of the considered recursive definition. data Target = Set -- ^ Constructing a Set (only meaningful with 'guardingTypeConstructors'). | Data QName -- ^ Constructing a coinductive or mixed type (could be data or record). deriving (Eq, Show) -- | Check wether a 'Target" corresponds to the current one. matchingTarget :: DBPConf -> Target -> TCM Bool matchingTarget conf t = maybe (return True) (match t) (currentTarget conf) where match Set Set = return True match (Data d) (Data d') = mutuallyRecursive d d' match _ _ = return False -} -- | Convert a term (from a dot pattern) to a DeBruijn pattern. -- -- The term is first normalized and stripped of all non-coinductive projections. termToDBP :: Term -> TerM DeBruijnPat termToDBP t = ifNotM terGetUseDotPatterns (return unusedVar) $ {- else -} do suc <- terGetSizeSuc let loop :: Term -> TCM DeBruijnPat loop t = do t <- constructorForm t case ignoreSharing t of -- Constructors. Con c args -> ConDBP (conName c) <$> mapM (loop . unArg) args Def s [Apply arg] | Just s == suc -> ConDBP s . (:[]) <$> loop (unArg arg) DontCare t -> __IMPOSSIBLE__ -- removed by stripAllProjections -- Leaves. Var i [] -> return $ VarDBP i Lit l -> return $ LitDBP l t -> return $ TermDBP t liftTCM $ loop =<< stripAllProjections =<< normalise t -- | Masks coconstructor patterns in a deBruijn pattern. stripCoConstructors :: DeBruijnPat -> TerM DeBruijnPat stripCoConstructors p = do case p of ConDBP c args -> do ind <- ifM ((Just c ==) <$> terGetSizeSuc) (return Inductive) {- else -} (liftTCM $ whatInduction c) case ind of Inductive -> ConDBP c <$> mapM stripCoConstructors args CoInductive -> return unusedVar -- The remaining (atomic) patterns cannot contain coconstructors, obviously. VarDBP{} -> return p LitDBP{} -> return p TermDBP{} -> return p -- Can contain coconstructors, but they do not count here. ProjDBP{} -> return p -- | Masks all non-data/record type patterns if --without-K. maskNonDataArgs :: [DeBruijnPat] -> TerM [Masked DeBruijnPat] maskNonDataArgs ps = zipWith mask ps <$> terGetMaskArgs where mask p@ProjDBP{} _ = Masked False p mask p d = Masked d p -- | cf. 'TypeChecking.Coverage.Match.buildMPatterns' openClause :: Permutation -> [Pattern] -> ClauseBody -> TerM ([DeBruijnPat], Maybe Term) openClause perm ps body = do -- invariant: xs has enough variables for the body unless (permRange perm == genericLength xs) __IMPOSSIBLE__ dbps <- evalStateT (mapM build ps) xs return . (dbps,) $ case body `apply` map (defaultArg . var) xs of NoBody -> Nothing Body v -> Just v _ -> __IMPOSSIBLE__ where -- TODO: express build using numberPatVars -- length of the telescope n = size perm -- the variables as a map from the body variables to the clause telescope xs = permPicks $ flipP $ invertP __IMPOSSIBLE__ perm tick = do x : xs <- get; put xs; return x build :: Pattern -> StateT [Nat] TerM DeBruijnPat build (VarP _) = VarDBP <$> tick build (ConP con _ ps) = ConDBP (conName con) <$> mapM (build . namedArg) ps build (DotP t) = tick *> do lift $ termToDBP t build (LitP l) = return $ LitDBP l build (ProjP d) = return $ ProjDBP d -- | Extract recursive calls from one clause. termClause :: Clause -> TerM Calls termClause clause = do ifNotM (terGetInlineWithFunctions) (termClause' clause) $ {- else -} do name <- terGetCurrent ifM (isJust <$> do isWithFunction name) (return mempty) $ mapM' termClause' =<< do liftTCM $ inlineWithClauses name clause termClause' :: Clause -> TerM Calls termClause' clause = do cl @ Clause { clauseTel = tel , clausePerm = perm , clauseBody = body } <- introHiddenLambdas clause let argPats' = clausePats cl liftTCM $ reportSDoc "term.check.clause" 25 $ vcat [ text "termClause" , nest 2 $ text "tel =" <+> prettyTCM tel , nest 2 $ text ("perm = " ++ show perm) -- how to get the following right? -- , nest 2 $ text "argPats' =" <+> do prettyA =<< reifyPatterns tel perm argPats' ] addCtxTel tel $ do ps <- liftTCM $ normalise $ map unArg argPats' (dbpats, res) <- openClause perm ps body case res of Nothing -> return empty Just v -> do dbpats <- mapM stripCoConstructors dbpats mdbpats <- maskNonDataArgs dbpats terSetPatterns mdbpats $ do terSetSizeDepth tel $ do reportBody v extract v {- -- if we are checking a delayed definition, we treat it as if there were -- a guarding coconstructor (sharp) terModifyGuarded (const $ case delayed of Delayed -> Order.lt NotDelayed -> Order.le) $ do -} where reportBody :: Term -> TerM () reportBody v = verboseS "term.check.clause" 6 $ do f <- terGetCurrent delayed <- terGetDelayed pats <- terGetPatterns liftTCM $ reportSDoc "term.check.clause" 6 $ do sep [ text ("termination checking " ++ (if delayed == Delayed then "delayed " else "") ++ "clause of") <+> prettyTCM f , nest 2 $ text "lhs:" <+> hsep (map prettyTCM pats) , nest 2 $ text "rhs:" <+> prettyTCM v ] -- | Rewrite a clause @f ps =tel= \ {xs} -> v@ to @f ps {xs} =(tel {xs})= v@. -- The pupose is to move hidden size quantifications -- to the lhs such that the termination checker can make use of them. -- See, e.g., test/succeed/SizedTypesExtendedLambda.agda. introHiddenLambdas :: MonadTCM tcm => Clause -> tcm Clause introHiddenLambdas clause = liftTCM $ do case clause of Clause range ctel perm ps body Nothing -> return clause Clause range ctel perm ps body (Just t)-> do case removeHiddenLambdas body of -- nobody or no hidden lambdas ([], _) -> return clause -- hidden lambdas (axs, body') -> do -- n = number of hidden lambdas let n = length axs -- take n abstractions from rhs type TelV ttel t' <- telViewUpTo n $ unArg t when (size ttel < n) __IMPOSSIBLE__ -- join with lhs telescope let ctel' = telFromList $ telToList ctel ++ telToList ttel ps' = ps ++ map toPat axs perm' = liftP n perm return $ Clause range ctel' perm' ps' body' $ Just (t $> t') where toPat (Common.Arg (Common.ArgInfo h r c) x) = Common.Arg (Common.ArgInfo h r []) $ namedVarP x removeHiddenLambdas :: ClauseBody -> ([I.Arg ArgName], ClauseBody) removeHiddenLambdas = underBinds $ hlamsToBinds hlamsToBinds :: Term -> ([I.Arg ArgName], ClauseBody) hlamsToBinds v = case ignoreSharing v of Lam info b | getHiding info == Hidden -> let (xs, b') = hlamsToBinds $ unAbs b in (Arg info (absName b) : xs, Bind $ b' <$ b) _ -> ([], Body v) underBinds :: (Term -> ([a], ClauseBody)) -> ClauseBody -> ([a], ClauseBody) underBinds k body = loop body where loop (Bind b) = let (res, b') = loop $ unAbs b in (res, Bind $ b' <$ b) loop NoBody = ([], NoBody) loop (Body v) = k v -- | Extract recursive calls from expressions. class ExtractCalls a where extract :: a -> TerM Calls instance ExtractCalls a => ExtractCalls (Abs a) where extract (NoAbs _ a) = extract a extract (Abs x a) = addContext x $ terRaise $ extract a instance ExtractCalls a => ExtractCalls (I.Arg a) where extract = extract . unArg instance ExtractCalls a => ExtractCalls (I.Dom a) where extract = extract . unDom instance ExtractCalls a => ExtractCalls (Elim' a) where extract Proj{} = return empty extract (Apply a) = extract $ unArg a instance ExtractCalls a => ExtractCalls [a] where extract = mapM' extract instance (ExtractCalls a, ExtractCalls b) => ExtractCalls (a,b) where extract (a, b) = CallGraph.union <$> extract a <*> extract b -- | Sorts can contain arbitrary terms of type @Level@, -- so look for recursive calls also in sorts. -- Ideally, 'Sort' would not be its own datatype but just -- a subgrammar of 'Term', then we would not need this boilerplate. instance ExtractCalls Sort where extract s = do liftTCM $ do reportSDoc "term.sort" 20 $ text "extracting calls from sort" <+> prettyTCM s reportSDoc "term.sort" 50 $ text ("s = " ++ show s) case s of Prop -> return empty Inf -> return empty SizeUniv -> return empty Type t -> terUnguarded $ extract t -- no guarded levels DLub s1 s2 -> extract (s1, s2) -- | Extract recursive calls from a type. instance ExtractCalls Type where extract (El s t) = extract (s, t) {- -- | Auxiliary type to write an instance of 'ExtractCalls'. data TerConstructor = TerConstructor { terConsName :: QName -- ^ Constructor name. , terConsInduction :: Induction -- ^ Should the constructor be treated as inductive or coinductive? , terConsArgs :: [(I.Arg Term, Bool)] -- ^ All the arguments, -- and for every argument a boolean which is 'True' iff the -- argument should be viewed as preserving guardedness. } -- | Extract recursive calls from a constructor application. instance ExtractCalls TerConstructor where extract (TerConstructor c ind args) = mapM' loopArg args where loopArg (arg, preserves) = terModifyGuarded g' $ extract arg where g' = case (preserves, ind) of (True, Inductive) -> id (True, CoInductive) -> (Order.lt .*.) (False, _) -> const Order.unknown -} -- | Extract recursive calls from a constructor application. constructor :: QName -- ^ Constructor name. -> Induction -- ^ Should the constructor be treated as inductive or coinductive? -> [(I.Arg Term, Bool)] -- ^ All the arguments, -- and for every argument a boolean which is 'True' iff the -- argument should be viewed as preserving guardedness. -> TerM Calls constructor c ind args = do cutoff <- terGetCutOff let ?cutoff = cutoff mapM' loopArg args where loopArg (arg, preserves) = terModifyGuarded g' $ extract arg where g' = case (preserves, ind) of (True, Inductive) -> id (True, CoInductive) -> (Order.lt .*.) (False, _) -> const Order.unknown -- | Handle guardedness preserving type constructor. guardPresTyCon :: QName -> Elims -> (QName -> Elims -> TerM Calls) -> TerM Calls guardPresTyCon g es cont = do ifNotM (terGetGuardingTypeConstructors) (cont g es) $ {- else -} do def <- liftTCM $ getConstInfo g let occs = defArgOccurrences def preserves = (StrictPos <=) -- Data or record type constructor. con = constructor g Inductive $ -- guardedness preserving zip (argsFromElims es) (map preserves occs ++ repeat False) case theDef def of Datatype{} -> con Record{} -> con _ -> cont g es -- | Extract calls from with function application. withFunction :: QName -> Elims -> TerM Calls withFunction g es = do v <- liftTCM $ -- billTo [Benchmark.Termination, Benchmark.With] $ -- 0ms expandWithFunctionCall g es liftTCM $ reportSDoc "term.with.call" 30 $ text "termination checking expanded with-function call:" <+> prettyTCM v extract v -- | Handles function applications @g es@. function :: QName -> Elims -> TerM Calls function g es = ifM (terGetInlineWithFunctions `and2M` do isJust <$> isWithFunction g) (withFunction g es) $ {-else, no with function-} do f <- terGetCurrent names <- terGetMutual guarded <- terGetGuarded let gArgs = Def g es liftTCM $ reportSDoc "term.function" 30 $ text "termination checking function call " <+> prettyTCM gArgs -- First, look for calls in the arguments of the call gArgs. -- We have to reduce constructors in case they're reexported. -- Andreas, Issue 1530: constructors have to be reduced deep inside terms, -- thus, we need to use traverseTermM. Sharing is handled by traverseTermM, -- so no ignoreSharing needed here. let reduceCon = traverseTermM $ \ t -> case t of Con c vs -> (`apply` vs) <$> reduce (Con c []) -- make sure we don't reduce the arguments _ -> return t -- Reduce constructors only when this call is actually a recursive one. -- es <- liftTCM $ billTo [Benchmark.Termination, Benchmark.Reduce] $ forM es $ -- etaContract <=< traverse reduceCon <=< instantiateFull -- If the function is a projection but not for a coinductive record, -- then preserve guardedness for its principal argument. isProj <- isProjectionButNotCoinductive g let unguards = repeat Order.unknown let guards = applyWhen isProj (guarded :) unguards -- Collect calls in the arguments of this call. let args = map unArg $ argsFromElims es calls <- forM' (zip guards args) $ \ (guard, a) -> do terSetGuarded guard $ extract a -- Then, consider call gArgs itself. liftTCM $ reportSDoc "term.found.call" 20 $ sep [ text "found call from" <+> prettyTCM f , nest 2 $ text "to" <+> prettyTCM g ] -- insert this call into the call list case List.elemIndex g names of -- call leads outside the mutual block and can be ignored Nothing -> return calls -- call is to one of the mutally recursive functions Just gInd -> do delayed <- terGetDelayed pats <- terGetPatterns -- 2014-03-25 Andreas, the costs seem small, benchmark turned off. es <- liftTCM $ -- billTo [Benchmark.Termination, Benchmark.Reduce] $ forM es $ etaContract <=< traverse reduceCon <=< instantiateFull -- Compute the call matrix. -- Andreas, 2014-03-26 only 6% of termination time for library test -- spent on call matrix generation (nrows, ncols, matrix) <- billTo [Benchmark.Termination, Benchmark.Compare] $ compareArgs es -- only a delayed definition can be guarded let ifDelayed o | Order.decreasing o && delayed == NotDelayed = Order.le | otherwise = o liftTCM $ reportSLn "term.guardedness" 20 $ "composing with guardedness " ++ show guarded ++ " counting as " ++ show (ifDelayed guarded) cutoff <- terGetCutOff let ?cutoff = cutoff let matrix' = composeGuardedness (ifDelayed guarded) matrix -- Andreas, 2013-04-26 FORBIDDINGLY expensive! -- This PrettyTCM QName cost 50% of the termination time for std-lib!! -- gPretty <-liftTCM $ billTo [Benchmark.Termination, Benchmark.Level] $ -- render <$> prettyTCM g -- Andreas, 2013-05-19 as pointed out by Andrea Vezzosi, -- printing the call eagerly is forbiddingly expensive. -- So we build a closure such that we can print the call -- whenever we really need to. -- This saves 30s (12%) on the std-lib! -- Andreas, 2015-01-21 Issue 1410: Go to the module where g is defined -- otherwise its free variables with be prepended to the call -- in the error message. doc <- liftTCM $ withCurrentModule (qnameModule g) $ buildClosure gArgs let src = fromMaybe __IMPOSSIBLE__ $ List.elemIndex f names tgt = gInd cm = makeCM ncols nrows matrix' info = CallPath [CallInfo { callInfoTarget = g , callInfoRange = getRange g , callInfoCall = doc }] liftTCM $ reportSDoc "term.kept.call" 5 $ vcat [ text "kept call from" <+> text (show f) <+> hsep (map prettyTCM pats) , nest 2 $ text "to" <+> text (show g) <+> hsep (map (parens . prettyTCM) args) , nest 2 $ text "call matrix (with guardedness): " , nest 2 $ pretty cm ] return $ CallGraph.insert src tgt cm info calls -- | Extract recursive calls from a term. instance ExtractCalls Term where extract t = do liftTCM $ reportSDoc "term.check.term" 50 $ do text "looking for calls in" <+> prettyTCM t -- Instantiate top-level MetaVar. t <- liftTCM $ instantiate t case ignoreSharing t of -- Constructed value. Con ConHead{conName = c} args -> do -- A constructor preserves the guardedness of all its arguments. let argsg = zip args $ repeat True -- If we encounter a coinductive record constructor -- in a type mutual with the current target -- then we count it as guarding. ind <- ifM ((Just c ==) <$> terGetSharp) (return CoInductive) $ do r <- liftTCM $ isRecordConstructor c case r of Nothing -> return Inductive Just (q, def) -> (\ b -> if b then CoInductive else Inductive) <$> andM [ return $ recRecursive def , return $ recInduction def == Just CoInductive , targetElem (q : recMutual def) ] constructor c ind argsg -- Function, data, or record type. Def g es -> guardPresTyCon g es function -- Abstraction. Preserves guardedness. Lam h b -> extract b -- Neutral term. Destroys guardedness. Var i es -> terUnguarded $ extract es -- Dependent function space. Pi a (Abs x b) -> CallGraph.union <$> (terUnguarded $ extract a) <*> do a <- maskSizeLt a -- OR: just do not add a to the context! terPiGuarded $ addContext (x, a) $ terRaise $ extract b -- Non-dependent function space. Pi a (NoAbs _ b) -> CallGraph.union <$> terUnguarded (extract a) <*> terPiGuarded (extract b) -- Literal. Lit l -> return empty -- Sort. Sort s -> extract s -- Unsolved metas are not considered termination problems, there -- will be a warning for them anyway. MetaV x args -> return empty -- Erased and not-yet-erased proof. DontCare t -> extract t -- Level. Level l -> -- billTo [Benchmark.Termination, Benchmark.Level] $ do -- Andreas, 2014-03-26 Benchmark discontinued, < 0.3% spent on levels. extract l Shared{} -> __IMPOSSIBLE__ ExtLam{} -> __IMPOSSIBLE__ -- | Extract recursive calls from level expressions. deriving instance ExtractCalls Level instance ExtractCalls PlusLevel where extract (ClosedLevel n) = return $ mempty extract (Plus n l) = extract l instance ExtractCalls LevelAtom where extract (MetaLevel x es) = extract es extract (BlockedLevel x t) = extract t extract (NeutralLevel _ t) = extract t extract (UnreducedLevel t) = extract t -- | Rewrite type @tel -> Size< u@ to @tel -> Size@. maskSizeLt :: MonadTCM tcm => I.Dom Type -> tcm (I.Dom Type) maskSizeLt dom@(Dom info a) = liftTCM $ do (msize, msizelt) <- getBuiltinSize case (msize, msizelt) of (_ , Nothing) -> return dom (Nothing, _) -> __IMPOSSIBLE__ (Just size, Just sizelt) -> do TelV tel c <- telView a case ignoreSharingType a of El s (Def d [v]) | d == sizelt -> return $ Dom info $ abstract tel $ El s $ Def size [] _ -> return dom {- | @compareArgs es@ Compare the list of de Bruijn patterns (=parameters) @pats@ with a list of arguments @es@ and create a call maxtrix with |es| rows and |pats| columns. The guardedness is the number of projection patterns in @pats@ minus the number of projections in @es@. -} compareArgs :: (Integral n) => [Elim] -> TerM (n, n, [[Order]]) compareArgs es = do pats <- terGetPatterns -- apats <- annotatePatsWithUseSizeLt pats -- reportSDoc "term.compare" 20 $ -- text "annotated patterns = " <+> sep (map prettyTCM apats) -- matrix <- forM es $ \ e -> forM apats $ \ (b, p) -> terSetUseSizeLt b $ compareElim e p matrix <- withUsableVars pats $ forM es $ \ e -> forM pats $ \ p -> compareElim e p -- Count the number of coinductive projection(pattern)s in caller and callee. -- Only recursive coinductive projections are eligible (Issue 1209). projsCaller <- genericLength <$> do filterM (isCoinductiveProjection True) $ mapMaybe (isProjP . getMasked) pats projsCallee <- genericLength <$> do filterM (isCoinductiveProjection True) $ mapMaybe isProjElim es cutoff <- terGetCutOff let ?cutoff = cutoff let guardedness = decr $ projsCaller - projsCallee liftTCM $ reportSDoc "term.guardedness" 30 $ sep [ text "compareArgs:" , nest 2 $ text $ "projsCaller = " ++ show projsCaller , nest 2 $ text $ "projsCallee = " ++ show projsCallee , nest 2 $ text $ "guardedness of call: " ++ show guardedness ] return $ addGuardedness guardedness (size es) (size pats) matrix -- | Traverse patterns from left to right. -- When we come to a projection pattern, -- switch usage of SIZELT constraints: -- on, if coinductive, -- off, if inductive. -- -- UNUSED annotatePatsWithUseSizeLt :: [DeBruijnPat] -> TerM [(Bool,DeBruijnPat)] annotatePatsWithUseSizeLt = loop where loop [] = return [] loop (p@(ProjDBP q) : pats) = ((False,p) :) <$> do projUseSizeLt q $ loop pats loop (p : pats) = (\ b ps -> (b,p) : ps) <$> terGetUseSizeLt <*> loop pats -- | @compareElim e dbpat@ compareElim :: Elim -> Masked DeBruijnPat -> TerM Order compareElim e p = do liftTCM $ do reportSDoc "term.compare" 30 $ sep [ text "compareElim" , nest 2 $ text "e = " <+> prettyTCM e , nest 2 $ text "p = " <+> prettyTCM p ] reportSDoc "term.compare" 50 $ sep [ nest 2 $ text $ "e = " ++ show e , nest 2 $ text $ "p = " ++ show p ] case (e, getMasked p) of (Proj d, ProjDBP d') -> compareProj d d' (Proj{}, _ ) -> return Order.unknown (Apply{}, ProjDBP{}) -> return Order.unknown (Apply arg, _) -> compareTerm (unArg arg) p -- | In dependent records, the types of later fields may depend on the -- values of earlier fields. Thus when defining an inhabitant of a -- dependent record type such as Σ by copattern matching, -- a recursive call eliminated by an earlier projection (proj₁) might -- occur in the definition at a later projection (proj₂). -- Thus, earlier projections are considered "smaller" when -- comparing copattern spines. This is an ok approximation -- of the actual dependency order. -- See issues 906, 942. compareProj :: MonadTCM tcm => QName -> QName -> tcm Order compareProj d d' | d == d' = return Order.le | otherwise = liftTCM $ do -- different projections mr <- getRecordOfField d mr' <- getRecordOfField d' case (mr, mr') of (Just r, Just r') | r == r' -> do -- of same record def <- theDef <$> getConstInfo r case def of Record{ recFields = fs } -> do fs <- return $ map unArg fs case (find (d==) fs, find (d'==) fs) of (Just i, Just i') -- earlier field is smaller | i < i' -> return Order.lt | i == i' -> do __IMPOSSIBLE__ | otherwise -> return Order.unknown _ -> __IMPOSSIBLE__ _ -> __IMPOSSIBLE__ _ -> return Order.unknown -- | 'makeCM' turns the result of 'compareArgs' into a proper call matrix makeCM :: Int -> Int -> [[Order]] -> CallMatrix makeCM ncols nrows matrix = CallMatrix $ Matrix.fromLists (Matrix.Size nrows ncols) matrix {- To turn off guardedness, restore this code. -- | 'addGuardedness' does nothing. addGuardedness :: Integral n => Order -> n -> n -> [[Order]] -> (n, n, [[Order]]) addGuardedness g nrows ncols m = (nrows, ncols, m) -} -- | 'addGuardedness' adds guardedness flag in the upper left corner (0,0). addGuardedness :: Integral n => Order -> n -> n -> [[Order]] -> (n, n, [[Order]]) addGuardedness o nrows ncols m = (nrows + 1, ncols + 1, (o : genericReplicate ncols Order.unknown) : map (Order.unknown :) m) -- | Compose something with the upper-left corner of a call matrix composeGuardedness :: (?cutoff :: CutOff) => Order -> [[Order]] -> [[Order]] composeGuardedness o ((corner : row) : rows) = ((o .*. corner) : row) : rows composeGuardedness _ _ = __IMPOSSIBLE__ -- | Stripping off a record constructor is not counted as decrease, in -- contrast to a data constructor. -- A record constructor increases/decreases by 0, a data constructor by 1. offsetFromConstructor :: MonadTCM tcm => QName -> tcm Int offsetFromConstructor c = maybe 1 (const 0) <$> do liftTCM $ isRecordConstructor c -- | Compute the proper subpatterns of a 'DeBruijnPat'. subPatterns :: DeBruijnPat -> [DeBruijnPat] subPatterns p = case p of ConDBP c ps -> ps ++ concatMap subPatterns ps VarDBP _ -> [] LitDBP _ -> [] TermDBP _ -> [] ProjDBP _ -> [] compareTerm :: Term -> Masked DeBruijnPat -> TerM Order compareTerm t p = do -- reportSDoc "term.compare" 25 $ -- text " comparing term " <+> prettyTCM t <+> -- text " to pattern " <+> prettyTCM p t <- liftTCM $ stripAllProjections t o <- compareTerm' t p liftTCM $ reportSDoc "term.compare" 25 $ text " comparing term " <+> prettyTCM t <+> text " to pattern " <+> prettyTCM p <+> text (" results in " ++ show o) return o {- compareTerm t p = Order.supremum $ compareTerm' t p : map cmp (subPatterns p) where cmp p' = (Order..*.) Order.lt (compareTerm' t p') -} -- | Remove all non-coinductive projections from an algebraic term -- (not going under binders). -- Also, remove 'DontCare's. class StripAllProjections a where stripAllProjections :: a -> TCM a instance StripAllProjections a => StripAllProjections (I.Arg a) where stripAllProjections = traverse stripAllProjections -- stripAllProjections (Arg info a) = Arg info <$> stripAllProjections a {- DOES NOT WORK, since s.th. special is needed for Elims instance StripAllProjections a => StripAllProjections [a] where stripAllProjections = traverse stripAllProjections instance StripAllProjections a => StripAllProjections (Elim' a) where -} instance StripAllProjections Elims where stripAllProjections es = case es of [] -> return [] (Apply a : es) -> do (:) <$> (Apply <$> stripAllProjections a) <*> stripAllProjections es (Proj p : es) -> do isP <- isProjectionButNotCoinductive p applyUnless isP (Proj p :) <$> stripAllProjections es instance StripAllProjections Args where stripAllProjections = mapM stripAllProjections instance StripAllProjections Term where stripAllProjections t = do case ignoreSharing t of Var i es -> Var i <$> stripAllProjections es Con c ts -> Con c <$> stripAllProjections ts Def d es -> Def d <$> stripAllProjections es DontCare t -> stripAllProjections t _ -> return t -- | @compareTerm' t dbpat@ -- -- Precondition: top meta variable resolved compareTerm' :: Term -> Masked DeBruijnPat -> TerM Order compareTerm' v mp@(Masked m p) = do suc <- terGetSizeSuc cutoff <- terGetCutOff let ?cutoff = cutoff v <- return $ ignoreSharing v case (v, p) of -- Andreas, 2013-11-20 do not drop projections, -- in any case not coinductive ones!: (Var i es, _) | Just{} <- allApplyElims es -> compareVar i mp (DontCare t, _) -> compareTerm' t mp -- Andreas, 2014-09-22, issue 1281: -- For metas, termination checking should be optimistic. -- If there is any instance of the meta making termination -- checking succeed, then we should not fail. -- Thus, we assume the meta will be instantiated with the -- deepest variable in @p@. -- For sized types, the depth is maximally -- the number of SIZELT hypotheses one can have in a context. (MetaV{}, p) -> Order.decr . max (if m then 0 else patternDepth p) . pred <$> terAsks _terSizeDepth -- Successor on both sides cancel each other. -- We ignore the mask for sizes. (Def s [Apply t], ConDBP s' [p]) | s == s' && Just s == suc -> compareTerm' (unArg t) (notMasked p) -- Register also size increase. (Def s [Apply t], p) | Just s == suc -> -- Andreas, 2012-10-19 do not cut off here increase 1 <$> compareTerm' (unArg t) mp -- In all cases that do not concern sizes, -- we cannot continue if pattern is masked. _ | m -> return Order.unknown (Lit l, LitDBP l') | l == l' -> return Order.le | otherwise -> return Order.unknown (Lit l, _) -> do v <- liftTCM $ constructorForm v case ignoreSharing v of Lit{} -> return Order.unknown v -> compareTerm' v mp -- Andreas, 2011-04-19 give subterm priority over matrix order (Con{}, ConDBP c ps) | any (isSubTerm v) ps -> decrease <$> offsetFromConstructor c <*> return Order.le (Con c ts, ConDBP c' ps) | conName c == c'-> compareConArgs ts ps (Con c [], _) -> return Order.le -- new case for counting constructors / projections -- register also increase (Con c ts, _) -> do increase <$> offsetFromConstructor (conName c) <*> (infimum <$> mapM (\ t -> compareTerm' (unArg t) mp) ts) (t, p) -> return $ subTerm t p -- | @subTerm@ computes a size difference (Order) subTerm :: (?cutoff :: CutOff) => Term -> DeBruijnPat -> Order subTerm t p = if equal t p then Order.le else properSubTerm t p where equal (Shared p) dbp = equal (derefPtr p) dbp equal (Con c ts) (ConDBP c' ps) = and $ (conName c == c') : (length ts == length ps) : zipWith equal (map unArg ts) ps equal (Var i []) (VarDBP i') = i == i' equal (Lit l) (LitDBP l') = l == l' -- Terms. -- Checking for identity here is very fragile. -- However, we cannot do much more, as we are not allowed to normalize t. -- (It might diverge, and we are just in the process of termination checking.) equal t (TermDBP t') = t == t' equal _ _ = False properSubTerm t (ConDBP _ ps) = decrease 1 $ supremum $ map (subTerm t) ps properSubTerm _ _ = Order.unknown isSubTerm :: (?cutoff :: CutOff) => Term -> DeBruijnPat -> Bool isSubTerm t p = nonIncreasing $ subTerm t p compareConArgs :: Args -> [DeBruijnPat] -> TerM Order compareConArgs ts ps = do cutoff <- terGetCutOff let ?cutoff = cutoff -- we may assume |ps| >= |ts|, otherwise c ps would be of functional type -- which is impossible case (length ts, length ps) of (0,0) -> return Order.le -- c <= c (0,1) -> return Order.unknown -- c not<= c x (1,0) -> __IMPOSSIBLE__ (1,1) -> compareTerm' (unArg (head ts)) (notMasked (head ps)) (_,_) -> foldl (Order..*.) Order.le <$> zipWithM compareTerm' (map unArg ts) (map notMasked ps) -- corresponds to taking the size, not the height -- allows examples like (x, y) < (Succ x, y) {- version which does an "order matrix" -- Andreas, 2013-02-18 disabled because it is unclear -- how to scale idempotency test to matrix-shaped orders (need thinking/researcH) -- Trigges issue 787. (_,_) -> do -- build "call matrix" m <- mapM (\t -> mapM (compareTerm' suc (unArg t)) ps) ts let m2 = makeCM (genericLength ps) (genericLength ts) m return $ Order.orderMat (Order.mat m2) -} {- version which takes height -- if null ts then Order.Le -- else Order.infimum (zipWith compareTerm' (map unArg ts) ps) -} compareVar :: Nat -> Masked DeBruijnPat -> TerM Order compareVar i (Masked m p) = do suc <- terGetSizeSuc cutoff <- terGetCutOff let ?cutoff = cutoff let no = return Order.unknown case p of ProjDBP{} -> no LitDBP{} -> no TermDBP{} -> no VarDBP j -> compareVarVar i (Masked m j) ConDBP s [p] | Just s == suc -> decrease 1 <$> compareVar i (notMasked p) ConDBP c ps -> if m then no else do decrease <$> offsetFromConstructor c <*> (Order.supremum <$> mapM (compareVar i . notMasked) ps) -- | Compare two variables. -- -- The first variable comes from a term, the second from a pattern. compareVarVar :: Nat -> Masked Nat -> TerM Order compareVarVar i (Masked m j) | i == j = if not m then return Order.le else liftTCM $ -- If j is a size, we ignore the mask. ifM (isJust <$> do isSizeType =<< reduce =<< typeOfBV j) {- then -} (return Order.le) {- else -} (return Order.unknown) | otherwise = ifNotM ((i `VarSet.member`) <$> terGetUsableVars) (return Order.unknown) $ {- else -} do res <- isBounded i case res of BoundedNo -> return Order.unknown BoundedLt v -> decrease 1 <$> compareTerm' v (Masked m (VarDBP j)) Agda-2.4.2.5/src/full/Agda/Termination/CallGraph.hs0000644000000000000000000002356112635075266017776 0ustar0000000000000000{-# LANGUAGE CPP #-} {-# LANGUAGE GeneralizedNewtypeDeriving #-} {-# LANGUAGE ImplicitParams #-} {-# LANGUAGE StandaloneDeriving #-} {-# LANGUAGE TupleSections #-} -- | Call graphs and related concepts, more or less as defined in -- \"A Predicative Analysis of Structural Recursion\" by -- Andreas Abel and Thorsten Altenkirch. -- Originally copied from Agda1 sources. module Agda.Termination.CallGraph ( -- * Calls Node , Call, mkCall, mkCall', source, target, callMatrixSet , (>*<) -- * Call graphs , CallGraph(..) , targetNodes , fromList , toList , union , insert , complete, completionStep -- , prettyBehaviour -- * Tests , Agda.Termination.CallGraph.tests ) where import Prelude hiding (null) import Data.Foldable (Foldable) import qualified Data.Foldable as Fold import Data.Function import qualified Data.List as List import Data.Map (Map, (!)) import qualified Data.Map as Map import Data.Monoid import Data.Set (Set) import qualified Data.Set as Set import Data.Traversable (Traversable) import qualified Data.Traversable as Trav import Agda.Termination.CallMatrix (CallMatrix, callMatrix, CallMatrixAug(..), CMSet(..), CallComb(..)) import qualified Agda.Termination.CallMatrix as CMSet import Agda.Termination.CutOff import Agda.Termination.Order import Agda.Termination.SparseMatrix as Matrix hiding (tests) import Agda.Termination.Semiring (HasZero(..), Semiring) import qualified Agda.Termination.Semiring as Semiring import Agda.Utils.Favorites (Favorites(Favorites)) import qualified Agda.Utils.Favorites as Fav import Agda.Utils.Graph.AdjacencyMap.Unidirectional (Edge(..),Graph(..)) import qualified Agda.Utils.Graph.AdjacencyMap.Unidirectional as Graph import Agda.Utils.Function import Agda.Utils.List hiding (tests) import Agda.Utils.Map import Agda.Utils.Maybe import Agda.Utils.Monad import Agda.Utils.Null import Agda.Utils.PartialOrd import Agda.Utils.Pretty import Agda.Utils.QuickCheck hiding (label) import Agda.Utils.Singleton import Agda.Utils.TestHelpers import Agda.Utils.Tuple #include "undefined.h" import Agda.Utils.Impossible ------------------------------------------------------------------------ -- Calls -- | Call graph nodes. -- -- Machine integer 'Int' is sufficient, since we cannot index more than -- we have addresses on our machine. type Node = Int -- | Calls are edges in the call graph. -- It can be labelled with several call matrices if there -- are several pathes from one function to another. type Call cinfo = Edge Node Node (CMSet cinfo) callMatrixSet :: Call cinfo -> CMSet cinfo callMatrixSet = label -- | Make a call with a single matrix. mkCall :: Node -> Node -> CallMatrix -> cinfo -> Call cinfo mkCall s t m cinfo = Edge s t $ singleton $ CallMatrixAug m cinfo -- | Make a call with empty @cinfo@. mkCall' :: Monoid cinfo => Node -> Node -> CallMatrix -> Call cinfo mkCall' s t m = mkCall s t m mempty ------------------------------------------------------------------------ -- Call graphs -- | A call graph is a set of calls. Every call also has some -- associated meta information, which should be 'Monoid'al so that the -- meta information for different calls can be combined when the calls -- are combined. newtype CallGraph cinfo = CallGraph { theCallGraph :: Graph Node Node (CMSet cinfo) } deriving (Show) -- | Returns all the nodes with incoming edges. Somewhat expensive. @O(e)@. targetNodes :: CallGraph cinfo -> Set Node targetNodes = Graph.targetNodes . theCallGraph -- | Converts a call graph to a list of calls with associated meta -- information. toList :: CallGraph cinfo -> [Call cinfo] toList = Graph.edges . theCallGraph -- | Converts a list of calls with associated meta information to a -- call graph. fromList :: Monoid cinfo => [Call cinfo] -> CallGraph cinfo fromList = CallGraph . Graph.fromListWith CMSet.union -- | 'null' checks whether the call graph is completely disconnected. instance Null (CallGraph cinfo) where empty = CallGraph Graph.empty null = List.all (null . label) . toList -- | Takes the union of two call graphs. union :: Monoid cinfo => CallGraph cinfo -> CallGraph cinfo -> CallGraph cinfo union (CallGraph cs1) (CallGraph cs2) = CallGraph $ Graph.unionWith CMSet.union cs1 cs2 -- | 'CallGraph' is a monoid under 'union'. instance Monoid cinfo => Monoid (CallGraph cinfo) where mempty = empty mappend = union -- | Inserts a call into a call graph. insert :: Monoid cinfo => Node -> Node -> CallMatrix -> cinfo -> CallGraph cinfo -> CallGraph cinfo insert s t cm cinfo = CallGraph . Graph.insertEdgeWith CMSet.union e . theCallGraph where e = mkCall s t cm cinfo -- * Combination of a new thing with an old thing -- returning a really new things and updated old things. type CombineNewOldT a = a -> a -> (a, a) class CombineNewOld a where combineNewOld :: CombineNewOldT a instance PartialOrd a => CombineNewOld (Favorites a) where combineNewOld new old = (new', Fav.unionCompared (new', old')) where (new', old') = Fav.compareFavorites new old deriving instance CombineNewOld (CMSet cinfo) instance (Monoid a, CombineNewOld a, Ord s, Ord t) => CombineNewOld (Graph s t a) where combineNewOld new old = Graph.unzip $ Graph.unionWith comb new' old' where new' = (,mempty) <$> new old' = (mempty,) <$> old comb (new1,old1) (new2,old2) -- TODO: ensure old1 is null = mapFst (new2 `mappend`) $ combineNewOld new1 old2 -- -- | old1 == mempty = mapFst (new2 `mappend`) $ combineNewOld new1 old2 -- -- | otherwise = __IMPOSSIBLE__ -- Filter unlabelled edges from the resulting new graph. -- filt = Graph.filterEdges (not . null) -- | Call graph combination. -- -- Application of '>*<' to all pairs @(c1,c2)@ -- for which @'source' c1 = 'target' c2@.) -- GHC supports implicit-parameter constraints in instance declarations -- only from 7.4. To maintain compatibility with 7.2, we skip this instance: -- KEEP: -- instance (Monoid cinfo, ?cutoff :: CutOff) => CombineNewOld (CallGraph cinfo) where -- combineNewOld (CallGraph new) (CallGraph old) = CallGraph -*- CallGraph $ combineNewOld comb old -- -- combined calls: -- where comb = Graph.composeWith (>*<) CMSet.union new old -- Non-overloaded version: combineNewOldCallGraph :: (Monoid cinfo, ?cutoff :: CutOff) => CombineNewOldT (CallGraph cinfo) combineNewOldCallGraph (CallGraph new) (CallGraph old) = CallGraph -*- CallGraph $ combineNewOld comb old -- combined calls: where comb = Graph.composeWith (>*<) CMSet.union new old -- | Call graph comparison. -- A graph @cs'@ is ``worse'' than @cs@ if it has a new edge (call) -- or a call got worse, which means that one of its elements -- that was better or equal to 'Le' moved a step towards 'Un'. -- -- A call graph is complete if combining it with itself does not make it -- any worse. This is sound because of monotonicity: By combining a graph -- with itself, it can only get worse, but if it does not get worse after -- one such step, it gets never any worse. -- | @'complete' cs@ completes the call graph @cs@. A call graph is -- complete if it contains all indirect calls; if @f -> g@ and @g -> -- h@ are present in the graph, then @f -> h@ should also be present. complete :: (?cutoff :: CutOff) => Monoid cinfo => CallGraph cinfo -> CallGraph cinfo complete cs = repeatWhile (mapFst (not . null) . completionStep cs) cs completionStep :: (?cutoff :: CutOff) => Monoid cinfo => CallGraph cinfo -> CallGraph cinfo -> (CallGraph cinfo, CallGraph cinfo) completionStep gOrig gThis = combineNewOldCallGraph gOrig gThis -- prop_complete :: (?cutoff :: CutOff) => Property -- prop_complete = -- forAll (callGraph :: Gen (CallGraph [Integer])) $ \cs -> -- isComplete (complete cs) -- -- | Returns 'True' iff the call graph is complete. -- isComplete :: (Ord cinfo, Monoid cinfo, ?cutoff :: CutOff) => CallGraph cinfo -> Bool -- isComplete s = (s `union` (s `combine` s)) `notWorse` s ------------------------------------------------------------------------ -- * Printing ------------------------------------------------------------------------ -- | Displays the recursion behaviour corresponding to a call graph. instance Pretty cinfo => Pretty (CallGraph cinfo) where pretty = vcat . map prettyCall . toList where prettyCall e = if null (callMatrixSet e) then empty else align 20 $ [ ("Source:", text $ show $ source e) , ("Target:", text $ show $ target e) , ("Matrix:", pretty $ callMatrixSet e) ] -- -- | Displays the recursion behaviour corresponding to a call graph. -- prettyBehaviour :: Show cinfo => CallGraph cinfo -> Doc -- prettyBehaviour = vcat . map prettyCall . filter toSelf . toList -- where -- toSelf c = source c == target c -- prettyCall e = vcat $ map text -- [ "Function: " ++ show (source e) -- -- , "Behaviour: " ++ show (diagonal $ mat $ cm c) -- TODO -- -- , "Meta info: " ++ show cinfo -- ] ------------------------------------------------------------------------ -- * Generators and properties ------------------------------------------------------------------------ -- | Generates a call graph. callGraph :: (Monoid cinfo, Arbitrary cinfo) => Gen (CallGraph cinfo) callGraph = do indices <- fmap List.nub arbitrary n <- natural let noMatrices | List.null indices = 0 | otherwise = n `min` 3 -- Not too many. fromList <$> vectorOf noMatrices (matGen indices) where matGen indices = do [s, t] <- vectorOf 2 (elements indices) [c, r] <- vectorOf 2 (choose (0, 2)) -- Not too large. m <- callMatrix (Size { rows = r, cols = c }) mkCall s t m <$> arbitrary ------------------------------------------------------------------------ -- All tests tests :: IO Bool tests = runTests "Agda.Termination.CallGraph" [] -- [ quickCheck' prop_complete -- , quickCheck' prop_ensureCompletePrecondition -- ] where ?cutoff = DontCutOff -- CutOff 2 -- don't cut off in tests! Agda-2.4.2.5/src/full/Agda/Termination/Monad.hs0000644000000000000000000005302712635075266017177 0ustar0000000000000000{-# LANGUAGE CPP #-} {-# LANGUAGE DeriveFunctor #-} {-# LANGUAGE DeriveFoldable #-} {-# LANGUAGE DeriveTraversable #-} {-# LANGUAGE FlexibleInstances #-} {-# LANGUAGE GeneralizedNewtypeDeriving #-} {-# LANGUAGE MultiParamTypeClasses #-} -- | The monad for the termination checker. -- -- The termination monad @TerM@ is an extension of -- the type checking monad 'TCM' by an environment -- with information needed by the termination checker. module Agda.Termination.Monad where import Prelude hiding (null) import Control.Applicative hiding (empty) import Control.Monad.Reader import Control.Monad.Writer import Control.Monad.State import Data.Foldable (Foldable) import Data.Functor ((<$>)) import qualified Data.List as List import Data.Traversable (Traversable) import Agda.Interaction.Options import Agda.Syntax.Abstract (QName, IsProjP(..), AllNames) import Agda.Syntax.Common (Delayed(..), Induction(..), Dom(..)) import Agda.Syntax.Internal import Agda.Syntax.Literal import Agda.Syntax.Position (noRange) import Agda.Termination.CutOff import Agda.Termination.Order (Order,le,unknown) import Agda.Termination.RecCheck (anyDefs) import Agda.TypeChecking.Monad import Agda.TypeChecking.Monad.Benchmark import Agda.TypeChecking.Monad.Builtin import Agda.TypeChecking.Pretty import Agda.TypeChecking.Records import Agda.TypeChecking.Reduce import Agda.TypeChecking.Substitute import Agda.Utils.Except ( MonadError(catchError, throwError) ) import Agda.Utils.Function import Agda.Utils.Functor import Agda.Utils.Lens import Agda.Utils.Maybe import Agda.Utils.Monad import Agda.Utils.Null import Agda.Utils.Pretty (Pretty, prettyShow) import qualified Agda.Utils.Pretty as P import Agda.Utils.VarSet (VarSet) import qualified Agda.Utils.VarSet as VarSet #include "undefined.h" import Agda.Utils.Impossible -- | The mutual block we are checking. -- -- The functions are numbered according to their order of appearance -- in this list. type MutualNames = [QName] -- | The target of the function we are checking. type Target = QName -- | The current guardedness level. type Guarded = Order -- | The termination environment. data TerEnv = TerEnv -- First part: options, configuration. { terUseDotPatterns :: Bool -- ^ Are we mining dot patterns to find evindence of structal descent? , terGuardingTypeConstructors :: Bool -- ^ Do we assume that record and data type constructors -- preserve guardedness? , terInlineWithFunctions :: Bool -- ^ Do we inline with functions to enhance termination checking of with? , terSizeSuc :: Maybe QName -- ^ The name of size successor, if any. , terSharp :: Maybe QName -- ^ The name of the delay constructor (sharp), if any. , terCutOff :: CutOff -- ^ Depth at which to cut off the structural order. -- Second part: accumulated info during descent into decls./term. , terCurrent :: QName -- ^ The name of the function we are currently checking. , terMutual :: MutualNames -- ^ The names of the functions in the mutual block we are checking. -- This includes the internally generated functions -- (with, extendedlambda, coinduction). , terUserNames :: [QName] -- ^ The list of name actually appearing in the file (abstract syntax). -- Excludes the internally generated functions. , terTarget :: Maybe Target -- ^ Target type of the function we are currently termination checking. -- Only the constructors of 'Target' are considered guarding. , terDelayed :: Delayed -- ^ Are we checking a delayed definition? , terMaskArgs :: [Bool] -- ^ Only consider the 'notMasked' 'False' arguments for establishing termination. , terMaskResult :: Bool -- ^ Only consider guardedness if 'False' (not masked). , _terSizeDepth :: Int -- lazy by intention! -- ^ How many @SIZELT@ relations do we have in the context -- (= clause telescope). Used to approximate termination -- for metas in call args. , terPatterns :: MaskedDeBruijnPats -- ^ The patterns of the clause we are checking. , terPatternsRaise :: !Int -- ^ Number of additional binders we have gone under -- (and consequently need to raise the patterns to compare to terms). -- Updated during call graph extraction, hence strict. , terGuarded :: !Guarded -- ^ The current guardedness status. Changes as we go deeper into the term. -- Updated during call graph extraction, hence strict. , terUseSizeLt :: Bool -- ^ When extracting usable size variables during construction of the call -- matrix, can we take the variable for use with SIZELT constraints from the context? -- Yes, if we are under an inductive constructor. -- No, if we are under a record constructor. , terUsableVars :: VarSet -- ^ Pattern variables that can be compared to argument variables using SIZELT. } -- | An empty termination environment. -- -- Values are set to a safe default meaning that with these -- initial values the termination checker will not miss -- termination errors it would have seen with better settings -- of these values. -- -- Values that do not have a safe default are set to -- @IMPOSSIBLE@. -- Note: Do not write @__IMPOSSIBLE__@ in the haddock comment above -- since it will be expanded by the CPP, leading to a haddock parse error. defaultTerEnv :: TerEnv defaultTerEnv = TerEnv { terUseDotPatterns = False -- must be False initially! , terGuardingTypeConstructors = False , terInlineWithFunctions = True , terSizeSuc = Nothing , terSharp = Nothing , terCutOff = defaultCutOff , terUserNames = __IMPOSSIBLE__ -- needs to be set! , terMutual = __IMPOSSIBLE__ -- needs to be set! , terCurrent = __IMPOSSIBLE__ -- needs to be set! , terTarget = Nothing , terDelayed = NotDelayed , terMaskArgs = repeat False -- use all arguments (mask none) , terMaskResult = False -- use result (do not mask) , _terSizeDepth = __IMPOSSIBLE__ -- needs to be set! , terPatterns = __IMPOSSIBLE__ -- needs to be set! , terPatternsRaise = 0 , terGuarded = le -- not initially guarded , terUseSizeLt = False -- initially, not under data constructor , terUsableVars = VarSet.empty } -- | Termination monad service class. class (Functor m, Monad m) => MonadTer m where terAsk :: m TerEnv terLocal :: (TerEnv -> TerEnv) -> m a -> m a terAsks :: (TerEnv -> a) -> m a terAsks f = f <$> terAsk -- | Termination monad. newtype TerM a = TerM { terM :: ReaderT TerEnv TCM a } deriving (Functor, Applicative, Monad, MonadBench Phase) instance MonadTer TerM where terAsk = TerM $ ask terLocal f = TerM . local f . terM -- | Generic run method for termination monad. runTer :: TerEnv -> TerM a -> TCM a runTer tenv (TerM m) = runReaderT m tenv -- | Run TerM computation in default environment (created from options). runTerDefault :: TerM a -> TCM a runTerDefault cont = do -- Assemble then initial configuration of the termination environment. cutoff <- optTerminationDepth <$> pragmaOptions -- Get the name of size suc (if sized types are enabled) suc <- sizeSucName -- The name of sharp (if available). sharp <- fmap nameOfSharp <$> coinductionKit guardingTypeConstructors <- optGuardingTypeConstructors <$> pragmaOptions -- Andreas, 2014-08-28 -- We do not inline with functions if --without-K. inlineWithFunctions <- not . optWithoutK <$> pragmaOptions let tenv = defaultTerEnv { terGuardingTypeConstructors = guardingTypeConstructors , terInlineWithFunctions = inlineWithFunctions , terSizeSuc = suc , terSharp = sharp , terCutOff = cutoff } runTer tenv cont -- * Termination monad is a 'MonadTCM'. instance MonadReader TCEnv TerM where ask = TerM $ lift $ ask local f m = TerM $ ReaderT $ local f . runReaderT (terM m) instance MonadState TCState TerM where get = TerM $ lift $ get put = TerM . lift . put instance MonadIO TerM where liftIO = TerM . liftIO instance MonadTCM TerM where liftTCM = TerM . lift instance MonadError TCErr TerM where throwError = liftTCM . throwError catchError m handler = TerM $ ReaderT $ \ tenv -> do runTer tenv m `catchError` (\ err -> runTer tenv $ handler err) -- * Modifiers and accessors for the termination environment in the monad. terGetGuardingTypeConstructors :: TerM Bool terGetGuardingTypeConstructors = terAsks terGuardingTypeConstructors terGetInlineWithFunctions :: TerM Bool terGetInlineWithFunctions = terAsks terInlineWithFunctions terGetUseDotPatterns :: TerM Bool terGetUseDotPatterns = terAsks terUseDotPatterns terSetUseDotPatterns :: Bool -> TerM a -> TerM a terSetUseDotPatterns b = terLocal $ \ e -> e { terUseDotPatterns = b } terGetSizeSuc :: TerM (Maybe QName) terGetSizeSuc = terAsks terSizeSuc terGetCurrent :: TerM QName terGetCurrent = terAsks terCurrent terSetCurrent :: QName -> TerM a -> TerM a terSetCurrent q = terLocal $ \ e -> e { terCurrent = q } terGetSharp :: TerM (Maybe QName) terGetSharp = terAsks terSharp terGetCutOff :: TerM CutOff terGetCutOff = terAsks terCutOff terGetMutual :: TerM MutualNames terGetMutual = terAsks terMutual terGetUserNames :: TerM [QName] terGetUserNames = terAsks terUserNames terGetTarget :: TerM (Maybe Target) terGetTarget = terAsks terTarget terSetTarget :: Maybe Target -> TerM a -> TerM a terSetTarget t = terLocal $ \ e -> e { terTarget = t } terGetDelayed :: TerM Delayed terGetDelayed = terAsks terDelayed terSetDelayed :: Delayed -> TerM a -> TerM a terSetDelayed b = terLocal $ \ e -> e { terDelayed = b } terGetMaskArgs :: TerM [Bool] terGetMaskArgs = terAsks terMaskArgs terSetMaskArgs :: [Bool] -> TerM a -> TerM a terSetMaskArgs b = terLocal $ \ e -> e { terMaskArgs = b } terGetMaskResult :: TerM Bool terGetMaskResult = terAsks terMaskResult terSetMaskResult :: Bool -> TerM a -> TerM a terSetMaskResult b = terLocal $ \ e -> e { terMaskResult = b } terGetPatterns :: TerM (MaskedDeBruijnPats) terGetPatterns = do n <- terAsks terPatternsRaise mps <- terAsks terPatterns return $ if n == 0 then mps else map (fmap (fmap (n +))) mps terSetPatterns :: MaskedDeBruijnPats -> TerM a -> TerM a terSetPatterns ps = terLocal $ \ e -> e { terPatterns = ps } terRaise :: TerM a -> TerM a terRaise = terLocal $ \ e -> e { terPatternsRaise = terPatternsRaise e + 1 } terGetGuarded :: TerM Guarded terGetGuarded = terAsks terGuarded terModifyGuarded :: (Order -> Order) -> TerM a -> TerM a terModifyGuarded f = terLocal $ \ e -> e { terGuarded = f $ terGuarded e } terSetGuarded :: Order -> TerM a -> TerM a terSetGuarded = terModifyGuarded . const terUnguarded :: TerM a -> TerM a terUnguarded = terSetGuarded unknown -- | Should the codomain part of a function type preserve guardedness? terPiGuarded :: TerM a -> TerM a terPiGuarded m = ifM terGetGuardingTypeConstructors m $ terUnguarded m -- | Lens for '_terSizeDepth'. terSizeDepth :: Lens' Int TerEnv terSizeDepth f e = f (_terSizeDepth e) <&> \ i -> e { _terSizeDepth = i } -- | Lens for 'terUsableVars'. terGetUsableVars :: TerM VarSet terGetUsableVars = terAsks terUsableVars terModifyUsableVars :: (VarSet -> VarSet) -> TerM a -> TerM a terModifyUsableVars f = terLocal $ \ e -> e { terUsableVars = f $ terUsableVars e } terSetUsableVars :: VarSet -> TerM a -> TerM a terSetUsableVars = terModifyUsableVars . const -- | Lens for 'terUseSizeLt'. terGetUseSizeLt :: TerM Bool terGetUseSizeLt = terAsks terUseSizeLt terModifyUseSizeLt :: (Bool -> Bool) -> TerM a -> TerM a terModifyUseSizeLt f = terLocal $ \ e -> e { terUseSizeLt = f $ terUseSizeLt e } terSetUseSizeLt :: Bool -> TerM a -> TerM a terSetUseSizeLt = terModifyUseSizeLt . const -- | Compute usable vars from patterns and run subcomputation. withUsableVars :: UsableSizeVars a => a -> TerM b -> TerM b withUsableVars pats m = do vars <- usableSizeVars pats reportSLn "term.size" 20 $ "usableSizeVars = " ++ show vars terSetUsableVars vars $ m -- | Set 'terUseSizeLt' when going under constructor @c@. conUseSizeLt :: QName -> TerM a -> TerM a conUseSizeLt c m = do caseMaybeM (liftTCM $ isRecordConstructor c) (terSetUseSizeLt True m) (const $ terSetUseSizeLt False m) -- | Set 'terUseSizeLt' for arguments following projection @q@. -- We disregard j TerM a -> TerM a projUseSizeLt q m = do co <- isCoinductiveProjection False q reportSLn "term.size" 20 $ applyUnless co ("not " ++) $ "using SIZELT vars after projection " ++ prettyShow q terSetUseSizeLt co m -- | For termination checking purposes flat should not be considered a -- projection. That is, it flat doesn't preserve either structural order -- or guardedness like other projections do. -- Andreas, 2012-06-09: the same applies to projections of recursive records. isProjectionButNotCoinductive :: MonadTCM tcm => QName -> tcm Bool isProjectionButNotCoinductive qn = liftTCM $ do b <- isProjectionButNotCoinductive' qn reportSDoc "term.proj" 60 $ do text "identifier" <+> prettyTCM qn <+> do text $ if b then "is an inductive projection" else "is either not a projection or coinductive" return b where isProjectionButNotCoinductive' qn = do flat <- fmap nameOfFlat <$> coinductionKit if Just qn == flat then return False else do mp <- isProjection qn case mp of Just Projection{ projProper = Just{}, projFromType = t } -> isInductiveRecord t _ -> return False -- | Check whether a projection belongs to a coinductive record -- and is actually recursive. -- E.g. -- @ -- isCoinductiveProjection (Stream.head) = return False -- -- isCoinductiveProjection (Stream.tail) = return True -- @ isCoinductiveProjection :: MonadTCM tcm => Bool -> QName -> tcm Bool isCoinductiveProjection mustBeRecursive q = liftTCM $ do reportSLn "term.guardedness" 40 $ "checking isCoinductiveProjection " ++ prettyShow q flat <- fmap nameOfFlat <$> coinductionKit -- yes for ♭ if Just q == flat then return True else do pdef <- getConstInfo q case isProjection_ (theDef pdef) of Just Projection{ projProper = Just{}, projFromType = r, projIndex = n } -> caseMaybeM (isRecord r) __IMPOSSIBLE__ $ \ rdef -> do -- no for inductive or non-recursive record if recInduction rdef /= Just CoInductive then return False else do reportSLn "term.guardedness" 40 $ prettyShow q ++ " is coinductive" if not mustBeRecursive then return True else do reportSLn "term.guardedness" 40 $ prettyShow q ++ " must be recursive" if not (recRecursive rdef) then return False else do reportSLn "term.guardedness" 40 $ prettyShow q ++ " has been declared recursive, doing actual check now..." -- TODO: the following test for recursiveness of a projection should be cached. -- E.g., it could be stored in the @Projection@ component. -- Now check if type of field mentions mutually recursive symbol. -- Get the type of the field by dropping record parameters and record argument. let TelV tel core = telView' (defType pdef) tel' = drop n $ telToList tel -- Check if any recursive symbols appear in the record type. -- Q (2014-07-01): Should we normalize the type? reportSDoc "term.guardedness" 40 $ sep [ text "looking for recursive occurrences in" , prettyTCM (telFromList tel') , text "and" , prettyTCM core ] names <- anyDefs (r : recMutual rdef) (map (snd . unDom) tel', core) reportSDoc "term.guardedness" 40 $ text "found" <+> sep (map prettyTCM names) return $ not $ null names _ -> do reportSLn "term.guardedness" 40 $ prettyShow q ++ " is not a proper projection" return False -- * De Bruijn patterns. type DeBruijnPats = [DeBruijnPat] -- | Patterns with variables as de Bruijn indices. type DeBruijnPat = DeBruijnPat' Int data DeBruijnPat' a = VarDBP a -- ^ De Bruijn Index. | ConDBP QName [DeBruijnPat' a] -- ^ The name refers to either an ordinary -- constructor or the successor function on sized types. | LitDBP Literal -- ^ Literal. Also abused to censor part of a pattern. | TermDBP Term -- ^ Part of dot pattern that cannot be converted into a pattern. | ProjDBP QName -- ^ Projection pattern. deriving (Functor, Show) instance IsProjP (DeBruijnPat' a) where isProjP (ProjDBP d) = Just d isProjP _ = Nothing instance PrettyTCM DeBruijnPat where prettyTCM (VarDBP i) = prettyTCM $ var i prettyTCM (ConDBP c ps) = parens $ do prettyTCM c <+> hsep (map prettyTCM ps) prettyTCM (LitDBP l) = prettyTCM l prettyTCM (TermDBP v) = parens $ prettyTCM v prettyTCM (ProjDBP d) = prettyTCM d -- | How long is the path to the deepest variable? patternDepth :: DeBruijnPat' a -> Int patternDepth p = case p of ConDBP _ ps -> succ $ maximum $ 0 : map patternDepth ps VarDBP{} -> 0 LitDBP{} -> 0 TermDBP{} -> 0 ProjDBP{} -> 0 -- | A dummy pattern used to mask a pattern that cannot be used -- for structural descent. unusedVar :: DeBruijnPat unusedVar = LitDBP (LitString noRange "term.unused.pat.var") -- | @raiseDBP n ps@ increases each de Bruijn index in @ps@ by @n@. -- Needed when going under a binder during analysis of a term. raiseDBP :: Int -> DeBruijnPats -> DeBruijnPats raiseDBP 0 = id raiseDBP n = map $ fmap (n +) -- | Extract variables from 'DeBruijnPat's that could witness a decrease -- via a SIZELT constraint. -- -- These variables must be under an inductive constructor (with no record -- constructor in the way), or after a coinductive projection (with no -- inductive one in the way). class UsableSizeVars a where usableSizeVars :: a -> TerM VarSet instance UsableSizeVars DeBruijnPat where usableSizeVars p = do let none = return mempty case p of VarDBP i -> ifM terGetUseSizeLt (return $ VarSet.singleton i) {- else -} none ConDBP c ps -> conUseSizeLt c $ usableSizeVars ps LitDBP{} -> none TermDBP{} -> none ProjDBP{} -> none instance UsableSizeVars DeBruijnPats where usableSizeVars ps = case ps of [] -> return mempty (ProjDBP q : ps) -> projUseSizeLt q $ usableSizeVars ps (p : ps) -> mappend <$> usableSizeVars p <*> usableSizeVars ps instance UsableSizeVars (Masked DeBruijnPat) where usableSizeVars (Masked m p) = do let none = return mempty case p of VarDBP i -> ifM terGetUseSizeLt (return $ VarSet.singleton i) {- else -} none ConDBP c ps -> if m then none else conUseSizeLt c $ usableSizeVars ps LitDBP{} -> none TermDBP{} -> none ProjDBP{} -> none instance UsableSizeVars MaskedDeBruijnPats where usableSizeVars ps = case ps of [] -> return mempty (Masked _ (ProjDBP q) : ps) -> projUseSizeLt q $ usableSizeVars ps (p : ps) -> mappend <$> usableSizeVars p <*> usableSizeVars ps -- * Masked patterns (which are not eligible for structural descent, only for size descent) type MaskedDeBruijnPats = [Masked DeBruijnPat] data Masked a = Masked { getMask :: Bool -- ^ True if thing not eligible for structural descent. , getMasked :: a -- ^ Thing. } deriving (Eq, Ord, Show, Functor, Foldable, Traversable) masked :: a -> Masked a masked = Masked True notMasked :: a -> Masked a notMasked = Masked False instance Decoration Masked where traverseF f (Masked m a) = Masked m <$> f a -- | Print masked things in double parentheses. instance PrettyTCM a => PrettyTCM (Masked a) where prettyTCM (Masked m a) = applyWhen m (parens . parens) $ prettyTCM a -- * Call pathes -- | The call information is stored as free monoid -- over 'CallInfo'. As long as we never look at it, -- only accumulate it, it does not matter whether we use -- 'Set', (nub) list, or 'Tree'. -- Internally, due to lazyness, it is anyway a binary tree of -- 'mappend' nodes and singleton leafs. -- Since we define no order on 'CallInfo' (expensive), -- we cannot use a 'Set' or nub list. -- Performance-wise, I could not see a difference between Set and list. newtype CallPath = CallPath { callInfos :: [CallInfo] } deriving (Show, Monoid, AllNames) -- | Only show intermediate nodes. (Drop last 'CallInfo'). instance Pretty CallPath where pretty (CallPath cis0) = if null cis then empty else P.hsep (map (\ ci -> arrow P.<+> P.pretty ci) cis) P.<+> arrow where cis = init cis0 arrow = P.text "-->" -- * Size depth estimation -- | A very crude way of estimating the @SIZELT@ chains -- @i > j > k@ in context. Returns 3 in this case. -- Overapproximates. -- TODO: more precise analysis, constructing a tree -- of relations between size variables. terSetSizeDepth :: Telescope -> TerM a -> TerM a terSetSizeDepth tel cont = do n <- liftTCM $ sum <$> do forM (telToList tel) $ \ dom -> do a <- reduce $ snd $ unDom dom ifM (isJust <$> isSizeType a) (return 1) {- else -} $ case ignoreSharing $ unEl a of MetaV{} -> return 1 _ -> return 0 terLocal (set terSizeDepth n) cont Agda-2.4.2.5/src/full/Agda/Termination/Semiring.hs0000644000000000000000000000557312635075266017721 0ustar0000000000000000-- | Semirings. module Agda.Termination.Semiring ( HasZero(..), SemiRing(..) , Semiring(..) , semiringInvariant , integerSemiring , intSemiring , boolSemiring , Agda.Termination.Semiring.tests ) where import Data.Monoid import Agda.Utils.QuickCheck import Agda.Utils.TestHelpers {- | SemiRing type class. Additive monoid with multiplication operation. Inherit addition and zero from Monoid. -} class (Eq a, Monoid a) => SemiRing a where -- isZero :: a -> Bool multiply :: a -> a -> a -- | @HasZero@ is needed for sparse matrices, to tell which is the element -- that does not have to be stored. -- It is a cut-down version of @SemiRing@ which is definable -- without the implicit @?cutoff@. class Eq a => HasZero a where zeroElement :: a -- | Semirings. data Semiring a = Semiring { add :: a -> a -> a -- ^ Addition. , mul :: a -> a -> a -- ^ Multiplication. , zero :: a -- ^ Zero. -- The one is never used in matrix multiplication -- , one :: a -- ^ One. } -- | Semiring invariant. -- I think it's OK to use the same x, y, z triple for all the -- properties below. semiringInvariant :: (Arbitrary a, Eq a, Show a) => Semiring a -> a -> a -> a -> Bool semiringInvariant (Semiring { add = (+), mul = (*) , zero = zero --, one = one }) = \x y z -> associative (+) x y z && identity zero (+) x && commutative (+) x y && associative (*) x y z && -- identity one (*) x && leftDistributive (*) (+) x y z && rightDistributive (*) (+) x y z && isZero zero (*) x ------------------------------------------------------------------------ -- Specific semirings -- | The standard semiring on 'Integer's. instance HasZero Integer where zeroElement = 0 integerSemiring :: Semiring Integer integerSemiring = Semiring { add = (+), mul = (*), zero = 0 } -- , one = 1 } prop_integerSemiring :: Integer -> Integer -> Integer -> Bool prop_integerSemiring = semiringInvariant integerSemiring -- | The standard semiring on 'Int's. instance HasZero Int where zeroElement = 0 intSemiring :: Semiring Int intSemiring = Semiring { add = (+), mul = (*), zero = 0 } -- , one = 1 } prop_intSemiring :: Int -> Int -> Int -> Bool prop_intSemiring = semiringInvariant intSemiring -- | The standard semiring on 'Bool's. boolSemiring :: Semiring Bool boolSemiring = Semiring { add = (||), mul = (&&), zero = False } --, one = True } prop_boolSemiring :: Bool -> Bool -> Bool -> Bool prop_boolSemiring = semiringInvariant boolSemiring ------------------------------------------------------------------------ -- All tests tests :: IO Bool tests = runTests "Agda.Termination.Semiring" [ quickCheck' prop_integerSemiring , quickCheck' prop_boolSemiring ] Agda-2.4.2.5/src/full/Agda/Termination/Inlining.hs0000644000000000000000000002554712635075266017716 0ustar0000000000000000{-# LANGUAGE CPP #-} #if __GLASGOW_HASKELL__ >= 710 {-# LANGUAGE FlexibleContexts #-} #endif -- Author: Ulf Norell -- Created: 2013-11-09 {-| This module defines an inlining transformation on clauses that's run before termination checking. The purpose is to improve termination checking of with clauses (issue 59). The transformation inlines generated with-functions expanding the clauses of the parent function in such a way that termination checking the expanded clauses guarantees termination of the original function, while allowing more terminating functions to be accepted. It does in no way pretend to preserve the semantics of the original function. Roughly, the source program > f ps with as > {f ps₁i qsi = bi} is represented internally as > f ps = f-aux xs as where xs = vars(ps) > {f-aux ps₂i qsi = bi} where ps₁i = ps[ps₂i/xs] The inlining transformation turns this into > {f ps = aj} for aj ∈ as > {f ps₁i qsi = bi} The first set of clauses, called 'withExprClauses', ensure that we don't forget any recursive calls in @as@. The second set of clauses, henceforth called 'inlinedClauses', are the surface-level clauses the user sees (and probably reasons about). The reason this works is that there is a single call site for each with-function. Note that the lhss of the inlined clauses are not type-correct, neither with the type of @f@ (since there are additional patterns @qsi@) nor with the type of @f-aux@ (since there are the surface-level patterns @ps₁i@ instead of the actual patterns @ps₂i@). -} module Agda.Termination.Inlining ( inlineWithClauses , isWithFunction , expandWithFunctionCall ) where import Control.Applicative import Control.Monad.State import Data.Maybe (fromMaybe) import Data.Monoid import Data.Foldable (foldMap) import Data.Traversable (traverse) import Data.List as List import Agda.Syntax.Common as Common hiding (NamedArg) import Agda.Syntax.Internal import Agda.Syntax.Internal.Pattern import Agda.TypeChecking.Monad import Agda.TypeChecking.Pretty import Agda.TypeChecking.Substitute import Agda.TypeChecking.Reduce import Agda.TypeChecking.DisplayForm import Agda.TypeChecking.Telescope import Agda.Utils.Maybe import Agda.Utils.Monad import Agda.Utils.Permutation import Agda.Utils.Size import Agda.Utils.Impossible #include "undefined.h" inlineWithClauses :: QName -> Clause -> TCM [Clause] inlineWithClauses f cl = inTopContext $ do -- Clauses are relative to the empty context, so we operate @inTopContext@. let noInline = return [cl] -- Get the clause body as-is (unraised). -- The de Bruijn indices are then relative to the @clauseTel cl@. body <- traverse instantiate $ getBodyUnraised cl case body of Just (Def wf els) -> caseMaybeM (isWithFunction wf) noInline $ \ f' -> if f /= f' then noInline else do -- The clause body is a with-function call @wf args@. -- @f@ is the function the with-function belongs to. let args = fromMaybe __IMPOSSIBLE__ . allApplyElims $ els reportSDoc "term.with.inline" 70 $ sep [ text "Found with (raw):", nest 2 $ text $ show cl ] reportSDoc "term.with.inline" 20 $ sep [ text "Found with:", nest 2 $ prettyTCM $ QNamed f cl ] t <- defType <$> getConstInfo wf cs1 <- withExprClauses cl t args reportSDoc "term.with.inline" 70 $ vcat $ text "withExprClauses (raw)" : map (nest 2 . text . show) cs1 reportSDoc "term.with.inline" 20 $ vcat $ text "withExprClauses" : map (nest 2 . prettyTCM . QNamed f) cs1 cs2 <- inlinedClauses f cl t wf reportSDoc "term.with.inline" 70 $ vcat $ text "inlinedClauses (raw)" : map (nest 2 . text . show) cs2 reportSDoc "term.with.inline" 20 $ vcat $ text "inlinedClauses" : map (nest 2 . prettyTCM . QNamed f) cs2 return $ cs1 ++ cs2 _ -> noInline -- | @withExprClauses cl t as@ generates a clause containing a fake -- call to with-expression @a@ for each @a@ in @as@ that is not -- a variable (and thus cannot contain a recursive call). -- -- Andreas, 2013-11-11: I guess "not a variable" could be generalized -- to "not containing a call to a mutually defined function". -- -- Note that the @as@ stem from the *unraised* clause body of @cl@ -- and thus can be simply 'fmap'ped back there (under all the 'Bind' -- abstractions). -- -- Precondition: we are 'inTopContext'. withExprClauses :: Clause -> Type -> Args -> TCM [Clause] withExprClauses cl t args = {- addCtxTel (clauseTel cl) $ -} loop t args where -- Note: for the following code, it does not matter which context we are in. -- Restore the @addCtxTel (clauseTel cl)@ if that should become necessary -- (like when debug printing @args@ etc). loop t [] = return [] loop t (a:as) = case unArg a of Var i [] -> rest -- TODO: smarter criterion when to skip withExprClause v -> (cl { clauseBody = v <$ clauseBody cl , clauseType = Just $ defaultArg dom } :) <$> rest where rest = loop (piApply t [a]) as dom = case unEl t of -- The type is the generated with-function type so we know it Pi a _ -> unDom a -- doesn't contain anything funny _ -> __IMPOSSIBLE__ -- | @inlinedClauses f cl t wf@ inlines the clauses of with-function @wf@ -- of type @t@ into the clause @cl@. The original function name is @f@. -- -- Precondition: we are 'inTopContext'. inlinedClauses :: QName -> Clause -> Type -> QName -> TCM [Clause] inlinedClauses f cl t wf = do -- @wf@ might define a with-function itself, so we first construct -- the with-inlined clauses @wcs@ of @wf@ recursively. wcs <- concat <$> (mapM (inlineWithClauses wf) =<< defClauses <$> getConstInfo wf) reportSDoc "term.with.inline" 30 $ vcat $ text "With-clauses to inline" : map (nest 2 . prettyTCM . QNamed wf) wcs mapM (inline f cl t wf) wcs -- | The actual work horse. -- @inline f pcl t wf wcl@ inlines with-clause @wcl@ of with-function @wf@ -- (of type @t@) into parent clause @pcl@ (original function being @f@). inline :: QName -> Clause -> Type -> QName -> Clause -> TCM Clause inline f pcl t wf wcl = inTopContext $ addCtxTel (clauseTel wcl) $ do -- The tricky part here is to get the variables to line up properly. The -- order of the arguments to the with-function is not the same as the order -- of the arguments to the parent function. Fortunately we have already -- figured out how to turn an application of the with-function into an -- application of the parent function in the display form. reportSDoc "term.with.inline" 70 $ text "inlining (raw) =" <+> text (show wcl) let vs = clauseArgs wcl Just disp <- displayForm wf vs reportSDoc "term.with.inline" 70 $ text "display form (raw) =" <+> text (show disp) reportSDoc "term.with.inline" 40 $ text "display form =" <+> prettyTCM disp (pats, perm) <- dispToPats disp -- Now we need to sort out the right hand side. We have -- Γ - clause telescope (same for with-clause and inlined clause) -- Δw - variables bound in the patterns of the with clause -- Δi - variables bound in the patterns of the inlined clause -- Δw ⊢ clauseBody wcl -- and we want -- Δi ⊢ body -- We can use the clause permutations to get there (renaming is bugged and -- shouldn't need the reverseP): -- applySubst (renaming $ reverseP $ clausePerm wcl) : Term Δw -> Term Γ -- applySubst (renamingR perm) : Term Γ -> Term Δi -- Finally we need to add the right number of Bind's to the body. let body = rebindBody (permRange perm) $ applySubst (renamingR perm) . applySubst (renaming $ reverseP $ clausePerm wcl) <$> clauseBody wcl return wcl { clausePerm = perm , namedClausePats = pats , clauseBody = body , clauseType = Nothing -- TODO: renaming of original clause type } where numVars = size (clauseTel wcl) rebindBody n b = bind n $ maybe NoBody Body $ getBodyUnraised b where bind 0 = id bind n = Bind . Abs (stringToArgName $ "h" ++ show n') . bind n' where n' = n - 1 dispToPats :: DisplayTerm -> TCM ([NamedArg Pattern], Permutation) dispToPats (DWithApp (DDef _ es) ws zs) = do let es' = es ++ map Apply (map defaultArg ws ++ map (fmap DTerm) zs) (ps, (j, ren)) <- (`runStateT` (0, [])) $ mapM (traverse dtermToPat) es' let perm = Perm j (map snd $ List.sort ren) return (map ePatToPat ps, perm) dispToPats t = __IMPOSSIBLE__ bindVar i = do (j, is) <- get let i' = numVars - i - 1 case lookup i' is of Nothing -> True <$ put (j + 1, (i', j) : is) Just{} -> False <$ put (j + 1, is) skip = modify $ \(j, is) -> (j + 1, is) ePatToPat :: Elim' Pattern -> NamedArg Pattern ePatToPat (Apply p) = fmap unnamed p ePatToPat (Proj d) = defaultNamedArg $ ProjP d dtermToPat :: DisplayTerm -> StateT (Int, [(Int, Int)]) TCM Pattern dtermToPat v = case v of DWithApp{} -> __IMPOSSIBLE__ -- I believe DCon c vs -> ConP c noConPatternInfo . map (fmap unnamed) <$> mapM (traverse dtermToPat) vs DDef d es -> do ifM (return (null es) `and2M` do isJust <$> lift (isProjection d)) {-then-} (return $ ProjP d) {-else-} (DotP (dtermToTerm v) <$ skip) DDot v -> DotP v <$ skip DTerm (Var i []) -> ifM (bindVar i) (VarP . nameToPatVarName <$> lift (nameOfBV i)) (pure $ DotP (Var i [])) DTerm (Con c vs) -> ConP c noConPatternInfo . map (fmap unnamed) <$> mapM (traverse (dtermToPat . DTerm)) vs DTerm v -> DotP v <$ skip isWithFunction :: MonadTCM tcm => QName -> tcm (Maybe QName) isWithFunction x = liftTCM $ do def <- getConstInfo x return $ case theDef def of Function{ funWith = w } -> w _ -> Nothing expandWithFunctionCall :: QName -> Elims -> TCM Term expandWithFunctionCall f es = do as <- displayFormArities f case as of [a] | length vs >= a -> do Just disp <- displayForm f vs return $ dtermToTerm disp `applyE` es' -- We might get an underapplied with function application (issue1598), in -- which case we have to eta expand. The resulting term is only used for -- termination checking, so we don't have to worry about getting hiding -- information right. [a] | null es' -> do let pad = a - length vs vs' = raise pad vs ++ [defaultArg (Var i []) | i <- reverse [0..pad - 1]] Just disp <- displayForm f vs' return $ foldr (\_ -> Lam defaultArgInfo . Abs "") (dtermToTerm disp) (replicate pad ()) _ -> __IMPOSSIBLE__ where (vs, es') = splitApplyElims es Agda-2.4.2.5/src/full/Agda/Termination/Order.hs0000644000000000000000000002776512635075266017226 0ustar0000000000000000{-# LANGUAGE CPP #-} {-# LANGUAGE FlexibleInstances #-} {-# LANGUAGE ImplicitParams #-} -- | An Abstract domain of relative sizes, i.e., differences -- between size of formal function parameter and function argument -- in recursive call; used in the termination checker. module Agda.Termination.Order ( -- * Structural orderings Order(Mat), decr , increase, decrease , (.*.) , supremum, infimum , orderSemiring , le, lt, unknown, orderMat, collapseO , nonIncreasing, decreasing, isDecr , NotWorse(..) , tests ) where import Data.Foldable (Foldable) import qualified Data.Foldable as Fold import Data.List as List hiding (union, insert) import Data.Monoid import Agda.Termination.CutOff import Agda.Termination.SparseMatrix as Matrix hiding (tests) import Agda.Termination.Semiring (HasZero(..), Semiring) import qualified Agda.Termination.Semiring as Semiring import Agda.Utils.PartialOrd hiding (tests) import Agda.Utils.Pretty import Agda.Utils.QuickCheck import Agda.Utils.TestHelpers #include "undefined.h" import Agda.Utils.Impossible ------------------------------------------------------------------------ -- Structural orderings -- | In the paper referred to above, there is an order R with -- @'Unknown' '<=' 'Le' '<=' 'Lt'@. -- -- This is generalized to @'Unknown' '<=' 'Decr k'@ where -- @Decr 1@ replaces @Lt@ and @Decr 0@ replaces @Le@. -- A negative decrease means an increase. The generalization -- allows the termination checker to record an increase by 1 which -- can be compensated by a following decrease by 2 which results in -- an overall decrease. -- -- However, the termination checker of the paper itself terminates because -- there are only finitely many different call-matrices. To maintain -- termination of the terminator we set a @cutoff@ point which determines -- how high the termination checker can count. This value should be -- set by a global or file-wise option. -- -- See 'Call' for more information. -- -- TODO: document orders which are call-matrices themselves. data Order = Decr {-# UNPACK #-} !Int -- ^ Decrease of callee argument wrt. caller parameter. | Unknown -- ^ No relation, infinite increase, or increase beyond termination depth. | Mat {-# UNPACK #-} !(Matrix Int Order) -- ^ Matrix-shaped order, currently UNUSED. deriving (Eq,Ord) instance Show Order where show (Decr k) = show (- k) show Unknown = "." show (Mat m) = "Mat " ++ show m instance HasZero Order where zeroElement = Unknown -- | Information order: 'Unknown' is least information. -- The more we decrease, the more information we have. -- -- When having comparable call-matrices, we keep the lesser one. -- Call graph completion works toward losing the good calls, -- tending towards Unknown (the least information). instance PartialOrd Order where comparable o o' = case (o, o') of (Unknown, Unknown) -> POEQ (Unknown, _ ) -> POLT (_ , Unknown) -> POGT (Decr k , Decr l ) -> comparableOrd k l -- Matrix-shaped orders are no longer supported (Mat{} , _ ) -> __IMPOSSIBLE__ (_ , Mat{} ) -> __IMPOSSIBLE__ -- | A partial order, aimed at deciding whether a call graph gets -- worse during the completion. -- class NotWorse a where notWorse :: a -> a -> Bool -- | It does not get worse then ``increase''. -- If we are still decreasing, it can get worse: less decreasing. instance NotWorse Order where o `notWorse` Unknown = True -- we are unboundedly increasing Unknown `notWorse` Decr k = k < 0 -- we are increasing Decr l `notWorse` Decr k = k < 0 || l >= k -- we are increasing or -- we are decreasing, but more -- Matrix-shaped orders are no longer supported Mat m `notWorse` o = __IMPOSSIBLE__ o `notWorse` Mat m = __IMPOSSIBLE__ {- Mat m `notWorse` Mat n = m `notWorse` n -- matrices are compared pointwise o `notWorse` Mat n = o `notWorse` collapse n -- or collapsed (sound?) Mat m `notWorse` o = collapse m `notWorse` o -} -- | We assume the matrices have the same dimension. instance (Ord i) => NotWorse (Matrix i Order) where m `notWorse` n | size m /= size n = __IMPOSSIBLE__ | otherwise = Fold.all isTrue $ zipMatrices onlym onlyn both trivial m n where -- If an element is only in @m@, then its 'Unknown' in @n@ -- so it gotten better at best, in any case, not worse. onlym o = True -- @== o `notWorse` Unknown@ onlyn o = Unknown `notWorse` o both = notWorse isTrue = id trivial = id -- | Raw increase which does not cut off. increase :: Int -> Order -> Order increase i o = case o of Unknown -> Unknown Decr k -> Decr $ k - i Mat m -> Mat $ fmap (increase i) m -- | Raw decrease which does not cut off. decrease :: Int -> Order -> Order decrease i o = increase (-i) o -- | Smart constructor for @Decr k :: Order@ which cuts off too big values. -- -- Possible values for @k@: @- ?cutoff '<=' k '<=' ?cutoff + 1@. -- decr :: (?cutoff :: CutOff) => Int -> Order decr k = case ?cutoff of CutOff c | k < -c -> Unknown | k > c -> Decr $ c + 1 _ -> Decr k -- | Smart constructor for matrix shaped orders, avoiding empty and singleton matrices. orderMat :: Matrix Int Order -> Order orderMat m | Matrix.isEmpty m = Decr 0 -- 0x0 Matrix = neutral element | otherwise = case isSingleton m of Just o -> o -- 1x1 Matrix Nothing -> Mat m -- nxn Matrix withinCutOff :: (?cutoff :: CutOff) => Int -> Bool withinCutOff k = case ?cutoff of DontCutOff -> True CutOff c -> k >= -c && k <= c + 1 isOrder :: (?cutoff :: CutOff) => Order -> Bool isOrder (Decr k) = withinCutOff k isOrder Unknown = True isOrder (Mat m) = False -- TODO: extend to matrices prop_decr :: (?cutoff :: CutOff) => Int -> Bool prop_decr = isOrder . decr -- | @le@, @lt@, @decreasing@, @unknown@: for backwards compatibility, and for external use. le :: Order le = Decr 0 lt :: Order lt = Decr 1 unknown :: Order unknown = Unknown nonIncreasing :: Order -> Bool nonIncreasing (Decr k) = k >= 0 nonIncreasing _ = False decreasing :: Order -> Bool decreasing (Decr k) = k > 0 decreasing _ = False -- | Matrix-shaped order is decreasing if any diagonal element is decreasing. isDecr :: Order -> Bool isDecr (Mat m) = any isDecr $ diagonal m isDecr o = decreasing o instance Pretty Order where pretty (Decr 0) = text "=" pretty (Decr k) = text $ show (0 - k) pretty Unknown = text "?" pretty (Mat m) = text "Mat" <+> pretty m --instance Ord Order where -- max = maxO {- instances cannot have implicit arguments?! GHC manual says: 7.8.3.1. Implicit-parameter type constraints You can't have an implicit parameter in the context of a class or instance declaration. For example, both these declarations are illegal: class (?x::Int) => C a where ... instance (?x::a) => Foo [a] where ... Reason: exactly which implicit parameter you pick up depends on exactly where you invoke a function. But the ``invocation'' of instance declarations is done behind the scenes by the compiler, so it's hard to figure out exactly where it is done. Easiest thing is to outlaw the offending types. instance (?cutoff :: CutOff) => Arbitrary Order where arbitrary = frequency [(20, return Unknown) ,(80, elements [- ?cutoff .. ?cutoff + 1] >>= Decr) ] -- no embedded matrices generated for now. -} instance Arbitrary Order where arbitrary = frequency [(30, return Unknown) ,(70, elements [0,1] >>= return . Decr) ] -- no embedded matrices generated for now. instance CoArbitrary Order where coarbitrary (Decr k) = variant 0 coarbitrary Unknown = variant 1 coarbitrary (Mat m) = variant 2 -- | Multiplication of 'Order's. (Corresponds to sequential -- composition.) -- I think this funny pattern matching is because overlapping patterns -- are producing a warning and thus an error (strict compilation settings) (.*.) :: (?cutoff :: CutOff) => Order -> Order -> Order Unknown .*. _ = Unknown (Mat m) .*. Unknown = Unknown (Decr k) .*. Unknown = Unknown (Decr k) .*. (Decr l) = decr (k + l) (Decr 0) .*. (Mat m) = Mat m (Decr k) .*. (Mat m) = (Decr k) .*. (collapse m) (Mat m1) .*. (Mat m2) = if (okM m1 m2) then Mat $ mul orderSemiring m1 m2 else (collapse m1) .*. (collapse m2) (Mat m) .*. (Decr 0) = Mat m (Mat m) .*. (Decr k) = (collapse m) .*. (Decr k) {- collapse m We assume that m codes a permutation: each row has at most one column that is not Un. To collapse a matrix into a single value, we take the best value of each column and multiply them. That means if one column is all Un, i.e., no argument relates to that parameter, than the collapsed value is also Un. This makes order multiplication associative. -} collapse :: (?cutoff :: CutOff) => Matrix Int Order -> Order collapse m = -- if not $ Matrix.matrixInvariant m then __IMPOSSIBLE__ else case toLists $ Matrix.transpose m of [] -> __IMPOSSIBLE__ -- This can never happen if order matrices are generated by the smart constructor m' -> foldl1 (.*.) $ map (foldl1 maxO) m' {- OLD CODE, does not give associative matrix multiplication: collapse :: (?cutoff :: CutOff) => Matrix Int Order -> Order collapse m = foldl (.*.) le (Data.Array.elems $ diagonal m) -} collapseO :: (?cutoff :: CutOff) => Order -> Order collapseO (Mat m) = collapse m collapseO o = o okM :: Matrix Int Order -> Matrix Int Order -> Bool okM m1 m2 = (rows $ size m2) == (cols $ size m1) -- | The supremum of a (possibly empty) list of 'Order's. -- More information (i.e., more decrease) is bigger. -- 'Unknown' is no information, thus, smallest. supremum :: (?cutoff :: CutOff) => [Order] -> Order supremum = foldr maxO Unknown -- | @('Order', 'maxO', '.*.')@ forms a semiring, with 'Unknown' as -- zero and 'Le' as one. maxO :: (?cutoff :: CutOff) => Order -> Order -> Order maxO o1 o2 = case (o1,o2) of (Decr k, Decr l) -> Decr (max k l) -- cut off not needed, within borders (Unknown,_) -> o2 (_,Unknown) -> o1 (Mat m1, Mat m2) -> Mat (Matrix.add maxO m1 m2) (Mat m,_) -> maxO (collapse m) o2 (_,Mat m) -> maxO o1 (collapse m) -- | The infimum of a (non empty) list of 'Order's. -- 'Unknown' is the least element, thus, dominant. infimum :: (?cutoff :: CutOff) => [Order] -> Order infimum (o:l) = foldl' minO o l infimum [] = __IMPOSSIBLE__ minO :: (?cutoff :: CutOff) => Order -> Order -> Order minO o1 o2 = case (o1,o2) of (Unknown,_) -> Unknown (_,Unknown) -> Unknown (Decr k, Decr l) -> Decr (min k l) -- cut off not needed, within borders (Mat m1, Mat m2) -> if (size m1 == size m2) then Mat $ Matrix.intersectWith minO m1 m2 else minO (collapse m1) (collapse m2) (Mat m1,_) -> minO (collapse m1) o2 (_,Mat m2) -> minO o1 (collapse m2) {- Cannot have implicit arguments in instances. Too bad! instance Monoid Order where mempty = Unknown mappend = maxO instance (cutoff :: Int) => SemiRing Order where multiply = (.*.) -} orderSemiring :: (?cutoff :: CutOff) => Semiring Order orderSemiring = Semiring.Semiring { Semiring.add = maxO , Semiring.mul = (.*.) , Semiring.zero = Unknown -- , Semiring.one = Le } prop_orderSemiring :: (?cutoff :: CutOff) => Order -> Order -> Order -> Bool prop_orderSemiring = Semiring.semiringInvariant orderSemiring ------------------------------------------------------------------------ -- All tests tests :: IO Bool tests = runTests "Agda.Termination.Order" [ quickCheck' prop_decr , quickCheck' prop_orderSemiring ] where ?cutoff = DontCutOff -- CutOff 2 -- don't cut off in tests! Agda-2.4.2.5/src/full/Agda/Termination/SparseMatrix.hs0000644000000000000000000006214712635075266020566 0ustar0000000000000000{-# LANGUAGE CPP #-} {-# LANGUAGE DeriveFoldable #-} {-# LANGUAGE DeriveFunctor #-} {-# LANGUAGE DeriveTraversable #-} {-# LANGUAGE FlexibleInstances #-} {-# LANGUAGE FunctionalDependencies #-} {-# LANGUAGE NamedFieldPuns #-} {-# LANGUAGE MultiParamTypeClasses #-} {-# LANGUAGE ScopedTypeVariables #-} {-# LANGUAGE TupleSections #-} {- | Sparse matrices. We assume the matrices to be very sparse, so we just implement them as sorted association lists. Most operations are linear in the number of non-zero elements. An exception is transposition, which needs to sort the association list again; it has the complexity of sorting: @n log n@ where @n@ is the number of non-zero elements. Another exception is matrix multiplication, of course. -} module Agda.Termination.SparseMatrix ( -- * Basic data types Matrix , matrixInvariant , Size(..) , sizeInvariant , MIx (..) , mIxInvariant -- * Generating and creating matrices , fromLists , fromIndexList , toLists -- , Agda.Termination.Matrix.zipWith , matrix , matrixUsingRowGen -- * Combining and querying matrices , size , square , isEmpty , isSingleton , zipMatrices , add, intersectWith , mul , transpose , Diagonal(..) -- * Modifying matrices , addRow , addColumn -- * Tests , Agda.Termination.SparseMatrix.tests ) where import Data.Array import Data.Function import qualified Data.List as List import Data.Maybe import Data.Monoid import Data.Foldable (Foldable) import qualified Data.Foldable as Fold import Data.Traversable (Traversable) import qualified Text.PrettyPrint.Boxes as Boxes import Agda.Termination.Semiring (HasZero(..), Semiring) import qualified Agda.Termination.Semiring as Semiring import Agda.Utils.Functor import Agda.Utils.List import Agda.Utils.Maybe import Agda.Utils.Monad import Agda.Utils.PartialOrd import Agda.Utils.Pretty hiding (isEmpty) import Agda.Utils.QuickCheck import Agda.Utils.TestHelpers import Agda.Utils.Tuple #include "undefined.h" import Agda.Utils.Impossible ------------------------------------------------------------------------ -- * Basic data types ------------------------------------------------------------------------ -- | Size of a matrix. data Size i = Size { rows :: i -- ^ Number of rows, @>= 0@. , cols :: i -- ^ Number of columns, @>= 0@. } deriving (Eq, Ord, Show) -- | Type of matrix indices (row, column). data MIx i = MIx { row :: i -- ^ Row index, @1 <= row <= rows@. , col :: i -- ^ Column index @1 <= col <= cols@. } deriving (Eq, Ord, Show, Ix) -- | Convert a 'Size' to a set of bounds suitable for use with -- the matrices in this module. toBounds :: Num i => Size i -> (MIx i, MIx i) toBounds sz = (MIx { row = 1, col = 1 }, MIx { row = rows sz, col = cols sz }) -- | Type of matrices, parameterised on the type of values. -- -- Sparse matrices are implemented as an ordered association list, -- mapping coordinates to values. data Matrix i b = Matrix { size :: Size i -- ^ Dimensions of the matrix. , unM :: [(MIx i, b)] -- ^ Association of indices to values. } deriving (Eq, Ord, Functor, Foldable, Traversable) ------------------------------------------------------------------------ -- * Operations and query on matrix size. ------------------------------------------------------------------------ -- | 'True' iff the matrix is square. square :: Ix i => Matrix i b -> Bool square m = rows (size m) == cols (size m) -- | Returns 'True' iff the matrix is empty. isEmpty :: (Num i, Ix i) => Matrix i b -> Bool isEmpty m = rows sz <= 0 || cols sz <= 0 where sz = size m -- | Compute the matrix size of the union of two matrices. supSize :: Ord i => Matrix i a -> Matrix i b -> Size i supSize (Matrix (Size r1 c1) _) (Matrix (Size r2 c2) _) = Size (max r1 r2) (max c1 c2) -- | Compute the matrix size of the intersection of two matrices. infSize :: Ord i => Matrix i a -> Matrix i b -> Size i infSize (Matrix (Size r1 c1) _) (Matrix (Size r2 c2) _) = Size (min r1 r2) (min c1 c2) ------------------------------------------------------------------------ -- * Creating matrices and converting to lists. ------------------------------------------------------------------------ -- | Constructs a matrix from a list of @(index, value)@-pairs. -- @O(n)@ where @n@ is size of the list. -- -- Precondition: indices are unique. fromIndexList :: (Ord i, HasZero b) => Size i -> [(MIx i, b)] -> Matrix i b fromIndexList sz = Matrix sz . List.sortBy (compare `on` fst) . filter ((zeroElement /=) . snd) -- | @'fromLists' sz rs@ constructs a matrix from a list of lists of -- values (a list of rows). -- @O(size)@ where @size = rows × cols@. -- -- Precondition: -- @'length' rs '==' 'rows' sz@ and -- @'all' (('cols' sz '==') . 'length') rs@. fromLists :: (Ord i, Num i, Enum i, HasZero b) => Size i -> [[b]] -> Matrix i b fromLists sz bs = fromIndexList sz $ zip ([ MIx i j | i <- [1..rows sz] , j <- [1..cols sz]]) (concat bs) -- | Converts a sparse matrix to a sparse list of rows. -- @O(n)@ where @n@ is the number of non-zero entries of the matrix. -- -- Only non-empty rows are generated. -- toSparseRows :: (Eq i) => Matrix i b -> [(i,[(i,b)])] toSparseRows (Matrix _ []) = [] toSparseRows (Matrix _ ((MIx i j, b) : m)) = aux i [(j,b)] m where aux i' [] [] = [] aux i' row [] = [(i', reverse row)] aux i' row ((MIx i j, b) : m) | i' == i = aux i' ((j,b):row) m | otherwise = (i', reverse row) : aux i [(j,b)] m -- | Alternative implementation, serves as specification. toSparseRows' :: (Eq i) => Matrix i b -> [(i,[(i,b)])] toSparseRows' (Matrix _ m) = -- group list by row index for (List.groupBy ((==) `on` (row . fst)) m) $ \ ((MIx i j, b) : vs) -> -- turn each group into a sparse row (i, (j,b) : map (mapFst col) vs) prop_toSparseRows :: TM -> Bool prop_toSparseRows m = toSparseRows m == toSparseRows' m -- | Turn a sparse vector into a vector by inserting a fixed element -- at the missing positions. -- @O(size)@ where @size@ is the dimension of the vector. blowUpSparseVec :: (Integral i) => b -> i -> [(i,b)] -> [b] blowUpSparseVec zero n l = aux 1 l where aux i [] = List.genericReplicate (n + 1 - i) zero aux i l@((j,b):l') | i > j || i > n = __IMPOSSIBLE__ | i == j = b : aux (i + 1) l' | otherwise = zero : aux (i + 1) l -- Older implementation without replicate. blowUpSparseVec' :: (Show i, Ord i, Num i, Enum i) => b -> i -> [(i,b)] -> [b] blowUpSparseVec' zero n l = aux 1 l where aux i [] | i > n = [] | otherwise = zero : aux (i+1) [] aux i ((j,b):l) | i <= n && j == i = b : aux (succ i) l aux i ((j,b):l) | i <= n && j >= i = zero : aux (succ i) ((j,b):l) aux i l = __IMPOSSIBLE__ -- error $ "blowUpSparseVec (n = " ++ show n ++ ") aux i=" ++ show i ++ " j=" ++ show (fst (head l)) ++ " length l = " ++ show (length l) -- | Converts a matrix to a list of row lists. -- @O(size)@ where @size = rows × cols@. toLists :: (Integral i, HasZero b) => Matrix i b -> [[b]] toLists m@(Matrix size@(Size nrows ncols) _) = blowUpSparseVec emptyRow nrows $ map (mapSnd (blowUpSparseVec zeroElement ncols)) $ toSparseRows m where emptyRow = List.genericReplicate ncols zeroElement ------------------------------------------------------------------------ -- * Combining and querying matrices ------------------------------------------------------------------------ -- | Returns 'Just b' iff it is a 1x1 matrix with just one entry 'b'. -- @O(1)@. isSingleton :: (Eq i, Num i, HasZero b) => Matrix i b -> Maybe b isSingleton (Matrix (Size 1 1) [(_,b)]) = Just b isSingleton (Matrix (Size 1 1) [] ) = Just zeroElement isSingleton (Matrix (Size 1 1) _ ) = __IMPOSSIBLE__ isSingleton _ = Nothing -- | @'diagonal' m@ extracts the diagonal of @m@. -- -- For non-square matrices, the length of the diagonal is -- the minimum of the dimensions of the matrix. class Diagonal m e | m -> e where diagonal :: m -> [e] -- | Diagonal of sparse matrix. -- -- @O(n)@ where @n@ is the number of non-zero elements in the matrix. instance (Integral i, HasZero b) => Diagonal (Matrix i b) b where diagonal (Matrix (Size r c) m) = blowUpSparseVec zeroElement (min r c) $ mapMaybe (\ ((MIx i j), b) -> if i==j then Just (i,b) else Nothing) m -- | Transposable things. class Transpose a where transpose :: a -> a -- | Size of transposed matrix. instance Transpose (Size i) where transpose (Size n m) = Size m n -- | Transposing coordinates. instance Transpose (MIx i) where transpose (MIx i j) = MIx j i -- | Matrix transposition. -- -- @O(n log n)@ where @n@ is the number of non-zero elements in the matrix. instance Ord i => Transpose (Matrix i b) where transpose (Matrix size m) = Matrix (transpose size) $ List.sortBy (compare `on` fst) $ map (mapFst transpose) m -- | General pointwise combination function for association lists. -- @O(n1 + n2)@ where @ni@ is the number of non-zero element in matrix @i@. -- -- In @zipAssocWith fs gs f g h l l'@, -- -- @fs@ is possibly more efficient version of -- @'mapMaybe' (\ (i, a) -> (i,) <$> f a)@, and same for @gs@ and @g@. zipAssocWith :: (Ord i) => ([(i,a)] -> [(i,c)]) -- ^ Only left map remaining. -> ([(i,b)] -> [(i,c)]) -- ^ Only right map remaining. -> (a -> Maybe c) -- ^ Element only present in left map. -> (b -> Maybe c) -- ^ Element only present in right map. -> (a -> b -> Maybe c) -- ^ Element present in both maps. -> [(i,a)] -> [(i,b)] -> [(i,c)] zipAssocWith fs gs f g h = merge where merge m1 [] = mapMaybe (\ (i, a) -> (i,) <$> f a) m1 merge [] m2 = mapMaybe (\ (i, b) -> (i,) <$> g b) m2 merge m1@((i,a):m1') m2@((j,b):m2') = case compare i j of LT -> mcons ((i,) <$> f a) $ merge m1' m2 GT -> mcons ((j,) <$> g b) $ merge m1 m2' EQ -> mcons ((i,) <$> h a b) $ merge m1' m2' -- | Instance of 'zipAssocWith' which keeps longer assoc lists. -- @O(n1 + n2)@. unionAssocWith :: (Ord i) => (a -> Maybe c) -- ^ Element only present in left map. -> (b -> Maybe c) -- ^ Element only present in right map. -> (a -> b -> Maybe c) -- ^ Element present in both maps. -> [(i,a)] -> [(i,b)] -> [(i,c)] unionAssocWith f g h = zipAssocWith (map_ f) (map_ g) f g h where map_ f = mapMaybe (\ (i, a) -> (i,) <$> f a) -- | General pointwise combination function for sparse matrices. -- @O(n1 + n2)@. zipMatrices :: forall a b c i . (Ord i) => (a -> c) -- ^ Element only present in left matrix. -> (b -> c) -- ^ Element only present in right matrix. -> (a -> b -> c) -- ^ Element present in both matrices. -> (c -> Bool) -- ^ Result counts as zero? -> Matrix i a -> Matrix i b -> Matrix i c zipMatrices f g h zero m1 m2 = Matrix (supSize m1 m2) $ unionAssocWith (drop0 . f) (drop0 . g) (\ a -> drop0 . h a) (unM m1) (unM m2) where drop0 = filterMaybe (not . zero) -- | @'add' (+) m1 m2@ adds @m1@ and @m2@, using @(+)@ to add values. -- @O(n1 + n2)@. -- -- Returns a matrix of size @'supSize' m1 m2@. add :: (Ord i, HasZero a) => (a -> a -> a) -> Matrix i a -> Matrix i a -> Matrix i a add plus = zipMatrices id id plus (== zeroElement) -- | @'intersectWith' f m1 m2@ build the pointwise conjunction @m1@ and @m2@. -- Uses @f@ to combine non-zero values. -- @O(n1 + n2)@. -- -- Returns a matrix of size @infSize m1 m2@. intersectWith :: (Ord i) => (a -> a -> a) -> Matrix i a -> Matrix i a -> Matrix i a intersectWith f m1 m2 = Matrix (infSize m1 m2) $ interAssocWith f (unM m1) (unM m2) -- | Association list intersection. -- @O(n1 + n2)@. -- -- @interAssocWith f l l' = { (i, f a b) | (i,a) ∈ l and (i,b) ∈ l' }@ -- -- Used to combine sparse matrices, it might introduce zero elements -- if @f@ can return zero for non-zero arguments. interAssocWith :: (Ord i) => (a -> a -> a) -> [(i,a)] -> [(i,a)] -> [(i,a)] interAssocWith f [] m = [] interAssocWith f l [] = [] interAssocWith f l@((i,a):l') m@((j,b):m') | i < j = interAssocWith f l' m | i > j = interAssocWith f l m' | otherwise = (i, f a b) : interAssocWith f l' m' interAssocWith2 :: (Ord i, HasZero a) => (a -> a -> a) -> [(i,a)] -> [(i,a)] -> [(i,a)] interAssocWith2 f = zipAssocWith (const []) (const []) (const Nothing) (const Nothing) (\ a -> Just . f a) prop_interAssocWith_correct2 :: [(Int,Int)] -> [(Int,Int)] -> Bool prop_interAssocWith_correct2 xs ys = interAssocWith (*) xs ys == interAssocWith2 (*) xs ys where l = List.sortBy (compare `on` fst) xs l' = List.sortBy (compare `on` fst) ys -- | @'mul' semiring m1 m2@ multiplies matrices @m1@ and @m2@. -- Uses the operations of the semiring @semiring@ to perform the -- multiplication. -- -- @O(n1 + n2 log n2 + Σ(i <= r1) Σ(j <= c2) d(i,j))@ where -- @r1@ is the number of non-empty rows in @m1@ and -- @c2@ is the number of non-empty columns in @m2@ and -- @d(i,j)@ is the bigger one of the following two quantifies: -- the length of sparse row @i@ in @m1@ and -- the length of sparse column @j@ in @m2@. -- -- Given dimensions @m1 : r1 × c1@ and @m2 : r2 × c2@, -- a matrix of size @r1 × c2@ is returned. -- It is not necessary that @c1 == r2@, the matrices are implicitly -- patched with zeros to match up for multiplication. -- For sparse matrices, this patching is a no-op. mul :: (Enum i, Num i, Ix i, Eq a) => Semiring a -> Matrix i a -> Matrix i a -> Matrix i a mul semiring m1 m2 = Matrix (Size { rows = rows (size m1), cols = cols (size m2) }) $ [ (MIx i j, b) | (i,v) <- toSparseRows m1 , (j,w) <- toSparseRows $ transpose m2 , let b = inner v w , b /= zero ] where zero = Semiring.zero semiring plus = Semiring.add semiring times = Semiring.mul semiring inner v w = List.foldl' plus zero $ map snd $ interAssocWith times v w -- | Pointwise comparison. -- Only matrices with the same dimension are comparable. instance (Ord i, PartialOrd a) => PartialOrd (Matrix i a) where comparable m n | size m /= size n = POAny | otherwise = Fold.fold $ zipMatrices onlym onlyn both trivial m n where -- If an element is only in @m@, then its 'Unknown' in @n@ -- so it gotten better at best, in any case, not worse. onlym o = POGT -- If an element is only in @n@, then its 'Unknown' in @m@ -- so we have strictly less information. onlyn o = POLT both = comparable -- The zero element of the result sparse matrix is the -- neutral element of the monoid. trivial = (==mempty) ------------------------------------------------------------------------ -- Modifying matrices -- | @'addColumn' x m@ adds a new column to @m@, after the columns -- already existing in the matrix. All elements in the new column get -- set to @x@. addColumn :: (Num i, HasZero b) => b -> Matrix i b -> Matrix i b addColumn x m | x == zeroElement = m { size = (size m) { cols = cols (size m) + 1 }} | otherwise = __IMPOSSIBLE__ prop_addColumn :: TM -> Bool prop_addColumn m = matrixInvariant m' && map init (toLists m') == toLists m where m' = addColumn zeroElement m -- | @'addRow' x m@ adds a new row to @m@, after the rows already -- existing in the matrix. All elements in the new row get set to @x@. addRow :: (Num i, HasZero b) => b -> Matrix i b -> Matrix i b addRow x m | x == zeroElement = m { size = (size m) { rows = rows (size m) + 1 }} | otherwise = __IMPOSSIBLE__ prop_addRow :: TM -> Bool prop_addRow m = matrixInvariant m' && init (toLists m') == toLists m where m' = addRow zeroElement m ------------------------------------------------------------------------ -- * Printing ------------------------------------------------------------------------ instance (Integral i, HasZero b, Show i, Show b) => Show (Matrix i b) where showsPrec _ m = showString "Agda.Termination.SparseMatrix.fromLists " . shows (size m) . showString " " . shows (toLists m) instance (Integral i, HasZero b, Pretty b) => Pretty (Matrix i b) where -- pretty = vcat . map (hsep . map pretty) . toLists pretty = vcat . map text . lines . Boxes.render . Boxes.hsep 1 Boxes.right . map ( Boxes.vcat Boxes.right . map ( Boxes.alignHoriz Boxes.right 2 . Boxes.text . render . pretty ) ) . toLists . transpose -- ADAPTED FROM: -- http://www.tedreed.info/programming/2012/06/02/how-to-use-textprettyprintboxes/ -- print_table :: [[String]] -> IO () -- print_table rows = printBox $ hsep 2 left (map (vcat left . map text) (transpose rows)) ------------------------------------------------------------------------ -- * Generators, properties and tests ------------------------------------------------------------------------ -- ** Size ------------------------------------------------------------------------ instance (Arbitrary i, Integral i) => Arbitrary (Size i) where arbitrary = do r <- natural c <- natural return $ Size { rows = fromInteger r, cols = fromInteger c } instance CoArbitrary i => CoArbitrary (Size i) where coarbitrary (Size rs cs) = coarbitrary rs . coarbitrary cs -- | Size invariant: dimensions are non-negative. sizeInvariant :: (Ord i, Num i) => Size i -> Bool sizeInvariant sz = rows sz >= 0 && cols sz >= 0 prop_Arbitrary_Size :: Size Integer -> Bool prop_Arbitrary_Size = sizeInvariant prop_size :: TM -> Bool prop_size m = sizeInvariant (size m) -- ** Matrix indices ------------------------------------------------------------------------ instance (Arbitrary i, Integral i) => Arbitrary (MIx i) where arbitrary = MIx <$> positive <*> positive instance CoArbitrary i => CoArbitrary (MIx i) where coarbitrary (MIx r c) = coarbitrary r . coarbitrary c -- | Indices must be positive, @>= 1@. mIxInvariant :: (Ord i, Num i) => MIx i -> Bool mIxInvariant i = row i >= 1 && col i >= 1 prop_Arbitrary_MIx :: MIx Integer -> Bool prop_Arbitrary_MIx = mIxInvariant -- ** Matrices ------------------------------------------------------------------------ -- | Matrix indices are lexicographically sorted with no duplicates. -- All indices must be within bounds. matrixInvariant :: (Num i, Ix i, HasZero b) => Matrix i b -> Bool matrixInvariant (Matrix size@Size{ rows, cols} m) = sizeInvariant size && all inBounds m && all nonZero m && strictlySorted (MIx 0 0) m where inBounds (MIx i j, _) = 1 <= i && i <= rows && 1 <= j && j <= cols nonZero (_, b) = b /= zeroElement -- | Check whether an association list is ordered and -- deterministic, a partial function from @i@ to @b@. strictlySorted :: (Ord i) => i -> [(i, b)] -> Bool strictlySorted i [] = True strictlySorted i ((i', _) : l) = i < i' && strictlySorted i' l -- Ord MIx should be the lexicographic order already (Haskell report). -- | Generates a matrix of the given size, using the given generator -- to generate the rows. matrixUsingRowGen :: (Arbitrary i, Integral i, Arbitrary b, HasZero b) => Size i -> (i -> Gen [b]) -- ^ The generator is parameterised on the size of the row. -> Gen (Matrix i b) matrixUsingRowGen sz rowGen = do rows <- vectorOf (fromIntegral $ rows sz) (rowGen $ cols sz) return $ fromLists sz rows -- | Generates a matrix of the given size. matrix :: (Arbitrary i, Integral i, Arbitrary b, HasZero b) => Size i -> Gen (Matrix i b) matrix sz = matrixUsingRowGen sz (\n -> vectorOf (fromIntegral n) arbitrary) prop_matrix :: Size Int -> Property prop_matrix sz = forAll (matrix sz :: Gen TM) $ \ m -> size m == sz -- | Generate a matrix of arbitrary size. instance (Arbitrary i, Num i, Integral i, Arbitrary b, HasZero b) => Arbitrary (Matrix i b) where arbitrary = matrix =<< arbitrary instance (Show i, Ord i, Integral i, Enum i, Ix i, CoArbitrary b, HasZero b) => CoArbitrary (Matrix i b) where coarbitrary m = coarbitrary (toLists m) -- | This matrix type is used for tests. type TM = Matrix Int Int prop_Arbitrary_Matrix :: TM -> Bool prop_Arbitrary_Matrix = matrixInvariant -- ** Matrix operations -- | 'fromIndexList' is identity on well-formed sparse matrices. prop_fromIndexList :: TM -> Bool prop_fromIndexList m@(Matrix size vs) = fromIndexList size vs == m -- | Converting a matrix to a list of lists and back is the identity. prop_fromLists_toLists :: TM -> Bool prop_fromLists_toLists m = fromLists (size m) (toLists m) == m -- | Any 1x1 matrix is a singleton. prop_isSingleton :: Int -> Bool prop_isSingleton b = Just b == (isSingleton (fromLists (Size 1 1) [[b]] :: TM)) -- | The length of the diagonal is the minimum of the number of -- rows and columns of the matrix. prop_diagonal :: TM -> Bool prop_diagonal m@(Matrix (Size r c) _) = length (diagonal m) == min r c -- prop_diagonal' n = -- forAll natural $ \n -> -- forAll (matrix (Size n n) :: Gen TM) $ \m -> -- length (diagonal m) == n -- | Transposing twice is the identity. prop_transpose :: TM -> Bool prop_transpose m = matrixInvariant m' && m == transpose m' where m' = transpose m -- ** Matrix addition -- | Old implementation of 'zipMatrices'. zipMatrices' :: forall a b c i . (Ord i) => (a -> c) -- ^ Element only present in left matrix. -> (b -> c) -- ^ Element only present in right matrix. -> (a -> b -> c) -- ^ Element present in both matrices. -> (c -> Bool) -- ^ Result counts as zero? -> Matrix i a -> Matrix i b -> Matrix i c zipMatrices' f g h zero m1 m2 = Matrix (supSize m1 m2) (merge (unM m1) (unM m2)) where merge :: [(MIx i,a)] -> [(MIx i,b)] -> [(MIx i,c)] merge [] m2 = filter (not . zero . snd) $ map (mapSnd g) m2 merge m1 [] = filter (not . zero . snd) $ map (mapSnd f) m1 merge m1@((i,a):m1') m2@((j,b):m2') = case compare i j of LT -> if zero c then r else (i,c) : r where c = f a ; r = merge m1' m2 GT -> if zero c then r else (j,c) : r where c = g b ; r = merge m1 m2' EQ -> if zero c then r else (i,c) : r where c = h a b ; r = merge m1' m2' -- | Verify 'zipMatrices' against older implementation prop_zipMatrices_correct :: TM -> TM -> Bool prop_zipMatrices_correct m1 m2 = zipMatrices id id (+) (== 0) m1 m2 == zipMatrices' id id (+) (== 0) m1 m2 -- | Matrix addition is well-defined, associative and commutative. prop_add :: Size Int -> Property prop_add sz = forAll (three (matrix sz :: Gen TM)) $ \(m1, m2, m3) -> let m' = add (+) m1 m2 in associative (add (+)) m1 m2 m3 && commutative (add (+)) m1 m2 && matrixInvariant m' && size m' == size m1 -- | Verify addition against an older implementation. -- -- The older implementation did not fully preserve sparsity, -- i.e., introduced zeros. Thus, we need to convert to lists to -- obtain equal results. prop_add_correct :: TM -> TM -> Bool prop_add_correct m1 m2 = toLists (add (+) m1 m2) == toLists (add' (+) m1 m2) where add' :: (Ord i) => (a -> a -> a) -> Matrix i a -> Matrix i a -> Matrix i a add' plus m1 m2 = Matrix (supSize m1 m2) $ mergeAssocWith plus (unM m1) (unM m2) where mergeAssocWith :: (Ord i) => (a -> a -> a) -> [(i,a)] -> [(i,a)] -> [(i,a)] mergeAssocWith f [] m = m mergeAssocWith f l [] = l mergeAssocWith f l@((i,a):l') m@((j,b):m') | i < j = (i,a) : mergeAssocWith f l' m | i > j = (j,b) : mergeAssocWith f l m' | otherwise = (i, f a b) : mergeAssocWith f l' m' -- ** Matrix multiplication -- | Specification of 'interAssocWith'. interAssocWith' :: (Eq i) => (a -> a -> a) -> [(i,a)] -> [(i,a)] -> [(i,a)] interAssocWith' f l l' = [ (i, f a b) | (i,a) <- l, (j,b) <- l', i == j ] -- | Efficient implementation of 'interAssocWith' matches its specification. prop_interAssocWith_correct :: [(Int,Int)] -> [(Int,Int)] -> Bool prop_interAssocWith_correct xs ys = interAssocWith (*) l l' == interAssocWith' (*) l l' where l = List.sortBy (compare `on` fst) xs l' = List.sortBy (compare `on` fst) ys -- | Matrix multiplication is well-defined and associative. prop_mul :: Size Int -> Property prop_mul sz = mapSize (`div` 2) $ forAll (two natural) $ \(c2, c3) -> forAll (matrix sz :: Gen TM) $ \m1 -> forAll (matrix (Size { rows = cols sz, cols = c2 })) $ \m2 -> forAll (matrix (Size { rows = c2, cols = c3 })) $ \m3 -> let m' = mult m1 m2 in associative mult m1 m2 m3 && matrixInvariant m' && size m' == Size { rows = rows sz, cols = c2 } where mult = mul Semiring.intSemiring ------------------------------------------------------------------------ -- All tests tests :: IO Bool tests = runTests "Agda.Termination.SparseMatrix" [ quickCheck' prop_transpose , quickCheck' prop_Arbitrary_Size , quickCheck' prop_Arbitrary_Matrix , quickCheck' prop_Arbitrary_MIx , quickCheck' prop_fromIndexList , quickCheck' prop_matrix , quickCheck' prop_size , quickCheck' prop_toSparseRows , quickCheck' prop_fromLists_toLists , quickCheck' prop_isSingleton , quickCheck' prop_zipMatrices_correct , quickCheck' prop_add , quickCheck' prop_add_correct , quickCheck' prop_mul , quickCheck' prop_diagonal , quickCheck' prop_addColumn , quickCheck' prop_addRow ] Agda-2.4.2.5/src/full/Agda/TypeChecking/0000755000000000000000000000000012635075266015662 5ustar0000000000000000Agda-2.4.2.5/src/full/Agda/TypeChecking/CompiledClause.hs0000644000000000000000000001156612635075266021120 0ustar0000000000000000{-# LANGUAGE CPP #-} {-# LANGUAGE DeriveDataTypeable #-} {-# LANGUAGE DeriveFoldable #-} {-# LANGUAGE DeriveFunctor #-} {-# LANGUAGE DeriveTraversable #-} -- | Case trees. -- -- After coverage checking, pattern matching is translated -- to case trees, i.e., a tree of successive case splits -- on one variable at a time. module Agda.TypeChecking.CompiledClause where import Prelude hiding (null) import qualified Data.Map as Map import Data.Map (Map) import Data.Monoid import Data.Typeable (Typeable) import Data.Foldable (Foldable, foldMap) import Data.Traversable (Traversable) import Agda.Syntax.Internal import Agda.Syntax.Literal import Agda.Syntax.Position import Agda.Utils.Maybe import Agda.Utils.Null import Agda.Utils.Pretty #include "undefined.h" import Agda.Utils.Impossible data WithArity c = WithArity { arity :: Int, content :: c } deriving (Typeable, Functor, Foldable, Traversable) -- | Branches in a case tree. data Case c = Branches { projPatterns :: Bool -- ^ We are constructing a record here (copatterns). -- 'conBranches' lists projections. , conBranches :: Map QName (WithArity c) -- ^ Map from constructor (or projection) names to their arity -- and the case subtree. (Projections have arity 0.) , litBranches :: Map Literal c -- ^ Map from literal to case subtree. , catchAllBranch :: Maybe c -- ^ (Possibly additional) catch-all clause. } deriving (Typeable, Functor, Foldable, Traversable) -- | Case tree with bodies. data CompiledClauses = Case Int (Case CompiledClauses) -- ^ @Case n bs@ stands for a match on the @n@-th argument -- (counting from zero) with @bs@ as the case branches. -- If the @n@-th argument is a projection, we have only 'conBranches' -- with arity 0. | Done [Arg ArgName] Term -- ^ @Done xs b@ stands for the body @b@ where the @xs@ contains hiding -- and name suggestions for the free variables. This is needed to build -- lambdas on the right hand side for partial applications which can -- still reduce. | Fail -- ^ Absurd case. deriving (Typeable) litCase :: Literal -> c -> Case c litCase l x = Branches False Map.empty (Map.singleton l x) Nothing conCase :: QName -> WithArity c -> Case c conCase c x = Branches False (Map.singleton c x) Map.empty Nothing projCase :: QName -> c -> Case c projCase c x = Branches True (Map.singleton c $ WithArity 0 x) Map.empty Nothing catchAll :: c -> Case c catchAll x = Branches False Map.empty Map.empty (Just x) -- | Check whether a case tree has a catch-all clause. hasCatchAll :: CompiledClauses -> Bool hasCatchAll = getAny . loop where loop cc = case cc of Fail{} -> mempty Done{} -> mempty Case _ br -> maybe (foldMap loop br) (const $ Any True) $ catchAllBranch br instance Monoid c => Monoid (WithArity c) where mempty = WithArity __IMPOSSIBLE__ mempty mappend (WithArity n1 c1) (WithArity n2 c2) | n1 == n2 = WithArity n1 $ mappend c1 c2 | otherwise = __IMPOSSIBLE__ -- arity must match! instance Monoid m => Monoid (Case m) where mempty = empty mappend (Branches cop cs ls m) (Branches cop' cs' ls' m') = Branches (cop || cop') -- for @projCase <> mempty@ (Map.unionWith mappend cs cs') (Map.unionWith mappend ls ls') (mappend m m') instance Null (Case m) where empty = Branches False Map.empty Map.empty Nothing null (Branches _cop cs ls mcatch) = null cs && null ls && null mcatch -- * Pretty instances. instance Pretty a => Show (Case a) where show = show . pretty instance Show CompiledClauses where show = show . pretty instance Pretty a => Pretty (WithArity a) where pretty = pretty . content instance Pretty a => Pretty (Case a) where prettyPrec p (Branches _cop cs ls m) = mparens (p > 0) $ vcat $ prettyMap cs ++ prettyMap ls ++ prC m where prC Nothing = [] prC (Just x) = [text "_ ->" <+> pretty x] prettyMap :: (Show k, Pretty v) => Map k v -> [Doc] prettyMap m = [ sep [ text (show x ++ " ->") , nest 2 $ pretty v ] | (x, v) <- Map.toList m ] instance Pretty CompiledClauses where pretty (Done hs t) = text ("done" ++ show hs) <+> pretty t pretty Fail = text "fail" pretty (Case n bs) | projPatterns bs = sep [ text "record" , nest 2 $ pretty bs ] pretty (Case n bs) = sep [ text ("case " ++ show n ++ " of") , nest 2 $ pretty bs ] -- * KillRange instances. instance KillRange c => KillRange (WithArity c) where killRange = fmap killRange instance KillRange c => KillRange (Case c) where killRange (Branches cop con lit all) = Branches cop (killRangeMap con) (killRangeMap lit) (killRange all) instance KillRange CompiledClauses where killRange (Case i br) = killRange2 Case i br killRange (Done xs v) = killRange2 Done xs v killRange Fail = Fail Agda-2.4.2.5/src/full/Agda/TypeChecking/SyntacticEquality.hs0000644000000000000000000001641112635075266021700 0ustar0000000000000000{-# LANGUAGE CPP #-} {-# LANGUAGE FlexibleContexts #-} {-# LANGUAGE FlexibleInstances #-} {-# LANGUAGE PatternGuards #-} {-# LANGUAGE TupleSections #-} -- | A syntactic equality check that takes meta instantiations into account, -- but does not reduce. It replaces -- @ -- (v, v') <- instantiateFull (v, v') -- v == v' -- @ -- by a more efficient routine which only traverses and instantiates the terms -- as long as they are equal. module Agda.TypeChecking.SyntacticEquality (SynEq, checkSyntacticEquality) where import Prelude hiding (mapM) import Control.Applicative hiding ((<**>)) import Control.Arrow ((***)) import Control.Monad.State hiding (mapM) import qualified Agda.Syntax.Common as Common import Agda.Syntax.Internal import Agda.TypeChecking.Monad import Agda.TypeChecking.Reduce (instantiate) import Agda.TypeChecking.Substitute import Agda.Utils.Monad (ifM) #include "undefined.h" import Agda.Utils.Impossible -- | Syntactic equality check for terms. -- @ -- checkSyntacticEquality v v' = do -- (v,v') <- instantiateFull (v,v') -- return ((v,v'), v==v') -- @ -- only that @v,v'@ are only fully instantiated to the depth -- where they are equal. {-# SPECIALIZE checkSyntacticEquality :: Term -> Term -> TCM ((Term, Term), Bool) #-} {-# SPECIALIZE checkSyntacticEquality :: Type -> Type -> TCM ((Type, Type), Bool) #-} checkSyntacticEquality :: (SynEq a) => a -> a -> TCM ((a, a), Bool) checkSyntacticEquality v v' = synEq v v' `runStateT` True -- | Monad for checking syntactic equality type SynEqM = StateT Bool TCM -- | Return, flagging inequalty. inequal :: a -> SynEqM a inequal a = put False >> return a -- | If inequality is flagged, return, else continue. ifEqual :: (a -> SynEqM a) -> (a -> SynEqM a) ifEqual cont a = ifM get (cont a) (return a) -- Since List2 is only Applicative, not a monad, I cannot -- define a List2T monad transformer, so we do it manually: (<$$>) :: Functor f => (a -> b) -> f (a,a) -> f (b,b) f <$$> xx = (f *** f) <$> xx pure2 :: Applicative f => a -> f (a,a) pure2 a = pure (a,a) (<**>) :: Applicative f => f (a -> b, a -> b) -> f (a,a) -> f (b,b) ff <**> xx = pure (uncurry (***)) <*> ff <*> xx {- updateSharedM2 :: Monad m => (Term -> Term -> m (Term, Term)) -> Term -> Term -> m (Term, Term) updateSharedM2 f v0@(Shared p) = do v <- f (derefPtr p) case derefPtr (setPtr v p) of Var _ [] -> return v _ -> compressPointerChain v0 `pseq` return v0 updateSharedM2 f v = f v updateSharedTerm2 :: MonadTCM tcm => (Term -> Term -> tcm (Term, Term)) -> Term -> Term -> tcm (Term, Term) updateSharedTerm f v v' = ifM (liftTCM $ asks envAllowDestructiveUpdate) (updateSharedM2 f v v') (f (ignoreSharing v) (ignoreSharing v')) -} -- | Instantiate full as long as things are equal class SynEq a where synEq :: a -> a -> SynEqM (a,a) synEq' :: a -> a -> SynEqM (a,a) synEq' a a' = ifEqual (uncurry synEq) (a, a') -- | Syntactic term equality ignores 'DontCare' stuff. instance SynEq Term where synEq v v' = do (v, v') <- lift $ instantiate (v, v') -- currently destroys sharing -- TODO: preserve sharing! case (ignoreSharing v, ignoreSharing v') of (Var i vs, Var i' vs') | i == i' -> Var i <$$> synEq vs vs' (Con c vs, Con c' vs') | c == c' -> Con c <$$> synEq vs vs' (Def f vs, Def f' vs') | f == f' -> Def f <$$> synEq vs vs' (MetaV x vs, MetaV x' vs') | x == x' -> MetaV x <$$> synEq vs vs' (Lit l , Lit l' ) | l == l' -> pure2 $ v (Lam h b , Lam h' b' ) | h == h' -> Lam h <$$> synEq b b' (Level l , Level l' ) -> levelTm <$$> synEq l l' (Sort s , Sort s' ) -> sortTm <$$> synEq s s' (Pi a b , Pi a' b' ) -> Pi <$$> synEq a a' <**> synEq' b b' (DontCare _, DontCare _ ) -> pure (v, v') -- Irrelevant things are syntactically equal. ALT: -- DontCare <$$> synEq v v' (Shared{} , _ ) -> __IMPOSSIBLE__ (_ , Shared{} ) -> __IMPOSSIBLE__ _ -> inequal (v, v') instance SynEq Level where synEq (Max vs) (Max vs') = levelMax <$$> synEq vs vs' instance SynEq PlusLevel where synEq l l' = do case (l, l') of (ClosedLevel v, ClosedLevel v') | v == v' -> pure2 l (Plus n v, Plus n' v') | n == n' -> Plus n <$$> synEq v v' _ -> inequal (l, l') instance SynEq LevelAtom where synEq l l' = do l <- lift (unBlock =<< instantiate l) case (l, l') of (MetaLevel m vs , MetaLevel m' vs' ) | m == m' -> MetaLevel m <$$> synEq vs vs' (UnreducedLevel v, UnreducedLevel v' ) -> UnreducedLevel <$$> synEq v v' -- The reason for being blocked should not matter for equality. (NeutralLevel r v, NeutralLevel r' v') -> NeutralLevel r <$$> synEq v v' (BlockedLevel m v, BlockedLevel m' v') -> BlockedLevel m <$$> synEq v v' _ -> inequal (l, l') where unBlock l = case l of BlockedLevel m v -> ifM (isInstantiatedMeta m) (pure $ UnreducedLevel v) (pure l) _ -> pure l instance SynEq Sort where synEq s s' = do (s, s') <- lift $ instantiate (s, s') case (s, s') of (Type l , Type l' ) -> levelSort <$$> synEq l l' (DLub a b, DLub a' b') -> dLub <$$> synEq a a' <**> synEq' b b' (Prop , Prop ) -> pure2 s (Inf , Inf ) -> pure2 s _ -> inequal (s, s') -- | Syntactic equality ignores sorts. instance SynEq Type where synEq (El s t) (El s' t') = (El s *** El s') <$> synEq t t' instance SynEq a => SynEq [a] where synEq as as' | length as == length as' = unzip <$> zipWithM synEq' as as' | otherwise = inequal (as, as') instance SynEq a => SynEq (Elim' a) where synEq e e' = case (e, e') of (Proj f , Proj f' ) | f == f' -> pure2 e (Apply a, Apply a') -> Apply <$$> synEq a a' _ -> inequal (e, e') instance (Subst a, SynEq a) => SynEq (Abs a) where synEq a a' = case (a, a') of (NoAbs x b, NoAbs x' b') -> (NoAbs x *** NoAbs x') <$> synEq b b' (Abs x b, Abs x' b') -> (Abs x *** Abs x') <$> synEq b b' (Abs x b, NoAbs x' b') -> Abs x <$$> synEq b (raise 1 b') -- TODO: mkAbs? (NoAbs x b, Abs x' b') -> Abs x' <$$> synEq (raise 1 b) b' {- TRIGGERS test/fail/UnequalHiding -- | Ignores 'ArgInfo'. instance SynEq a => SynEq (Common.Arg c a) where synEq (Common.Arg ai a) (Common.Arg ai' a') = (Common.Arg ai *** Common.Arg ai') <$> synEq a a' -- | Ignores 'ArgInfo'. instance SynEq a => SynEq (Common.Dom c a) where synEq (Common.Dom ai a) (Common.Dom ai' a') = (Common.Dom ai *** Common.Dom ai') <$> synEq a a' -} instance (SynEq a, SynEq c) => SynEq (Common.Arg c a) where synEq (Common.Arg ai a) (Common.Arg ai' a') = Common.Arg <$$> synEq ai ai' <**> synEq a a' instance (SynEq a, SynEq c) => SynEq (Common.Dom c a) where synEq (Common.Dom ai a) (Common.Dom ai' a') = Common.Dom <$$> synEq ai ai' <**> synEq a a' instance (SynEq c) => SynEq (Common.ArgInfo c) where synEq ai@(Common.ArgInfo h r c) ai'@(Common.ArgInfo h' r' c') | h == h', r == r' = Common.ArgInfo h r <$$> synEq c c' | otherwise = inequal (ai, ai') Agda-2.4.2.5/src/full/Agda/TypeChecking/Abstract.hs0000644000000000000000000001032512635075266017762 0ustar0000000000000000{-# LANGUAGE CPP #-} {-# LANGUAGE FlexibleInstances #-} {-# LANGUAGE PatternGuards #-} -- | Functions for abstracting terms over other terms. module Agda.TypeChecking.Abstract where import Control.Monad import Data.Function import Agda.Syntax.Common hiding (Arg, Dom, NamedArg) import qualified Agda.Syntax.Common as Common import Agda.Syntax.Internal import Agda.TypeChecking.Substitute import Agda.Utils.List (splitExactlyAt) import Agda.Utils.Impossible #include "undefined.h" piAbstractTerm :: Term -> Type -> Type -> Type piAbstractTerm v a b = fun a (abstractTerm v b) where fun a b = El s $ Pi (defaultDom a) $ mkAbs "w" b where s = (sLub `on` getSort) a b -- | @isPrefixOf u v = Just es@ if @v == u `applyE` es@. class IsPrefixOf a where isPrefixOf :: a -> a -> Maybe Elims instance IsPrefixOf Elims where isPrefixOf us vs = do (vs1, vs2) <- splitExactlyAt (length us) vs guard $ us == vs1 return vs2 instance IsPrefixOf Args where isPrefixOf us vs = do (vs1, vs2) <- splitExactlyAt (length us) vs guard $ us == vs1 return $ map Apply vs2 instance IsPrefixOf Term where isPrefixOf u v = case (ignoreSharing u, ignoreSharing v) of (Var i us, Var j vs) | i == j -> us `isPrefixOf` vs (Def f us, Def g vs) | f == g -> us `isPrefixOf` vs (Con c us, Con d vs) | c == d -> us `isPrefixOf` vs (MetaV x us, MetaV y vs) | x == y -> us `isPrefixOf` vs (u, v) -> guard (u == v) >> return [] class AbstractTerm a where -- | @subst u . abstractTerm u == id@ abstractTerm :: Term -> a -> a instance AbstractTerm Term where abstractTerm u v | Just es <- u `isPrefixOf` v = Var 0 $ absT es | otherwise = case v of -- Andreas, 2013-10-20: the original impl. works only at base types -- v | u == v -> Var 0 [] -- incomplete see succeed/WithOfFunctionType Var i vs -> Var (i + 1) $ absT vs Lam h b -> Lam h $ absT b Def c vs -> Def c $ absT vs Con c vs -> Con c $ absT vs Pi a b -> uncurry Pi $ absT (a, b) Lit l -> Lit l Level l -> Level $ absT l Sort s -> Sort $ absT s MetaV m vs -> MetaV m $ absT vs DontCare mv -> DontCare $ absT mv Shared p -> Shared $ absT p ExtLam{} -> __IMPOSSIBLE__ where absT x = abstractTerm u x instance AbstractTerm a => AbstractTerm (Ptr a) where abstractTerm u = fmap (abstractTerm u) instance AbstractTerm Type where abstractTerm u (El s v) = El (abstractTerm u s) (abstractTerm u v) instance AbstractTerm Sort where abstractTerm u s = case s of Type n -> Type $ absS n Prop -> Prop Inf -> Inf SizeUniv -> SizeUniv DLub s1 s2 -> DLub (absS s1) (absS s2) where absS x = abstractTerm u x instance AbstractTerm Level where abstractTerm u (Max as) = Max $ abstractTerm u as instance AbstractTerm PlusLevel where abstractTerm u l@ClosedLevel{} = l abstractTerm u (Plus n l) = Plus n $ abstractTerm u l instance AbstractTerm LevelAtom where abstractTerm u l = case l of MetaLevel m vs -> MetaLevel m $ abstractTerm u vs NeutralLevel r v -> NeutralLevel r $ abstractTerm u v BlockedLevel _ v -> UnreducedLevel $ abstractTerm u v -- abstracting might remove the blockage UnreducedLevel v -> UnreducedLevel $ abstractTerm u v instance AbstractTerm a => AbstractTerm (Elim' a) where abstractTerm = fmap . abstractTerm instance AbstractTerm a => AbstractTerm (Arg a) where abstractTerm = fmap . abstractTerm instance AbstractTerm a => AbstractTerm (Dom a) where abstractTerm = fmap . abstractTerm instance AbstractTerm a => AbstractTerm [a] where abstractTerm = fmap . abstractTerm instance AbstractTerm a => AbstractTerm (Maybe a) where abstractTerm = fmap . abstractTerm instance (Subst a, AbstractTerm a) => AbstractTerm (Abs a) where abstractTerm u (NoAbs x v) = NoAbs x $ abstractTerm u v abstractTerm u (Abs x v) = Abs x $ applySubst swap $ abstractTerm (raise 1 u) v where -- This swaps var 0 and var 1 (we hope) swap = var 1 :# liftS 1 (raiseS 1) instance (AbstractTerm a, AbstractTerm b) => AbstractTerm (a, b) where abstractTerm u (x, y) = (abstractTerm u x, abstractTerm u y) Agda-2.4.2.5/src/full/Agda/TypeChecking/Telescope.hs0000644000000000000000000002202412635075266020141 0ustar0000000000000000{-# LANGUAGE CPP #-} #if __GLASGOW_HASKELL__ >= 710 {-# LANGUAGE FlexibleContexts #-} #endif module Agda.TypeChecking.Telescope where import Control.Applicative import Control.Monad (forM_, unless) import Data.List import Agda.Syntax.Common hiding (Arg, Dom, NamedArg, ArgInfo) import qualified Agda.Syntax.Common as Common import Agda.Syntax.Internal import Agda.TypeChecking.Monad import Agda.TypeChecking.Reduce import Agda.TypeChecking.Substitute import Agda.TypeChecking.Free import Agda.Utils.List import Agda.Utils.Permutation import Agda.Utils.Size import Agda.Utils.Tuple import Agda.Utils.VarSet (VarSet) import qualified Agda.Utils.VarSet as VarSet #include "undefined.h" import Agda.Utils.Impossible data OutputTypeName = OutputTypeName QName | OutputTypeNameNotYetKnown | NoOutputTypeName -- | Strips all Pi's and return the head definition name, if possible. getOutputTypeName :: Type -> TCM OutputTypeName getOutputTypeName t = do TelV tel t' <- telView t ifBlocked (unEl t') (\ _ _ -> return OutputTypeNameNotYetKnown) $ \ v -> case ignoreSharing v of -- Possible base types: Def n _ -> return $ OutputTypeName n Sort{} -> return NoOutputTypeName Var{} -> return NoOutputTypeName -- Not base types: Con{} -> __IMPOSSIBLE__ ExtLam{} -> __IMPOSSIBLE__ Lam{} -> __IMPOSSIBLE__ Lit{} -> __IMPOSSIBLE__ Level{} -> __IMPOSSIBLE__ MetaV{} -> __IMPOSSIBLE__ Pi{} -> __IMPOSSIBLE__ Shared{} -> __IMPOSSIBLE__ DontCare{} -> __IMPOSSIBLE__ -- | The permutation should permute the corresponding telescope. (left-to-right list) renameP :: Subst t => Permutation -> t -> t renameP p = applySubst (renaming p) -- | If @permute π : [a]Γ -> [a]Δ@, then @applySubst (renaming π) : Term Γ -> Term Δ@ renaming :: Permutation -> Substitution renaming p = prependS __IMPOSSIBLE__ gamma $ raiseS $ size p where gamma = inversePermute p var -- gamma = safePermute (invertP (-1) p) $ map var [0..] -- | If @permute π : [a]Γ -> [a]Δ@, then @applySubst (renamingR π) : Term Δ -> Term Γ@ renamingR :: Permutation -> Substitution renamingR p@(Perm n _) = permute (reverseP p) (map var [0..]) ++# raiseS n -- | Flatten telescope: (Γ : Tel) -> [Type Γ] flattenTel :: Telescope -> [Dom Type] flattenTel EmptyTel = [] flattenTel (ExtendTel a tel) = raise (size tel + 1) a : flattenTel (absBody tel) -- | Order a flattened telescope in the correct dependeny order: Γ -> -- Permutation (Γ -> Γ~) -- -- Since @reorderTel tel@ uses free variable analysis of type in @tel@, -- the telescope should be 'normalise'd. reorderTel :: [Dom Type] -> Maybe Permutation reorderTel tel = topoSort comesBefore tel' where tel' = zip (downFrom $ size tel) tel (i, _) `comesBefore` (_, a) = i `freeIn` unEl (unDom a) -- a tiny bit unsafe reorderTel_ :: [Dom Type] -> Permutation reorderTel_ tel = case reorderTel tel of Nothing -> __IMPOSSIBLE__ Just p -> p -- | Unflatten: turns a flattened telescope into a proper telescope. Must be -- properly ordered. unflattenTel :: [ArgName] -> [Dom Type] -> Telescope unflattenTel [] [] = EmptyTel unflattenTel (x : xs) (a : tel) = ExtendTel a' (Abs x tel') where tel' = unflattenTel xs tel a' = applySubst rho a rho = parallelS (replicate (size tel + 1) __IMPOSSIBLE_TERM__) unflattenTel [] (_ : _) = __IMPOSSIBLE__ unflattenTel (_ : _) [] = __IMPOSSIBLE__ -- | Get the suggested names from a telescope teleNames :: Telescope -> [ArgName] teleNames = map (fst . unDom) . telToList teleArgNames :: Telescope -> [Arg ArgName] teleArgNames = map (argFromDom . fmap fst) . telToList teleArgs :: Telescope -> Args teleArgs tel = [ Common.Arg info (var i) | (i, Common.Dom info _) <- zip (downFrom $ size l) l ] where l = telToList tel -- | A telescope split in two. data SplitTel = SplitTel { firstPart :: Telescope , secondPart :: Telescope , splitPerm :: Permutation -- ^ The permutation takes us from the original telescope to -- @firstPart ++ secondPart@. } -- | Split a telescope into the part that defines the given variables and the -- part that doesn't. -- -- See 'Agda.TypeChecking.Tests.prop_splitTelescope'. splitTelescope :: VarSet -- ^ A set of de Bruijn indices. -> Telescope -- ^ Original telescope. -> SplitTel -- ^ @firstPart@ mentions the given variables, @secondPart@ not. splitTelescope fv tel = SplitTel tel1 tel2 perm where names = teleNames tel ts0 = flattenTel tel n = size tel -- We start with a rough split into fv and the rest. This will most likely -- not be correct so we patch it up later with reorderTel. -- Convert given de Bruijn indices into ascending list of de Bruijn levels. is = map (n - 1 -) $ dropWhile (>= n) $ VarSet.toDescList fv -- Compute the complement (de Bruijn levels not mentioned in @fv@). isC = [0..n - 1] \\ is perm0 = Perm n $ is ++ isC permuteTel p ts = renameP (reverseP p) (permute p ts) ts1 = permuteTel perm0 ts0 perm1 = reorderTel_ ts1 ts2 = permuteTel perm1 ts1 perm = composeP perm1 perm0 tel' = unflattenTel (permute perm names) ts2 m = length $ takeWhile (`notElem` is) $ reverse $ permPicks perm (tel1, tel2) = telFromList -*- telFromList $ splitAt (n - m) $ telToList tel' telView :: Type -> TCM TelView telView = telViewUpTo (-1) -- | @telViewUpTo n t@ takes off the first @n@ function types of @t@. -- Takes off all if @n < 0@. telViewUpTo :: Int -> Type -> TCM TelView telViewUpTo n t = telViewUpTo' n (const True) t -- | @telViewUpTo' n p t@ takes off $t$ -- the first @n@ (or arbitrary many if @n < 0@) function domains -- as long as they satify @p@. telViewUpTo' :: Int -> (Dom Type -> Bool) -> Type -> TCM TelView telViewUpTo' 0 p t = return $ TelV EmptyTel t telViewUpTo' n p t = do t <- reduce t case ignoreSharing $ unEl t of Pi a b | p a -> absV a (absName b) <$> telViewUpTo' (n - 1) p (absBody b) _ -> return $ TelV EmptyTel t where absV a x (TelV tel t) = TelV (ExtendTel a (Abs x tel)) t -- | Decomposing a function type. mustBePi :: MonadTCM tcm => Type -> tcm (Dom Type, Abs Type) mustBePi t = ifNotPiType t __IMPOSSIBLE__ $ \ a b -> return (a,b) -- | If the given type is a @Pi@, pass its parts to the first continuation. -- If not (or blocked), pass the reduced type to the second continuation. ifPi :: MonadTCM tcm => Term -> (Dom Type -> Abs Type -> tcm a) -> (Term -> tcm a) -> tcm a ifPi t yes no = do t <- liftTCM $ reduce t case ignoreSharing t of Pi a b -> yes a b _ -> no t -- | If the given type is a @Pi@, pass its parts to the first continuation. -- If not (or blocked), pass the reduced type to the second continuation. ifPiType :: MonadTCM tcm => Type -> (Dom Type -> Abs Type -> tcm a) -> (Type -> tcm a) -> tcm a ifPiType (El s t) yes no = ifPi t yes (no . El s) -- | If the given type is blocked or not a @Pi@, pass it reduced to the first continuation. -- If it is a @Pi@, pass its parts to the second continuation. ifNotPi :: MonadTCM tcm => Term -> (Term -> tcm a) -> (Dom Type -> Abs Type -> tcm a) -> tcm a ifNotPi = flip . ifPi -- | If the given type is blocked or not a @Pi@, pass it reduced to the first continuation. -- If it is a @Pi@, pass its parts to the second continuation. ifNotPiType :: MonadTCM tcm => Type -> (Type -> tcm a) -> (Dom Type -> Abs Type -> tcm a) -> tcm a ifNotPiType = flip . ifPiType -- | A safe variant of piApply. piApplyM :: Type -> Args -> TCM Type piApplyM t [] = return t piApplyM t (arg : args) = do (_, b) <- mustBePi t absApp b (unArg arg) `piApplyM` args piApply1 :: MonadTCM tcm => Type -> Term -> tcm Type piApply1 t v = do (_, b) <- mustBePi t return $ absApp b v -- | Given a function type, introduce its domain into -- the context and continue with its codomain. intro1 :: (MonadTCM tcm) => Type -> (Type -> tcm a) -> tcm a intro1 t cont = do (a, b) <- mustBePi t underAbstraction a b cont --------------------------------------------------------------------------- -- * Instance definitions --------------------------------------------------------------------------- addTypedInstance :: QName -> Type -> TCM () addTypedInstance x t = do n <- getOutputTypeName t case n of OutputTypeName n -> addNamedInstance x n OutputTypeNameNotYetKnown -> addUnknownInstance x NoOutputTypeName -> typeError $ GenericError $ "Terms marked as eligible for instance search should end with a name" resolveUnknownInstanceDefs :: TCM () resolveUnknownInstanceDefs = do anonInstanceDefs <- getAnonInstanceDefs clearAnonInstanceDefs forM_ anonInstanceDefs $ \ n -> addTypedInstance n =<< typeOfConst n -- | Try to solve the instance definitions whose type is not yet known, report -- an error if it doesn't work and return the instance table otherwise. getInstanceDefs :: TCM InstanceTable getInstanceDefs = do resolveUnknownInstanceDefs insts <- getAllInstanceDefs unless (null $ snd insts) $ typeError $ GenericError $ "There are instances whose type is still unsolved" return $ fst insts Agda-2.4.2.5/src/full/Agda/TypeChecking/Quote.hs0000644000000000000000000002055512635075266017322 0ustar0000000000000000{-# LANGUAGE CPP #-} {-# LANGUAGE FlexibleInstances #-} {-# LANGUAGE PatternGuards #-} module Agda.TypeChecking.Quote where import Control.Applicative import Control.Monad.State (evalState, get, put) import Control.Monad.Writer (execWriterT, tell) import Control.Monad.Trans (lift) import Data.Char import Data.Maybe (fromMaybe) import Data.Traversable (traverse) import Agda.Syntax.Common import Agda.Syntax.Internal as I import Agda.Syntax.Literal import Agda.Syntax.Position import Agda.Syntax.Translation.InternalToAbstract import Agda.TypeChecking.CompiledClause import Agda.TypeChecking.Datatypes ( getConHead ) import Agda.TypeChecking.DropArgs import Agda.TypeChecking.Free import Agda.TypeChecking.Level import Agda.TypeChecking.Monad import Agda.TypeChecking.Monad.Builtin import Agda.TypeChecking.Monad.Exception import Agda.TypeChecking.Pretty import Agda.TypeChecking.Reduce import Agda.TypeChecking.Reduce.Monad import Agda.TypeChecking.Substitute import Agda.Utils.Except import Agda.Utils.Impossible import Agda.Utils.Monad ( ifM ) import Agda.Utils.Permutation ( Permutation(Perm) ) import Agda.Utils.String ( Str(Str), unStr ) import Agda.Utils.VarSet (VarSet) import qualified Agda.Utils.VarSet as Set #include "undefined.h" data QuotingKit = QuotingKit { quoteTermWithKit :: Term -> ReduceM Term , quoteTypeWithKit :: Type -> ReduceM Term , quoteClauseWithKit :: Clause -> ReduceM Term , quoteDomWithKit :: I.Dom Type -> ReduceM Term } quotingKit :: TCM QuotingKit quotingKit = do hidden <- primHidden instanceH <- primInstance visible <- primVisible relevant <- primRelevant irrelevant <- primIrrelevant nil <- primNil cons <- primCons arg <- primArgArg arginfo <- primArgArgInfo var <- primAgdaTermVar lam <- primAgdaTermLam extlam <- primAgdaTermExtLam def <- primAgdaTermDef con <- primAgdaTermCon pi <- primAgdaTermPi sort <- primAgdaTermSort lit <- primAgdaTermLit litNat <- primAgdaLitNat litFloat <- primAgdaLitFloat litChar <- primAgdaLitChar litString <- primAgdaLitString litQName <- primAgdaLitQName normalClause <- primAgdaClauseClause absurdClause <- primAgdaClauseAbsurd varP <- primAgdaPatVar conP <- primAgdaPatCon dotP <- primAgdaPatDot litP <- primAgdaPatLit projP <- primAgdaPatProj absurdP <- primAgdaPatAbsurd set <- primAgdaSortSet setLit <- primAgdaSortLit unsupportedSort <- primAgdaSortUnsupported sucLevel <- primLevelSuc lub <- primLevelMax lkit <- requireLevels el <- primAgdaTypeEl Con z _ <- ignoreSharing <$> primZero Con s _ <- ignoreSharing <$> primSuc unsupported <- primAgdaTermUnsupported let (@@) :: Apply a => ReduceM a -> ReduceM Term -> ReduceM a t @@ u = apply <$> t <*> ((:[]) . defaultArg <$> u) (!@) :: Apply a => a -> ReduceM Term -> ReduceM a t !@ u = pure t @@ u (!@!) :: Apply a => a -> Term -> ReduceM a t !@! u = pure t @@ pure u quoteHiding :: Hiding -> ReduceM Term quoteHiding Hidden = pure hidden quoteHiding Instance = pure instanceH quoteHiding NotHidden = pure visible quoteRelevance :: Relevance -> ReduceM Term quoteRelevance Relevant = pure relevant quoteRelevance Irrelevant = pure irrelevant quoteRelevance NonStrict = pure relevant quoteRelevance Forced{} = pure relevant quoteRelevance UnusedArg = pure relevant -- quoteColors _ = nil -- TODO guilhem quoteArgInfo :: I.ArgInfo -> ReduceM Term quoteArgInfo (ArgInfo h r cs) = arginfo !@ quoteHiding h @@ quoteRelevance r -- @@ quoteColors cs quoteLit :: Literal -> ReduceM Term quoteLit l@LitInt{} = lit !@ (litNat !@! Lit l) quoteLit l@LitFloat{} = lit !@ (litFloat !@! Lit l) quoteLit l@LitChar{} = lit !@ (litChar !@! Lit l) quoteLit l@LitString{} = lit !@ (litString !@! Lit l) quoteLit l@LitQName{} = lit !@ (litQName !@! Lit l) -- We keep no ranges in the quoted term, so the equality on terms -- is only on the structure. quoteSortLevelTerm :: Level -> ReduceM Term quoteSortLevelTerm (Max []) = setLit !@! Lit (LitInt noRange 0) quoteSortLevelTerm (Max [ClosedLevel n]) = setLit !@! Lit (LitInt noRange n) quoteSortLevelTerm l = set !@ quoteTerm (unlevelWithKit lkit l) quoteSort :: Sort -> ReduceM Term quoteSort (Type t) = quoteSortLevelTerm t quoteSort Prop = pure unsupportedSort quoteSort Inf = pure unsupportedSort quoteSort SizeUniv = pure unsupportedSort quoteSort DLub{} = pure unsupportedSort quoteType :: Type -> ReduceM Term quoteType (El s t) = el !@ quoteSort s @@ quoteTerm t quoteQName :: QName -> ReduceM Term quoteQName x = pure $ Lit $ LitQName noRange x quotePats :: [I.NamedArg Pattern] -> ReduceM Term quotePats ps = list $ map (quoteArg quotePat . fmap namedThing) ps quotePat :: Pattern -> ReduceM Term quotePat (VarP "()") = pure absurdP quotePat (VarP _) = pure varP quotePat (DotP _) = pure dotP quotePat (ConP c _ ps) = conP !@ quoteQName (conName c) @@ quotePats ps quotePat (LitP l) = litP !@! Lit l quotePat (ProjP x) = projP !@ quoteQName x quoteBody :: I.ClauseBody -> Maybe (ReduceM Term) quoteBody (Body a) = Just (quoteTerm a) quoteBody (Bind b) = quoteBody (absBody b) quoteBody NoBody = Nothing quoteClause :: Clause -> ReduceM Term quoteClause Clause{namedClausePats = ps, clauseBody = body} = case quoteBody body of Nothing -> absurdClause !@ quotePats ps Just b -> normalClause !@ quotePats ps @@ b list :: [ReduceM Term] -> ReduceM Term list [] = pure nil list (a : as) = cons !@ a @@ list as quoteDom :: (Type -> ReduceM Term) -> I.Dom Type -> ReduceM Term quoteDom q (Dom info t) = arg !@ quoteArgInfo info @@ q t quoteArg :: (a -> ReduceM Term) -> I.Arg a -> ReduceM Term quoteArg q (Arg info t) = arg !@ quoteArgInfo info @@ q t quoteArgs :: I.Args -> ReduceM Term quoteArgs ts = list (map (quoteArg quoteTerm) ts) quoteTerm :: Term -> ReduceM Term quoteTerm v = case unSpine v of Var n es -> let ts = fromMaybe __IMPOSSIBLE__ $ allApplyElims es in var !@! Lit (LitInt noRange $ fromIntegral n) @@ quoteArgs ts Lam info t -> lam !@ quoteHiding (getHiding info) @@ quoteTerm (absBody t) Def x es -> do d <- theDef <$> getConstInfo x qx d @@ quoteArgs ts where ts = fromMaybe __IMPOSSIBLE__ $ allApplyElims es qx Function{ funExtLam = Just (ExtLamInfo h nh), funClauses = cs } = extlam !@ list (map (quoteClause . dropArgs (h + nh)) cs) qx Function{ funCompiled = Just Fail, funClauses = [cl] } = extlam !@ list [quoteClause $ dropArgs (length (clausePats cl) - 1) cl] qx _ = def !@! quoteName x Con x ts -> con !@! quoteConName x @@ quoteArgs ts Pi t u -> pi !@ quoteDom quoteType t @@ quoteType (absBody u) Level l -> quoteTerm (unlevelWithKit lkit l) Lit lit -> quoteLit lit Sort s -> sort !@ quoteSort s Shared p -> quoteTerm $ derefPtr p MetaV{} -> pure unsupported DontCare{} -> pure unsupported -- could be exposed at some point but we have to take care ExtLam{} -> __IMPOSSIBLE__ return $ QuotingKit quoteTerm quoteType quoteClause (quoteDom quoteType) quoteName :: QName -> Term quoteName x = Lit (LitQName noRange x) quoteConName :: ConHead -> Term quoteConName = quoteName . conName quoteTerm :: Term -> TCM Term quoteTerm v = do kit <- quotingKit runReduceM (quoteTermWithKit kit v) quoteType :: Type -> TCM Term quoteType v = do kit <- quotingKit runReduceM (quoteTypeWithKit kit v) Agda-2.4.2.5/src/full/Agda/TypeChecking/CheckInternal.hs-boot0000644000000000000000000000032312635075266021667 0ustar0000000000000000module Agda.TypeChecking.CheckInternal where import Agda.Syntax.Internal import Agda.TypeChecking.Monad.Base (TCM) checkType :: Type -> TCM () checkInternal :: Term -> Type -> TCM () infer :: Term -> TCM Type Agda-2.4.2.5/src/full/Agda/TypeChecking/Empty.hs-boot0000644000000000000000000000035012635075266020253 0ustar0000000000000000 module Agda.TypeChecking.Empty where import Agda.TypeChecking.Monad (TCM) import Agda.Syntax.Internal (Type) import Agda.Syntax.Position (Range) -- isReallyEmptyType :: Type -> TCM () isEmptyType :: Range -> Type -> TCM () Agda-2.4.2.5/src/full/Agda/TypeChecking/Reduce.hs0000644000000000000000000013714412635075266017437 0ustar0000000000000000{-# LANGUAGE CPP #-} {-# LANGUAGE FlexibleInstances #-} {-# LANGUAGE PatternGuards #-} {-# LANGUAGE TupleSections #-} #if __GLASGOW_HASKELL__ >= 710 {-# LANGUAGE FlexibleContexts #-} #endif module Agda.TypeChecking.Reduce where import Prelude hiding (mapM) import Control.Monad.Reader hiding (mapM) import Control.Applicative import Data.List as List hiding (sort) import Data.Maybe import Data.Map (Map) import Data.Traversable import Data.Hashable import Agda.Syntax.Position import Agda.Syntax.Common hiding (Arg, Dom, NamedArg, ArgInfo) import qualified Agda.Syntax.Common as Common import Agda.Syntax.Internal import Agda.Syntax.Scope.Base (Scope) import Agda.Syntax.Literal import Agda.TypeChecking.Monad hiding ( underAbstraction_, enterClosure, isInstantiatedMeta , reportSDoc, reportSLn, getConstInfo , lookupMeta ) import qualified Agda.TypeChecking.Monad as TCM import Agda.TypeChecking.Monad.Builtin hiding (getPrimitive, constructorForm) import Agda.TypeChecking.Substitute import Agda.TypeChecking.CompiledClause import Agda.TypeChecking.EtaContract import Agda.TypeChecking.Reduce.Monad import {-# SOURCE #-} Agda.TypeChecking.CompiledClause.Match import {-# SOURCE #-} Agda.TypeChecking.Patterns.Match import {-# SOURCE #-} Agda.TypeChecking.Pretty import {-# SOURCE #-} Agda.TypeChecking.Rewriting import Agda.Utils.Either import Agda.Utils.Function import Agda.Utils.Functor import Agda.Utils.Monad import Agda.Utils.HashMap (HashMap) import Agda.Utils.Maybe import Agda.Utils.Monad import Agda.Utils.Tuple #include "undefined.h" import Agda.Utils.Impossible instantiate :: Instantiate a => a -> TCM a instantiate = runReduceM . instantiate' instantiateFull :: InstantiateFull a => a -> TCM a instantiateFull = runReduceM . instantiateFull' reduce :: Reduce a => a -> TCM a reduce = runReduceM . reduce' reduceB :: Reduce a => a -> TCM (Blocked a) reduceB = runReduceM . reduceB' normalise :: Normalise a => a -> TCM a normalise = runReduceM . normalise' simplify :: Simplify a => a -> TCM a simplify = runReduceM . simplify' -- | Instantiate something. -- Results in an open meta variable or a non meta. -- Doesn't do any reduction, and preserves blocking tags (when blocking meta -- is uninstantiated). class Instantiate t where instantiate' :: t -> ReduceM t instance Instantiate Term where instantiate' t@(MetaV x es) = do mi <- mvInstantiation <$> lookupMeta x case mi of InstV tel v -> instantiate' inst where -- A slight complication here is that the meta might be underapplied, -- in which case we have to build the lambda abstraction before -- applying the substitution, or overapplied in which case we need to -- fall back to applyE. (es1, es2) = splitAt (length tel) es vs1 = reverse $ map unArg $ fromMaybe __IMPOSSIBLE__ $ allApplyElims es1 rho = vs1 ++# wkS (length vs1) idS -- really should be .. ++# emptyS but using wkS makes it reduce to idS -- when applicable -- specification: inst == foldr mkLam v tel `applyE` es inst = applySubst rho (foldr mkLam v $ drop (length es1) tel) `applyE` es2 Open -> return t OpenIFS -> return t BlockedConst _ -> return t PostponedTypeCheckingProblem _ _ -> return t InstS _ -> __IMPOSSIBLE__ instantiate' (Level l) = levelTm <$> instantiate' l instantiate' (Sort s) = sortTm <$> instantiate' s instantiate' v@Shared{} = __IMPOSSIBLE__ -- updateSharedTerm instantiate' v instantiate' t = return t instance Instantiate Level where instantiate' (Max as) = levelMax <$> instantiate' as instance Instantiate PlusLevel where instantiate' l@ClosedLevel{} = return l instantiate' (Plus n a) = Plus n <$> instantiate' a instance Instantiate LevelAtom where instantiate' l = case l of MetaLevel m vs -> do v <- instantiate' (MetaV m vs) case ignoreSharing v of MetaV m vs -> return $ MetaLevel m vs _ -> return $ UnreducedLevel v UnreducedLevel l -> UnreducedLevel <$> instantiate' l _ -> return l instance Instantiate a => Instantiate (Blocked a) where instantiate' v@NotBlocked{} = return v instantiate' v@(Blocked x u) = do mi <- mvInstantiation <$> lookupMeta x case mi of InstV{} -> notBlocked <$> instantiate' u Open -> return v OpenIFS -> return v BlockedConst{} -> return v PostponedTypeCheckingProblem{} -> return v InstS{} -> __IMPOSSIBLE__ instance Instantiate Type where instantiate' (El s t) = El <$> instantiate' s <*> instantiate' t instance Instantiate Sort where instantiate' s = case s of Type l -> levelSort <$> instantiate' l _ -> return s instance Instantiate Elim where instantiate' (Apply v) = Apply <$> instantiate' v instantiate' (Proj f) = pure $ Proj f instance Instantiate t => Instantiate (Abs t) where instantiate' = traverse instantiate' instance Instantiate t => Instantiate (Arg t) where instantiate' = traverse instantiate' instance Instantiate t => Instantiate (Dom t) where instantiate' = traverse instantiate' instance Instantiate t => Instantiate [t] where instantiate' = traverse instantiate' instance (Instantiate a, Instantiate b) => Instantiate (a,b) where instantiate' (x,y) = (,) <$> instantiate' x <*> instantiate' y instance (Instantiate a, Instantiate b,Instantiate c) => Instantiate (a,b,c) where instantiate' (x,y,z) = (,,) <$> instantiate' x <*> instantiate' y <*> instantiate' z instance Instantiate a => Instantiate (Closure a) where instantiate' cl = do x <- enterClosure cl instantiate' return $ cl { clValue = x } instance Instantiate Telescope where instantiate' tel = return tel instance Instantiate Constraint where instantiate' (ValueCmp cmp t u v) = do (t,u,v) <- instantiate' (t,u,v) return $ ValueCmp cmp t u v instantiate' (ElimCmp cmp t v as bs) = ElimCmp cmp <$> instantiate' t <*> instantiate' v <*> instantiate' as <*> instantiate' bs instantiate' (LevelCmp cmp u v) = uncurry (LevelCmp cmp) <$> instantiate' (u,v) instantiate' (TypeCmp cmp a b) = uncurry (TypeCmp cmp) <$> instantiate' (a,b) instantiate' (TelCmp a b cmp tela telb) = uncurry (TelCmp a b cmp) <$> instantiate' (tela,telb) instantiate' (SortCmp cmp a b) = uncurry (SortCmp cmp) <$> instantiate' (a,b) instantiate' (Guarded c pid) = Guarded <$> instantiate' c <*> pure pid instantiate' (UnBlock m) = return $ UnBlock m instantiate' (FindInScope m args) = FindInScope m <$> mapM instantiate' args instantiate' (IsEmpty r t) = IsEmpty r <$> instantiate' t instantiate' (CheckSizeLtSat t) = CheckSizeLtSat <$> instantiate' t instance (Ord k, Instantiate e) => Instantiate (Map k e) where instantiate' = traverse instantiate' --------------------------------------------------------------------------- -- * Reduction to weak head normal form. --------------------------------------------------------------------------- -- | Case on whether a term is blocked on a meta (or is a meta). -- That means it can change its shape when the meta is instantiated. ifBlocked :: MonadTCM tcm => Term -> (MetaId -> Term -> tcm a) -> (Term -> tcm a) -> tcm a ifBlocked t blocked unblocked = do t <- liftTCM $ reduceB t case ignoreSharing <$> t of Blocked m _ -> blocked m (ignoreBlocking t) NotBlocked _ (MetaV m _) -> blocked m (ignoreBlocking t) NotBlocked{} -> unblocked (ignoreBlocking t) -- | Case on whether a type is blocked on a meta (or is a meta). ifBlockedType :: MonadTCM tcm => Type -> (MetaId -> Type -> tcm a) -> (Type -> tcm a) -> tcm a ifBlockedType (El s t) blocked unblocked = ifBlocked t (\ m v -> blocked m $ El s v) (\ v -> unblocked $ El s v) class Reduce t where reduce' :: t -> ReduceM t reduceB' :: t -> ReduceM (Blocked t) reduce' t = ignoreBlocking <$> reduceB' t reduceB' t = notBlocked <$> reduce' t instance Reduce Type where reduce' (El s t) = El s <$> reduce' t reduceB' (El s t) = fmap (El s) <$> reduceB' t instance Reduce Sort where reduce' s = {-# SCC "reduce'" #-} ifNotM hasUniversePolymorphism (red s) $ {- else -} red =<< instantiateFull' s where red s = do s <- instantiate' s case s of DLub s1 s2 -> do s <- dLub <$> reduce' s1 <*> reduce' s2 case s of DLub{} -> return s _ -> reduce' s -- TODO: not so nice Prop -> return s Type s' -> levelSort <$> reduce' s' Inf -> return Inf SizeUniv -> return SizeUniv instance Reduce Elim where reduce' (Apply v) = Apply <$> reduce' v reduce' (Proj f) = pure $ Proj f instance Reduce Level where reduce' (Max as) = levelMax <$> mapM reduce' as reduceB' (Max as) = fmap levelMax . traverse id <$> traverse reduceB' as instance Reduce PlusLevel where reduceB' l@ClosedLevel{} = return $ notBlocked l reduceB' (Plus n l) = fmap (Plus n) <$> reduceB' l instance Reduce LevelAtom where reduceB' l = case l of MetaLevel m vs -> fromTm (MetaV m vs) NeutralLevel r v -> return $ NotBlocked r $ NeutralLevel r v BlockedLevel m v -> ifM (isInstantiatedMeta m) (fromTm v) (return $ Blocked m $ BlockedLevel m v) UnreducedLevel v -> fromTm v where fromTm v = do bv <- reduceB' v let v = ignoreBlocking bv case ignoreSharing <$> bv of NotBlocked r (MetaV m vs) -> return $ NotBlocked r $ MetaLevel m vs Blocked m _ -> return $ Blocked m $ BlockedLevel m v NotBlocked r _ -> return $ NotBlocked r $ NeutralLevel r v instance (Subst t, Reduce t) => Reduce (Abs t) where reduce' b@(Abs x _) = Abs x <$> underAbstraction_ b reduce' reduce' (NoAbs x v) = NoAbs x <$> reduce' v -- Lists are never blocked instance Reduce t => Reduce [t] where reduce' = traverse reduce' instance Reduce t => Reduce (Arg t) where reduce' a = case getRelevance a of Irrelevant -> return a -- Don't reduce' irr. args!? _ -> traverse reduce' a reduceB' t = traverse id <$> traverse reduceB' t instance Reduce t => Reduce (Dom t) where reduce' = traverse reduce' reduceB' t = traverse id <$> traverse reduceB' t -- Tuples are never blocked instance (Reduce a, Reduce b) => Reduce (a,b) where reduce' (x,y) = (,) <$> reduce' x <*> reduce' y instance (Reduce a, Reduce b,Reduce c) => Reduce (a,b,c) where reduce' (x,y,z) = (,,) <$> reduce' x <*> reduce' y <*> reduce' z instance Reduce Term where reduceB' = {-# SCC "reduce'" #-} rewriteAfter $ \ v -> do v <- instantiate' v let done = return $ notBlocked v case v of -- Andreas, 2012-11-05 not reducing meta args does not destroy anything -- and seems to save 2% sec on the standard library -- MetaV x args -> notBlocked . MetaV x <$> reduce' args MetaV x es -> done Def f es -> unfoldDefinitionE False reduceB' (Def f []) f es Con c args -> do -- Constructors can reduce' when they come from an -- instantiated module. v <- unfoldDefinition False reduceB' (Con c []) (conName c) args traverse reduceNat v Sort s -> fmap sortTm <$> reduceB' s Level l -> ifM (elem LevelReductions <$> asks envAllowedReductions) {- then -} (fmap levelTm <$> reduceB' l) {- else -} done Pi _ _ -> done Lit _ -> done Var _ _ -> done Lam _ _ -> done DontCare _ -> done ExtLam{} -> __IMPOSSIBLE__ Shared{} -> __IMPOSSIBLE__ -- updateSharedTermF reduceB' v where -- NOTE: reduceNat can traverse the entire term. reduceNat v@Shared{} = __IMPOSSIBLE__ -- updateSharedTerm reduceNat v reduceNat v@(Con c []) = do mz <- getBuiltin' builtinZero case v of _ | Just v == mz -> return $ Lit $ LitInt (getRange c) 0 _ -> return v reduceNat v@(Con c [a]) | notHidden a && isRelevant a = do ms <- fmap ignoreSharing <$> getBuiltin' builtinSuc case v of _ | Just (Con c []) == ms -> inc <$> reduce' (unArg a) _ -> return v where inc w = case ignoreSharing w of Lit (LitInt r n) -> Lit (LitInt (fuseRange c r) $ n + 1) _ -> Con c [defaultArg w] reduceNat v = return v rewriteAfter :: (Term -> ReduceM (Blocked Term)) -> Term -> ReduceM (Blocked Term) rewriteAfter f = trampolineM $ rewrite <=< f -- Andreas, 2013-03-20 recursive invokations of unfoldCorecursion -- need also to instantiate metas, see Issue 826. unfoldCorecursionE :: Elim -> ReduceM (Blocked Elim) unfoldCorecursionE e@(Proj f) = return $ notBlocked e unfoldCorecursionE (Apply (Common.Arg info v)) = fmap (Apply . Common.Arg info) <$> unfoldCorecursion v unfoldCorecursion :: Term -> ReduceM (Blocked Term) unfoldCorecursion = rewriteAfter $ \ v -> do v <- instantiate' v case v of Def f es -> unfoldDefinitionE True unfoldCorecursion (Def f []) f es Shared{} -> fmap shared <$> unfoldCorecursion (ignoreSharing v) -- don't update when unfolding corecursion! _ -> reduceB' v -- | If the first argument is 'True', then a single delayed clause may -- be unfolded. unfoldDefinition :: Bool -> (Term -> ReduceM (Blocked Term)) -> Term -> QName -> Args -> ReduceM (Blocked Term) unfoldDefinition b keepGoing v f args = snd <$> do unfoldDefinition' b (\ t -> (NoSimplification,) <$> keepGoing t) v f $ map Apply args unfoldDefinitionE :: Bool -> (Term -> ReduceM (Blocked Term)) -> Term -> QName -> Elims -> ReduceM (Blocked Term) unfoldDefinitionE b keepGoing v f es = snd <$> unfoldDefinition' b (\ t -> (NoSimplification,) <$> keepGoing t) v f es unfoldDefinition' :: Bool -> (Term -> ReduceM (Simplification, Blocked Term)) -> Term -> QName -> Elims -> ReduceM (Simplification, Blocked Term) unfoldDefinition' unfoldDelayed keepGoing v0 f es = {-# SCC "reduceDef" #-} do info <- getConstInfo f allowed <- asks envAllowedReductions let def = theDef info v = v0 `applyE` es -- Non-terminating functions -- (i.e., those that failed the termination check) -- and delayed definitions -- are not unfolded unless explicitely permitted. dontUnfold = (defNonterminating info && notElem NonTerminatingReductions allowed) || (defDelayed info == Delayed && not unfoldDelayed) case def of Constructor{conSrcCon = c} -> retSimpl $ notBlocked $ Con (c `withRangeOf` f) [] `applyE` es Primitive{primAbstr = ConcreteDef, primName = x, primClauses = cls} -> do pf <- fromMaybe __IMPOSSIBLE__ <$> getPrimitive' x reducePrimitive x v0 f es pf dontUnfold cls (defCompiled info) _ -> do if FunctionReductions `elem` allowed || (isJust (isProjection_ def) && ProjectionReductions `elem` allowed) -- includes projection-like then reduceNormalE keepGoing v0 f (map notReduced es) dontUnfold (defClauses info) (defCompiled info) else retSimpl $ notBlocked v -- Andrea(s), 2014-12-05 OK? where retSimpl v = (,v) <$> getSimplification reducePrimitive x v0 f es pf dontUnfold cls mcc | genericLength es < ar = retSimpl $ NotBlocked Underapplied $ v0 `applyE` es -- not fully applied | otherwise = {-# SCC "reducePrimitive" #-} do let (es1,es2) = genericSplitAt ar es args1 = fromMaybe __IMPOSSIBLE__ $ mapM isApplyElim es1 r <- primFunImplementation pf args1 case r of NoReduction args1' -> do let es1' = map (fmap Apply) args1' if null cls then do retSimpl $ applyE (Def f []) <$> do traverse id $ map mredToBlocked es1' ++ map notBlocked es2 else reduceNormalE keepGoing v0 f (es1' ++ map notReduced es2) dontUnfold cls mcc YesReduction simpl v -> performedSimplification' simpl $ keepGoing $ v `applyE` es2 where ar = primFunArity pf mredToBlocked :: MaybeReduced a -> Blocked a mredToBlocked (MaybeRed NotReduced x) = notBlocked x mredToBlocked (MaybeRed (Reduced b) x) = x <$ b reduceNormalE :: (Term -> ReduceM (Simplification, Blocked Term)) -> Term -> QName -> [MaybeReduced Elim] -> Bool -> [Clause] -> Maybe CompiledClauses -> ReduceM (Simplification, Blocked Term) reduceNormalE keepGoing v0 f es dontUnfold def mcc = {-# SCC "reduceNormal" #-} do case def of _ | dontUnfold -> defaultResult -- non-terminating or delayed [] -> defaultResult -- no definition for head cls -> do ev <- appDefE_ f v0 cls mcc es case ev of NoReduction v -> do traceSDoc "tc.reduce'" 90 (vcat [ text "*** tried to reduce' " <+> prettyTCM f , text " es = " <+> sep (map (prettyTCM . ignoreReduced) es) -- [ text "*** tried to reduce' " <+> prettyTCM vfull , text " stuck on" <+> prettyTCM (ignoreBlocking v) ]) $ do retSimpl v YesReduction simpl v -> performedSimplification' simpl $ do traceSDoc "tc.reduce'" 90 (text "*** reduced definition: " <+> prettyTCM f) $ do traceSDoc "tc.reduce'" 95 (text " result" <+> prettyTCM v) $ do traceSDoc "tc.reduce'" 100 (text " raw " <+> text (show v)) $ do keepGoing v where defaultResult = retSimpl $ NotBlocked AbsurdMatch vfull vfull = v0 `applyE` map ignoreReduced es -- | Reduce a non-primitive definition if it is a copy linking to another def. reduceDefCopy :: QName -> Args -> TCM (Reduced () Term) reduceDefCopy f vs = do info <- TCM.getConstInfo f if (defCopy info) then reduceDef_ info f vs else return $ NoReduction () where reduceDef_ :: Definition -> QName -> Args -> TCM (Reduced () Term) reduceDef_ info f vs = do let v0 = Def f [] args = map notReduced vs cls = (defClauses info) mcc = (defCompiled info) if (defDelayed info == Delayed) || (defNonterminating info) then return $ NoReduction () else do ev <- runReduceM $ appDef_ f v0 cls mcc args case ev of YesReduction simpl t -> return $ YesReduction simpl t NoReduction args' -> return $ NoReduction () -- | Reduce simple (single clause) definitions. reduceHead :: Term -> TCM (Blocked Term) reduceHead = runReduceM . reduceHead' reduceHead' :: Term -> ReduceM (Blocked Term) reduceHead' v = do -- ignoreAbstractMode $ do -- Andreas, 2013-02-18 ignoreAbstractMode leads to information leakage -- see Issue 796 -- first, possibly rewrite literal v to constructor form v <- constructorForm v reportSDoc "tc.inj.reduce" 30 $ text "reduceHead" <+> prettyTCM v case ignoreSharing v of Def f es -> do abstractMode <- envAbstractMode <$> ask isAbstract <- treatAbstractly f reportSLn "tc.inj.reduce" 50 $ "reduceHead: we are in " ++ show abstractMode++ "; " ++ show f ++ " is treated " ++ if isAbstract then "abstractly" else "concretely" let v0 = Def f [] red = unfoldDefinitionE False reduceHead' v0 f es def <- theDef <$> getConstInfo f case def of -- Andreas, 2012-11-06 unfold aliases (single clause terminating functions) -- see test/succeed/Issue747 -- We restrict this to terminating functions to not make the -- type checker loop here on non-terminating functions. -- see test/fail/TerminationInfiniteRecord Function{ funClauses = [ _ ], funDelayed = NotDelayed, funTerminates = Just True } -> do reportSLn "tc.inj.reduce" 50 $ "reduceHead: head " ++ show f ++ " is Function" red Datatype{ dataClause = Just _ } -> red Record{ recClause = Just _ } -> red _ -> return $ notBlocked v _ -> return $ notBlocked v -- | Apply a definition using the compiled clauses, or fall back to -- ordinary clauses if no compiled clauses exist. appDef_ :: QName -> Term -> [Clause] -> Maybe CompiledClauses -> MaybeReducedArgs -> ReduceM (Reduced (Blocked Term) Term) appDef_ f v0 cls mcc args = appDefE_ f v0 cls mcc $ map (fmap Apply) args appDefE_ :: QName -> Term -> [Clause] -> Maybe CompiledClauses -> MaybeReducedElims -> ReduceM (Reduced (Blocked Term) Term) appDefE_ f v0 cls mcc args = local (\ e -> e { envAppDef = Just f }) $ maybe (appDefE' v0 cls args) (\cc -> appDefE v0 cc args) mcc -- | Apply a defined function to it's arguments, using the compiled clauses. -- The original term is the first argument applied to the third. appDef :: Term -> CompiledClauses -> MaybeReducedArgs -> ReduceM (Reduced (Blocked Term) Term) appDef v cc args = appDefE v cc $ map (fmap Apply) args appDefE :: Term -> CompiledClauses -> MaybeReducedElims -> ReduceM (Reduced (Blocked Term) Term) appDefE v cc es = do r <- matchCompiledE cc es case r of YesReduction simpl t -> return $ YesReduction simpl t NoReduction es' -> return $ NoReduction $ applyE v <$> es' -- | Apply a defined function to it's arguments, using the original clauses. appDef' :: Term -> [Clause] -> MaybeReducedArgs -> ReduceM (Reduced (Blocked Term) Term) appDef' v cls args = appDefE' v cls $ map (fmap Apply) args appDefE' :: Term -> [Clause] -> MaybeReducedElims -> ReduceM (Reduced (Blocked Term) Term) appDefE' v cls es = goCls cls $ map ignoreReduced es where goCls :: [Clause] -> [Elim] -> ReduceM (Reduced (Blocked Term) Term) goCls cl es = do reportSLn "tc.reduce'" 95 $ "Reduce.goCls tries reduction, #clauses = " ++ show (length cl) case cl of -- Andreas, 2013-10-26 In case of an incomplete match, -- we just do not reduce. This allows adding single function -- clauses after they have been type-checked, to type-check -- the remaining clauses (see Issue 907). -- Andrea(s), 2014-12-05: We return 'MissingClauses' here, since this -- is the most conservative reason. [] -> return $ NoReduction $ NotBlocked MissingClauses $ v `applyE` es Clause{ namedClausePats = pats, clauseBody = body } : cls -> do let n = length pats -- if clause is underapplied, skip to next clause if length es < n then goCls cls es else do let (es0, es1) = splitAt n es (m, es0) <- matchCopatterns pats es0 es <- return $ es0 ++ es1 case m of No -> goCls cls es DontKnow b -> return $ NoReduction $ b $> v `applyE` es Yes simpl vs -- vs is the subst. for the variables bound in body | isJust (getBodyUnraised body) -- clause has body? -> return $ YesReduction simpl $ -- TODO: let matchPatterns also return the reduced forms -- of the original arguments! -- Andreas, 2013-05-19 isn't this done now? app vs body EmptyS `applyE` es1 | otherwise -> return $ NoReduction $ NotBlocked AbsurdMatch $ v `applyE` es -- Build an explicit substitution from arguments -- and execute it using parallel substitution. -- Calculating the de Bruijn indices: ;-) for the Bind case -- Simply-typed version -- (we are not interested in types, only in de Bruijn indices here) -- Γ ⊢ σ : Δ -- Γ ⊢ v : A -- Γ ⊢ (σ,v) : Δ.A -- Δ ⊢ λ b : A → B -- Δ.A ⊢ b : B app :: [Term] -> ClauseBody -> Substitution -> Term app [] (Body v) sigma = applySubst sigma v app (v : vs) (Bind (Abs _ b)) sigma = app vs b $ consS v sigma -- CBN app (v : vs) (Bind (NoAbs _ b)) sigma = app vs b sigma app _ NoBody sigma = __IMPOSSIBLE__ app (_ : _) (Body _) sigma = __IMPOSSIBLE__ app [] (Bind _) sigma = __IMPOSSIBLE__ instance Reduce a => Reduce (Closure a) where reduce' cl = do x <- enterClosure cl reduce' return $ cl { clValue = x } instance Reduce Telescope where reduce' tel = return tel instance Reduce Constraint where reduce' (ValueCmp cmp t u v) = do (t,u,v) <- reduce' (t,u,v) return $ ValueCmp cmp t u v reduce' (ElimCmp cmp t v as bs) = ElimCmp cmp <$> reduce' t <*> reduce' v <*> reduce' as <*> reduce' bs reduce' (LevelCmp cmp u v) = uncurry (LevelCmp cmp) <$> reduce' (u,v) reduce' (TypeCmp cmp a b) = uncurry (TypeCmp cmp) <$> reduce' (a,b) reduce' (TelCmp a b cmp tela telb) = uncurry (TelCmp a b cmp) <$> reduce' (tela,telb) reduce' (SortCmp cmp a b) = uncurry (SortCmp cmp) <$> reduce' (a,b) reduce' (Guarded c pid) = Guarded <$> reduce' c <*> pure pid reduce' (UnBlock m) = return $ UnBlock m reduce' (FindInScope m cands) = FindInScope m <$> mapM reduce' cands reduce' (IsEmpty r t) = IsEmpty r <$> reduce' t reduce' (CheckSizeLtSat t) = CheckSizeLtSat <$> reduce' t instance (Ord k, Reduce e) => Reduce (Map k e) where reduce' = traverse reduce' --------------------------------------------------------------------------- -- * Simplification --------------------------------------------------------------------------- -- | Only unfold definitions if this leads to simplification -- which means that a constructor/literal pattern is matched. class Simplify t where simplify' :: t -> ReduceM t instance Simplify Term where simplify' v = do v <- instantiate' v case v of Def f vs -> do let keepGoing v = (,notBlocked v) <$> getSimplification -- Andrea(s), 2014-12-05 OK? (simpl, v) <- unfoldDefinition' False keepGoing (Def f []) f vs reportSDoc "tc.simplify'" 20 $ text ("simplify': unfolding definition returns " ++ show simpl) <+> prettyTCM (ignoreBlocking v) case simpl of YesSimplification -> simplifyBlocked' v -- Dangerous, but if @simpl@ then @v /= Def f vs@ NoSimplification -> Def f <$> simplify' vs MetaV x vs -> MetaV x <$> simplify' vs Con c vs -> Con c <$> simplify' vs Sort s -> sortTm <$> simplify' s Level l -> levelTm <$> simplify' l Pi a b -> Pi <$> simplify' a <*> simplify' b Lit l -> return v Var i vs -> Var i <$> simplify' vs Lam h v -> Lam h <$> simplify' v DontCare v -> dontCare <$> simplify' v ExtLam{} -> __IMPOSSIBLE__ Shared{} -> __IMPOSSIBLE__ -- updateSharedTerm simplify' v simplifyBlocked' :: Simplify t => Blocked t -> ReduceM t simplifyBlocked' (Blocked _ t) = return t simplifyBlocked' (NotBlocked _ t) = simplify' t -- Andrea(s), 2014-12-05 OK? instance Simplify Type where simplify' (El s t) = El <$> simplify' s <*> simplify' t instance Simplify Elim where simplify' (Apply v) = Apply <$> simplify' v simplify' (Proj f) = pure $ Proj f instance Simplify Sort where simplify' s = do case s of DLub s1 s2 -> dLub <$> simplify' s1 <*> simplify' s2 Type s -> levelSort <$> simplify' s Prop -> return s Inf -> return s SizeUniv -> return s instance Simplify Level where simplify' (Max as) = levelMax <$> simplify' as instance Simplify PlusLevel where simplify' l@ClosedLevel{} = return l simplify' (Plus n l) = Plus n <$> simplify' l instance Simplify LevelAtom where simplify' l = do l <- instantiate' l case l of MetaLevel m vs -> MetaLevel m <$> simplify' vs BlockedLevel m v -> BlockedLevel m <$> simplify' v NeutralLevel r v -> NeutralLevel r <$> simplify' v -- ?? UnreducedLevel v -> UnreducedLevel <$> simplify' v -- ?? instance (Subst t, Simplify t) => Simplify (Abs t) where simplify' a@(Abs x _) = Abs x <$> underAbstraction_ a simplify' simplify' (NoAbs x v) = NoAbs x <$> simplify' v instance Simplify t => Simplify (Arg t) where simplify' = traverse simplify' instance Simplify t => Simplify (Named name t) where simplify' = traverse simplify' instance Simplify t => Simplify (Dom t) where simplify' = traverse simplify' instance Simplify t => Simplify [t] where simplify' = traverse simplify' instance (Ord k, Simplify e) => Simplify (Map k e) where simplify' = traverse simplify' instance Simplify a => Simplify (Maybe a) where simplify' = traverse simplify' instance (Simplify a, Simplify b) => Simplify (a,b) where simplify' (x,y) = (,) <$> simplify' x <*> simplify' y instance (Simplify a, Simplify b, Simplify c) => Simplify (a,b,c) where simplify' (x,y,z) = do (x,(y,z)) <- simplify' (x,(y,z)) return (x,y,z) instance Simplify a => Simplify (Closure a) where simplify' cl = do x <- enterClosure cl simplify' return $ cl { clValue = x } instance (Subst a, Simplify a) => Simplify (Tele a) where simplify' EmptyTel = return EmptyTel simplify' (ExtendTel a b) = uncurry ExtendTel <$> simplify' (a, b) instance Simplify ProblemConstraint where simplify' (PConstr pid c) = PConstr pid <$> simplify' c instance Simplify Constraint where simplify' (ValueCmp cmp t u v) = do (t,u,v) <- simplify' (t,u,v) return $ ValueCmp cmp t u v simplify' (ElimCmp cmp t v as bs) = ElimCmp cmp <$> simplify' t <*> simplify' v <*> simplify' as <*> simplify' bs simplify' (LevelCmp cmp u v) = uncurry (LevelCmp cmp) <$> simplify' (u,v) simplify' (TypeCmp cmp a b) = uncurry (TypeCmp cmp) <$> simplify' (a,b) simplify' (TelCmp a b cmp tela telb) = uncurry (TelCmp a b cmp) <$> simplify' (tela,telb) simplify' (SortCmp cmp a b) = uncurry (SortCmp cmp) <$> simplify' (a,b) simplify' (Guarded c pid) = Guarded <$> simplify' c <*> pure pid simplify' (UnBlock m) = return $ UnBlock m simplify' (FindInScope m cands) = FindInScope m <$> mapM simplify' cands simplify' (IsEmpty r t) = IsEmpty r <$> simplify' t simplify' (CheckSizeLtSat t) = CheckSizeLtSat <$> simplify' t instance Simplify Bool where simplify' = return -- UNUSED -- instance Simplify ConPatternInfo where -- simplify' (ConPatternInfo mr mt) = ConPatternInfo mr <$> simplify' mt -- UNUSED -- instance Simplify Pattern where -- simplify' p = case p of -- VarP _ -> return p -- LitP _ -> return p -- ConP c ci ps -> ConP c <$> simplify' ci <*> simplify' ps -- DotP v -> DotP <$> simplify' v -- ProjP _ -> return p instance Simplify ClauseBody where simplify' (Body t) = Body <$> simplify' t simplify' (Bind b) = Bind <$> simplify' b simplify' NoBody = return NoBody instance Simplify DisplayForm where simplify' (Display n ps v) = Display n <$> simplify' ps <*> return v --------------------------------------------------------------------------- -- * Normalisation --------------------------------------------------------------------------- class Normalise t where normalise' :: t -> ReduceM t instance Normalise Sort where normalise' s = do s <- reduce' s case s of DLub s1 s2 -> dLub <$> normalise' s1 <*> normalise' s2 Prop -> return s Type s -> levelSort <$> normalise' s Inf -> return Inf SizeUniv -> return SizeUniv instance Normalise Type where normalise' (El s t) = El <$> normalise' s <*> normalise' t instance Normalise Term where normalise' v = do v <- reduce' v case v of Var n vs -> Var n <$> normalise' vs Con c vs -> Con c <$> normalise' vs Def f vs -> Def f <$> normalise' vs MetaV x vs -> MetaV x <$> normalise' vs Lit _ -> return v Level l -> levelTm <$> normalise' l Lam h b -> Lam h <$> normalise' b Sort s -> sortTm <$> normalise' s Pi a b -> uncurry Pi <$> normalise' (a,b) Shared{} -> __IMPOSSIBLE__ -- updateSharedTerm normalise' v ExtLam{} -> __IMPOSSIBLE__ DontCare _ -> return v instance Normalise Elim where normalise' (Apply v) = Apply <$> normalise' v normalise' (Proj f) = pure $ Proj f instance Normalise Level where normalise' (Max as) = levelMax <$> normalise' as instance Normalise PlusLevel where normalise' l@ClosedLevel{} = return l normalise' (Plus n l) = Plus n <$> normalise' l instance Normalise LevelAtom where normalise' l = do l <- reduce' l case l of MetaLevel m vs -> MetaLevel m <$> normalise' vs BlockedLevel m v -> BlockedLevel m <$> normalise' v NeutralLevel r v -> NeutralLevel r <$> normalise' v UnreducedLevel{} -> __IMPOSSIBLE__ -- I hope instance Normalise ClauseBody where normalise' (Body t) = Body <$> normalise' t normalise' (Bind b) = Bind <$> normalise' b normalise' NoBody = return NoBody instance (Subst t, Normalise t) => Normalise (Abs t) where normalise' a@(Abs x _) = Abs x <$> underAbstraction_ a normalise' normalise' (NoAbs x v) = NoAbs x <$> normalise' v instance Normalise t => Normalise (Arg t) where normalise' a | isIrrelevant a = return a -- Andreas, 2012-04-02: Do not normalize irrelevant terms!? | otherwise = traverse normalise' a instance Normalise t => Normalise (Named name t) where normalise' = traverse normalise' instance Normalise t => Normalise (Dom t) where normalise' = traverse normalise' instance Normalise t => Normalise [t] where normalise' = traverse normalise' instance (Normalise a, Normalise b) => Normalise (a,b) where normalise' (x,y) = (,) <$> normalise' x <*> normalise' y instance (Normalise a, Normalise b, Normalise c) => Normalise (a,b,c) where normalise' (x,y,z) = do (x,(y,z)) <- normalise' (x,(y,z)) return (x,y,z) instance Normalise a => Normalise (Closure a) where normalise' cl = do x <- enterClosure cl normalise' return $ cl { clValue = x } instance (Subst a, Normalise a) => Normalise (Tele a) where normalise' EmptyTel = return EmptyTel normalise' (ExtendTel a b) = uncurry ExtendTel <$> normalise' (a, b) instance Normalise ProblemConstraint where normalise' (PConstr pid c) = PConstr pid <$> normalise' c instance Normalise Constraint where normalise' (ValueCmp cmp t u v) = do (t,u,v) <- normalise' (t,u,v) return $ ValueCmp cmp t u v normalise' (ElimCmp cmp t v as bs) = ElimCmp cmp <$> normalise' t <*> normalise' v <*> normalise' as <*> normalise' bs normalise' (LevelCmp cmp u v) = uncurry (LevelCmp cmp) <$> normalise' (u,v) normalise' (TypeCmp cmp a b) = uncurry (TypeCmp cmp) <$> normalise' (a,b) normalise' (TelCmp a b cmp tela telb) = uncurry (TelCmp a b cmp) <$> normalise' (tela,telb) normalise' (SortCmp cmp a b) = uncurry (SortCmp cmp) <$> normalise' (a,b) normalise' (Guarded c pid) = Guarded <$> normalise' c <*> pure pid normalise' (UnBlock m) = return $ UnBlock m normalise' (FindInScope m cands) = FindInScope m <$> mapM normalise' cands normalise' (IsEmpty r t) = IsEmpty r <$> normalise' t normalise' (CheckSizeLtSat t) = CheckSizeLtSat <$> normalise' t instance Normalise Bool where normalise' = return instance Normalise ConPatternInfo where normalise' (ConPatternInfo mr mt) = ConPatternInfo mr <$> normalise' mt instance Normalise Pattern where normalise' p = case p of VarP _ -> return p LitP _ -> return p ConP c mt ps -> ConP c <$> normalise' mt <*> normalise' ps DotP v -> DotP <$> normalise' v ProjP _ -> return p instance Normalise DisplayForm where normalise' (Display n ps v) = Display n <$> normalise' ps <*> return v instance (Ord k, Normalise e) => Normalise (Map k e) where normalise' = traverse normalise' instance Normalise a => Normalise (Maybe a) where normalise' = traverse normalise' --------------------------------------------------------------------------- -- * Full instantiation --------------------------------------------------------------------------- -- STALE: Full instantiatiation = normalisation [ instantiate' / reduce' ] -- How can we express this? We need higher order classes! -- | @instantiateFull'@ 'instantiate's metas everywhere (and recursively) -- but does not 'reduce'. class InstantiateFull t where instantiateFull' :: t -> ReduceM t instance InstantiateFull Name where instantiateFull' = return instance InstantiateFull Sort where instantiateFull' s = do s <- instantiate' s case s of Type n -> levelSort <$> instantiateFull' n Prop -> return s DLub s1 s2 -> dLub <$> instantiateFull' s1 <*> instantiateFull' s2 Inf -> return s SizeUniv -> return s instance (InstantiateFull a) => InstantiateFull (Type' a) where instantiateFull' (El s t) = El <$> instantiateFull' s <*> instantiateFull' t instance InstantiateFull Term where instantiateFull' v = etaOnce =<< do -- Andreas, 2010-11-12 DONT ETA!! eta-reduction breaks subject reduction -- but removing etaOnce now breaks everything v <- instantiate' v case v of Var n vs -> Var n <$> instantiateFull' vs Con c vs -> Con c <$> instantiateFull' vs Def f vs -> Def f <$> instantiateFull' vs MetaV x vs -> MetaV x <$> instantiateFull' vs Lit _ -> return v Level l -> levelTm <$> instantiateFull' l Lam h b -> Lam h <$> instantiateFull' b Sort s -> sortTm <$> instantiateFull' s Pi a b -> uncurry Pi <$> instantiateFull' (a,b) Shared{} -> __IMPOSSIBLE__ -- updateSharedTerm instantiateFull' v ExtLam{} -> __IMPOSSIBLE__ DontCare v -> dontCare <$> instantiateFull' v instance InstantiateFull Level where instantiateFull' (Max as) = levelMax <$> instantiateFull' as instance InstantiateFull PlusLevel where instantiateFull' l@ClosedLevel{} = return l instantiateFull' (Plus n l) = Plus n <$> instantiateFull' l instance InstantiateFull LevelAtom where instantiateFull' l = case l of MetaLevel m vs -> do v <- instantiateFull' (MetaV m vs) case ignoreSharing v of MetaV m vs -> return $ MetaLevel m vs _ -> return $ UnreducedLevel v NeutralLevel r v -> NeutralLevel r <$> instantiateFull' v BlockedLevel m v -> ifM (isInstantiatedMeta m) (UnreducedLevel <$> instantiateFull' v) (BlockedLevel m <$> instantiateFull' v) UnreducedLevel v -> UnreducedLevel <$> instantiateFull' v instance InstantiateFull Substitution where instantiateFull' sigma = case sigma of IdS -> return IdS EmptyS -> return EmptyS Wk n sigma -> Wk n <$> instantiateFull' sigma Lift n sigma -> Lift n <$> instantiateFull' sigma Strengthen bot sigma -> Strengthen bot <$> instantiateFull' sigma t :# sigma -> consS <$> instantiateFull' t <*> instantiateFull' sigma instance InstantiateFull Bool where instantiateFull' = return instance InstantiateFull ConPatternInfo where instantiateFull' (ConPatternInfo mr mt) = ConPatternInfo mr <$> instantiateFull' mt instance InstantiateFull Pattern where instantiateFull' v@VarP{} = return v instantiateFull' (DotP t) = DotP <$> instantiateFull' t instantiateFull' (ConP n mt ps) = ConP n <$> instantiateFull' mt <*> instantiateFull' ps instantiateFull' l@LitP{} = return l instantiateFull' p@ProjP{} = return p instance InstantiateFull ClauseBody where instantiateFull' (Body t) = Body <$> instantiateFull' t instantiateFull' (Bind b) = Bind <$> instantiateFull' b instantiateFull' NoBody = return NoBody instance (Subst t, InstantiateFull t) => InstantiateFull (Abs t) where instantiateFull' a@(Abs x _) = Abs x <$> underAbstraction_ a instantiateFull' instantiateFull' (NoAbs x a) = NoAbs x <$> instantiateFull' a instance InstantiateFull t => InstantiateFull (Arg t) where instantiateFull' = traverse instantiateFull' instance InstantiateFull t => InstantiateFull (Named name t) where instantiateFull' = traverse instantiateFull' instance InstantiateFull t => InstantiateFull (Dom t) where instantiateFull' = traverse instantiateFull' instance InstantiateFull t => InstantiateFull [t] where instantiateFull' = traverse instantiateFull' instance (InstantiateFull a, InstantiateFull b) => InstantiateFull (a,b) where instantiateFull' (x,y) = (,) <$> instantiateFull' x <*> instantiateFull' y instance (InstantiateFull a, InstantiateFull b, InstantiateFull c) => InstantiateFull (a,b,c) where instantiateFull' (x,y,z) = do (x,(y,z)) <- instantiateFull' (x,(y,z)) return (x,y,z) instance InstantiateFull a => InstantiateFull (Closure a) where instantiateFull' cl = do x <- enterClosure cl instantiateFull' return $ cl { clValue = x } instance InstantiateFull ProblemConstraint where instantiateFull' (PConstr p c) = PConstr p <$> instantiateFull' c instance InstantiateFull Constraint where instantiateFull' c = case c of ValueCmp cmp t u v -> do (t,u,v) <- instantiateFull' (t,u,v) return $ ValueCmp cmp t u v ElimCmp cmp t v as bs -> ElimCmp cmp <$> instantiateFull' t <*> instantiateFull' v <*> instantiateFull' as <*> instantiateFull' bs LevelCmp cmp u v -> uncurry (LevelCmp cmp) <$> instantiateFull' (u,v) TypeCmp cmp a b -> uncurry (TypeCmp cmp) <$> instantiateFull' (a,b) TelCmp a b cmp tela telb -> uncurry (TelCmp a b cmp) <$> instantiateFull' (tela,telb) SortCmp cmp a b -> uncurry (SortCmp cmp) <$> instantiateFull' (a,b) Guarded c pid -> Guarded <$> instantiateFull' c <*> pure pid UnBlock m -> return $ UnBlock m FindInScope m cands -> FindInScope m <$> mapM instantiateFull' cands IsEmpty r t -> IsEmpty r <$> instantiateFull' t CheckSizeLtSat t -> CheckSizeLtSat <$> instantiateFull' t instance (InstantiateFull a) => InstantiateFull (Elim' a) where instantiateFull' (Apply v) = Apply <$> instantiateFull' v instantiateFull' (Proj f) = pure $ Proj f instance (Ord k, InstantiateFull e) => InstantiateFull (Map k e) where instantiateFull' = traverse instantiateFull' instance (Eq k, Hashable k, InstantiateFull e) => InstantiateFull (HashMap k e) where instantiateFull' = traverse instantiateFull' instance InstantiateFull ModuleName where instantiateFull' = return instance InstantiateFull Scope where instantiateFull' = return instance InstantiateFull Signature where instantiateFull' (Sig a b c) = uncurry3 Sig <$> instantiateFull' (a, b, c) instance InstantiateFull Section where instantiateFull' (Section tel) = Section <$> instantiateFull' tel instance (Subst a, InstantiateFull a) => InstantiateFull (Tele a) where instantiateFull' EmptyTel = return EmptyTel instantiateFull' (ExtendTel a b) = uncurry ExtendTel <$> instantiateFull' (a, b) instance InstantiateFull Char where instantiateFull' = return instance InstantiateFull Definition where instantiateFull' (Defn rel x t pol occ df i c inst d) = do (t, df, d) <- instantiateFull' (t, df, d) return $ Defn rel x t pol occ df i c inst d instance InstantiateFull NLPat where instantiateFull' (PVar x) = return $ PVar x instantiateFull' (PWild) = return PWild instantiateFull' (PDef x y) = PDef <$> instantiateFull' x <*> instantiateFull' y instantiateFull' (PLam x y) = PLam x <$> instantiateFull' y instantiateFull' (PPi x y) = PPi <$> instantiateFull' x <*> instantiateFull' y instantiateFull' (PBoundVar x y) = PBoundVar x <$> instantiateFull' y instantiateFull' (PTerm x) = PTerm <$> instantiateFull' x instance InstantiateFull RewriteRule where instantiateFull' (RewriteRule q gamma lhs rhs t) = RewriteRule q <$> instantiateFull' gamma <*> instantiateFull' lhs <*> instantiateFull' rhs <*> instantiateFull' t instance InstantiateFull a => InstantiateFull (Open a) where instantiateFull' (OpenThing n a) = OpenThing n <$> instantiateFull' a instance InstantiateFull DisplayForm where instantiateFull' (Display n ps v) = uncurry (Display n) <$> instantiateFull' (ps, v) instance InstantiateFull DisplayTerm where instantiateFull' (DTerm v) = DTerm <$> instantiateFull' v instantiateFull' (DDot v) = DDot <$> instantiateFull' v instantiateFull' (DCon c vs) = DCon c <$> instantiateFull' vs instantiateFull' (DDef c es) = DDef c <$> instantiateFull' es instantiateFull' (DWithApp v vs ws) = uncurry3 DWithApp <$> instantiateFull' (v, vs, ws) instance InstantiateFull Defn where instantiateFull' d = case d of Axiom{} -> return d Function{ funClauses = cs, funCompiled = cc, funInv = inv } -> do (cs, cc, inv) <- instantiateFull' (cs, cc, inv) return $ d { funClauses = cs, funCompiled = cc, funInv = inv } Datatype{ dataSort = s, dataClause = cl } -> do s <- instantiateFull' s cl <- instantiateFull' cl return $ d { dataSort = s, dataClause = cl } Record{ recConType = t, recClause = cl, recTel = tel } -> do t <- instantiateFull' t cl <- instantiateFull' cl tel <- instantiateFull' tel return $ d { recConType = t, recClause = cl, recTel = tel } Constructor{} -> return d Primitive{ primClauses = cs } -> do cs <- instantiateFull' cs return $ d { primClauses = cs } instance InstantiateFull FunctionInverse where instantiateFull' NotInjective = return NotInjective instantiateFull' (Inverse inv) = Inverse <$> instantiateFull' inv instance InstantiateFull a => InstantiateFull (WithArity a) where instantiateFull' (WithArity n a) = WithArity n <$> instantiateFull' a instance InstantiateFull a => InstantiateFull (Case a) where instantiateFull' (Branches cop cs ls m) = Branches cop <$> instantiateFull' cs <*> instantiateFull' ls <*> instantiateFull' m instance InstantiateFull CompiledClauses where instantiateFull' Fail = return Fail instantiateFull' (Done m t) = Done m <$> instantiateFull' t instantiateFull' (Case n bs) = Case n <$> instantiateFull' bs instance InstantiateFull Clause where instantiateFull' (Clause r tel perm ps b t) = Clause r <$> instantiateFull' tel <*> return perm <*> instantiateFull' ps <*> instantiateFull' b <*> instantiateFull' t instance InstantiateFull Interface where instantiateFull' (Interface h ms mod scope inside sig b hsImports highlighting pragmas patsyns) = Interface h ms mod scope inside <$> instantiateFull' sig <*> instantiateFull' b <*> return hsImports <*> return highlighting <*> return pragmas <*> return patsyns instance InstantiateFull a => InstantiateFull (Builtin a) where instantiateFull' (Builtin t) = Builtin <$> instantiateFull' t instantiateFull' (Prim x) = Prim <$> instantiateFull' x instance InstantiateFull QName where instantiateFull' = return instance InstantiateFull a => InstantiateFull (Maybe a) where instantiateFull' = mapM instantiateFull' Agda-2.4.2.5/src/full/Agda/TypeChecking/Constraints.hs-boot0000644000000000000000000000060512635075266021467 0ustar0000000000000000module Agda.TypeChecking.Constraints where import Agda.TypeChecking.Monad.Base addConstraint :: Constraint -> TCM () catchConstraint :: Constraint -> TCM () -> TCM () solveConstraint :: Constraint -> TCM () solveAwakeConstraints' :: Bool -> TCM () noConstraints :: TCM a -> TCM a ifNoConstraints_ :: TCM () -> TCM a -> (ProblemId -> TCM a) -> TCM a Agda-2.4.2.5/src/full/Agda/TypeChecking/Datatypes.hs0000644000000000000000000001421112635075266020153 0ustar0000000000000000{-# LANGUAGE CPP #-} module Agda.TypeChecking.Datatypes where import Control.Applicative ((<$>)) import Data.Maybe (fromMaybe) import Agda.Syntax.Common import Agda.Syntax.Position import Agda.Syntax.Internal as I import Agda.TypeChecking.Monad import Agda.TypeChecking.Monad.Builtin (constructorForm) import Agda.TypeChecking.Telescope import Agda.TypeChecking.Substitute import Agda.Utils.Size #include "undefined.h" import Agda.Utils.Impossible --------------------------------------------------------------------------- -- * Constructors --------------------------------------------------------------------------- -- | Get true constructor with record fields. getConHead :: QName -> TCM ConHead getConHead c = conSrcCon . theDef <$> getConstInfo c -- | Get true constructor as term. getConTerm :: QName -> TCM Term getConTerm c = flip Con [] <$> getConHead c -- | Get true constructor with fields, expanding literals to constructors -- if possible. getConForm :: QName -> TCM ConHead getConForm c = do Con con [] <- ignoreSharing <$> do constructorForm =<< getConTerm c return con -- | Augment constructor with record fields (preserve constructor name). -- The true constructor might only surface via 'reduce'. getOrigConHead :: QName -> TCM ConHead getOrigConHead c = setConName c <$> getConHead c -- | Analogous to 'getConTerm'. getOrigConTerm :: QName -> TCM Term getOrigConTerm c = flip Con [] <$> getOrigConHead c -- | Get the name of the datatype constructed by a given constructor. -- Precondition: The argument must refer to a constructor {-# SPECIALIZE getConstructorData :: QName -> TCM QName #-} getConstructorData :: HasConstInfo m => QName -> m QName getConstructorData c = do def <- getConstInfo c case theDef def of Constructor{conData = d} -> return d _ -> __IMPOSSIBLE__ -- | @getConType c t@ computes the constructor parameters from type @t@ -- and returns the instantiated type of constructor @c@. -- @Nothing@ if @t@ is not a data/record type or does not have -- a constructor @c@. -- Precondition: @t@ is reduced. getConType :: ConHead -> Type -> TCM (Maybe Type) getConType c t = do c <- getConHead $ conName c case ignoreSharing $ unEl t of Def d es -> do def <- theDef <$> getConstInfo d case def of Datatype { dataPars = n, dataCons = cs } | conName c `elem` cs -> cont n Record { recPars = n, recConHead = con } | c == con -> cont n _ -> return Nothing where cont n = do let pars = fromMaybe __IMPOSSIBLE__ $ allApplyElims $ take n es Just . (`apply` pars) . defType <$> getConInfo c _ -> return Nothing -- | Return the number of non-parameter arguments to a data constructor, -- or the field names of a record constructor. -- -- For getting just the arity of constructor @c@, -- use @either id size <$> getConstructorArity c@. getConstructorArity :: QName -> TCM (Either Nat [I.Arg QName]) getConstructorArity c = do Defn{ defType = t, theDef = def } <- getConstInfo c case def of Constructor{ conData = d, conPars = n } -> do def <- theDef <$> getConstInfo d case def of Record{ recFields = fs } -> return $ Right fs Datatype{} -> do -- TODO: I do not want to take the type of constructor apart -- to see its arity! TelV tel _ <- telView t return $ Left $ size tel - n _ -> __IMPOSSIBLE__ _ -> __IMPOSSIBLE__ --------------------------------------------------------------------------- -- * Data types --------------------------------------------------------------------------- -- | Check if a name refers to a datatype or a record with a named constructor. isDatatype :: QName -> TCM Bool isDatatype d = do def <- getConstInfo d case theDef def of Datatype{} -> return True Record{recNamedCon = namedC} -> return namedC _ -> return False data DataOrRecord = IsData | IsRecord deriving (Eq, Ord, Show) -- | Check if a name refers to a datatype or a record. isDataOrRecordType :: QName -> TCM (Maybe DataOrRecord) isDataOrRecordType d = do def <- getConstInfo d case theDef def of Datatype{} -> return $ Just IsData Record{} -> return $ Just IsRecord _ -> return $ Nothing -- | Precodition: 'Term' is 'reduce'd. isDataOrRecord :: Term -> TCM (Maybe QName) isDataOrRecord v = do case ignoreSharing v of Def d _ -> fmap (const d) <$> isDataOrRecordType d _ -> return Nothing getNumberOfParameters :: QName -> TCM (Maybe Nat) getNumberOfParameters d = do def <- getConstInfo d case theDef def of Datatype{ dataPars = n} -> return $ Just n Record{ recPars = n} -> return $ Just n _ -> return Nothing {- UNUSED data DatatypeInfo = DataInfo { datatypeName :: QName , datatypeParTel :: Telescope , datatypePars :: Args , datatypeIxTel :: Telescope , datatypeIxs :: Args } -- | Get the name and parameters from a type if it's a datatype or record type -- with a named constructor. getDatatypeInfo :: Type -> TCM (Maybe DatatypeInfo) getDatatypeInfo t = do t <- reduce t case unEl t of Def d args -> do n <- getDefFreeVars d args <- return $ genericDrop n args def <- instantiateDef =<< getConstInfo d TelV tel _ <- telView (defType def) let npars = case theDef def of Datatype{dataPars = np} -> Just np Record{recPars = np, recNamedCon = True} | genericLength args == np -> Just np | otherwise -> __IMPOSSIBLE__ _ -> Nothing return $ do np <- npars let (pt, it) = genericSplitAt np $ telToList tel parTel = telFromList pt ixTel = telFromList it (ps, is) = genericSplitAt np args return $ DataInfo { datatypeName = d , datatypeParTel = parTel , datatypePars = ps , datatypeIxTel = ixTel , datatypeIxs = is } _ -> return Nothing -} Agda-2.4.2.5/src/full/Agda/TypeChecking/Records.hs0000644000000000000000000005126112635075266017624 0ustar0000000000000000{-# LANGUAGE CPP #-} {-# LANGUAGE PatternGuards #-} {-# LANGUAGE TupleSections #-} module Agda.TypeChecking.Records where -- import Control.Applicative import Control.Monad import Data.Function import Data.List import Data.Maybe import qualified Data.Set as Set import Agda.Syntax.Common import qualified Agda.Syntax.Concrete.Name as C import Agda.Syntax.Abstract.Name import Agda.Syntax.Internal as I import Agda.Syntax.Position import Agda.TypeChecking.Monad import Agda.TypeChecking.Substitute import Agda.TypeChecking.Pretty import Agda.TypeChecking.Reduce import Agda.TypeChecking.Reduce.Monad () import Agda.TypeChecking.Telescope import Agda.Utils.Either import Agda.Utils.Functor (for, ($>)) import Agda.Utils.Lens import Agda.Utils.List import Agda.Utils.Maybe import Agda.Utils.Monad import Agda.Utils.Null import qualified Agda.Utils.HashMap as HMap import Agda.Utils.Pretty (prettyShow) import Agda.Utils.Size #include "undefined.h" import Agda.Utils.Impossible -- | Order the fields of a record construction. -- Use the second argument for missing fields. orderFields :: QName -> a -> [C.Name] -> [(C.Name, a)] -> TCM [a] orderFields r def xs fs = do unlessNull (ys \\ nub ys) $ typeError . DuplicateFields . nub unlessNull (ys \\ xs) $ typeError . TooManyFields r -- shouldBeNull (xs \\ ys) $ TooFewFields r return $ order xs fs where ys = map fst fs -- invariant: the first list contains at least the fields of the second list order [] [] = [] order [] _ = __IMPOSSIBLE__ order (x : xs) ys = case lookup x (assocHoles ys) of Just (e, ys') -> e : order xs ys' Nothing -> def : order xs ys assocHoles xs = [ (x, (v, xs')) | ((x, v), xs') <- holes xs ] -- | The name of the module corresponding to a record. recordModule :: QName -> ModuleName recordModule = mnameFromList . qnameToList -- | Get the definition for a record. Throws an exception if the name -- does not refer to a record or the record is abstract. getRecordDef :: QName -> TCM Defn getRecordDef r = maybe err return =<< isRecord r where err = typeError $ ShouldBeRecordType (El Prop $ Def r []) -- | Get the record name belonging to a field name. getRecordOfField :: QName -> TCM (Maybe QName) getRecordOfField d = maybe Nothing fromP <$> isProjection d where fromP Projection{ projProper = mp, projFromType = r} = mp $> r -- | Get the field names of a record. getRecordFieldNames :: QName -> TCM [I.Arg C.Name] getRecordFieldNames r = recordFieldNames <$> getRecordDef r recordFieldNames :: Defn -> [I.Arg C.Name] recordFieldNames = map (fmap (nameConcrete . qnameName)) . recFields -- | Find all records with at least the given fields. findPossibleRecords :: [C.Name] -> TCM [QName] findPossibleRecords fields = do defs <- (HMap.union `on` (^. sigDefinitions)) <$> getSignature <*> getImportedSignature let possible def = case theDef def of Record{ recFields = fs } -> Set.isSubsetOf given inrecord where inrecord = Set.fromList $ map (nameConcrete . qnameName . unArg) fs _ -> False return [ defName d | d <- HMap.elems defs, possible d ] where given = Set.fromList fields -- | Get the field types of a record. getRecordFieldTypes :: QName -> TCM Telescope getRecordFieldTypes r = recTel <$> getRecordDef r -- | Get the field names belonging to a record type. getRecordTypeFields :: Type -> TCM [I.Arg QName] getRecordTypeFields t = case ignoreSharing $ unEl t of Def r _ -> do rDef <- theDef <$> getConstInfo r case rDef of Record { recFields = fields } -> return fields _ -> __IMPOSSIBLE__ _ -> __IMPOSSIBLE__ -- | Get the original name of the projection -- (the current one could be from a module application). getOriginalProjection :: QName -> TCM QName getOriginalProjection q = do proj <- fromMaybe __IMPOSSIBLE__ <$> isProjection q return $ fromMaybe __IMPOSSIBLE__ $ projProper proj -- | Get the type of the record constructor. getRecordConstructorType :: QName -> TCM Type getRecordConstructorType r = recConType <$> getRecordDef r -- | Returns the given record type's constructor name (with an empty -- range). getRecordConstructor :: QName -> TCM ConHead getRecordConstructor r = killRange <$> recConHead <$> getRecordDef r -- | Check if a name refers to a record. -- If yes, return record definition. {-# SPECIALIZE isRecord :: QName -> TCM (Maybe Defn) #-} {-# SPECIALIZE isRecord :: QName -> ReduceM (Maybe Defn) #-} isRecord :: HasConstInfo m => QName -> m (Maybe Defn) isRecord r = do def <- theDef <$> getConstInfo r return $ case def of Record{} -> Just def _ -> Nothing -- | Reduce a type and check whether it is a record type. -- Succeeds only if type is not blocked by a meta var. -- If yes, return its name, parameters, and definition. isRecordType :: Type -> TCM (Maybe (QName, Args, Defn)) isRecordType t = either (const Nothing) Just <$> tryRecordType t -- | Reduce a type and check whether it is a record type. -- Succeeds only if type is not blocked by a meta var. -- If yes, return its name, parameters, and definition. -- If no, return the reduced type (unless it is blocked). tryRecordType :: Type -> TCM (Either (Maybe Type) (QName, Args, Defn)) tryRecordType t = ifBlockedType t (\ _ _ -> return $ Left Nothing) $ \ t -> do let no = return $ Left $ Just t case ignoreSharing $ unEl t of Def r es -> do let vs = fromMaybe __IMPOSSIBLE__ $ allApplyElims es caseMaybeM (isRecord r) no $ \ def -> return $ Right (r,vs,def) _ -> no -- | The analogue of 'piApply'. If @v@ is a value of record type @t@ -- with field @f@, then @projectTyped v t f@ returns the type of @f v@. -- -- Works also for projection-like definitions @f@. -- -- Precondition: @t@ is reduced. projectTyped :: Term -> Type -> QName -> TCM (Maybe (Term, Type)) projectTyped v t f = caseMaybeM (getDefType f t) (return Nothing) $ \ tf -> do (dom, b) <- mustBePi tf u <- f `applyDef` (argFromDom dom $> v) return $ Just (u, b `absApp` v) -- | Check if a name refers to an eta expandable record. {-# SPECIALIZE isEtaRecord :: QName -> TCM Bool #-} {-# SPECIALIZE isEtaRecord :: QName -> ReduceM Bool #-} isEtaRecord :: HasConstInfo m => QName -> m Bool isEtaRecord r = maybe False recEtaEquality <$> isRecord r isEtaCon :: HasConstInfo m => QName -> m Bool isEtaCon c = do cdef <- theDef <$> getConstInfo c case cdef of Constructor {conData = r} -> isEtaRecord r _ -> return False -- | Check if a name refers to a record which is not coinductive. (Projections are then size-preserving) isInductiveRecord :: QName -> TCM Bool isInductiveRecord r = maybe False (\ d -> recInduction d /= Just CoInductive || not (recRecursive d)) <$> isRecord r -- | Check if a type is an eta expandable record and return the record identifier and the parameters. isEtaRecordType :: Type -> TCM (Maybe (QName, Args)) isEtaRecordType a = case ignoreSharing $ unEl a of Def d es -> do let vs = fromMaybe __IMPOSSIBLE__ $ allApplyElims es ifM (isEtaRecord d) (return $ Just (d, vs)) (return Nothing) _ -> return Nothing -- | Check if a name refers to a record constructor. -- If yes, return record definition. isRecordConstructor :: MonadTCM tcm => QName -> tcm (Maybe (QName, Defn)) isRecordConstructor c = liftTCM $ do def <- theDef <$> getConstInfo c case def of Constructor{ conData = r } -> fmap (r,) <$> isRecord r _ -> return Nothing -- | Check if a constructor name is the internally generated record constructor. isGeneratedRecordConstructor :: QName -> TCM Bool isGeneratedRecordConstructor c = do def <- theDef <$> getConstInfo c case def of Constructor{ conData = r } -> do def <- theDef <$> getConstInfo r case def of Record{ recNamedCon = False } -> return True _ -> return False _ -> return False -- | Mark record type as unguarded. -- No eta-expansion. Projections do not preserve guardedness. unguardedRecord :: QName -> TCM () unguardedRecord q = modifySignature $ updateDefinition q $ updateTheDef $ updateRecord where updateRecord r@Record{} = r { recEtaEquality = False, recRecursive = True } updateRecord _ = __IMPOSSIBLE__ -- | Mark record type as recursive. -- Projections do not preserve guardedness. recursiveRecord :: QName -> TCM () recursiveRecord q = modifySignature $ updateDefinition q $ updateTheDef $ updateRecord where updateRecord r@Record{} = r { recRecursive = True } updateRecord _ = __IMPOSSIBLE__ -- | Check whether record type is marked as recursive. -- -- Precondition: record type identifier exists in signature. isRecursiveRecord :: QName -> TCM Bool isRecursiveRecord q = recRecursive_ . theDef . fromMaybe __IMPOSSIBLE__ . lookupDefinition q <$> getSignature -- | Version of @recRecursive@ with proper internal error. recRecursive_ :: Defn -> Bool recRecursive_ (Record { recRecursive = b }) = b recRecursive_ _ = __IMPOSSIBLE__ {- | @etaExpandBoundVar i = (Δ, σ, τ)@ Precondition: The current context is @Γ = Γ₁, x:R pars, Γ₂@ where @|Γ₂| = i@ and @R@ is a eta-expandable record type with constructor @c@ and fields @Γ'@. Postcondition: @Δ = Γ₁, Γ', Γ₂[c Γ']@ and @Γ ⊢ σ : Δ@ and @Δ ⊢ τ : Γ@. -} etaExpandBoundVar :: Int -> TCM (Maybe (Telescope, Substitution, Substitution)) etaExpandBoundVar i = fmap (\ (delta, sigma, tau, _) -> (delta, sigma, tau)) <$> do expandRecordVar i =<< getContextTelescope -- | @expandRecordVar i Γ = (Δ, σ, τ, Γ')@ -- -- Precondition: @Γ = Γ₁, x:R pars, Γ₂@ where -- @|Γ₂| = i@ and @R@ is a eta-expandable record type -- with constructor @c@ and fields @Γ'@. -- -- Postcondition: @Δ = Γ₁, Γ', Γ₂[c Γ']@ and @Γ ⊢ σ : Δ@ and @Δ ⊢ τ : Γ@. expandRecordVar :: Int -> Telescope -> TCM (Maybe (Telescope, Substitution, Substitution, Telescope)) expandRecordVar i gamma0 = do -- Get the context with last variable added last in list. let gamma = telToList gamma0 -- Convert the de Bruijn index i to a de Bruijn level l = size gamma - 1 - i -- Extract type of @i@th de Bruijn index. -- Γ = Γ₁, x:a, Γ₂ let (gamma1, dom@(Dom ai (x, a)) : gamma2) = splitAt l gamma -- This must be a eta-expandable record type. let failure = do reportSDoc "tc.meta.assign.proj" 25 $ text "failed to eta-expand variable " <+> pretty x <+> text " since its type " <+> prettyTCM a <+> text " is not a record type" return Nothing caseMaybeM (isRecordType a) failure $ \ (r, pars, def) -> do if not (recEtaEquality def) then return Nothing else Just <$> do -- Get the record fields @Γ₁ ⊢ tel@ (@tel = Γ'@). -- TODO: compose argInfo ai with tel. let tel = recTel def `apply` pars m = size tel fs = recFields def -- Construct the record pattern @Γ₁, Γ' ⊢ u := c ys@. ys = zipWith (\ f i -> f $> var i) fs $ downFrom m u = Con (recConHead def) ys -- @Γ₁, Γ' ⊢ τ₀ : Γ₁, x:_@ tau0 = consS u $ raiseS m -- @Γ₁, Γ', Γ₂ ⊢ τ₀ : Γ₁, x:_, Γ₂@ tau = liftS (size gamma2) tau0 -- Fields are in order first-first. zs = for fs $ fmap $ \ f -> Var 0 [Proj f] -- We need to reverse the field sequence to build the substitution. -- @Γ₁, x:_ ⊢ σ₀ : Γ₁, Γ'@ sigma0 = reverse (map unArg zs) ++# raiseS 1 -- @Γ₁, x:_, Γ₂ ⊢ σ₀ : Γ₁, Γ', Γ₂@ sigma = liftS (size gamma2) sigma0 -- Construct @Δ@ as telescope. -- Note @Γ₁, x:_ ⊢ Γ₂@, thus, @Γ₁, Γ' ⊢ [τ₀]Γ₂@ -- Use "f(x)" as variable name for the projection f(x). s = prettyShow x tel' = mapAbsNames (\ f -> stringToArgName $ argNameToString f ++ "(" ++ s ++ ")") tel delta = telFromList $ gamma1 ++ telToList tel' ++ applySubst tau0 gamma2 return (delta, sigma, tau, tel) -- | Precondition: variable list is ordered descendingly. Can be empty. expandRecordVarsRecursively :: [Int] -> Telescope -> TCM (Telescope, Substitution, Substitution) expandRecordVarsRecursively [] gamma = return (gamma, idS, idS) expandRecordVarsRecursively (i : is) gamma = do caseMaybeM (expandRecordVar i gamma) (expandRecordVarsRecursively is gamma) $ \ (gamma1, sigma1, tau1, tel) -> do -- Γ ⊢ σ₁ : Γ₁ and Γ₁ ⊢ τ₁ : Γ let n = size tel newis = take n $ downFrom $ i + n (gamma2, sigma2, tau2) <- expandRecordVarsRecursively (newis ++ is) gamma1 -- Γ₁ ⊢ σ₂ : Γ₂ and Γ₂ ⊢ τ₂ : Γ₁ return (gamma2, applySubst sigma1 sigma2, applySubst tau2 tau1) -- | @curryAt v (Γ (y : R pars) -> B) n = -- ( \ v -> λ Γ ys → v Γ (c ys) {- curry -} -- , \ v -> λ Γ y → v Γ (p1 y) ... (pm y) {- uncurry -} -- , Γ (ys : As) → B[c ys / y] -- )@ -- -- where @n = size Γ@. curryAt :: Type -> Int -> TCM (Term -> Term, Term -> Term, Type) curryAt t n = do -- first, strip the leading n domains (which remain unchanged) TelV gamma core <- telViewUpTo n t case ignoreSharing $ unEl core of -- There should be at least one domain left Pi (Dom ai a) b -> do -- Eta-expand @dom@ along @qs@ into a telescope @tel@, computing a substitution. -- For now, we only eta-expand once. -- This might trigger another call to @etaExpandProjectedVar@ later. -- A more efficient version does all the eta-expansions at once here. (r, pars, def) <- fromMaybe __IMPOSSIBLE__ <$> isRecordType a unless (recEtaEquality def) __IMPOSSIBLE__ -- TODO: compose argInfo ai with tel. let tel = recTel def `apply` pars m = size tel fs = recFields def ys = zipWith (\ f i -> f $> var i) fs $ downFrom m u = Con (recConHead def) ys b' = raise m b `absApp` u t' = gamma `telePi` (tel `telePi` b') gammai = map domInfo $ telToList gamma xs = reverse $ zipWith (\ ai i -> Arg ai $ var i) gammai [m..] curry v = teleLam gamma $ teleLam tel $ raise (n+m) v `apply` (xs ++ [Arg ai u]) zs = for fs $ fmap $ \ f -> Var 0 [Proj f] atel = sgTel $ Dom ai (absName b, a) uncurry v = teleLam gamma $ teleLam atel $ raise (n + 1) v `apply` (xs ++ zs) return (curry, uncurry, t') _ -> __IMPOSSIBLE__ {-| @etaExpand r pars u@ computes the eta expansion of record value @u@ at record type @r pars@. The first argument @r@ should be the name of a record type. Given @record R : Set where field x : A; y : B; .z : C@ and @r : R@, @etaExpand R [] r = (tel, [R.x r, R.y r, R.z r])@ where @tel@ is the record telescope instantiated at the parameters @pars@. -} etaExpandRecord :: QName -> Args -> Term -> TCM (Telescope, Args) etaExpandRecord r pars u = do def <- getRecordDef r (tel, _, args) <- etaExpandRecord_ r pars def u return (tel, args) etaExpandRecord_ :: QName -> Args -> Defn -> Term -> TCM (Telescope, ConHead, Args) etaExpandRecord_ r pars def u = do let Record{ recConHead = con , recFields = xs , recTel = tel , recEtaEquality = eta } = def tel' = apply tel pars unless eta __IMPOSSIBLE__ -- make sure we do not expand non-eta records case ignoreSharing u of -- Already expanded. Con con_ args -> do when (con /= con_) __IMPOSSIBLE__ return (tel', con, args) -- Not yet expanded. _ -> do let xs' = for xs $ fmap $ \ x -> u `applyE` [Proj x] {- recFields are always the original projections -- Andreas, 2013-10-22 call applyDef to make sure we get the original proj. -- xs' <- mapM (traverse (`applyDef` defaultArg u)) xs -} reportSDoc "tc.record.eta" 20 $ vcat [ text "eta expanding" <+> prettyTCM u <+> text ":" <+> prettyTCM r , nest 2 $ vcat [ text "tel' =" <+> prettyTCM tel' , text "args =" <+> prettyTCM xs' ] ] return (tel', con, xs') etaExpandAtRecordType :: Type -> Term -> TCM (Telescope, Term) etaExpandAtRecordType t u = do (r, pars, def) <- fromMaybe __IMPOSSIBLE__ <$> isRecordType t (tel, con, args) <- etaExpandRecord_ r pars def u return (tel, Con con args) -- | The fields should be eta contracted already. -- -- We can eta contract if all fields @f = ...@ are irrelevant -- or all fields @f@ are the projection @f v@ of the same value @v@, -- but we need at least one relevant field to find the value @v@. -- -- TODO: this can be moved out of TCM (but only if ConHead -- stores also the Arg-decoration of the record fields. {-# SPECIALIZE etaContractRecord :: QName -> ConHead -> Args -> TCM Term #-} {-# SPECIALIZE etaContractRecord :: QName -> ConHead -> Args -> ReduceM Term #-} etaContractRecord :: HasConstInfo m => QName -> ConHead -> Args -> m Term etaContractRecord r c args = do Just Record{ recFields = xs } <- isRecord r let check :: I.Arg Term -> I.Arg QName -> Maybe (Maybe Term) check a ax = do -- @a@ is the constructor argument, @ax@ the corr. record field name -- skip irrelevant record fields by returning DontCare case (getRelevance a, hasElims $ unArg a) of (Irrelevant, _) -> Just Nothing -- if @a@ is the record field name applied to a single argument -- then it passes the check (_, Just (_, [])) -> Nothing -- not a projection (_, Just (h, es)) | Proj f <- last es, unArg ax == f -> Just $ Just $ h $ init es _ -> Nothing fallBack = return (Con c args) case compare (length args) (length xs) of LT -> fallBack -- Not fully applied GT -> __IMPOSSIBLE__ -- Too many arguments. Impossible. EQ -> do case zipWithM check args xs of Just as -> case [ a | Just a <- as ] of (a:as) -> if all (a ==) as then return a else fallBack _ -> fallBack -- just irrelevant terms _ -> fallBack -- a Nothing -- | Is the type a hereditarily singleton record type? May return a -- blocking metavariable. -- -- Precondition: The name should refer to a record type, and the -- arguments should be the parameters to the type. isSingletonRecord :: QName -> Args -> TCM (Either MetaId Bool) isSingletonRecord r ps = mapRight isJust <$> isSingletonRecord' False r ps isSingletonRecordModuloRelevance :: QName -> Args -> TCM (Either MetaId Bool) isSingletonRecordModuloRelevance r ps = mapRight isJust <$> isSingletonRecord' True r ps -- | Return the unique (closed) inhabitant if exists. -- In case of counting irrelevance in, the returned inhabitant -- contains garbage. isSingletonRecord' :: Bool -> QName -> Args -> TCM (Either MetaId (Maybe Term)) isSingletonRecord' regardIrrelevance r ps = do reportSLn "tc.meta.eta" 30 $ "Is " ++ show r ++ " a singleton record type?" def <- getRecordDef r emap (Con $ recConHead def) <$> check (recTel def `apply` ps) where check :: Telescope -> TCM (Either MetaId (Maybe [I.Arg Term])) check tel = do reportSDoc "tc.meta.eta" 30 $ text "isSingletonRecord' checking telescope " <+> prettyTCM tel case tel of EmptyTel -> return $ Right $ Just [] ExtendTel dom tel | isIrrelevant dom && regardIrrelevance -> do underAbstraction dom tel $ \ tel -> emap (Arg (domInfo dom) garbage :) <$> check tel | otherwise -> do isSing <- isSingletonType' regardIrrelevance $ unDom dom case isSing of Left mid -> return $ Left mid Right Nothing -> return $ Right Nothing Right (Just v) -> underAbstraction dom tel $ \ tel -> emap (Arg (domInfo dom) v :) <$> check tel garbage :: Term garbage = Sort Prop -- | Check whether a type has a unique inhabitant and return it. -- Can be blocked by a metavar. isSingletonType :: Type -> TCM (Either MetaId (Maybe Term)) isSingletonType = isSingletonType' False -- | Check whether a type has a unique inhabitant (irrelevant parts ignored). -- Can be blocked by a metavar. isSingletonTypeModuloRelevance :: (MonadTCM tcm) => Type -> tcm (Either MetaId Bool) isSingletonTypeModuloRelevance t = liftTCM $ do mapRight isJust <$> isSingletonType' True t isSingletonType' :: Bool -> Type -> TCM (Either MetaId (Maybe Term)) isSingletonType' regardIrrelevance t = do TelV tel t <- telView t ifBlockedType t (\ m _ -> return $ Left m) $ \ t -> do res <- isRecordType t case res of Just (r, ps, def) | recEtaEquality def -> do emap (abstract tel) <$> isSingletonRecord' regardIrrelevance r ps _ -> return $ Right Nothing -- | Auxiliary function. emap :: (a -> b) -> Either c (Maybe a) -> Either c (Maybe b) emap = mapRight . fmap Agda-2.4.2.5/src/full/Agda/TypeChecking/Conversion.hs0000644000000000000000000015601512635075266020353 0ustar0000000000000000{-# LANGUAGE CPP #-} {-# LANGUAGE FlexibleInstances #-} {-# LANGUAGE PatternGuards #-} #if __GLASGOW_HASKELL__ >= 710 {-# LANGUAGE FlexibleContexts #-} #endif module Agda.TypeChecking.Conversion where import Control.Applicative import Control.Monad import Control.Monad.Reader import Control.Monad.State import Data.List hiding (sort) import qualified Data.List as List import Data.Traversable hiding (mapM, sequence) import Agda.Syntax.Abstract.Views (isSet) import Agda.Syntax.Common import Agda.Syntax.Internal import Agda.Syntax.Translation.InternalToAbstract (reify) import Agda.TypeChecking.Monad import Agda.TypeChecking.Monad.Builtin (constructorForm) import Agda.TypeChecking.CompiledClause (CompiledClauses(Fail)) import Agda.TypeChecking.MetaVars import Agda.TypeChecking.MetaVars.Occurs (killArgs,PruneResult(..)) import Agda.TypeChecking.Reduce import Agda.TypeChecking.Substitute import qualified Agda.TypeChecking.SyntacticEquality as SynEq import Agda.TypeChecking.Telescope import Agda.TypeChecking.Constraints import {-# SOURCE #-} Agda.TypeChecking.CheckInternal (infer) import Agda.TypeChecking.Errors import Agda.TypeChecking.Free import Agda.TypeChecking.Datatypes (getConType) import Agda.TypeChecking.Records import Agda.TypeChecking.Pretty import Agda.TypeChecking.Injectivity import Agda.TypeChecking.Polarity import Agda.TypeChecking.SizedTypes import Agda.TypeChecking.Level import Agda.TypeChecking.Implicit (implicitArgs) import Agda.TypeChecking.Irrelevance import Agda.TypeChecking.ProjectionLike (elimView) import Agda.Interaction.Options import Agda.Utils.Except ( MonadError(catchError, throwError) ) import Agda.Utils.Functor import Agda.Utils.Monad import Agda.Utils.Maybe import Agda.Utils.Size import Agda.Utils.Tuple #include "undefined.h" import Agda.Utils.Impossible {- MOVED to TypeChecking.Level mlevel :: TCM (Maybe Term) mlevel = liftTCM $ (Just <$> primLevel) `catchError` \_ -> return Nothing -} -- | Try whether a computation runs without errors or new constraints -- (may create new metas, though). -- Restores state upon failure. tryConversion :: TCM () -> TCM Bool tryConversion = isJust <.> tryConversion' -- | Try whether a computation runs without errors or new constraints -- (may create new metas, though). -- Return 'Just' the result upon success. -- Return 'Nothing' and restore state upon failure. tryConversion' :: TCM a -> TCM (Maybe a) tryConversion' m = (Just <$> do disableDestructiveUpdate $ noConstraints m) `catchError` \ _ -> return Nothing -- | Check if to lists of arguments are the same (and all variables). -- Precondition: the lists have the same length. sameVars :: Elims -> Elims -> Bool sameVars xs ys = and $ zipWith same xs ys where same (Apply (Arg _ (Var n []))) (Apply (Arg _ (Var m []))) = n == m same _ _ = False -- | @intersectVars us vs@ checks whether all relevant elements in @us@ and @vs@ -- are variables, and if yes, returns a prune list which says @True@ for -- arguments which are different and can be pruned. intersectVars :: Elims -> Elims -> Maybe [Bool] intersectVars = zipWithM areVars where -- ignore irrelevant args areVars (Apply u) v | isIrrelevant u = Just False -- do not prune areVars (Apply (Arg _ (Var n []))) (Apply (Arg _ (Var m []))) = Just $ n /= m -- prune different vars areVars _ _ = Nothing equalTerm :: Type -> Term -> Term -> TCM () equalTerm = compareTerm CmpEq equalAtom :: Type -> Term -> Term -> TCM () equalAtom = compareAtom CmpEq equalType :: Type -> Type -> TCM () equalType = compareType CmpEq {- Comparing in irrelevant context always succeeds. However, we might want to dig for solutions of irrelevant metas. To this end, we can just ignore errors during conversion checking. -} -- convError :: MonadTCM tcm => TypeError -> tcm a -- | Ignore errors in irrelevant context. convError :: TypeError -> TCM () convError err = ifM ((==) Irrelevant <$> asks envRelevance) (return ()) $ typeError err -- | Type directed equality on values. -- compareTerm :: Comparison -> Type -> Term -> Term -> TCM () -- If one term is a meta, try to instantiate right away. This avoids unnecessary unfolding. -- Andreas, 2012-02-14: This is UNSOUND for subtyping! compareTerm cmp a u v = do reportSDoc "tc.conv.term" 10 $ sep [ text "compareTerm" , nest 2 $ prettyTCM u <+> prettyTCM cmp <+> prettyTCM v , nest 2 $ text ":" <+> prettyTCM a ] -- Check syntactic equality first. This actually saves us quite a bit of work. ((u, v), equal) <- SynEq.checkSyntacticEquality u v -- OLD CODE, traverses the *full* terms u v at each step, even if they -- are different somewhere. Leads to infeasibility in issue 854. -- (u, v) <- instantiateFull (u, v) -- let equal = u == v if equal then unifyPointers cmp u v $ verboseS "profile.sharing" 20 $ tick "equal terms" else do verboseS "profile.sharing" 20 $ tick "unequal terms" let checkPointerEquality def | not $ null $ List.intersect (pointerChain u) (pointerChain v) = do verboseS "profile.sharing" 10 $ tick "pointer equality" return () checkPointerEquality def = def checkPointerEquality $ do reportSDoc "tc.conv.term" 15 $ sep [ text "compareTerm (not syntactically equal)" , nest 2 $ prettyTCM u <+> prettyTCM cmp <+> prettyTCM v , nest 2 $ text ":" <+> prettyTCM a ] -- If we are at type Size, we cannot short-cut comparison -- against metas by assignment. -- Andreas, 2014-04-12: this looks incomplete. -- It seems to assume we are never comparing -- at function types into Size. let fallback = compareTerm' cmp a u v unlessSubtyping cont = if cmp == CmpEq then cont else do -- Andreas, 2014-04-12 do not short cut if type is blocked. ifBlockedType a (\ _ _ -> fallback) {-else-} $ \ a -> do -- do not short circuit size comparison! caseMaybeM (isSizeType a) cont (\ _ -> fallback) dir = fromCmp cmp rid = flipCmp dir -- The reverse direction. Bad name, I know. case (ignoreSharing u, ignoreSharing v) of (MetaV x us, MetaV y vs) | x /= y -> unlessSubtyping $ solve1 `orelse` solve2 `orelse` compareTerm' cmp a u v | otherwise -> fallback where (solve1, solve2) | x > y = (assign dir x us v, assign rid y vs u) | otherwise = (assign rid y vs u, assign dir x us v) (MetaV x us, _) -> unlessSubtyping $ assign dir x us v `orelse` fallback (_, MetaV y vs) -> unlessSubtyping $ assign rid y vs u `orelse` fallback _ -> fallback where assign dir x es v = do -- Andreas, 2013-10-19 can only solve if no projections reportSDoc "tc.conv.term.shortcut" 20 $ sep [ text "attempting shortcut" , nest 2 $ prettyTCM (MetaV x es) <+> text ":=" <+> prettyTCM v ] ifM (isInstantiatedMeta x) patternViolation {-else-} $ do assignE dir x es v $ compareTermDir dir a _ <- instantiate u -- () <- seq u' $ return () reportSLn "tc.conv.term.shortcut" 50 $ "shortcut successful\n result: " ++ show u -- Should be ok with catchError_ but catchError is much safer since we don't -- rethrow errors. orelse m h = catchError m (\_ -> h) unifyPointers :: Comparison -> Term -> Term -> TCM () -> TCM () unifyPointers _ _ _ action = action -- unifyPointers cmp _ _ action | cmp /= CmpEq = action -- unifyPointers _ u v action = do -- old <- gets stDirty -- modify $ \s -> s { stDirty = False } -- action -- (u, v) <- instantiate (u, v) -- dirty <- gets stDirty -- modify $ \s -> s { stDirty = old } -- when (not dirty) $ forceEqualTerms u v -- | Try to assign meta. If meta is projected, try to eta-expand -- and run conversion check again. assignE :: CompareDirection -> MetaId -> Elims -> Term -> (Term -> Term -> TCM ()) -> TCM () assignE dir x es v comp = assignWrapper dir x es v $ do case allApplyElims es of Just vs -> assignV dir x vs v Nothing -> do reportSDoc "tc.conv.assign" 30 $ sep [ text "assigning to projected meta " , prettyTCM x <+> sep (map prettyTCM es) <+> text (":" ++ show dir) <+> prettyTCM v ] etaExpandMeta [Records] x res <- isInstantiatedMeta' x case res of Just u -> do reportSDoc "tc.conv.assign" 30 $ sep [ text "seems like eta expansion instantiated meta " , prettyTCM x <+> text (":" ++ show dir) <+> prettyTCM u ] let w = u `applyE` es comp w v Nothing -> do reportSLn "tc.conv.assign" 30 "eta expansion did not instantiate meta" patternViolation -- nothing happened, give up compareTermDir :: CompareDirection -> Type -> Term -> Term -> TCM () compareTermDir dir a = dirToCmp (`compareTerm'` a) dir compareTerm' :: Comparison -> Type -> Term -> Term -> TCM () compareTerm' cmp a m n = verboseBracket "tc.conv.term" 20 "compareTerm" $ do a' <- reduce a catchConstraint (ValueCmp cmp a' m n) $ do reportSDoc "tc.conv.term" 30 $ fsep [ text "compareTerm", prettyTCM m, prettyTCM cmp, prettyTCM n, text ":", prettyTCM a' ] proofIrr <- proofIrrelevance isSize <- isJust <$> isSizeType a' s <- reduce $ getSort a' mlvl <- mlevel case s of Prop | proofIrr -> return () _ | isSize -> compareSizes cmp m n _ -> case ignoreSharing $ unEl a' of a | Just a == mlvl -> do a <- levelView m b <- levelView n equalLevel a b -- OLD: Pi dom _ -> equalFun (dom, a') m n a@Pi{} -> equalFun a m n Lam _ _ -> __IMPOSSIBLE__ Def r es -> do isrec <- isEtaRecord r if isrec then do sig <- getSignature let ps = fromMaybe __IMPOSSIBLE__ $ allApplyElims es -- Andreas, 2010-10-11: allowing neutrals to be blocked things does not seem -- to change Agda's behavior -- isNeutral Blocked{} = False isNeutral = isNeutral' . fmap ignoreSharing isMeta = isMeta' . fmap ignoreSharing isNeutral' (NotBlocked _ Con{}) = return False -- Andreas, 2013-09-18 / 2015-06-29: a Def by copatterns is -- not neutral if it is blocked (there can be missing projections -- to trigger a reduction. isNeutral' (NotBlocked r (Def q _)) = do -- Andreas, 2014-12-06 optimize this using r !! not <$> usesCopatterns q -- a def by copattern can reduce if projected isNeutral' _ = return True isMeta' (NotBlocked _ MetaV{}) = True isMeta' _ = False reportSDoc "tc.conv.term" 30 $ prettyTCM a <+> text "is eta record type" m <- reduceB m mNeutral <- isNeutral m n <- reduceB n nNeutral <- isNeutral n case (m, n) of _ | isMeta m || isMeta n -> compareAtom cmp a' (ignoreBlocking m) (ignoreBlocking n) _ | mNeutral && nNeutral -> do -- Andreas 2011-03-23: (fixing issue 396) -- if we are dealing with a singleton record, -- we can succeed immediately isSing <- isSingletonRecordModuloRelevance r ps case isSing of Right True -> return () -- do not eta-expand if comparing two neutrals _ -> compareAtom cmp a' (ignoreBlocking m) (ignoreBlocking n) _ -> do (tel, m') <- etaExpandRecord r ps $ ignoreBlocking m (_ , n') <- etaExpandRecord r ps $ ignoreBlocking n -- No subtyping on record terms c <- getRecordConstructor r -- Record constructors are covariant (see test/succeed/CovariantConstructors). compareArgs (repeat $ polFromCmp cmp) (telePi_ tel $ sort Prop) (Con c []) m' n' else compareAtom cmp a' m n _ -> compareAtom cmp a' m n where -- equality at function type (accounts for eta) equalFun :: Term -> Term -> Term -> TCM () equalFun (Shared p) m n = equalFun (derefPtr p) m n equalFun (Pi dom@(Dom info _) b) m n = do name <- freshName_ $ suggest (absName b) "x" addContext (name, dom) $ compareTerm cmp (absBody b) m' n' where (m',n') = raise 1 (m,n) `apply` [Arg info $ var 0] equalFun _ _ _ = __IMPOSSIBLE__ -- | @compareTel t1 t2 cmp tel1 tel1@ checks whether pointwise -- @tel1 \`cmp\` tel2@ and complains that @t2 \`cmp\` t1@ failed if -- not. compareTel :: Type -> Type -> Comparison -> Telescope -> Telescope -> TCM () compareTel t1 t2 cmp tel1 tel2 = verboseBracket "tc.conv.tel" 20 "compareTel" $ catchConstraint (TelCmp t1 t2 cmp tel1 tel2) $ case (tel1, tel2) of (EmptyTel, EmptyTel) -> return () (EmptyTel, _) -> bad (_, EmptyTel) -> bad (ExtendTel dom1@(Dom i1 a1) tel1, ExtendTel dom2@(Dom i2 a2) tel2) | getHiding i1 /= getHiding i2 -> bad -- Andreas, 2011-09-11 do not test r1 == r2 because they could differ -- e.g. one could be Forced and the other Relevant (see fail/UncurryMeta) | otherwise -> do name <- freshName_ (suggest (absName tel1) (absName tel2)) let r = max (getRelevance i1) (getRelevance i2) -- take "most irrelevant" dependent = (r /= Irrelevant) && isBinderUsed tel2 -- NEW pid <- newProblem_ $ compareType cmp a1 a2 dom <- if dependent then Dom i1 <$> blockTypeOnProblem a1 pid else return dom1 addContext (name, dom) $ compareTel t1 t2 cmp (absBody tel1) (absBody tel2) stealConstraints pid {- OLD, before 2013-05-15 let checkDom = escapeContext 1 $ compareType cmp a1 a2 c = TelCmp t1 t2 cmp (absBody tel1) (absBody tel2) addCtx name dom1 $ if dependent then guardConstraint c checkDom else checkDom >> solveConstraint_ c -} where -- Andreas, 2011-05-10 better report message about types bad = typeError $ UnequalTypes cmp t2 t1 -- switch t2 and t1 because of contravariance! -- bad = typeError $ UnequalTelescopes cmp tel1 tel2 -- | Raise 'UnequalTerms' if there is no hope that by -- meta solving and subsequent eta-contraction these -- terms could become equal. -- Precondition: the terms are in reduced form -- (with no top-level pointer) and -- failed to be equal in the 'compareAtom' check. -- -- By eta-contraction, a lambda or a record constructor term -- can become anything. etaInequal :: Comparison -> Type -> Term -> Term -> TCM () etaInequal cmp t m n = do let inequal = typeError $ UnequalTerms cmp m n t dontKnow = do reportSDoc "tc.conv.inequal" 20 $ hsep [ text "etaInequal: postponing " , prettyTCM m , text " != " , prettyTCM n ] patternViolation -- if type is not blocked, then we would have tried eta already flip (ifBlockedType t) (\ _ -> inequal) $ \ _ _ -> do -- type is blocked case (m, n) of (Con{}, _) -> dontKnow (_, Con{}) -> dontKnow (Lam{}, _) -> dontKnow (_, Lam{}) -> dontKnow _ -> inequal compareAtomDir :: CompareDirection -> Type -> Term -> Term -> TCM () compareAtomDir dir a = dirToCmp (`compareAtom` a) dir -- | Syntax directed equality on atomic values -- compareAtom :: Comparison -> Type -> Term -> Term -> TCM () compareAtom cmp t m n = verboseBracket "tc.conv.atom" 20 "compareAtom" $ -- if a PatternErr is thrown, rebuild constraint! catchConstraint (ValueCmp cmp t m n) $ do reportSDoc "tc.conv.atom" 50 $ text "compareAtom" <+> fsep [ prettyTCM m <+> prettyTCM cmp , prettyTCM n , text ":" <+> prettyTCM t ] -- Andreas: what happens if I cut out the eta expansion here? -- Answer: Triggers issue 245, does not resolve 348 (mb',nb') <- ifM (asks envCompareBlocked) ((notBlocked -*- notBlocked) <$> reduce (m,n)) $ do mb' <- etaExpandBlocked =<< reduceB m nb' <- etaExpandBlocked =<< reduceB n return (mb', nb') -- constructorForm changes literal to constructors -- only needed if the other side is not a literal (mb'', nb'') <- case (ignoreSharing $ ignoreBlocking mb', ignoreSharing $ ignoreBlocking nb') of (Lit _, Lit _) -> return (mb', nb') _ -> (,) <$> traverse constructorForm mb' <*> traverse constructorForm nb' mb <- traverse unLevel mb'' nb <- traverse unLevel nb'' let m = ignoreBlocking mb n = ignoreBlocking nb postpone = addConstraint $ ValueCmp cmp t m n checkSyntacticEquality = do n <- normalise n -- is this what we want? m <- normalise m if m == n then return () -- Check syntactic equality for blocked terms else postpone dir = fromCmp cmp rid = flipCmp dir -- The reverse direction. Bad name, I know. assign dir x es v = assignE dir x es v $ compareAtomDir dir t unifyPointers cmp (ignoreBlocking mb') (ignoreBlocking nb') $ do -- this needs to go after eta expansion to avoid creating infinite terms reportSDoc "tc.conv.atom" 30 $ text "compareAtom" <+> fsep [ prettyTCM mb <+> prettyTCM cmp , prettyTCM nb , text ":" <+> prettyTCM t ] case (ignoreSharing <$> mb, ignoreSharing <$> nb) of -- equate two metas x and y. if y is the younger meta, -- try first y := x and then x := y (NotBlocked _ (MetaV x xArgs), NotBlocked _ (MetaV y yArgs)) | x == y -> case intersectVars xArgs yArgs of -- all relevant arguments are variables Just kills -> do -- kills is a list with 'True' for each different var killResult <- killArgs kills x case killResult of NothingToPrune -> return () PrunedEverything -> return () PrunedNothing -> postpone PrunedSomething -> postpone -- OLD CODE: if killedAll then return () else checkSyntacticEquality -- not all relevant arguments are variables Nothing -> checkSyntacticEquality -- Check syntactic equality on meta-variables -- (same as for blocked terms) | otherwise -> do [p1, p2] <- mapM getMetaPriority [x,y] -- instantiate later meta variables first let (solve1, solve2) | (p1,x) > (p2,y) = (l,r) | otherwise = (r,l) where l = assign dir x xArgs n r = assign rid y yArgs m try m h = m `catchError_` \err -> case err of PatternErr{} -> h _ -> throwError err -- First try the one with the highest priority. If that doesn't -- work, try the low priority one. try solve1 solve2 -- one side a meta, the other an unblocked term (NotBlocked _ (MetaV x es), _) -> assign dir x es n (_, NotBlocked _ (MetaV x es)) -> assign rid x es m (Blocked{}, Blocked{}) -> checkSyntacticEquality (Blocked{}, _) -> useInjectivity cmp t m n (_,Blocked{}) -> useInjectivity cmp t m n _ -> do -- -- Andreas, 2013-10-20 put projection-like function -- -- into the spine, to make compareElims work. -- -- 'False' means: leave (Def f []) unchanged even for -- -- proj-like funs. -- m <- elimView False m -- n <- elimView False n -- Andreas, 2015-07-01, actually, don't put them into the spine. -- Polarity cannot be communicated properly if projection-like -- functions are post-fix. case (ignoreSharing m, ignoreSharing n) of (Pi{}, Pi{}) -> equalFun m n (Sort s1, Sort Inf) -> return () (Sort s1, Sort s2) -> compareSort CmpEq s1 s2 (Lit l1, Lit l2) | l1 == l2 -> return () (Var i es, Var i' es') | i == i' -> do a <- typeOfBV i -- Variables are invariant in their arguments compareElims [] a (var i) es es' (Def f [], Def f' []) | f == f' -> return () (Def f es, Def f' es') | f == f' -> do def <- getConstInfo f -- To compute the type @a@ of a projection-like @f@, -- we have to infer the type of its first argument. a <- if projectionArgs (theDef def) <= 0 then return $ defType def else do -- Find an first argument to @f@. let arg = case (es, es') of (Apply arg : _, _) -> arg (_, Apply arg : _) -> arg _ -> __IMPOSSIBLE__ -- Infer its type. targ <- infer $ unArg arg -- getDefType wants the argument type reduced. fromMaybeM __IMPOSSIBLE__ $ getDefType f =<< reduce targ -- The polarity vector of projection-like functions -- does not include the parameters. pol <- getPolarity' cmp f compareElims pol a (Def f []) es es' (Def f es, Def f' es') -> unlessM (bothAbsurd f f') $ do trySizeUniv cmp t m n f es f' es' (Con x xArgs, Con y yArgs) | x == y -> do -- Get the type of the constructor instantiated to the datatype parameters. a' <- conType x t -- Constructors are covariant in their arguments -- (see test/succeed/CovariantConstructors). compareArgs (repeat $ polFromCmp cmp) a' (Con x []) xArgs yArgs _ -> etaInequal cmp t m n -- fixes issue 856 (unsound conversion error) where -- Andreas, 2013-05-15 due to new postponement strategy, type can now be blocked conType c t = ifBlockedType t (\ _ _ -> patternViolation) $ \ t -> do let impossible = do reportSDoc "impossible" 10 $ text "expected data/record type, found " <+> prettyTCM t reportSLn "impossible" 70 $ " raw = " ++ show t -- __IMPOSSIBLE__ -- Andreas, 2013-10-20: in case termination checking fails -- we might get some unreduced types here. -- In issue 921, this happens during the final attempt -- to solve left-over constraints. -- Thus, instead of crashing, just give up gracefully. patternViolation maybe impossible return =<< getConType c t equalFun t1 t2 = case (ignoreSharing t1, ignoreSharing t2) of (Pi dom1@(Dom i1 a1@(El a1s a1t)) b1, Pi (Dom i2 a2) b2) | argInfoHiding i1 /= argInfoHiding i2 -> typeError $ UnequalHiding t1 t2 -- Andreas 2010-09-21 compare r1 and r2, but ignore forcing annotations! | not (compareRelevance cmp (ignoreForced $ argInfoRelevance i2) (ignoreForced $ argInfoRelevance i1)) -> typeError $ UnequalRelevance cmp t1 t2 | otherwise -> verboseBracket "tc.conv.fun" 15 "compare function types" $ do reportSDoc "tc.conv.fun" 20 $ nest 2 $ vcat [ text "t1 =" <+> prettyTCM t1 , text "t2 =" <+> prettyTCM t2 ] -- We only need to require a1 == a2 if t2 is a dependent function type. -- If it's non-dependent it doesn't matter what we add to the context. pid <- newProblem_ $ compareType cmp a2 a1 dom <- if isBinderUsed b2 then Dom i1 <$> blockTypeOnProblem a1 pid -- then Dom i1 . El a1s <$> blockTermOnProblem (El Inf $ Sort a1s) a1t pid else return dom1 name <- freshName_ (suggest b1 b2) addContext (name, dom) $ compareType cmp (absBody b1) (absBody b2) stealConstraints pid -- Andreas, 2013-05-15 Now, comparison of codomains is not -- blocked any more by getting stuck on domains. -- Only the domain type in context will be blocked. {- OLD let checkDom = escapeContext 1 $ compareType cmp a2 a1 conCoDom = TypeCmp cmp (absBody b1) (absBody b2) -- We only need to require a1 == a2 if t2 is a dependent function type. -- If it's non-dependent it doesn't matter what we add to the context. name <- freshName_ (suggest b1 b2) addCtx name dom1 $ if isBinderUsed b2 -- dependent function type? then guardConstraint conCoDom checkDom else checkDom >> solveConstraint_ conCoDom -} _ -> __IMPOSSIBLE__ compareRelevance :: Comparison -> Relevance -> Relevance -> Bool compareRelevance CmpEq = (==) compareRelevance CmpLeq = (<=) -- | @compareElims pols a v els1 els2@ performs type-directed equality on eliminator spines. -- @t@ is the type of the head @v@. compareElims :: [Polarity] -> Type -> Term -> [Elim] -> [Elim] -> TCM () compareElims pols0 a v els01 els02 = catchConstraint (ElimCmp pols0 a v els01 els02) $ do let v1 = applyE v els01 v2 = applyE v els02 failure = typeError $ UnequalTerms CmpEq v1 v2 a -- Andreas, 2013-03-15 since one of the spines is empty, @a@ -- is the correct type here. unless (null els01) $ do reportSDoc "tc.conv.elim" 25 $ text "compareElims" $$ do nest 2 $ vcat [ text "a =" <+> prettyTCM a , text "pols0 (truncated to 10) =" <+> sep (map prettyTCM $ take 10 pols0) , text "v =" <+> prettyTCM v , text "els01 =" <+> prettyTCM els01 , text "els02 =" <+> prettyTCM els02 ] case (els01, els02) of ([] , [] ) -> return () ([] , Proj{}:_ ) -> failure -- not impossible, see issue 821 (Proj{} : _, [] ) -> failure -- could be x.p =?= x for projection p ([] , Apply{} : _) -> failure -- not impossible, see issue 878 (Apply{} : _, [] ) -> failure (Apply{} : _, Proj{} : _) -> __IMPOSSIBLE__ <$ solveAwakeConstraints' True -- NB: popped up in issue 889 (Proj{} : _, Apply{} : _) -> __IMPOSSIBLE__ <$ solveAwakeConstraints' True -- but should be impossible (but again in issue 1467) (Apply arg1 : els1, Apply arg2 : els2) -> verboseBracket "tc.conv.elim" 20 "compare Apply" $ do reportSDoc "tc.conv.elim" 10 $ nest 2 $ vcat [ text "a =" <+> prettyTCM a , text "v =" <+> prettyTCM v , text "arg1 =" <+> prettyTCM arg1 , text "arg2 =" <+> prettyTCM arg2 ] reportSDoc "tc.conv.elim" 50 $ nest 2 $ vcat [ text "v =" <+> text (show v) , text "arg1 =" <+> text (show arg1) , text "arg2 =" <+> text (show arg2) , text "" ] let (pol, pols) = nextPolarity pols0 ifBlockedType a (\ m t -> patternViolation) $ \ a -> do case ignoreSharing . unEl $ a of (Pi (Dom info b) codom) -> do mlvl <- mlevel let freeInCoDom (Abs _ c) = 0 `freeInIgnoringSorts` c freeInCoDom _ = False dependent = (Just (unEl b) /= mlvl) && freeInCoDom codom -- Level-polymorphism (x : Level) -> ... does not count as dependency here -- NB: we could drop the free variable test and still be sound. -- It is a trade-off between the administrative effort of -- creating a blocking and traversing a term for free variables. -- Apparently, it is believed that checking free vars is cheaper. -- Andreas, 2013-05-15 r = getRelevance info -- NEW, Andreas, 2013-05-15 -- compare arg1 and arg2 pid <- newProblem_ $ applyRelevanceToContext r $ case r of Forced{} -> return () r | irrelevantOrUnused r -> compareIrrelevant b (unArg arg1) (unArg arg2) _ -> compareWithPol pol (flip compareTerm b) (unArg arg1) (unArg arg2) -- if comparison got stuck and function type is dependent, block arg arg <- if dependent then (arg1 $>) <$> blockTermOnProblem b (unArg arg1) pid else return arg1 -- continue, possibly with blocked instantiation compareElims pols (piApply a [arg]) (apply v [arg]) els1 els2 -- any left over constraints of arg are associatd to the comparison stealConstraints pid {- Stealing solves this issue: Does not create enough blocked tc-problems, see test/fail/DontPrune. (There are remaining problems which do not show up as yellow.) Need to find a way to associate pid also to result of compareElims. -} {- OLD, before 2013-05-15 let checkArg = applyRelevanceToContext r $ case r of Forced -> return () r | irrelevantOrUnused r -> compareIrrelevant b (unArg arg1) (unArg arg2) _ -> compareWithPol pol (flip compareTerm b) (unArg arg1) (unArg arg2) theRest = ElimCmp pols (piApply a [arg1]) (apply v [arg1]) els1 els2 if dependent then guardConstraint theRest checkArg else checkArg >> solveConstraint_ theRest -} a -> do reportSDoc "impossible" 10 $ text "unexpected type when comparing apply eliminations " <+> prettyTCM a reportSLn "impossible" 50 $ "raw type: " ++ show a patternViolation -- Andreas, 2013-10-22 -- in case of disabled reductions (due to failing termination check) -- we might get stuck, so do not crash, but fail gently. -- __IMPOSSIBLE__ -- case: f == f' are projections (Proj f : els1, Proj f' : els2) | f /= f' -> typeError . GenericError . show =<< prettyTCM f <+> text "/=" <+> prettyTCM f' | otherwise -> ifBlockedType a (\ m t -> patternViolation) $ \ a -> do res <- projectTyped v a f -- fails only if f is proj.like but parameters cannot be retrieved case res of Just (u, t) -> do -- Andreas, 2015-07-01: -- The arguments following the principal argument of a projection -- are invariant. (At least as long as we have no explicit polarity -- annotations.) compareElims [] t u els1 els2 Nothing -> do reportSDoc "tc.conv.elims" 30 $ sep [ text $ "projection " ++ show f , text "applied to value " <+> prettyTCM v , text "of unexpected type " <+> prettyTCM a ] patternViolation {- res <- getDefType f a -- get type of projection (like) function case res of Just ft -> do let arg = defaultArg v -- we could get the proper Arg deco from ft c = ft `piApply` [arg] u <- applyDef f arg -- correct both for proj.s and non proj.s (cmp, els1, els2) <- return $ case fst $ nextPolarity pols0 of Invariant -> (CmpEq , els1, els2) Covariant -> (CmpLeq, els1, els2) Contravariant -> (CmpLeq, els2, els1) Nonvariant -> __IMPOSSIBLE__ -- the polarity should be Invariant pols' <- getPolarity' cmp f compareElims pols' c u els1 els2 _ -> do reportSDoc "impossible" 10 $ sep [ text $ "projection " ++ show f , text "applied to value " <+> prettyTCM v , text "of unexpected type " <+> prettyTCM a ] patternViolation -- __IMPOSSIBLE__ -} -- | "Compare" two terms in irrelevant position. This always succeeds. -- However, we can dig for solutions of irrelevant metas in the -- terms we compare. -- (Certainly not the systematic solution, that'd be proof search...) compareIrrelevant :: Type -> Term -> Term -> TCM () {- 2012-04-02 DontCare no longer present compareIrrelevant t (DontCare v) w = compareIrrelevant t v w compareIrrelevant t v (DontCare w) = compareIrrelevant t v w -} compareIrrelevant t v w = do reportSDoc "tc.conv.irr" 20 $ vcat [ text "compareIrrelevant" , nest 2 $ text "v =" <+> prettyTCM v , nest 2 $ text "w =" <+> prettyTCM w ] reportSDoc "tc.conv.irr" 50 $ vcat [ nest 2 $ text $ "v = " ++ show v , nest 2 $ text $ "w = " ++ show w ] try v w $ try w v $ return () where try (Shared p) w fallback = try (derefPtr p) w fallback try (MetaV x es) w fallback = do mv <- lookupMeta x let rel = getMetaRelevance mv inst = case mvInstantiation mv of InstV{} -> True InstS{} -> True _ -> False reportSDoc "tc.conv.irr" 20 $ vcat [ nest 2 $ text $ "rel = " ++ show rel , nest 2 $ text $ "inst = " ++ show inst ] if not (irrelevantOrUnused rel) || inst then fallback else assignE DirEq x es w $ compareIrrelevant t -- the value of irrelevant or unused meta does not matter try v w fallback = fallback compareWithPol :: Polarity -> (Comparison -> a -> a -> TCM ()) -> a -> a -> TCM () compareWithPol Invariant cmp x y = cmp CmpEq x y compareWithPol Covariant cmp x y = cmp CmpLeq x y compareWithPol Contravariant cmp x y = cmp CmpLeq y x compareWithPol Nonvariant cmp x y = return () polFromCmp :: Comparison -> Polarity polFromCmp CmpLeq = Covariant polFromCmp CmpEq = Invariant -- | Type-directed equality on argument lists -- compareArgs :: [Polarity] -> Type -> Term -> Args -> Args -> TCM () compareArgs pol a v args1 args2 = compareElims pol a v (map Apply args1) (map Apply args2) --------------------------------------------------------------------------- -- * Types --------------------------------------------------------------------------- -- | Equality on Types compareType :: Comparison -> Type -> Type -> TCM () compareType cmp ty1@(El s1 a1) ty2@(El s2 a2) = verboseBracket "tc.conv.type" 20 "compareType" $ catchConstraint (TypeCmp cmp ty1 ty2) $ do reportSDoc "tc.conv.type" 50 $ vcat [ text "compareType" <+> sep [ prettyTCM ty1 <+> prettyTCM cmp , prettyTCM ty2 ] , hsep [ text " sorts:", prettyTCM s1, text " and ", prettyTCM s2 ] ] -- Andreas, 2011-4-27 should not compare sorts, but currently this is needed -- for solving sort and level metas compareSort CmpEq s1 s2 `catchError` \err -> case err of TypeError _ e -> do reportSDoc "tc.conv.type" 30 $ vcat [ text "sort comparison failed" , nest 2 $ vcat [ text "s1 =" <+> prettyTCM s1 , text "s2 =" <+> prettyTCM s2 ] ] case clValue e of -- Issue 659: Better error message SetOmegaNotValidType -> typeError $ UnequalBecauseOfUniverseConflict cmp a1 a2 _ -> do -- This error will probably be more informative compareTerm cmp (sort s1) a1 a2 -- Throw the original error if the above doesn't -- give an error (for instance, due to pending -- constraints). -- Or just ignore it... We run into this with irrelevant levels -- which may show up in sort constraints, causing them to fail. -- In any case it's not safe to ignore the error, for instance -- a1 might be Set and a2 a meta of type Set, in which case we -- really need the sort comparison to fail, instead of silently -- instantiating the meta. -- Andreas, 2013-10-31 Maybe the error went away -- when we compared the types. So we try the sort comparison -- again, this time not catching the error. (see Issue 930) -- throwError err compareSort CmpEq s1 s2 _ -> throwError err compareTerm cmp (sort s1) a1 a2 return () leqType :: Type -> Type -> TCM () leqType = compareType CmpLeq -- | @coerce v a b@ coerces @v : a@ to type @b@, returning a @v' : b@ -- with maybe extra hidden applications or hidden abstractions. -- -- In principle, this function can host coercive subtyping, but -- currently it only tries to fix problems with hidden function types. coerce :: Term -> Type -> Type -> TCM Term coerce v t1 t2 = blockTerm t2 $ do verboseS "tc.conv.coerce" 10 $ do (a1,a2) <- reify (t1,t2) let dbglvl = if isSet a1 && isSet a2 then 50 else 10 reportSDoc "tc.conv.coerce" dbglvl $ text "coerce" <+> vcat [ text "term v =" <+> prettyTCM v , text "from type t1 =" <+> prettyTCM a1 , text "to type t2 =" <+> prettyTCM a2 ] -- v <$ do workOnTypes $ leqType t1 t2 -- take off hidden/instance domains from t1 and t2 TelV tel1 b1 <- telViewUpTo' (-1) ((NotHidden /=) . getHiding) t1 TelV tel2 b2 <- telViewUpTo' (-1) ((NotHidden /=) . getHiding) t2 let n = size tel1 - size tel2 -- the crude solution would be -- v' = λ {tel2} → v {tel1} -- however, that may introduce unneccessary many function types -- If n > 0 and b2 is not blocked, it is safe to -- insert n many hidden args if n <= 0 then fallback else do ifBlockedType b2 (\ _ _ -> fallback) $ \ _ -> do (args, t1') <- implicitArgs n (NotHidden /=) t1 coerceSize (v `apply` args) t1' t2 where fallback = coerceSize v t1 t2 -- | Account for situations like @k : (Size< j) <= (Size< k + 1)@ -- -- Actually, the semantics is -- @(Size<= k) ∩ (Size< j) ⊆ rhs@ -- which gives a disjunctive constraint. Mmmh, looks like stuff -- TODO. -- -- For now, we do a cheap heuristics. coerceSize :: Term -> Type -> Type -> TCM Term coerceSize v t1 t2 = workOnTypes $ do let fallback = v <$ leqType t1 t2 done = caseMaybeM (isSizeType t1) fallback $ \ b1 -> return v -- Andreas, 2015-07-22, Issue 1615: -- If t1 is a meta and t2 a type like Size< v2, we need to make sure we do not miss -- the constraint v < v2! caseMaybeM (isSizeType t2) fallback $ \ b2 -> do -- Andreas, 2015-02-11 do not instantiate metas here (triggers issue 1203). ifM (tryConversion $ dontAssignMetas $ leqType t1 t2) (return v) $ {- else -} do -- A (most probably weaker) alternative is to just check syn.eq. -- ifM (snd <$> checkSyntacticEquality t1 t2) (return v) $ {- else -} do case b2 of -- @t2 = Size@. We are done! BoundedNo -> done -- @t2 = Size< v2@ BoundedLt v2 -> do sv2 <- sizeView v2 case sv2 of SizeInf -> done OtherSize{} -> do -- Andreas, 2014-06-16: -- Issue 1203: For now, just treat v < v2 as suc v <= v2 -- TODO: Need proper < comparison vinc <- sizeSuc 1 v compareSizes CmpLeq vinc v2 done -- @v2 = a2 + 1@: In this case, we can try @v <= a2@ SizeSuc a2 -> do compareSizes CmpLeq v a2 done -- to pass Issue 1136 --------------------------------------------------------------------------- -- * Sorts and levels --------------------------------------------------------------------------- compareLevel :: Comparison -> Level -> Level -> TCM () compareLevel CmpLeq u v = leqLevel u v compareLevel CmpEq u v = equalLevel u v compareSort :: Comparison -> Sort -> Sort -> TCM () compareSort CmpEq = equalSort compareSort CmpLeq = leqSort -- | Check that the first sort is less or equal to the second. -- -- We can put @SizeUniv@ below @Inf@, but otherwise, it is -- unrelated to the other universes. -- leqSort :: Sort -> Sort -> TCM () leqSort s1 s2 = catchConstraint (SortCmp CmpLeq s1 s2) $ do (s1,s2) <- reduce (s1,s2) let postpone = addConstraint (SortCmp CmpLeq s1 s2) no = typeError $ NotLeqSort s1 s2 yes = return () reportSDoc "tc.conv.sort" 30 $ sep [ text "leqSort" , nest 2 $ fsep [ prettyTCM s1 <+> text "=<" , prettyTCM s2 ] ] case (s1, s2) of (_ , Inf ) -> yes (SizeUniv, _ ) -> equalSort s1 s2 (_ , SizeUniv) -> equalSort s1 s2 (Type a , Type b ) -> unlessM typeInType $ leqLevel a b (Prop , Prop ) -> yes (Prop , Type _ ) -> yes (Type _ , Prop ) -> no -- (SizeUniv, SizeUniv) -> yes -- (SizeUniv, _ ) -> no -- (_ , SizeUniv) -> no (Inf , _ ) -> unlessM typeInType $ equalSort s1 s2 (DLub{} , _ ) -> unlessM typeInType $ postpone (_ , DLub{} ) -> unlessM typeInType $ postpone leqLevel :: Level -> Level -> TCM () leqLevel a b = liftTCM $ do reportSDoc "tc.conv.nat" 30 $ text "compareLevel" <+> sep [ prettyTCM a <+> text "=<" , prettyTCM b ] a <- reduce a b <- reduce b catchConstraint (LevelCmp CmpLeq a b) $ leqView a b where leqView a@(Max as) b@(Max bs) = do reportSDoc "tc.conv.nat" 30 $ text "compareLevelView" <+> sep [ text (show a) <+> text "=<" , text (show b) ] wrap $ case (as, bs) of -- same term _ | as == bs -> ok -- 0 ≤ any ([], _) -> ok -- as ≤ 0 (as, []) -> sequence_ [ equalLevel (Max [a]) (Max []) | a <- as ] -- as ≤ [b] (as@(_:_:_), [b]) -> sequence_ [ leqView (Max [a]) (Max [b]) | a <- as ] -- reduce constants (as, bs) | minN > 0 -> leqView (Max $ map (subtr minN) as) (Max $ map (subtr minN) bs) where ns = map constant as ms = map constant bs minN = minimum (ns ++ ms) -- remove subsumed -- Andreas, 2014-04-07: This is ok if we do not go back to equalLevel (as, bs) | not $ null subsumed -> leqView (Max $ as \\ subsumed) (Max bs) where subsumed = [ a | a@(Plus m l) <- as, n <- findN l, m <= n ] -- @findN a@ finds the unique(?) term @Plus n a@ in @bs@, if any. -- Andreas, 2014-04-07 Why must there be a unique term? findN a = case [ n | Plus n b <- bs, b == a ] of [n] -> [n] _ -> [] -- Andreas, 2012-10-02 raise error on unsolvable constraint ([ClosedLevel n], [ClosedLevel m]) -> if n <= m then ok else notok -- closed ≤ bs ([ClosedLevel n], bs) | n <= maximum (map constant bs) -> ok -- as ≤ neutral (as, bs) | neutralB && maxA > maxB -> notok | neutralB && any (\a -> neutral a && not (isInB a)) as -> notok | neutralB && neutralA -> maybeok $ all (\a -> constant a <= findN a) as where maxA = maximum $ map constant as maxB = maximum $ map constant bs neutralA = all neutral as neutralB = all neutral bs isInB a = elem (unneutral a) $ map unneutral bs findN a = case [ n | b@(Plus n _) <- bs, unneutral b == unneutral a ] of [n] -> n _ -> __IMPOSSIBLE__ -- [a] ≤ [neutral] ([a@(Plus n _)], [b@(Plus m NeutralLevel{})]) | m == n -> equalLevel (Max [a]) (Max [b]) -- Andreas, 2014-04-07: This call to equalLevel is ok even if we removed -- subsumed terms from the lhs. -- anything else _ -> postpone where ok = return () notok = typeError $ NotLeqSort (Type a) (Type b) postpone = patternViolation wrap m = catchError m $ \e -> case e of TypeError{} -> notok _ -> throwError e maybeok True = ok maybeok False = notok neutral (Plus _ NeutralLevel{}) = True neutral _ = False meta (Plus _ MetaLevel{}) = True meta _ = False unneutral (Plus _ (NeutralLevel _ v)) = v unneutral _ = __IMPOSSIBLE__ constant (ClosedLevel n) = n constant (Plus n _) = n subtr m (ClosedLevel n) = ClosedLevel (n - m) subtr m (Plus n l) = Plus (n - m) l -- choice [] = patternViolation -- choice (m:ms) = noConstraints m `catchError` \_ -> choice ms -- case e of -- PatternErr{} -> choice ms -- _ -> throwError e equalLevel :: Level -> Level -> TCM () equalLevel a b = do -- Andreas, 2013-10-31 Use normalization to make syntactic equality stronger (a, b) <- normalise (a, b) reportSLn "tc.conv.level" 50 $ "equalLevel (" ++ show a ++ ") (" ++ show b ++ ")" liftTCM $ catchConstraint (LevelCmp CmpEq a b) $ check a b where check a@(Max as) b@(Max bs) = do -- Jesper, 2014-02-02 remove terms that certainly do not contribute -- to the maximum as <- return $ [ a | a <- as, not $ a `isStrictlySubsumedBy` bs ] bs <- return $ [ b | b <- bs, not $ b `isStrictlySubsumedBy` as ] -- Andreas, 2013-10-31 remove common terms (that don't contain metas!!) -- THAT's actually UNSOUND when metas are instantiated, because -- max a b == max a c does not imply b == c -- as <- return $ Set.fromList $ closed0 as -- bs <- return $ Set.fromList $ closed0 bs -- let cs = Set.filter (not . hasMeta) $ Set.intersection as bs -- as <- return $ Set.toList $ as Set.\\ cs -- bs <- return $ Set.toList $ bs Set.\\ cs as <- return $ List.sort $ closed0 as bs <- return $ List.sort $ closed0 bs reportSDoc "tc.conv.level" 40 $ sep [ text "equalLevel" , vcat [ nest 2 $ sep [ prettyTCM a <+> text "==" , prettyTCM b ] , text "reduced" , nest 2 $ sep [ prettyTCM (Max as) <+> text "==" , prettyTCM (Max bs) ] ] ] reportSDoc "tc.conv.level" 50 $ sep [ text "equalLevel" , vcat [ nest 2 $ sep [ text (show (Max as)) <+> text "==" , text (show (Max bs)) ] ] ] case (as, bs) of _ | as == bs -> ok | any isBlocked (as ++ bs) -> do lvl <- levelType liftTCM $ useInjectivity CmpEq lvl (Level a) (Level b) -- closed == closed ([ClosedLevel n], [ClosedLevel m]) | n == m -> ok | otherwise -> notok -- closed == neutral ([ClosedLevel{}], _) | any isNeutral bs -> notok (_, [ClosedLevel{}]) | any isNeutral as -> notok -- 0 == any ([ClosedLevel 0], bs@(_:_:_)) -> sequence_ [ equalLevel (Max []) (Max [b]) | b <- bs ] (as@(_:_:_), [ClosedLevel 0]) -> sequence_ [ equalLevel (Max [a]) (Max []) | a <- as ] -- Andreas, 2014-04-07 Why should the following be ok? -- X (suc a) could be different from X (suc (suc a)) -- -- Same meta -- ([Plus n (MetaLevel x _)], [Plus m (MetaLevel y _)]) -- | n == m && x == y -> ok -- meta == any ([Plus n (MetaLevel x as)], _) | any (isThisMeta x) bs -> postpone (_, [Plus n (MetaLevel x bs)]) | any (isThisMeta x) as -> postpone ([Plus n (MetaLevel x as')], [Plus m (MetaLevel y bs')]) -- lexicographic comparison intended! | (n, y) < (m, x) -> meta n x as' bs | otherwise -> meta m y bs' as ([Plus n (MetaLevel x as')],_) -> meta n x as' bs (_,[Plus m (MetaLevel y bs')]) -> meta m y bs' as -- any other metas -- Andreas, 2013-10-31: There could be metas in neutral levels (see Issue 930). -- Should not we postpone there as well? Yes! _ | any hasMeta (as ++ bs) -> postpone -- neutral/closed == neutral/closed _ | all isNeutralOrClosed (as ++ bs) -> do reportSLn "tc.conv.level" 60 $ "equalLevel: all are neutral or closed" if length as == length bs then zipWithM_ (\a b -> [a] =!= [b]) as bs else notok -- more cases? _ -> postpone where a === b = do lvl <- levelType equalAtom lvl a b as =!= bs = levelTm (Max as) === levelTm (Max bs) ok = return () notok = typeError $ UnequalSorts (Type a) (Type b) postpone = do reportSLn "tc.conv.level" 30 $ "postponing: " ++ show a ++ " == " ++ show b patternViolation closed0 [] = [ClosedLevel 0] closed0 as = as -- perform assignment (Plus n (MetaLevel x as)) := bs meta n x as bs = do reportSLn "tc.meta.level" 30 $ "Assigning meta level" reportSLn "tc.meta.level" 50 $ "meta " ++ show as ++ " " ++ show bs bs' <- mapM (subtr n) bs assignE DirEq x as (levelTm (Max bs')) (===) -- fallback: check equality as atoms -- Make sure to give a sensible error message wrap m = m `catchError` \err -> case err of TypeError{} -> notok _ -> throwError err subtr n (ClosedLevel m) | m >= n = return $ ClosedLevel (m - n) | otherwise = notok subtr n (Plus m a) | m >= n = return $ Plus (m - n) a subtr _ (Plus _ BlockedLevel{}) = postpone subtr _ (Plus _ MetaLevel{}) = postpone subtr _ (Plus _ NeutralLevel{}) = postpone subtr _ (Plus _ UnreducedLevel{}) = __IMPOSSIBLE__ isNeutral (Plus _ NeutralLevel{}) = True isNeutral _ = False isClosed ClosedLevel{} = True isClosed _ = False isNeutralOrClosed l = isClosed l || isNeutral l isBlocked (Plus _ BlockedLevel{}) = True isBlocked _ = False hasMeta ClosedLevel{} = False hasMeta (Plus _ MetaLevel{}) = True hasMeta (Plus _ (BlockedLevel _ v)) = not $ null $ allMetas v hasMeta (Plus _ (NeutralLevel _ v)) = not $ null $ allMetas v hasMeta (Plus _ (UnreducedLevel v)) = not $ null $ allMetas v isThisMeta x (Plus _ (MetaLevel y _)) = x == y isThisMeta _ _ = False constant (ClosedLevel n) = n constant (Plus n _) = n (ClosedLevel m) `isStrictlySubsumedBy` [] = m == 0 (ClosedLevel m) `isStrictlySubsumedBy` ys = m < maximum (map constant ys) (Plus m x) `isStrictlySubsumedBy` ys = not $ null $ [ n | Plus n y <- ys, x == y, m < n ] -- | Check that the first sort equal to the second. equalSort :: Sort -> Sort -> TCM () equalSort s1 s2 = do ifM typeInType (return ()) $ catchConstraint (SortCmp CmpEq s1 s2) $ do (s1,s2) <- reduce (s1,s2) let postpone = addConstraint (SortCmp CmpEq s1 s2) yes = return () no = typeError $ UnequalSorts s1 s2 -- Test whether a level is infinity. isInf ClosedLevel{} = no isInf (Plus _ l) = case l of MetaLevel x es -> assignE DirEq x es (Sort Inf) $ equalAtom topSort -- Andreas, 2015-02-14 -- This seems to be a hack, as a level meta is instantiated -- by a sort. NeutralLevel _ v -> case ignoreSharing v of Sort Inf -> yes _ -> no _ -> no -- Equate a level with SizeUniv. eqSizeUniv l0 = case l0 of Plus 0 l -> case l of MetaLevel x es -> assignE DirEq x es (Sort SizeUniv) $ equalAtom topSort NeutralLevel _ v -> case ignoreSharing v of Sort SizeUniv -> yes _ -> no _ -> no _ -> no reportSDoc "tc.conv.sort" 30 $ sep [ text "equalSort" , vcat [ nest 2 $ fsep [ prettyTCM s1 <+> text "==" , prettyTCM s2 ] , nest 2 $ fsep [ text (show s1) <+> text "==" , text (show s2) ] ] ] case (s1, s2) of (Type a , Type b ) -> equalLevel a b (SizeUniv, SizeUniv) -> yes (SizeUniv, Type (Max as@(_:_))) -> mapM_ eqSizeUniv as (Type (Max as@(_:_)), SizeUniv) -> mapM_ eqSizeUniv as (SizeUniv, _ ) -> no (_ , SizeUniv) -> no (Prop , Prop ) -> yes (Type _ , Prop ) -> no (Prop , Type _ ) -> no (Inf , Inf ) -> yes (Inf , Type (Max as@(_:_))) -> mapM_ isInf as (Type (Max as@(_:_)), Inf) -> mapM_ isInf as -- Andreas, 2014-06-27: -- @Type (Max [])@ (which is Set0) falls through to error. (Inf , _ ) -> no (_ , Inf ) -> no -- Andreas, 2014-06-27: Why are there special cases for Set0? -- Andreas, 2015-02-14: Probably because s ⊔ s' = Set0 -- entailed that both s and s' are Set0. -- This is no longer true if SizeUniv ⊔ s = s -- (DLub s1 s2, s0@(Type (Max []))) -> do -- equalSort s1 s0 -- underAbstraction_ s2 $ \s2 -> equalSort s2 s0 -- (s0@(Type (Max [])), DLub s1 s2) -> do -- equalSort s0 s1 -- underAbstraction_ s2 $ \s2 -> equalSort s0 s2 (DLub{} , _ ) -> postpone (_ , DLub{} ) -> postpone --------------------------------------------------------------------------- -- * Definitions --------------------------------------------------------------------------- bothAbsurd :: QName -> QName -> TCM Bool bothAbsurd f f' | isAbsurdLambdaName f, isAbsurdLambdaName f' = do def <- getConstInfo f def' <- getConstInfo f' case (theDef def, theDef def') of (Function{ funCompiled = Just Fail}, Function{ funCompiled = Just Fail}) -> return True _ -> return False | otherwise = return False Agda-2.4.2.5/src/full/Agda/TypeChecking/Records.hs-boot0000644000000000000000000000071512635075266020563 0ustar0000000000000000 module Agda.TypeChecking.Records where import Agda.Syntax.Internal -- import Agda.Syntax.Abstract.Name import qualified Agda.Syntax.Concrete.Name as C import Agda.TypeChecking.Monad isRecord :: HasConstInfo m => QName -> m (Maybe Defn) isEtaRecord :: HasConstInfo m => QName -> m Bool getRecordFieldNames :: QName -> TCM [Arg C.Name] etaContractRecord :: HasConstInfo m => QName -> ConHead -> Args -> m Term isGeneratedRecordConstructor :: QName -> TCM Bool Agda-2.4.2.5/src/full/Agda/TypeChecking/Free.hs0000644000000000000000000004114012635075266017077 0ustar0000000000000000{-# LANGUAGE CPP #-} {-# LANGUAGE ConstraintKinds #-} {-# LANGUAGE FlexibleContexts #-} {-# LANGUAGE FlexibleInstances #-} {-# LANGUAGE MultiParamTypeClasses #-} -- | Computing the free variables of a term. -- -- The distinction between rigid and strongly rigid occurrences comes from: -- Jason C. Reed, PhD thesis, 2009, page 96 (see also his LFMTP 2009 paper) -- -- The main idea is that x = t(x) is unsolvable if x occurs strongly rigidly -- in t. It might have a solution if the occurrence is not strongly rigid, e.g. -- -- x = \f -> suc (f (x (\ y -> k))) has x = \f -> suc (f (suc k)) -- -- [Jason C. Reed, PhD thesis, page 106] -- -- Under coinductive constructors, occurrences are never strongly rigid. -- Also, function types and lambdas do not establish strong rigidity. -- Only inductive constructors do so. -- (See issue 1271). module Agda.TypeChecking.Free ( FreeVars(..) , Free, FreeV, FreeVS , IgnoreSorts(..) , allFreeVars, allRelevantVars, allRelevantVarsIgnoring , freeIn, freeInIgnoringSorts, isBinderUsed , relevantIn, relevantInIgnoringSortAnn , Occurrence(..) , occurrence , closed , freeVars -- only for testing ) where import Control.Applicative hiding (empty) import Control.Monad.Reader import Data.Foldable (foldMap) import Data.Monoid import Data.IntSet (IntSet) import qualified Data.IntSet as Set import qualified Agda.Benchmarking as Bench import Agda.Syntax.Common hiding (Arg, Dom, NamedArg) import Agda.Syntax.Internal import Agda.TypeChecking.Free.Lazy ( Free'(..) , FreeEnv(..), initFreeEnv , VarOcc(..), IgnoreSorts(..), Variable, SingleVar ) import qualified Agda.TypeChecking.Free.Lazy as Free import Agda.Utils.Function import Agda.Utils.Functor import Agda.Utils.Monad import Agda.Utils.Singleton #include "undefined.h" import Agda.Utils.Impossible type VarSet = IntSet -- | Free variables of a term, (disjointly) partitioned into strongly and -- and weakly rigid variables, flexible variables and irrelevant variables. data FreeVars = FV { stronglyRigidVars :: VarSet -- ^ Variables under only and at least one inductive constructor(s). , unguardedVars :: VarSet -- ^ Variables at top or only under inductive record constructors -- λs and Πs. -- The purpose of recording these separately is that they -- can still become strongly rigid if put under a constructor -- whereas weakly rigid ones stay weakly rigid. , weaklyRigidVars :: VarSet -- ^ Ordinary rigid variables, e.g., in arguments of variables. , flexibleVars :: VarSet -- ^ Variables occuring in arguments of metas. -- These are only potentially free, depending how the meta variable is instantiated. , irrelevantVars :: VarSet -- ^ Variables in irrelevant arguments and under a @DontCare@, i.e., -- in irrelevant positions. , unusedVars :: VarSet -- ^ Variables in 'UnusedArg'uments. } deriving (Eq, Show) mapSRV, mapUGV, mapWRV, mapFXV, mapIRV, mapUUV :: (VarSet -> VarSet) -> FreeVars -> FreeVars mapSRV f fv = fv { stronglyRigidVars = f $ stronglyRigidVars fv } mapUGV f fv = fv { unguardedVars = f $ unguardedVars fv } mapWRV f fv = fv { weaklyRigidVars = f $ weaklyRigidVars fv } mapFXV f fv = fv { flexibleVars = f $ flexibleVars fv } mapIRV f fv = fv { irrelevantVars = f $ irrelevantVars fv } mapUUV f fv = fv { unusedVars = f $ unusedVars fv } -- | Rigid variables: either strongly rigid, unguarded, or weakly rigid. rigidVars :: FreeVars -> VarSet rigidVars fv = Set.unions [ stronglyRigidVars fv , unguardedVars fv , weaklyRigidVars fv ] -- | All but the irrelevant variables. relevantVars :: FreeVars -> VarSet relevantVars fv = Set.unions [rigidVars fv, flexibleVars fv] -- | @allVars fv@ includes irrelevant variables. allVars :: FreeVars -> VarSet allVars fv = Set.unions [relevantVars fv, irrelevantVars fv, unusedVars fv] data Occurrence = NoOccurrence | Irrelevantly | StronglyRigid -- ^ Under at least one and only inductive constructors. | Unguarded -- ^ In top position, or only under inductive record constructors. | WeaklyRigid -- ^ In arguments to variables and definitions. | Flexible -- ^ In arguments of metas. | Unused deriving (Eq,Show) -- | Compute an occurrence of a single variable in a piece of internal syntax. occurrence :: FreeV a => Nat -> a -> Occurrence occurrence x v = occurrenceFV x $ freeVars v -- | Extract occurrence of a single variable from computed free variables. occurrenceFV :: Nat -> FreeVars -> Occurrence occurrenceFV x fv | x `Set.member` stronglyRigidVars fv = StronglyRigid | x `Set.member` unguardedVars fv = Unguarded | x `Set.member` weaklyRigidVars fv = WeaklyRigid | x `Set.member` flexibleVars fv = Flexible | x `Set.member` irrelevantVars fv = Irrelevantly | x `Set.member` unusedVars fv = Unused | otherwise = NoOccurrence -- | Mark variables as flexible. Useful when traversing arguments of metas. flexible :: FreeVars -> FreeVars flexible fv = fv { stronglyRigidVars = Set.empty , unguardedVars = Set.empty , weaklyRigidVars = Set.empty , flexibleVars = relevantVars fv } -- | Mark rigid variables as non-strongly. Useful when traversing arguments of variables. weakly :: FreeVars -> FreeVars weakly fv = fv { stronglyRigidVars = Set.empty , unguardedVars = Set.empty , weaklyRigidVars = rigidVars fv } -- | Mark unguarded variables as strongly rigid. Useful when traversing arguments of inductive constructors. strongly :: FreeVars -> FreeVars strongly fv = fv { stronglyRigidVars = stronglyRigidVars fv `Set.union` unguardedVars fv , unguardedVars = Set.empty } -- | What happens to the variables occurring under a constructor? underConstructor :: ConHead -> FreeVars -> FreeVars underConstructor (ConHead c i fs) = case (i,fs) of -- Coinductive (record) constructors admit infinite cycles: (CoInductive, _) -> weakly -- Inductive data constructors do not admit infinite cycles: (Inductive, []) -> strongly -- Inductive record constructors do not admit infinite cycles, -- but this cannot be proven inside Agda. -- Thus, unification should not prove it either. (Inductive, (_:_)) -> id -- | Mark all free variables as irrelevant. irrelevantly :: FreeVars -> FreeVars irrelevantly fv = empty { irrelevantVars = allVars fv } -- | Mark all free variables as unused, except for irrelevant vars. unused :: FreeVars -> FreeVars unused fv = empty { irrelevantVars = irrelevantVars fv , unusedVars = Set.unions [ rigidVars fv, flexibleVars fv, unusedVars fv ] } -- | Pointwise union. union :: FreeVars -> FreeVars -> FreeVars union (FV sv1 gv1 rv1 fv1 iv1 uv1) (FV sv2 gv2 rv2 fv2 iv2 uv2) = FV (Set.union sv1 sv2) (Set.union gv1 gv2) (Set.union rv1 rv2) (Set.union fv1 fv2) (Set.union iv1 iv2) (Set.union uv1 uv2) unions :: [FreeVars] -> FreeVars unions = foldr union empty empty :: FreeVars empty = FV Set.empty Set.empty Set.empty Set.empty Set.empty Set.empty -- | Free variable sets form a monoid under 'union'. instance Monoid FreeVars where mempty = empty mappend = union mconcat = unions -- | @delete x fv@ deletes variable @x@ from variable set @fv@. delete :: Nat -> FreeVars -> FreeVars delete n (FV sv gv rv fv iv uv) = FV (Set.delete n sv) (Set.delete n gv) (Set.delete n rv) (Set.delete n fv) (Set.delete n iv) (Set.delete n uv) instance Singleton Variable FreeVars where singleton (i, VarOcc o r) = mod (Set.insert i) empty where mod :: (VarSet -> VarSet) -> FreeVars -> FreeVars mod = case (o, r) of (_, Irrelevant) -> mapIRV (_, UnusedArg ) -> mapUUV (Free.StronglyRigid, _) -> mapSRV (Free.Unguarded , _) -> mapUGV (Free.WeaklyRigid , _) -> mapWRV (Free.Flexible , _) -> mapFXV -- * Collecting free variables. bench :: a -> a bench = Bench.billToPure [ Bench.Typing , Bench.Free ] type Free a = Free' a Any type FreeV a = Free' a FreeVars type FreeVS a = Free' a VarSet -- | Doesn't go inside solved metas, but collects the variables from a -- metavariable application @X ts@ as @flexibleVars@. {-# SPECIALIZE freeVars :: FreeV a => a -> FreeVars #-} freeVars :: (Monoid c, Singleton Variable c, Free' a c) => a -> c freeVars = freeVarsIgnore IgnoreNot {-# SPECIALIZE freeVarsIgnore :: FreeV a => IgnoreSorts -> a -> FreeVars #-} freeVarsIgnore :: (Monoid c, Singleton Variable c, Free' a c) => IgnoreSorts -> a -> c freeVarsIgnore = runFree singleton -- Specialization to typical monoids {-# SPECIALIZE runFree :: Free' a Any => SingleVar Any -> IgnoreSorts -> a -> Any #-} {-# SPECIALIZE runFree :: Free' a All => SingleVar All -> IgnoreSorts -> a -> All #-} {-# SPECIALIZE runFree :: Free' a VarSet => SingleVar VarSet -> IgnoreSorts -> a -> VarSet #-} {-# SPECIALIZE runFree :: Free' a FreeVars => SingleVar FreeVars -> IgnoreSorts -> a -> FreeVars #-} -- Specialization to Term {-# SPECIALIZE runFree :: SingleVar Any -> IgnoreSorts -> Term -> Any #-} {-# SPECIALIZE runFree :: SingleVar All -> IgnoreSorts -> Term -> All #-} {-# SPECIALIZE runFree :: SingleVar VarSet -> IgnoreSorts -> Term -> VarSet #-} {-# SPECIALIZE runFree :: SingleVar FreeVars -> IgnoreSorts -> Term -> FreeVars #-} runFree :: (Monoid c, Free' a c) => SingleVar c -> IgnoreSorts -> a -> c runFree singleton i t = -- bench $ -- Benchmarking is expensive (4% on std-lib) freeVars' t `runReader` (initFreeEnv singleton) { feIgnoreSorts = i } freeIn'' :: Free a => (VarOcc -> Bool) -> IgnoreSorts -> Nat -> a -> Bool freeIn'' test ig x t = getAny $ runFree (\ (y, o) -> Any $ x == y && test o) ig t -- | @freeIn' = freeIn'' (const True)@ freeIn' :: Free a => IgnoreSorts -> Nat -> a -> Bool freeIn' ig x t = getAny $ runFree (Any . (x ==) . fst) ig t {-# SPECIALIZE freeIn :: Nat -> Term -> Bool #-} freeIn :: Free a => Nat -> a -> Bool freeIn = freeIn' IgnoreNot freeInIgnoringSorts :: Free a => Nat -> a -> Bool freeInIgnoringSorts = freeIn' IgnoreAll freeInIgnoringSortAnn :: Free a => Nat -> a -> Bool freeInIgnoringSortAnn = freeIn' IgnoreInAnnotations relevantInIgnoringSortAnn :: Free a => Nat -> a -> Bool relevantInIgnoringSortAnn = freeIn'' (not . irrelevantOrUnused . varRelevance) IgnoreInAnnotations relevantIn :: Free a => Nat -> a -> Bool relevantIn = freeIn'' (not . irrelevantOrUnused . varRelevance) IgnoreAll -- | Is the variable bound by the abstraction actually used? isBinderUsed :: Free a => Abs a -> Bool isBinderUsed NoAbs{} = False isBinderUsed (Abs _ x) = 0 `freeIn` x -- | Is the term entirely closed (no free variables)? closed :: Free' a All => a -> Bool closed t = getAll $ runFree (const $ All False) IgnoreNot t -- | Collect all free variables. allFreeVars :: Free' a VarSet => a -> VarSet allFreeVars = runFree (Set.singleton . fst) IgnoreNot -- | Collect all relevant free variables, possibly ignoring sorts. allRelevantVarsIgnoring :: Free' a VarSet => IgnoreSorts -> a -> VarSet allRelevantVarsIgnoring = runFree sg where sg (i, VarOcc _ r) = if irrelevantOrUnused r then Set.empty else Set.singleton i -- | Collect all relevant free variables. allRelevantVars :: Free' a VarSet => a -> VarSet allRelevantVars = allRelevantVarsIgnoring IgnoreNot {- OLD -- | A single unguarded variable. singleton :: Nat -> FreeVars singleton x = empty { unguardedVars = Set.singleton x } -- * Collecting free variables. -- | Where should we skip sorts in free variable analysis? data IgnoreSorts = IgnoreNot -- ^ Do not skip. | IgnoreInAnnotations -- ^ Skip when annotation to a type. | IgnoreAll -- ^ Skip unconditionally. deriving (Eq, Show) data FreeConf = FreeConf { fcIgnoreSorts :: !IgnoreSorts -- ^ Ignore free variables in sorts. , fcContext :: !Int -- ^ Under how many binders have we stepped? } initFreeConf :: FreeConf initFreeConf = FreeConf { fcIgnoreSorts = IgnoreNot , fcContext = 0 } -- | Return type of fold over syntax. type FreeT = Reader FreeConf FreeVars instance Monoid FreeT where mempty = pure mempty mappend = liftA2 mappend mconcat = mconcat <.> sequence -- | Base case: a variable. variable :: Int -> FreeT variable n = do m <- (n -) <$> asks fcContext if m >= 0 then pure $ singleton m else mempty -- | Going under a binder. bind :: FreeT -> FreeT bind = local $ \ e -> e { fcContext = 1 + fcContext e } class Free a where freeVars' :: a -> FreeT instance Free Term where freeVars' t = case t of Var n ts -> variable n `mappend` do weakly <$> freeVars' ts -- λ is not considered guarding, as -- we cannot prove that x ≡ λy.x is impossible. Lam _ t -> freeVars' t Lit _ -> mempty Def _ ts -> weakly <$> freeVars' ts -- because we are not in TCM -- we cannot query whether we are dealing with a data/record (strongly r.) -- or a definition by pattern matching (weakly rigid) -- thus, we approximate, losing that x = List x is unsolvable Con c ts -> underConstructor c <$> freeVars' ts -- Pi is not guarding, since we cannot prove that A ≡ B → A is impossible. -- Even as we do not permit infinite type expressions, -- we cannot prove their absence (as Set is not inductive). -- Also, this is incompatible with univalence (HoTT). Pi a b -> freeVars' (a,b) Sort s -> freeVars' s Level l -> freeVars' l MetaV _ ts -> flexible <$> freeVars' ts DontCare mt -> irrelevantly <$> freeVars' mt Shared p -> freeVars' (derefPtr p) ExtLam cs ts -> freeVars' (cs, ts) instance Free Type where freeVars' (El s t) = ifM ((IgnoreNot ==) <$> asks fcIgnoreSorts) {- then -} (freeVars' (s, t)) {- else -} (freeVars' t) instance Free Sort where freeVars' s = ifM ((IgnoreAll ==) <$> asks fcIgnoreSorts) mempty $ {- else -} case s of Type a -> freeVars' a Prop -> mempty Inf -> mempty SizeUniv -> mempty DLub s1 s2 -> weakly <$> freeVars' (s1, s2) instance Free Level where freeVars' (Max as) = freeVars' as instance Free PlusLevel where freeVars' ClosedLevel{} = mempty freeVars' (Plus _ l) = freeVars' l instance Free LevelAtom where freeVars' l = case l of MetaLevel _ vs -> flexible <$> freeVars' vs NeutralLevel _ v -> freeVars' v BlockedLevel _ v -> freeVars' v UnreducedLevel v -> freeVars' v instance Free a => Free [a] where freeVars' = foldMap freeVars' instance Free a => Free (Maybe a) where freeVars' = foldMap freeVars' instance (Free a, Free b) => Free (a,b) where freeVars' (x,y) = freeVars' x `mappend` freeVars' y instance Free a => Free (Elim' a) where freeVars' (Apply a) = freeVars' a freeVars' (Proj{} ) = mempty instance Free a => Free (Arg a) where freeVars' a = f <$> freeVars' (unArg a) where f = case getRelevance a of Irrelevant -> irrelevantly UnusedArg -> unused _ -> id instance Free a => Free (Dom a) where freeVars' = freeVars' . unDom instance Free a => Free (Abs a) where freeVars' (Abs _ b) = bind $ freeVars' b freeVars' (NoAbs _ b) = freeVars' b instance Free a => Free (Tele a) where freeVars' EmptyTel = mempty freeVars' (ExtendTel a tel) = freeVars' (a, tel) instance Free ClauseBody where freeVars' (Body t) = freeVars' t freeVars' (Bind b) = freeVars' b freeVars' NoBody = mempty instance Free Clause where freeVars' = freeVars' . clauseBody bench :: a -> a bench = Bench.billToPure [ Bench.Typing , Bench.Free ] -- | Doesn't go inside solved metas, but collects the variables from a -- metavariable application @X ts@ as @flexibleVars@. freeVars :: Free a => a -> FreeVars freeVars t = freeVars' t `runReader` initFreeConf freeVarsIgnore :: Free a => IgnoreSorts -> a -> FreeVars freeVarsIgnore i t = freeVars' t `runReader` initFreeConf{ fcIgnoreSorts = i } freeIn :: Free a => Nat -> a -> Bool freeIn v t = bench $ v `Set.member` allVars (freeVars t) freeInIgnoringSorts :: Free a => Nat -> a -> Bool freeInIgnoringSorts v t = bench $ v `Set.member` allVars (freeVarsIgnore IgnoreAll t) freeInIgnoringSortAnn :: Free a => Nat -> a -> Bool freeInIgnoringSortAnn v t = bench $ v `Set.member` allVars (freeVarsIgnore IgnoreInAnnotations t) relevantInIgnoringSortAnn :: Free a => Nat -> a -> Bool relevantInIgnoringSortAnn v t = bench $ v `Set.member` relevantVars (freeVarsIgnore IgnoreInAnnotations t) relevantIn :: Free a => Nat -> a -> Bool relevantIn v t = bench $ v `Set.member` relevantVars (freeVarsIgnore IgnoreAll t) -- | Is the variable bound by the abstraction actually used? isBinderUsed :: Free a => Abs a -> Bool isBinderUsed NoAbs{} = False isBinderUsed (Abs _ x) = 0 `freeIn` x -- -} -- -} -- -} Agda-2.4.2.5/src/full/Agda/TypeChecking/LevelConstraints.hs0000644000000000000000000000306712635075266021523 0ustar0000000000000000module Agda.TypeChecking.LevelConstraints ( simplifyLevelConstraint ) where import Agda.Syntax.Common (Nat) import Agda.Syntax.Internal import Agda.TypeChecking.Monad.Base import Agda.TypeChecking.Substitute import Agda.Utils.Size -- | @simplifyLevelConstraint n c cs@ turns an @c@ into an equality -- constraint if it is an inequality constraint and the reverse -- inequality is contained in @cs@. Number @n@ is the length -- of the context @c@ is defined in. simplifyLevelConstraint :: Int -> Constraint -> Constraints -> Constraint simplifyLevelConstraint n new old = case inequalities new of [a :=< b] | elem (b' :=< a') leqs -> LevelCmp CmpEq (Max [a]) (Max [b]) where (a', b') = raise (waterLevel - n) (a, b) _ -> new where -- get the constraints plus their "waterLevels", i.e., -- length of contexts they are defined in unClosure c = (size (envContext $ clEnv cl), clValue cl) where cl = theConstraint c (ns, ls) = unzip $ map unClosure old -- compute the common water level waterLevel :: Nat waterLevel = maximum (n:ns) -- raise deBruijn indices to largest context to -- enable comparing constraints under different contexts leqs = concatMap inequalities $ zipWith raise (map (waterLevel -) ns) ls data Leq = PlusLevel :=< PlusLevel deriving (Show, Eq) inequalities :: Constraint -> [Leq] inequalities (LevelCmp CmpEq (Max [a, b]) (Max [c])) | a == c = [b :=< a] | b == c = [a :=< b] inequalities (LevelCmp CmpEq (Max [a]) (Max [b, c])) | a == b = [c :=< b] | a == c = [b :=< c] inequalities _ = [] Agda-2.4.2.5/src/full/Agda/TypeChecking/InstanceArguments.hs0000644000000000000000000003545712635075266021666 0ustar0000000000000000{-# LANGUAGE CPP #-} #if __GLASGOW_HASKELL__ >= 710 {-# LANGUAGE FlexibleContexts #-} #endif module Agda.TypeChecking.InstanceArguments where import Control.Applicative import Control.Monad.Reader import Control.Monad.State import qualified Data.Map as Map import Data.List as List import Agda.Syntax.Common import Agda.Syntax.Position import Agda.Syntax.Scope.Base import Agda.Syntax.Internal as I import Agda.TypeChecking.Errors () import Agda.TypeChecking.Implicit (implicitArgs) import Agda.TypeChecking.Irrelevance import Agda.TypeChecking.Monad import Agda.TypeChecking.Pretty import Agda.TypeChecking.Reduce import Agda.TypeChecking.Substitute import Agda.TypeChecking.Telescope import {-# SOURCE #-} Agda.TypeChecking.Constraints import {-# SOURCE #-} Agda.TypeChecking.Rules.Term (checkArguments) import {-# SOURCE #-} Agda.TypeChecking.MetaVars import {-# SOURCE #-} Agda.TypeChecking.Conversion import Agda.Utils.Except ( MonadError(catchError, throwError), runExceptT ) import Agda.Utils.Lens import Agda.Utils.Maybe import Agda.Utils.Monad import Agda.Utils.Pretty (prettyShow) #include "undefined.h" import Agda.Utils.Impossible -- | A candidate solution for an instance meta is a term with its type. type Candidate = (Term, Type) type Candidates = [Candidate] -- | Compute a list of instance candidates. -- 'Nothing' if type is a meta, error if type is not eligible -- for instance search. initialIFSCandidates :: Type -> TCM (Maybe Candidates) initialIFSCandidates t = do cands1 <- getContextVars otn <- getOutputTypeName t case otn of NoOutputTypeName -> typeError $ GenericError $ "Instance search can only be used to find elements in a named type" OutputTypeNameNotYetKnown -> return Nothing OutputTypeName n -> do cands2 <- getScopeDefs n return $ Just $ cands1 ++ cands2 where -- get a list of variables with their type, relative to current context getContextVars :: TCM Candidates getContextVars = do ctx <- getContext let vars = [ (var i, raise (i + 1) t) | (Dom info (x, t), i) <- zip ctx [0..] , not (unusableRelevance $ argInfoRelevance info) ] -- get let bindings env <- asks envLetBindings env <- mapM (getOpen . snd) $ Map.toList env let lets = [ (v,t) | (v, Dom info t) <- env , not (unusableRelevance $ argInfoRelevance info) ] return $ vars ++ lets getScopeDefs :: QName -> TCM Candidates getScopeDefs n = do instanceDefs <- getInstanceDefs rel <- asks envRelevance let qs = fromMaybe [] $ Map.lookup n instanceDefs catMaybes <$> mapM (candidate rel) qs candidate :: Relevance -> QName -> TCM (Maybe Candidate) candidate rel q = -- Andreas, 2012-07-07: -- we try to get the info for q -- while opening a module, q may be in scope but not in the signature -- in this case, we just ignore q (issue 674) flip catchError handle $ do def <- getConstInfo q let r = defRelevance def if not (r `moreRelevant` rel) then return Nothing else do t <- defType <$> instantiateDef def args <- freeVarsToApply q let v = case theDef def of -- drop parameters if it's a projection function... Function{ funProjection = Just p } -> projDropPars p `apply` args -- Andreas, 2014-08-19: constructors cannot be declared as -- instances (at least as of now). -- I do not understand why the Constructor case is not impossible. -- Ulf, 2014-08-20: constructors are always instances. Constructor{ conSrcCon = c } -> Con c [] _ -> Def q $ map Apply args return $ Just (v, t) where -- unbound constant throws an internal error handle (TypeError _ (Closure {clValue = InternalError _})) = return Nothing handle err = throwError err -- | @initializeIFSMeta s t@ generates an instance meta of type @t@ -- with suggested name @s@. initializeIFSMeta :: String -> Type -> TCM Term initializeIFSMeta s t = do t <- reduce t -- see Issue 1321 cands <- initialIFSCandidates t newIFSMeta s t cands -- | @findInScope m (v,a)s@ tries to instantiate on of the types @a@s -- of the candidate terms @v@s to the type @t@ of the metavariable @m@. -- If successful, meta @m@ is solved with the instantiation of @v@. -- If unsuccessful, the constraint is regenerated, with possibly reduced -- candidate set. -- The list of candidates is equal to @Nothing@ when the type of the meta -- wasn't known when the constraint was generated. In that case, try to find -- its type again. findInScope :: MetaId -> Maybe Candidates -> TCM () findInScope m Nothing = do -- Andreas, 2015-02-07: New metas should be created with range of the -- current instance meta, thus, we set the range. mv <- lookupMeta m setCurrentRange mv $ do reportSLn "tc.instance" 20 $ "The type of the FindInScope constraint isn't known, trying to find it again." t <- getMetaType m cands <- initialIFSCandidates t case cands of Nothing -> addConstraint $ FindInScope m Nothing Just {} -> findInScope m cands findInScope m (Just cands) = whenJustM (findInScope' m cands) $ addConstraint . FindInScope m . Just -- | Result says whether we need to add constraint, and if so, the set of -- remaining candidates. findInScope' :: MetaId -> Candidates -> TCM (Maybe Candidates) findInScope' m cands = ifM (isFrozen m) (return (Just cands)) $ do -- Andreas, 2013-12-28 issue 1003: -- If instance meta is already solved, simply discard the constraint. ifM (isInstantiatedMeta m) (return Nothing) $ do -- Andreas, 2015-02-07: New metas should be created with range of the -- current instance meta, thus, we set the range. mv <- lookupMeta m setCurrentRange mv $ do reportSLn "tc.instance" 15 $ "findInScope 2: constraint: " ++ prettyShow m ++ "; candidates left: " ++ show (length cands) t <- normalise =<< getMetaTypeInContext m reportSDoc "tc.instance" 15 $ text "findInScope 3: t =" <+> prettyTCM t reportSLn "tc.instance" 70 $ "findInScope 3: t: " ++ show t -- If there are recursive instances, it's not safe to instantiate -- metavariables in the goal, so we freeze them before checking candidates. -- Metas that are rigidly constrained need not be frozen. isRec <- orM $ map (isRecursive . unEl . snd) cands let shouldFreeze rigid m | elem m rigid = return False | otherwise = not <$> isFrozen m metas <- if not isRec then return [] else do rigid <- rigidlyConstrainedMetas filterM (shouldFreeze rigid) (allMetas t) forM_ metas $ \ m -> updateMetaVar m $ \ mv -> mv { mvFrozen = Frozen } cands <- checkCandidates m t cands reportSLn "tc.instance" 15 $ "findInScope 4: cands left: " ++ show (length cands) unfreezeMeta metas case cands of [] -> do reportSDoc "tc.instance" 15 $ text "findInScope 5: not a single candidate found..." typeError $ IFSNoCandidateInScope t [(term, t')] -> do reportSDoc "tc.instance" 15 $ vcat [ text "findInScope 5: found one candidate" , nest 2 $ prettyTCM term , text "of type " <+> prettyTCM t' , text "for type" <+> prettyTCM t ] -- If t' takes initial hidden and instance arguments, apply them. -- Taking also instance arguments facilitates recursive instance search. (args, t'') <- implicitArgs (-1) notVisible t' leqType t'' t ctxArgs <- getContextArgs v <- (`applyDroppingParameters` args) =<< reduce term assignV DirEq m ctxArgs v reportSDoc "tc.instance" 10 $ vcat [ text "solved by instance search:" , prettyTCM m <+> text ":=" <+> prettyTCM v ] return Nothing cs -> do reportSDoc "tc.instance" 15 $ text ("findInScope 5: more than one candidate found: ") <+> prettyTCM (List.map fst cs) return (Just cs) where -- | Check whether a type is a function type with an instance domain. isRecursive :: Term -> TCM Bool isRecursive v = do v <- reduce v case ignoreSharing v of Pi (Dom info _) t -> if getHiding info == Instance then return True else isRecursive $ unEl $ unAbs t _ -> return False -- | A meta _M is rigidly constrained if there is a constraint _M us == D vs, -- for inert D. Such metas can safely be instantiated by recursive instance -- search, since the constraint limits the solution space. rigidlyConstrainedMetas :: TCM [MetaId] rigidlyConstrainedMetas = do cs <- (++) <$> use stSleepingConstraints <*> use stAwakeConstraints catMaybes <$> mapM rigidMetas cs where isRigid v = case v of Def f _ -> return True -- def <- getConstInfo f -- case theDef def of -- Record{} -> return True -- Datatype{} -> return True -- Axiom{} -> return True -- _ Con{} -> return True Lit{} -> return True Var{} -> return True _ -> return False rigidMetas c = case clValue $ theConstraint c of ValueCmp _ _ u v -> case (u, v) of (MetaV m _, _) -> ifM (isRigid v) (return $ Just m) (return Nothing) (_, MetaV m _) -> ifM (isRigid u) (return $ Just m) (return Nothing) _ -> return Nothing ElimCmp{} -> return Nothing TypeCmp{} -> return Nothing TelCmp{} -> return Nothing SortCmp{} -> return Nothing LevelCmp{} -> return Nothing UnBlock{} -> return Nothing Guarded{} -> return Nothing -- don't look inside Guarded, since the inner constraint might not fire IsEmpty{} -> return Nothing CheckSizeLtSat{} -> return Nothing FindInScope{} -> return Nothing -- | Given a meta @m@ of type @t@ and a list of candidates @cands@, -- @checkCandidates m t cands@ returns a refined list of valid candidates. checkCandidates :: MetaId -> Type -> Candidates -> TCM Candidates checkCandidates m t cands = localTCState $ disableDestructiveUpdate $ do -- for candidate checking, we don't take into account other IFS -- constraints dropConstraints (isIFSConstraint . clValue . theConstraint) cands <- filterM (uncurry $ checkCandidateForMeta m t) cands -- Drop all candidates which are equal to the first one dropSameCandidates cands where checkCandidateForMeta :: MetaId -> Type -> Term -> Type -> TCM Bool checkCandidateForMeta m t term t' = do -- Andreas, 2015-02-07: New metas should be created with range of the -- current instance meta, thus, we set the range. mv <- lookupMeta m setCurrentRange mv $ do verboseBracket "tc.instance" 20 ("checkCandidateForMeta " ++ prettyShow m) $ do liftTCM $ flip catchError handle $ do reportSLn "tc.instance" 70 $ " t: " ++ show t ++ "\n t':" ++ show t' ++ "\n term: " ++ show term ++ "." reportSDoc "tc.instance" 20 $ vcat [ text "checkCandidateForMeta" , text "t =" <+> prettyTCM t , text "t' =" <+> prettyTCM t' , text "term =" <+> prettyTCM term ] -- domi: we assume that nothing below performs direct IO -- (except for logging and such, I guess) localTCState $ do -- Apply hidden and instance arguments (recursive inst. search!). (args, t'') <- implicitArgs (-1) notVisible t' reportSDoc "tc.instance" 20 $ text "instance search: checking" <+> prettyTCM t'' <+> text "<=" <+> prettyTCM t -- if constraints remain, we abort, but keep the candidate flip (ifNoConstraints_ $ leqType t'' t) (const $ return True) $ do ctxArgs <- getContextArgs v <- (`applyDroppingParameters` args) =<< reduce term reportSDoc "tc.instance" 15 $ vcat [ text "instance search: attempting" , nest 2 $ prettyTCM m <+> text ":=" <+> prettyTCM v ] assign DirEq m ctxArgs v -- assign m ctxArgs (term `apply` args) -- make a pass over constraints, to detect cases where some are made -- unsolvable by the assignment, but don't do this for FindInScope's -- to prevent loops. We currently also ignore UnBlock constraints -- to be on the safe side. solveAwakeConstraints' True return True where handle :: TCErr -> TCM Bool handle err = do reportSDoc "tc.instance" 50 $ text "assignment failed:" <+> prettyTCM err return False isIFSConstraint :: Constraint -> Bool isIFSConstraint FindInScope{} = True isIFSConstraint UnBlock{} = True -- otherwise test/fail/Issue723 loops isIFSConstraint _ = False -- Drop all candidates which are judgmentally equal to the first one. -- This is sufficient to reduce the list to a singleton should all be equal. dropSameCandidates :: Candidates -> TCM Candidates dropSameCandidates cands = do case cands of [] -> return cands c@(v,a) : vas -> (c:) <$> dropWhileM equal vas where equal (v',a') = dontAssignMetas $ ifNoConstraints_ (equalType a a' >> equalTerm a v v') {- then -} (return True) {- else -} (\ _ -> return False) `catchError` (\ _ -> return False) -- | To preserve the invariant that a constructor is not applied to its -- parameter arguments, we explicitly check whether function term -- we are applying to arguments is a unapplied constructor. -- In this case we drop the first 'conPars' arguments. -- See Issue670a. -- Andreas, 2013-11-07 Also do this for projections, see Issue670b. applyDroppingParameters :: Term -> Args -> TCM Term applyDroppingParameters t vs = do let fallback = return $ t `apply` vs case ignoreSharing t of Con c [] -> do def <- theDef <$> getConInfo c case def of Constructor {conPars = n} -> return $ Con c (genericDrop n vs) _ -> __IMPOSSIBLE__ Def f [] -> do mp <- isProjection f case mp of Just Projection{projIndex = n} -> do case drop n vs of [] -> return t u : us -> (`apply` us) <$> applyDef f u _ -> fallback _ -> fallback Agda-2.4.2.5/src/full/Agda/TypeChecking/With.hs0000644000000000000000000006464512635075266017150 0ustar0000000000000000{-# LANGUAGE CPP #-} {-# LANGUAGE PatternGuards #-} {-# LANGUAGE TupleSections #-} module Agda.TypeChecking.With where import Control.Applicative import Control.Monad import Control.Monad.State import Data.List import Data.Maybe import qualified Data.Traversable as Trav (traverse) import Agda.Syntax.Common as Common import Agda.Syntax.Internal as I import Agda.Syntax.Internal.Pattern import qualified Agda.Syntax.Abstract as A import Agda.Syntax.Abstract.Views import Agda.Syntax.Info import Agda.Syntax.Position import Agda.TypeChecking.Monad import Agda.TypeChecking.Reduce import Agda.TypeChecking.Datatypes import Agda.TypeChecking.EtaContract import Agda.TypeChecking.Free import Agda.TypeChecking.Patterns.Abstract import Agda.TypeChecking.Pretty import Agda.TypeChecking.Records import Agda.TypeChecking.Substitute import Agda.TypeChecking.Telescope import Agda.TypeChecking.Abstract import Agda.TypeChecking.Rules.LHS.Implicit import Agda.TypeChecking.Rules.LHS (isFlexiblePattern) import Agda.Utils.Functor import Agda.Utils.List import Agda.Utils.Monad import Agda.Utils.Permutation import Agda.Utils.Pretty (prettyShow) import Agda.Utils.Size #include "undefined.h" import Agda.Utils.Impossible -- | Split pattern variables according to with-expressions. -- Input: -- -- [@Δ@] context of types and with-arguments. -- -- [@Δ ⊢ t@] type of rhs. -- -- [@Δ ⊢ as@] types of with arguments. -- -- [@Δ ⊢ vs@] with arguments. -- -- -- Output: -- -- [@Δ₁@] part of context not needed for with arguments and their types. -- -- [@Δ₂@] part of context needed for with arguments and their types. -- -- [@π@] permutation from Δ to Δ₁Δ₂ as returned by 'splitTelescope'. -- -- [@Δ₁Δ₂ ⊢ t'@] type of rhs under @π@ -- -- [@Δ₁ ⊢ as'@] types with with-arguments depending only on @Δ₁@. -- -- [@Δ₁ ⊢ vs'@] with-arguments under @π@. splitTelForWith -- Input: :: Telescope -- ^ __@Δ@__ context of types and with-arguments. -> Type -- ^ __@Δ ⊢ t@__ type of rhs. -> [Type] -- ^ __@Δ ⊢ as@__ types of with arguments. -> [Term] -- ^ __@Δ ⊢ vs@__ with arguments. -- Output: -> ( Telescope -- @Δ₁@ part of context not needed for with arguments and their types. , Telescope -- @Δ₂@ part of context needed for with arguments and their types. , Permutation -- @π@ permutation from Δ to Δ₁Δ₂ as returned by 'splitTelescope'. , Type -- @Δ₁Δ₂ ⊢ t'@ type of rhs under @π@ , [Type] -- @Δ₁ ⊢ as'@ types with with-arguments depending only on @Δ₁@. , [Term] -- @Δ₁ ⊢ vs'@ with-arguments under @π@. ) -- ^ (__@Δ₁@__,__@Δ₂@__,__@π@__,__@t'@__,__@as'@__,__@vs'@__) where -- -- [@Δ₁@] part of context not needed for with arguments and their types. -- -- [@Δ₂@] part of context needed for with arguments and their types. -- -- [@π@] permutation from Δ to Δ₁Δ₂ as returned by 'splitTelescope'. -- -- [@Δ₁Δ₂ ⊢ t'@] type of rhs under @π@ -- -- [@Δ₁ ⊢ as'@] types with with-arguments depending only on @Δ₁@. -- -- [@Δ₁ ⊢ vs'@] with-arguments under @π@. splitTelForWith delta t as vs = let -- Split the telescope into the part needed to type the with arguments -- and all the other stuff fv = allFreeVars as SplitTel delta1 delta2 perm = splitTelescope fv delta -- Δ₁Δ₂ ⊢ π : Δ pi = renaming (reverseP perm) -- Δ₁ ⊢ ρ : Δ₁Δ₂ (We know that as does not depend on Δ₂.) rho = strengthenS __IMPOSSIBLE__ $ size delta2 -- Δ₁ ⊢ ρ ∘ π : Δ rhopi = composeS rho pi -- We need Δ₁Δ₂ ⊢ t' t' = applySubst pi t -- and Δ₁ ⊢ as' as' = applySubst rhopi as -- and Δ₁ ⊢ vs' : as' vs' = applySubst pi vs in (delta1, delta2, perm, t', as', vs') -- | Abstract with-expressions @vs@ to generate type for with-helper function. withFunctionType :: Telescope -- ^ @Δ₁@ context for types of with types. -> [Term] -- ^ @Δ₁,Δ₂ ⊢ vs : raise Δ₂ as@ with-expressions. -> [Type] -- ^ @Δ₁ ⊢ as@ types of with-expressions. -> Telescope -- ^ @Δ₁ ⊢ Δ₂@ context extension to type with-expressions. -> Type -- ^ @Δ₁,Δ₂ ⊢ b@ type of rhs. -> TCM Type -- ^ @Δ₁ → wtel → Δ₂′ → b′@ such that -- @[vs/wtel]wtel = as@ and -- @[vs/wtel]Δ₂′ = Δ₂@ and -- @[vs/wtel]b′ = b@. withFunctionType delta1 vs as delta2 b = addCtxTel delta1 $ do -- Normalize and η-contract the types @as@ of the with-expressions. reportSLn "tc.with.abstract" 20 $ "preparing for with-abstraction" as <- etaContract =<< normalise as reportSDoc "tc.with.abstract" 20 $ text " as = " <+> prettyTCM as -- Normalize and η-contract the type @b@ of the rhs and the types @delta2@ -- of the pattern variables not mentioned in @as@. d2b <- return $ telePi_ delta2 b reportSDoc "tc.with.abstract" 30 $ text "normalizing d2b = " <+> prettyTCM d2b d2b <- normalise d2b reportSDoc "tc.with.abstract" 30 $ text "eta-contracting d2b = " <+> prettyTCM d2b d2b <- etaContract d2b reportSDoc "tc.with.abstract" 20 $ text " d2b = " <+> prettyTCM d2b let n2 = size delta2 TelV delta2 b <- telViewUpTo n2 d2b addContext delta2 $ do -- Normalize and η-contract the with-expressions @vs@. vs <- etaContract =<< normalise vs reportSDoc "tc.with.abstract" 20 $ text " vs = " <+> prettyTCM vs reportSDoc "tc.with.abstract" 40 $ sep [ text "abstracting" , nest 2 $ vcat $ [ text "vs = " <+> prettyTCM vs , text "as = " <+> escapeContext n2 (prettyTCM as) , text "delta2 = " <+> escapeContext n2 (prettyTCM delta2) , text "b = " <+> prettyTCM b ] ] reportSLn "tc.with.abstract" 50 $ " raw vs = " ++ show vs ++ "\n raw b = " ++ show b -- Abstract in @b@ and in @as@, generating @wtel@ and @b'@. ----------------------------------------------------------- -- Δ₁, Δ₂ ⊢ wtel0 -- Δ₁, Δ₂, wtel0 ⊢ b0 let TelV wtel0 b0 = telView'UpTo (size as) $ foldr (uncurry piAbstractTerm) b $ zip vs $ raise n2 as -- We know the types in wtel0 (abstracted versions of @as@) do not depend on Δ₂. -- Δ₁ ⊢ wtel let wtel = applySubst (strengthenS __IMPOSSIBLE__ n2) wtel0 -- Δ₁, Δ₂, wtel ⊢ ρ : Δ₁, wtel, Δ₂ let m = n2 + size wtel let rho = (map var $ [n2..m-1] ++ [0..n2-1]) ++# raiseS m -- Using ρ, swap the variables of wtel and Δ₂ to get -- Δ₁, wtel, Δ₂ ⊢ b' let b' = applySubst rho b0 -- Abstract in @Δ₂@ to get @Δ₁, wtel ⊢ Δ₂′@. ------------------------------------------ -- Δ₁, Δ₂ ⊢ Δ₂flat let delta2flat = flattenTel delta2 let abstrvs t = foldl (flip abstractTerm) t $ zipWith raise [0..] vs -- Δ₁, Δ₂, wtel ⊢ Δ₂abs let delta2abs = abstrvs delta2flat -- Δ₁, wtel, Δ₂ ⊢ Δ₂flat' let delta2flat' = applySubst rho delta2abs -- Δ₁, wtel ⊢ Δ₂′ let delta2' = unflattenTel (teleNames delta2) delta2flat' -- Assemble final type of with-function. ---------------------------------------- let ty = telePi_ delta1 $ telePi_ wtel $ telePi_ delta2' b' reportSDoc "tc.with.abstract" 20 $ sep $ [ text "finished with-abstraction" , text " wtel0 = " <+> prettyTCM wtel0 , text " wtel = " <+> do escapeContext n2 $ prettyTCM wtel , text " b0 = " <+> addContext wtel (prettyTCM b0) , text " b' = " <+> do escapeContext n2 $ addContext wtel $ addContext delta2 $ prettyTCM b' , text " delta2flat = " <+> prettyTCM delta2flat , text " delta2flat' = " <+> do addContext wtel $ prettyTCM delta2flat' , text " delta2' = " <+> do escapeContext n2 $ addContext wtel $ prettyTCM delta2' , text " ty = " <+> do escapeContext n2 $ escapeContext (size delta1) $ prettyTCM delta2' ] return ty -- | Compute the clauses for the with-function given the original patterns. buildWithFunction :: QName -- ^ Name of the parent function. -> QName -- ^ Name of the with-function. -> Type -- ^ Types of the parent function. -> [I.NamedArg Pattern] -- ^ Parent patterns. -> Permutation -- ^ Final permutation. -> Nat -- ^ Number of needed vars. -> Nat -- ^ Number of with expressions. -> [A.SpineClause] -- ^ With-clauses. -> TCM [A.SpineClause] -- ^ With-clauses flattened wrt. parent patterns. buildWithFunction f aux t qs perm n1 n cs = mapM buildWithClause cs where buildWithClause (A.Clause (A.SpineLHS i _ ps wps) rhs wh) = do let (wps0, wps1) = genericSplitAt n wps ps0 = map defaultNamedArg wps0 rhs <- buildRHS rhs (ps1, ps2) <- genericSplitAt n1 <$> stripWithClausePatterns f aux t qs perm ps let result = A.Clause (A.SpineLHS i aux (ps1 ++ ps0 ++ ps2) wps1) rhs wh reportSDoc "tc.with" 20 $ vcat [ text "buildWithClause returns" <+> prettyA result ] return result buildRHS rhs@(A.RHS _) = return rhs buildRHS rhs@A.AbsurdRHS = return rhs buildRHS (A.WithRHS q es cs) = A.WithRHS q es <$> mapM (A.spineToLhs <.> buildWithClause . A.lhsToSpine) cs buildRHS (A.RewriteRHS qes rhs wh) = flip (A.RewriteRHS qes) wh <$> buildRHS rhs {-| @stripWithClausePatterns parent f t qs π ps = ps'@ [@Δ@] context bound by lhs of original function (not an argument). [@f@] name of @with@-function. [@t@] type of the original function. [@qs@] internal patterns for original function. [@π@] permutation taking @vars(qs)@ to @support(Δ)@. [@ps@] patterns in with clause (eliminating type @t@). [@ps'@] patterns for with function (presumably of type @Δ@). Example: @ record Stream (A : Set) : Set where coinductive constructor delay field force : A × Stream A record SEq (s t : Stream A) : Set where coinductive field ~force : let a , as = force s b , bs = force t in a ≡ b × SEq as bs test : (s : Nat × Stream Nat) (t : Stream Nat) → SEq (delay s) t → SEq t (delay s) ~force (test (a , as) t p) with force t ~force (test (suc n , as) t p) | b , bs = {!!} @ With function: @ f : (t : Stream Nat) (w : Nat × Stream Nat) (a : Nat) (as : Stream Nat) (p : SEq (delay (a , as)) t) → (fst w ≡ a) × SEq (snd w) as Δ = t a as p -- reorder to bring with-relevant (= needed) vars first π = a as t p → Δ qs = (a , as) t p ~force ps = (suc n , as) t p ~force ps' = (suc n) as t p @ Resulting with-function clause is: @ f t (b , bs) (suc n) as t p @ Note: stripWithClausePatterns factors @ps@ through @qs@, thus @ ps = qs[ps'] @ where @[..]@ is to be understood as substitution. The projection patterns have vanished from @ps'@ (as they are already in @qs@). -} stripWithClausePatterns :: QName -- ^ Name of the parent function. -> QName -- ^ Name of with-function. -> Type -- ^ __@t@__ type of the original function. -> [I.NamedArg Pattern] -- ^ __@qs@__ internal patterns for original function. -> Permutation -- ^ __@π@__ permutation taking @vars(qs)@ to @support(Δ)@. -> [A.NamedArg A.Pattern] -- ^ __@ps@__ patterns in with clause (eliminating type @t@). -> TCM [A.NamedArg A.Pattern] -- ^ __@ps'@__ patterns for with function (presumably of type @Δ@). stripWithClausePatterns parent f t qs perm ps = do -- Andreas, 2014-03-05 expand away pattern synoyms (issue 1074) ps <- expandPatternSynonyms ps psi <- insertImplicitPatternsT ExpandLast ps t reportSDoc "tc.with.strip" 10 $ vcat [ text "stripping patterns" , nest 2 $ text "t = " <+> prettyTCM t , nest 2 $ text "psi = " <+> fsep (punctuate comma $ map prettyA psi) , nest 2 $ text "qs = " <+> fsep (punctuate comma $ map (prettyTCM . namedArg) qs) ] -- Andreas, 2015-11-09 Issue 1710: self starts with parent-function, not with-function! ps' <- strip (Def parent []) t psi $ numberPatVars perm qs let psp = permute perm ps' reportSDoc "tc.with.strip" 10 $ vcat [ nest 2 $ text "ps' = " <+> fsep (punctuate comma $ map prettyA ps') , nest 2 $ text "psp = " <+> fsep (punctuate comma $ map prettyA $ psp) ] -- Andreas, 2014-03-05 Issue 142: -- In some cases, permute throws away some dot patterns of ps' -- which are then never checked. if True then return psp else do -- Andreas, 2014-03-05 Disabled the fix for issue 142, the following is dead code: forM_ (permute (droppedP perm) ps') $ \ p -> setCurrentRange p $ do reportSDoc "tc.with.strip" 10 $ text "warning: dropped pattern " <+> prettyA p reportSDoc "tc.with.strip" 60 $ text $ show p case namedArg p of A.DotP info e -> case unScope e of A.Underscore{} -> return () -- Dot patterns without a range are Agda-generated from a user dot pattern -- so we only complain if there is a range. e | getRange info /= noRange -> typeError $ GenericError $ "This inaccessible pattern is never checked, so only _ allowed here" _ -> return () _ -> return () return psp where strip :: Term -- ^ Self. -> Type -- ^ The type to be eliminated. -> [A.NamedArg A.Pattern] -- ^ With-clause patterns. -> [I.NamedArg DeBruijnPattern] -- ^ Parent-clause patterns with de Bruijn indices relative to Δ. -> TCM [A.NamedArg A.Pattern] -- ^ With-clause patterns decomposed by parent-clause patterns. -- Case: out of with-clause patterns. strip self t [] qs@(_ : _) = do -- Andreas, 2015-06-11, issue 1551: -- As the type t develops, we need to insert more implicit patterns, -- due to copatterns / flexible arity. ps <- insertImplicitPatternsT ExpandLast [] t if null ps then typeError $ GenericError $ "Too few arguments given in with-clause" else strip self t ps qs -- Case: out of parent-clause patterns. -- This is only ok if all remaining with-clause patterns -- are implicit patterns (we inserted too many). strip _ _ ps [] = do let implicit (A.WildP{}) = True implicit (A.ConP ci _ _) = patOrigin ci == ConPImplicit implicit _ = False unless (all (implicit . namedArg) ps) $ typeError $ GenericError $ "Too many arguments given in with-clause" return [] -- Case: both parent-clause pattern and with-clause pattern present. -- Make sure they match, and decompose into subpatterns. strip self t ps0@(p0 : ps) qs0@(q : qs) = do p <- expandLitPattern p0 reportSDoc "tc.with.strip" 15 $ vcat [ text "strip" , nest 2 $ text "ps0 =" <+> fsep (punctuate comma $ map prettyA ps0) , nest 2 $ text "exp =" <+> prettyA p , nest 2 $ text "qs0 =" <+> fsep (punctuate comma $ map (prettyTCM . namedArg) qs0) , nest 2 $ text "self=" <+> prettyTCM self , nest 2 $ text "t =" <+> prettyTCM t ] let failDotPat = do d <- prettyA p typeError $ GenericError $ "Inaccessible (dotted) patterns from the parent clause must " ++ "also be inaccessible in the with clause, when checking the " ++ "pattern " ++ show d ++ "," case namedArg q of ProjP d -> case A.isProjP p of Just d' -> do d' <- getOriginalProjection d' if d /= d' then mismatch else do t <- reduce t (self1, t1) <- fromMaybe __IMPOSSIBLE__ <$> projectTyped self t d strip self1 t1 ps qs Nothing -> mismatch VarP (i, _x) -> do ps <- intro1 t $ \ t -> strip (self `apply1` var i) t ps qs return $ p : ps DotP v -> case namedArg p of A.DotP _ _ -> ok p A.WildP _ -> ok p -- Andreas, 2013-03-21 in case the implicit A.pattern has already been eta-expanded -- we just fold it back. This fixes issues 665 and 824. A.ConP ci _ _ | patOrigin ci == ConPImplicit -> okFlex p -- Andreas, 2015-07-07 issue 1606: Same for flexible record patterns. -- Agda might have replaced a record of dot patterns (A.ConP) by a dot pattern (I.DotP). p'@A.ConP{} -> ifM (isFlexiblePattern p') (okFlex p) {-else-} failDotPat p@(A.PatternSynP pi' c' [ps']) -> do reportSDoc "impossible" 10 $ text "stripWithClausePatterns: encountered pattern synonym " <+> prettyA p __IMPOSSIBLE__ _ -> failDotPat where okFlex = ok . makeImplicitP ok p = do t' <- piApply1 t v (p :) <$> strip (self `apply1` v) t' ps qs q'@(ConP c ci qs') -> do reportSDoc "tc.with.strip" 60 $ text "parent pattern is constructor " <+> prettyTCM c (a, b) <- mustBePi t case namedArg p of -- Andreas, 2015-07-07 Issue 1606. -- Agda sometimes changes a record of dot patterns into a dot pattern, -- so the user should be allowed to do likewise. A.DotP{} -> ifNotM (isFlexiblePattern q') mismatch $ {-else-} do maybe __IMPOSSIBLE__ (\ p -> strip self t (p : ps) qs0) =<< do expandImplicitPattern' (unDom a) $ makeImplicitP p -- Andreas, 2013-03-21 if we encounter an implicit pattern -- in the with-clause, we expand it and restart -- Andreas, 2015-07-07 Issue 1606 do this whenever the parent -- is a record pattern, regardless of whether it came from an implicit -- or not. This allows to drop hidden flexible record patterns from -- the with clauses even when they were present in the parent clause. A.WildP{} | Just _ <- conPRecord ci -> do maybe __IMPOSSIBLE__ (\ p -> strip self t (p : ps) qs0) =<< expandImplicitPattern' (unDom a) p A.ConP _ (A.AmbQ cs') ps' -> do c <- (`withRangeOf` c) <$> do getConForm $ conName c cs' <- mapM getConForm cs' unless (elem c cs') mismatch -- The type is a datatype Def d es <- ignoreSharing <$> normalise (unEl $ unDom a) let us = fromMaybe __IMPOSSIBLE__ $ allApplyElims es -- Compute the argument telescope for the constructor Defn {defType = ct, theDef = Constructor{conPars = np}} <- getConInfo c let ct' = ct `apply` genericTake np us TelV tel' _ <- telView ct' reportSDoc "tc.with.strip" 20 $ vcat [ text "ct = " <+> prettyTCM ct , text "ct' = " <+> prettyTCM ct' , text "np = " <+> text (show np) , text "us = " <+> prettyList (map prettyTCM us) , text "us' = " <+> prettyList (map prettyTCM $ genericTake np us) ] -- Compute the new type let v = Con c [ Arg info (var i) | (i, Arg info _) <- zip (downFrom $ size qs') qs' ] t' = tel' `abstract` absApp (raise (size tel') b) v self' = tel' `abstract` apply1 (raise (size tel') self) v -- Issue 1546 reportSDoc "tc.with.strip" 15 $ sep [ text "inserting implicit" , nest 2 $ prettyList $ map prettyA (ps' ++ ps) , nest 2 $ text ":" <+> prettyTCM t' ] -- Insert implicit patterns (just for the constructor arguments) psi' <- insertImplicitPatterns ExpandLast ps' tel' unless (size psi' == size tel') $ typeError $ WrongNumberOfConstructorArguments (conName c) (size tel') (size psi') -- Keep going strip self' t' (psi' ++ ps) (qs' ++ qs) p@(A.PatternSynP pi' c' ps') -> do reportSDoc "impossible" 10 $ text "stripWithClausePatterns: encountered pattern synonym " <+> prettyA p __IMPOSSIBLE__ p -> do reportSDoc "tc.with.strip" 60 $ text $ "with clause pattern is " ++ show p mismatch LitP lit -> case namedArg p of A.LitP lit' | lit == lit' -> do (a, b) <- mustBePi t let v = Lit lit strip (self `apply1` v) (b `absApp` v) ps qs p@(A.PatternSynP pi' c' [ps']) -> do reportSDoc "impossible" 10 $ text "stripWithClausePatterns: encountered pattern synonym " <+> prettyA p __IMPOSSIBLE__ _ -> mismatch where mismatch = typeError $ WithClausePatternMismatch (namedArg p0) (snd <$> namedArg q) -- | Make an ImplicitP, keeping arg. info. makeImplicitP :: A.NamedArg A.Pattern -> A.NamedArg A.Pattern makeImplicitP = updateNamedArg $ const $ A.WildP patNoRange -- | Construct the display form for a with function. It will display -- applications of the with function as applications to the original function. -- For instance, -- -- @ -- aux a b c -- @ -- -- as -- -- @ -- f (suc a) (suc b) | c -- @ withDisplayForm :: QName -- ^ The name of parent function. -> QName -- ^ The name of the @with@-function. -> Telescope -- ^ __@Δ₁@__ The arguments of the @with@ function before the @with@ expressions. -> Telescope -- ^ __@Δ₂@__ The arguments of the @with@ function after the @with@ expressions. -> Nat -- ^ __@n@__ The number of @with@ expressions. -> [I.NamedArg Pattern] -- ^ __@qs@__ The parent patterns. -> Permutation -- ^ __@perm@__ Permutation to split into needed and unneeded vars. -> Permutation -- ^ __@lhsPerm@__ Permutation reordering the variables in parent patterns. -> TCM DisplayForm withDisplayForm f aux delta1 delta2 n qs perm@(Perm m _) lhsPerm = do -- Compute the arity of the display form. let arity0 = n + size delta1 + size delta2 -- The currently free variables have to be added to the front. topArgs <- raise arity0 <$> getContextArgs let top = length topArgs arity = arity0 + top -- Build the rhs of the display form. wild <- freshNoName_ <&> \ x -> Def (qualify_ x) [] let -- Convert the parent patterns to terms. tqs0 = patsToElims lhsPerm qs -- Build a substitution to replace the parent pattern vars -- by the pattern vars of the with-function. (ys0, ys1) = splitAt (size delta1) $ permute perm $ downFrom m ys = reverse (map Just ys0 ++ replicate n Nothing ++ map Just ys1) ++ map (Just . (m +)) [0..top-1] rho = sub top ys wild tqs = applySubst rho tqs0 -- Build the arguments to the with function. es = map (Apply . fmap DTerm) topArgs ++ tqs withArgs = map var $ take n $ downFrom $ size delta2 + n dt = DWithApp (DDef f es) (map DTerm withArgs) [] -- Build the lhs of the display form and finish. -- @var 0@ is the pattern variable (hole). let display = Display arity (replicate arity $ var 0) dt -- Debug printing. let addFullCtx = addCtxTel delta1 . flip (foldr addContext) (for [1..n] $ \ i -> "w" ++ show i) . addCtxTel delta2 reportSDoc "tc.with.display" 20 $ vcat [ text "withDisplayForm" , nest 2 $ vcat [ text "f =" <+> text (show f) , text "aux =" <+> text (show aux) , text "delta1 =" <+> prettyTCM delta1 , text "delta2 =" <+> do addCtxTel delta1 $ prettyTCM delta2 , text "n =" <+> text (show n) , text "perm =" <+> text (show perm) , text "top =" <+> do addFullCtx $ prettyTCM topArgs , text "qs =" <+> sep (map (prettyTCM . namedArg) qs) , text "qsToTm =" <+> prettyTCM tqs0 -- ctx would be permuted form of delta1 ++ delta2 , text "ys =" <+> text (show ys) , text "rho =" <+> text (prettyShow rho) , text "qs[rho]=" <+> do addFullCtx $ prettyTCM tqs , text "dt =" <+> do addFullCtx $ prettyTCM dt ] ] reportSDoc "tc.with.display" 70 $ nest 2 $ vcat [ text "raw =" <+> text (show display) ] return display where -- Ulf, 2014-02-19: We need to rename the module parameters as well! (issue1035) -- sub top ys wild = map term [0 .. m - 1] ++# raiseS (length qs) -- Andreas, 2015-10-28: Yes, but properly! (Issue 1407) sub top ys wild = parallelS $ map term [0 .. m + top - 1] where term i = maybe wild var $ findIndex (Just i ==) ys -- -- OLD -- sub top rho wild = parallelS $ map term [0 .. m - 1] ++ topTerms -- where -- -- Ulf, 2014-02-19: We need to rename the module parameters as well! (issue1035) -- newVars = length qs -- topTerms = [ var (i + newVars) | i <- [0..top - 1] ] -- -- thinking required.. but ignored -- -- dropping the reverse seems to work better -- -- Andreas, 2010-09-09: I DISAGREE. -- -- Ulf, 2011-09-02: Thinking done. Neither was correct. -- -- We had the wrong permutation and we used it incorrectly. Should work now. -- term i = maybe wild var $ findIndex (Just i ==) rho -- Andreas, 2014-12-05 refactored using numberPatVars -- Andreas, 2013-02-28 modeled after Coverage/Match/buildMPatterns -- The permutation is the one of the original clause. patsToElims :: Permutation -> [I.NamedArg Pattern] -> [I.Elim' DisplayTerm] patsToElims perm ps = toElims $ numberPatVars perm ps where toElims :: [I.NamedArg DeBruijnPattern] -> [I.Elim' DisplayTerm] toElims = map $ toElim . fmap namedThing toElim :: I.Arg DeBruijnPattern -> I.Elim' DisplayTerm toElim (Common.Arg ai p) = case p of ProjP d -> I.Proj d p -> I.Apply $ Common.Arg ai $ toTerm p toTerms :: [I.NamedArg DeBruijnPattern] -> [I.Arg DisplayTerm] toTerms = map $ fmap $ toTerm . namedThing toTerm :: DeBruijnPattern -> DisplayTerm toTerm p = case p of ProjP d -> DDef d [] -- WRONG. TODO: convert spine to non-spine ... DDef d . defaultArg VarP (i, x) -> DTerm $ var i DotP t -> DDot $ t ConP c _ ps -> DCon c $ toTerms ps LitP l -> DTerm $ Lit l Agda-2.4.2.5/src/full/Agda/TypeChecking/ProjectionLike.hs0000644000000000000000000002643112635075266021145 0ustar0000000000000000{-# LANGUAGE CPP #-} {-# LANGUAGE FlexibleInstances #-} {-# LANGUAGE PatternGuards #-} #if __GLASGOW_HASKELL__ >= 710 {-# LANGUAGE FlexibleContexts #-} #endif module Agda.TypeChecking.ProjectionLike where import Control.Monad import qualified Data.Map as Map import Agda.Syntax.Abstract.Name import Agda.Syntax.Common import Agda.Syntax.Internal as I import Agda.TypeChecking.Monad import Agda.TypeChecking.Free (isBinderUsed) import Agda.TypeChecking.Substitute import Agda.TypeChecking.Positivity import Agda.TypeChecking.Pretty import Agda.TypeChecking.Reduce (reduce) import Agda.TypeChecking.DropArgs import Agda.Utils.Maybe import Agda.Utils.Monad import Agda.Utils.Size import Agda.Utils.Permutation #include "undefined.h" import Agda.Utils.Impossible -- | View for a @Def f (Apply a : es)@ where @isProjection f@. -- Used for projection-like @f@s. data ProjectionView = ProjectionView { projViewProj :: QName , projViewSelf :: I.Arg Term , projViewSpine :: Elims } -- ^ A projection or projection-like function, applied to its -- principal argument | LoneProjectionLike QName I.ArgInfo -- ^ Just a lone projection-like function, missing its principal -- argument (from which we could infer the parameters). | NoProjection Term -- ^ Not a projection or projection-like thing. -- | Semantics of 'ProjectionView'. unProjView :: ProjectionView -> Term unProjView pv = case pv of ProjectionView f a es -> Def f (Apply a : es) LoneProjectionLike f ai -> Def f [] NoProjection v -> v -- | Top-level 'ProjectionView' (no reduction). {-# SPECIALIZE projView :: Term -> TCM ProjectionView #-} projView :: HasConstInfo m => Term -> m ProjectionView projView v = do let fallback = return $ NoProjection v case ignoreSharing v of Def f es -> caseMaybeM (isProjection f) fallback $ \ isP -> do if projIndex isP <= 0 then fallback else do case es of [] -> return $ LoneProjectionLike f $ projArgInfo isP Apply a : es -> return $ ProjectionView f a es -- Since a projection is a function, it cannot be projected itself. Proj{} : _ -> __IMPOSSIBLE__ _ -> fallback -- | Reduce away top-level projection like functions. -- (Also reduces projections, but they should not be there, -- since Internal is in lambda- and projection-beta-normal form.) -- reduceProjectionLike :: Term -> TCM Term reduceProjectionLike v = do -- Andreas, 2013-11-01 make sure we do not reduce a constructor -- because that could be folded back into a literal by reduce. pv <- projView v case pv of ProjectionView{} -> onlyReduceProjections $ reduce v -- ordinary reduce, only different for Def's _ -> return v -- | Turn prefix projection-like function application into postfix ones. -- This does just one layer, such that the top spine contains -- the projection-like functions as projections. -- Used in 'compareElims' in @TypeChecking.Conversion@ -- and in "Agda.TypeChecking.CheckInternal". -- -- If the 'Bool' is 'True', a lone projection like function will be -- turned into a lambda-abstraction, expecting the principal argument. -- If the 'Bool' is 'False', it will be returned unaltered. -- -- No precondition. -- Preserves constructorForm, since it really does only something -- on (applications of) projection-like functions. elimView :: Bool -> Term -> TCM Term elimView loneProjToLambda v = do reportSDoc "tc.conv.elim" 30 $ text "elimView of " <+> prettyTCM v reportSLn "tc.conv.elim" 50 $ "v = " ++ show v v <- reduceProjectionLike v reportSDoc "tc.conv.elim" 40 $ text "elimView (projections reduced) of " <+> prettyTCM v pv <- projView v case pv of NoProjection{} -> return v LoneProjectionLike f ai | loneProjToLambda -> return $ Lam ai $ Abs "r" $ Var 0 [Proj f] | otherwise -> return v ProjectionView f a es -> (`applyE` (Proj f : es)) <$> elimView loneProjToLambda (unArg a) -- | Which @Def@types are eligible for the principle argument -- of a projection-like function? eligibleForProjectionLike :: QName -> TCM Bool eligibleForProjectionLike d = do defn <- theDef <$> getConstInfo d return $ case defn of Datatype{} -> True Record{} -> True Axiom{} -> True _ -> False -- | Turn a definition into a projection if it looks like a projection. makeProjection :: QName -> TCM () makeProjection x = inTopContext $ do -- reportSLn "tc.proj.like" 30 $ "Considering " ++ show x ++ " for projection likeness" defn <- getConstInfo x let t = defType defn reportSDoc "tc.proj.like" 20 $ sep [ text "Checking for projection likeness " , prettyTCM x <+> text " : " <+> prettyTCM t ] case theDef defn of Function{funClauses = cls} | any (isNothing . getBodyUnraised) cls -> reportSLn "tc.proj.like" 30 $ " projection-like functions cannot have absurd clauses" -- Constructor-headed functions can't be projection-like (at the moment). The reason -- for this is that invoking constructor-headedness will circumvent the inference of -- the dropped arguments. -- Nor can abstract definitions be projection-like since they won't reduce -- outside the abstract block. def@Function{funProjection = Nothing, funClauses = cls, funCompiled = cc0, funInv = NotInjective, funMutual = [], -- Andreas, 2012-09-28: only consider non-mutual funs (or those whose recursion status has not yet been determined) funAbstr = ConcreteDef} -> do ps0 <- filterM validProj $ candidateArgs [] t reportSLn "tc.proj.like" 30 $ if null ps0 then " no candidates found" else " candidates: " ++ show ps0 unless (null ps0) $ do -- Andreas 2012-09-26: only consider non-recursive functions for proj.like. -- Issue 700: problems with recursive funs. in term.checker and reduction ifM recursive (reportSLn "tc.proj.like" 30 $ " recursive functions are not considered for projection-likeness") $ do ps <- return $ filter (checkOccurs cls . snd) ps0 when (null ps) $ reportSLn "tc.proj.like" 50 $ " occurs check failed\n clauses = " ++ show cls case reverse ps of [] -> return () (d, n) : _ -> do reportSDoc "tc.proj.like" 10 $ sep [ prettyTCM x <+> text " : " <+> prettyTCM t , text $ " is projection like in argument " ++ show n ++ " for type " ++ show d ] {- reportSLn "tc.proj.like" 10 $ show (defName defn) ++ " is projection like in argument " ++ show n ++ " for type " ++ show d -} let cls' = map (dropArgs n) cls cc = dropArgs n cc0 -- cc <- compileClauses (Just (x, __IMPOSSIBLE__)) cls' reportSLn "tc.proj.like" 60 $ " rewrote clauses to\n " ++ show cc -- Andreas, 2013-10-20 build parameter dropping function let (ptel, Dom ai _ : _) = splitAt n $ telToList $ theTel $ telView' t -- leading lambdas are to ignore parameter applications proj = teleNoAbs ptel $ Def x [] -- proj = foldr (\ (Dom ai (y, _)) -> Lam ai . NoAbs y) (Def x []) ptel let projection = Projection { projProper = Nothing , projFromType = d , projIndex = n + 1 , projDropPars = proj , projArgInfo = ai } let newDef = def { funProjection = Just projection , funClauses = cls' , funCompiled = cc , funInv = dropArgs n $ funInv def } addConstant x $ defn { defPolarity = drop n $ defPolarity defn , defArgOccurrences = drop n $ defArgOccurrences defn , defDisplay = [] , theDef = newDef } Function{funInv = Inverse{}} -> reportSLn "tc.proj.like" 30 $ " injective functions can't be projections" Function{funAbstr = AbstractDef} -> reportSLn "tc.proj.like" 30 $ " abstract functions can't be projections" Function{funProjection = Just{}} -> reportSLn "tc.proj.like" 30 $ " already projection like" _ -> reportSLn "tc.proj.like" 30 $ " not a function" where -- @validProj (d,n)@ checks whether the head @d@ of the type of the -- @n@th argument is injective in all args (i.d. being name of data/record/axiom). validProj :: (QName, Int) -> TCM Bool validProj (_, 0) = return False validProj (d, _) = eligibleForProjectionLike d recursive = do occs <- computeOccurrences x let xocc = Map.lookup (ADef x) occs case xocc of Just (_ : _) -> return True -- recursive occurrence _ -> return False checkOccurs cls n = all (nonOccur n) cls nonOccur n cl = and [ take n p == [0..n - 1] , onlyMatch n ps -- projection-like functions are only allowed to match on the eliminatee -- otherwise we may end up projecting from constructor applications, in -- which case we can't reconstruct the dropped parameters , checkBody n b ] where Perm _ p = clausePerm cl ps = namedClausePats cl b = clauseBody cl onlyMatch n ps = all (shallowMatch . namedArg) (take 1 ps1) && noMatches (ps0 ++ drop 1 ps1) where (ps0, ps1) = splitAt n ps shallowMatch (ConP _ _ ps) = noMatches ps shallowMatch _ = True noMatches = all (noMatch . namedArg) noMatch ConP{} = False noMatch LitP{} = False noMatch ProjP{}= False noMatch VarP{} = True noMatch DotP{} = True checkBody 0 _ = True checkBody _ NoBody = __IMPOSSIBLE__ -- we check this earlier checkBody n (Bind b) = not (isBinderUsed b) && checkBody (n - 1) (unAbs b) checkBody _ Body{} = __IMPOSSIBLE__ -- @candidateArgs [var 0,...,var(n-1)] t@ adds @(n,d)@ to the output, -- if @t@ is a function-type with domain @t 0 .. (n-1)@ -- (the domain of @t@ is the type of the arg @n@). -- -- This means that from the type of arg @n@ all previous arguments -- can be computed by a simple matching. -- (Provided the @d@ is data/record/postulate, checked in @validProj@). -- -- E.g. f : {x : _}(y : _){z : _} -> D x y z -> ... -- will return (D,3) as a candidate (amongst maybe others). -- candidateArgs :: [Term] -> Type -> [(QName,Int)] candidateArgs vs t = case ignoreSharing $ unEl t of Pi a b | Def d es <- ignoreSharing $ unEl $ unDom a, Just us <- allApplyElims es, vs == map unArg us -> (d, length vs) : candidateRec b | otherwise -> candidateRec b _ -> [] where candidateRec NoAbs{} = [] candidateRec (Abs x t) = candidateArgs (var (size vs) : vs) t Agda-2.4.2.5/src/full/Agda/TypeChecking/CheckInternal.hs0000644000000000000000000002542412635075266020737 0ustar0000000000000000{-# LANGUAGE CPP #-} {-# LANGUAGE FlexibleInstances #-} -- Initially authored by Andreas, 2013-10-22. -- | A bidirectional type checker for internal syntax. -- -- Performs checking on unreduced terms. -- With the exception that projection-like function applications -- have to be reduced since they break bidirectionality. module Agda.TypeChecking.CheckInternal ( checkType , checkInternal , infer ) where import Control.Monad import Agda.Syntax.Common import Agda.Syntax.Internal as I import Agda.TypeChecking.Conversion import Agda.TypeChecking.Datatypes (getConType) import Agda.TypeChecking.Level import Agda.TypeChecking.Monad import Agda.TypeChecking.Monad.Builtin import Agda.TypeChecking.Pretty import Agda.TypeChecking.ProjectionLike (elimView) import Agda.TypeChecking.Reduce import Agda.TypeChecking.Substitute import Agda.TypeChecking.Telescope import Agda.Utils.Functor (($>)) import Agda.Utils.Monad import Agda.Utils.Size #include "undefined.h" import Agda.Utils.Impossible -- -- | Entry point for e.g. checking WithFunctionType. -- checkType :: Type -> TCM () -- checkType t = -- dontAssignMetas $ ignoreSorts $ -- checkInternal (unEl t) (sort Inf) -- | Entry point for e.g. checking WithFunctionType. checkType :: Type -> TCM () checkType t = void $ checkType' t -- | Check a type and infer its sort. -- -- Necessary because of PTS rule @(SizeUniv, Set i, Set i)@ -- but @SizeUniv@ is not included in any @Set i@. -- -- This algorithm follows -- Abel, Coquand, Dybjer, MPC 08, -- Verifying a Semantic βη-Conversion Test for Martin-Löf Type Theory -- checkType' :: Type -> TCM Sort checkType' t = do reportSDoc "tc.check.internal" 20 $ sep [ text "checking internal type " , prettyTCM t ] v <- elimView True $ unEl t -- bring projection-like funs in post-fix form case ignoreSharing v of Pi a b -> do s1 <- checkType' $ unDom a s2 <- (b $>) <$> do addContext (absName b, a) $ do checkType' $ absBody b return $ dLub s1 s2 Sort s -> do checkSort s return $ sSuc s Var i es -> do a <- typeOfBV i checkTypeSpine a (Var i []) es Def f es -> do -- not a projection-like fun a <- defType <$> getConstInfo f checkTypeSpine a (Def f []) es MetaV x es -> do -- we assume meta instantiations to be well-typed a <- metaType x checkTypeSpine a (MetaV x []) es v@Lam{} -> typeError $ InvalidType v v@Con{} -> typeError $ InvalidType v v@Lit{} -> typeError $ InvalidType v v@Level{} -> typeError $ InvalidType v DontCare v -> checkType' $ t $> v ExtLam{} -> __IMPOSSIBLE__ Shared{} -> __IMPOSSIBLE__ checkTypeSpine :: Type -> Term -> Elims -> TCM Sort checkTypeSpine a self es = shouldBeSort =<< inferSpine a self es -- | Entry point for term checking. checkInternal :: Term -> Type -> TCM () checkInternal v t = do reportSDoc "tc.check.internal" 20 $ sep [ text "checking internal " , prettyTCM v , text " : " , prettyTCM t ] -- Bring projection-like funs in post-fix form, -- even lone ones (True). v <- elimView True v case ignoreSharing v of Var i es -> do a <- typeOfBV i checkSpine a (Var i []) es t Def f es -> do -- f is not projection(-like)! a <- defType <$> getConstInfo f checkSpine a (Def f []) es t MetaV x es -> do -- we assume meta instantiations to be well-typed a <- metaType x checkSpine a (MetaV x []) es t Con c vs -> do -- we need to fully apply the constructor to make getConType work TelV tel t <- telView t addCtxTel tel $ do let failure = typeError $ DoesNotConstructAnElementOf (conName c) t vs' = raise (size tel) vs ++ teleArgs tel a <- maybe failure return =<< getConType c t checkArgs a (Con c []) vs' t Lit l -> litType l >>= (`subtype` t) Lam ai vb -> do (a, b) <- shouldBePi t checkArgInfo ai $ domInfo a addContext (suggest vb b, a) $ do checkInternal (absBody vb) (absBody b) Pi a b -> do s <- shouldBeSort t when (s == SizeUniv) $ typeError $ FunctionTypeInSizeUniv v let st = sort s checkInternal (unEl $ unDom a) st -- This does not work with SizeUniv addContext (absName b, a) $ do checkInternal (unEl $ absBody b) $ raise 1 st Sort s -> do checkSort s -- this ensures @s /= Inf@ (sSuc s `leqSort`) =<< shouldBeSort t Level l -> do checkLevel l levelType >>= (`subtype` t) DontCare v -> checkInternal v t Shared{} -> __IMPOSSIBLE__ ExtLam{} -> __IMPOSSIBLE__ {- RETIRED, works also when elimView has not been called before. -- | Check function application. checkDef :: QName -> Elims -> Type -> TCM () checkDef f es t = do def <- getConstInfo f if isJust $ isProjection_ $ theDef def then do -- we have to reduce away a projection-like function in head position -- because we might not be able to infer the type of its principal -- argument (it could be a Con) -- TODO: a reduce that reduces ONLY projection-like functions -- (`checkInternal` t) =<< elimView =<< reduceProjectionLike (Def f es) (`checkInternal` t) =<< elimView (Def f es) else checkSpine (defType def) (Def f []) es t -} {- -- | Check ordinary function application. checkDef :: QName -> Elims -> Type -> TCM () checkDef f es t = do a <- defType <$> getConstInfo f checkSpine a (Def f []) es t -- | Check possibly projection-like function application checkDef' :: QName -> I.Arg Term -> Elims -> Type -> TCM () checkDef' f a es t = do isProj <- isProjection f case isProj of Just Projection{ projIndex = n} | n > 0 -> do let self = unArg a b <- infer self checkSpine b self (Proj f : es) t _ -> checkDef f (Apply a : es) t -} checkSpine :: Type -> Term -> Elims -> Type -> TCM () checkSpine a self es t = do reportSDoc "tc.check.internal" 20 $ sep [ text "checking spine " , text "(" , prettyTCM self , text " : " , prettyTCM a , text ")" , prettyTCM es , text " : " , prettyTCM t ] inferSpine a self es >>= (`subtype` t) checkArgs :: Type -> Term -> Args -> Type -> TCM () checkArgs a self vs t = checkSpine a self (map Apply vs) t -- | @checkArgInfo actual expected@. checkArgInfo :: I.ArgInfo -> I.ArgInfo -> TCM () checkArgInfo ai ai' = do checkHiding (getHiding ai) (getHiding ai') checkRelevance (getRelevance ai) (getRelevance ai') checkColor (argInfoColors ai) (argInfoColors ai') checkHiding :: Hiding -> Hiding -> TCM () checkHiding h h' = unless (h == h') $ typeError $ HidingMismatch h h' checkRelevance :: Relevance -> Relevance -> TCM () checkRelevance r0 r0' = unless (r == r') $ typeError $ RelevanceMismatch r r' where r = canon r0 r' = canon r0' canon Forced{} = Relevant canon UnusedArg = Relevant canon r = r checkColor :: [Color] -> [Color] -> TCM () checkColor c c' = unless (c == c') $ typeError $ ColorMismatch c c' -- TODO guilhem -- | Infer type of a neutral term. infer :: Term -> TCM Type infer v = do case ignoreSharing v of Var i es -> do a <- typeOfBV i inferSpine a (Var i []) es Def f (Apply a : es) -> inferDef' f a es -- possibly proj.like Def f es -> inferDef f es -- not a projection-like fun MetaV x es -> do -- we assume meta instantiations to be well-typed a <- metaType x inferSpine a (MetaV x []) es Shared{} -> __IMPOSSIBLE__ _ -> __IMPOSSIBLE__ -- | Infer ordinary function application. inferDef :: QName -> Elims -> TCM Type inferDef f es = do a <- defType <$> getConstInfo f inferSpine a (Def f []) es -- | Infer possibly projection-like function application inferDef' :: QName -> I.Arg Term -> Elims -> TCM Type inferDef' f a es = do isProj <- isProjection f case isProj of Just Projection{ projIndex = n } | n > 0 -> do let self = unArg a b <- infer self inferSpine b self (Proj f : es) _ -> inferDef f (Apply a : es) -- | @inferSpine t self es@ checks that spine @es@ eliminates -- value @self@ of type @t@ and returns the remaining type -- (target of elimination). inferSpine :: Type -> Term -> Elims -> TCM Type inferSpine t self [] = return t inferSpine t self (e : es) = case e of Apply (Arg ai v) -> do (a, b) <- shouldBePi t checkArgInfo ai $ domInfo a checkInternal v $ unDom a inferSpine (b `absApp` v) (self `applyE` [e]) es -- case: projection or projection-like Proj f -> do (a, b) <- shouldBePi =<< shouldBeProjectible t f u <- f `applyDef` (argFromDom a $> self) inferSpine (b `absApp` self) u es -- | Type should either be a record type of a type eligible for -- the principal argument of projection-like functions. shouldBeProjectible :: Type -> QName -> TCM Type -- shouldBeProjectible t f = maybe failure return =<< projectionType t f shouldBeProjectible t f = maybe failure return =<< getDefType f =<< reduce t where failure = typeError $ ShouldBeRecordType t -- TODO: more accurate error that makes sense also for proj.-like funs. shouldBePi :: Type -> TCM (I.Dom Type, Abs Type) shouldBePi t = ifPiType t (\ a b -> return (a, b)) $ const $ typeError $ ShouldBePi t -- | Result is in reduced form. shouldBeSort :: Type -> TCM Sort shouldBeSort t = ifIsSort t return (typeError $ ShouldBeASort t) ifIsSort :: Type -> (Sort -> TCM a) -> TCM a -> TCM a ifIsSort t yes no = do t <- reduce t case ignoreSharing $ unEl t of Sort s -> yes s _ -> no -- | Check if sort is well-formed. checkSort :: Sort -> TCM () checkSort s = case s of Type l -> checkLevel l Prop -> __IMPOSSIBLE__ -- the dummy Prop should not be part of a term we check Inf -> typeError $ SetOmegaNotValidType -- we cannot have Setω on the lhs of the colon SizeUniv -> typeError $ InvalidTypeSort s DLub a b -> do checkSort a addContext (absName b, defaultDom (sort a) :: I.Dom Type) $ do checkSort (absBody b) -- | Check if level is well-formed. checkLevel :: Level -> TCM () checkLevel (Max ls) = mapM_ checkPlusLevel ls where checkPlusLevel ClosedLevel{} = return () checkPlusLevel (Plus _ l) = checkLevelAtom l checkLevelAtom l = do lvl <- levelType case l of MetaLevel x es -> checkInternal (MetaV x es) lvl BlockedLevel _ v -> checkInternal v lvl NeutralLevel _ v -> checkInternal v lvl UnreducedLevel v -> checkInternal v lvl -- | Type of a term or sort meta. metaType :: MetaId -> TCM Type metaType x = jMetaType . mvJudgement <$> lookupMeta x -- | Universe subsumption and type equality (subtyping for sizes, resp.). subtype :: Type -> Type -> TCM () subtype t1 t2 = do ifIsSort t1 (\ s1 -> (s1 `leqSort`) =<< shouldBeSort t2) $ leqType t1 t2 Agda-2.4.2.5/src/full/Agda/TypeChecking/Conversion.hs-boot0000644000000000000000000000140412635075266021303 0ustar0000000000000000 module Agda.TypeChecking.Conversion where import Agda.Syntax.Internal import Agda.TypeChecking.Monad compareTerm :: Comparison -> Type -> Term -> Term -> TCM () compareAtom :: Comparison -> Type -> Term -> Term -> TCM () compareArgs :: [Polarity] -> Type -> Term -> Args -> Args -> TCM () compareElims :: [Polarity] -> Type -> Term -> [Elim] -> [Elim] -> TCM () compareType :: Comparison -> Type -> Type -> TCM () compareTel :: Type -> Type -> Comparison -> Telescope -> Telescope -> TCM () compareSort :: Comparison -> Sort -> Sort -> TCM () compareLevel :: Comparison -> Level -> Level -> TCM () equalTerm :: Type -> Term -> Term -> TCM () equalType :: Type -> Type -> TCM () equalSort :: Sort -> Sort -> TCM () leqType :: Type -> Type -> TCM () Agda-2.4.2.5/src/full/Agda/TypeChecking/Injectivity.hs0000644000000000000000000002407212635075266020524 0ustar0000000000000000{-# LANGUAGE CPP #-} {-# LANGUAGE TupleSections #-} module Agda.TypeChecking.Injectivity where import Prelude hiding (mapM) import Control.Applicative import Control.Monad.State hiding (mapM, forM) import Control.Monad.Reader hiding (mapM, forM) import Data.Map (Map) import qualified Data.Map as Map import qualified Data.Set as Set import Data.Maybe import Data.Traversable hiding (for) import qualified Agda.Syntax.Abstract.Name as A import Agda.Syntax.Common import Agda.Syntax.Internal import Agda.TypeChecking.Monad import Agda.TypeChecking.Substitute import Agda.TypeChecking.Reduce import Agda.TypeChecking.Primitive import {-# SOURCE #-} Agda.TypeChecking.MetaVars import {-# SOURCE #-} Agda.TypeChecking.Conversion import Agda.TypeChecking.Pretty import Agda.TypeChecking.Constraints import Agda.TypeChecking.Polarity import Agda.Utils.Except ( MonadError(catchError, throwError) ) import Agda.Utils.List import Agda.Utils.Functor import Agda.Utils.Permutation #include "undefined.h" import Agda.Utils.Impossible headSymbol :: Term -> TCM (Maybe TermHead) headSymbol v = do -- ignoreAbstractMode $ do -- Andreas, 2013-02-18 ignoreAbstractMode leads to information leakage v <- ignoreBlocking <$> reduceHead v case ignoreSharing v of Def f _ -> do def <- theDef <$> do ignoreAbstractMode $ getConstInfo f -- Andreas, 2013-02-18 -- if we do not ignoreAbstractMode here, abstract Functions get turned -- into Axioms, but we want to distinguish these. case def of Datatype{} -> return (Just $ ConsHead f) Record{} -> return (Just $ ConsHead f) Axiom{} -> do reportSLn "tc.inj.axiom" 50 $ "headSymbol: " ++ show f ++ " is an Axiom." -- Don't treat axioms in the current mutual block -- as constructors (they might have definitions we -- don't know about yet). fs <- lookupMutualBlock =<< currentOrFreshMutualBlock if Set.member f fs then return Nothing else return (Just $ ConsHead f) Function{} -> return Nothing Primitive{} -> return Nothing Constructor{} -> __IMPOSSIBLE__ Con c _ -> return (Just $ ConsHead $ conName c) Sort _ -> return (Just SortHead) Pi _ _ -> return (Just PiHead) Lit _ -> return Nothing -- handle literal heads as well? can't think of -- any examples where it would be useful... Lam{} -> return Nothing Var{} -> return Nothing Level{} -> return Nothing MetaV{} -> return Nothing DontCare{} -> return Nothing Shared{} -> __IMPOSSIBLE__ ExtLam{} -> __IMPOSSIBLE__ checkInjectivity :: QName -> [Clause] -> TCM FunctionInverse checkInjectivity f cs | pointLess cs = do reportSLn "tc.inj.check.pointless" 20 $ "Injectivity of " ++ show (A.qnameToConcrete f) ++ " would be pointless." return NotInjective where -- Is it pointless to use injectivity for this function? pointLess [] = True pointLess (_:_:_) = False pointLess [cl] = not $ any (properlyMatching . unArg) $ clausePats cl -- Andreas, 2014-06-12 -- If we only have record patterns, it is also pointless. -- We need at least one proper match. checkInjectivity f cs = do reportSLn "tc.inj.check" 40 $ "Checking injectivity of " ++ show f -- Extract the head symbol of the rhs of each clause (skip absurd clauses) es <- catMaybes <$> do forM cs $ \ c -> do -- produces a list ... mapM ((,c) <.> headSymbol) $ getBodyUnraised c -- ... of maybes let (hs, ps) = unzip es reportSLn "tc.inj.check" 40 $ " right hand sides: " ++ show hs if all isJust hs && distinct hs then do let inv = Map.fromList (map fromJust hs `zip` ps) reportSLn "tc.inj.check" 20 $ show f ++ " is injective." reportSDoc "tc.inj.check" 30 $ nest 2 $ vcat $ for (Map.toList inv) $ \ (h, c) -> text (show h) <+> text "-->" <+> fsep (punctuate comma $ map (prettyTCM . unArg) $ clausePats c) return $ Inverse inv else return NotInjective -- | Argument should be in weak head normal form. functionInverse :: Term -> TCM InvView functionInverse v = case ignoreSharing v of Def f es -> do d <- theDef <$> getConstInfo f case d of Function{ funInv = inv } -> case inv of NotInjective -> return NoInv Inverse m -> return $ Inv f es m -- NB: Invertible functions are never classified as -- projection-like, so this is fine, we are not -- missing parameters. (Andreas, 2013-11-01) _ -> return NoInv _ -> return NoInv data InvView = Inv QName [Elim] (Map TermHead Clause) | NoInv data MaybeAbort = Abort | KeepGoing useInjectivity :: Comparison -> Type -> Term -> Term -> TCM () useInjectivity cmp a u v = do reportSDoc "tc.inj.use" 30 $ fsep $ pwords "useInjectivity on" ++ [ prettyTCM u, prettyTCM cmp, prettyTCM v, text ":", prettyTCM a ] uinv <- functionInverse u vinv <- functionInverse v case (uinv, vinv) of -- Andreas, Francesco, 2014-06-12: -- We know that one of u,v is neutral -- (see calls to useInjectivity in Conversion.hs). -- Otherwise, (e.g. if both were Blocked), the following case would be -- unsound, since it assumes the arguments to be pointwise equal. -- It would deliver non-unique solutions for metas. (Inv f fArgs _, Inv g gArgs _) | f == g -> do a <- defType <$> getConstInfo f reportSDoc "tc.inj.use" 20 $ vcat [ fsep (pwords "comparing application of injective function" ++ [prettyTCM f] ++ pwords "at") , nest 2 $ fsep $ punctuate comma $ map prettyTCM fArgs , nest 2 $ fsep $ punctuate comma $ map prettyTCM gArgs , nest 2 $ text "and type" <+> prettyTCM a ] pol <- getPolarity' cmp f compareElims pol a (Def f []) fArgs gArgs | otherwise -> fallBack (Inv f args inv, NoInv) -> do a <- defType <$> getConstInfo f reportSDoc "tc.inj.use" 20 $ fsep $ pwords "inverting injective function" ++ [ prettyTCM f, text ":", prettyTCM a, text "for", prettyTCM v , parens $ text "args =" <+> prettyList (map prettyTCM args) ] invert u f a inv args =<< headSymbol v (NoInv, Inv g args inv) -> do a <- defType <$> getConstInfo g reportSDoc "tc.inj.use" 20 $ fsep $ pwords "inverting injective function" ++ [ prettyTCM g, text ":", prettyTCM a, text "for", prettyTCM u , parens $ text "args =" <+> prettyList (map prettyTCM args) ] invert v g a inv args =<< headSymbol u (NoInv, NoInv) -> fallBack where fallBack = addConstraint $ ValueCmp cmp a u v invert :: Term -> QName -> Type -> Map TermHead Clause -> [Elim] -> Maybe TermHead -> TCM () invert _ _ a inv args Nothing = fallBack invert org f ftype inv args (Just h) = case Map.lookup h inv of Nothing -> typeError $ UnequalTerms cmp u v a Just cl@Clause{ clauseTel = tel , clausePerm = perm } -> maybeAbort $ do let ps = clausePats cl -- These are what dot patterns should be instantiated at ms <- map unArg <$> newTelMeta tel reportSDoc "tc.inj.invert" 20 $ vcat [ text "meta patterns" <+> prettyList (map prettyTCM ms) , text " perm =" <+> text (show perm) , text " tel =" <+> prettyTCM tel , text " ps =" <+> prettyList (map (text . show) ps) ] -- and this is the order the variables occur in the patterns let msAux = permute (invertP __IMPOSSIBLE__ $ compactP perm) ms let sub = parallelS (reverse ms) margs <- runReaderT (evalStateT (mapM metaElim ps) msAux) sub reportSDoc "tc.inj.invert" 20 $ vcat [ text "inversion" , nest 2 $ vcat [ text "lhs =" <+> prettyTCM margs , text "rhs =" <+> prettyTCM args , text "type =" <+> prettyTCM ftype ] ] -- Since we do not care for the value of non-variant metas here, -- we can treat 'Nonvariant' as 'Invariant'. -- That ensures these metas do not remain unsolved. pol <- purgeNonvariant <$> getPolarity' cmp f -- The clause might not give as many patterns as there -- are arguments (point-free style definitions). let args' = take (length margs) args compareElims pol ftype (Def f []) margs args' {- Andreas, 2011-05-09 allow unsolved constraints as long as progress unless (null cs) $ do reportSDoc "tc.inj.invert" 30 $ text "aborting inversion; remaining constraints" <+> prettyTCM cs patternViolation -} -- Check that we made progress, i.e. the head symbol -- of the original term should be a constructor. org <- reduce org h <- headSymbol org case h of Just h -> KeepGoing <$ compareTerm cmp a u v Nothing -> do reportSDoc "tc.inj.invert" 30 $ vcat [ text "aborting inversion;" <+> prettyTCM org , text "plainly," <+> text (show org) , text "has TermHead" <+> text (show h) , text "which does not expose a constructor" ] return Abort maybeAbort m = do (a, s) <- localTCStateSaving m case a of KeepGoing -> put s Abort -> fallBack nextMeta = do m : ms <- get put ms return m dotP :: Monad m => Term -> StateT [Term] (ReaderT Substitution m) Term dotP v = do sub <- ask return $ applySubst sub v metaElim (Arg _ (ProjP p)) = return $ Proj p metaElim (Arg info p) = Apply . Arg info <$> metaPat p metaArgs args = mapM (traverse $ metaPat . namedThing) args metaPat (DotP v) = dotP v metaPat (VarP _) = nextMeta metaPat (ConP c mt args) = Con c <$> metaArgs args metaPat (LitP l) = return $ Lit l metaPat ProjP{} = __IMPOSSIBLE__ Agda-2.4.2.5/src/full/Agda/TypeChecking/Serialise.hs0000644000000000000000000001774512635075266020154 0ustar0000000000000000-- Andreas, Makoto, Francesco 2014-10-15 AIM XX: -- -O2 does not have any noticable effect on runtime -- but sabotages cabal repl with -Werror -- (due to a conflict with --interactive warning) -- {-# OPTIONS_GHC -O2 #-} -- | Structure-sharing serialisation of Agda interface files. -- -!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!- -- NOTE: Every time the interface format is changed the interface -- version number should be bumped _in the same patch_. -- -!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!- module Agda.TypeChecking.Serialise ( encode, encodeFile, encodeInterface , decode, decodeFile, decodeInterface, decodeHashes , EmbPrj ) where import Control.Applicative import Control.Arrow (second) import Control.DeepSeq import qualified Control.Exception as E import Control.Monad import Control.Monad.Reader import Control.Monad.State.Strict import Data.Array.IArray import Data.Word import qualified Data.ByteString.Lazy as L import qualified Data.HashTable.IO as H import qualified Data.Map as Map import qualified Data.Binary as B import qualified Data.Binary.Get as B import qualified Data.Binary.Put as B import qualified Data.List as List import Data.Function import qualified Codec.Compression.GZip as G import qualified Agda.TypeChecking.Monad.Benchmark as Bench import Agda.TypeChecking.Serialise.Base import Agda.TypeChecking.Serialise.Instances () import Agda.TypeChecking.Monad import Agda.Utils.Hash import Agda.Utils.IORef import Agda.Utils.Lens import Agda.Utils.Except -- Note that the Binary instance for Int writes 64 bits, but throws -- away the 32 high bits when reading (at the time of writing, on -- 32-bit machines). Word64 does not have these problems. currentInterfaceVersion :: Word64 currentInterfaceVersion = 20151209 * 10 + 0 -- | Encodes something. To ensure relocatability file paths in -- positions are replaced with module names. encode :: EmbPrj a => a -> TCM L.ByteString encode a = do collectStats <- hasVerbosity "profile.serialize" 20 fileMod <- sourceToModule newD@(Dict nD sD iD dD _tD _nameD _qnameD nC sC iC dC tC nameC qnameC stats _ _) <- liftIO $ emptyDict collectStats root <- liftIO $ (`runReaderT` newD) $ do icodeFileMod fileMod icode a nL <- benchSort $ l nD sL <- benchSort $ l sD iL <- benchSort $ l iD dL <- benchSort $ l dD -- Record reuse statistics. verboseS "profile.sharing" 10 $ do statistics "pointers" tC verboseS "profile.serialize" 10 $ do statistics "Integer" iC statistics "String" sC statistics "Double" dC statistics "Node" nC statistics "Shared Term" tC statistics "A.QName" qnameC statistics "A.Name" nameC when collectStats $ do stats <- Map.fromList . map (second toInteger) <$> do liftIO $ H.toList stats modifyStatistics $ Map.union stats -- Encode hashmaps and root, and compress. bits1 <- Bench.billTo [ Bench.Serialization, Bench.BinaryEncode ] $ return $!! B.encode (root, nL, sL, iL, dL) let compressParams = G.defaultCompressParams { G.compressLevel = G.bestSpeed , G.compressStrategy = G.huffmanOnlyStrategy } cbits <- Bench.billTo [ Bench.Serialization, Bench.Compress ] $ return $!! G.compressWith compressParams bits1 let x = B.encode currentInterfaceVersion `L.append` cbits return x where l h = List.map fst . List.sortBy (compare `on` snd) <$> H.toList h benchSort = Bench.billTo [Bench.Serialization, Bench.Sort] . liftIO statistics :: String -> IORef FreshAndReuse -> TCM () statistics kind ioref = do FreshAndReuse fresh reused <- liftIO $ readIORef ioref tickN (kind ++ " (fresh)") $ fromIntegral fresh tickN (kind ++ " (reused)") $ fromIntegral reused -- encode :: EmbPrj a => a -> TCM L.ByteString -- encode a = do -- fileMod <- sourceToModule -- (x, shared, total) <- liftIO $ do -- newD@(Dict nD sD iD dD _ _ _ _ _ stats _) <- emptyDict fileMod -- root <- runReaderT (icode a) newD -- nL <- l nD; sL <- l sD; iL <- l iD; dL <- l dD -- (shared, total) <- readIORef stats -- return (B.encode currentInterfaceVersion `L.append` -- G.compress (B.encode (root, nL, sL, iL, dL)), shared, total) -- verboseS "profile.sharing" 10 $ do -- tickN "pointers (reused)" $ fromIntegral shared -- tickN "pointers" $ fromIntegral total -- return x -- where -- l h = List.map fst . List.sortBy (compare `on` snd) <$> H.toList h -- | Decodes something. The result depends on the include path. -- -- Returns 'Nothing' if the input does not start with the right magic -- number or some other decoding error is encountered. decode :: EmbPrj a => L.ByteString -> TCM (Maybe a) decode s = do mf <- use stModuleToSource incs <- getIncludeDirs -- Note that B.runGetState and G.decompress can raise errors if the -- input is malformed. The decoder is (intended to be) strict enough -- to ensure that all such errors can be caught by the handler here. (mf, r) <- liftIO $ E.handle (\(E.ErrorCall s) -> noResult s) $ do (ver, s, _) <- return $ runGetState B.get s 0 if ver /= currentInterfaceVersion then noResult "Wrong interface version." else do ((r, nL, sL, iL, dL), s, _) <- return $ runGetState B.get (G.decompress s) 0 if s /= L.empty -- G.decompress seems to throw away garbage at the end, so -- the then branch is possibly dead code. then noResult "Garbage at end." else do st <- St (ar nL) (ar sL) (ar iL) (ar dL) <$> liftIO H.new <*> return mf <*> return incs (r, st) <- runStateT (runExceptT (value r)) st return (Just (modFile st), r) case mf of Nothing -> return () Just mf -> stModuleToSource .= mf case r of Right x -> return (Just x) Left err -> do reportSLn "import.iface" 5 $ "Error when decoding interface file" -- Andreas, 2014-06-11 deactivated debug printing -- in order to get rid of dependency of Serialize on TCM.Pretty -- reportSDoc "import.iface" 5 $ -- text "Error when decoding interface file:" -- $+$ nest 2 (prettyTCM err) return Nothing where ar l = listArray (0, List.genericLength l - 1) l noResult s = return (Nothing, Left $ GenericError s) encodeInterface :: Interface -> TCM L.ByteString encodeInterface i = L.append hashes <$> encode i where hashes :: L.ByteString hashes = B.runPut $ B.put (iSourceHash i) >> B.put (iFullHash i) -- | Encodes something. To ensure relocatability file paths in -- positions are replaced with module names. encodeFile :: FilePath -> Interface -> TCM () encodeFile f i = liftIO . L.writeFile f =<< encodeInterface i -- | Decodes something. The result depends on the include path. -- -- Returns 'Nothing' if the file does not start with the right magic -- number or some other decoding error is encountered. decodeInterface :: L.ByteString -> TCM (Maybe Interface) decodeInterface s = decode $ L.drop 16 s decodeHashes :: L.ByteString -> Maybe (Hash, Hash) decodeHashes s | L.length s < 16 = Nothing | otherwise = Just $ B.runGet getH $ L.take 16 s where getH = (,) <$> B.get <*> B.get decodeFile :: FilePath -> TCM (Maybe Interface) decodeFile f = decodeInterface =<< liftIO (L.readFile f) -- | Store a 'SourceToModule' (map from 'AbsolutePath' to 'TopLevelModuleName') -- as map from 'AbsolutePath' to 'Int32', in order to directly get the identifiers -- from absolute pathes rather than going through top level module names. icodeFileMod :: SourceToModule -- ^ Maps file names to the corresponding module names. -- Must contain a mapping for every file name that is later encountered. -> S () icodeFileMod fileMod = do hmap <- asks absPathD forM_ (Map.toList fileMod) $ \ (absolutePath, topLevelModuleName) -> do i <- icod_ topLevelModuleName liftIO $ H.insert hmap absolutePath i Agda-2.4.2.5/src/full/Agda/TypeChecking/Monad.hs0000644000000000000000000000255012635075266017256 0ustar0000000000000000module Agda.TypeChecking.Monad ( module Agda.TypeChecking.Monad.Base , module Agda.TypeChecking.Monad.Closure , module Agda.TypeChecking.Monad.Constraints , module Agda.TypeChecking.Monad.Context , module Agda.TypeChecking.Monad.Env , module Agda.TypeChecking.Monad.Imports , module Agda.TypeChecking.Monad.MetaVars , module Agda.TypeChecking.Monad.Mutual , module Agda.TypeChecking.Monad.Open , module Agda.TypeChecking.Monad.Options , module Agda.TypeChecking.Monad.Sharing , module Agda.TypeChecking.Monad.Signature , module Agda.TypeChecking.Monad.SizedTypes , module Agda.TypeChecking.Monad.State , module Agda.TypeChecking.Monad.Statistics , module Agda.TypeChecking.Monad.Trace ) where import Agda.TypeChecking.Monad.Base import Agda.TypeChecking.Monad.Closure import Agda.TypeChecking.Monad.Constraints import Agda.TypeChecking.Monad.Context import Agda.TypeChecking.Monad.Env import Agda.TypeChecking.Monad.Imports import Agda.TypeChecking.Monad.MetaVars import Agda.TypeChecking.Monad.Mutual import Agda.TypeChecking.Monad.Options import Agda.TypeChecking.Monad.Open import Agda.TypeChecking.Monad.Sharing import Agda.TypeChecking.Monad.Signature import Agda.TypeChecking.Monad.SizedTypes import Agda.TypeChecking.Monad.State import Agda.TypeChecking.Monad.Statistics import Agda.TypeChecking.Monad.Trace Agda-2.4.2.5/src/full/Agda/TypeChecking/Polarity.hs0000644000000000000000000004356612635075266020037 0ustar0000000000000000{-# LANGUAGE CPP #-} {-# LANGUAGE FlexibleInstances #-} {-# LANGUAGE PatternGuards #-} module Agda.TypeChecking.Polarity where import Control.Applicative import Control.Monad.State import Data.List import Data.Maybe import Data.Traversable (traverse) import Agda.Syntax.Abstract.Name import Agda.Syntax.Common import Agda.Syntax.Internal as I import Agda.TypeChecking.Monad import Agda.TypeChecking.Pretty import Agda.TypeChecking.Substitute import Agda.TypeChecking.Telescope import Agda.TypeChecking.Reduce import Agda.TypeChecking.Free hiding (Occurrence(..)) import Agda.TypeChecking.Positivity.Occurrence import Agda.Interaction.Options import Agda.Utils.List import Agda.Utils.Maybe ( whenNothingM ) import Agda.Utils.Monad import Agda.Utils.Permutation import Agda.Utils.Size #include "undefined.h" import Agda.Utils.Impossible ------------------------------------------------------------------------ -- * Polarity lattice. ------------------------------------------------------------------------ -- | Infimum on the information lattice. -- 'Invariant' is bottom (dominant for inf), -- 'Nonvariant' is top (neutral for inf). (/\) :: Polarity -> Polarity -> Polarity Nonvariant /\ b = b a /\ Nonvariant = a a /\ b | a == b = a | otherwise = Invariant -- | 'Polarity' negation, swapping monotone and antitone. neg :: Polarity -> Polarity neg Covariant = Contravariant neg Contravariant = Covariant neg Invariant = Invariant neg Nonvariant = Nonvariant -- | What is the polarity of a function composition? composePol :: Polarity -> Polarity -> Polarity composePol Nonvariant _ = Nonvariant composePol _ Nonvariant = Nonvariant composePol Invariant _ = Invariant composePol Covariant x = x composePol Contravariant x = neg x polFromOcc :: Occurrence -> Polarity polFromOcc o = case o of GuardPos -> Covariant StrictPos -> Covariant JustPos -> Covariant JustNeg -> Contravariant Mixed -> Invariant Unused -> Nonvariant ------------------------------------------------------------------------ -- * Auxiliary functions ------------------------------------------------------------------------ -- | Get the next polarity from a list, 'Invariant' if empty. nextPolarity :: [Polarity] -> (Polarity, [Polarity]) nextPolarity [] = (Invariant, []) nextPolarity (p : ps) = (p, ps) -- | Replace 'Nonvariant' by 'Covariant'. -- (Arbitrary bias, but better than 'Invariant', see issue 1596). purgeNonvariant :: [Polarity] -> [Polarity] purgeNonvariant = map (\ p -> if p == Nonvariant then Covariant else p) ------------------------------------------------------------------------ -- * Computing the polarity of a symbol. ------------------------------------------------------------------------ -- | Main function of this module. computePolarity :: QName -> TCM () computePolarity x = inConcreteOrAbstractMode x $ do reportSLn "tc.polarity.set" 25 $ "Computing polarity of " ++ show x -- get basic polarity from positivity analysis def <- getConstInfo x let npars = droppedPars def let pol0 = replicate npars Nonvariant ++ map polFromOcc (defArgOccurrences def) reportSLn "tc.polarity.set" 15 $ "Polarity of " ++ show x ++ " from positivity: " ++ show pol0 {- -- get basic polarity from shape of def (arguments matched on or not?) def <- getConstInfo x let usagePol = usagePolarity $ theDef def reportSLn "tc.polarity.set" 15 $ "Polarity of " ++ show x ++ " from definition form: " ++ show usagePol let n = genericLength usagePol -- n <- getArity x reportSLn "tc.polarity.set" 20 $ " arity = " ++ show n -- refine polarity by positivity information pol0 <- zipWith (/\) usagePol <$> mapM getPol [0..n - 1] reportSLn "tc.polarity.set" 15 $ "Polarity of " ++ show x ++ " from positivity: " ++ show pol0 -} -- compute polarity of sized types pol1 <- sizePolarity x pol0 -- refine polarity again by using type information let t = defType def -- Instantiation takes place in Rules.Decl.instantiateDefinitionType -- t <- instantiateFull t -- Andreas, 2014-04-11 Issue 1099: needed for -- -- variable occurrence test in dependentPolarity. reportSDoc "tc.polarity.set" 15 $ text "Refining polarity with type " <+> prettyTCM t pol <- dependentPolarity t (enablePhantomTypes (theDef def) pol1) pol1 reportSLn "tc.polarity.set" 10 $ "Polarity of " ++ show x ++ ": " ++ show pol -- set the polarity in the signature setPolarity x $ drop npars pol -- purgeNonvariant pol -- temporarily disable non-variance -- make 'Nonvariant' args 'UnusedArg' in type and clause telescope -- Andreas 2012-11-18: skip this for abstract definitions (fixing issue 755). -- This means that the most precise type for abstract definitions -- is not available, even to other abstract definitions. -- A proper fix would be to introduce a second type for use within abstract. -- -- Andreas, 2015-07-01: I thought one should do this for -- abstract local definitions in @where@ blocks to fix Issue 1366b, --but it is not necessary. -- t <- if (defAbstract def == AbstractDef) && not (isAnonymousModuleName $ qnameModule x) t <- if (defAbstract def == AbstractDef) then return t else nonvariantToUnusedArg pol t modifySignature $ updateDefinition x $ updateTheDef (nonvariantToUnusedArgInDef pol) . updateDefType (const t) -- | Data and record parameters are used as phantom arguments all over -- the test suite (and possibly in user developments). -- @enablePhantomTypes@ turns 'Nonvariant' parameters to 'Covariant' -- to enable phantoms. enablePhantomTypes :: Defn -> [Polarity] -> [Polarity] enablePhantomTypes def pol = case def of Datatype{ dataPars = np } -> enable np Record { recPars = np } -> enable np _ -> pol where enable np = let (pars, rest) = genericSplitAt np pol in purgeNonvariant pars ++ rest {- UNUSED -- | Extract a basic approximate polarity info from the shape of definition. -- Arguments that are matched against get 'Invariant', others 'Nonvariant'. -- For data types, parameters get 'Nonvariant', indices 'Invariant'. usagePolarity :: Defn -> [Polarity] usagePolarity def = case def of Axiom{} -> [] Function{ funClauses = [] } -> [] Function{ funClauses = cs } -> usage $ map clausePats cs Datatype{ dataPars = np, dataIxs = ni } -> genericReplicate np Nonvariant Record{ recPars = n } -> genericReplicate n Nonvariant Constructor{} -> [] Primitive{} -> [] where usage = foldr1 (zipWith (/\)) . map (map (usagePat . unArg)) usagePat VarP{} = Nonvariant usagePat DotP{} = Nonvariant usagePat ConP{} = Invariant usagePat LitP{} = Invariant -} -- | Make arguments 'Invariant' if the type of a not-'Nonvariant' -- later argument depends on it. -- Also, enable phantom types by turning 'Nonvariant' into something -- else if it is a data/record parameter but not a size argument. [See issue 1596] -- -- Precondition: the "phantom" polarity list has the same length as the polarity list. dependentPolarity :: Type -> [Polarity] -> [Polarity] -> TCM [Polarity] dependentPolarity t _ [] = return [] -- all remaining are 'Invariant' dependentPolarity t [] (_ : _) = __IMPOSSIBLE__ dependentPolarity t (q:qs) pols@(p:ps) = do t <- reduce $ unEl t case ignoreSharing t of Pi dom b -> do let c = absBody b ps <- dependentPolarity c qs ps let mp = ifM (isJust <$> isSizeType (unDom dom)) (return p) (return q) p <- case b of Abs{} | p /= Invariant -> -- Andreas, 2014-04-11 see Issue 1099 -- Free variable analysis is not in the monad, -- hence metas must have been instantiated before! ifM (relevantInIgnoringNonvariant 0 c ps) (return Invariant) mp _ -> mp return $ p : ps _ -> return pols -- | Check whether a variable is relevant in a type expression, -- ignoring domains of non-variant arguments. relevantInIgnoringNonvariant :: Nat -> Type -> [Polarity] -> TCM Bool relevantInIgnoringNonvariant i t [] = return $ i `relevantInIgnoringSortAnn` t relevantInIgnoringNonvariant i t (p:ps) = do t <- reduce $ unEl t case ignoreSharing t of Pi a b -> if p /= Nonvariant && i `relevantInIgnoringSortAnn` a then return True else relevantInIgnoringNonvariant (i + 1) (absBody b) ps _ -> return $ i `relevantInIgnoringSortAnn` t -- * Turn polarity 'Nonvariant' into relevance 'UnusedArg' -- | Record information that an argument is unused in 'Relevance'. mkUnused :: Relevance -> Relevance mkUnused Relevant = UnusedArg -- commenting out this line switches off 'UnusedArg' polarity machinery mkUnused r = r -- 'Irrelevant' is more informative than 'UnusedArg'. -- | Improve 'Relevance' information in a type by polarity information. -- 'Nonvariant' becomes 'UnusedArg'. nonvariantToUnusedArg :: [Polarity] -> Type -> TCM Type nonvariantToUnusedArg [] t = return t nonvariantToUnusedArg (p:ps) t = do t <- reduce t case ignoreSharingType t of El s (Pi a b) -> do let a' = if p == Nonvariant then mapRelevance mkUnused a else a El s . Pi a' <$> traverse (nonvariantToUnusedArg ps) b -- we do not lift properly but bound variables do not matter for reduce -- also, we do not maintain the context _ -> return t -- | Propagate 'Nonvariant' 'Polarity' to 'Relevance' information in -- 'Arg's of a defined symbol. nonvariantToUnusedArgInDef :: [Polarity] -> Defn -> Defn nonvariantToUnusedArgInDef pol def = case def of Function { funClauses = cl } -> def { funClauses = map (nonvariantToUnusedArgInClause pol) cl } _ -> def nonvariantToUnusedArgInClause :: [Polarity] -> Clause -> Clause nonvariantToUnusedArgInClause pol cl@Clause{clauseTel = tel, clausePerm = perm, namedClausePats = ps} = let adjPat p Nonvariant | properlyMatching (namedArg p) = __IMPOSSIBLE__ -- if we match, we cannot be Nonvariant (sanity check) | otherwise = mapRelevance mkUnused p adjPat p _ = p -- change relevance of 'Nonvariant' arguments to 'UnusedArg' -- note that the associated patterns cannot be 'ConP' or 'LitP' ps' = zipWith adjPat ps (pol ++ repeat Invariant) -- get a list of 'Relevance's for the variables bound in the pattern rels0 = getRelevance <$> (concatMap (patternVars . fmap namedThing) ps') -- this is the order the variables appear in the telescope rels = permute perm rels0 -- now improve 'Relevance' in 'Telescope' by pattern relevance updateDom UnusedArg = mapRelevance mkUnused updateDom r = id tel' = telFromList $ zipWith updateDom rels $ telToList tel in cl { namedClausePats = ps', clauseTel = tel'} ------------------------------------------------------------------------ -- * Sized types ------------------------------------------------------------------------ -- | Hack for polarity of size indices. -- As a side effect, this sets the positivity of the size index. -- See test/succeed/PolaritySizeSucData.agda for a case where this is needed. sizePolarity :: QName -> [Polarity] -> TCM [Polarity] sizePolarity d pol0 = do let exit = return pol0 ifM (not . optSizedTypes <$> pragmaOptions) exit $ do def <- getConstInfo d case theDef def of Datatype{ dataPars = np, dataCons = cons } -> do let TelV tel _ = telView' $ defType def (parTel, ixTel) = genericSplitAt np $ telToList tel case ixTel of [] -> exit -- No size index Dom _ (_, a) : _ -> ifM ((/= Just BoundedNo) <$> isSizeType a) exit $ do -- we assume the size index to be 'Covariant' ... let pol = genericTake np pol0 polCo = pol ++ [Covariant] polIn = pol ++ [Invariant] setPolarity d $ polCo -- and seek confirm it by looking at the constructor types let check c = do t <- defType <$> getConstInfo c addCtxTel (telFromList parTel) $ do --OLD: let pars = reverse [ defaultArg $ var i | i <- [0..np - 1] ] let pars = map (defaultArg . var) $ downFrom np TelV conTel target <- telView =<< (t `piApplyM` pars) case conTel of EmptyTel -> return False -- no size argument ExtendTel arg tel -> ifM ((/= Just BoundedNo) <$> isSizeType (unDom arg)) (return False) $ do -- also no size argument -- First constructor argument has type Size -- check that only positive occurences in tel let isPos = underAbstraction arg tel $ \ tel -> do pols <- zipWithM polarity [0..] $ map (snd . unDom) $ telToList tel reportSDoc "tc.polarity.size" 25 $ text $ "to pass size polarity check, the following polarities need all to be covariant: " ++ show pols return $ all (`elem` [Nonvariant, Covariant]) pols -- check that the size argument appears in the -- right spot in the target type let sizeArg = size tel isLin = addContext conTel $ checkSizeIndex d np sizeArg target ok <- isPos `and2M` isLin reportSDoc "tc.polarity.size" 15 $ text "constructor" <+> prettyTCM c <+> text (if ok then "passes" else "fails") <+> text "size polarity check" return ok ifNotM (andM $ map check cons) (return polIn) -- no, does not conform to the rules of sized types $ do -- yes, we have a sized type here -- Andreas, 2015-07-01 -- As a side effect, mark the size also covariant for subsequent -- positivity checking (which feeds back into polarity analysis). modifyArgOccurrences d $ \ occ -> take np occ ++ [JustPos] return polCo _ -> exit -- | @checkSizeIndex d np i a@ checks that constructor target type @a@ -- has form @d ps (↑ i) idxs@ where @|ps| = np@. -- -- Precondition: @a@ is reduced and of form @d ps idxs0@. checkSizeIndex :: QName -> Nat -> Nat -> Type -> TCM Bool checkSizeIndex d np i a = do reportSDoc "tc.polarity.size" 15 $ withShowAllArguments $ text "checking that constructor target type " <+> prettyTCM a <+> text "is data type " <+> prettyTCM d <+> text "has size index successor of " <+> prettyTCM (var i) case ignoreSharing $ unEl a of Def d0 es -> do whenNothingM (sameDef d d0) __IMPOSSIBLE__ s <- sizeView $ unArg ix case s of SizeSuc v | Var j [] <- ignoreSharing v, i == j -> return $ not $ freeIn i (pars ++ ixs) _ -> return False where (pars, Apply ix : ixs) = genericSplitAt np es _ -> __IMPOSSIBLE__ -- | @polarities i a@ computes the list of polarities of de Bruijn index @i@ -- in syntactic entity @a@. class HasPolarity a where polarities :: Nat -> a -> TCM [Polarity] -- | @polarity i a@ computes the polarity of de Bruijn index @i@ -- in syntactic entity @a@ by taking the infimum of all 'polarities'. polarity :: HasPolarity a => Nat -> a -> TCM Polarity polarity i x = do ps <- polarities i x case ps of [] -> return Nonvariant ps -> return $ foldr1 (/\) ps instance HasPolarity a => HasPolarity (I.Arg a) where polarities i = polarities i . unArg instance HasPolarity a => HasPolarity (I.Dom a) where polarities i = polarities i . unDom instance HasPolarity a => HasPolarity (Abs a) where polarities i (Abs _ b) = polarities (i + 1) b polarities i (NoAbs _ v) = polarities i v instance HasPolarity a => HasPolarity [a] where polarities i xs = concat <$> mapM (polarities i) xs instance (HasPolarity a, HasPolarity b) => HasPolarity (a, b) where polarities i (x, y) = (++) <$> polarities i x <*> polarities i y instance HasPolarity Type where polarities i (El _ v) = polarities i v instance HasPolarity a => HasPolarity (Elim' a) where polarities i (Proj p) = return [] polarities i (Apply a) = polarities i a instance HasPolarity Term where polarities i v = do v <- instantiate v case v of -- Andreas, 2012-09-06: taking the polarities of the arguments -- without taking the variance of the function into account seems wrong. Var n ts | n == i -> (Covariant :) . map (const Invariant) <$> polarities i ts | otherwise -> map (const Invariant) <$> polarities i ts Lam _ t -> polarities i t Lit _ -> return [] Level l -> polarities i l Def x ts -> do pols <- getPolarity x let compose p ps = map (composePol p) ps concat . zipWith compose (pols ++ repeat Invariant) <$> mapM (polarities i) ts Con _ ts -> polarities i ts -- constructors can be seen as monotone in all args. Pi a b -> (++) <$> (map neg <$> polarities i a) <*> polarities i b Sort s -> return [] -- polarities i s -- return [] MetaV _ ts -> map (const Invariant) <$> polarities i ts Shared p -> polarities i $ derefPtr p DontCare t -> polarities i t -- return [] ExtLam{} -> __IMPOSSIBLE__ instance HasPolarity Level where polarities i (Max as) = polarities i as instance HasPolarity PlusLevel where polarities i ClosedLevel{} = return [] polarities i (Plus _ l) = polarities i l instance HasPolarity LevelAtom where polarities i l = case l of MetaLevel _ vs -> map (const Invariant) <$> polarities i vs BlockedLevel _ v -> polarities i v NeutralLevel _ v -> polarities i v UnreducedLevel v -> polarities i v Agda-2.4.2.5/src/full/Agda/TypeChecking/MetaVars.hs0000644000000000000000000013604512635075266017751 0ustar0000000000000000{-# LANGUAGE CPP #-} {-# LANGUAGE FlexibleInstances #-} {-# LANGUAGE PatternGuards #-} {-# LANGUAGE RelaxedPolyRec #-} {-# LANGUAGE TupleSections #-} module Agda.TypeChecking.MetaVars where import Control.Monad.Reader import Data.Function import Data.List hiding (sort) import qualified Data.List as List import qualified Data.Map as Map import qualified Data.Foldable as Fold import qualified Data.Traversable as Trav import Agda.Syntax.Common import Agda.Syntax.Internal as I import Agda.Syntax.Internal.Generic import Agda.Syntax.Position import qualified Agda.Syntax.Abstract as A import Agda.TypeChecking.Monad import Agda.TypeChecking.Monad.Builtin import Agda.TypeChecking.Reduce import Agda.TypeChecking.Substitute import Agda.TypeChecking.Telescope import Agda.TypeChecking.Constraints import Agda.TypeChecking.Errors import Agda.TypeChecking.Free import Agda.TypeChecking.Level import Agda.TypeChecking.Records import Agda.TypeChecking.Pretty import Agda.TypeChecking.Irrelevance import Agda.TypeChecking.EtaContract import Agda.TypeChecking.SizedTypes (boundedSizeMetaHook, isSizeProblem) -- import Agda.TypeChecking.CheckInternal -- import {-# SOURCE #-} Agda.TypeChecking.CheckInternal (checkInternal) import Agda.TypeChecking.MetaVars.Occurs import Agda.Utils.Except ( ExceptT #if !MIN_VERSION_transformers(0,4,1) , Error(noMsg) #endif , MonadError(throwError) , runExceptT ) import Agda.Utils.List import Agda.Utils.Maybe import Agda.Utils.Monad import Agda.Utils.Size import Agda.Utils.Tuple import Agda.Utils.Permutation import Agda.Utils.Pretty (prettyShow) import qualified Agda.Utils.VarSet as Set #include "undefined.h" import Agda.Utils.Impossible -- | Find position of a value in a list. -- Used to change metavar argument indices during assignment. -- -- @reverse@ is necessary because we are directly abstracting over the list. -- findIdx :: Eq a => [a] -> a -> Maybe Int findIdx vs v = findIndex (==v) (reverse vs) -- | Check whether a meta variable is a place holder for a blocked term. isBlockedTerm :: MetaId -> TCM Bool isBlockedTerm x = do reportSLn "tc.meta.blocked" 12 $ "is " ++ prettyShow x ++ " a blocked term? " i <- mvInstantiation <$> lookupMeta x let r = case i of BlockedConst{} -> True PostponedTypeCheckingProblem{} -> True InstV{} -> False InstS{} -> False Open{} -> False OpenIFS{} -> False reportSLn "tc.meta.blocked" 12 $ if r then " yes, because " ++ show i else " no" return r isEtaExpandable :: MetaId -> TCM Bool isEtaExpandable x = do i <- mvInstantiation <$> lookupMeta x return $ case i of Open{} -> True OpenIFS{} -> False InstV{} -> False InstS{} -> False BlockedConst{} -> False PostponedTypeCheckingProblem{} -> False -- * Performing the assignment -- | Performing the meta variable assignment. -- -- The instantiation should not be an 'InstV' or 'InstS' and the 'MetaId' -- should point to something 'Open' or a 'BlockedConst'. -- Further, the meta variable may not be 'Frozen'. assignTerm :: MetaId -> [I.Arg ArgName] -> Term -> TCM () assignTerm x tel v = do -- verify (new) invariants whenM (isFrozen x) __IMPOSSIBLE__ assignTerm' x tel v -- | Skip frozen check. Used for eta expanding frozen metas. assignTerm' :: MetaId -> [I.Arg ArgName] -> Term -> TCM () assignTerm' x tel v = do reportSLn "tc.meta.assign" 70 $ prettyShow x ++ " := " ++ show v ++ "\n in " ++ show tel -- verify (new) invariants whenM (not <$> asks envAssignMetas) __IMPOSSIBLE__ {- TODO make double-checking work -- currently, it does not work since types of sort-metas are inaccurate! -- Andreas, 2013-10-25 double check solution before assigning m <- lookupMeta x case mvJudgement m of HasType _ a -> dontAssignMetas $ checkInternal t a IsSort{} -> return () -- skip double check since type of meta is not accurate -} -- Andreas, 2013-10-25 double check solution before assigning -- Andreas, 2013-11-30 this seems to open a can of worms... -- dontAssignMetas $ do -- checkInternal t . jMetaType . mvJudgement =<< lookupMeta x let i = metaInstance tel v verboseS "profile.metas" 10 $ liftTCM $ tickMax "max-open-metas" . size =<< getOpenMetas modifyMetaStore $ ins x i etaExpandListeners x wakeupConstraints x reportSLn "tc.meta.assign" 20 $ "completed assignment of " ++ prettyShow x where metaInstance tel v = InstV tel v ins x i store = Map.adjust (inst i) x store inst i mv = mv { mvInstantiation = i } -- Andreas, 2013-10-25 hack to fool the unused-imports-checking-Nazi -- phantomUseToOverruleStrictImportsChecking = checkInternal -- * Creating meta variables. newSortMeta :: TCM Sort newSortMeta = ifM typeInType (return $ mkType 0) $ {- else -} ifM hasUniversePolymorphism (newSortMetaCtx =<< getContextArgs) -- else (no universe polymorphism) $ do i <- createMetaInfo lvl <- levelType x <- newMeta i normalMetaPriority (idP 0) $ IsSort () lvl -- WAS: topSort return $ Type $ Max [Plus 0 $ MetaLevel x []] newSortMetaCtx :: Args -> TCM Sort newSortMetaCtx vs = ifM typeInType (return $ mkType 0) $ {- else -} do i <- createMetaInfo tel <- getContextTelescope lvl <- levelType let t = telePi_ tel lvl -- WAS: topSort x <- newMeta i normalMetaPriority (idP 0) (IsSort () t) reportSDoc "tc.meta.new" 50 $ text "new sort meta" <+> prettyTCM x <+> text ":" <+> prettyTCM t return $ Type $ Max [Plus 0 $ MetaLevel x $ map Apply vs] newTypeMeta :: Sort -> TCM Type newTypeMeta s = El s <$> newValueMeta RunMetaOccursCheck (sort s) newTypeMeta_ :: TCM Type newTypeMeta_ = newTypeMeta =<< (workOnTypes $ newSortMeta) -- TODO: (this could be made work with new uni-poly) -- Andreas, 2011-04-27: If a type meta gets solved, than we do not have to check -- that it has a sort. The sort comes from the solution. -- newTypeMeta_ = newTypeMeta Inf -- | @newIFSMeta s t cands@ creates a new "implicit from scope" metavariable -- of type the output type of @t@ with name suggestion @s@ and initial -- solution candidates @cands@. If @t@ is a function type, then insert enough -- lambdas in front of it. newIFSMeta :: MetaNameSuggestion -> Type -> Maybe [(Term, Type)] -> TCM Term newIFSMeta s t cands = do TelV tel t' <- telView t addCtxTel tel $ do vs <- getContextArgs ctx <- getContextTelescope teleLam tel <$> newIFSMetaCtx s (telePi_ ctx t') vs (raise (size tel) cands) -- | Create a new value meta with specific dependencies. newIFSMetaCtx :: MetaNameSuggestion -> Type -> Args -> Maybe [(Term, Type)] -> TCM Term newIFSMetaCtx s t vs cands = do reportSDoc "tc.meta.new" 50 $ fsep [ text "new ifs meta:" , nest 2 $ prettyTCM vs <+> text "|-" ] i0 <- createMetaInfo let i = i0 { miNameSuggestion = s } TelV tel _ <- telView t let perm = idP (size tel) x <- newMeta' OpenIFS i normalMetaPriority perm (HasType () t) reportSDoc "tc.meta.new" 50 $ fsep [ nest 2 $ pretty x <+> text ":" <+> prettyTCM t ] addConstraint $ FindInScope x cands return $ MetaV x $ map Apply vs newNamedValueMeta :: RunMetaOccursCheck -> MetaNameSuggestion -> Type -> TCM Term newNamedValueMeta b s t = do v <- newValueMeta b t setValueMetaName v s return v -- | Create a new metavariable, possibly η-expanding in the process. newValueMeta :: RunMetaOccursCheck -> Type -> TCM Term newValueMeta b t = do vs <- getContextArgs tel <- getContextTelescope newValueMetaCtx b (telePi_ tel t) vs newValueMetaCtx :: RunMetaOccursCheck -> Type -> Args -> TCM Term newValueMetaCtx b t ctx = instantiateFull =<< newValueMetaCtx' b t ctx -- | Create a new value meta without η-expanding. newValueMeta' :: RunMetaOccursCheck -> Type -> TCM Term newValueMeta' b t = do vs <- getContextArgs tel <- getContextTelescope newValueMetaCtx' b (telePi_ tel t) vs -- | Create a new value meta with specific dependencies. newValueMetaCtx' :: RunMetaOccursCheck -> Type -> Args -> TCM Term newValueMetaCtx' b t vs = do i <- createMetaInfo' b TelV tel a <- telView t let perm = idP (size tel) x <- newMeta i normalMetaPriority perm (HasType () t) reportSDoc "tc.meta.new" 50 $ fsep [ text "new meta:" , nest 2 $ prettyTCM vs <+> text "|-" , nest 2 $ pretty x <+> text ":" <+> prettyTCM t ] etaExpandMetaSafe x -- Andreas, 2012-09-24: for Metas X : Size< u add constraint X+1 <= u let u = shared $ MetaV x $ map Apply vs boundedSizeMetaHook u tel a return u newTelMeta :: Telescope -> TCM Args newTelMeta tel = newArgsMeta (abstract tel $ typeDontCare) type Condition = I.Dom Type -> Abs Type -> Bool trueCondition :: Condition trueCondition _ _ = True newArgsMeta :: Type -> TCM Args newArgsMeta = newArgsMeta' trueCondition newArgsMeta' :: Condition -> Type -> TCM Args newArgsMeta' condition t = do args <- getContextArgs tel <- getContextTelescope newArgsMetaCtx' condition t tel args newArgsMetaCtx :: Type -> Telescope -> Args -> TCM Args newArgsMetaCtx = newArgsMetaCtx' trueCondition newArgsMetaCtx' :: Condition -> Type -> Telescope -> Args -> TCM Args newArgsMetaCtx' condition (El s tm) tel ctx = do tm <- reduce tm case ignoreSharing tm of Pi dom@(Dom info a) codom | condition dom codom -> do arg <- Arg info <$> do applyRelevanceToContext (getRelevance info) $ {- -- Andreas, 2010-09-24 skip irrelevant record fields when eta-expanding a meta var -- Andreas, 2010-10-11 this is WRONG, see Issue 347 if r == Irrelevant then return DontCare else -} newValueMetaCtx RunMetaOccursCheck (telePi_ tel a) ctx args <- newArgsMetaCtx' condition (El s tm `piApply` [arg]) tel ctx return $ arg : args _ -> return [] -- | Create a metavariable of record type. This is actually one metavariable -- for each field. newRecordMeta :: QName -> Args -> TCM Term newRecordMeta r pars = do args <- getContextArgs tel <- getContextTelescope newRecordMetaCtx r pars tel args newRecordMetaCtx :: QName -> Args -> Telescope -> Args -> TCM Term newRecordMetaCtx r pars tel ctx = do ftel <- flip apply pars <$> getRecordFieldTypes r fields <- newArgsMetaCtx (telePi_ ftel $ sort Prop) tel ctx con <- getRecordConstructor r return $ Con con fields newQuestionMark :: InteractionId -> Type -> TCM Term newQuestionMark ii t = do -- Do not run check for recursive occurrence of meta in definitions, -- because we want to give the recursive solution interactively (Issue 589) m <- newValueMeta' DontRunMetaOccursCheck t let MetaV x _ = ignoreSharing m connectInteractionPoint ii x return m -- | Construct a blocked constant if there are constraints. blockTerm :: Type -> TCM Term -> TCM Term blockTerm t blocker = do (pid, v) <- newProblem blocker blockTermOnProblem t v pid blockTermOnProblem :: Type -> Term -> ProblemId -> TCM Term blockTermOnProblem t v pid = -- Andreas, 2012-09-27 do not block on unsolved size constraints ifM (isProblemSolved pid `or2M` isSizeProblem pid) (return v) $ do i <- createMetaInfo es <- map Apply <$> getContextArgs tel <- getContextTelescope x <- newMeta' (BlockedConst $ abstract tel v) i lowMetaPriority (idP $ size tel) (HasType () $ telePi_ tel t) -- we don't instantiate blocked terms inTopContext $ addConstraint (Guarded (UnBlock x) pid) reportSDoc "tc.meta.blocked" 20 $ vcat [ text "blocked" <+> prettyTCM x <+> text ":=" <+> inTopContext (prettyTCM $ abstract tel v) , text " by" <+> (prettyTCM =<< getConstraintsForProblem pid) ] inst <- isInstantiatedMeta x case inst of True -> instantiate (MetaV x es) False -> do -- We don't return the blocked term instead create a fresh metavariable -- that we compare against the blocked term once it's unblocked. This way -- blocked terms can be instantiated before they are unblocked, thus making -- constraint solving a bit more robust against instantiation order. -- Andreas, 2015-05-22: DontRunMetaOccursCheck to avoid Issue585-17. v <- newValueMeta DontRunMetaOccursCheck t i <- liftTCM fresh -- This constraint is woken up when unblocking, so it doesn't need a problem id. cmp <- buildProblemConstraint 0 (ValueCmp CmpEq t v (MetaV x es)) listenToMeta (CheckConstraint i cmp) x return v blockTypeOnProblem :: Type -> ProblemId -> TCM Type blockTypeOnProblem (El s a) pid = El s <$> blockTermOnProblem (El Inf $ Sort s) a pid -- | @unblockedTester t@ returns @False@ if @t@ is a meta or a blocked term. -- -- Auxiliary function to create a postponed type checking problem. unblockedTester :: Type -> TCM Bool unblockedTester t = ifBlockedType t (\ m t -> return False) (\ t -> return True) -- | Create a postponed type checking problem @e : t@ that waits for type @t@ -- to unblock (become instantiated or its constraints resolved). postponeTypeCheckingProblem_ :: TypeCheckingProblem -> TCM Term postponeTypeCheckingProblem_ p = do postponeTypeCheckingProblem p (unblock p) where unblock (CheckExpr _ t) = unblockedTester t unblock (CheckArgs _ _ _ _ t _ _) = unblockedTester t -- The type of the head of the application. unblock (CheckLambda _ _ t) = unblockedTester t -- | Create a postponed type checking problem @e : t@ that waits for conditon -- @unblock@. A new meta is created in the current context that has as -- instantiation the postponed type checking problem. An 'UnBlock' constraint -- is added for this meta, which links to this meta. postponeTypeCheckingProblem :: TypeCheckingProblem -> TCM Bool -> TCM Term postponeTypeCheckingProblem p unblock = do i <- createMetaInfo' DontRunMetaOccursCheck tel <- getContextTelescope cl <- buildClosure p let t = problemType p m <- newMeta' (PostponedTypeCheckingProblem cl unblock) i normalMetaPriority (idP (size tel)) $ HasType () $ telePi_ tel t -- Create the meta that we actually return -- Andreas, 2012-03-15 -- This is an alias to the pptc meta, in order to allow pruning (issue 468) -- and instantiation. -- Since this meta's solution comes from user code, we do not need -- to run the extended occurs check (metaOccurs) to exclude -- non-terminating solutions. es <- map Apply <$> getContextArgs v <- newValueMeta DontRunMetaOccursCheck t cmp <- buildProblemConstraint 0 (ValueCmp CmpEq t v (MetaV m es)) i <- liftTCM fresh listenToMeta (CheckConstraint i cmp) m addConstraint (UnBlock m) return v -- | Type of the term that is produced by solving the 'TypeCheckingProblem'. problemType :: TypeCheckingProblem -> Type problemType (CheckExpr _ t ) = t problemType (CheckArgs _ _ _ _ _ t _ ) = t -- The target type of the application. problemType (CheckLambda _ _ t ) = t -- | Eta expand metavariables listening on the current meta. etaExpandListeners :: MetaId -> TCM () etaExpandListeners m = do ls <- getMetaListeners m clearMetaListeners m -- we don't really have to do this mapM_ wakeupListener ls -- | Wake up a meta listener and let it do its thing wakeupListener :: Listener -> TCM () -- Andreas 2010-10-15: do not expand record mvars, lazyness needed for irrelevance wakeupListener (EtaExpand x) = etaExpandMetaSafe x wakeupListener (CheckConstraint _ c) = do reportSDoc "tc.meta.blocked" 20 $ text "waking boxed constraint" <+> prettyTCM c addAwakeConstraints [c] solveAwakeConstraints -- | Do safe eta-expansions for meta (@SingletonRecords,Levels@). etaExpandMetaSafe :: MetaId -> TCM () etaExpandMetaSafe = etaExpandMeta [SingletonRecords,Levels] -- | Various kinds of metavariables. data MetaKind = Records -- ^ Meta variables of record type. | SingletonRecords -- ^ Meta variables of \"hereditarily singleton\" record type. | Levels -- ^ Meta variables of level type, if type-in-type is activated. deriving (Eq, Enum, Bounded, Show) -- | All possible metavariable kinds. allMetaKinds :: [MetaKind] allMetaKinds = [minBound .. maxBound] -- | Eta expand a metavariable, if it is of the specified kind. -- Don't do anything if the metavariable is a blocked term. etaExpandMeta :: [MetaKind] -> MetaId -> TCM () etaExpandMeta kinds m = whenM (isEtaExpandable m) $ do verboseBracket "tc.meta.eta" 20 ("etaExpandMeta " ++ prettyShow m) $ do let waitFor x = do reportSDoc "tc.meta.eta" 20 $ do text "postponing eta-expansion of meta variable" <+> prettyTCM m <+> text "which is blocked by" <+> prettyTCM x listenToMeta (EtaExpand m) x dontExpand = do reportSDoc "tc.meta.eta" 20 $ do text "we do not expand meta variable" <+> prettyTCM m <+> text ("(requested was expansion of " ++ show kinds ++ ")") meta <- lookupMeta m let HasType _ a = mvJudgement meta TelV tel b <- telView a -- if the target type @b@ of @m@ is a meta variable @x@ itself -- (@NonBlocked (MetaV{})@), -- or it is blocked by a meta-variable @x@ (@Blocked@), we cannot -- eta expand now, we have to postpone this. Once @x@ is -- instantiated, we can continue eta-expanding m. This is realized -- by adding @m@ to the listeners of @x@. ifBlocked (unEl b) (\ x _ -> waitFor x) $ \ t -> case ignoreSharing t of lvl@(Def r es) -> ifM (isEtaRecord r) {- then -} (do let ps = fromMaybe __IMPOSSIBLE__ $ allApplyElims es let expand = do u <- withMetaInfo' meta $ newRecordMetaCtx r ps tel $ teleArgs tel inTopContext $ do verboseS "tc.meta.eta" 15 $ do du <- prettyTCM u reportSDoc "tc.meta.eta" 15 $ sep [ text "eta expanding: " <+> pretty m <+> text " --> " , nest 2 $ prettyTCM u ] -- Andreas, 2012-03-29: No need for occurrence check etc. -- we directly assign the solution for the meta -- 2012-05-23: We also bypass the check for frozen. noConstraints $ assignTerm' m (telToArgs tel) u -- should never produce any constraints if Records `elem` kinds then expand else if (SingletonRecords `elem` kinds) then do singleton <- isSingletonRecord r ps case singleton of Left x -> waitFor x Right False -> dontExpand Right True -> expand else dontExpand ) $ {- else -} ifM (andM [ return $ Levels `elem` kinds , typeInType , (Just lvl ==) <$> getBuiltin' builtinLevel ]) (do reportSLn "tc.meta.eta" 20 $ "Expanding level meta to 0 (type-in-type)" -- Andreas, 2012-03-30: No need for occurrence check etc. -- we directly assign the solution for the meta noConstraints $ assignTerm m (telToArgs tel) (Level $ Max []) ) $ {- else -} dontExpand _ -> dontExpand -- | Eta expand blocking metavariables of record type, and reduce the -- blocked thing. etaExpandBlocked :: Reduce t => Blocked t -> TCM (Blocked t) etaExpandBlocked t@NotBlocked{} = return t etaExpandBlocked (Blocked m t) = do etaExpandMeta [Records] m t <- reduceB t case t of Blocked m' _ | m /= m' -> etaExpandBlocked t _ -> return t -- * Solve constraint @x vs = v@. -- | Assign to an open metavar which may not be frozen. -- First check that metavar args are in pattern fragment. -- Then do extended occurs check on given thing. -- -- Assignment is aborted by throwing a @PatternErr@ via a call to -- @patternViolation@. This error is caught by @catchConstraint@ -- during equality checking (@compareAtom@) and leads to -- restoration of the original constraints. assignV :: CompareDirection -> MetaId -> Args -> Term -> TCM () assignV dir x args v = assignWrapper dir x (map Apply args) v $ assign dir x args v assignWrapper :: CompareDirection -> MetaId -> Elims -> Term -> TCM () -> TCM () assignWrapper dir x es v doAssign = do ifNotM (asks envAssignMetas) patternViolation $ {- else -} do reportSDoc "tc.meta.assign" 10 $ do text "term" <+> prettyTCM (MetaV x es) <+> text (":" ++ show dir) <+> prettyTCM v liftTCM $ nowSolvingConstraints doAssign `finally` solveAwakeConstraints -- | Miller pattern unification: -- -- @assign x vs v@ solves problem @x vs = v@ for meta @x@ -- if @vs@ are distinct variables (linearity check) -- and @v@ depends only on these variables -- and does not contain @x@ itself (occurs check). -- -- This is the basic story, but we have added some features: -- -- 1. Pruning. -- 2. Benign cases of non-linearity. -- 3. @vs@ may contain record patterns. -- -- For a reference to some of these extensions, read -- Andreas Abel and Brigitte Pientka's TLCA 2011 paper. assign :: CompareDirection -> MetaId -> Args -> Term -> TCM () assign dir x args v = do mvar <- lookupMeta x -- information associated with meta x let t = jMetaType $ mvJudgement mvar -- Andreas, 2011-05-20 TODO! -- full normalization (which also happens during occurs check) -- is too expensive! (see Issue 415) -- need to do something cheaper, especially if -- we are dealing with a Miller pattern that can be solved -- immediately! -- Ulf, 2011-08-25 DONE! -- Just instantiating the top-level meta, which is cheaper. The occurs -- check will first try without unfolding any definitions (treating -- arguments to definitions as flexible), if that fails it tries again -- with full unfolding. v <- instantiate v reportSLn "tc.meta.assign" 50 $ "MetaVars.assign: assigning to " ++ show v case (ignoreSharing v, mvJudgement mvar) of (Sort Inf, HasType{}) -> typeError SetOmegaNotValidType _ -> return () -- We don't instantiate frozen mvars when (mvFrozen mvar == Frozen) $ do reportSLn "tc.meta.assign" 25 $ "aborting: meta is frozen!" patternViolation -- We never get blocked terms here anymore. TODO: we actually do. why? whenM (isBlockedTerm x) patternViolation -- Andreas, 2010-10-15 I want to see whether rhs is blocked reportSLn "tc.meta.assign" 50 $ "MetaVars.assign: I want to see whether rhs is blocked" reportSDoc "tc.meta.assign" 25 $ do v0 <- reduceB v case v0 of Blocked m0 _ -> text "r.h.s. blocked on:" <+> prettyTCM m0 NotBlocked{} -> text "r.h.s. not blocked" -- Turn the assignment problem @_X args >= SizeLt u@ into -- @_X args = SizeLt (_Y args@ and constraint -- @_Y args >= u@. subtypingForSizeLt dir x mvar t args v $ \ v -> do -- Normalise and eta contract the arguments to the meta. These are -- usually small, and simplifying might let us instantiate more metas. -- MOVED TO expandProjectedVars: -- args <- etaContract =<< normalise args -- Also, try to expand away projected vars in meta args. expandProjectedVars args v $ \ args v -> do -- If we had the type here we could save the work we put -- into expanding projected variables. -- catchConstraint (ValueCmp CmpEq ? (MetaV m $ map Apply args) v) $ do -- Andreas, 2011-04-21 do the occurs check first -- e.g. _1 x (suc x) = suc (_2 x y) -- even though the lhs is not a pattern, we can prune the y from _2 let relVL = Set.toList $ allRelevantVars args {- Andreas, 2012-04-02: DontCare no longer present -- take away top-level DontCare constructors args <- return $ map (fmap stripDontCare) args -} -- Andreas, 2011-10-06 only irrelevant vars that are direct -- arguments to the meta, hence, can be abstracted over, may -- appear on the rhs. (test/fail/Issue483b) -- Update 2011-03-27: Also irr. vars under record constructors. let fromIrrVar (Var i []) = return [i] fromIrrVar (Con c vs) = ifM (isNothing <$> isRecordConstructor (conName c)) (return []) $ concat <$> mapM (fromIrrVar . {- stripDontCare .-} unArg) vs fromIrrVar (Shared p) = fromIrrVar (derefPtr p) fromIrrVar _ = return [] irrVL <- concat <$> mapM fromIrrVar [ v | Arg info v <- args, irrelevantOrUnused (getRelevance info) ] reportSDoc "tc.meta.assign" 20 $ let pr (Var n []) = text (show n) pr (Def c []) = prettyTCM c pr _ = text ".." in vcat [ text "mvar args:" <+> sep (map (pr . unArg) args) , text "fvars lhs (rel):" <+> sep (map (text . show) relVL) , text "fvars lhs (irr):" <+> sep (map (text . show) irrVL) ] -- Check that the x doesn't occur in the right hand side. -- Prune mvars on rhs such that they can only depend on lhs vars. -- Herein, distinguish relevant and irrelevant vars, -- since when abstracting irrelevant lhs vars, they may only occur -- irrelevantly on rhs. v <- liftTCM $ occursCheck x (relVL, irrVL) v reportSLn "tc.meta.assign" 15 "passed occursCheck" verboseS "tc.meta.assign" 30 $ do let n = termSize v when (n > 200) $ reportSDoc "tc.meta.assign" 30 $ sep [ text "size" <+> text (show n) -- , nest 2 $ text "type" <+> prettyTCM t , nest 2 $ text "term" <+> prettyTCM v ] -- Check linearity of @ids@ -- Andreas, 2010-09-24: Herein, ignore the variables which are not -- free in v -- Ulf, 2011-09-22: we need to respect irrelevant vars as well, otherwise -- we'll build solutions where the irrelevant terms are not valid let fvs = allFreeVars v reportSDoc "tc.meta.assign" 20 $ text "fvars rhs:" <+> sep (map (text . show) $ Set.toList fvs) -- Check that the arguments are variables mids <- do res <- runExceptT $ inverseSubst args case res of -- all args are variables Right ids -> do reportSDoc "tc.meta.assign" 50 $ text "inverseSubst returns:" <+> sep (map prettyTCM ids) return $ Just ids -- we have proper values as arguments which could be cased on -- here, we cannot prune, since offending vars could be eliminated Left CantInvert -> return Nothing -- we have non-variables, but these are not eliminateable Left NeutralArg -> Just <$> attemptPruning x args fvs -- we have a projected variable which could not be eta-expanded away: -- same as neutral Left (ProjectedVar i qs) -> Just <$> attemptPruning x args fvs case mids of Nothing -> patternViolation -- Ulf 2014-07-13: actually not needed after all: attemptInertRHSImprovement x args v Just ids -> do -- Check linearity ids <- do res <- runExceptT $ checkLinearity {- (`Set.member` fvs) -} ids case res of -- case: linear Right ids -> return ids -- case: non-linear variables that could possibly be pruned Left () -> attemptPruning x args fvs -- Solve. m <- getContextSize assignMeta' m x t (length args) ids v where attemptPruning x args fvs = do -- non-linear lhs: we cannot solve, but prune killResult <- prune x args $ Set.toList fvs reportSDoc "tc.meta.assign" 10 $ text "pruning" <+> prettyTCM x <+> do text $ if killResult `elem` [PrunedSomething,PrunedEverything] then "succeeded" else "failed" patternViolation {- UNUSED -- | When faced with @_X us == D vs@ for an inert D we can solve this by -- @_X xs := D _Ys@ with new constraints @_Yi us == vi@. This is important -- for instance arguments, where knowing the head D might enable progress. attemptInertRHSImprovement :: MetaId -> Args -> Term -> TCM () attemptInertRHSImprovement m args v = do reportSDoc "tc.meta.inert" 30 $ vcat [ text "attempting inert rhs improvement" , nest 2 $ sep [ prettyTCM (MetaV m $ map Apply args) <+> text "==" , prettyTCM v ] ] -- Check that the right-hand side has the form D vs, for some inert constant D. -- Returns the type of D and a function to build an application of D. (a, mkRHS) <- ensureInert v -- Check that all arguments to the meta are neutral and does not have head D. -- If there are non-neutral arguments there could be solutions to the meta -- that computes over these arguments. If D is an argument to the meta we get -- multiple solutions (for instance: _M Nat == Nat can be solved by both -- _M := \ x -> x and _M := \ x -> Nat). mapM_ (ensureNeutral (mkRHS []) . unArg) args tel <- theTel <$> (telView =<< getMetaType m) -- When attempting shortcut meta solutions, metas aren't necessarily fully -- eta expanded. If this is the case we skip inert improvement. when (length args < size tel) $ do reportSDoc "tc.meta.inert" 30 $ text "not fully applied" patternViolation -- Solve the meta with _M := \ xs -> D (_Y1 xs) .. (_Yn xs), for fresh metas -- _Yi. metaArgs <- inTopContext $ addCtxTel tel $ newArgsMeta a let varArgs = map Apply $ reverse $ zipWith (\i a -> var i <$ a) [0..] (reverse args) sol = mkRHS metaArgs argTel = map ("x" <$) args reportSDoc "tc.meta.inert" 30 $ nest 2 $ vcat [ text "a =" <+> prettyTCM a , text "tel =" <+> prettyTCM tel , text "metas =" <+> prettyList (map prettyTCM metaArgs) , text "sol =" <+> prettyTCM sol ] assignTerm m argTel sol patternViolation -- throwing a pattern violation here lets the constraint -- machinery worry about restarting the comparison. where ensureInert :: Term -> TCM (Type, Args -> Term) ensureInert v = do let notInert = do reportSDoc "tc.meta.inert" 30 $ nest 2 $ text "not inert:" <+> prettyTCM v patternViolation toArgs elims = case allApplyElims elims of Nothing -> do reportSDoc "tc.meta.inert" 30 $ nest 2 $ text "can't do projections from inert" patternViolation Just args -> return args case ignoreSharing v of Var x elims -> (, Var x . map Apply) <$> typeOfBV x Con c args -> notInert -- (, Con c) <$> defType <$> getConstInfo (conName c) Def f elims -> do def <- getConstInfo f let good = return (defType def, Def f . map Apply) case theDef def of Axiom{} -> good Datatype{} -> good Record{} -> good Function{} -> notInert Primitive{} -> notInert Constructor{} -> __IMPOSSIBLE__ Pi{} -> notInert -- this is actually inert but improving doesn't buy us anything for Pi Lam{} -> notInert Sort{} -> notInert Lit{} -> notInert Level{} -> notInert MetaV{} -> notInert DontCare{} -> notInert ExtLam{} -> __IMPOSSIBLE__ Shared{} -> __IMPOSSIBLE__ ensureNeutral :: Term -> Term -> TCM () ensureNeutral rhs v = do b <- reduceB v let notNeutral v = do reportSDoc "tc.meta.inert" 30 $ nest 2 $ text "not neutral:" <+> prettyTCM v patternViolation checkRHS arg | arg == rhs = do reportSDoc "tc.meta.inert" 30 $ nest 2 $ text "argument shares head with RHS:" <+> prettyTCM arg patternViolation | otherwise = return () case fmap ignoreSharing b of Blocked{} -> notNeutral v NotBlocked r v -> -- Andrea(s) 2014-12-06 can r be useful? case v of Var x _ -> checkRHS (Var x []) Def f _ -> checkRHS (Def f []) Pi{} -> return () Sort{} -> return () Level{} -> return () Lit{} -> notNeutral v DontCare{} -> notNeutral v MetaV{} -> notNeutral v Con{} -> notNeutral v Lam{} -> notNeutral v ExtLam{} -> __IMPOSSIBLE__ Shared{} -> __IMPOSSIBLE__ -- END UNUSED -} -- | @assignMeta m x t ids u@ solves @x ids = u@ for meta @x@ of type @t@, -- where term @u@ lives in a context of length @m@. -- Precondition: @ids@ is linear. assignMeta :: Int -> MetaId -> Type -> [Int] -> Term -> TCM () assignMeta m x t ids v = do let n = length ids cand = List.sort $ zip ids $ map var $ downFrom n assignMeta' m x t n cand v -- | @assignMeta' m x t ids u@ solves @x = [ids]u@ for meta @x@ of type @t@, -- where term @u@ lives in a context of length @m@, -- and @ids@ is a partial substitution. assignMeta' :: Int -> MetaId -> Type -> Int -> SubstCand -> Term -> TCM () assignMeta' m x t n ids v = do -- we are linear, so we can solve! reportSDoc "tc.meta.assign" 25 $ text "preparing to instantiate: " <+> prettyTCM v -- Rename the variables in v to make it suitable for abstraction over ids. v' <- do -- Basically, if -- Γ = a b c d e -- ids = d b e -- then -- v' = (λ a b c d e. v) _ 1 _ 2 0 -- -- Andreas, 2013-10-25 Solve using substitutions: -- Convert assocList @ids@ (which is sorted) into substitution, -- filling in __IMPOSSIBLE__ for the missing terms, e.g. -- [(0,0),(1,2),(3,1)] --> [0, 2, __IMP__, 1, __IMP__] -- ALT 1: O(m * size ids), serves as specification -- let ivs = [fromMaybe __IMPOSSIBLE__ $ lookup i ids | i <- [0..m-1]] -- ALT 2: O(m) let assocToList i l = case l of _ | i >= m -> [] ((j,u) : l) | i == j -> Just u : assocToList (i+1) l _ -> Nothing : assocToList (i+1) l ivs = assocToList 0 ids rho = prependS __IMPOSSIBLE__ ivs $ raiseS n return $ applySubst rho v -- Metas are top-level so we do the assignment at top-level. inTopContext $ do -- Andreas, 2011-04-18 to work with irrelevant parameters -- we need to construct tel' from the type of the meta variable -- (no longer from ids which may not be the complete variable list -- any more) reportSDoc "tc.meta.assign" 15 $ text "type of meta =" <+> prettyTCM t reportSDoc "tc.meta.assign" 70 $ text "type of meta =" <+> text (show t) TelV tel' _ <- telViewUpTo n t reportSDoc "tc.meta.assign" 30 $ text "tel' =" <+> prettyTCM tel' reportSDoc "tc.meta.assign" 30 $ text "#args =" <+> text (show n) -- Andreas, 2013-09-17 (AIM XVIII): if t does not provide enough -- types for the arguments, it might be blocked by a meta; -- then we give up. (Issue 903) when (size tel' < n) patternViolation -- WAS: __IMPOSSIBLE__ -- Perform the assignment (and wake constraints). reportSDoc "tc.meta.assign" 10 $ text "solving" <+> prettyTCM x <+> text ":=" <+> prettyTCM (abstract tel' v') assignTerm x (telToArgs tel') v' -- | Turn the assignment problem @_X args <= SizeLt u@ into -- @_X args = SizeLt (_Y args)@ and constraint -- @_Y args <= u@. subtypingForSizeLt :: CompareDirection -- ^ @dir@ -> MetaId -- ^ The meta variable @x@. -> MetaVariable -- ^ Its associated information @mvar <- lookupMeta x@. -> Type -- ^ Its type @t = jMetaType $ mvJudgement mvar@ -> Args -- ^ Its arguments. -> Term -- ^ Its to-be-assigned value @v@, such that @x args `dir` v@. -> (Term -> TCM ()) -- ^ Continuation taking its possibly assigned value. -> TCM () subtypingForSizeLt DirEq x mvar t args v cont = cont v subtypingForSizeLt dir x mvar t args v cont = do let fallback = cont v -- Check whether we have built-ins SIZE and SIZELT (mSize, mSizeLt) <- getBuiltinSize caseMaybe mSize fallback $ \ qSize -> do caseMaybe mSizeLt fallback $ \ qSizeLt -> do -- Check whether v is a SIZELT v <- reduce v case ignoreSharing v of Def q [Apply (Arg ai u)] | q == qSizeLt -> do -- Clone the meta into a new size meta @y@. -- To this end, we swap the target of t for Size. TelV tel _ <- telView t let size = sizeType_ qSize t' = telePi tel size y <- newMeta (mvInfo mvar) (mvPriority mvar) (mvPermutation mvar) (HasType __IMPOSSIBLE__ t') -- Note: no eta-expansion of new meta possible/necessary. -- Add the size constraint @y args `dir` u@. let yArgs = MetaV y $ map Apply args addConstraint $ dirToCmp (`ValueCmp` size) dir yArgs u -- We continue with the new assignment problem, and install -- an exception handler, since we created a meta and a constraint, -- so we cannot fall back to the original handler. let xArgs = MetaV x $ map Apply args v' = Def qSizeLt [Apply $ Arg ai yArgs] c = dirToCmp (`ValueCmp` sizeUniv) dir xArgs v' catchConstraint c $ cont v' _ -> fallback -- | Eta-expand bound variables like @z@ in @X (fst z)@. expandProjectedVars :: (Normalise a, TermLike a, Show a, PrettyTCM a, NoProjectedVar a, Subst a, PrettyTCM b, Subst b) => a -> b -> (a -> b -> TCM c) -> TCM c expandProjectedVars args v ret = loop (args, v) where loop (args, v) = do reportSDoc "tc.meta.assign.proj" 45 $ text "meta args: " <+> prettyTCM args args <- etaContract =<< normalise args reportSDoc "tc.meta.assign.proj" 45 $ text "norm args: " <+> prettyTCM args reportSDoc "tc.meta.assign.proj" 85 $ text "norm args: " <+> text (show args) let done = ret args v case noProjectedVar args of Right () -> do reportSDoc "tc.meta.assign.proj" 40 $ text "no projected var found in args: " <+> prettyTCM args done Left (ProjVarExc i _) -> etaExpandProjectedVar i (args, v) done loop -- | Eta-expand a de Bruijn index of record type in context and passed term(s). etaExpandProjectedVar :: (PrettyTCM a, Subst a) => Int -> a -> TCM c -> (a -> TCM c) -> TCM c etaExpandProjectedVar i v fail succeed = do reportSDoc "tc.meta.assign.proj" 40 $ text "trying to expand projected variable" <+> prettyTCM (var i) caseMaybeM (etaExpandBoundVar i) fail $ \ (delta, sigma, tau) -> do reportSDoc "tc.meta.assign.proj" 25 $ text "eta-expanding var " <+> prettyTCM (var i) <+> text " in terms " <+> prettyTCM v inTopContext $ addContext delta $ succeed $ applySubst tau v -- | Check whether one of the meta args is a projected var. class NoProjectedVar a where noProjectedVar :: a -> Either ProjVarExc () data ProjVarExc = ProjVarExc Int [QName] -- ASR (17 June 2015). Unused Error instance. -- instance Error ProjVarExc where -- noMsg = __IMPOSSIBLE__ instance NoProjectedVar Term where noProjectedVar t = case ignoreSharing t of Var i es | qs@(_:_) <- takeWhileJust id $ map isProjElim es -> Left $ ProjVarExc i qs -- Andreas, 2015-09-12 Issue 1316: -- Also look in inductive record constructors Con (ConHead _ Inductive (_:_)) vs -> noProjectedVar vs _ -> return () instance NoProjectedVar a => NoProjectedVar (I.Arg a) where noProjectedVar = Fold.mapM_ noProjectedVar instance NoProjectedVar a => NoProjectedVar [a] where noProjectedVar = Fold.mapM_ noProjectedVar {- UNUSED, BUT KEEP! -- Wrong attempt at expanding bound variables. -- The following code curries meta instead. -- | @etaExpandProjectedVar mvar x t n qs@ -- -- @mvar@ is the meta var info. -- @x@ is the meta variable we are trying to solve for. -- @t@ is its type. -- @n@ is the number of the meta arg we want to curry (starting at 0). -- @qs@ is the projection path along which we curry. -- etaExpandProjectedVar :: MetaVariable -> MetaId -> Type -> Int -> [QName] -> TCM a etaExpandProjectedVar mvar x t n qs = inTopContext $ do (_, uncurry, t') <- curryAt t n let TelV tel a = telView' t' perm = idP (size tel) y <- newMeta (mvInfo mvar) (mvPriority mvar) perm (HasType __IMPOSSIBLE__ t') assignTerm' x (uncurry $ MetaV y []) patternViolation -} {- -- first, strip the leading n domains (which remain unchanged) TelV gamma core <- telViewUpTo n t case ignoreSharing $ unEl core of -- There should be at least one domain left Pi (Dom ai a) b -> do -- Eta-expand @dom@ along @qs@ into a telescope @tel@, computing a substitution. -- For now, we only eta-expand once. -- This might trigger another call to @etaExpandProjectedVar@ later. -- A more efficient version does all the eta-expansions at once here. (r, pars, def) <- fromMaybe __IMPOSSIBLE__ <$> isRecordType a unless (recEtaEquality def) __IMPOSSIBLE__ let tel = recTel def `apply` pars m = size tel v = Con (recConHead def) $ map var $ downFrom m b' = raise m b `absApp` v fs = recFields def vs = zipWith (\ f i -> Var i [Proj f]) fs $ downFrom m -- v = c (n-1) ... 1 0 (tel, u) <- etaExpandAtRecordType a $ var 0 -- TODO: compose argInfo ai with tel. -- Substitute into @b@. -- Abstract over @tel@. -- Abstract over @gamma@. -- Create new meta. -- Solve old meta, using substitution. patternViolation _ -> __IMPOSSIBLE__ -} type FVs = Set.VarSet type SubstCand = [(Nat,Term)] -- ^ a possibly non-deterministic substitution -- | Turn non-det substitution into proper substitution, if possible. -- Otherwise, raise the error. checkLinearity :: SubstCand -> ExceptT () TCM SubstCand checkLinearity ids0 = do let ids = sortBy (compare `on` fst) ids0 -- see issue 920 let grps = groupOn fst ids concat <$> mapM makeLinear grps where -- | Non-determinism can be healed if type is singleton. [Issue 593] -- (Same as for irrelevance.) makeLinear :: SubstCand -> ExceptT () TCM SubstCand makeLinear [] = __IMPOSSIBLE__ makeLinear grp@[_] = return grp makeLinear (p@(i,t) : _) = ifM ((Right True ==) <$> do isSingletonTypeModuloRelevance =<< typeOfBV i) (return [p]) (throwError ()) -- Intermediate result in the following function type Res = [(I.Arg Nat, Term)] -- | Exceptions raised when substitution cannot be inverted. data InvertExcept = CantInvert -- ^ Cannot recover. | NeutralArg -- ^ A potentially neutral arg: can't invert, but can try pruning. | ProjectedVar Int [QName] -- ^ Try to eta-expand var to remove projs. #if !MIN_VERSION_transformers(0,4,1) instance Error InvertExcept where noMsg = CantInvert #endif -- | Check that arguments @args@ to a metavar are in pattern fragment. -- Assumes all arguments already in whnf and eta-reduced. -- Parameters are represented as @Var@s so @checkArgs@ really -- checks that all args are @Var@s and returns the "substitution" -- to be applied to the rhs of the equation to solve. -- (If @args@ is considered a substitution, its inverse is returned.) -- -- The returned list might not be ordered. -- Linearity, i.e., whether the substitution is deterministic, -- has to be checked separately. -- inverseSubst :: Args -> ExceptT InvertExcept TCM SubstCand inverseSubst args = map (mapFst unArg) <$> loop (zip args terms) where loop = foldM isVarOrIrrelevant [] terms = map var (downFrom (size args)) failure = do lift $ reportSDoc "tc.meta.assign" 15 $ vcat [ text "not all arguments are variables: " <+> prettyTCM args , text " aborting assignment" ] throwError CantInvert neutralArg = throwError NeutralArg isVarOrIrrelevant :: Res -> (I.Arg Term, Term) -> ExceptT InvertExcept TCM Res isVarOrIrrelevant vars (arg, t) = case ignoreSharing <$> arg of -- i := x Arg info (Var i []) -> return $ (Arg info i, t) `cons` vars -- π i := x try to eta-expand projection π away! Arg _ (Var i es) | Just qs <- mapM isProjElim es -> throwError $ ProjectedVar i qs -- (i, j) := x becomes [i := fst x, j := snd x] -- Andreas, 2013-09-17 but only if constructor is fully applied Arg info (Con c vs) -> do let fallback | irrelevantOrUnused (getRelevance info) = return vars | otherwise = failure isRC <- lift $ isRecordConstructor $ conName c case isRC of Just (_, Record{ recFields = fs }) | length fs == length vs -> do let aux (Arg _ v) (Arg info' f) = (Arg ai v,) $ t `applyE` [Proj f] where ai = ArgInfo { argInfoColors = argInfoColors info -- TODO guilhem , argInfoHiding = min (getHiding info) (getHiding info') , argInfoRelevance = max (getRelevance info) (getRelevance info') } res <- loop $ zipWith aux vs fs return $ res `append` vars | otherwise -> fallback Just _ -> __IMPOSSIBLE__ Nothing -> fallback -- An irrelevant argument which is not an irrefutable pattern is dropped Arg info _ | irrelevantOrUnused (getRelevance info) -> return vars -- Andreas, 2013-10-29 -- An irrelevant part can also be marked by a DontCare -- (coming from an irrelevant projection), see Issue 927: Arg _ DontCare{} -> return vars -- Distinguish args that can be eliminated (Con,Lit,Lam,unsure) ==> failure -- from those that can only put somewhere as a whole ==> neutralArg Arg _ Var{} -> neutralArg Arg _ Def{} -> neutralArg -- Note that this Def{} is in normal form and might be prunable. Arg _ Lam{} -> failure Arg _ Lit{} -> failure Arg _ MetaV{} -> failure Arg _ Pi{} -> neutralArg Arg _ Sort{} -> neutralArg Arg _ Level{} -> neutralArg Arg _ ExtLam{} -> __IMPOSSIBLE__ Arg info (Shared p) -> isVarOrIrrelevant vars (Arg info $ derefPtr p, t) -- managing an assoc list where duplicate indizes cannot be irrelevant vars append :: Res -> Res -> Res append res vars = foldr cons vars res -- adding an irrelevant entry only if not present cons :: (I.Arg Nat, Term) -> Res -> Res cons a@(Arg (ArgInfo _ Irrelevant _) i, t) vars -- TODO? UnusedArg?! | any ((i==) . unArg . fst) vars = vars | otherwise = a : vars -- adding a relevant entry: cons a@(Arg info i, t) vars = a : -- filter out duplicate irrelevants filter (not . (\ a@(Arg info j, t) -> isIrrelevant info && i == j)) vars -- | Used in 'Agda.Interaction.BasicOps.giveExpr'. updateMeta :: MetaId -> Term -> TCM () updateMeta mI v = do mv <- lookupMeta mI withMetaInfo' mv $ do args <- getContextArgs noConstraints $ assignV DirEq mI args v -- | Returns every meta-variable occurrence in the given type, except -- for those in 'Sort's. allMetas :: TermLike a => a -> [MetaId] allMetas = foldTerm metas where metas (MetaV m _) = [m] metas _ = [] Agda-2.4.2.5/src/full/Agda/TypeChecking/Pretty.hs0000644000000000000000000003456212635075266017517 0ustar0000000000000000{-# LANGUAGE CPP #-} {-# LANGUAGE FlexibleContexts #-} {-# LANGUAGE FlexibleInstances #-} {-# LANGUAGE TupleSections #-} {-# LANGUAGE UndecidableInstances #-} module Agda.TypeChecking.Pretty where import Prelude hiding (null) import Control.Applicative hiding (empty) import qualified Data.Map as Map import Data.Maybe import Agda.Syntax.Position import Agda.Syntax.Common hiding (Arg, Dom, NamedArg, ArgInfo) import qualified Agda.Syntax.Common as Common import Agda.Syntax.Internal import Agda.Syntax.Literal import Agda.Syntax.Translation.InternalToAbstract import Agda.Syntax.Translation.AbstractToConcrete import qualified Agda.Syntax.Abstract as A import qualified Agda.Syntax.Concrete as C import qualified Agda.Syntax.Abstract.Pretty as AP import qualified Agda.Syntax.Concrete.Pretty as CP import Agda.TypeChecking.Monad import Agda.TypeChecking.Positivity.Occurrence import Agda.Utils.Graph.AdjacencyMap.Unidirectional (Graph) import qualified Agda.Utils.Graph.AdjacencyMap.Unidirectional as Graph import Agda.Utils.Maybe import Agda.Utils.Null import Agda.Utils.Permutation (Permutation) import qualified Agda.Utils.Pretty as P #include "undefined.h" import Agda.Utils.Impossible --------------------------------------------------------------------------- -- * Wrappers for pretty printing combinators --------------------------------------------------------------------------- type Doc = P.Doc comma, colon, equals :: TCM Doc comma = return P.comma colon = return P.colon equals = return P.equals pretty :: P.Pretty a => a -> TCM Doc pretty x = return $ P.pretty x prettyA :: (P.Pretty c, ToConcrete a c) => a -> TCM Doc prettyA x = AP.prettyA x prettyAs :: (P.Pretty c, ToConcrete a [c]) => a -> TCM Doc prettyAs x = AP.prettyAs x text :: String -> TCM Doc text s = return $ P.text s pwords :: String -> [TCM Doc] pwords s = map return $ P.pwords s fwords :: String -> TCM Doc fwords s = return $ P.fwords s sep, fsep, hsep, hcat, vcat :: [TCM Doc] -> TCM Doc sep ds = P.sep <$> sequence ds fsep ds = P.fsep <$> sequence ds hsep ds = P.hsep <$> sequence ds hcat ds = P.hcat <$> sequence ds vcat ds = P.vcat <$> sequence ds ($$), ($+$), (<>), (<+>) :: TCM Doc -> TCM Doc -> TCM Doc d1 $$ d2 = (P.$$) <$> d1 <*> d2 d1 $+$ d2 = (P.$+$) <$> d1 <*> d2 d1 <> d2 = (P.<>) <$> d1 <*> d2 d1 <+> d2 = (P.<+>) <$> d1 <*> d2 nest :: Int -> TCM Doc -> TCM Doc nest n d = P.nest n <$> d braces, dbraces, brackets, parens :: TCM Doc -> TCM Doc braces d = P.braces <$> d dbraces d = CP.dbraces <$> d brackets d = P.brackets <$> d parens d = P.parens <$> d -- | Comma-separated list in brackets. prettyList :: [TCM Doc] -> TCM Doc prettyList ds = brackets $ fsep $ punctuate comma ds -- | 'prettyList' without the brackets. prettyList_ :: [TCM Doc] -> TCM Doc prettyList_ ds = fsep $ punctuate comma ds punctuate :: TCM Doc -> [TCM Doc] -> [TCM Doc] punctuate _ [] = [] punctuate d ds = zipWith (<>) ds (replicate n d ++ [empty]) where n = length ds - 1 --------------------------------------------------------------------------- -- * The PrettyTCM class --------------------------------------------------------------------------- class PrettyTCM a where prettyTCM :: a -> TCM Doc instance PrettyTCM Bool where prettyTCM = pretty instance PrettyTCM C.Name where prettyTCM = pretty instance PrettyTCM C.QName where prettyTCM = pretty instance PrettyTCM Comparison where prettyTCM = pretty instance PrettyTCM Literal where prettyTCM = pretty instance PrettyTCM Nat where prettyTCM = pretty instance PrettyTCM ProblemId where prettyTCM = pretty instance PrettyTCM Range where prettyTCM = pretty -- instance PrettyTCM Interval where prettyTCM = pretty -- instance PrettyTCM Position where prettyTCM = pretty instance PrettyTCM a => PrettyTCM (Closure a) where prettyTCM cl = enterClosure cl prettyTCM instance PrettyTCM a => PrettyTCM [a] where prettyTCM = prettyList . map prettyTCM instance (PrettyTCM a, PrettyTCM b) => PrettyTCM (a,b) where prettyTCM (a, b) = parens $ prettyTCM a <> comma <> prettyTCM b instance (PrettyTCM a, PrettyTCM b, PrettyTCM c) => PrettyTCM (a,b,c) where prettyTCM (a, b, c) = parens $ prettyTCM a <> comma <> prettyTCM b <> comma <> prettyTCM c instance PrettyTCM Term where prettyTCM x = prettyA =<< reify x instance PrettyTCM Type where prettyTCM x = prettyA =<< reify x instance PrettyTCM Sort where prettyTCM x = prettyA =<< reify x instance PrettyTCM DisplayTerm where prettyTCM x = prettyA =<< reify x instance PrettyTCM NamedClause where prettyTCM x = prettyA =<< reify x instance PrettyTCM Level where prettyTCM x = prettyA =<< reify (Level x) instance PrettyTCM Permutation where prettyTCM = text . show instance PrettyTCM Polarity where prettyTCM = text . show instance PrettyTCM Clause where prettyTCM cl = do x <- qualify_ <$> freshName_ "" prettyTCM (QNamed x cl) instance PrettyTCM ClauseBody where prettyTCM b = do (binds, body) <- walk b sep [ brackets (fsep binds), return body ] where walk NoBody = return ([], P.text "()") walk (Body v) = ([],) <$> prettyTCM v walk (Bind b) = do (bs, v) <- underAbstraction_ b walk return (text (argNameToString $ absName b) : bs, v) instance PrettyTCM a => PrettyTCM (Judgement a) where prettyTCM (HasType a t) = prettyTCM a <+> text ":" <+> prettyTCM t prettyTCM (IsSort a t) = text "Sort" <+> prettyTCM a <+> text ":" <+> prettyTCM t instance PrettyTCM MetaId where prettyTCM x = do mn <- getMetaNameSuggestion x pretty $ NamedMeta mn x instance PrettyTCM a => PrettyTCM (Blocked a) where prettyTCM (Blocked x a) = text "[" <+> prettyTCM a <+> text "]" <> text (show x) prettyTCM (NotBlocked _ x) = prettyTCM x instance (Reify a e, ToConcrete e c, P.Pretty c) => PrettyTCM (Named_ a) where prettyTCM x = prettyA =<< reify x instance (Reify a e, ToConcrete e c, P.Pretty c) => PrettyTCM (Arg a) where prettyTCM x = prettyA =<< reify x instance (Reify a e, ToConcrete e c, P.Pretty c) => PrettyTCM (Dom a) where prettyTCM x = prettyA =<< reify x -- instance (Reify a e, ToConcrete e c, P.Pretty c, PrettyTCM a) => PrettyTCM (Elim' a) where instance PrettyTCM Elim where prettyTCM (Apply v) = text "$" <+> prettyTCM v prettyTCM (Proj f) = text "." <> prettyTCM f instance PrettyTCM a => PrettyTCM (MaybeReduced a) where prettyTCM = prettyTCM . ignoreReduced instance PrettyTCM A.Expr where prettyTCM = prettyA instance PrettyTCM Relevance where prettyTCM Irrelevant = text "." prettyTCM NonStrict = text ".." prettyTCM Relevant = empty prettyTCM Forced{} = empty prettyTCM UnusedArg = empty instance PrettyTCM ProblemConstraint where prettyTCM (PConstr pid c) = brackets (prettyTCM pid) <+> prettyTCM c instance PrettyTCM Constraint where prettyTCM c = case c of ValueCmp cmp ty s t -> sep [ sep [ prettyTCM s , prettyTCM cmp <+> prettyTCM t ] , nest 2 $ text ":" <+> prettyTCM ty ] ElimCmp cmps t v us vs -> sep [ sep [ prettyTCM us , nest 2 $ text "~~" <+> prettyTCM vs ] , text ":" <+> prettyTCM t ] LevelCmp cmp a b -> sep [ prettyTCM a , prettyTCM cmp <+> prettyTCM b ] TypeCmp cmp a b -> sep [ prettyTCM a , prettyTCM cmp <+> prettyTCM b ] TelCmp a b cmp tela telb -> sep [ prettyTCM tela , prettyTCM cmp <+> prettyTCM telb ] SortCmp cmp s1 s2 -> sep [ prettyTCM s1 , prettyTCM cmp <+> prettyTCM s2 ] Guarded c pid -> sep [ prettyTCM c , nest 2 $ brackets $ text "blocked on problem" <+> prettyTCM pid ] UnBlock m -> do -- BlockedConst t <- mvInstantiation <$> lookupMeta m mi <- mvInstantiation <$> lookupMeta m case mi of BlockedConst t -> sep [ pretty m <+> text ":=" , nest 2 $ prettyTCM t ] PostponedTypeCheckingProblem cl _ -> enterClosure cl $ \p -> sep [ pretty m <+> text ":=" , nest 2 $ prettyTCM p ] Open{} -> __IMPOSSIBLE__ OpenIFS{} -> __IMPOSSIBLE__ InstS{} -> __IMPOSSIBLE__ InstV{} -> __IMPOSSIBLE__ FindInScope m Nothing -> do t <- getMetaType m sep [ text "Find in scope" <+> pretty m <+> text ":" , prettyTCM t , text " (no candidate for now)" ] FindInScope m (Just cands) -> do t <- getMetaType m sep [ text "Find in scope" <+> pretty m <+> text ":" , nest 2 $ prettyTCM t , sep $ flip map cands $ \(t,ty) -> prettyTCM t <+> text ": " <+> prettyTCM ty ] IsEmpty r t -> sep [ text "Is empty:", nest 2 $ prettyTCM t ] CheckSizeLtSat t -> sep [ text "Is not empty type of sizes:", nest 2 $ prettyTCM t ] instance PrettyTCM TypeCheckingProblem where prettyTCM (CheckExpr e a) = sep [ prettyA e <+> text ":?", prettyTCM a ] prettyTCM (CheckArgs _ _ _ es t0 t1 _) = sep [ parens $ text "_ :" <+> prettyTCM t0 , nest 2 $ prettyList $ map prettyA es , nest 2 $ text ":?" <+> prettyTCM t1 ] prettyTCM (CheckLambda (Common.Arg ai (xs, mt)) e t) = sep [ return CP.lambda <+> (CP.prettyRelevance ai . CP.prettyHiding ai (if isNothing mt && length xs == 1 then id else P.parens) <$> do fsep $ map prettyTCM xs ++ caseMaybe mt [] (\ a -> [text ":", prettyTCM a])) <+> return CP.arrow <+> prettyTCM e <+> text ":?" , prettyTCM t ] instance PrettyTCM a => PrettyTCM (WithHiding a) where prettyTCM (WithHiding h a) = CP.prettyHiding h id <$> prettyTCM a instance PrettyTCM Name where prettyTCM x = P.pretty <$> abstractToConcrete_ x instance PrettyTCM QName where prettyTCM x = P.pretty <$> abstractToConcrete_ x instance PrettyTCM ModuleName where prettyTCM x = P.pretty <$> abstractToConcrete_ x instance PrettyTCM ConHead where prettyTCM = prettyTCM . conName instance PrettyTCM Telescope where prettyTCM tel = P.fsep . map P.pretty <$> (do tel <- reify tel runAbsToCon $ bindToConcrete tel (return . concat) ) newtype PrettyContext = PrettyContext Context instance PrettyTCM PrettyContext where prettyTCM (PrettyContext ctx) = P.fsep . reverse <$> pr (map ctxEntry ctx) where pr :: [Dom (Name, Type)] -> TCM [P.Doc] pr [] = return [] pr (Common.Dom info (x,t) : ctx) = escapeContext 1 $ do -- TODO guilhem: show colors d <- CP.prettyRelevance info . CP.prettyHiding info P.parens <$> do prettyTCM x <+> text ":" <+> prettyTCM t (d :) <$> pr ctx instance PrettyTCM Context where prettyTCM = prettyTCM . PrettyContext instance PrettyTCM Pattern where prettyTCM = showPat' (text . patVarNameToString) instance PrettyTCM DeBruijnPattern where prettyTCM = showPat' $ \ (i, x) -> text $ patVarNameToString x ++ "@" ++ show i -- | Show a pattern, given a method how to show pattern variables. showPat' :: (a -> TCM Doc) -> Pattern' a -> TCM Doc showPat' showVar = showPat where showPat (VarP x) = showVar x showPat (DotP t) = text $ ".(" ++ P.prettyShow t ++ ")" showPat (ConP c i ps) = (if b then braces else parens) $ prTy $ prettyTCM c <+> fsep (map (showPat . namedArg) ps) where b = maybe False (== ConPImplicit) $ conPRecord i prTy d = caseMaybe (conPType i) d $ \ t -> d <+> text ":" <+> prettyTCM t showPat (LitP l) = text (show l) showPat (ProjP q) = text (show q) instance PrettyTCM (Elim' DisplayTerm) where prettyTCM (Apply v) = text "$" <+> prettyTCM (unArg v) prettyTCM (Proj f) = text "." <> prettyTCM f raisePatVars :: Int -> NLPat -> NLPat raisePatVars k (PVar x) = PVar (k+x) raisePatVars k (PWild) = PWild raisePatVars k (PDef f es) = PDef f $ (fmap . fmap) (raisePatVars k) es raisePatVars k (PLam i u) = PLam i $ fmap (raisePatVars k) u raisePatVars k (PPi a b) = PPi ((fmap . fmap) (raisePatVars k) a) ((fmap . fmap) (raisePatVars k) b) raisePatVars k (PBoundVar i es) = PBoundVar k $ (fmap . fmap) (raisePatVars k) es raisePatVars k (PTerm t) = PTerm t instance PrettyTCM NLPat where prettyTCM (PVar x) = prettyTCM (var x) prettyTCM (PWild) = text $ "_" prettyTCM (PDef f es) = parens $ prettyTCM f <+> fsep (map prettyTCM es) prettyTCM (PLam i u) = text "λ" <+> (addContext (absName u) $ prettyTCM (raisePatVars 1 $ unAbs u)) prettyTCM (PPi a b) = text "Π" <+> prettyTCM (Common.unDom a) <+> (addContext (absName b) $ prettyTCM (fmap (raisePatVars 1) $ unAbs b)) prettyTCM (PBoundVar i es) = parens $ prettyTCM (var i) <+> fsep (map prettyTCM es) prettyTCM (PTerm t) = text "." <> parens (prettyTCM t) instance PrettyTCM (Elim' NLPat) where prettyTCM (Apply v) = text "$" <+> prettyTCM (unArg v) prettyTCM (Proj f) = text "." <> prettyTCM f instance PrettyTCM (Type' NLPat) where prettyTCM = prettyTCM . unEl instance PrettyTCM RewriteRule where prettyTCM (RewriteRule q gamma lhs rhs b) = inTopContext $ do prettyTCM q <+> text " rule " <+> do prettyTCM gamma <+> text " |- " <+> do addContext gamma $ do prettyTCM lhs <+> text " --> " <+> do prettyTCM rhs <+> text " : " <+> do prettyTCM b instance PrettyTCM Occurrence where prettyTCM GuardPos = text "-[g+]->" prettyTCM StrictPos = text "-[++]->" prettyTCM JustPos = text "-[+]->" prettyTCM JustNeg = text "-[-]->" prettyTCM Mixed = text "-[*]->" prettyTCM Unused = text "-[ ]->" -- | Pairing something with a node (for printing only). data WithNode n a = WithNode n a instance PrettyTCM n => PrettyTCM (WithNode n Occurrence) where prettyTCM (WithNode n o) = prettyTCM o <+> prettyTCM n instance (PrettyTCM n, PrettyTCM (WithNode n e)) => PrettyTCM (Graph n n e) where prettyTCM g = vcat $ map pr $ Map.assocs $ Graph.graph g where pr (n, es) = sep [ prettyTCM n , nest 2 $ vcat $ map (prettyTCM . uncurry WithNode) $ Map.assocs es ] Agda-2.4.2.5/src/full/Agda/TypeChecking/InstanceArguments.hs-boot0000644000000000000000000000026712635075266022616 0ustar0000000000000000 module Agda.TypeChecking.InstanceArguments where import Agda.TypeChecking.Monad.Base (TCM) import Agda.Syntax.Internal (Type, Term) initializeIFSMeta :: String -> Type -> TCM Term Agda-2.4.2.5/src/full/Agda/TypeChecking/Datatypes.hs-boot0000644000000000000000000000037112635075266021116 0ustar0000000000000000 module Agda.TypeChecking.Datatypes where import Agda.TypeChecking.Monad.Base import Agda.TypeChecking.Monad.Signature import Agda.Syntax.Internal getConHead :: QName -> TCM ConHead getConstructorData :: HasConstInfo m => QName -> m QName Agda-2.4.2.5/src/full/Agda/TypeChecking/Tests.hs0000644000000000000000000000750112635075266017323 0ustar0000000000000000{-# LANGUAGE CPP #-} module Agda.TypeChecking.Tests where import qualified Agda.Utils.VarSet as Set import Agda.Utils.QuickCheck import Agda.Syntax.Internal import Agda.TypeChecking.Test.Generators import Agda.TypeChecking.Telescope import Agda.TypeChecking.Substitute import Agda.Utils.Size import Agda.Utils.Permutation import Agda.Utils.TestHelpers #include "undefined.h" import Agda.Utils.Impossible --------------------------------------------------------------------------- -- * Tests for "Agda.Utils.Permutation" --------------------------------------------------------------------------- --------------------------------------------------------------------------- -- * Tests for "Agda.TypeChecking.Telescope" --------------------------------------------------------------------------- -- | @telFromList . telToList == id@ prop_telToListInv :: TermConfiguration -> Property prop_telToListInv conf = forAll (genC conf) $ \tel -> telFromList (telToList tel) == tel -- | All elements of 'flattenTel' are well-scoped under the original telescope. prop_flattenTelScope :: TermConfiguration -> Property prop_flattenTelScope conf = forAll (genC conf) $ \tel -> all (isWellScoped $ extendWithTelConf tel conf) (flattenTel tel) -- | @unflattenTel . flattenTel == id@ prop_flattenTelInv :: TermConfiguration -> Property prop_flattenTelInv conf = forAll (genC conf) $ \tel -> unflattenTel (teleNames tel) (flattenTel tel) == tel -- | 'reorderTel' is stable. prop_reorderTelStable :: TermConfiguration -> Property prop_reorderTelStable conf = forAll (genC conf) $ \tel -> reorderTel (flattenTel tel) == Just (idP (size tel)) -- | The result of splitting a telescope is well-scoped. prop_splitTelescopeScope :: TermConfiguration -> Property prop_splitTelescopeScope conf = forAll (genC conf) $ \tel -> forAll (listOfElements [0..size tel - 1]) $ \vs -> let SplitTel tel1 tel2 perm = splitTelescope (Set.fromList vs) tel tel' = telFromList (telToList tel1 ++ telToList tel2) in isWellScoped conf tel' -- | The permutation generated when splitting a telescope preserves scoping. prop_splitTelescopePermScope :: TermConfiguration -> Property prop_splitTelescopePermScope conf = forAllShrink (genC conf) (shrinkC conf) $ \tel -> forAllShrink (listOfElements [0..size tel - 1]) shrink $ \vs -> let SplitTel tel1 tel2 perm = splitTelescope (Set.fromList vs) tel conf1 = extendWithTelConf tel1 conf conf2 = conf1 { tcFreeVariables = map (size tel2 +) (tcFreeVariables conf1) } conf' = conf { tcFreeVariables = map (size tel +) (tcFreeVariables conf) ++ vs } in forAllShrink (genC conf') (shrinkC conf') $ \t -> isWellScoped conf2 (applySubst (renamingR $ invertP __IMPOSSIBLE__ perm) (t :: Term)) {- -- | The permutation generated when splitting a telescope correctly translates -- between the old and the new telescope. prop_splitTelescopePermInv :: TermConfiguration -> Property prop_splitTelescopePermInv conf = forAll (wellScopedTel conf) $ \tel -> forAll (listOfElements [0..size tel - 1]) $ \vs -> let SplitTel tel1 tel2 perm = splitTelescope (Set.fromList vs) tel tel' = telFromList (telToList tel1 ++ telToList tel2) conf1 = extendWithTelConf tel conf conf2 = extendWithTelConf tel' conf in forAll (wellScopedTerm conf1) $ \t1 -> forAll (wellScopedTerm conf2) $ \t2 -> let t1' = rename (invertP __IMPOSSIBLE__ perm) $ rename perm t1 t2' = rename perm $ rename (invertP __IMPOSSIBLE__ perm) t2 in t1 == t1' && t2 == t2' -} tests :: IO Bool tests = runTests "Agda.TypeChecking.Tests" [ quickCheck' prop_telToListInv , quickCheck' prop_flattenTelScope , quickCheck' prop_flattenTelInv , quickCheck' prop_reorderTelStable , quickCheck' prop_splitTelescopeScope , quickCheck' prop_splitTelescopePermScope ] Agda-2.4.2.5/src/full/Agda/TypeChecking/Implicit.hs0000644000000000000000000000715212635075266017775 0ustar0000000000000000{-# LANGUAGE CPP #-} {-# LANGUAGE PatternGuards #-} {-| Functions for inserting implicit arguments at the right places. -} module Agda.TypeChecking.Implicit where import Control.Applicative import Control.Monad import Agda.Syntax.Common import Agda.Syntax.Internal as I import qualified Agda.Syntax.Abstract as A (NamedArg) import Agda.TypeChecking.Irrelevance import {-# SOURCE #-} Agda.TypeChecking.MetaVars import Agda.TypeChecking.Monad import Agda.TypeChecking.Reduce import Agda.TypeChecking.Substitute import {-# SOURCE #-} Agda.TypeChecking.InstanceArguments import Agda.TypeChecking.Pretty import Agda.Utils.Tuple #include "undefined.h" import Agda.Utils.Impossible -- | @implicitArgs n expand t@ generates up to @n@ implicit arguments -- metas (unbounded if @n<0@), as long as @t@ is a function type -- and @expand@ holds on the hiding info of its domain. implicitArgs :: Int -> (Hiding -> Bool) -> Type -> TCM (Args, Type) implicitArgs n expand t = mapFst (map (fmap namedThing)) <$> do implicitNamedArgs n (\ h x -> expand h) t -- | @implicitNamedArgs n expand t@ generates up to @n@ named implicit arguments -- metas (unbounded if @n<0@), as long as @t@ is a function type -- and @expand@ holds on the hiding and name info of its domain. implicitNamedArgs :: Int -> (Hiding -> ArgName -> Bool) -> Type -> TCM (NamedArgs, Type) implicitNamedArgs 0 expand t0 = return ([], t0) implicitNamedArgs n expand t0 = do t0' <- reduce t0 case ignoreSharing $ unEl t0' of Pi (Dom info a) b | let x = absName b, expand (getHiding info) x -> do when (getHiding info == Instance) $ reportSDoc "tc.term.args.ifs" 15 $ text "inserting instance meta for type" <+> prettyTCM a v <- applyRelevanceToContext (getRelevance info) $ newMeta (getHiding info) (argNameToString x) a let narg = Arg info (Named (Just $ unranged x) v) mapFst (narg :) <$> implicitNamedArgs (n-1) expand (absApp b v) _ -> return ([], t0') where newMeta Hidden = newNamedValueMeta RunMetaOccursCheck newMeta Instance = initializeIFSMeta newMeta _ = __IMPOSSIBLE__ --------------------------------------------------------------------------- data ImplicitInsertion = ImpInsert [Hiding] -- ^ this many implicits have to be inserted | BadImplicits -- ^ hidden argument where there should have been a non-hidden arg | NoSuchName ArgName -- ^ bad named argument | NoInsertNeeded deriving (Show) impInsert :: [Hiding] -> ImplicitInsertion impInsert [] = NoInsertNeeded impInsert hs = ImpInsert hs -- | The list should be non-empty. insertImplicit :: A.NamedArg e -> [I.Arg ArgName] -> ImplicitInsertion insertImplicit _ [] = __IMPOSSIBLE__ insertImplicit a ts | notHidden a = impInsert $ nofHidden ts where nofHidden :: [I.Arg a] -> [Hiding] nofHidden = takeWhile (NotHidden /=) . map getHiding insertImplicit a ts = case nameOf (unArg a) of Nothing -> maybe BadImplicits impInsert $ upto (getHiding a) $ map getHiding ts Just x -> find [] (rangedThing x) (getHiding a) ts where upto h [] = Nothing upto h (NotHidden:_) = Nothing upto h (h':_) | h == h' = Just [] upto h (h':hs) = (h':) <$> upto h hs find :: [Hiding] -> ArgName -> Hiding -> [I.Arg ArgName] -> ImplicitInsertion find _ x _ (a@(Arg{}) : _) | notHidden a = NoSuchName x find hs x hidingx (a@(Arg _ y) : ts) | x == y && hidingx == getHiding a = impInsert $ reverse hs | x == y && hidingx /= getHiding a = BadImplicits | otherwise = find (getHiding a:hs) x hidingx ts find i x _ [] = NoSuchName x Agda-2.4.2.5/src/full/Agda/TypeChecking/Errors.hs0000644000000000000000000014406512635075266017504 0ustar0000000000000000{-# LANGUAGE CPP #-} {-# LANGUAGE FlexibleInstances #-} {-# LANGUAGE TupleSections #-} {-# OPTIONS_GHC -fno-warn-orphans #-} module Agda.TypeChecking.Errors ( prettyError , tcErrString , Warnings(..) , warningsToError ) where import Prelude hiding (null) import Control.Monad.State import Data.Function import Data.List (nub, sortBy, intercalate) import Data.Maybe import Agda.Syntax.Common hiding (Arg, Dom, NamedArg) import qualified Agda.Syntax.Common as Common import Agda.Syntax.Fixity import Agda.Syntax.Position import qualified Agda.Syntax.Info as A import qualified Agda.Syntax.Concrete as C import qualified Agda.Syntax.Concrete.Definitions as D import Agda.Syntax.Abstract as A import Agda.Syntax.Internal as I import qualified Agda.Syntax.Abstract.Pretty as AP import Agda.Syntax.Translation.InternalToAbstract import Agda.Syntax.Translation.AbstractToConcrete import Agda.Syntax.Scope.Monad (isDatatypeModule) import Agda.TypeChecking.Monad.Base import Agda.TypeChecking.Monad.Closure import Agda.TypeChecking.Monad.Context import Agda.TypeChecking.Monad.Options import Agda.TypeChecking.Monad.Builtin import Agda.TypeChecking.Pretty import Agda.TypeChecking.Reduce (instantiate) import Agda.Utils.Except ( MonadError(catchError) ) import Agda.Utils.FileName import Agda.Utils.Function import Agda.Utils.Monad import Agda.Utils.Null import Agda.Utils.Size import qualified Agda.Utils.Pretty as P #include "undefined.h" import Agda.Utils.Impossible --------------------------------------------------------------------------- -- * Top level function --------------------------------------------------------------------------- {-# SPECIALIZE prettyError :: TCErr -> TCM String #-} prettyError :: MonadTCM tcm => TCErr -> tcm String prettyError err = liftTCM $ show <$> prettyError' err [] where prettyError' :: TCErr -> [TCErr] -> TCM Doc prettyError' err errs | length errs > 3 = fsep ( pwords "total panic: error when printing error from printing error from printing error." ++ pwords "I give up! Approximations of errors (original error last):" ) $$ vcat (map (text . tcErrString) errs) | otherwise = applyUnless (null errs) (text "panic: error when printing error!" $$) $ do (prettyTCM err $$ vcat (map (text . ("when printing error " ++) . tcErrString) errs)) `catchError` \ err' -> prettyError' err' (err:errs) --------------------------------------------------------------------------- -- * Warnings --------------------------------------------------------------------------- -- | Warnings. -- -- Invariant: The fields are never empty at the same time. data Warnings = Warnings { unsolvedMetaVariables :: [Range] -- ^ Meta-variable problems are reported as type errors unless -- 'optAllowUnsolved' is 'True'. , unsolvedConstraints :: Constraints -- ^ Same as 'unsolvedMetaVariables'. } -- | Turns warnings into an error. Even if several errors are possible -- only one is raised. warningsToError :: Warnings -> TCM a warningsToError (Warnings [] []) = typeError $ SolvedButOpenHoles warningsToError (Warnings w@(_:_) _) = typeError $ UnsolvedMetas w warningsToError (Warnings _ w@(_:_)) = typeError $ UnsolvedConstraints w --------------------------------------------------------------------------- -- * Helpers --------------------------------------------------------------------------- sayWhere :: HasRange a => a -> TCM Doc -> TCM Doc sayWhere x d = applyUnless (null r) (prettyTCM r $$) d where r = getRange x sayWhen :: Range -> Maybe (Closure Call) -> TCM Doc -> TCM Doc sayWhen r Nothing m = sayWhere r m sayWhen r (Just cl) m = sayWhere r (m $$ prettyTCM cl) panic :: String -> TCM Doc panic s = fwords $ "Panic: " ++ s nameWithBinding :: QName -> TCM Doc nameWithBinding q = sep [ prettyTCM q, text "bound at", prettyTCM r ] where r = nameBindingSite $ qnameName q tcErrString :: TCErr -> String tcErrString err = show (getRange err) ++ " " ++ case err of TypeError _ cl -> errorString $ clValue cl Exception r s -> show r ++ " " ++ show s IOException r e -> show r ++ " " ++ show e PatternErr{} -> "PatternErr" {- AbortAssign _ -> "AbortAssign" -- UNUSED -} errorString :: TypeError -> String errorString err = case err of AmbiguousModule{} -> "AmbiguousModule" AmbiguousName{} -> "AmbiguousName" AmbiguousParseForApplication{} -> "AmbiguousParseForApplication" AmbiguousParseForLHS{} -> "AmbiguousParseForLHS" -- AmbiguousParseForPatternSynonym{} -> "AmbiguousParseForPatternSynonym" AmbiguousTopLevelModuleName {} -> "AmbiguousTopLevelModuleName" BadArgumentsToPatternSynonym{} -> "BadArgumentsToPatternSynonym" TooFewArgumentsToPatternSynonym{} -> "TooFewArgumentsToPatternSynonym" BothWithAndRHS -> "BothWithAndRHS" BuiltinInParameterisedModule{} -> "BuiltinInParameterisedModule" BuiltinMustBeConstructor{} -> "BuiltinMustBeConstructor" ClashingDefinition{} -> "ClashingDefinition" ClashingFileNamesFor{} -> "ClashingFileNamesFor" ClashingImport{} -> "ClashingImport" ClashingModule{} -> "ClashingModule" ClashingModuleImport{} -> "ClashingModuleImport" CompilationError{} -> "CompilationError" ConstructorPatternInWrongDatatype{} -> "ConstructorPatternInWrongDatatype" CoverageFailure{} -> "CoverageFailure" CoverageCantSplitOn{} -> "CoverageCantSplitOn" CoverageCantSplitIrrelevantType{} -> "CoverageCantSplitIrrelevantType" CoverageCantSplitType{} -> "CoverageCantSplitType" CyclicModuleDependency{} -> "CyclicModuleDependency" DataMustEndInSort{} -> "DataMustEndInSort" -- UNUSED: DataTooManyParameters{} -> "DataTooManyParameters" CantResolveOverloadedConstructorsTargetingSameDatatype{} -> "CantResolveOverloadedConstructorsTargetingSameDatatype" DifferentArities -> "DifferentArities" DoesNotConstructAnElementOf{} -> "DoesNotConstructAnElementOf" DuplicateBuiltinBinding{} -> "DuplicateBuiltinBinding" DuplicateConstructors{} -> "DuplicateConstructors" DuplicateFields{} -> "DuplicateFields" DuplicateImports{} -> "DuplicateImports" FieldOutsideRecord -> "FieldOutsideRecord" FileNotFound{} -> "FileNotFound" GenericError{} -> "GenericError" GenericDocError{} -> "GenericDocError" IFSNoCandidateInScope{} -> "IFSNoCandidateInScope" IlltypedPattern{} -> "IlltypedPattern" IllformedProjectionPattern{} -> "IllformedProjectionPattern" CannotEliminateWithPattern{} -> "CannotEliminateWithPattern" IllegalLetInTelescope{} -> "IllegalLetInTelescope" IncompletePatternMatching{} -> "IncompletePatternMatching" IndexVariablesNotDistinct{} -> "IndexVariablesNotDistinct" IndicesFreeInParameters{} -> "IndicesFreeInParameters" IndicesNotConstructorApplications{} -> "IndicesNotConstructorApplications" InternalError{} -> "InternalError" InvalidPattern{} -> "InvalidPattern" LocalVsImportedModuleClash{} -> "LocalVsImportedModuleClash" MetaCannotDependOn{} -> "MetaCannotDependOn" MetaOccursInItself{} -> "MetaOccursInItself" ModuleArityMismatch{} -> "ModuleArityMismatch" ModuleDefinedInOtherFile {} -> "ModuleDefinedInOtherFile" ModuleDoesntExport{} -> "ModuleDoesntExport" ModuleNameDoesntMatchFileName {} -> "ModuleNameDoesntMatchFileName" NeedOptionCopatterns{} -> "NeedOptionCopatterns" NeedOptionRewriting{} -> "NeedOptionRewriting" NoBindingForBuiltin{} -> "NoBindingForBuiltin" NoParseForApplication{} -> "NoParseForApplication" NoParseForLHS{} -> "NoParseForLHS" -- NoParseForPatternSynonym{} -> "NoParseForPatternSynonym" NoRHSRequiresAbsurdPattern{} -> "NoRHSRequiresAbsurdPattern" NotInductive {} -> "NotInductive" AbsurdPatternRequiresNoRHS{} -> "AbsurdPatternRequiresNoRHS" NoSuchBuiltinName{} -> "NoSuchBuiltinName" NoSuchModule{} -> "NoSuchModule" NoSuchPrimitiveFunction{} -> "NoSuchPrimitiveFunction" NotAModuleExpr{} -> "NotAModuleExpr" NotAProperTerm -> "NotAProperTerm" SetOmegaNotValidType{} -> "SetOmegaNotValidType" InvalidType{} -> "InvalidType" InvalidTypeSort{} -> "InvalidTypeSort" FunctionTypeInSizeUniv{} -> "FunctionTypeInSizeUniv" NotAValidLetBinding{} -> "NotAValidLetBinding" NotAnExpression{} -> "NotAnExpression" NotImplemented{} -> "NotImplemented" NotSupported{} -> "NotSupported" NotInScope{} -> "NotInScope" NotLeqSort{} -> "NotLeqSort" NotStrictlyPositive{} -> "NotStrictlyPositive" NothingAppliedToHiddenArg{} -> "NothingAppliedToHiddenArg" NothingAppliedToInstanceArg{} -> "NothingAppliedToInstanceArg" OverlappingProjects {} -> "OverlappingProjects" PatternShadowsConstructor {} -> "PatternShadowsConstructor" PropMustBeSingleton -> "PropMustBeSingleton" RepeatedVariablesInPattern{} -> "RepeatedVariablesInPattern" SafeFlagPostulate{} -> "SafeFlagPostulate" SafeFlagPragma{} -> "SafeFlagPragma" SafeFlagNoTerminationCheck{} -> "SafeFlagNoTerminationCheck" SafeFlagNonTerminating{} -> "SafeFlagNonTerminating" SafeFlagTerminating{} -> "SafeFlagTerminating" SafeFlagPrimTrustMe{} -> "SafeFlagPrimTrustMe" ShadowedModule{} -> "ShadowedModule" ShouldBeASort{} -> "ShouldBeASort" ShouldBeApplicationOf{} -> "ShouldBeApplicationOf" ShouldBeAppliedToTheDatatypeParameters{} -> "ShouldBeAppliedToTheDatatypeParameters" ShouldBeEmpty{} -> "ShouldBeEmpty" ShouldBePi{} -> "ShouldBePi" ShouldBeRecordType{} -> "ShouldBeRecordType" ShouldBeRecordPattern{} -> "ShouldBeRecordPattern" NotAProjectionPattern{} -> "NotAProjectionPattern" ShouldEndInApplicationOfTheDatatype{} -> "ShouldEndInApplicationOfTheDatatype" SplitError{} -> "SplitError" TerminationCheckFailed{} -> "TerminationCheckFailed" TooFewFields{} -> "TooFewFields" TooManyArgumentsInLHS{} -> "TooManyArgumentsInLHS" TooManyFields{} -> "TooManyFields" SplitOnIrrelevant{} -> "SplitOnIrrelevant" DefinitionIsIrrelevant{} -> "DefinitionIsIrrelevant" VariableIsIrrelevant{} -> "VariableIsIrrelevant" UnequalBecauseOfUniverseConflict{} -> "UnequalBecauseOfUniverseConflict" UnequalRelevance{} -> "UnequalRelevance" UnequalHiding{} -> "UnequalHiding" -- UnequalLevel{} -> "UnequalLevel" -- UNUSED UnequalSorts{} -> "UnequalSorts" UnequalTerms{} -> "UnequalTerms" UnequalTypes{} -> "UnequalTypes" -- UnequalTelescopes{} -> "UnequalTelescopes" -- UNUSED UnequalColors{} -> "UnequalTelescopes" HeterogeneousEquality{} -> "HeterogeneousEquality" WithOnFreeVariable{} -> "WithOnFreeVariable" UnexpectedWithPatterns{} -> "UnexpectedWithPatterns" UninstantiatedDotPattern{} -> "UninstantiatedDotPattern" UninstantiatedModule{} -> "UninstantiatedModule" UnreachableClauses{} -> "UnreachableClauses" UnsolvedConstraints{} -> "UnsolvedConstraints" UnsolvedMetas{} -> "UnsolvedMetas" SolvedButOpenHoles{} -> "SolvedButOpenHoles" UnusedVariableInPatternSynonym -> "UnusedVariableInPatternSynonym" UnquoteFailed{} -> "UnquoteFailed" WithClausePatternMismatch{} -> "WithClausePatternMismatch" WithoutKError{} -> "WithoutKError" WrongHidingInApplication{} -> "WrongHidingInApplication" WrongHidingInLHS{} -> "WrongHidingInLHS" WrongHidingInLambda{} -> "WrongHidingInLambda" WrongIrrelevanceInLambda{} -> "WrongIrrelevanceInLambda" WrongNamedArgument{} -> "WrongNamedArgument" WrongNumberOfConstructorArguments{} -> "WrongNumberOfConstructorArguments" HidingMismatch{} -> "HidingMismatch" RelevanceMismatch{} -> "RelevanceMismatch" ColorMismatch{} -> "ColorMismatch" instance PrettyTCM TCErr where prettyTCM err = case err of -- Andreas, 2014-03-23 -- This use of localState seems ok since we do not collect -- Benchmark info during printing errors. TypeError s e -> localState $ do put s sayWhen (envRange $ clEnv e) (envCall $ clEnv e) $ prettyTCM e Exception r s -> sayWhere r $ return s IOException r e -> sayWhere r $ fwords $ show e PatternErr{} -> sayWhere err $ panic "uncaught pattern violation" {- AbortAssign _ -> sayWhere err $ panic "uncaught aborted assignment" -- UNUSED -} instance PrettyTCM CallInfo where prettyTCM c = do let call = prettyTCM $ callInfoCall c r = callInfoRange c if null $ P.pretty r then call else call $$ nest 2 (text "(at" <+> prettyTCM r <> text ")") -- | Drops the filename component of the qualified name. dropTopLevelModule :: QName -> QName dropTopLevelModule (QName (MName ns) n) = QName (MName (drop 1 ns)) n instance PrettyTCM TypeError where prettyTCM err = case err of InternalError s -> panic s NotImplemented s -> fwords $ "Not implemented: " ++ s NotSupported s -> fwords $ "Not supported: " ++ s CompilationError s -> sep [fwords "Compilation error:", text s] GenericError s -> fwords s GenericDocError d -> return d TerminationCheckFailed because -> fwords "Termination checking failed for the following functions:" $$ (nest 2 $ fsep $ punctuate comma $ map (pretty . dropTopLevelModule) $ concatMap termErrFunctions because) $$ fwords "Problematic calls:" $$ (nest 2 $ fmap (P.vcat . nub) $ mapM prettyTCM $ sortBy (compare `on` callInfoRange) $ concatMap termErrCalls because) PropMustBeSingleton -> fwords "Datatypes in Prop must have at most one constructor when proof irrelevance is enabled" DataMustEndInSort t -> fsep $ pwords "The type of a datatype must end in a sort." ++ [prettyTCM t] ++ pwords "isn't a sort." {- UNUSED: DataTooManyParameters -> fsep $ pwords "Too many parameters given to data type." -} ShouldEndInApplicationOfTheDatatype t -> fsep $ pwords "The target of a constructor must be the datatype applied to its parameters," ++ [prettyTCM t] ++ pwords "isn't" ShouldBeAppliedToTheDatatypeParameters s t -> fsep $ pwords "The target of the constructor should be" ++ [prettyTCM s] ++ pwords "instead of" ++ [prettyTCM t] ShouldBeApplicationOf t q -> fsep $ pwords "The pattern constructs an element of" ++ [prettyTCM q] ++ pwords "which is not the right datatype" ShouldBeRecordType t -> fsep $ pwords "Expected non-abstract record type, found " ++ [prettyTCM t] ShouldBeRecordPattern p -> fsep $ pwords "Expected record pattern" -- ", found " ++ [prettyTCM p] NotAProjectionPattern p -> fsep $ pwords "Not a valid projection for a copattern: " ++ [ prettyA p ] DifferentArities -> fwords "The number of arguments in the defining equations differ" WrongHidingInLHS -> fwords "Unexpected implicit argument" WrongHidingInLambda t -> fwords "Found an implicit lambda where an explicit lambda was expected" WrongIrrelevanceInLambda t -> fwords "Found an irrelevant lambda where a relevant lambda was expected" WrongNamedArgument a -> fsep $ pwords "Function does not accept argument " ++ [prettyTCM a] -- ++ pwords " (wrong argument name)" WrongHidingInApplication t -> fwords "Found an implicit application where an explicit application was expected" HidingMismatch h h' -> fwords $ "Expected " ++ verbalize (Indefinite h') ++ " argument, but found " ++ verbalize (Indefinite h) ++ " argument" RelevanceMismatch r r' -> fwords $ "Expected " ++ verbalize (Indefinite r') ++ " argument, but found " ++ verbalize (Indefinite r) ++ " argument" ColorMismatch c c' -> fsep $ -- TODO guilhem pwords "Expected argument color to be" ++ [prettyTCM c'] ++ pwords "but found color" ++ [prettyTCM c] NotInductive t -> fsep $ [prettyTCM t] ++ pwords "is not an inductive data type" UninstantiatedDotPattern e -> fsep $ pwords "Failed to infer the value of dotted pattern" IlltypedPattern p a -> fsep $ pwords "Type mismatch" IllformedProjectionPattern p -> fsep $ pwords "Ill-formed projection pattern " ++ [prettyA p] CannotEliminateWithPattern p a -> do let isProj = isJust (isProjP p) fsep $ pwords "Cannot eliminate type" ++ prettyTCM a : if isProj then pwords "with projection pattern" ++ [prettyA p] else pwords "with pattern" ++ prettyA p : pwords "(did you supply too many arguments?)" TooManyArgumentsInLHS a -> fsep $ pwords "Left hand side gives too many arguments to a function of type" ++ [prettyTCM a] WrongNumberOfConstructorArguments c expect given -> fsep $ pwords "The constructor" ++ [prettyTCM c] ++ pwords "expects" ++ [prettyTCM expect] ++ pwords "arguments (including hidden ones), but has been given" ++ [prettyTCM given] ++ pwords "(including hidden ones)" CantResolveOverloadedConstructorsTargetingSameDatatype d cs -> fsep $ pwords "Can't resolve overloaded constructors targeting the same datatype" ++ [(parens $ prettyTCM (qnameToConcrete d)) <> colon] ++ map pretty cs DoesNotConstructAnElementOf c t -> fsep $ pwords "The constructor" ++ [prettyTCM c] ++ pwords "does not construct an element of" ++ [prettyTCM t] ConstructorPatternInWrongDatatype c d -> fsep $ [prettyTCM c] ++ pwords "is not a constructor of the datatype" ++ [prettyTCM d] IndicesNotConstructorApplications [i] -> fwords "The index" $$ nest 2 (prettyTCM i) $$ fsep (pwords "is not a constructor (or literal) applied to variables" ++ pwords "(note that parameters count as constructor arguments)") IndicesNotConstructorApplications is -> fwords "The indices" $$ nest 2 (vcat $ map prettyTCM is) $$ fsep (pwords "are not constructors (or literals) applied to variables" ++ pwords "(note that parameters count as constructor arguments)") IndexVariablesNotDistinct vs is -> fwords "The variables" $$ nest 2 (vcat $ map (\v -> prettyTCM (I.Var v [])) vs) $$ fwords "in the indices" $$ nest 2 (vcat $ map prettyTCM is) $$ fwords "are not distinct (note that parameters count as constructor arguments)" IndicesFreeInParameters vs indices pars -> fwords "The variables" $$ nest 2 (vcat $ map (\v -> prettyTCM (I.Var v [])) vs) $$ fwords "which are used (perhaps as constructor parameters) in the index expressions" $$ nest 2 (vcat $ map prettyTCM indices) $$ fwords "are free in the parameters" $$ nest 2 (vcat $ map prettyTCM pars) ShadowedModule x [] -> __IMPOSSIBLE__ ShadowedModule x ms@(m : _) -> fsep $ pwords "Duplicate definition of module" ++ [prettyTCM x <> text "."] ++ pwords "Previous definition of" ++ [help m] ++ pwords "module" ++ [prettyTCM x] ++ pwords "at" ++ [prettyTCM r] where help m = do b <- isDatatypeModule m if b then text "datatype" else empty r = case [ r | r <- map (defSiteOfLast . mnameToList) ms , r /= noRange ] of [] -> noRange r : _ -> r defSiteOfLast [] = noRange defSiteOfLast ns = nameBindingSite (last ns) ModuleArityMismatch m EmptyTel args -> fsep $ pwords "The module" ++ [prettyTCM m] ++ pwords "is not parameterized, but is being applied to arguments" ModuleArityMismatch m tel@(ExtendTel _ _) args -> fsep $ pwords "The arguments to " ++ [prettyTCM m] ++ pwords "do not fit the telescope" ++ [prettyTCM tel] ShouldBeEmpty t [] -> fsep $ [prettyTCM t] ++ pwords "should be empty, but that's not obvious to me" ShouldBeEmpty t ps -> fsep ( [prettyTCM t] ++ pwords "should be empty, but the following constructor patterns are valid:" ) $$ nest 2 (vcat $ map (prettyPat 0) ps) ShouldBeASort t -> fsep $ [prettyTCM t] ++ pwords "should be a sort, but it isn't" ShouldBePi t -> fsep $ [prettyTCM t] ++ pwords "should be a function type, but it isn't" NotAProperTerm -> fwords "Found a malformed term" SetOmegaNotValidType -> fwords "Setω is not a valid type" InvalidTypeSort s -> fsep $ [prettyTCM s] ++ pwords "is not a valid type" InvalidType v -> fsep $ [prettyTCM v] ++ pwords "is not a valid type" FunctionTypeInSizeUniv v -> fsep $ pwords "Functions may not return sizes, thus, function type " ++ [ prettyTCM v ] ++ pwords " is illegal" SplitOnIrrelevant p t -> fsep $ pwords "Cannot pattern match" ++ [prettyA p] ++ pwords "against irrelevant type" ++ [prettyTCM t] DefinitionIsIrrelevant x -> fsep $ text "Identifier" : prettyTCM x : pwords "is declared irrelevant, so it cannot be used here" VariableIsIrrelevant x -> fsep $ text "Variable" : prettyTCM x : pwords "is declared irrelevant, so it cannot be used here" UnequalBecauseOfUniverseConflict cmp s t -> fsep $ [prettyTCM s, notCmp cmp, prettyTCM t, text "because this would result in an invalid use of Setω" ] UnequalTerms cmp s t a -> do (d1, d2, d) <- prettyInEqual s t fsep $ [return d1, notCmp cmp, return d2] ++ pwords "of type" ++ [prettyTCM a] ++ [return d] -- UnequalLevel is UNUSED -- UnequalLevel cmp s t -> fsep $ -- [prettyTCM s, notCmp cmp, prettyTCM t] -- UnequalTelescopes is UNUSED -- UnequalTelescopes cmp a b -> fsep $ -- [prettyTCM a, notCmp cmp, prettyTCM b] UnequalTypes cmp a b -> prettyUnequal a (notCmp cmp) b -- fsep $ [prettyTCM a, notCmp cmp, prettyTCM b] UnequalColors a b -> error "TODO guilhem 4" HeterogeneousEquality u a v b -> fsep $ pwords "Refuse to solve heterogeneous constraint" ++ [prettyTCM u] ++ pwords ":" ++ [prettyTCM a] ++ pwords "=?=" ++ [prettyTCM v] ++ pwords ":" ++ [prettyTCM b] UnequalRelevance cmp a b -> fsep $ [prettyTCM a, notCmp cmp, prettyTCM b] ++ -- Andreas 2010-09-21 to reveal Forced annotations, print also uglily -- [text $ show a, notCmp cmp, text $ show b] ++ pwords "because one is a relevant function type and the other is an irrelevant function type" UnequalHiding a b -> fsep $ [prettyTCM a, text "!=", prettyTCM b] ++ pwords "because one is an implicit function type and the other is an explicit function type" UnequalSorts s1 s2 -> fsep $ [prettyTCM s1, text "!=", prettyTCM s2] NotLeqSort s1 s2 -> fsep $ pwords "The type of the constructor does not fit in the sort of the datatype, since" ++ [prettyTCM s1] ++ pwords "is not less or equal than" ++ [prettyTCM s2] TooFewFields r xs -> fsep $ pwords "Missing fields" ++ punctuate comma (map pretty xs) ++ pwords "in an element of the record" ++ [prettyTCM r] TooManyFields r xs -> fsep $ pwords "The record type" ++ [prettyTCM r] ++ pwords "does not have the fields" ++ punctuate comma (map pretty xs) DuplicateConstructors xs -> fsep $ pwords "Duplicate constructors" ++ punctuate comma (map pretty xs) ++ pwords "in datatype" DuplicateFields xs -> fsep $ pwords "Duplicate fields" ++ punctuate comma (map pretty xs) ++ pwords "in record" WithOnFreeVariable e -> fsep $ pwords "Cannot `with` on variable " ++ [prettyA e] ++ pwords " bound in a module telescope (or patterns of a parent clause)" UnexpectedWithPatterns ps -> fsep $ pwords "Unexpected with patterns" ++ (punctuate (text " |") $ map prettyA ps) WithClausePatternMismatch p q -> fsep $ pwords "With clause pattern " ++ [prettyA p] ++ pwords " is not an instance of its parent pattern " ++ [prettyTCM q] -- TODO: prettier printing for internal patterns MetaCannotDependOn m ps i -> fsep $ pwords "The metavariable" ++ [prettyTCM $ MetaV m []] ++ pwords "cannot depend on" ++ [pvar i] ++ pwords "because it" ++ deps where pvar = prettyTCM . I.var deps = case map pvar ps of [] -> pwords "does not depend on any variables" [x] -> pwords "only depends on the variable" ++ [x] xs -> pwords "only depends on the variables" ++ punctuate comma xs MetaOccursInItself m -> fsep $ pwords "Cannot construct infinite solution of metavariable" ++ [prettyTCM $ MetaV m []] BuiltinMustBeConstructor s e -> fsep $ [prettyA e] ++ pwords "must be a constructor in the binding to builtin" ++ [text s] NoSuchBuiltinName s -> fsep $ pwords "There is no built-in thing called" ++ [text s] DuplicateBuiltinBinding b x y -> fsep $ pwords "Duplicate binding for built-in thing" ++ [text b <> comma] ++ pwords "previous binding to" ++ [prettyTCM x] NoBindingForBuiltin x | elem x [builtinZero, builtinSuc] -> fsep $ pwords "No binding for builtin " ++ [text x <> comma] ++ pwords ("use {-# BUILTIN " ++ builtinNat ++ " name #-} to bind builtin natural " ++ "numbers to the type 'name'") | otherwise -> fsep $ pwords "No binding for builtin thing" ++ [text x <> comma] ++ pwords ("use {-# BUILTIN " ++ x ++ " name #-} to bind it to 'name'") NoSuchPrimitiveFunction x -> fsep $ pwords "There is no primitive function called" ++ [text x] BuiltinInParameterisedModule x -> fwords $ "The BUILTIN pragma cannot appear inside a bound context " ++ "(for instance, in a parameterised module or as a local declaration)" IllegalLetInTelescope tb -> fsep $ -- pwords "The binding" ++ [pretty tb] ++ pwords " is not allowed in a telescope here." NoRHSRequiresAbsurdPattern ps -> fwords $ "The right-hand side can only be omitted if there " ++ "is an absurd pattern, () or {}, in the left-hand side." AbsurdPatternRequiresNoRHS ps -> fwords $ "The right-hand side must be omitted if there " ++ "is an absurd pattern, () or {}, in the left-hand side." LocalVsImportedModuleClash m -> fsep $ pwords "The module" ++ [prettyTCM m] ++ pwords "can refer to either a local module or an imported module" SolvedButOpenHoles -> text "Module cannot be imported since it has open interaction points" UnsolvedMetas rs -> fsep ( pwords "Unsolved metas at the following locations:" ) $$ nest 2 (vcat $ map prettyTCM rs) UnsolvedConstraints cs -> fsep ( pwords "Failed to solve the following constraints:" ) $$ nest 2 (vcat $ map prettyConstraint cs) where prettyConstraint :: ProblemConstraint -> TCM Doc prettyConstraint c = f (prettyTCM c) where r = getRange c f d = if null $ P.pretty r then d else d $$ nest 4 (text "[ at" <+> prettyTCM r <+> text "]") CyclicModuleDependency ms -> fsep (pwords "cyclic module dependency:") $$ nest 2 (vcat $ map pretty ms) FileNotFound x files -> fsep ( pwords "Failed to find source of module" ++ [pretty x] ++ pwords "in any of the following locations:" ) $$ nest 2 (vcat $ map (text . filePath) files) OverlappingProjects f m1 m2 -> fsep ( pwords "The file" ++ [text (filePath f)] ++ pwords "can be accessed via several project roots. Both" ++ [pretty m1] ++ pwords "and" ++ [pretty m2] ++ pwords "point to this file." ) AmbiguousTopLevelModuleName x files -> fsep ( pwords "Ambiguous module name. The module name" ++ [pretty x] ++ pwords "could refer to any of the following files:" ) $$ nest 2 (vcat $ map (text . filePath) files) ClashingFileNamesFor x files -> fsep ( pwords "Multiple possible sources for module" ++ [prettyTCM x] ++ pwords "found:" ) $$ nest 2 (vcat $ map (text . filePath) files) ModuleDefinedInOtherFile mod file file' -> fsep $ pwords "You tried to load" ++ [text (filePath file)] ++ pwords "which defines the module" ++ [pretty mod <> text "."] ++ pwords "However, according to the include path this module should" ++ pwords "be defined in" ++ [text (filePath file') <> text "."] ModuleNameDoesntMatchFileName given files -> fsep (pwords "The name of the top level module does not match the file name. The module" ++ [ pretty given ] ++ pwords "should be defined in one of the following files:") $$ nest 2 (vcat $ map (text . filePath) files) BothWithAndRHS -> fsep $ pwords "Unexpected right hand side" NotInScope xs -> fsep (pwords "Not in scope:") $$ nest 2 (vcat $ map name xs) where name x = fsep [ pretty x , text "at" <+> prettyTCM (getRange x) , suggestion (P.prettyShow x) ] suggestion s | elem ':' s = parens $ text "did you forget space around the ':'?" | elem "->" two = parens $ text "did you forget space around the '->'?" | otherwise = empty where two = zipWith (\a b -> [a,b]) s (tail s) NoSuchModule x -> fsep $ pwords "No such module" ++ [pretty x] AmbiguousName x ys -> vcat [ fsep $ pwords "Ambiguous name" ++ [pretty x <> text "."] ++ pwords "It could refer to any one of" , nest 2 $ vcat $ map nameWithBinding ys , fwords "(hint: Use C-c C-w (in Emacs) if you want to know why)" ] AmbiguousModule x ys -> vcat [ fsep $ pwords "Ambiguous module name" ++ [pretty x <> text "."] ++ pwords "It could refer to any one of" , nest 2 $ vcat $ map help ys , fwords "(hint: Use C-c C-w (in Emacs) if you want to know why)" ] where help :: ModuleName -> TCM Doc help m = do b <- isDatatypeModule m sep [prettyTCM m, if b then text "(datatype module)" else empty] UninstantiatedModule x -> fsep ( pwords "Cannot access the contents of the parameterised module" ++ [pretty x <> text "."] ++ pwords "To do this the module first has to be instantiated. For instance:" ) $$ nest 2 (hsep [ text "module", pretty x <> text "'", text "=", pretty x, text "e1 .. en" ]) ClashingDefinition x y -> fsep $ pwords "Multiple definitions of" ++ [pretty x <> text "."] ++ pwords "Previous definition at" ++ [prettyTCM $ nameBindingSite $ qnameName y] ClashingModule m1 m2 -> fsep $ pwords "The modules" ++ [prettyTCM m1, text "and", prettyTCM m2] ++ pwords "clash." ClashingImport x y -> fsep $ pwords "Import clash between" ++ [pretty x, text "and", prettyTCM y] ClashingModuleImport x y -> fsep $ pwords "Module import clash between" ++ [pretty x, text "and", prettyTCM y] PatternShadowsConstructor x c -> fsep $ pwords "The pattern variable" ++ [prettyTCM x] ++ pwords "has the same name as the constructor" ++ [prettyTCM c] DuplicateImports m xs -> fsep $ pwords "Ambiguous imports from module" ++ [pretty m] ++ pwords "for" ++ punctuate comma (map pretty xs) ModuleDoesntExport m xs -> fsep $ pwords "The module" ++ [pretty m] ++ pwords "doesn't export the following:" ++ punctuate comma (map pretty xs) NotAModuleExpr e -> fsep $ pwords "The right-hand side of a module definition must have the form 'M e1 .. en'" ++ pwords "where M is a module name. The expression" ++ [pretty e, text "doesn't."] FieldOutsideRecord -> fsep $ pwords "Field appearing outside record declaration." InvalidPattern p -> fsep $ pretty p : pwords "is not a valid pattern" RepeatedVariablesInPattern xs -> fsep $ pwords "Repeated variables in pattern:" ++ map pretty xs NotAnExpression e -> fsep $ [pretty e] ++ pwords "is not a valid expression." NotAValidLetBinding nd -> fwords $ "Not a valid let-declaration" NothingAppliedToHiddenArg e -> fsep $ [pretty e] ++ pwords "cannot appear by itself. It needs to be the argument to" ++ pwords "a function expecting an implicit argument." NothingAppliedToInstanceArg e -> fsep $ [pretty e] ++ pwords "cannot appear by itself. It needs to be the argument to" ++ pwords "a function expecting an instance argument." NoParseForApplication es -> fsep $ pwords "Could not parse the application" ++ [pretty $ C.RawApp noRange es] AmbiguousParseForApplication es es' -> fsep ( pwords "Don't know how to parse" ++ [pretty_es <> (text ".")] ++ pwords "Could mean any one of:" ) $$ nest 2 (vcat $ map pretty' es') where pretty_es :: TCM Doc pretty_es = pretty $ C.RawApp noRange es pretty' :: C.Expr -> TCM Doc pretty' e = do p1 <- pretty_es p2 <- pretty e pretty $ if show p1 == show p2 then unambiguous e else e unambiguous :: C.Expr -> C.Expr unambiguous (C.OpApp r op _ xs) | all (isOrdinary . namedArg) xs = foldl (C.App r) (C.Ident op) $ (map . fmap . fmap) fromOrdinary xs unambiguous e = e isOrdinary :: C.OpApp e -> Bool isOrdinary (C.Ordinary _) = True isOrdinary _ = False fromOrdinary :: C.OpApp e -> e fromOrdinary (C.Ordinary e) = e fromOrdinary _ = __IMPOSSIBLE__ BadArgumentsToPatternSynonym x -> fsep $ pwords "Bad arguments to pattern synonym " ++ [prettyTCM x] TooFewArgumentsToPatternSynonym x -> fsep $ pwords "Too few arguments to pattern synonym " ++ [prettyTCM x] UnusedVariableInPatternSynonym -> fsep $ pwords "Unused variable in pattern synonym." NoParseForLHS IsLHS p -> fsep $ pwords "Could not parse the left-hand side" ++ [pretty p] NoParseForLHS IsPatSyn p -> fsep $ pwords "Could not parse the pattern synonym" ++ [pretty p] {- UNUSED NoParseForPatternSynonym p -> fsep $ pwords "Could not parse the pattern synonym" ++ [pretty p] -} AmbiguousParseForLHS lhsOrPatSyn p ps -> fsep ( pwords "Don't know how to parse" ++ [pretty_p <> text "."] ++ pwords "Could mean any one of:" ) $$ nest 2 (vcat $ map pretty' ps) where pretty_p :: TCM Doc pretty_p = pretty p pretty' :: C.Pattern -> TCM Doc pretty' p' = do p1 <- pretty_p p2 <- pretty p' pretty $ if show p1 == show p2 then unambiguousP p' else p' -- the entire pattern is shown, not just the ambiguous part, -- so we need to dig in order to find the OpAppP's. unambiguousP :: C.Pattern -> C.Pattern unambiguousP (C.AppP x y) = C.AppP (unambiguousP x) $ (fmap.fmap) unambiguousP y unambiguousP (C.HiddenP r x) = C.HiddenP r $ fmap unambiguousP x unambiguousP (C.InstanceP r x) = C.InstanceP r $ fmap unambiguousP x unambiguousP (C.ParenP r x) = C.ParenP r $ unambiguousP x unambiguousP (C.AsP r n x) = C.AsP r n $ unambiguousP x unambiguousP (C.OpAppP r op _ xs) = foldl C.AppP (C.IdentP op) xs unambiguousP e = e {- UNUSED AmbiguousParseForPatternSynonym p ps -> fsep ( pwords "Don't know how to parse" ++ [pretty p <> text "."] ++ pwords "Could mean any one of:" ) $$ nest 2 (vcat $ map pretty ps) -} IncompletePatternMatching v args -> fsep $ pwords "Incomplete pattern matching for" ++ [prettyTCM v <> text "."] ++ pwords "No match for" ++ map prettyTCM args UnreachableClauses f pss -> fsep $ pwords "Unreachable" ++ pwords (plural (length pss) "clause") where plural 1 thing = thing plural n thing = thing ++ "s" CoverageFailure f pss -> fsep ( pwords "Incomplete pattern matching for" ++ [prettyTCM f <> text "."] ++ pwords "Missing cases:") $$ nest 2 (vcat $ map display pss) where display ps = do ps <- nicify f ps prettyTCM f <+> fsep (map prettyArg ps) nicify f ps = do showImp <- showImplicitArguments if showImp then return ps else return ps -- TODO: remove implicit arguments which aren't constructors CoverageCantSplitOn c tel cIxs gIxs | length cIxs /= length gIxs -> __IMPOSSIBLE__ | otherwise -> addCtxTel tel $ vcat ( [ fsep $ pwords "I'm not sure if there should be a case for the constructor" ++ [prettyTCM c <> text ","] ++ pwords "because I get stuck when trying to solve the following" ++ pwords "unification problems (inferred index ≟ expected index):" ] ++ zipWith (\c g -> nest 2 $ prettyTCM c <+> text "≟" <+> prettyTCM g) cIxs gIxs) CoverageCantSplitIrrelevantType a -> fsep $ pwords "Cannot split on argument of irrelevant datatype" ++ [prettyTCM a] CoverageCantSplitType a -> fsep $ pwords "Cannot split on argument of non-datatype" ++ [prettyTCM a] SplitError e -> prettyTCM e WithoutKError a u v -> fsep $ pwords "Cannot eliminate reflexive equation" ++ [prettyTCM u] ++ pwords "=" ++ [prettyTCM v] ++ pwords "of type" ++ [prettyTCM a] ++ pwords "because K has been disabled." NotStrictlyPositive d ocs -> fsep $ pwords "The datatype" ++ [prettyTCM d] ++ pwords "is not strictly positive, because" ++ prettyOcc "it" ocs where prettyOcc _ [] = [] prettyOcc it (OccCon d c r : ocs) = concat [ pwords it, pwords "occurs", prettyR r , pwords "in the constructor", [prettyTCM c], pwords "of" , [prettyTCM d <> com ocs], prettyOcc "which" ocs ] prettyOcc it (OccClause f n r : ocs) = concat [ pwords it, pwords "occurs", prettyR r , pwords "in the", [th n], pwords "clause of" , [prettyTCM f <> com ocs], prettyOcc "which" ocs ] prettyR NonPositively = pwords "negatively" prettyR (ArgumentTo i q) = pwords "as the" ++ [th i] ++ pwords "argument to" ++ [prettyTCM q] th 0 = text "first" th 1 = text "second" th 2 = text "third" th n = prettyTCM (n - 1) <> text "th" com [] = empty com (_:_) = comma IFSNoCandidateInScope t -> fsep $ pwords "No variable of type" ++ [prettyTCM t] ++ pwords "was found in scope." UnquoteFailed e -> case e of BadVisibility msg arg -> fsep $ pwords $ "Unable to unquote the argument. It should be `" ++ msg ++ "'." ConInsteadOfDef x def con -> fsep $ pwords ("Use " ++ con ++ " instead of " ++ def ++ " for constructor") ++ [prettyTCM x] DefInsteadOfCon x def con -> fsep $ pwords ("Use " ++ def ++ " instead of " ++ con ++ " for non-constructor") ++ [prettyTCM x] NotAConstructor kind t -> fwords "Unable to unquote the term" $$ nest 2 (prettyTCM t) $$ fwords ("of type " ++ kind ++ ". Reason: not a constructor.") NotALiteral kind t -> fwords "Unable to unquote the term" $$ nest 2 (prettyTCM t) $$ fwords ("of type " ++ kind ++ ". Reason: not a literal value.") RhsUsesDottedVar ixs t -> fwords "Unable to unquote the term" $$ nest 2 (prettyTCM t) $$ fwords "of type Clause. Reason: the right-hand side contains variables that are referring to a dot pattern." $$ fwords ("Offending De Bruijn indices: " ++ intercalate ", " (map P.prettyShow ixs) ++ ".") BlockedOnMeta m -> __IMPOSSIBLE__ UnquotePanic err -> __IMPOSSIBLE__ SafeFlagPostulate e -> fsep $ pwords "Cannot postulate" ++ [pretty e] ++ pwords "with safe flag" SafeFlagPragma xs -> let plural | length xs == 1 = "" | otherwise = "s" in fsep $ [fwords ("Cannot set OPTION pragma" ++ plural)] ++ map text xs ++ [fwords "with safe flag."] SafeFlagNoTerminationCheck -> fsep $ pwords "Cannot use NO_TERMINATION_CHECK pragma with safe flag." SafeFlagNonTerminating -> fsep $ pwords "Cannot use NON_TERMINATING pragma with safe flag." SafeFlagTerminating -> fsep $ pwords "Cannot use TERMINATING pragma with safe flag." SafeFlagPrimTrustMe -> fsep (pwords "Cannot use primTrustMe with safe flag") NeedOptionCopatterns -> fsep $ pwords "Option --copatterns needed to enable destructor patterns" NeedOptionRewriting -> fsep $ pwords "Option --rewriting needed to add and use rewrite rules" where mpar n args | n > 0 && not (null args) = parens | otherwise = id prettyArg :: I.Arg I.Pattern -> TCM Doc prettyArg (Common.Arg info x) = case getHiding info of Hidden -> braces $ prettyPat 0 x Instance -> dbraces $ prettyPat 0 x NotHidden -> prettyPat 1 x prettyPat :: Integer -> I.Pattern -> TCM Doc prettyPat _ (I.VarP _) = text "_" prettyPat _ (I.DotP _) = text "._" prettyPat n (I.ConP c _ args) = mpar n args $ prettyTCM c <+> fsep (map (prettyArg . fmap namedThing) args) prettyPat _ (I.LitP l) = prettyTCM l prettyPat _ (I.ProjP p) = prettyTCM p notCmp :: Comparison -> TCM Doc notCmp cmp = text "!" <> prettyTCM cmp -- | Print two terms that are supposedly unequal. -- If they print to the same identifier, add some explanation -- why they are different nevertheless. prettyInEqual :: Term -> Term -> TCM (Doc, Doc, Doc) prettyInEqual t1 t2 = do d1 <- prettyTCM t1 d2 <- prettyTCM t2 (d1, d2,) <$> do -- if printed differently, no extra explanation needed if P.render d1 /= P.render d2 then empty else do (v1, v2) <- instantiate (t1, t2) case (ignoreSharing v1, ignoreSharing v2) of (I.Var i1 _, I.Var i2 _) | i1 == i2 -> __IMPOSSIBLE__ -- if they're actually the same we would get the error on the arguments instead | otherwise -> varVar i1 i2 (I.Def{}, I.Con{}) -> __IMPOSSIBLE__ -- ambiguous identifiers (I.Con{}, I.Def{}) -> __IMPOSSIBLE__ (I.Var{}, I.Def{}) -> varDef (I.Def{}, I.Var{}) -> varDef (I.Var{}, I.Con{}) -> varCon (I.Con{}, I.Var{}) -> varCon _ -> empty where varDef, varCon :: TCM Doc varDef = parens $ fwords "because one is a variable and one a defined identifier" varCon = parens $ fwords "because one is a variable and one a constructor" varVar :: Int -> Int -> TCM Doc varVar i j = parens $ fwords $ "because one has deBruijn index " ++ show i ++ " and the other " ++ show j class PrettyUnequal a where prettyUnequal :: a -> TCM Doc -> a -> TCM Doc instance PrettyUnequal Term where prettyUnequal t1 ncmp t2 = do (d1, d2, d) <- prettyInEqual t1 t2 fsep $ return d1 : ncmp : return d2 : return d : [] instance PrettyUnequal Type where prettyUnequal t1 ncmp t2 = prettyUnequal (unEl t1) ncmp (unEl t2) instance PrettyTCM SplitError where prettyTCM err = case err of NotADatatype t -> enterClosure t $ \ t -> fsep $ pwords "Cannot pattern match on non-datatype" ++ [prettyTCM t] IrrelevantDatatype t -> enterClosure t $ \ t -> fsep $ pwords "Cannot pattern match on datatype" ++ [prettyTCM t] ++ pwords "since it is declared irrelevant" CoinductiveDatatype t -> enterClosure t $ \ t -> fsep $ pwords "Cannot pattern match on the coinductive type" ++ [prettyTCM t] {- UNUSED NoRecordConstructor t -> fsep $ pwords "Cannot pattern match on record" ++ [prettyTCM t] ++ pwords "because it has no constructor" -} CantSplit c tel cIxs gIxs -> prettyTCM $ CoverageCantSplitOn c tel cIxs gIxs GenericSplitError s -> fsep $ pwords "Split failed:" ++ pwords s instance PrettyTCM Call where prettyTCM c = case c of CheckClause t cl -> fsep $ pwords "when checking that the clause" ++ [AP.prettyA cl] ++ pwords "has type" ++ [prettyTCM t] CheckPattern p tel t -> addCtxTel tel $ fsep $ pwords "when checking that the pattern" ++ [prettyA p] ++ pwords "has type" ++ [prettyTCM t] CheckLetBinding b -> fsep $ pwords "when checking the let binding" ++ [AP.prettyA b] InferExpr e -> fsep $ pwords "when inferring the type of" ++ [prettyA e] CheckExprCall e t -> fsep $ pwords "when checking that the expression" ++ [prettyA e] ++ pwords "has type" ++ [prettyTCM t] IsTypeCall e s -> fsep $ pwords "when checking that the expression" ++ [prettyA e] ++ pwords "is a type of sort" ++ [prettyTCM s] IsType_ e -> fsep $ pwords "when checking that the expression" ++ [prettyA e] ++ pwords "is a type" CheckArguments r es t0 t1 -> fsep $ pwords "when checking that" ++ map hPretty es ++ pwords (singPlural es "is a valid argument" "are valid arguments") ++ pwords "to a function of type" ++ [prettyTCM t0] CheckRecDef _ x ps cs -> fsep $ pwords "when checking the definition of" ++ [prettyTCM x] CheckDataDef _ x ps cs -> fsep $ pwords "when checking the definition of" ++ [prettyTCM x] CheckConstructor d _ _ (A.Axiom _ _ _ c _) -> fsep $ pwords "when checking the constructor" ++ [prettyTCM c] ++ pwords "in the declaration of" ++ [prettyTCM d] CheckConstructor{} -> __IMPOSSIBLE__ CheckFunDef _ f _ -> fsep $ pwords "when checking the definition of" ++ [prettyTCM f] CheckPragma _ p -> fsep $ pwords "when checking the pragma" ++ [prettyA $ RangeAndPragma noRange p] CheckPrimitive _ x e -> fsep $ pwords "when checking that the type of the primitive function" ++ [prettyTCM x] ++ pwords "is" ++ [prettyA e] CheckWithFunctionType e -> fsep $ pwords "when checking that the type" ++ [prettyA e] ++ pwords "of the generated with function is well-formed" CheckDotPattern e v -> fsep $ pwords "when checking that the given dot pattern" ++ [prettyA e] ++ pwords "matches the inferred value" ++ [prettyTCM v] CheckPatternShadowing c -> fsep $ pwords "when checking the clause" ++ [AP.prettyA c] InferVar x -> fsep $ pwords "when inferring the type of" ++ [prettyTCM x] InferDef _ x -> fsep $ pwords "when inferring the type of" ++ [prettyTCM x] CheckIsEmpty r t -> fsep $ pwords "when checking that" ++ [prettyTCM t] ++ pwords "has no constructors" ScopeCheckExpr e -> fsep $ pwords "when scope checking" ++ [pretty e] ScopeCheckDeclaration d -> fwords "when scope checking the declaration" $$ nest 2 (pretty $ simpleDecl d) ScopeCheckLHS x p -> fsep $ pwords "when scope checking the left-hand side" ++ [pretty p] ++ pwords "in the definition of" ++ [pretty x] NoHighlighting -> empty SetRange r -> fsep (pwords "when doing something at") <+> prettyTCM r CheckSectionApplication _ m1 modapp -> fsep $ pwords "when checking the module application" ++ [prettyA $ A.Apply info m1 modapp empty empty] where info = A.ModuleInfo noRange noRange Nothing Nothing Nothing where hPretty :: I.Arg (Named_ Expr) -> TCM Doc hPretty a = do info <- reify $ argInfo a pretty =<< abstractToConcreteCtx (hiddenArgumentCtx (getHiding a)) (Common.Arg info $ unArg a) simpleDecl = D.notSoNiceDeclaration --------------------------------------------------------------------------- -- * Natural language --------------------------------------------------------------------------- class Verbalize a where verbalize :: a -> String instance Verbalize Hiding where verbalize h = case h of Hidden -> "hidden" NotHidden -> "visible" Instance -> "instance" instance Verbalize Relevance where verbalize r = case r of Relevant -> "relevant" Irrelevant -> "irrelevant" NonStrict -> "shape-irrelevant" Forced{} -> __IMPOSSIBLE__ UnusedArg -> __IMPOSSIBLE__ -- | Indefinite article. data Indefinite a = Indefinite a instance Verbalize a => Verbalize (Indefinite a) where verbalize (Indefinite a) = case verbalize a of "" -> "" w@(c:cs) | c `elem` ['a','e','i','o'] -> "an " ++ w | otherwise -> "a " ++ w -- Aarne Ranta would whip me if he saw this. singPlural :: Sized a => a -> c -> c -> c singPlural xs singular plural = if size xs == 1 then singular else plural Agda-2.4.2.5/src/full/Agda/TypeChecking/Constraints.hs0000644000000000000000000001762612635075266020541 0ustar0000000000000000{-# LANGUAGE CPP #-} module Agda.TypeChecking.Constraints where import Control.Monad.State import Control.Monad.Reader import Control.Applicative import Data.List as List import Agda.Syntax.Internal import Agda.TypeChecking.Monad import Agda.TypeChecking.Errors import Agda.TypeChecking.InstanceArguments import Agda.TypeChecking.Pretty import Agda.TypeChecking.Reduce import Agda.TypeChecking.Substitute import Agda.TypeChecking.LevelConstraints import Agda.TypeChecking.SizedTypes import {-# SOURCE #-} Agda.TypeChecking.Rules.Term import {-# SOURCE #-} Agda.TypeChecking.Conversion import {-# SOURCE #-} Agda.TypeChecking.MetaVars import {-# SOURCE #-} Agda.TypeChecking.Empty import Agda.Utils.Except ( MonadError(throwError) ) import Agda.Utils.Maybe import Agda.Utils.Monad import Agda.Utils.Pretty (prettyShow) #include "undefined.h" import Agda.Utils.Impossible -- | Catches pattern violation errors and adds a constraint. -- catchConstraint :: Constraint -> TCM () -> TCM () catchConstraint c v = liftTCM $ catchError_ v $ \err -> case err of -- Not putting s (which should really be the what's already there) makes things go -- a lot slower (+20% total time on standard library). How is that possible?? -- The problem is most likely that there are internal catchErrors which forgets the -- state. catchError should preserve the state on pattern violations. PatternErr{} -> addConstraint c _ -> throwError err addConstraint :: Constraint -> TCM () addConstraint c = do pids <- asks envActiveProblems reportSDoc "tc.constr.add" 20 $ hsep [ text "adding constraint" , text (show pids) , prettyTCM c ] -- Need to reduce to reveal possibly blocking metas c <- reduce =<< instantiateFull c c' <- simpl c if (c /= c') then do reportSDoc "tc.constr.add" 20 $ text " simplified:" <+> prettyTCM c' solveConstraint_ c' else addConstraint' c' -- the added constraint can cause IFS constraints to be solved unless (isIFSConstraint c) $ wakeConstraints (isIFSConstraint . clValue . theConstraint) where isIFSConstraint :: Constraint -> Bool isIFSConstraint FindInScope{} = True isIFSConstraint _ = False simpl :: Constraint -> TCM Constraint simpl c = do n <- genericLength <$> getContext let isLvl LevelCmp{} = True isLvl _ = False cs <- getAllConstraints lvls <- instantiateFull $ List.filter (isLvl . clValue . theConstraint) cs when (not $ List.null lvls) $ reportSDoc "tc.constr.add" 40 $ text " simplifying using" <+> prettyTCM lvls return $ simplifyLevelConstraint n c lvls -- | Don't allow the argument to produce any constraints. noConstraints :: TCM a -> TCM a noConstraints problem = liftTCM $ do (pid, x) <- newProblem problem cs <- getConstraintsForProblem pid unless (List.null cs) $ typeError $ UnsolvedConstraints cs return x -- | Create a fresh problem for the given action. newProblem :: TCM a -> TCM (ProblemId, a) newProblem action = do pid <- fresh -- Don't get distracted by other constraints while working on the problem x <- nowSolvingConstraints $ solvingProblem pid action -- Now we can check any woken constraints solveAwakeConstraints return (pid, x) newProblem_ :: TCM () -> TCM ProblemId newProblem_ action = fst <$> newProblem action ifNoConstraints :: TCM a -> (a -> TCM b) -> (ProblemId -> a -> TCM b) -> TCM b ifNoConstraints check ifNo ifCs = do (pid, x) <- newProblem check ifM (isProblemSolved pid) (ifNo x) (ifCs pid x) ifNoConstraints_ :: TCM () -> TCM a -> (ProblemId -> TCM a) -> TCM a ifNoConstraints_ check ifNo ifCs = ifNoConstraints check (const ifNo) (\pid _ -> ifCs pid) -- | @guardConstraint c blocker@ tries to solve @blocker@ first. -- If successful without constraints, it moves on to solve @c@, otherwise it -- adds a @Guarded c cs@ constraint -- to the @blocker@-generated constraints @cs@. guardConstraint :: Constraint -> TCM () -> TCM () guardConstraint c blocker = ifNoConstraints_ blocker (solveConstraint_ c) (addConstraint . Guarded c) whenConstraints :: TCM () -> TCM () -> TCM () whenConstraints action handler = ifNoConstraints_ action (return ()) $ \pid -> do stealConstraints pid handler -- | Wake up the constraints depending on the given meta. wakeupConstraints :: MetaId -> TCM () wakeupConstraints x = do wakeConstraints (const True) -- (mentionsMeta x) -- TODO: needs fixing to cope with shared updates solveAwakeConstraints -- | Wake up all constraints. wakeupConstraints_ :: TCM () wakeupConstraints_ = do wakeConstraints (const True) solveAwakeConstraints solveAwakeConstraints :: TCM () solveAwakeConstraints = solveAwakeConstraints' False solveAwakeConstraints' :: Bool -> TCM () solveAwakeConstraints' force = do verboseS "profile.constraints" 10 $ liftTCM $ tickMax "max-open-constraints" . genericLength =<< getAllConstraints whenM ((force ||) . not <$> isSolvingConstraints) $ nowSolvingConstraints $ do -- solveSizeConstraints -- Andreas, 2012-09-27 attacks size constrs too early solve where solve = do reportSDoc "tc.constr.solve" 10 $ hsep [ text "Solving awake constraints." , text . show . length =<< getAwakeConstraints , text "remaining." ] whenJustM takeAwakeConstraint $ \ c -> do withConstraint solveConstraint c solve solveConstraint :: Constraint -> TCM () solveConstraint c = do verboseS "profile.constraints" 10 $ liftTCM $ tick "attempted-constraints" verboseBracket "tc.constr.solve" 20 "solving constraint" $ do pids <- asks envActiveProblems reportSDoc "tc.constr.solve" 20 $ text (show pids) <+> prettyTCM c solveConstraint_ c solveConstraint_ :: Constraint -> TCM () solveConstraint_ (ValueCmp cmp a u v) = compareTerm cmp a u v solveConstraint_ (ElimCmp cmp a e u v) = compareElims cmp a e u v solveConstraint_ (TypeCmp cmp a b) = compareType cmp a b solveConstraint_ (TelCmp a b cmp tela telb) = compareTel a b cmp tela telb solveConstraint_ (SortCmp cmp s1 s2) = compareSort cmp s1 s2 solveConstraint_ (LevelCmp cmp a b) = compareLevel cmp a b solveConstraint_ c0@(Guarded c pid) = do ifM (isProblemSolved pid) (solveConstraint_ c) (addConstraint c0) solveConstraint_ (IsEmpty r t) = isEmptyType r t solveConstraint_ (CheckSizeLtSat t) = checkSizeLtSat t solveConstraint_ (UnBlock m) = ifM (isFrozen m) (addConstraint $ UnBlock m) $ do inst <- mvInstantiation <$> lookupMeta m reportSDoc "tc.constr.unblock" 15 $ text ("unblocking a metavar yields the constraint: " ++ show inst) case inst of BlockedConst t -> do reportSDoc "tc.constr.blocked" 15 $ text ("blocked const " ++ prettyShow m ++ " :=") <+> prettyTCM t assignTerm m [] t PostponedTypeCheckingProblem cl unblock -> enterClosure cl $ \prob -> do ifNotM unblock (addConstraint $ UnBlock m) $ do tel <- getContextTelescope v <- liftTCM $ checkTypeCheckingProblem prob assignTerm m (telToArgs tel) v -- Andreas, 2009-02-09, the following were IMPOSSIBLE cases -- somehow they pop up in the context of sized types -- -- already solved metavariables: should only happen for size -- metas (not sure why it does, Andreas?) InstV{} -> return () InstS{} -> return () -- Open (whatever that means) Open -> __IMPOSSIBLE__ OpenIFS -> __IMPOSSIBLE__ solveConstraint_ (FindInScope m cands) = findInScope m cands checkTypeCheckingProblem :: TypeCheckingProblem -> TCM Term checkTypeCheckingProblem p = case p of CheckExpr e t -> checkExpr e t CheckArgs eh ei r args t0 t1 k -> checkArguments' eh ei r args t0 t1 k CheckLambda args body target -> checkPostponedLambda args body target Agda-2.4.2.5/src/full/Agda/TypeChecking/Coverage.hs0000644000000000000000000007465712635075266017774 0ustar0000000000000000{-# OPTIONS_GHC -fwarn-unused-imports #-} {-# LANGUAGE CPP #-} {-# LANGUAGE FlexibleContexts #-} {-# LANGUAGE PatternGuards #-} {-# LANGUAGE TupleSections #-} {-| Coverage checking, case splitting, and splitting for refine tactics. -} module Agda.TypeChecking.Coverage ( SplitClause(..), clauseToSplitClause, fixTarget , Covering(..), splitClauses , coverageCheck , splitClauseWithAbsurd , splitLast , splitResult ) where import Prelude hiding (null) import Control.Monad import Control.Monad.Trans ( lift ) #if !MIN_VERSION_base(4,8,0) import Control.Applicative hiding (empty) #endif import Data.List hiding (null) import Data.Set (Set) import qualified Data.Set as Set import qualified Data.Traversable as Trav import qualified Agda.Syntax.Common as Common import Agda.Syntax.Common hiding (Arg,Dom) import Agda.Syntax.Internal as I import Agda.Syntax.Internal.Pattern import Agda.TypeChecking.Monad import Agda.TypeChecking.Monad.Exception import Agda.TypeChecking.Rules.LHS.Problem (flexibleVarFromHiding) import Agda.TypeChecking.Rules.LHS.Unify import Agda.TypeChecking.Rules.LHS.Instantiate (instantiateTel) import Agda.TypeChecking.Rules.LHS (instantiatePattern) import Agda.TypeChecking.Coverage.Match import Agda.TypeChecking.Coverage.SplitTree import Agda.TypeChecking.Datatypes (getConForm) import Agda.TypeChecking.Pretty import Agda.TypeChecking.Substitute import Agda.TypeChecking.Reduce import Agda.TypeChecking.Records (isRecordType) import Agda.TypeChecking.Telescope import Agda.Interaction.Options import Agda.Utils.Either import Agda.Utils.Functor import Agda.Utils.List import Agda.Utils.Maybe import Agda.Utils.Monad import Agda.Utils.Null import Agda.Utils.Permutation import Agda.Utils.Size import Agda.Utils.Tuple #include "undefined.h" import Agda.Utils.Impossible data SplitClause = SClause { scTel :: Telescope -- ^ Type of variables in @scPats@. , scPerm :: Permutation -- ^ How to get from the variables in the patterns to the telescope. , scPats :: [I.NamedArg Pattern] -- ^ The patterns leading to the currently considered branch of -- the split tree. , scSubst :: Substitution -- ^ Substitution from 'scTel' to old context. -- Only needed directly after split on variable: -- * To update 'scTarget' -- * To rename other split variables when splitting on -- multiple variables. -- @scSubst@ is not ``transitive'', i.e., does not record -- the substitution from the original context to 'scTel' -- over a series of splits. It is freshly computed -- after each split by 'computeNeighborhood'; also -- 'splitResult', which does not split on a variable, -- should reset it to the identity 'idS', lest it be -- applied to 'scTarget' again, leading to Issue 1294. , scTarget :: Maybe (I.Arg Type) -- ^ The type of the rhs, living in context 'scTel'. -- This invariant is broken before calls to 'fixTarget'; -- there, 'scTarget' lives in the old context. -- 'fixTarget' moves 'scTarget' to the new context by applying -- substitution 'scSubst'. } -- | A @Covering@ is the result of splitting a 'SplitClause'. data Covering = Covering { covSplitArg :: Nat -- ^ De Bruijn level of argument we split on. , covSplitClauses :: [(QName, SplitClause)] -- ^ Covering clauses, indexed by constructor these clauses share. } -- | Project the split clauses out of a covering. splitClauses :: Covering -> [SplitClause] splitClauses (Covering _ qcs) = map snd qcs -- | Create a split clause from a clause in internal syntax. clauseToSplitClause :: Clause -> SplitClause clauseToSplitClause cl = SClause { scTel = clauseTel cl , scPerm = clausePerm cl , scPats = namedClausePats cl , scSubst = idS -- Andreas, 2014-07-15 TODO: Is this ok? , scTarget = clauseType cl } type CoverM = ExceptionT SplitError TCM -- | Top-level function for checking pattern coverage. coverageCheck :: QName -> Type -> [Clause] -> TCM SplitTree coverageCheck f t cs = do TelV gamma a <- telView t let -- n = arity -- lgamma/gamma' = telescope of non-dropped arguments -- xs = variable patterns fitting lgamma n = size gamma lgamma = telToList gamma xs = map (argFromDom . fmap (namedVarP . fst)) $ lgamma -- construct the initial split clause sc = SClause gamma (idP n) xs idS $ Just $ defaultArg a reportSDoc "tc.cover.top" 10 $ vcat [ text $ "Coverage checking " ++ show f , nest 2 $ vcat $ map (text . show . clausePats) cs ] -- used = actually used clauses for cover -- pss = uncovered cases (splitTree, used, pss) <- cover f cs sc reportSDoc "tc.cover.splittree" 10 $ vcat [ text "generated split tree for" <+> prettyTCM f , text $ show splitTree ] whenM (optCompletenessCheck <$> pragmaOptions) $ -- report an error if there are uncovered cases unless (null pss) $ setCurrentRange cs $ typeError $ CoverageFailure f (map (map $ fmap namedThing) pss) -- is = indices of unreachable clauses let is = Set.toList $ Set.difference (Set.fromList [0..genericLength cs - 1]) used -- report an error if there are unreachable clauses unless (null is) $ do let unreached = map (cs !!) is setCurrentRange unreached $ typeError $ UnreachableClauses f (map clausePats unreached) return splitTree -- | @cover f cs (SClause _ _ ps _) = return (splitTree, used, pss)@. -- checks that the list of clauses @cs@ covers the given split clause. -- Returns the @splitTree@, the @used@ clauses, and missing cases @pss@. cover :: QName -> [Clause] -> SplitClause -> TCM (SplitTree, Set Nat, [[I.NamedArg Pattern]]) cover f cs sc@(SClause tel perm ps _ target) = do reportSDoc "tc.cover.cover" 10 $ vcat [ text "checking coverage of pattern:" , nest 2 $ text "tel =" <+> prettyTCM tel , nest 2 $ text "perm =" <+> text (show perm) , nest 2 $ text "ps =" <+> text (show ps) ] let ups = map (fmap namedThing) ps case match cs ups perm of Yes i -> do reportSLn "tc.cover.cover" 10 $ "pattern covered by clause " ++ show i -- Check if any earlier clauses could match with appropriate literals let is = [ j | (j, c) <- zip [0..i-1] cs, matchLits c ups perm ] reportSLn "tc.cover.cover" 10 $ "literal matches: " ++ show is return (SplittingDone (size tel), Set.fromList (i : is), []) No -> do reportSLn "tc.cover" 20 $ "pattern is not covered" return (SplittingDone (size tel), Set.empty, [ps]) -- case: split into projection patterns BlockP -> do reportSLn "tc.cover" 20 $ "blocked by projection pattern" -- if we want to split projections, but have no target type, we give up let done = return (SplittingDone (size tel), Set.empty, [ps]) caseMaybeM (splitResult f sc) done $ \ (Covering n scs) -> do (projs, (trees, useds, psss)) <- mapSnd unzip3 . unzip <$> do mapM (traverseF $ cover f cs <=< (snd <.> fixTarget)) scs -- OR: -- forM scs $ \ (proj, sc') -> (proj,) <$> do -- cover f cs =<< do -- snd <$> fixTarget sc' let tree = SplitAt n $ zip projs trees return (tree, Set.unions useds, concat psss) -- case: split on variable Block bs -> do reportSLn "tc.cover.strategy" 20 $ "blocking vars = " ++ show bs -- xs is a non-empty lists of blocking variables -- try splitting on one of them xs <- splitStrategy bs tel r <- altM1 (split Inductive sc) xs case r of Left err -> case err of CantSplit c tel us vs -> typeError $ CoverageCantSplitOn c tel us vs NotADatatype a -> enterClosure a $ typeError . CoverageCantSplitType IrrelevantDatatype a -> enterClosure a $ typeError . CoverageCantSplitIrrelevantType CoinductiveDatatype a -> enterClosure a $ typeError . CoverageCantSplitType {- UNUSED NoRecordConstructor a -> typeError $ CoverageCantSplitType a -} GenericSplitError s -> fail $ "failed to split: " ++ s -- If we get the empty covering, we have reached an impossible case -- and are done. Right (Covering n []) -> return (SplittingDone (size tel), Set.empty, []) Right (Covering n scs) -> do (trees, useds, psss) <- unzip3 <$> mapM (cover f cs) (map snd scs) let tree = SplitAt n $ zipWith (\ (q,_) t -> (q,t)) scs trees return (tree, Set.unions useds, concat psss) splitStrategy :: BlockingVars -> Telescope -> TCM BlockingVars splitStrategy bs tel = return $ updateLast clearBlockingVarCons xs -- Make sure we do not insists on precomputed coverage when -- we make our last try to split. -- Otherwise, we will not get a nice error message. where xs = bs {- KEEP! -- Andreas, 2012-10-13 -- The following split strategy which prefers all-constructor columns -- fails on test/fail/CoverStrategy xs = ys ++ zs (ys, zs) = partition allConstructors bs allConstructors :: BlockingVar -> Bool allConstructors = isJust . snd -} -- | Check that a type is a non-irrelevant datatype or a record with -- named constructor. Unless the 'Induction' argument is 'CoInductive' -- the data type must be inductive. isDatatype :: (MonadTCM tcm, MonadException SplitError tcm) => Induction -> Dom Type -> tcm (QName, [Arg Term], [Arg Term], [QName]) isDatatype ind at = do let t = unDom at throw f = throwException . f =<< do liftTCM $ buildClosure t t' <- liftTCM $ reduce t case ignoreSharing $ unEl t' of Def d es -> do let ~(Just args) = allApplyElims es def <- liftTCM $ theDef <$> getConstInfo d splitOnIrrelevantDataAllowed <- liftTCM $ optExperimentalIrrelevance <$> pragmaOptions case def of Datatype{dataPars = np, dataCons = cs, dataInduction = i} | i == CoInductive && ind /= CoInductive -> throw CoinductiveDatatype -- Andreas, 2011-10-03 allow some splitting on irrelevant data (if only one constr. matches) | isIrrelevant at && not splitOnIrrelevantDataAllowed -> throw IrrelevantDatatype | otherwise -> do let (ps, is) = genericSplitAt np args return (d, ps, is, cs) Record{recPars = np, recConHead = con, recInduction = i} | i == Just CoInductive && ind /= CoInductive -> throw CoinductiveDatatype | otherwise -> return (d, args, [], [conName con]) _ -> throw NotADatatype _ -> throw NotADatatype -- | Update the target type, add more patterns to split clause -- if target becomes a function type. -- Returns the domains of the function type (if any). fixTarget :: SplitClause -> TCM (Telescope, SplitClause) fixTarget sc@SClause{ scTel = sctel, scPerm = perm, scPats = ps, scSubst = sigma, scTarget = target } = caseMaybe target (return (empty, sc)) $ \ a -> do reportSDoc "tc.cover.target" 20 $ sep [ text "split clause telescope: " <+> prettyTCM sctel , text "old permutation : " <+> prettyTCM perm , text "old patterns : " <+> sep (map (prettyTCM . namedArg) ps) , text "substitution : " <+> text (show sigma) ] reportSDoc "tc.cover.target" 30 $ sep [ text "target type before substitution (variables may be wrong): " <+> do addContext sctel $ prettyTCM a ] TelV tel b <- telView $ applySubst sigma $ unArg a reportSDoc "tc.cover.target" 10 $ sep [ text "target type telescope (after substitution): " <+> do addContext sctel $ prettyTCM tel , text "target type core (after substitution): " <+> do addContext sctel $ addContext tel $ prettyTCM b ] let n = size tel lgamma = telToList tel xs = for lgamma $ \ (Common.Dom ai (x, _)) -> Common.Arg ai $ namedVarP "_" -- Compute new split clause sctel' = telFromList $ telToList (raise n sctel) ++ lgamma perm' = liftP n $ scPerm sc -- Dot patterns in @ps@ need to be raised! (Issue 1298) ps' = raise n ps ++ xs newTarget = Just $ a $> b sc' = SClause { scTel = sctel' , scPerm = perm' , scPats = ps' , scSubst = liftS n $ sigma , scTarget = newTarget } -- Separate debug printing to find cause of crash (Issue 1374) reportSDoc "tc.cover.target" 30 $ sep [ text "new split clause telescope : " <+> prettyTCM sctel' ] reportSDoc "tc.cover.target" 30 $ sep [ text "new split clause permutation : " <+> prettyTCM perm' ] reportSDoc "tc.cover.target" 30 $ sep [ text "new split clause patterns : " <+> sep (map (prettyTCM . namedArg) ps') ] reportSDoc "tc.cover.target" 30 $ sep [ text "new split clause substitution: " <+> text (show $ scSubst sc') ] reportSDoc "tc.cover.target" 30 $ sep [ text "new split clause target : " <+> do addContext sctel' $ prettyTCM $ fromJust newTarget ] reportSDoc "tc.cover.target" 20 $ sep [ text "new split clause" , prettyTCM sc' ] return $ if n == 0 then (empty, sc { scTarget = newTarget }) else (tel, sc') -- | @computeNeighbourhood delta1 delta2 perm d pars ixs hix hps con@ -- -- @ -- delta1 Telescope before split point -- n Name of pattern variable at split point -- delta2 Telescope after split point -- d Name of datatype to split at -- pars Data type parameters -- ixs Data type indices -- hix Index of split variable -- hps Patterns with hole at split point -- con Constructor to fit into hole -- @ -- @dtype == d pars ixs@ computeNeighbourhood :: Telescope -- ^ Telescope before split point. -> PatVarName -- ^ Name of pattern variable at split point. -> Telescope -- ^ Telescope after split point. -> Permutation -- ^ -> QName -- ^ Name of datatype to split at. -> Args -- ^ Data type parameters. -> Args -- ^ Data type indices. -> Nat -- ^ Index of split variable. -> OneHolePatterns -- ^ Patterns with hole at split point. -> QName -- ^ Constructor to fit into hole. -> CoverM (Maybe SplitClause) -- ^ New split clause if successful. computeNeighbourhood delta1 n delta2 perm d pars ixs hix hps c = do -- Get the type of the datatype dtype <- liftTCM $ (`piApply` pars) . defType <$> getConstInfo d -- Get the real constructor name con <- liftTCM $ getConForm c con <- return $ con { conName = c } -- What if we restore the current name? -- Andreas, 2013-11-29 changes nothing! {- con <- conSrcCon . theDef <$> getConstInfo con Con con [] <- liftTCM $ ignoreSharing <$> (constructorForm =<< normalise (Con con [])) -} -- Get the type of the constructor ctype <- liftTCM $ defType <$> getConInfo con -- Lookup the type of the constructor at the given parameters (gamma0, cixs) <- do TelV gamma0 (El _ d) <- liftTCM $ telView (ctype `piApply` pars) let Def _ es = ignoreSharing d Just cixs = allApplyElims es return (gamma0, cixs) -- Andreas, 2012-02-25 preserve name suggestion for recursive arguments -- of constructor let preserve (x, t@(El _ (Def d' _))) | d == d' = (n, t) preserve (x, (El s (Shared p))) = preserve (x, El s $ derefPtr p) preserve p = p gammal = map (fmap preserve) . telToList $ gamma0 gamma = telFromList gammal debugInit con ctype d pars ixs cixs delta1 delta2 gamma hps hix -- All variables are flexible -- let flex = [0..size delta1 + size gamma - 1] let gammaDelta1 = gammal ++ telToList delta1 makeFlex i d = flexibleVarFromHiding (getHiding d) i flex = zipWith makeFlex [0..] gammaDelta1 -- Unify constructor target and given type (in Δ₁Γ) let conIxs = drop (size pars) cixs givenIxs = raise (size gamma) ixs r <- addCtxTel (delta1 `abstract` gamma) $ unifyIndices flex (raise (size gamma) dtype) conIxs givenIxs case r of NoUnify {} -> debugNoUnify $> Nothing DontKnow{} -> do debugCantSplit throwException $ CantSplit (conName con) (delta1 `abstract` gamma) conIxs givenIxs Unifies sub -> do debugSubst "sub" sub -- Substitute the constructor for x in Δ₂: Δ₂' = Δ₂[conv/x] let conv = Con con $ teleArgs gamma -- Θ Γ ⊢ conv (for any Θ) rho0 = consS conv $ raiseS (size gamma) -- Andreas, 2015-06-13 share substitution rho0 delta2' = applySubst rho0 delta2 -- delta2' = subst 0 conv $ raiseFrom 1 (size gamma) delta2 debugTel "delta2'" delta2' -- Compute a substitution ρ : Δ₁ΓΔ₂' → Δ₁(x:D)Δ₂' let rho = liftS (size delta2') $ rho0 -- [ Var i [] | i <- [0..size delta2' - 1] ] -- ++ [ raise (size delta2') conv ] -- ++ [ Var i [] | i <- [size delta2' + size gamma ..] ] -- Plug the hole with the constructor and apply ρ -- Andreas, 2015-05-01 I guess it is fine to use @noConPatternInfo@ -- as the result of splitting is never used further down the pipeline. -- After splitting, Agda reloads the file. let conp = ConP con noConPatternInfo $ map (fmap namedVarP) $ teleArgNames gamma ps = plugHole conp hps ps' = applySubst rho ps -- Δ₁ΓΔ₂' ⊢ ps' debugPlugged ps ps' -- Δ₁Γ ⊢ sub, we need something in Δ₁ΓΔ₂' -- Also needs to be padded with Nothing's to have the right length. let pad n xs x = xs ++ replicate (max 0 $ n - size xs) x sub' = replicate (size delta2') Nothing ++ pad (size delta1 + size gamma) (raise (size delta2') sub) Nothing debugSubst "sub'" sub' -- Θ = Δ₁ΓΔ₂' let theta = delta1 `abstract` gamma `abstract` delta2' debugTel "theta" theta -- Apply the unifying substitution to Θ -- We get ρ' : Θ' -> Θ -- π : Θ' -> Θ (theta', iperm, rho', _) <- liftTCM $ instantiateTel sub' theta debugTel "theta'" theta' debugShow "iperm" iperm -- Compute final permutation let perm' = expandP hix (size gamma) perm -- perm' : Θ -> Δ₁(x : D)Δ₂ rperm = iperm `composeP` perm' debugShow "perm'" perm' debugShow "rperm" rperm -- Compute the final patterns let ps'' = instantiatePattern sub' perm' ps' rps = applySubst rho' ps'' -- Compute the final substitution let rsub = applySubst rho' rho debugFinal theta' rperm rps return $ Just $ SClause theta' rperm rps rsub Nothing -- target fixed later where debugInit con ctype d pars ixs cixs delta1 delta2 gamma hps hix = liftTCM $ reportSDoc "tc.cover.split.con" 20 $ vcat [ text "computeNeighbourhood" , nest 2 $ vcat [ text "con =" <+> prettyTCM con , text "ctype =" <+> prettyTCM ctype , text "hps =" <+> text (show hps) , text "d =" <+> prettyTCM d , text "pars =" <+> prettyList (map prettyTCM pars) , text "ixs =" <+> addCtxTel delta1 (prettyList (map prettyTCM ixs)) , text "cixs =" <+> do addCtxTel gamma $ prettyList (map prettyTCM cixs) , text "delta1 =" <+> prettyTCM delta1 , text "delta2 =" <+> prettyTCM delta2 , text "gamma =" <+> prettyTCM gamma , text "hix =" <+> text (show hix) ] ] debugNoUnify = liftTCM $ reportSLn "tc.cover.split.con" 20 " Constructor impossible!" debugCantSplit = liftTCM $ reportSLn "tc.cover.split.con" 20 " Bad split!" debugSubst s sub = liftTCM $ reportSDoc "tc.cover.split.con" 20 $ nest 2 $ vcat [ text (s ++ " =") <+> brackets (fsep $ punctuate comma $ map (maybe (text "_") prettyTCM) sub) ] debugTel s tel = liftTCM $ reportSDoc "tc.cover.split.con" 20 $ nest 2 $ vcat [ text (s ++ " =") <+> prettyTCM tel ] debugShow s x = liftTCM $ reportSDoc "tc.cover.split.con" 20 $ nest 2 $ vcat [ text (s ++ " =") <+> text (show x) ] debugPlugged ps ps' = liftTCM $ reportSDoc "tc.cover.split.con" 20 $ nest 2 $ vcat [ text "ps =" <+> text (show ps) , text "ps' =" <+> text (show ps') ] debugFinal tel perm ps = liftTCM $ reportSDoc "tc.cover.split.con" 20 $ nest 2 $ vcat [ text "rtel =" <+> prettyTCM tel , text "rperm =" <+> text (show perm) , text "rps =" <+> text (show ps) ] -- | Entry point from @Interaction.MakeCase@. splitClauseWithAbsurd :: SplitClause -> Nat -> TCM (Either SplitError (Either SplitClause Covering)) splitClauseWithAbsurd c x = split' Inductive c (BlockingVar x Nothing) -- | Entry point from @TypeChecking.Empty@ and @Interaction.BasicOps@. -- @splitLast CoInductive@ is used in the @refine@ tactics. splitLast :: Induction -> Telescope -> [I.NamedArg Pattern] -> TCM (Either SplitError Covering) splitLast ind tel ps = split ind sc (BlockingVar 0 Nothing) where sc = SClause tel (idP $ size tel) ps __IMPOSSIBLE__ Nothing -- | @split ind splitClause x = return res@ -- splits @splitClause@ at pattern var @x@ (de Bruijn index). -- -- Possible results @res@ are: -- -- 1. @Left err@: -- Splitting failed. -- -- 2. @Right covering@: -- A covering set of split clauses, one for each valid constructor. -- This could be the empty set (denoting an absurd clause). split :: Induction -- ^ Coinductive constructors are allowed if this argument is -- 'CoInductive'. -> SplitClause -> BlockingVar -> TCM (Either SplitError Covering) split ind sc x = fmap (blendInAbsurdClause (splitDbIndexToLevel sc x)) <$> split' ind sc x where blendInAbsurdClause :: Nat -> Either SplitClause Covering -> Covering blendInAbsurdClause n = fromRight (const $ Covering n []) splitDbIndexToLevel :: SplitClause -> BlockingVar -> Nat splitDbIndexToLevel sc@SClause{ scTel = tel, scPerm = perm } x = dbIndexToLevel tel perm $ blockingVarNo x -- | Convert a de Bruijn index relative to a telescope to a de Buijn level. -- The result should be the argument (counted from left, starting with 0) -- to split at (dot patterns included!). dbIndexToLevel :: Telescope -> Permutation -> Int -> Nat dbIndexToLevel tel perm x = if n < 0 then __IMPOSSIBLE__ else n where n = if k < 0 then __IMPOSSIBLE__ else case permute perm [0..] !!! k of Nothing -> __IMPOSSIBLE__ Just n -> n k = size tel - x - 1 -- | @split' ind splitClause x = return res@ -- splits @splitClause@ at pattern var @x@ (de Bruijn index). -- -- Possible results @res@ are: -- -- 1. @Left err@: -- Splitting failed. -- -- 2. @Right (Left splitClause')@: -- Absurd clause (type of @x@ has 0 valid constructors). -- -- 3. @Right (Right covering)@: -- A covering set of split clauses, one for each valid constructor. split' :: Induction -- ^ Coinductive constructors are allowed if this argument is -- 'CoInductive'. -> SplitClause -> BlockingVar -> TCM (Either SplitError (Either SplitClause Covering)) split' ind sc@(SClause tel perm ps _ target) (BlockingVar x mcons) = liftTCM $ runExceptionT $ do debugInit tel perm x ps -- Split the telescope at the variable -- t = type of the variable, Δ₁ ⊢ t (n, t, delta1, delta2) <- do let (tel1, Common.Dom info (n, t) : tel2) = genericSplitAt (size tel - x - 1) $ telToList tel return (n, Common.Dom info t, telFromList tel1, telFromList tel2) -- Compute the one hole context of the patterns at the variable (hps, hix) <- do let holes = reverse $ permute perm $ zip [0..] $ allHolesWithContents ps unless (length holes == length (telToList tel)) $ fail "split: bad holes or tel" -- There is always a variable at the given hole. let (hix, (VarP s, hps)) = case holes !!! x of Nothing -> __IMPOSSIBLE__ Just p -> p debugHoleAndType delta1 delta2 s hps t return (hps, hix) -- Check that t is a datatype or a record -- Andreas, 2010-09-21, isDatatype now directly throws an exception if it fails -- cons = constructors of this datatype (d, pars, ixs, cons) <- inContextOfT $ isDatatype ind t -- Compute the neighbourhoods for the constructors ns <- catMaybes <$> do forM cons $ \ con -> fmap (con,) <$> do msc <- computeNeighbourhood delta1 n delta2 perm d pars ixs hix hps con Trav.forM msc $ \ sc -> lift $ snd <$> fixTarget sc{ scTarget = target } case ns of [] -> do let absurd = VarP "()" return $ Left $ SClause { scTel = telFromList $ telToList delta1 ++ [fmap ((,) "()") t] ++ -- add name "()" telToList delta2 , scPerm = perm , scPats = plugHole absurd hps , scSubst = idS -- not used anyway , scTarget = Nothing -- not used } -- Andreas, 2011-10-03 -- if more than one constructor matches, we cannot be irrelevant -- (this piece of code is unreachable if --experimental-irrelevance is off) (_ : _ : _) | unusableRelevance (getRelevance t) -> throwException . IrrelevantDatatype =<< do liftTCM $ buildClosure (unDom t) -- Andreas, 2012-10-10 fail if precomputed constructor set does not cover -- all the data type constructors _ | Just pcons' <- mcons, let pcons = map conName pcons', let cons = (map fst ns), let diff = Set.fromList cons Set.\\ Set.fromList pcons, not (Set.null diff) -> do liftTCM $ reportSDoc "tc.cover.precomputed" 10 $ vcat [ hsep $ text "pcons =" : map prettyTCM pcons , hsep $ text "cons =" : map prettyTCM cons ] throwException (GenericSplitError "precomputed set of constructors does not cover all cases") _ -> return $ Right $ Covering xDBLevel ns where xDBLevel :: Nat xDBLevel = dbIndexToLevel tel perm x inContextOfT :: MonadTCM tcm => tcm a -> tcm a inContextOfT = addCtxTel tel . escapeContext (x + 1) inContextOfDelta2 :: MonadTCM tcm => tcm a -> tcm a inContextOfDelta2 = addCtxTel tel . escapeContext x -- Debug printing debugInit tel perm x ps = liftTCM $ reportSDoc "tc.cover.top" 10 $ vcat [ text "TypeChecking.Coverage.split': split" , nest 2 $ vcat [ text "tel =" <+> prettyTCM tel , text "perm =" <+> text (show perm) , text "x =" <+> text (show x) , text "ps =" <+> text (show ps) ] ] debugHoleAndType delta1 delta2 s hps t = liftTCM $ reportSDoc "tc.cover.top" 10 $ nest 2 $ vcat $ [ text "p =" <+> text (patVarNameToString s) , text "hps =" <+> text (show hps) , text "delta1 =" <+> prettyTCM delta1 , text "delta2 =" <+> inContextOfDelta2 (prettyTCM delta2) , text "t =" <+> inContextOfT (prettyTCM t) ] -- | @splitResult f sc = return res@ -- -- If the target type of @sc@ is a record type, a covering set of -- split clauses is returned (@sc@ extended by all valid projection patterns), -- otherwise @res == Nothing@. -- Note that the empty set of split clauses is returned if the record has no fields. splitResult :: QName -> SplitClause -> TCM (Maybe Covering) splitResult f sc@(SClause tel perm ps _ target) = do reportSDoc "tc.cover.split" 10 $ vcat [ text "splitting result:" , nest 2 $ text "f =" <+> text (show f) , nest 2 $ text "target =" <+> (addContext tel $ maybe empty prettyTCM target) ] -- if we want to split projections, but have no target type, we give up let done = return Nothing caseMaybe target done $ \ t -> do isR <- addCtxTel tel $ isRecordType $ unArg t case isR of Just (_r, vs, Record{ recFields = fs }) -> do reportSDoc "tc.cover" 20 $ sep [ text $ "we are of record type _r = " ++ show _r , text "applied to parameters vs = " <+> (addCtxTel tel $ prettyTCM vs) , text $ "and have fields fs = " ++ show fs ] fvs <- freeVarsToApply f let es = patternsToElims perm ps let self = defaultArg $ Def f (map Apply fvs) `applyE` es pargs = vs ++ [self] reportSDoc "tc.cover" 20 $ sep [ text "we are self = " <+> (addCtxTel tel $ prettyTCM $ unArg self) ] let -- WRONG: -- n = length ps -- past the last argument, is pos. of proj pat. -- n = size tel -- past the last variable, is pos. of proj pat. DURING SPLITTING n = permRange perm -- Andreas & James, 2013-11-19 includes the dot patterns! -- See test/succeed/CopatternsAndDotPatterns.agda for a case with dot patterns -- and copatterns which fails for @n = size tel@ with a broken case tree. Just . Covering n <$> do forM fs $ \ proj -> do -- compute the new target dType <- defType <$> do getConstInfo $ unArg proj -- WRONG: typeOfConst $ unArg proj let -- type of projection instantiated at self target' = Just $ proj $> dType `apply` pargs sc' = sc { scPats = scPats sc ++ [fmap (Named Nothing . ProjP) proj] , scSubst = idS , scTarget = target' } return (unArg proj, sc') _ -> done -- * Boring instances -- | For debugging only. instance PrettyTCM SplitClause where prettyTCM (SClause tel perm pats sigma target) = sep [ text "SplitClause" , nest 2 $ vcat [ text "tel = " <+> prettyTCM tel , text "perm = " <+> prettyTCM perm , text "pats = " <+> sep (map (prettyTCM . namedArg) pats) , text "subst = " <+> (text . show) sigma , text "target = " <+> do caseMaybe target empty $ \ t -> do addContext tel $ prettyTCM t -- Triggers crash (see Issue 1374). -- , text "subst target = " <+> do -- caseMaybe target empty $ \ t -> do -- addContext tel $ prettyTCM $ applySubst sigma t ] ] Agda-2.4.2.5/src/full/Agda/TypeChecking/Unquote.hs0000644000000000000000000003301212635075266017655 0ustar0000000000000000{-# LANGUAGE CPP #-} {-# LANGUAGE FlexibleInstances #-} {-# LANGUAGE PatternGuards #-} module Agda.TypeChecking.Unquote where import Control.Applicative import Control.Monad.State (evalState, get, put) import Control.Monad.Writer (execWriterT, tell) import Control.Monad.Trans (lift) import Data.Char import Data.Maybe (fromMaybe) import Data.Traversable (traverse) import Agda.Syntax.Common import Agda.Syntax.Internal as I import Agda.Syntax.Literal import Agda.Syntax.Position import Agda.Syntax.Translation.InternalToAbstract import Agda.TypeChecking.CompiledClause import Agda.TypeChecking.Datatypes ( getConHead ) import Agda.TypeChecking.DropArgs import Agda.TypeChecking.Free import Agda.TypeChecking.Level import Agda.TypeChecking.Monad import Agda.TypeChecking.Monad.Builtin import Agda.TypeChecking.Monad.Exception import Agda.TypeChecking.Pretty import Agda.TypeChecking.Reduce import Agda.TypeChecking.Reduce.Monad import Agda.TypeChecking.Substitute import Agda.Utils.Except import Agda.Utils.Impossible import Agda.Utils.Monad ( ifM ) import Agda.Utils.Permutation ( Permutation(Perm) ) import Agda.Utils.String ( Str(Str), unStr ) import Agda.Utils.VarSet (VarSet) import qualified Agda.Utils.VarSet as Set #include "undefined.h" agdaTermType :: TCM Type agdaTermType = El (mkType 0) <$> primAgdaTerm qNameType :: TCM Type qNameType = El (mkType 0) <$> primQName type UnquoteM = ExceptionT UnquoteError TCM runUnquoteM :: UnquoteM a -> TCM (Either UnquoteError a) runUnquoteM = runExceptionT isCon :: ConHead -> TCM Term -> UnquoteM Bool isCon con tm = do t <- lift tm case ignoreSharing t of Con con' _ -> return (con == con') _ -> return False {-unquoteFailedGeneric :: String -> UnquoteM a unquoteFailedGeneric msg = typeError . GenericError $ "Unable to unquote the " ++ msg unquoteFailed :: String -> String -> Term -> TCM a unquoteFailed kind msg t = do doc <- prettyTCM t unquoteFailedGeneric $ "term (" ++ show doc ++ ") of type " ++ kind ++ ".\nReason: " ++ msg ++ "." -} class Unquote a where unquote :: Term -> UnquoteM a unquoteH :: Unquote a => I.Arg Term -> UnquoteM a unquoteH a | isHidden a && isRelevant a = unquote $ unArg a unquoteH a = throwException $ BadVisibility "hidden" a unquoteN :: Unquote a => I.Arg Term -> UnquoteM a unquoteN a | notHidden a && isRelevant a = unquote $ unArg a unquoteN a = throwException $ BadVisibility "visible" a choice :: Monad m => [(m Bool, m a)] -> m a -> m a choice [] dflt = dflt choice ((mb, mx) : mxs) dflt = ifM mb mx $ choice mxs dflt ensureDef :: QName -> UnquoteM QName ensureDef x = do i <- (theDef <$> getConstInfo x) `catchError` \_ -> return Axiom -- for recursive unquoteDecl case i of Constructor{} -> do def <- lift $ prettyTCM =<< primAgdaTermDef con <- lift $ prettyTCM =<< primAgdaTermCon throwException $ ConInsteadOfDef x (show def) (show con) _ -> return x ensureCon :: QName -> UnquoteM QName ensureCon x = do i <- (theDef <$> getConstInfo x) `catchError` \_ -> return Axiom -- for recursive unquoteDecl case i of Constructor{} -> return x _ -> do def <- lift $ prettyTCM =<< primAgdaTermDef con <- lift $ prettyTCM =<< primAgdaTermCon throwException $ DefInsteadOfCon x (show def) (show con) pickName :: Type -> String pickName a = case unEl a of Pi{} -> "f" Sort{} -> "A" Def d _ | c:_ <- show (qnameName d), isAlpha c -> [toLower c] _ -> "_" instance Unquote I.ArgInfo where unquote t = do t <- lift $ reduce t case ignoreSharing t of Con c [h,r] -> do choice [(c `isCon` primArgArgInfo, ArgInfo <$> unquoteN h <*> unquoteN r <*> return [])] __IMPOSSIBLE__ Con c _ -> __IMPOSSIBLE__ _ -> throwException $ NotAConstructor "ArgInfo" t instance Unquote a => Unquote (I.Arg a) where unquote t = do t <- lift $ reduce t case ignoreSharing t of Con c [info,x] -> do choice [(c `isCon` primArgArg, Arg <$> unquoteN info <*> unquoteN x)] __IMPOSSIBLE__ Con c _ -> __IMPOSSIBLE__ _ -> throwException $ NotAConstructor "Arg" t -- Andreas, 2013-10-20: currently, post-fix projections are not part of the -- quoted syntax. instance Unquote a => Unquote (Elim' a) where unquote t = Apply <$> unquote t instance Unquote Integer where unquote t = do t <- lift $ reduce t case ignoreSharing t of Lit (LitInt _ n) -> return n _ -> throwException $ NotALiteral "Integer" t instance Unquote Double where unquote t = do t <- lift $ reduce t case ignoreSharing t of Lit (LitFloat _ x) -> return x _ -> throwException $ NotALiteral "Float" t instance Unquote Char where unquote t = do t <- lift $ reduce t case ignoreSharing t of Lit (LitChar _ x) -> return x _ -> throwException $ NotALiteral "Char" t instance Unquote Str where unquote t = do t <- lift $ reduce t case ignoreSharing t of Lit (LitString _ x) -> return (Str x) _ -> throwException $ NotALiteral "String" t instance Unquote a => Unquote [a] where unquote t = do t <- lift $ reduce t case ignoreSharing t of Con c [x,xs] -> do choice [(c `isCon` primCons, (:) <$> unquoteN x <*> unquoteN xs)] __IMPOSSIBLE__ Con c [] -> do choice [(c `isCon` primNil, return [])] __IMPOSSIBLE__ Con c _ -> __IMPOSSIBLE__ _ -> throwException $ NotAConstructor "List" t instance Unquote Hiding where unquote t = do t <- lift $ reduce t case ignoreSharing t of Con c [] -> do choice [(c `isCon` primHidden, return Hidden) ,(c `isCon` primInstance, return Instance) ,(c `isCon` primVisible, return NotHidden)] __IMPOSSIBLE__ Con c vs -> __IMPOSSIBLE__ _ -> throwException $ NotAConstructor "Hiding" t instance Unquote Relevance where unquote t = do t <- lift $ reduce t case ignoreSharing t of Con c [] -> do choice [(c `isCon` primRelevant, return Relevant) ,(c `isCon` primIrrelevant, return Irrelevant)] __IMPOSSIBLE__ Con c vs -> __IMPOSSIBLE__ _ -> throwException $ NotAConstructor "Relevance" t instance Unquote QName where unquote t = do t <- lift $ reduce t case ignoreSharing t of Lit (LitQName _ x) -> return x _ -> throwException $ NotALiteral "QName" t instance Unquote ConHead where unquote t = lift . getConHead =<< ensureCon =<< unquote t instance Unquote a => Unquote (Abs a) where unquote t = Abs "_" <$> unquote t instance Unquote Sort where unquote t = do t <- lift $ reduce t case ignoreSharing t of Con c [] -> do choice [(c `isCon` primAgdaSortUnsupported, pure $ Type $ Max [Plus 0 $ UnreducedLevel $ hackReifyToMeta])] __IMPOSSIBLE__ Con c [u] -> do choice [(c `isCon` primAgdaSortSet, Type <$> unquoteN u) ,(c `isCon` primAgdaSortLit, Type . levelMax . (:[]) . ClosedLevel <$> unquoteN u)] __IMPOSSIBLE__ Con c _ -> __IMPOSSIBLE__ _ -> throwException $ NotAConstructor "Sort" t instance Unquote Level where unquote l = Max . (:[]) . Plus 0 . UnreducedLevel <$> unquote l instance Unquote Type where unquote t = do t <- lift $ reduce t case ignoreSharing t of Con c [s, u] -> do choice [(c `isCon` primAgdaTypeEl, El <$> unquoteN s <*> unquoteN u)] __IMPOSSIBLE__ Con c _ -> __IMPOSSIBLE__ _ -> throwException $ NotAConstructor "Type" t instance Unquote Literal where unquote t = do t <- lift $ reduce t case ignoreSharing t of Con c [x] -> choice [ (c `isCon` primAgdaLitNat, LitInt noRange <$> unquoteN x) , (c `isCon` primAgdaLitFloat, LitFloat noRange <$> unquoteN x) , (c `isCon` primAgdaLitChar, LitChar noRange <$> unquoteN x) , (c `isCon` primAgdaLitString, LitString noRange . unStr <$> unquoteN x) , (c `isCon` primAgdaLitQName, LitQName noRange <$> unquoteN x) ] __IMPOSSIBLE__ Con c _ -> __IMPOSSIBLE__ _ -> throwException $ NotAConstructor "Literal" t instance Unquote Term where unquote t = do t <- lift $ reduce t case ignoreSharing t of Con c [] -> choice [(c `isCon` primAgdaTermUnsupported, pure hackReifyToMeta)] __IMPOSSIBLE__ Con c [x] -> do choice [ (c `isCon` primAgdaTermSort, Sort <$> unquoteN x) , (c `isCon` primAgdaTermLit, Lit <$> unquoteN x) ] __IMPOSSIBLE__ Con c [x, y] -> choice [ (c `isCon` primAgdaTermVar, Var <$> (fromInteger <$> unquoteN x) <*> unquoteN y) , (c `isCon` primAgdaTermCon, Con <$> unquoteN x <*> unquoteN y) , (c `isCon` primAgdaTermDef, Def <$> (ensureDef =<< unquoteN x) <*> unquoteN y) , (c `isCon` primAgdaTermLam, Lam <$> (flip setHiding defaultArgInfo <$> unquoteN x) <*> unquoteN y) , (c `isCon` primAgdaTermPi, mkPi <$> (domFromArg <$> unquoteN x) <*> unquoteN y) , (c `isCon` primAgdaTermExtLam, mkExtLam <$> unquoteN x <*> unquoteN y) ] __IMPOSSIBLE__ where mkExtLam = ExtLam mkPi a (Abs _ b) = Pi a (Abs x b) where x | 0 `freeIn` b = pickName (unDom a) | otherwise = "_" mkPi _ NoAbs{} = __IMPOSSIBLE__ Con{} -> __IMPOSSIBLE__ Lit{} -> __IMPOSSIBLE__ _ -> throwException $ NotAConstructor "Term" t instance Unquote Pattern where unquote t = do t <- lift $ reduce t case ignoreSharing t of Con c [] -> do choice [ (c `isCon` primAgdaPatVar, pure (VarP "x")) , (c `isCon` primAgdaPatAbsurd, pure (VarP "()")) , (c `isCon` primAgdaPatDot, pure (DotP hackReifyToMeta)) ] __IMPOSSIBLE__ Con c [x] -> do choice [ (c `isCon` primAgdaPatProj, ProjP <$> unquoteN x) , (c `isCon` primAgdaPatLit, LitP <$> unquoteN x) ] __IMPOSSIBLE__ Con c [x, y] -> do choice [ (c `isCon` primAgdaPatCon, flip ConP noConPatternInfo <$> unquoteN x <*> (map (fmap unnamed) <$> unquoteN y)) ] __IMPOSSIBLE__ Con c _ -> __IMPOSSIBLE__ _ -> throwException $ NotAConstructor "Pattern" t data UnquotedFunDef = UnQFun Type [Clause] instance Unquote Clause where unquote t = do t <- lift $ reduce t case ignoreSharing t of Con c [x] -> do choice [ (c `isCon` primAgdaClauseAbsurd, mkClause Nothing <$> unquoteN x) ] __IMPOSSIBLE__ Con c [x, y] -> do choice [ (c `isCon` primAgdaClauseClause, checkClause =<< mkClause . Just <$> unquoteN y <*> unquoteN x) ] __IMPOSSIBLE__ Con c _ -> __IMPOSSIBLE__ _ -> throwException $ NotAConstructor "Clause" t where mkClause :: Maybe Term -> [I.Arg Pattern] -> I.Clause mkClause b ps0 = Clause { clauseRange = noRange , clauseTel = dummyTel n' , clausePerm = Perm n vs , namedClausePats = ps , clauseBody = mkBody n b , clauseType = Nothing } where ps = map (fmap unnamed) ps0 n = vars True ps -- with dot patterns n' = vars False ps -- without dot patterns dummyTel 0 = EmptyTel dummyTel n = ExtendTel dummyDom (Abs "x" $ dummyTel (n - 1)) mkBody 0 b = maybe NoBody Body b mkBody n b = Bind $ Abs "x" $ mkBody (n - 1) b vars d ps = sum $ map (vars' d . namedArg) ps vars' d (ConP _ _ ps) = vars d ps vars' d VarP{} = 1 vars' d DotP{} = if d then 1 else 0 vars' d LitP{} = 0 vars' d ProjP{} = 0 vs = evalState (execWriterT $ mapM_ (computePerm . namedArg) ps) 0 next = do n <- get; put (n + 1); return n computePerm (ConP _ _ ps) = mapM_ (computePerm . namedArg) ps computePerm VarP{} = tell . (:[]) =<< next computePerm DotP{} = () <$ next computePerm LitP{} = return () computePerm ProjP{} = return () checkClause :: I.Clause -> UnquoteM I.Clause checkClause cl@Clause{ clausePerm = Perm n vs , clauseBody = body } = do let freevs = allFreeVars $ fromMaybe __IMPOSSIBLE__ $ getBody body propervs = Set.fromList $ map ((n-1)-) vs dottedvs = Set.difference (Set.fromList [0..n-1]) propervs offending = Set.intersection freevs dottedvs Agda.TypeChecking.Monad.reportSDoc "tc.unquote.clause.dotvars" 30 $ vcat [ text $ "checkClause " , nest 2 $ text $ "free vars: " ++ show freevs , nest 2 $ text $ "dotted vars: " ++ show dottedvs , nest 2 $ text $ "offending vars: " ++ show offending ] if Set.null offending then return cl else throwException $ RhsUsesDottedVar (Set.toList offending) t instance Unquote UnquotedFunDef where unquote t = do t <- lift $ reduce t case ignoreSharing t of Con c [x, y] -> do choice [ (c `isCon` primAgdaFunDefCon, UnQFun <$> unquoteN x <*> unquoteN y) ] __IMPOSSIBLE__ Con c _ -> __IMPOSSIBLE__ _ -> throwException $ NotAConstructor "Pattern" t reifyUnquoted :: Reify a e => a -> TCM e reifyUnquoted = nowReifyingUnquoted . disableDisplayForms . withShowAllArguments . reify Agda-2.4.2.5/src/full/Agda/TypeChecking/Positivity.hs0000644000000000000000000007361212635075266020412 0ustar0000000000000000{-# LANGUAGE CPP #-} {-# LANGUAGE FlexibleContexts #-} {-# LANGUAGE FlexibleInstances #-} {-# LANGUAGE TupleSections #-} {-# LANGUAGE UndecidableInstances #-} -- | Check that a datatype is strictly positive. module Agda.TypeChecking.Positivity where import Prelude hiding (null) import Control.Applicative hiding (empty) import Control.DeepSeq import Control.Monad.Reader import Data.Either import Data.Graph (SCC(..), flattenSCC) import Data.List as List hiding (null) import Data.Maybe (mapMaybe, fromMaybe) import Data.Map (Map) import qualified Data.Map as Map import Data.Set (Set) import qualified Data.Set as Set import Debug.Trace import Test.QuickCheck import Agda.Syntax.Position import Agda.Syntax.Common import Agda.Syntax.Internal as I import Agda.TypeChecking.Datatypes (isDataOrRecordType, DataOrRecord(..)) import Agda.TypeChecking.Records (unguardedRecord, recursiveRecord) import Agda.TypeChecking.Monad import Agda.TypeChecking.Monad.Builtin (primInf, CoinductionKit(..), coinductionKit) import Agda.TypeChecking.Reduce import Agda.TypeChecking.Positivity.Occurrence import Agda.TypeChecking.Pretty import Agda.TypeChecking.Substitute import Agda.TypeChecking.Telescope import qualified Agda.Utils.Graph.AdjacencyMap.Unidirectional as Graph import Agda.Utils.Functor import Agda.Utils.List import Agda.Utils.Maybe import Agda.Utils.Monad import Agda.Utils.Null import qualified Agda.Utils.Permutation as Perm import Agda.Utils.SemiRing import Agda.Utils.Size #include "undefined.h" import Agda.Utils.Impossible type Graph n e = Graph.Graph n n e -- | Check that the datatypes in the mutual block containing the given -- declarations are strictly positive. -- -- Also add information about positivity and recursivity of records -- to the signature. checkStrictlyPositive :: Set QName -> TCM () checkStrictlyPositive qset = disableDestructiveUpdate $ do -- compute the occurrence graph for qs let qs = Set.toList qset reportSDoc "tc.pos.tick" 100 $ text "positivity of" <+> prettyTCM qs -- remove @Unused@ edges g <- Graph.clean <$> buildOccurrenceGraph qset let gstar = Graph.gaussJordanFloydWarshallMcNaughtonYamada $ fmap occ g reportSDoc "tc.pos.tick" 100 $ text "constructed graph" reportSLn "tc.pos.graph" 5 $ "Positivity graph: N=" ++ show (size $ Graph.nodes g) ++ " E=" ++ show (length $ Graph.edges g) reportSDoc "tc.pos.graph" 10 $ vcat [ text "positivity graph for" <+> (fsep $ map prettyTCM qs) , nest 2 $ prettyTCM g ] reportSLn "tc.pos.graph" 5 $ "Positivity graph (completed): E=" ++ show (length $ Graph.edges gstar) reportSDoc "tc.pos.graph" 50 $ vcat [ text "transitive closure of positivity graph for" <+> prettyTCM qs , nest 2 $ prettyTCM gstar ] -- remember argument occurrences for qs in the signature setArgOccs qset qs gstar reportSDoc "tc.pos.tick" 100 $ text "set args" -- check positivity for all strongly connected components of the graph for qs let sccs' = Graph.sccs' gstar sccs = map flattenSCC sccs' reportSDoc "tc.pos.graph.sccs" 10 $ do let (triv, others) = partitionEithers $ for sccs' $ \ scc -> case scc of AcyclicSCC v -> Left v CyclicSCC vs -> Right vs sep [ text $ show (length triv) ++ " trivial sccs" , text $ show (length others) ++ " non-trivial sccs with lengths " ++ show (map length others) ] reportSDoc "tc.pos.graph.sccs" 15 $ text $ " sccs = " ++ show sccs forM_ sccs $ \ scc -> setMut [ q | DefNode q <- scc ] mapM_ (checkPos g gstar) $ qs reportSDoc "tc.pos.tick" 100 $ text "checked positivity" where checkPos :: Graph Node Edge -> Graph Node Occurrence -> QName -> TCM () checkPos g gstar q = inConcreteOrAbstractMode q $ do -- we check positivity only for data or record definitions whenJustM (isDatatype q) $ \ dr -> do reportSDoc "tc.pos.check" 10 $ text "Checking positivity of" <+> prettyTCM q let loop = Graph.lookup (DefNode q) (DefNode q) gstar how msg p = fsep $ [prettyTCM q] ++ pwords "is" ++ case filter (p . occ) $ -- Graph.allTrails (DefNode q) (DefNode q) g of -- exponential, see Issue 1612 Graph.allPaths (p . occ) (DefNode q) (DefNode q) g of Edge _ how : _ -> pwords (msg ++ ", because it occurs") ++ [prettyTCM how] _ -> pwords $ msg ++ "." -- For an example of code that exercises the latter, -- uninformative clause above, see -- test/fail/BadInductionRecursion5.agda. -- If a suitable StarSemiRing instance can be -- defined for Edge, then -- gaussJordanFloydWarshallMcNaughtonYamada can be -- used instead of allTrails, thus avoiding the -- uninformative clause. -- if we have a negative loop, raise error whenM positivityCheckEnabled $ case loop of Just o | p o -> do err <- how "not strictly positive" p setCurrentRange q $ typeError $ GenericDocError err where p = (<= JustPos) _ -> return () -- if we find an unguarded record, mark it as such when (dr == IsRecord) $ case loop of Just o | p o -> do reportSDoc "tc.pos.record" 5 $ how "not guarded" p unguardedRecord q checkInduction q where p = (<= StrictPos) _ -> -- otherwise, if the record is recursive, mark it as well case loop of Just o | p o -> do reportSDoc "tc.pos.record" 5 $ how "recursive" p recursiveRecord q checkInduction q where p = (== GuardPos) _ -> return () checkInduction q = whenM positivityCheckEnabled $ do -- Check whether the recursive record has been declared as -- 'Inductive' or 'Coinductive'. Otherwise, error. unlessM (isJust . recInduction . theDef <$> getConstInfo q) $ setCurrentRange (nameBindingSite $ qnameName q) $ typeError . GenericDocError =<< text "Recursive record" <+> prettyTCM q <+> text "needs to be declared as either inductive or coinductive" occ (Edge o _) = o isDatatype q = do def <- theDef <$> getConstInfo q return $ case def of Datatype{dataClause = Nothing} -> Just IsData Record {recClause = Nothing} -> Just IsRecord _ -> Nothing -- Set the mutually recursive identifiers for a SCC. setMut [] = return () -- nothing to do setMut [q] = return () -- no mutual recursion setMut qs = forM_ qs $ \ q -> setMutual q (delete q qs) -- Set the polarity of the arguments to a couple of definitions setArgOccs :: Set QName -> [QName] -> Graph Node Occurrence -> TCM () setArgOccs qset qs g = do -- Compute a map from each name in q to the maximal argument index let maxs = Map.fromListWith max [ (q, i) | ArgNode q i <- Set.toList $ Graph.sourceNodes g, q `Set.member` qset ] forM_ qs $ \ q -> inConcreteOrAbstractMode q $ do reportSDoc "tc.pos.args" 10 $ text "checking args of" <+> prettyTCM q n <- getDefArity =<< getConstInfo q -- If there is no outgoing edge @ArgNode q i@, all @n@ arguments are @Unused@. -- Otherwise, we obtain the occurrences from the Graph. let findOcc i = fromMaybe Unused $ Graph.lookup (ArgNode q i) (DefNode q) g args = caseMaybe (Map.lookup q maxs) (replicate n Unused) $ \ m -> map findOcc [0 .. max m (n - 1)] reportSDoc "tc.pos.args" 10 $ sep [ text "args of" <+> prettyTCM q <+> text "=" , nest 2 $ prettyList $ map (text . show) args ] -- The list args can take a long time to compute, but contains -- small elements, and is stored in the interface (right?), so -- it is computed deep-strictly. setArgOccurrences q $!! args getDefArity :: Definition -> TCM Int getDefArity def = case theDef def of defn@Function{} -> do let dropped = projectionArgs defn subtract dropped . arity <$> instantiateFull (defType def) Datatype{ dataPars = n } -> return n Record{ recPars = n } -> return n _ -> return 0 -- Specification of occurrences ------------------------------------------- -- See also Agda.TypeChecking.Positivity.Occurrence. -- | Description of an occurrence. data OccursWhere = LeftOfArrow OccursWhere | DefArg QName Nat OccursWhere -- ^ in the nth argument of a define constant | UnderInf OccursWhere -- ^ in the principal argument of built-in ∞ | VarArg OccursWhere -- ^ as an argument to a bound variable | MetaArg OccursWhere -- ^ as an argument of a metavariable | ConArgType QName OccursWhere -- ^ in the type of a constructor | IndArgType QName OccursWhere -- ^ in a datatype index of a constructor | InClause Nat OccursWhere -- ^ in the nth clause of a defined function | Matched OccursWhere -- ^ matched against in a clause of a defined function | InDefOf QName OccursWhere -- ^ in the definition of a constant | Here | Unknown -- ^ an unknown position (treated as negative) deriving (Show, Eq, Ord) (>*<) :: OccursWhere -> OccursWhere -> OccursWhere Here >*< o = o Unknown >*< o = Unknown LeftOfArrow o1 >*< o2 = LeftOfArrow (o1 >*< o2) DefArg d i o1 >*< o2 = DefArg d i (o1 >*< o2) UnderInf o1 >*< o2 = UnderInf (o1 >*< o2) VarArg o1 >*< o2 = VarArg (o1 >*< o2) MetaArg o1 >*< o2 = MetaArg (o1 >*< o2) ConArgType c o1 >*< o2 = ConArgType c (o1 >*< o2) IndArgType c o1 >*< o2 = IndArgType c (o1 >*< o2) InClause i o1 >*< o2 = InClause i (o1 >*< o2) Matched o1 >*< o2 = Matched (o1 >*< o2) InDefOf d o1 >*< o2 = InDefOf d (o1 >*< o2) instance PrettyTCM OccursWhere where prettyTCM o = prettyOs $ map maxOneLeftOfArrow $ uniq $ splitOnDef o where nth 0 = pwords "first" nth 1 = pwords "second" nth 2 = pwords "third" nth n = pwords $ show (n + 1) ++ "th" -- remove consecutive duplicates uniq = map head . group prettyOs [] = __IMPOSSIBLE__ prettyOs [o] = prettyO o <> text "." prettyOs (o:os) = prettyO o <> text ", which occurs" $$ prettyOs os prettyO o = case o of Here -> empty Unknown -> empty LeftOfArrow o -> explain o $ pwords "to the left of an arrow" DefArg q i o -> explain o $ pwords "in the" ++ nth i ++ pwords "argument to" ++ [prettyTCM q] UnderInf o -> do Def inf _ <- ignoreSharing <$> primInf -- this cannot fail if an 'UnderInf' has been generated explain o $ pwords "under" ++ [prettyTCM inf] VarArg o -> explain o $ pwords "in an argument to a bound variable" MetaArg o -> explain o $ pwords "in an argument to a metavariable" ConArgType c o -> explain o $ pwords "in the type of the constructor" ++ [prettyTCM c] IndArgType c o -> explain o $ pwords "in an index of the target type of the constructor" ++ [prettyTCM c] InClause i o -> explain o $ pwords "in the" ++ nth i ++ pwords "clause" Matched o -> explain o $ pwords "as matched against" InDefOf d o -> explain o $ pwords "in the definition of" ++ [prettyTCM d] explain o ds = prettyO o $$ fsep ds maxOneLeftOfArrow o = case o of LeftOfArrow o -> LeftOfArrow $ purgeArrows o Here -> Here Unknown -> Unknown DefArg q i o -> DefArg q i $ maxOneLeftOfArrow o UnderInf o -> UnderInf $ maxOneLeftOfArrow o InDefOf d o -> InDefOf d $ maxOneLeftOfArrow o VarArg o -> VarArg $ maxOneLeftOfArrow o MetaArg o -> MetaArg $ maxOneLeftOfArrow o ConArgType c o -> ConArgType c $ maxOneLeftOfArrow o IndArgType c o -> IndArgType c $ maxOneLeftOfArrow o InClause i o -> InClause i $ maxOneLeftOfArrow o Matched o -> Matched $ maxOneLeftOfArrow o purgeArrows o = case o of LeftOfArrow o -> purgeArrows o Here -> Here Unknown -> Unknown DefArg q i o -> DefArg q i $ purgeArrows o UnderInf o -> UnderInf $ purgeArrows o InDefOf d o -> InDefOf d $ purgeArrows o VarArg o -> VarArg $ purgeArrows o MetaArg o -> MetaArg $ purgeArrows o ConArgType c o -> ConArgType c $ purgeArrows o IndArgType c o -> IndArgType c $ purgeArrows o InClause i o -> InClause i $ purgeArrows o Matched o -> Matched $ purgeArrows o splitOnDef o = case o of Here -> [Here] Unknown -> [Unknown] InDefOf d o -> sp (InDefOf d) o LeftOfArrow o -> sp LeftOfArrow o DefArg q i o -> sp (DefArg q i) o UnderInf o -> sp UnderInf o VarArg o -> sp VarArg o MetaArg o -> sp MetaArg o ConArgType c o -> sp (ConArgType c) o IndArgType c o -> sp (IndArgType c) o InClause i o -> sp (InClause i) o Matched o -> sp Matched o where sp f o = case splitOnDef o of os@(InDefOf _ _:_) -> f Here : os o:os -> f o : os [] -> __IMPOSSIBLE__ -- Computing occurrences -------------------------------------------------- data Item = AnArg Nat | ADef QName deriving (Eq, Ord, Show) type Occurrences = Map Item [OccursWhere] (>+<) :: Occurrences -> Occurrences -> Occurrences (>+<) = Map.unionWith (++) concatOccurs :: [Occurrences] -> Occurrences concatOccurs = Map.unionsWith (++) occursAs :: (OccursWhere -> OccursWhere) -> Occurrences -> Occurrences occursAs f = Map.map (map f) here :: Item -> Occurrences here i = Map.singleton i [Here] -- | @onlyVarsUpTo n occs@ discards occurrences of de Bruijn index @>= n@. onlyVarsUpTo :: Nat -> Occurrences -> Occurrences onlyVarsUpTo n = Map.filterWithKey p where p (AnArg i) v = i < n p (ADef q) v = True -- | Context for computing occurrences. data OccEnv = OccEnv { vars :: [Maybe Item] -- ^ Items corresponding to the free variables. , inf :: Maybe QName -- ^ Name for ∞ builtin. } -- | Monad for computing occurrences. type OccM = Reader OccEnv withExtendedOccEnv :: Maybe Item -> OccM a -> OccM a withExtendedOccEnv i = local $ \ e -> e { vars = i : vars e } -- | Running the monad getOccurrences :: (Show a, PrettyTCM a, ComputeOccurrences a) => [Maybe Item] -> a -> TCM Occurrences getOccurrences vars a = do reportSDoc "tc.pos.occ" 70 $ text "computing occurrences in " <+> text (show a) reportSDoc "tc.pos.occ" 20 $ text "computing occurrences in " <+> prettyTCM a kit <- coinductionKit return $ runReader (occurrences a) $ OccEnv vars $ fmap nameOfInf kit class ComputeOccurrences a where occurrences :: a -> OccM Occurrences instance ComputeOccurrences Clause where occurrences cl = do let ps = clausePats cl (concatOccurs (mapMaybe matching (zip [0..] ps)) >+<) <$> walk (patItems ps) (clauseBody cl) where matching (i, p) | properlyMatching (unArg p) = Just $ occursAs Matched $ here $ AnArg i | otherwise = Nothing walk _ NoBody = return empty walk [] (Body v) = occurrences v walk (i : pis) (Bind b) = withExtendedOccEnv i $ walk pis $ absBody b walk [] Bind{} = __IMPOSSIBLE__ walk (_ : _) Body{} = __IMPOSSIBLE__ -- @patItems ps@ creates a map from the pattern variables of @ps@ -- to the index of the argument they are bound in. -- This map is given as a list. patItems ps = concat $ zipWith patItem [0..] ps -- @patItem i p@ replicates index @i@ as often as there are -- pattern variables in @p@ (dot patterns count as variable) patItem :: Int -> I.Arg Pattern -> [Maybe Item] patItem i p = map (const $ Just $ AnArg i) $ patternVars p instance ComputeOccurrences Term where occurrences v = case unSpine v of Var i args -> do vars <- asks vars occs <- occurrences args -- Apparently some development version of GHC chokes if the -- following line is replaced by vars ! i. let mi | i < length vars = vars !! i | otherwise = flip trace __IMPOSSIBLE__ $ "impossible: occurrence of de Bruijn index " ++ show i ++ " in vars " ++ show vars ++ " is unbound" return $ maybe empty here mi >+< occursAs VarArg occs Def d args -> do inf <- asks inf let occsAs = if Just d /= inf then occursAs . DefArg d else \ n -> -- the principal argument of builtin INF (∞) is the second (n==1) -- the first is a level argument (n==0, counting from 0!) if n == 1 then occursAs UnderInf else occursAs (DefArg d n) occs <- mapM occurrences args return $ here (ADef d) >+< concatOccurs (zipWith occsAs [0..] occs) Con c args -> occurrences args MetaV _ args -> occursAs MetaArg <$> occurrences args Pi a b -> do oa <- occurrences a ob <- occurrences b return $ occursAs LeftOfArrow oa >+< ob Lam _ b -> occurrences b Level l -> occurrences l Lit{} -> return empty Sort{} -> return empty DontCare _ -> return empty -- Andreas, 2011-09-09: do we need to check for negative occurrences in irrelevant positions? Shared p -> occurrences $ derefPtr p ExtLam{} -> __IMPOSSIBLE__ instance ComputeOccurrences Level where occurrences (Max as) = occurrences as instance ComputeOccurrences PlusLevel where occurrences ClosedLevel{} = return empty occurrences (Plus _ l) = occurrences l instance ComputeOccurrences LevelAtom where occurrences l = case l of MetaLevel _ vs -> occursAs MetaArg <$> occurrences vs BlockedLevel _ v -> occurrences v NeutralLevel _ v -> occurrences v UnreducedLevel v -> occurrences v instance ComputeOccurrences Type where occurrences (El _ v) = occurrences v instance ComputeOccurrences a => ComputeOccurrences (Tele a) where occurrences EmptyTel = return empty occurrences (ExtendTel a b) = occurrences (a, b) instance ComputeOccurrences a => ComputeOccurrences (Abs a) where occurrences (Abs _ b) = withExtendedOccEnv Nothing $ occurrences b occurrences (NoAbs _ b) = occurrences b instance ComputeOccurrences a => ComputeOccurrences (Elim' a) where occurrences Proj{} = __IMPOSSIBLE__ occurrences (Apply a) = occurrences a instance ComputeOccurrences a => ComputeOccurrences (I.Arg a) where occurrences = occurrences . unArg instance ComputeOccurrences a => ComputeOccurrences (I.Dom a) where occurrences = occurrences . unDom instance ComputeOccurrences a => ComputeOccurrences [a] where occurrences vs = concatOccurs <$> mapM occurrences vs instance (ComputeOccurrences a, ComputeOccurrences b) => ComputeOccurrences (a, b) where occurrences (x, y) = do ox <- occurrences x oy <- occurrences y return $ ox >+< oy -- | Compute the occurrences in a given definition. computeOccurrences :: QName -> TCM Occurrences computeOccurrences q = inConcreteOrAbstractMode q $ do reportSDoc "tc.pos" 25 $ do a <- defAbstract <$> getConstInfo q m <- asks envAbstractMode text "computeOccurrences" <+> prettyTCM q <+> text (show a) <+> text (show m) def <- getConstInfo q occursAs (InDefOf q) <$> case theDef def of Function{funClauses = cs} -> do n <- getDefArity def cs <- map (etaExpandClause n) <$> instantiateFull cs concatOccurs . zipWith (occursAs . InClause) [0..] <$> mapM (getOccurrences []) cs Datatype{dataClause = Just c} -> getOccurrences [] =<< instantiateFull c Datatype{dataPars = np, dataCons = cs} -> do -- Andreas, 2013-02-27: first, each data index occurs as matched on. TelV tel t <- telView $ defType def let xs = [np .. size tel - 1] -- argument positions corresponding to indices ioccs = concatOccurs $ map (occursAs Matched . here . AnArg) xs -- Then, we compute the occurrences in the constructor types. let conOcc c = do a <- defType <$> getConstInfo c TelV tel t <- telView' <$> normalise a -- normalization needed e.g. for test/succeed/Bush.agda let indices = case unEl t of Def _ vs -> genericDrop np vs _ -> __IMPOSSIBLE__ let tel' = telFromList $ genericDrop np $ telToList tel vars np = map (Just . AnArg) $ downFrom np (>+<) <$> (occursAs (ConArgType c) <$> getOccurrences (vars np) tel') <*> (occursAs (IndArgType c) . onlyVarsUpTo np <$> getOccurrences (vars $ size tel) indices) (>+<) ioccs <$> (concatOccurs <$> mapM conOcc cs) Record{recClause = Just c} -> getOccurrences [] =<< instantiateFull c Record{recPars = np, recTel = tel} -> do let tel' = telFromList $ genericDrop np $ telToList tel vars = map (Just . AnArg) $ downFrom np getOccurrences vars =<< instantiateFull tel' -- Arguments to other kinds of definitions are hard-wired. Constructor{} -> return empty Axiom{} -> return empty Primitive{} -> return empty -- | Eta expand a clause to have the given number of variables. -- Warning: doesn't put correct types in telescope! -- This is used instead of special treatment of lambdas -- (which was unsound: issue 121) etaExpandClause :: Nat -> Clause -> Clause etaExpandClause n c@Clause{ clauseTel = tel, clausePerm = perm, namedClausePats = ps, clauseBody = b } | m <= 0 = c | otherwise = c { namedClausePats = ps ++ genericReplicate m (defaultArg $ unnamed $ VarP underscore) , clauseBody = liftBody m b , clauseTel = telFromList $ telToList tel ++ (replicate m $ (underscore,) <$> dummyDom) -- dummyDom, not __IMPOSSIBLE__, because of debug printing. , clausePerm = Perm.liftP m perm -- Andreas, 2015-06-28 this is probably correct. } where m = n - genericLength ps bind 0 = id bind n = Bind . Abs underscore . bind (n - 1) vars = map (defaultArg . var) $ downFrom m -- vars = reverse [ defaultArg $ var i | i <- [0..m - 1] ] liftBody m (Bind b) = Bind $ fmap (liftBody m) b liftBody m NoBody = bind m NoBody liftBody m (Body v) = bind m $ Body $ raise m v `apply` vars -- Building the occurrence graph ------------------------------------------ data Node = DefNode QName | ArgNode QName Nat deriving (Eq, Ord) instance Show Node where show (DefNode q) = show q show (ArgNode q i) = show q ++ "." ++ show i instance PrettyTCM Node where prettyTCM (DefNode q) = prettyTCM q prettyTCM (ArgNode q i) = prettyTCM q <> text ("." ++ show i) instance PrettyTCM n => PrettyTCM (WithNode n Edge) where prettyTCM (WithNode n (Edge o w)) = prettyTCM o <+> prettyTCM n <+> fsep (pwords $ show w) -- | Edge labels for the positivity graph. data Edge = Edge Occurrence OccursWhere deriving (Eq, Ord, Show) instance Null Edge where null (Edge o _) = null o empty = Edge empty Unknown -- | These operations form a semiring if we quotient by the relation -- \"the 'Occurrence' components are equal\". instance SemiRing Edge where ozero = Edge ozero Unknown oone = Edge oone Unknown oplus _ e@(Edge Mixed _) = e -- dominant oplus e@(Edge Mixed _) _ = e oplus (Edge Unused _) e = e -- neutral oplus e (Edge Unused _) = e oplus (Edge JustNeg _) e@(Edge JustNeg _) = e oplus _ e@(Edge JustNeg w) = Edge Mixed w oplus e@(Edge JustNeg w) _ = Edge Mixed w oplus _ e@(Edge JustPos _) = e -- dominates strict pos. oplus e@(Edge JustPos _) _ = e oplus _ e@(Edge StrictPos _) = e -- dominates 'GuardPos' oplus e@(Edge StrictPos _) _ = e oplus (Edge GuardPos _) e@(Edge GuardPos _) = e otimes (Edge o1 w1) (Edge o2 w2) = Edge (otimes o1 o2) (w1 >*< w2) -- | As 'OccursWhere' does not have an 'oplus' we cannot do something meaningful -- for the @OccursWhere@ here. -- -- E.g. @ostar (Edge JustNeg w) = Edge Mixed (w `oplus` (w >*< w))@ -- would probably more sense, if we could do it. instance StarSemiRing Edge where ostar (Edge o w) = Edge (ostar o) w buildOccurrenceGraph :: Set QName -> TCM (Graph Node Edge) buildOccurrenceGraph qs = Graph.unionsWith oplus <$> mapM defGraph (Set.toList qs) where defGraph :: QName -> TCM (Graph Node Edge) defGraph q = do occs <- computeOccurrences q Graph.unionsWith oplus <$> do forM (Map.assocs occs) $ \ (item, occs) -> do let src = itemToNode item es <- mapM (computeEdge qs) occs return $ Graph.unionsWith oplus $ for es $ \ (tgt, w) -> Graph.singleton src tgt w where itemToNode (AnArg i) = ArgNode q i itemToNode (ADef q) = DefNode q -- | Given an 'OccursWhere' computes the target node and an 'Edge'. The first -- argument is the set of names in the current mutual block. computeEdge :: Set QName -> OccursWhere -> TCM (Node, Edge) computeEdge muts o = do (to, occ) <- mkEdge __IMPOSSIBLE__ StrictPos o return (to, Edge occ o) where mkEdge to pol o = case o of Here -> return (to, pol) Unknown -> return (to, Mixed) VarArg o -> mixed o MetaArg o -> mixed o LeftOfArrow o -> negative o DefArg d i o -> do isDR <- isDataOrRecordType d let pol' | isDR == Just IsData = GuardPos -- a datatype is guarding | otherwise = StrictPos if Set.member d muts then mkEdge (ArgNode d i) pol' o else addPol o =<< otimes pol' <$> getArgOccurrence d i {- DefArg d i o | Set.member d muts -> inArg d i o | otherwise -> addPol o =<< getArgOccurrence d i -} UnderInf o -> addPol o GuardPos -- Andreas, 2012-06-09: ∞ is guarding ConArgType _ o -> keepGoing o IndArgType _ o -> mixed o InClause _ o -> keepGoing o Matched o -> mixed o -- consider arguments matched against as used InDefOf d o -> do isDR <- isDataOrRecordType d let pol' | isDR == Just IsData = GuardPos -- a datatype is guarding | otherwise = StrictPos mkEdge (DefNode d) pol' o where keepGoing = mkEdge to pol mixed = mkEdge to Mixed negative o = mkEdge to (otimes pol JustNeg) o addPol o pol' = mkEdge to (otimes pol pol') o -- Reset polarity when changing the target node -- D: (A B -> C) generates a positive edge B --> A.1 -- even though the context is negative. inArg d i = mkEdge (ArgNode d i) StrictPos ------------------------------------------------------------------------ -- * Generators and tests ------------------------------------------------------------------------ instance Arbitrary OccursWhere where arbitrary = sized arbitraryS where arbitraryS n = oneof $ [ return Here , return Unknown ] ++ if n <= 0 then [] else [ LeftOfArrow <$> arb , DefArg <$> arbitrary <*> arbitrary <*> arb , UnderInf <$> arb , VarArg <$> arb , MetaArg <$> arb , ConArgType <$> arbitrary <*> arb , IndArgType <$> arbitrary <*> arb , InClause <$> arbitrary <*> arb , Matched <$> arb , InDefOf <$> arbitrary <*> arb ] where arb = arbitraryS (n - 1) shrink x = replaceConstructor x ++ genericShrink x where replaceConstructor Here = [] replaceConstructor Unknown = [] replaceConstructor _ = [Here, Unknown] genericShrink (LeftOfArrow a) = a : [ LeftOfArrow a | a <- shrink a ] genericShrink (DefArg a b c) = c : [ DefArg a b c | c <- shrink c ] genericShrink (UnderInf a) = a : [ UnderInf a | a <- shrink a ] genericShrink (VarArg a) = a : [ VarArg a | a <- shrink a ] genericShrink (MetaArg a) = a : [ MetaArg a | a <- shrink a ] genericShrink (ConArgType a b) = b : [ ConArgType a b | b <- shrink b ] genericShrink (IndArgType a b) = b : [ IndArgType a b | b <- shrink b ] genericShrink (InClause a b) = b : [ InClause a b | b <- shrink b ] genericShrink (Matched a) = a : [ Matched a | a <- shrink a ] genericShrink (InDefOf a b) = b : [ InDefOf a b | b <- shrink b ] genericShrink Here = [] genericShrink Unknown = [] instance CoArbitrary OccursWhere where coarbitrary (LeftOfArrow a) = variant 0 . coarbitrary a coarbitrary (DefArg a b c) = variant 1 . coarbitrary (a, b, c) coarbitrary (UnderInf a) = variant 2 . coarbitrary a coarbitrary (VarArg a) = variant 3 . coarbitrary a coarbitrary (MetaArg a) = variant 4 . coarbitrary a coarbitrary (ConArgType a b) = variant 5 . coarbitrary (a, b) coarbitrary (IndArgType a b) = variant 6 . coarbitrary (a, b) coarbitrary (InClause a b) = variant 7 . coarbitrary (a, b) coarbitrary (Matched a) = variant 8 . coarbitrary a coarbitrary (InDefOf a b) = variant 9 . coarbitrary (a, b) coarbitrary Here = variant 10 coarbitrary Unknown = variant 11 instance Arbitrary Edge where arbitrary = Edge <$> arbitrary <*> arbitrary shrink (Edge o w) = [ Edge o w | o <- shrink o ] ++ [ Edge o w | w <- shrink w ] instance CoArbitrary Edge where coarbitrary (Edge o w) = coarbitrary (o, w) -- properties moved to Agda.TypeChecking.Positivity.Tests Agda-2.4.2.5/src/full/Agda/TypeChecking/Level.hs-boot0000644000000000000000000000020212635075266020220 0ustar0000000000000000 module Agda.TypeChecking.Level where import Agda.TypeChecking.Monad import Agda.Syntax.Internal levelView :: Term -> TCM Level Agda-2.4.2.5/src/full/Agda/TypeChecking/ProjectionLike.hs-boot0000644000000000000000000000031612635075266022100 0ustar0000000000000000module Agda.TypeChecking.ProjectionLike where import Agda.Syntax.Abstract.Name (QName) import Agda.TypeChecking.Monad.Base makeProjection :: QName -> TCM () eligibleForProjectionLike :: QName -> TCM Bool Agda-2.4.2.5/src/full/Agda/TypeChecking/DisplayForm.hs0000644000000000000000000001327012635075266020452 0ustar0000000000000000{-# LANGUAGE CPP #-} {-# LANGUAGE FlexibleInstances #-} -- | Tools for 'DisplayTerm' and 'DisplayForm'. module Agda.TypeChecking.DisplayForm where import Control.Applicative import Control.Monad import Control.Monad.Trans.Maybe import Data.Traversable (traverse) import Agda.Syntax.Common hiding (Arg, Dom, NamedArg, ArgInfo) import Agda.Syntax.Internal import Agda.Syntax.Scope.Base (inverseScopeLookupName) import Agda.TypeChecking.Monad import Agda.TypeChecking.Substitute import Agda.TypeChecking.Level import Agda.Utils.List import Agda.Utils.Maybe #include "undefined.h" import Agda.Utils.Impossible -- | Convert a 'DisplayTerm' into a 'Term'. dtermToTerm :: DisplayTerm -> Term dtermToTerm dt = case dt of DWithApp d ds vs -> dtermToTerm d `apply` (map (defaultArg . dtermToTerm) ds ++ vs) DCon c args -> Con c $ map (fmap dtermToTerm) args DDef f es -> Def f $ map (fmap dtermToTerm) es DDot v -> v DTerm v -> v -- | Get the arities of all display forms for a name. displayFormArities :: QName -> TCM [Int] displayFormArities q = map (length . dfPats . openThing) . defDisplay <$> getConstInfo q -- | Find a matching display form for @q vs@. -- In essence this tries to reqwrite @q vs@ with any -- display form @q ps --> dt@ and returns the instantiated -- @dt@ if successful. First match wins. displayForm :: QName -> Args -> TCM (Maybe DisplayTerm) displayForm q vs = do -- Get display forms for name q. odfs <- defDisplay <$> getConstInfo q -- Display debug info about the @Open@s. unless (null odfs) $ verboseS "tc.display.top" 100 $ do n <- getContextId reportSLn "tc.display.top" 100 $ "displayForm: context = " ++ show n ++ ", dfs = " ++ show (map openThingCtxIds odfs) -- Use only the display forms that can be opened in the current context. dfs <- catMaybes <$> mapM tryOpen odfs scope <- getScope -- Keep the display forms that match the application @c vs@. ms <- do ms <- mapM (runMaybeT . (`matchDisplayForm` vs)) dfs return [ m | Just m <- ms, inScope scope m ] -- Not safe when printing non-terminating terms. -- (nfdfs, us) <- normalise (dfs, vs) unless (null odfs) $ reportSLn "tc.display.top" 100 $ unlines [ "name : " ++ show q , "displayForms: " ++ show dfs , "arguments : " ++ show vs , "matches : " ++ show ms , "result : " ++ show (headMaybe ms) ] -- Return the first display form that matches. return $ headMaybe ms -- Andreas, 2014-06-11: The following error swallowing -- is potentially harmful, making debugging harder. -- I removed it, and it does not cause problems on the test suite. -- `catchError` \_ -> return Nothing where -- 'hd' is only used in the commented-out code for 'inScope' above. inScope _ d | isWithDisplay d = True inScope scope d = case hd d of Just h -> not . null $ inverseScopeLookupName h scope Nothing -> __IMPOSSIBLE__ -- TODO: currently all display forms have heads isWithDisplay DWithApp{} = True isWithDisplay _ = False hd (DTerm (Def x _)) = Just x hd (DTerm (Con x _)) = Just $ conName x hd (DTerm (Shared p)) = hd (DTerm $ derefPtr p) hd (DWithApp d _ _) = hd d hd _ = Nothing -- | Match a 'DisplayForm' @q ps = v@ against @q vs@. -- Return the 'DisplayTerm' @v[us]@ if the match was successful, -- i.e., @vs / ps = Just us@. matchDisplayForm :: DisplayForm -> Args -> MaybeT TCM DisplayTerm matchDisplayForm (Display _ ps v) vs | length ps > length vs = mzero | otherwise = do let (vs0, vs1) = splitAt (length ps) vs us <- match ps $ raise 1 $ map unArg vs0 return $ applySubst (parallelS $ reverse us) v `apply` vs1 -- | Class @Match@ for matching a term @p@ in the role of a pattern -- against a term @v@. -- -- The 0th variable in @p@ plays the role -- of a place holder (pattern variable). Each occurrence of -- @var 0@ in @p@ stands for a different pattern variable. -- -- The result of matching, if successful, is a list of solutions for the -- pattern variables, in left-to-right order. -- -- The 0th variable is in scope in the input @v@, but should not -- actually occur! -- In the output solution, the @0th@ variable is no longer in scope. -- (It has been substituted by __IMPOSSIBLE__ which corresponds to -- a raise by -1). class Match a where match :: a -> a -> MaybeT TCM [Term] instance Match a => Match [a] where match xs ys = concat <$> zipWithM match xs ys instance Match a => Match (Arg a) where match p v = match (unArg p) (unArg v) instance Match a => Match (Elim' a) where match p v = case (p, v) of (Proj f, Proj f') | f == f' -> return [] (Apply a, Apply a') -> match a a' _ -> mzero instance Match Term where match p v = case (ignoreSharing p, ignoreSharing v) of (Var 0 [], v) -> return [strengthen __IMPOSSIBLE__ v] (Var i ps, Var j vs) | i == j -> match ps vs (Def c ps, Def d vs) | c == d -> match ps vs (Con c ps, Con d vs) | c == d -> match ps vs (Lit l, Lit l') | l == l' -> return [] (p, v) | p == v -> return [] (p, Level l) -> match p =<< reallyUnLevelView l (Sort ps, Sort pv) -> match ps pv (p, Sort (Type v)) -> match p =<< reallyUnLevelView v _ -> mzero instance Match Sort where match p v = case (p, v) of (Type pl, Type vl) -> match pl vl _ | p == v -> return [] _ -> mzero instance Match Level where match p v = do p <- reallyUnLevelView p v <- reallyUnLevelView v match p v Agda-2.4.2.5/src/full/Agda/TypeChecking/SizedTypes.hs0000644000000000000000000006206112635075266020326 0ustar0000000000000000{-# LANGUAGE CPP #-} {-# LANGUAGE NondecreasingIndentation #-} {-# LANGUAGE PatternGuards #-} module Agda.TypeChecking.SizedTypes where import Prelude hiding (null) import Control.Monad.Writer import Data.Function import Data.List hiding (null) import qualified Data.Map as Map import Data.Monoid import Agda.Interaction.Options import Agda.Syntax.Common import Agda.Syntax.Internal import Agda.TypeChecking.Monad import Agda.TypeChecking.Monad.Builtin import Agda.TypeChecking.Pretty import Agda.TypeChecking.Reduce import {-# SOURCE #-} Agda.TypeChecking.MetaVars import Agda.TypeChecking.Substitute import Agda.TypeChecking.Telescope import {-# SOURCE #-} Agda.TypeChecking.Conversion import {-# SOURCE #-} Agda.TypeChecking.Constraints import Agda.Utils.Except ( MonadError(catchError, throwError) ) import Agda.Utils.List as List import Agda.Utils.Maybe import Agda.Utils.Monad import Agda.Utils.Null import Agda.Utils.Size import Agda.Utils.Tuple import qualified Agda.Utils.Warshall as W #include "undefined.h" import Agda.Utils.Impossible ------------------------------------------------------------------------ -- * SIZELT stuff ------------------------------------------------------------------------ -- | Check whether a type is either not a SIZELT or a SIZELT that is non-empty. checkSizeLtSat :: Type -> TCM () checkSizeLtSat t = do reportSDoc "tc.size" 10 $ sep [ text "checking that " <+> prettyTCM t <+> text " is not an empty type of sizes" , text "in context " <+> do inTopContext . prettyTCM =<< getContextTelescope ] let postpone t = addConstraint $ CheckSizeLtSat t ifBlockedType t (const postpone) $ \ t -> do caseMaybeM (isSizeType t) (return ()) $ \ b -> do case b of BoundedNo -> return () BoundedLt b -> do ifBlocked b (\ _ _ -> postpone t) $ \ b -> do catchConstraint (CheckSizeLtSat t) $ do unlessM (checkSizeNeverZero b) $ do typeError . GenericDocError =<< do text "Possibly empty type of sizes " <+> prettyTCM t -- | Precondition: Term is reduced and not blocked. -- Throws a 'patternViolation' if undecided checkSizeNeverZero :: Term -> TCM Bool checkSizeNeverZero u = do v <- sizeView u case v of SizeInf -> return True -- OK, infty is never 0. SizeSuc{} -> return True -- OK, a + 1 is never 0. OtherSize u -> case ignoreSharing u of Var i [] -> checkSizeVarNeverZero i -- neutral sizes cannot be guaranteed > 0 _ -> return False -- -- | A size variable is never zero if it is the strict upper bound of -- -- some other size variable in context. -- -- Eg. @i : Size, j : Size< i@ |- i is never zero. -- -- Throws a 'patternViolation' if undecided. -- checkSizeVarNeverZero :: Int -> TCM Bool -- checkSizeVarNeverZero i = do -- -- Looking for a variable j : Size< i, we can restrict to the last i -- -- entries, as this variable necessarily has been defined later than i. -- doms <- take i <$> getContext -- -- We raise each type to make sense in the current context. -- let ts = zipWith raise [1..] $ map (snd . unDom) doms -- reportSDoc "tc.size" 15 $ sep -- [ text "checking that size " <+> prettyTCM (var i) <+> text " is never 0" -- , text "in context " <+> do sep $ map prettyTCM ts -- ] -- foldr f (return False) ts -- where -- f t cont = do -- -- If we encounter a blocked type in the context, we cannot -- -- definitely say no. -- let yes = return True -- no = cont -- perhaps = cont >>= \ res -> if res then return res else patternViolation -- ifBlockedType t (\ _ _ -> perhaps) $ \ t -> do -- caseMaybeM (isSizeType t) no $ \ b -> do -- case b of -- BoundedNo -> no -- BoundedLt u -> ifBlocked u (\ _ _ -> perhaps) $ \ u -> do -- case ignoreSharing u of -- Var i' [] | i == i' -> yes -- _ -> no -- | Checks that a size variable is ensured to be @> 0@. -- E.g. variable @i@ cannot be zero in context -- @(i : Size) (j : Size< ↑ ↑ i) (k : Size< j) (k' : Size< k)@. -- Throws a 'patternViolation' if undecided. checkSizeVarNeverZero :: Int -> TCM Bool checkSizeVarNeverZero i = do reportSDoc "tc.size" 20 $ text "checkSizeVarNeverZero" <+> prettyTCM (var i) -- Looking for the minimal value for size variable i, -- we can restrict to the last i -- entries, as only these can contain i in an upper bound. ts <- map (snd . unDom) . take i <$> getContext -- If we encountered a blocking meta in the context, we cannot -- say ``no'' for sure. (n, Any meta) <- runWriterT $ minSizeValAux ts $ repeat 0 if n > 0 then return True else if meta then patternViolation else return False where -- Compute the least valuation for size context ts above the -- given valuation and return its last value. minSizeValAux :: [Type] -> [Int] -> WriterT Any TCM Int minSizeValAux _ [] = __IMPOSSIBLE__ minSizeValAux [] (n : _) = return n minSizeValAux (t : ts) (n : ns) = do reportSDoc "tc.size" 60 $ text ("minSizeVal (n:ns) = " ++ show (take (length ts + 2) $ n:ns) ++ " t =") <+> (text . show) t -- prettyTCM t -- Wrong context! -- n is the min. value for variable 0 which has type t. let cont = minSizeValAux ts ns perhaps = tell (Any True) >> cont -- If we encounter a blocked type in the context, we cannot -- give a definite answer. ifBlockedType t (\ _ _ -> perhaps) $ \ t -> do caseMaybeM (liftTCM $ isSizeType t) cont $ \ b -> do case b of BoundedNo -> cont BoundedLt u -> ifBlocked u (\ _ _ -> perhaps) $ \ u -> do reportSLn "tc.size" 60 $ "minSizeVal upper bound u = " ++ show u v <- liftTCM $ deepSizeView u case v of -- Variable 0 has bound @(< j + m)@ -- meaning that @minval(j) > n - m@, i.e., @minval(j) >= n+1-m@. -- Thus, we update the min value for @j@ with function @(max (n+1-m))@. DSizeVar j m -> do reportSLn "tc.size" 60 $ "minSizeVal upper bound v = " ++ show v let ns' = List.updateAt j (max $ n+1-m) ns reportSLn "tc.size" 60 $ "minSizeVal ns' = " ++ show (take (length ts + 1) ns') minSizeValAux ts ns' DSizeMeta{} -> perhaps _ -> cont -- | Check whether a variable in the context is bounded by a size expression. -- If @x : Size< a@, then @a@ is returned. isBounded :: MonadTCM tcm => Nat -> tcm BoundedSize isBounded i = liftTCM $ do t <- reduce =<< typeOfBV i case ignoreSharing $ unEl t of Def x [Apply u] -> do sizelt <- getBuiltin' builtinSizeLt return $ if (Just (Def x []) == sizelt) then BoundedLt $ unArg u else BoundedNo _ -> return BoundedNo -- | Whenever we create a bounded size meta, add a constraint -- expressing the bound. -- In @boundedSizeMetaHook v tel a@, @tel@ includes the current context. boundedSizeMetaHook :: Term -> Telescope -> Type -> TCM () boundedSizeMetaHook v tel0 a = do res <- isSizeType a case res of Just (BoundedLt u) -> do n <- getContextSize let tel | n > 0 = telFromList $ genericDrop n $ telToList tel0 | otherwise = tel0 addCtxTel tel $ do v <- sizeSuc 1 $ raise (size tel) v `apply` teleArgs tel -- compareSizes CmpLeq v u size <- sizeType addConstraint $ ValueCmp CmpLeq size v u _ -> return () -- | @trySizeUniv cmp t m n x els1 y els2@ -- is called as a last resort when conversion checking @m `cmp` n : t@ -- failed for definitions @m = x els1@ and @n = y els2@, -- where the heads @x@ and @y@ are not equal. -- -- @trySizeUniv@ accounts for subtyping between SIZELT and SIZE, -- like @Size< i =< Size@. -- -- If it does not succeed it reports failure of conversion check. trySizeUniv :: Comparison -> Type -> Term -> Term -> QName -> Elims -> QName -> Elims -> TCM () trySizeUniv cmp t m n x els1 y els2 = do let failure = typeError $ UnequalTerms cmp m n t forceInfty u = compareSizes CmpEq (unArg u) =<< primSizeInf -- Get the SIZE built-ins. (size, sizelt) <- flip catchError (const failure) $ do Def size _ <- ignoreSharing <$> primSize Def sizelt _ <- ignoreSharing <$> primSizeLt return (size, sizelt) case (cmp, els1, els2) of -- Case @Size< _ <= Size@: true. (CmpLeq, [_], []) | x == sizelt && y == size -> return () -- Case @Size< u = Size@: forces @u = ∞@. (_, [Apply u], []) | x == sizelt && y == size -> forceInfty u (_, [], [Apply u]) | x == size && y == sizelt -> forceInfty u -- This covers all cases for SIZE and SIZELT. -- The remaining case is for @x@ and @y@ which are not size built-ins. _ -> failure ------------------------------------------------------------------------ -- * Size views that 'reduce'. ------------------------------------------------------------------------ -- | Compute the deep size view of a term. -- Precondition: sized types are enabled. deepSizeView :: Term -> TCM DeepSizeView deepSizeView v = do Def inf [] <- ignoreSharing <$> primSizeInf Def suc [] <- ignoreSharing <$> primSizeSuc let loop v = do v <- reduce v case ignoreSharing v of Def x [] | x == inf -> return $ DSizeInf Def x [Apply u] | x == suc -> sizeViewSuc_ suc <$> loop (unArg u) Var i [] -> return $ DSizeVar i 0 MetaV x us -> return $ DSizeMeta x us 0 _ -> return $ DOtherSize v loop v sizeMaxView :: Term -> TCM SizeMaxView sizeMaxView v = do inf <- getBuiltinDefName builtinSizeInf suc <- getBuiltinDefName builtinSizeSuc max <- getBuiltinDefName builtinSizeMax let loop v = do v <- reduce v case v of Def x [] | Just x == inf -> return $ [DSizeInf] Def x [Apply u] | Just x == suc -> maxViewSuc_ (fromJust suc) <$> loop (unArg u) Def x [Apply u1, Apply u2] | Just x == max -> maxViewMax <$> loop (unArg u1) <*> loop (unArg u2) Var i [] -> return $ [DSizeVar i 0] MetaV x us -> return $ [DSizeMeta x us 0] _ -> return $ [DOtherSize v] loop v ------------------------------------------------------------------------ -- * Size comparison that might add constraints. ------------------------------------------------------------------------ -- | Compare two sizes. compareSizes :: Comparison -> Term -> Term -> TCM () compareSizes cmp u v = do reportSDoc "tc.conv.size" 10 $ vcat [ text "Comparing sizes" , nest 2 $ sep [ prettyTCM u <+> prettyTCM cmp , prettyTCM v ] ] verboseS "tc.conv.size" 60 $ do u <- reduce u v <- reduce v reportSDoc "tc.conv.size" 60 $ nest 2 $ sep [ text (show u) <+> prettyTCM cmp , text (show v) ] us <- sizeMaxView u vs <- sizeMaxView v compareMaxViews cmp us vs -- | Compare two sizes in max view. compareMaxViews :: Comparison -> SizeMaxView -> SizeMaxView -> TCM () compareMaxViews cmp us vs = case (cmp, us, vs) of (CmpLeq, _, (DSizeInf : _)) -> return () (cmp, [u], [v]) -> compareSizeViews cmp u v (CmpLeq, us, [v]) -> forM_ us $ \ u -> compareSizeViews cmp u v (CmpLeq, us, vs) -> forM_ us $ \ u -> compareBelowMax u vs (CmpEq, us, vs) -> compareMaxViews CmpLeq us vs >> compareMaxViews CmpLeq vs us -- | @compareBelowMax u vs@ checks @u <= max vs@. Precondition: @size vs >= 2@ compareBelowMax :: DeepSizeView -> SizeMaxView -> TCM () compareBelowMax u vs = alt (dontAssignMetas $ alts $ map (compareSizeViews CmpLeq u) vs) $ do u <- unDeepSizeView u v <- unMaxView vs size <- sizeType addConstraint $ ValueCmp CmpLeq size u v where alt c1 c2 = c1 `catchError` const c2 alts [] = __IMPOSSIBLE__ alts [c] = c alts (c:cs) = c `alt` alts cs compareSizeViews :: Comparison -> DeepSizeView -> DeepSizeView -> TCM () compareSizeViews cmp s1' s2' = do size <- sizeType let (s1, s2) = removeSucs (s1', s2') withUnView cont = do u <- unDeepSizeView s1 v <- unDeepSizeView s2 cont u v failure = withUnView $ \ u v -> typeError $ UnequalTerms cmp u v size continue cmp = withUnView $ compareAtom cmp size case (cmp, s1, s2) of (CmpLeq, _, DSizeInf) -> return () (CmpEq, DSizeInf, DSizeInf) -> return () (CmpEq, DSizeVar{}, DSizeInf) -> failure (_ , DSizeInf, DSizeVar{}) -> failure (_ , DSizeInf, _ ) -> continue CmpEq (CmpLeq, DSizeVar i n, DSizeVar j m) | i == j -> unless (n <= m) failure (CmpLeq, DSizeVar i n, DSizeVar j m) | i /= j -> do res <- isBounded i case res of BoundedNo -> failure BoundedLt u' -> do -- now we have i < u', in the worst case i+1 = u' -- and we want to check i+n <= v v <- unDeepSizeView s2 if n > 0 then do u'' <- sizeSuc (n - 1) u' compareSizes cmp u'' v else compareSizes cmp u' =<< sizeSuc 1 v (CmpLeq, s1, s2) -> withUnView $ \ u v -> do unlessM (trivial u v) $ addConstraint $ ValueCmp CmpLeq size u v (CmpEq, s1, s2) -> continue cmp -- | Checked whether a size constraint is trivial (like @X <= X+1@). trivial :: Term -> Term -> TCM Bool trivial u v = do a@(e , n ) <- sizeExpr u b@(e', n') <- sizeExpr v let triv = e == e' && n <= n' -- Andreas, 2012-02-24 filtering out more trivial constraints fixes -- test/lib-succeed/SizeInconsistentMeta4.agda reportSDoc "tc.conv.size" 60 $ nest 2 $ sep [ if triv then text "trivial constraint" else empty , text (show a) <+> text "<=" , text (show b) ] return triv `catchError` \_ -> return False ------------------------------------------------------------------------ -- * Size constraints. ------------------------------------------------------------------------ -- | Test whether a problem consists only of size constraints. isSizeProblem :: ProblemId -> TCM Bool isSizeProblem pid = andM . map (isSizeConstraint . theConstraint) =<< getConstraintsForProblem pid -- | Test is a constraint speaks about sizes. isSizeConstraint :: Closure Constraint -> TCM Bool isSizeConstraint Closure{ clValue = ValueCmp _ s _ _ } = isJust <$> isSizeType s isSizeConstraint _ = return False -- | Find the size constraints. getSizeConstraints :: TCM [Closure Constraint] getSizeConstraints = do test <- isSizeTypeTest let sizeConstraint cl@Closure{ clValue = ValueCmp CmpLeq s _ _ } | isJust (test s) = Just cl sizeConstraint _ = Nothing mapMaybe (sizeConstraint . theConstraint) <$> getAllConstraints -- | Return a list of size metas and their context. getSizeMetas :: Bool -> TCM [(MetaId, Type, Telescope)] getSizeMetas interactionMetas = do test <- isSizeTypeTest catMaybes <$> do getOpenMetas >>= do mapM $ \ m -> do let no = return Nothing mi <- lookupMeta m case mvJudgement mi of HasType _ a -> do TelV tel b <- telView a -- b is reduced caseMaybe (test b) no $ \ _ -> do let yes = return $ Just (m, a, tel) if interactionMetas then yes else do ifM (isJust <$> isInteractionMeta m) no yes _ -> no {- ROLLED BACK getSizeMetas :: TCM ([(MetaId, Int)], [SizeConstraint]) getSizeMetas = do ms <- getOpenMetas test <- isSizeTypeTest let sizeCon m = do let nothing = return ([], []) mi <- lookupMeta m case mvJudgement mi of HasType _ a -> do TelV tel b <- telView =<< instantiateFull a let noConstr = return ([(m, size tel)], []) case test b of Nothing -> nothing Just BoundedNo -> noConstr Just (BoundedLt u) -> noConstr {- WORKS NOT Just (BoundedLt u) -> flip catchError (const $ noConstr) $ do -- we assume the metavariable is used in an -- extension of its creation context ctxIds <- getContextId let a = SizeMeta m $ take (size tel) $ reverse ctxIds (b, n) <- sizeExpr u return ([(m, size tel)], [Leq a (n-1) b]) -} _ -> nothing (mss, css) <- unzip <$> mapM sizeCon ms return (concat mss, concat css) -} ------------------------------------------------------------------------ -- * Size constraint solving. ------------------------------------------------------------------------ -- | Atomic size expressions. data SizeExpr = SizeMeta MetaId [Int] -- ^ A size meta applied to de Bruijn levels. | Rigid Int -- ^ A de Bruijn level. deriving (Eq) instance Show SizeExpr where show (SizeMeta m _) = "X" ++ show (fromIntegral m :: Int) show (Rigid i) = "c" ++ show i -- | Size constraints we can solve. data SizeConstraint = Leq SizeExpr Int SizeExpr -- ^ @Leq a +n b@ represents @a =< b + n@. -- @Leq a -n b@ represents @a + n =< b@. instance Show SizeConstraint where show (Leq a n b) | n == 0 = show a ++ " =< " ++ show b | n > 0 = show a ++ " =< " ++ show b ++ " + " ++ show n | otherwise = show a ++ " + " ++ show (-n) ++ " =< " ++ show b -- | Compute a set of size constraints that all live in the same context -- from constraints over terms of type size that may live in different -- contexts. -- -- cf. 'Agda.TypeChecking.LevelConstraints.simplifyLevelConstraint' computeSizeConstraints :: [Closure Constraint] -> TCM [SizeConstraint] computeSizeConstraints [] = return [] -- special case to avoid maximum [] computeSizeConstraints cs = catMaybes <$> mapM computeSizeConstraint leqs where -- get the constraints plus contexts they are defined in gammas = map (envContext . clEnv) cs ls = map clValue cs -- compute the longest context (common water level) -- gamma = maximumBy (compare `on` size) gammas -- waterLevel = size gamma ns = map size gammas waterLevel = maximum ns -- convert deBruijn indices to deBruijn levels to -- enable comparing constraints under different contexts -- leqs = zipWith raise (map ((waterLevel -) . size) gammas) ls leqs = zipWith raise (map (waterLevel -) ns) ls -- | Turn a constraint over de Bruijn levels into a size constraint. computeSizeConstraint :: Constraint -> TCM (Maybe SizeConstraint) computeSizeConstraint c = case c of ValueCmp CmpLeq _ u v -> do reportSDoc "tc.size.solve" 50 $ sep [ text "converting size constraint" , prettyTCM c ] (a, n) <- sizeExpr u (b, m) <- sizeExpr v return $ Just $ Leq a (m - n) b `catchError` \ err -> case err of PatternErr{} -> return Nothing _ -> throwError err _ -> __IMPOSSIBLE__ -- | Turn a term with de Bruijn levels into a size expression with offset. -- -- Throws a 'patternViolation' if the term isn't a proper size expression. sizeExpr :: Term -> TCM (SizeExpr, Int) sizeExpr u = do u <- reduce u -- Andreas, 2009-02-09. -- This is necessary to surface the solutions of metavariables. reportSDoc "tc.conv.size" 60 $ text "sizeExpr:" <+> prettyTCM u s <- sizeView u case s of SizeInf -> patternViolation SizeSuc u -> mapSnd (+1) <$> sizeExpr u OtherSize u -> case ignoreSharing u of Var i [] -> return (Rigid i, 0) -- i is already a de Bruijn level. MetaV m es | Just xs <- mapM isVar es, fastDistinct xs -> return (SizeMeta m xs, 0) _ -> patternViolation where isVar (Proj{}) = Nothing isVar (Apply v) = case ignoreSharing $ unArg v of Var i [] -> Just i _ -> Nothing -- | Compute list of size metavariables with their arguments -- appearing in a constraint. flexibleVariables :: SizeConstraint -> [(MetaId, [Int])] flexibleVariables (Leq a _ b) = flex a ++ flex b where flex (Rigid _) = [] flex (SizeMeta m xs) = [(m, xs)] -- | Convert size constraint into form where each meta is applied -- to levels @0,1,..,n-1@ where @n@ is the arity of that meta. -- -- @X[σ] <= t@ beomes @X[id] <= t[σ^-1]@ -- -- @X[σ] ≤ Y[τ]@ becomes @X[id] ≤ Y[τ[σ^-1]]@ or @X[σ[τ^1]] ≤ Y[id]@ -- whichever is defined. If none is defined, we give up. -- canonicalizeSizeConstraint :: SizeConstraint -> Maybe SizeConstraint canonicalizeSizeConstraint c@(Leq a n b) = case (a,b) of (Rigid{}, Rigid{}) -> return c (SizeMeta m xs, Rigid i) -> do j <- findIndex (==i) xs return $ Leq (SizeMeta m [0..size xs-1]) n (Rigid j) (Rigid i, SizeMeta m xs) -> do j <- findIndex (==i) xs return $ Leq (Rigid j) n (SizeMeta m [0..size xs-1]) (SizeMeta m xs, SizeMeta l ys) -- try to invert xs on ys | Just ys' <- mapM (\ y -> findIndex (==y) xs) ys -> return $ Leq (SizeMeta m [0..size xs-1]) n (SizeMeta l ys') -- try to invert ys on xs | Just xs' <- mapM (\ x -> findIndex (==x) ys) xs -> return $ Leq (SizeMeta m xs') n (SizeMeta l [0..size ys-1]) -- give up | otherwise -> Nothing -- | Main function. solveSizeConstraints :: TCM () solveSizeConstraints = whenM haveSizedTypes $ do reportSLn "tc.size.solve" 70 $ "Considering to solve size constraints" cs0 <- getSizeConstraints cs <- computeSizeConstraints cs0 ms <- getSizeMetas True -- get all size metas, also interaction metas when (not (null cs) || not (null ms)) $ do reportSLn "tc.size.solve" 10 $ "Solving size constraints " ++ show cs cs <- return $ mapMaybe canonicalizeSizeConstraint cs reportSLn "tc.size.solve" 10 $ "Canonicalized constraints: " ++ show cs let -- Error for giving up cannotSolve = typeError . GenericDocError =<< vcat (text "Cannot solve size constraints" : map prettyTCM cs0) -- Size metas in constraints. metas0 :: [(MetaId, Int)] -- meta id + arity metas0 = nub $ map (mapSnd length) $ concatMap flexibleVariables cs -- Unconstrained size metas that do not occur in constraints. metas1 :: [(MetaId, Int)] metas1 = forMaybe ms $ \ (m, _, tel) -> maybe (Just (m, size tel)) (const Nothing) $ lookup m metas0 -- All size metas metas = metas0 ++ metas1 reportSLn "tc.size.solve" 15 $ "Metas: " ++ show metas0 ++ ", " ++ show metas1 verboseS "tc.size.solve" 20 $ -- debug print the type of all size metas forM_ metas $ \ (m, _) -> reportSDoc "tc.size.solve" 20 $ prettyTCM =<< mvJudgement <$> lookupMeta m -- Run the solver. unlessM (oldSolver metas cs) cannotSolve -- Double-checking the solution. -- Andreas, 2012-09-19 -- The returned solution might not be consistent with -- the hypotheses on rigid vars (j : Size< i). -- Thus, we double check that all size constraints -- have been solved correctly. flip catchError (const cannotSolve) $ noConstraints $ forM_ cs0 $ \ cl -> enterClosure cl solveConstraint -- | Old solver for size constraints using "Agda.Utils.Warshall". oldSolver :: [(MetaId, Int)] -- ^ Size metas and their arity. -> [SizeConstraint] -- ^ Size constraints (in preprocessed form). -> TCM Bool -- ^ Returns @False@ if solver fails. oldSolver metas cs = do let cannotSolve = return False mkFlex (m, ar) = W.NewFlex (fromIntegral m) $ \ i -> fromIntegral i < ar mkConstr (Leq a n b) = W.Arc (mkNode a) n (mkNode b) mkNode (Rigid i) = W.Rigid $ W.RVar i mkNode (SizeMeta m _) = W.Flex $ fromIntegral m -- run the Warshall solver case W.solve $ map mkFlex metas ++ map mkConstr cs of Nothing -> cannotSolve Just sol -> do reportSLn "tc.size.solve" 10 $ "Solved constraints: " ++ show sol s <- primSizeSuc infty <- primSizeInf let suc v = s `apply` [defaultArg v] plus v 0 = v plus v n = suc $ plus v (n - 1) inst (i, e) = do let m = fromIntegral i -- meta variable identifier ar = fromMaybe __IMPOSSIBLE__ $ lookup m metas -- meta var arity term (W.SizeConst W.Infinite) = infty term (W.SizeVar j n) | j < ar = plus (var $ ar - j - 1) n term _ = __IMPOSSIBLE__ tel = replicate ar $ defaultArg "s" -- convert size expression to term v = term e reportSDoc "tc.size.solve" 20 $ sep [ pretty m <+> text ":=" , nest 2 $ prettyTCM v ] -- Andreas, 2012-09-25: do not assign interaction metas to \infty let isInf (W.SizeConst W.Infinite) = True isInf _ = False unlessM ((isJust <$> isInteractionMeta m) `and2M` return (isInf e)) $ assignTerm m tel v mapM_ inst $ Map.toList sol return True Agda-2.4.2.5/src/full/Agda/TypeChecking/Level.hs0000644000000000000000000001142212635075266017265 0ustar0000000000000000{-# LANGUAGE CPP #-} module Agda.TypeChecking.Level where import Control.Applicative import Data.List as List import Agda.Syntax.Common import Agda.Syntax.Internal import Agda.TypeChecking.Monad import Agda.TypeChecking.Substitute import Agda.TypeChecking.Reduce import Agda.TypeChecking.Reduce.Monad () import Agda.TypeChecking.Monad.Builtin import Agda.Utils.Except ( MonadError(catchError) ) #include "undefined.h" import Agda.Utils.Impossible data LevelKit = LevelKit { lvlType :: Term , lvlSuc :: Term -> Term , lvlMax :: Term -> Term -> Term , lvlZero :: Term , typeName :: QName , sucName :: QName , maxName :: QName , zeroName :: QName } -- | Get the 'primLevel as a 'Term', if present. mlevel :: TCM (Maybe Term) mlevel = liftTCM $ (Just <$> primLevel) `catchError` \_ -> return Nothing -- | Get the 'primLevel' as a 'Type'. levelType :: TCM Type levelType = El (mkType 0) <$> primLevel levelSucFunction :: TCM (Term -> Term) levelSucFunction = do suc <- primLevelSuc return $ \a -> suc `apply` [defaultArg a] builtinLevelKit :: TCM (Maybe LevelKit) builtinLevelKit = liftTCM $ do level@(Def l []) <- ignoreSharing <$> primLevel zero@(Def z []) <- ignoreSharing <$> primLevelZero suc@(Def s []) <- ignoreSharing <$> primLevelSuc max@(Def m []) <- ignoreSharing <$> primLevelMax let a @@ b = a `apply` [defaultArg b] return $ Just $ LevelKit { lvlType = level , lvlSuc = \a -> suc @@ a , lvlMax = \a b -> max @@ a @@ b , lvlZero = zero , typeName = l , sucName = s , maxName = m , zeroName = z } `catchError` \_ -> return Nothing -- | Raises an error if no level kit is available. requireLevels :: TCM LevelKit requireLevels = do mKit <- builtinLevelKit case mKit of Nothing -> sequence_ [primLevel, primLevelZero, primLevelSuc, primLevelMax] >> __IMPOSSIBLE__ Just k -> return k unLevel :: Term -> TCM Term unLevel (Level l) = reallyUnLevelView l unLevel (Shared p) = unLevel (derefPtr p) unLevel v = return v {-# SPECIALIZE reallyUnLevelView :: Level -> TCM Term #-} reallyUnLevelView :: MonadTCM tcm => Level -> tcm Term reallyUnLevelView nv = liftTCM $ do case nv of Max [] -> primLevelZero Max [Plus 0 a] -> return $ unLevelAtom a Max [a] -> do zer <- primLevelZero suc <- primLevelSuc return $ unPlusV zer (\n -> suc `apply` [defaultArg n]) a _ -> (`unlevelWithKit` nv) <$> requireLevels unlevelWithKit :: LevelKit -> Level -> Term unlevelWithKit LevelKit{ lvlZero = zer, lvlSuc = suc, lvlMax = max } (Max as) = case map (unPlusV zer suc) as of [a] -> a [] -> zer as -> foldr1 max as unPlusV :: Term -> (Term -> Term) -> PlusLevel -> Term unPlusV zer suc (ClosedLevel n) = foldr (.) id (genericReplicate n suc) zer unPlusV _ suc (Plus n a) = foldr (.) id (genericReplicate n suc) (unLevelAtom a) maybePrimCon :: TCM Term -> TCM (Maybe ConHead) maybePrimCon prim = liftTCM $ do Con c [] <- prim return (Just c) `catchError` \_ -> return Nothing maybePrimDef :: TCM Term -> TCM (Maybe QName) maybePrimDef prim = liftTCM $ do Def f [] <- prim return (Just f) `catchError` \_ -> return Nothing levelView :: Term -> TCM Level levelView a = do reportSLn "tc.level.view" 50 $ "{ levelView " ++ show a v <- runReduceM $ levelView' a reportSLn "tc.level.view" 50 $ " view: " ++ show v ++ "}" return v levelView' :: Term -> ReduceM Level levelView' a = do msuc <- (getCon =<<) <$> getBuiltin' builtinLevelSuc mzer <- (getCon =<<) <$> getBuiltin' builtinLevelZero mmax <- (getDef =<<) <$> getBuiltin' builtinLevelMax let view a = do a <- reduce' a case ignoreSharing a of Level l -> return l Con s [arg] | Just s == msuc -> inc <$> view (unArg arg) Con z [] | Just z == mzer -> return $ closed 0 Def m [Apply arg1, Apply arg2] | Just m == mmax -> levelLub <$> view (unArg arg1) <*> view (unArg arg2) _ -> mkAtom a v <- view a return v where getCon (Con c []) = Just c getCon _ = Nothing getDef (Def f []) = Just f getDef _ = Nothing mkAtom a = do b <- reduceB' a return $ case ignoreSharing <$> b of NotBlocked _ (MetaV m as) -> atom $ MetaLevel m as NotBlocked r _ -> atom $ NeutralLevel r $ ignoreBlocking b Blocked m _ -> atom $ BlockedLevel m $ ignoreBlocking b atom a = Max [Plus 0 a] closed n = Max [ClosedLevel n | n > 0] inc (Max as) = Max $ map inc' as where inc' (ClosedLevel n) = ClosedLevel $ n + 1 inc' (Plus n a) = Plus (n + 1) a levelLub :: Level -> Level -> Level levelLub (Max as) (Max bs) = levelMax $ as ++ bs Agda-2.4.2.5/src/full/Agda/TypeChecking/Forcing.hs0000644000000000000000000001135212635075266017607 0ustar0000000000000000{-# LANGUAGE CPP #-} {-# LANGUAGE FlexibleInstances #-} {-| A constructor argument is forced if it appears as pattern variable in an index of the target. For instance @x@ is forced in @sing@ and @n@ is forced in @zero@ and @suc@: @ data Sing {a}{A : Set a} : A -> Set where sing : (x : A) -> Sing x data Fin : Nat -> Set where zero : (n : Nat) -> Fin (suc n) suc : (n : Nat) (i : Fin n) -> Fin (suc n) @ At runtime, forced constructor arguments may be erased as they can be recovered from dot patterns. In the epic backend, @ unsing : {A : Set} (x : A) -> Sing x -> A unsing .x (sing x) = x @ becomes @ unsing x sing = x @ and @ proj : (n : Nat) (i : Fin n) -> Nat proj .(suc n) (zero n) = n proj .(suc n) (suc n i) = n @ becomes @ proj (suc n) zero = n proj (suc n) (suc i) = n @ Forcing is a concept from pattern matching and thus builds on the concept of equality (I) used there (closed terms, extensional) which is different from the equality (II) used in conversion checking and the constraint solver (open terms, intensional). Up to issue 1441 (Feb 2015), the forcing analysis here relied on the wrong equality (II), considering type constructors as injective. This is unsound for Epic's program extraction, but ok if forcing is only used to decide which arguments to skip during conversion checking. From now on, forcing uses equality (I) and does not search for forced variables under type constructors. This may lose some savings during conversion checking. If this turns out to be a problem, the old forcing could be brought back, using a new modality @Skip@ to indicate that this is a relevant argument but still can be skipped during conversion checking as it is forced by equality (II). -} module Agda.TypeChecking.Forcing where import Prelude hiding (elem, maximum) import Control.Applicative import Data.Foldable import Data.Traversable import Agda.Interaction.Options import Agda.Syntax.Common import Agda.Syntax.Internal import Agda.TypeChecking.Monad import Agda.TypeChecking.Irrelevance import Agda.TypeChecking.Reduce import Agda.TypeChecking.Substitute import Agda.TypeChecking.Conversion import Agda.Utils.Function import Agda.Utils.Monad import Agda.Utils.Size #include "undefined.h" import Agda.Utils.Impossible -- | Given the type of a constructor (excluding the parameters), -- decide which arguments are forced. -- Update the relevance info in the domains accordingly. -- Precondition: the type is of the form @Γ → D vs@ and the @vs@ -- are in normal form. addForcingAnnotations :: Type -> TCM Type addForcingAnnotations t = ifM (not . optForcing <$> commandLineOptions) (return t) $ do -- Andreas, 2015-03-10 Normalization prevents Issue 1454. -- t <- normalise t -- Andreas, 2015-03-28 Issue 1469: Normalization too costly. -- Instantiation also fixes Issue 1454. -- Note that normalization of s0 below does not help. t <- instantiateFull t let TelV tel (El s a) = telView' t vs = case ignoreSharing a of Def _ us -> us _ -> __IMPOSSIBLE__ n = size tel indexToLevel x = n - x - 1 -- Note: data parameters will be negative levels. let xs = filter (>=0) $ map indexToLevel $ forcedVariables vs let s0 = raise (0 - size tel) s t' <- force s0 xs t reportSLn "tc.force" 60 $ unlines [ "Forcing analysis" , " xs = " ++ show xs , " t = " ++ show t , " t' = " ++ show t' ] return t' -- | Compute the pattern variables of a term or term-like thing. class ForcedVariables a where forcedVariables :: a -> [Nat] instance (ForcedVariables a, Foldable t) => ForcedVariables (t a) where forcedVariables = foldMap forcedVariables -- | Assumes that the term is in normal form. instance ForcedVariables Term where forcedVariables t = case ignoreSharing t of Var i [] -> [i] Con _ vs -> forcedVariables vs _ -> [] -- | @force s xs t@ marks the domains @xs@ in function type @t@ as forced. -- Domains bigger than @s@ are marked as @'Forced' 'Big'@, others as -- @'Forced' 'Small'@. -- Counting left-to-right, starting with 0. -- Precondition: function type is exposed. force :: Sort -> [Nat] -> Type -> TCM Type force s0 xs t = loop 0 t where m = maximum (-1:xs) -- number of domains to look at loop i t | i > m = return t loop i t = case ignoreSharingType t of El s (Pi a b) -> do a' <- if not (i `elem` xs) then return a else do -- If the sort of the data type is >= the sort of the argument type -- then the index is small, else big. b <- ifM (tryConversion $ leqSort (getSort a) (raise i s0)) (return Small) (return Big) return $ mapRelevance (composeRelevance $ Forced b) a El s . Pi a' <$> traverse (loop $ i + 1) b _ -> __IMPOSSIBLE__ Agda-2.4.2.5/src/full/Agda/TypeChecking/Errors.hs-boot0000644000000000000000000000033012635075266020427 0ustar0000000000000000module Agda.TypeChecking.Errors where import Agda.TypeChecking.Monad.Base -- Misplaced SPECIALISE pragma: -- {-# SPECIALIZE prettyError :: TCErr -> TCM String #-} prettyError :: MonadTCM tcm => TCErr -> tcm String Agda-2.4.2.5/src/full/Agda/TypeChecking/Pretty.hs-boot0000644000000000000000000000135712635075266020454 0ustar0000000000000000{-# LANGUAGE FlexibleInstances #-} module Agda.TypeChecking.Pretty where -- import Agda.Syntax.Common import Agda.Syntax.Internal -- import Agda.Syntax.Literal import Agda.TypeChecking.Monad import Agda.Utils.Pretty (Doc) -- import qualified Agda.Utils.Pretty as P text :: String -> TCM Doc sep, fsep, hsep, vcat :: [TCM Doc] -> TCM Doc ($$), (<>), (<+>) :: TCM Doc -> TCM Doc -> TCM Doc class PrettyTCM a where prettyTCM :: a -> TCM Doc instance PrettyTCM a => PrettyTCM (Closure a) instance PrettyTCM a => PrettyTCM [a] instance PrettyTCM Name instance PrettyTCM QName instance PrettyTCM Term instance PrettyTCM Elim instance PrettyTCM Type instance PrettyTCM Sort instance PrettyTCM DisplayTerm Agda-2.4.2.5/src/full/Agda/TypeChecking/Rewriting.hs-boot0000644000000000000000000000033212635075266021127 0ustar0000000000000000module Agda.TypeChecking.Rewriting where import Agda.Syntax.Internal import Agda.TypeChecking.Monad.Base verifyBuiltinRewrite :: Term -> Type -> TCM () rewrite :: Blocked Term -> ReduceM (Either (Blocked Term) Term) Agda-2.4.2.5/src/full/Agda/TypeChecking/Irrelevance.hs0000644000000000000000000000672112635075266020463 0ustar0000000000000000-- {-# LANGUAGE CPP #-} {-| Irrelevant function types. -} module Agda.TypeChecking.Irrelevance where import Control.Applicative import Control.Monad.Reader import qualified Data.Map as Map import Agda.Interaction.Options hiding (tests) import Agda.Syntax.Common hiding (Arg, Dom, NamedArg, ArgInfo) import Agda.Syntax.Internal (Dom) import Agda.TypeChecking.Monad import Agda.Utils.QuickCheck import Agda.Utils.TestHelpers -- | data 'Relevance' -- see "Agda.Syntax.Common". -- * Operations on 'Dom'. -- | Prepare parts of a parameter telescope for abstraction in constructors -- and projections. hideAndRelParams :: Dom a -> Dom a hideAndRelParams = setHiding Hidden . mapRelevance nonStrictToIrr -- | Used to modify context when going into a @rel@ argument. inverseApplyRelevance :: Relevance -> Dom a -> Dom a inverseApplyRelevance rel = mapRelevance (rel `inverseComposeRelevance`) -- | Compose two relevance flags. -- This function is used to update the relevance information -- on pattern variables @a@ after a match against something @rel@. applyRelevance :: Relevance -> Dom a -> Dom a applyRelevance rel = mapRelevance (rel `composeRelevance`) -- * Operations on 'Context'. -- | Modify the context whenever going from the l.h.s. (term side) -- of the typing judgement to the r.h.s. (type side). workOnTypes :: TCM a -> TCM a workOnTypes cont = do allowed <- optExperimentalIrrelevance <$> pragmaOptions verboseBracket "tc.irr" 20 "workOnTypes" $ workOnTypes' allowed cont -- | Call me if --experimental-irrelevance is set. doWorkOnTypes :: TCM a -> TCM a doWorkOnTypes = verboseBracket "tc.irr" 20 "workOnTypes" . workOnTypes' True -- | Internal workhorse, expects value of --experimental-irrelevance flag -- as argument. workOnTypes' :: Bool -> TCM a -> TCM a workOnTypes' allowed cont = if allowed then liftTCM $ modifyContext (modifyContextEntries $ mapRelevance $ irrToNonStrict) cont else cont -- | (Conditionally) wake up irrelevant variables and make them relevant. -- For instance, -- in an irrelevant function argument otherwise irrelevant variables -- may be used, so they are awoken before type checking the argument. applyRelevanceToContext :: Relevance -> TCM a -> TCM a applyRelevanceToContext rel = case rel of Relevant -> id Forced{} -> id _ -> local $ \ e -> e { envContext = modifyContextEntries (inverseApplyRelevance rel) (envContext e) , envLetBindings = Map.map (fmap $ \ (t, a) -> (t, inverseApplyRelevance rel a)) (envLetBindings e) -- enable local irr. defs , envRelevance = composeRelevance rel (envRelevance e) -- enable global irr. defs } -- | Wake up irrelevant variables and make them relevant. For instance, -- in an irrelevant function argument otherwise irrelevant variables -- may be used, so they are awoken before type checking the argument. wakeIrrelevantVars :: TCM a -> TCM a wakeIrrelevantVars = applyRelevanceToContext Irrelevant ------------------------------------------------------------------------ -- * Tests ------------------------------------------------------------------------ prop_galois :: Relevance -> Relevance -> Relevance -> Bool prop_galois r x y = x `moreRelevant` (r `composeRelevance` y) == (r `inverseComposeRelevance` x) `moreRelevant` y tests :: IO Bool tests = runTests "Agda.TypeChecking.Irrelevance" [ quickCheck' prop_galois ] Agda-2.4.2.5/src/full/Agda/TypeChecking/DropArgs.hs0000644000000000000000000000544112635075266017743 0ustar0000000000000000{-# LANGUAGE CPP #-} {-# LANGUAGE FlexibleInstances #-} module Agda.TypeChecking.DropArgs where import Agda.Syntax.Internal import Agda.TypeChecking.Monad import Agda.TypeChecking.Substitute import Agda.TypeChecking.CompiledClause import Agda.Utils.Permutation #include "undefined.h" import Agda.Utils.Impossible --------------------------------------------------------------------------- -- * Dropping initial arguments to create a projection-like function --------------------------------------------------------------------------- -- | When making a function projection-like, we drop the first @n@ -- arguments. class DropArgs a where dropArgs :: Int -> a -> a instance DropArgs a => DropArgs (Maybe a) where dropArgs n = fmap (dropArgs n) -- | NOTE: This creates telescopes with unbound de Bruijn indices. instance DropArgs Telescope where dropArgs n tel = telFromList $ drop n $ telToList tel instance DropArgs Permutation where dropArgs n (Perm m p) = Perm (m - n) $ map (subtract n) $ drop n p -- | NOTE: does not go into the body, so does not work for recursive functions. instance DropArgs ClauseBody where dropArgs 0 b = b dropArgs _ NoBody = NoBody dropArgs n (Bind b) = dropArgs (n - 1) (absBody b) dropArgs n Body{} = __IMPOSSIBLE__ -- | NOTE: does not work for recursive functions. instance DropArgs Clause where dropArgs n cl = cl{ clausePerm = dropArgs n $ clausePerm cl , clauseTel = dropArgs n $ clauseTel cl -- Andreas, 2012-09-25: just dropping the front of telescope -- makes it ill-formed (unbound indices) -- we should let the telescope intact!? , namedClausePats = drop n $ namedClausePats cl , clauseBody = dropArgs n $ clauseBody cl -- BUG: need to drop also from recursive calls!! } instance DropArgs FunctionInverse where dropArgs n finv = fmap (dropArgs n) finv {- UNUSED, but don't remove (Andreas, 2012-10-08) -- | Use for dropping initial lambdas in compiled clause bodies. -- NOTE: does not reduce term, need lambdas to be present. instance DropArgs Term where dropArgs 0 v = v dropArgs n v = case ignoreSharing v of Lam h b -> dropArgs (n - 1) (absBody b) _ -> __IMPOSSIBLE__ -} -- | To drop the first @n@ arguments in a compiled clause, -- we reduce the split argument indices by @n@ and -- drop @n@ arguments from the bodies. -- NOTE: this only works for non-recursive functions, we -- are not dropping arguments to recursive calls in bodies. instance DropArgs CompiledClauses where dropArgs n cc = case cc of Case i br | i < n -> __IMPOSSIBLE__ | otherwise -> Case (i - n) $ fmap (dropArgs n) br Done xs t | length xs < n -> __IMPOSSIBLE__ | otherwise -> Done (drop n xs) t Fail -> Fail Agda-2.4.2.5/src/full/Agda/TypeChecking/Rewriting.hs0000644000000000000000000003317312635075266020177 0ustar0000000000000000{-# LANGUAGE CPP #-} {-# LANGUAGE FlexibleInstances #-} {-# LANGUAGE PatternGuards #-} -- | Rewriting with arbitrary rules. -- -- The user specifies a relation symbol by the pragma -- @ -- {-# BUILTIN REWRITE rel #-} -- @ -- where @rel@ should be of type @Δ → (lhs rhs : A) → Set i@. -- -- Then the user can add rewrite rules by the pragma -- @ -- {-# REWRITE q #-} -- @ -- where @q@ should be a closed term of type @Γ → rel us lhs rhs@. -- -- We then intend to add a rewrite rule -- @ -- Γ ⊢ lhs ↦ rhs : B -- @ -- to the signature where @B = A[us/Δ]@. -- -- To this end, we normalize @lhs@, which should be of the form -- @ -- f ts -- @ -- for a @'Def'@-symbol f (postulate, function, data, record, constructor). -- Further, @FV(ts) = dom(Γ)@. -- The rule @q :: Γ ⊢ f ts ↦ rhs : B@ is added to the signature -- to the definition of @f@. -- -- When reducing a term @Ψ ⊢ f vs@ is stuck, we try the rewrites for @f@, -- by trying to unify @vs@ with @ts@. -- This is for now done by substituting fresh metas Xs for the bound -- variables in @ts@ and checking equality with @vs@ -- @ -- Ψ ⊢ (f ts)[Xs/Γ] = f vs : B[Xs/Γ] -- @ -- If successful (no open metas/constraints), we replace @f vs@ by -- @rhs[Xs/Γ]@ and continue reducing. module Agda.TypeChecking.Rewriting where import Prelude hiding (null) import Control.Applicative hiding (empty) import Control.Monad import Control.Monad.Reader (local) import Data.Foldable ( Foldable, foldMap ) import Data.IntSet (IntSet) import qualified Data.IntSet as IntSet import qualified Data.List as List import Data.Monoid import Agda.Interaction.Options import Agda.Syntax.Common import Agda.Syntax.Internal as I import Agda.TypeChecking.Monad import Agda.TypeChecking.Monad.Builtin import Agda.TypeChecking.EtaContract import Agda.TypeChecking.MetaVars import Agda.TypeChecking.Conversion import Agda.TypeChecking.Pretty import Agda.TypeChecking.Reduce import Agda.TypeChecking.Substitute import Agda.TypeChecking.Telescope import Agda.TypeChecking.Rewriting.NonLinMatch import qualified Agda.TypeChecking.Reduce.Monad as Red import Agda.Utils.Functor import Agda.Utils.Maybe import Agda.Utils.Monad import Agda.Utils.Null import Agda.Utils.Singleton import Agda.Utils.Size #include "undefined.h" import Agda.Utils.Impossible requireOptionRewriting :: TCM () requireOptionRewriting = unlessM (optRewriting <$> pragmaOptions) $ typeError NeedOptionRewriting -- | Check that the name given to the BUILTIN REWRITE is actually -- a relation symbol. -- I.e., its type should be of the form @Δ → (lhs rhs : A) → Set ℓ@. -- Note: we do not care about hiding/non-hiding of lhs and rhs. verifyBuiltinRewrite :: Term -> Type -> TCM () verifyBuiltinRewrite v t = do requireOptionRewriting let failure reason = typeError . GenericDocError =<< sep [ prettyTCM v <+> text " does not have the right type for a rewriting relation" , reason ] caseMaybeM (relView t) (failure $ text "because it should accept at least two arguments") $ \ (RelView tel delta a b core) -> do case ignoreSharing (unEl core) of Sort{} -> do -- Check that the types of the last two arguments are equal. unlessM (tryConversion $ inTopContext $ addContext tel $ escapeContext 1 $ equalType (raise 1 a) b) $ failure $ text $ "because the types of the last two arguments are different" Con{} -> __IMPOSSIBLE__ Level{} -> __IMPOSSIBLE__ Lam{} -> __IMPOSSIBLE__ Pi{} -> __IMPOSSIBLE__ Shared{} -> __IMPOSSIBLE__ _ -> failure $ text "because its type does not end in a sort, but in " <+> do inTopContext $ addContext tel $ prettyTCM core -- | Deconstructing a type into @Δ → t → t' → core@. data RelView = RelView { relViewTel :: Telescope -- ^ The whole telescope @Δ, t, t'@. , relViewDelta :: ListTel -- ^ @Δ@. , relViewType :: Type -- ^ @t@. , relViewType' :: Type -- ^ @t'@. , relViewCore :: Type -- ^ @core@. } -- | Deconstructing a type into @Δ → t → t' → core@. -- Returns @Nothing@ if not enough argument types. relView :: Type -> TCM (Maybe RelView) relView t = do TelV tel core <- telView t let n = size tel (delta, lastTwo) = splitAt (n - 2) $ telToList tel if size lastTwo < 2 then return Nothing else do let [a, b] = snd . unDom <$> lastTwo return $ Just $ RelView tel delta a b core -- | Add @q : Γ → rel us lhs rhs@ as rewrite rule -- @ -- Γ ⊢ lhs ↦ rhs : B -- @ -- to the signature where @B = A[us/Δ]@. -- Remember that @rel : Δ → A → A → Set i@, so -- @rel us : (lhs rhs : A[us/Δ]) → Set i@. -- -- Makes only sense in empty context. addRewriteRule :: QName -> TCM () addRewriteRule q = inTopContext $ do requireOptionRewriting Def rel _ <- primRewrite def <- getConstInfo q -- Issue 1651: Check that we are not adding a rewrite rule -- for a type signature whose body has not been type-checked yet. when (isEmptyFunction $ theDef def) $ typeError . GenericDocError =<< hsep [ text "Rewrite rule from function " , prettyTCM q , text " cannot be added before the function definition" ] -- We know that the type of rel is that of a relation. Just (RelView _tel delta a _a' _core) <- relView =<< do defType <$> getConstInfo rel reportSDoc "rewriting" 30 $ do text "rewrite relation at type " <+> do inTopContext $ prettyTCM (telFromList delta) <+> text " |- " <+> do addContext delta $ prettyTCM a -- Get rewrite rule (type of q). TelV gamma core <- telView $ defType def reportSDoc "rewriting" 30 $ do text "attempting to add rewrite rule of type " <+> do inTopContext $ prettyTCM gamma <+> text " |- " <+> do addContext gamma $ prettyTCM core let failureWrongTarget = typeError . GenericDocError =<< hsep [ prettyTCM q , text " does not target rewrite relation" ] let failureMetas = typeError . GenericDocError =<< hsep [ prettyTCM q , text " is not a legal rewrite rule, since it contains unsolved meta variables" ] let failureNotDefOrCon = typeError . GenericDocError =<< hsep [ prettyTCM q , text " is not a legal rewrite rule, since the left-hand side is neither a defined symbol nor a constructor" ] let failureFreeVars xs = typeError . GenericDocError =<< do addContext gamma $ hsep $ [ prettyTCM q , text " is not a legal rewrite rule, since the following variables are not bound by the left hand side: " , prettyList_ (map (prettyTCM . var) xs) ] let failureLhsReduction lhs = typeError . GenericDocError =<< do addContext gamma $ hsep $ [ prettyTCM q , text " is not a legal rewrite rule, since the left-hand side " , prettyTCM lhs , text " has top-level reductions" ] let failureIllegalRule = typeError . GenericDocError =<< hsep [ prettyTCM q , text " is not a legal rewrite rule" ] -- Check that type of q targets rel. case ignoreSharing $ unEl core of Def rel' es@(_:_:_) | rel == rel' -> do -- Because of the type of rel (Γ → sort), all es are applications. let vs = map unArg $ fromMaybe __IMPOSSIBLE__ $ allApplyElims es -- The last two arguments are lhs and rhs. n = size vs (us, [lhs, rhs]) = splitAt (n - 2) vs unless (size delta == size us) __IMPOSSIBLE__ b <- instantiateFull $ applySubst (parallelS $ reverse us) a gamma <- instantiateFull gamma -- Find head symbol f of the lhs. f <- case ignoreSharing lhs of Def f es -> return f Con c vs -> return $ conName c _ -> failureNotDefOrCon -- Normalize lhs: we do not want to match redexes. lhs <- normaliseArgs lhs unlessM (isNormal lhs) $ failureLhsReduction lhs -- Normalize rhs: might be more efficient. rhs <- etaContract =<< normalise rhs unless (null $ allMetas (telToList gamma, lhs, rhs, b)) failureMetas pat <- patternFrom 0 lhs let rew = RewriteRule q gamma pat rhs b reportSDoc "rewriting" 10 $ addContext gamma $ text "considering rewrite rule " <+> prettyTCM rew -- Check that all variables of Γ are pattern variables in the lhs. unlessNull ([0 .. size gamma - 1] List.\\ IntSet.toList (nlPatVars pat)) failureFreeVars -- -- check that FV(rhs) ⊆ nlPatVars(lhs) -- unless (allVars (freeVars rhs) `IntSet.isSubsetOf` nlPatVars pat) $ -- failureFreeVars -- NO LONGER WORKS: -- -- Check whether lhs can be rewritten with itself. -- -- Otherwise, there are unbound variables in either gamma or rhs. -- addContext gamma $ -- unlessM (isJust <$> runReduceM (rewriteWith (Just b) lhs rew)) $ -- failureFreeVars -- Add rewrite rule gamma ⊢ lhs ↦ rhs : b for f. addRewriteRules f [rew] _ -> failureWrongTarget where normaliseArgs :: Term -> TCM Term normaliseArgs v = case ignoreSharing v of Def f es -> Def f <$> do etaContract =<< normalise es Con c vs -> Con c <$> do etaContract =<< normalise vs _ -> __IMPOSSIBLE__ isNormal :: Term -> TCM Bool isNormal v = do v' <- normalise v return $ v == v' -- | Append rewrite rules to a definition. addRewriteRules :: QName -> RewriteRules -> TCM () addRewriteRules f rews = do reportSDoc "rewriting" 10 $ text "rewrite rule ok, adding it to the definition of " <+> prettyTCM f modifySignature $ addRewriteRulesFor f rews rules <- getRewriteRulesFor f reportSDoc "rewriting" 20 $ vcat [ text "rewrite rules for " <+> prettyTCM f <+> text ":" , vcat (map prettyTCM rules) ] -- | @rewriteWith t v rew@ -- tries to rewrite @v : t@ with @rew@, returning the reduct if successful. rewriteWith :: Maybe Type -> Term -> RewriteRule -> ReduceM (Either (Blocked Term) Term) rewriteWith mt v (RewriteRule q gamma lhs rhs b) = do Red.traceSDoc "rewriting" 95 (sep [ text "attempting to rewrite term " <+> prettyTCM v , text " with rule " <+> prettyTCM q ]) $ do result <- nonLinMatch lhs v case result of Left block -> return $ Left $ const v <$> block Right sub -> do let v' = applySubst sub rhs Red.traceSDoc "rewriting" 90 (sep [ text "rewrote " <+> prettyTCM v , text " to " <+> prettyTCM v' ]) $ return $ Right v' {- OLD CODE: -- Freeze all metas, remember which one where not frozen before. -- This ensures that we do not instantiate metas while matching -- on the rewrite lhs. ms <- freezeMetas res <- tryConversion' $ do -- Create new metas for the lhs variables of the rewriting rule. xs <- newTelMeta gamma let sigma = parallelS $ map unArg xs (lhs', rhs', b') = applySubst sigma (lhs, rhs, b) -- Unify type and term with type and lhs of rewrite rule. whenJust mt $ \ t -> leqType t b' local (\ e -> e {envCompareBlocked = True}) $ equalTerm b' lhs' v -- Check that all variables have been solved for. unlessM (isInstantiatedMeta xs) $ do reportSDoc "rewriting" 20 $ text "lhs variables solved with: " <+> do sep $ map prettyTCM xs -- The following error is caught immediately by tryConversion. typeError $ GenericError $ "free variables not bound by left hand side" return rhs' -- Thaw metas that were frozen by a call to this function. unfreezeMetas' (`elem` ms) return res-} -- | @rewrite t@ tries to rewrite a reduced term. rewrite :: Blocked Term -> ReduceM (Either (Blocked Term) Term) rewrite bv = ifNotM (optRewriting <$> pragmaOptions) (return $ Left bv) $ {- else -} do let v = ignoreBlocking bv case ignoreSharing v of -- We only rewrite @Def@s and @Con@s. Def f es -> rew f (Def f) es Con c vs -> rew (conName c) hd (Apply <$> vs) where hd es = Con c $ fromMaybe __IMPOSSIBLE__ $ allApplyElims es _ -> return $ Left bv where -- Try all rewrite rules for f. rew :: QName -> (Elims -> Term) -> Elims -> ReduceM (Either (Blocked Term) Term) rew f hd es = do rules <- getRewriteRulesFor f case rules of [] -> return $ Left $ bv $> hd es _ -> do es <- etaContract =<< instantiateFull' es loop (void bv) es rules where loop :: Blocked_ -> Elims -> [RewriteRule] -> ReduceM (Either (Blocked Term) Term) loop block es [] = return $ Left $ block $> hd es loop block es (rew:rews) | let n = rewArity rew, length es >= n = do let (es1, es2) = List.genericSplitAt n es result <- rewriteWith Nothing (hd es1) rew case result of Left (Blocked m u) -> loop (block `mappend` Blocked m ()) es rews Left (NotBlocked _ _) -> loop block es rews Right w -> return $ Right $ w `applyE` es2 | otherwise = loop (block `mappend` NotBlocked Underapplied ()) es rews ------------------------------------------------------------------------ -- * Auxiliary functions ------------------------------------------------------------------------ class NLPatVars a where nlPatVars :: a -> IntSet instance (Foldable f, NLPatVars a) => NLPatVars (f a) where nlPatVars = foldMap nlPatVars instance NLPatVars NLPat where nlPatVars p = case p of PVar i -> singleton i PDef _ es -> nlPatVars es PWild -> empty PLam _ p' -> nlPatVars $ unAbs p' PPi a b -> nlPatVars a `IntSet.union` nlPatVars (unAbs b) PBoundVar _ es -> nlPatVars es PTerm{} -> empty rewArity :: RewriteRule -> Int rewArity rew = case rewLHS rew of PDef _f es -> length es _ -> __IMPOSSIBLE__ Agda-2.4.2.5/src/full/Agda/TypeChecking/EtaContract.hs0000644000000000000000000000753412635075266020436 0ustar0000000000000000{-# LANGUAGE CPP #-} {-# LANGUAGE FlexibleContexts #-} {-# LANGUAGE PatternGuards #-} -- | Compute eta short normal forms. module Agda.TypeChecking.EtaContract where import Control.Monad.Reader import Agda.Syntax.Common hiding (Arg, Dom, NamedArg, ArgInfo) import qualified Agda.Syntax.Common as Common import Agda.Syntax.Internal import Agda.Syntax.Internal.Generic import Agda.TypeChecking.Substitute import Agda.TypeChecking.Free import Agda.TypeChecking.Monad import Agda.TypeChecking.Reduce.Monad () import {-# SOURCE #-} Agda.TypeChecking.Records import {-# SOURCE #-} Agda.TypeChecking.Datatypes import Agda.Utils.Monad #include "undefined.h" import Agda.Utils.Impossible -- TODO: move to Agda.Syntax.Internal.SomeThing data BinAppView = App Term (Arg Term) | NoApp Term binAppView :: Term -> BinAppView binAppView t = case t of Var i xs -> appE (Var i) xs Def c xs -> appE (Def c) xs -- Andreas, 2013-09-17: do not eta-contract when body is (record) constructor -- like in \ x -> s , x! (See interaction/DoNotEtaContractFunIntoRecord) -- (Cf. also issue 889 (fixed differently).) -- At least record constructors should be fully applied where possible! -- TODO: also for ordinary constructors (\ x -> suc x vs. suc)? Con c xs | null (conFields c) -> app (Con c) xs | otherwise -> noApp Lit _ -> noApp Level _ -> noApp -- could be an application, but let's not eta contract levels Lam _ _ -> noApp Pi _ _ -> noApp Sort _ -> noApp MetaV _ _ -> noApp DontCare _ -> noApp ExtLam _ _ -> __IMPOSSIBLE__ Shared p -> binAppView (derefPtr p) -- destroys sharing where noApp = NoApp t app f [] = noApp app f xs = App (f $ init xs) (last xs) appE f [] = noApp appE f xs | Apply v <- last xs = App (f $ init xs) v | otherwise = noApp -- | Contracts all eta-redexes it sees without reducing. {-# SPECIALIZE etaContract :: TermLike a => a -> TCM a #-} {-# SPECIALIZE etaContract :: TermLike a => a -> ReduceM a #-} etaContract :: (MonadReader TCEnv m, HasConstInfo m, TermLike a) => a -> m a etaContract = traverseTermM etaOnce {-# SPECIALIZE etaOnce :: Term -> TCM Term #-} {-# SPECIALIZE etaOnce :: Term -> ReduceM Term #-} etaOnce :: (MonadReader TCEnv m, HasConstInfo m) => Term -> m Term etaOnce v = case v of -- Andreas, 2012-11-18: this call to reportSDoc seems to cost me 2% -- performance on the std-lib -- reportSDoc "tc.eta" 70 $ text "eta-contracting" <+> prettyTCM v Shared{} -> __IMPOSSIBLE__ -- updateSharedTerm eta v Lam i (Abs _ b) -> do -- NoAbs can't be eta'd imp <- shouldEtaContractImplicit case binAppView b of App u (Common.Arg info v) | (isIrrelevant info || isVar0 v) && allowed imp info && not (freeIn 0 u) -> return $ strengthen __IMPOSSIBLE__ u _ -> return v where isVar0 (Shared p) = __IMPOSSIBLE__ -- isVar0 (derefPtr p) isVar0 (Var 0 []) = True isVar0 (Level (Max [Plus 0 l])) = case l of NeutralLevel _ v -> isVar0 v UnreducedLevel v -> isVar0 v BlockedLevel{} -> False MetaLevel{} -> False isVar0 _ = False allowed imp i' = getHiding i == getHiding i' && (imp || notHidden i) -- Andreas, 2012-12-18: Abstract definitions could contain -- abstract records whose constructors are not in scope. -- To be able to eta-contract them, we ignore abstract. Con c args -> ignoreAbstractMode $ do -- reportSDoc "tc.eta" 20 $ text "eta-contracting record" <+> prettyTCM t r <- getConstructorData $ conName c -- fails in ConcreteMode if c is abstract ifM (isEtaRecord r) (do -- reportSDoc "tc.eta" 20 $ text "eta-contracting record" <+> prettyTCM t etaContractRecord r c args) (return v) v -> return v Agda-2.4.2.5/src/full/Agda/TypeChecking/Empty.hs0000644000000000000000000000255112635075266017317 0ustar0000000000000000 module Agda.TypeChecking.Empty where import Control.Applicative import Control.Monad import Agda.Syntax.Common import Agda.Syntax.Internal import Agda.Syntax.Position import Agda.TypeChecking.Monad import Agda.TypeChecking.Coverage import Agda.TypeChecking.Constraints import Agda.TypeChecking.Reduce import Agda.TypeChecking.Substitute -- | Check whether a type is empty. -- This check may be postponed as emptiness constraint. isEmptyType :: Range -> Type -> TCM () isEmptyType r t = do let postpone t = addConstraint $ IsEmpty r t -- If t is blocked or a meta, we cannot decide emptiness now. Postpone. ifBlockedType t (\ _ t -> postpone t) $ {- else -} \ t -> do -- from the current context xs:ts, create a pattern list -- xs _ : ts t and try to split on _ (the last variable) tel0 <- getContextTelescope let gamma = telToList tel0 ++ [domFromArg $ defaultArg (underscore, t)] ps = [ Arg info $ namedVarP x | Dom info (x, _) <- gamma ] tel = telFromList gamma dontAssignMetas $ do r <- splitLast Inductive tel ps case r of Left (CantSplit c tel us vs) -> postpone t Left _ -> typeError $ ShouldBeEmpty t [] Right cov -> do let cs = splitClauses cov unless (null cs) $ typeError $ ShouldBeEmpty t $ map (namedArg . last . scPats) $ cs Agda-2.4.2.5/src/full/Agda/TypeChecking/MetaVars.hs-boot0000644000000000000000000000167512635075266020712 0ustar0000000000000000module Agda.TypeChecking.MetaVars where import Agda.Syntax.Internal ( MetaId, Term, Type, Arg, Args, Abs, Dom, Telescope ) import Agda.Syntax.Internal.Generic ( TermLike ) import Agda.TypeChecking.Monad.Base ( TCM, RunMetaOccursCheck(..), CompareDirection(..) ) type Condition = Dom Type -> Abs Type -> Bool newArgsMeta' :: Condition -> Type -> TCM Args newArgsMeta :: Type -> TCM Args assignTerm :: MetaId -> [Arg String] -> Term -> TCM () etaExpandMetaSafe :: MetaId -> TCM () assignV :: CompareDirection -> MetaId -> Args -> Term -> TCM () assign :: CompareDirection -> MetaId -> Args -> Term -> TCM () newIFSMeta :: String -> Type -> Maybe [(Term, Type)] -> TCM Term newValueMeta :: RunMetaOccursCheck -> Type -> TCM Term newNamedValueMeta :: RunMetaOccursCheck -> String -> Type -> TCM Term newTelMeta :: Telescope -> TCM Args allMetas :: TermLike a => a -> [MetaId] Agda-2.4.2.5/src/full/Agda/TypeChecking/Polarity.hs-boot0000644000000000000000000000030212635075266020755 0ustar0000000000000000 module Agda.TypeChecking.Polarity where import Agda.Syntax.Internal import Agda.TypeChecking.Monad.Base computePolarity :: QName -> TCM () composePol :: Polarity -> Polarity -> Polarity Agda-2.4.2.5/src/full/Agda/TypeChecking/Primitive.hs0000644000000000000000000005623612635075266020202 0ustar0000000000000000{-# LANGUAGE CPP #-} {-# LANGUAGE FlexibleInstances #-} {-# LANGUAGE GeneralizedNewtypeDeriving #-} {-# LANGUAGE ScopedTypeVariables #-} {-# LANGUAGE UndecidableInstances #-} {-| Primitive functions, such as addition on builtin integers. -} module Agda.TypeChecking.Primitive where import Control.Monad import Control.Applicative import Data.Char import Data.Map (Map) import qualified Data.Map as Map import Data.Maybe import Agda.Interaction.Options import Agda.Syntax.Position import Agda.Syntax.Common hiding (Nat) import Agda.Syntax.Internal as I import Agda.Syntax.Internal.Generic (TermLike) import Agda.Syntax.Literal import Agda.Syntax.Concrete.Pretty () import Agda.TypeChecking.Monad hiding (getConstInfo, typeOfConst) import qualified Agda.TypeChecking.Monad as TCM import Agda.TypeChecking.Monad.Builtin import Agda.TypeChecking.Reduce import Agda.TypeChecking.Reduce.Monad import Agda.TypeChecking.Substitute import Agda.TypeChecking.Errors import Agda.TypeChecking.Level import Agda.TypeChecking.Quote (QuotingKit, quoteTermWithKit, quoteTypeWithKit, quoteClauseWithKit, quotingKit) import Agda.TypeChecking.Pretty () -- instances only import Agda.TypeChecking.MetaVars (allMetas) import Agda.Utils.Monad import Agda.Utils.Pretty (pretty) import Agda.Utils.String ( Str(Str), unStr ) #include "undefined.h" import Agda.Utils.Impossible import Debug.Trace --------------------------------------------------------------------------- -- * Primitive functions --------------------------------------------------------------------------- data PrimitiveImpl = PrimImpl Type PrimFun -- Haskell type to Agda type newtype Nat = Nat { unNat :: Integer } deriving (Eq, Ord, Num, Enum, Real) -- In GHC > 7.8 deriving Integral causes an unnecessary toInteger -- warning. instance Integral Nat where toInteger = unNat quotRem (Nat a) (Nat b) = (Nat q, Nat r) where (q, r) = quotRem a b instance Show Nat where show = show . toInteger newtype Lvl = Lvl { unLvl :: Integer } deriving (Eq, Ord) instance Show Lvl where show = show . unLvl class PrimType a where primType :: a -> TCM Type instance (PrimType a, PrimType b) => PrimTerm (a -> b) where primTerm _ = unEl <$> (primType (undefined :: a) --> primType (undefined :: b)) instance PrimTerm a => PrimType a where primType _ = el $ primTerm (undefined :: a) class PrimTerm a where primTerm :: a -> TCM Term instance PrimTerm Integer where primTerm _ = primInteger instance PrimTerm Bool where primTerm _ = primBool instance PrimTerm Char where primTerm _ = primChar instance PrimTerm Double where primTerm _ = primFloat instance PrimTerm Str where primTerm _ = primString instance PrimTerm Nat where primTerm _ = primNat instance PrimTerm Lvl where primTerm _ = primLevel instance PrimTerm QName where primTerm _ = primQName instance PrimTerm Type where primTerm _ = primAgdaType instance PrimTerm a => PrimTerm [a] where primTerm _ = list (primTerm (undefined :: a)) instance PrimTerm a => PrimTerm (IO a) where primTerm _ = io (primTerm (undefined :: a)) -- From Agda term to Haskell value class ToTerm a where toTerm :: TCM (a -> Term) toTermR :: TCM (a -> ReduceM Term) toTermR = (pure .) <$> toTerm instance ToTerm Integer where toTerm = return $ Lit . LitInt noRange instance ToTerm Nat where toTerm = return $ Lit . LitInt noRange . toInteger instance ToTerm Lvl where toTerm = return $ Level . Max . (:[]) . ClosedLevel . unLvl instance ToTerm Double where toTerm = return $ Lit . LitFloat noRange instance ToTerm Char where toTerm = return $ Lit . LitChar noRange instance ToTerm Str where toTerm = return $ Lit . LitString noRange . unStr instance ToTerm QName where toTerm = return $ Lit . LitQName noRange instance ToTerm Bool where toTerm = do true <- primTrue false <- primFalse return $ \b -> if b then true else false instance ToTerm Term where toTerm = do kit <- quotingKit; runReduceF (quoteTermWithKit kit) toTermR = do kit <- quotingKit; return (quoteTermWithKit kit) instance ToTerm Type where toTerm = do kit <- quotingKit; runReduceF (quoteTypeWithKit kit) toTermR = do kit <- quotingKit; return (quoteTypeWithKit kit) instance ToTerm I.ArgInfo where toTerm = do info <- primArgArgInfo vis <- primVisible hid <- primHidden ins <- primInstance rel <- primRelevant irr <- primIrrelevant return $ \(ArgInfo h r _) -> apply info $ map defaultArg [ case h of NotHidden -> vis Hidden -> hid Instance -> ins , case r of Relevant -> rel Irrelevant -> irr NonStrict -> rel Forced{} -> irr UnusedArg -> irr ] -- | @buildList A ts@ builds a list of type @List A@. Assumes that the terms -- @ts@ all have type @A@. buildList :: TCM ([Term] -> Term) buildList = do nil' <- primNil cons' <- primCons let nil = nil' cons x xs = cons' `apply` [defaultArg x, defaultArg xs] return $ foldr cons nil instance (PrimTerm a, ToTerm a) => ToTerm [a] where toTerm = do mkList <- buildList fromA <- toTerm return $ mkList . map fromA -- From Haskell value to Agda term type FromTermFunction a = I.Arg Term -> ReduceM (Reduced (MaybeReduced (I.Arg Term)) a) class FromTerm a where fromTerm :: TCM (FromTermFunction a) instance FromTerm Integer where fromTerm = fromLiteral $ \l -> case l of LitInt _ n -> Just n _ -> Nothing instance FromTerm Nat where fromTerm = fromLiteral $ \l -> case l of LitInt _ n -> Just $ fromInteger n _ -> Nothing instance FromTerm Lvl where fromTerm = fromReducedTerm $ \l -> case l of Level (Max [ClosedLevel n]) -> Just $ Lvl n _ -> Nothing instance FromTerm Double where fromTerm = fromLiteral $ \l -> case l of LitFloat _ x -> Just x _ -> Nothing instance FromTerm Char where fromTerm = fromLiteral $ \l -> case l of LitChar _ c -> Just c _ -> Nothing instance FromTerm Str where fromTerm = fromLiteral $ \l -> case l of LitString _ s -> Just $ Str s _ -> Nothing instance FromTerm QName where fromTerm = fromLiteral $ \l -> case l of LitQName _ x -> Just x _ -> Nothing instance FromTerm Bool where fromTerm = do true <- primTrue false <- primFalse fromReducedTerm $ \t -> case t of _ | t === true -> Just True | t === false -> Just False | otherwise -> Nothing where Def x [] === Def y [] = x == y Con x [] === Con y [] = x == y Var n [] === Var m [] = n == m _ === _ = False instance (ToTerm a, FromTerm a) => FromTerm [a] where fromTerm = do nil' <- primNil cons' <- primCons nil <- isCon nil' cons <- isCon cons' toA <- fromTerm fromA <- toTerm return $ mkList nil cons toA fromA where isCon (Lam _ b) = isCon $ absBody b isCon (Con c _) = return c isCon (Shared p) = __IMPOSSIBLE__ -- isCon (derefPtr p) isCon v = __IMPOSSIBLE__ mkList nil cons toA fromA t = do b <- reduceB' t let t = ignoreBlocking b let arg = Arg (ArgInfo { argInfoHiding = getHiding t , argInfoRelevance = getRelevance t , argInfoColors = argColors t }) case unArg t of Con c [] | c == nil -> return $ YesReduction NoSimplification [] Con c [x,xs] | c == cons -> redBind (toA x) (\x' -> notReduced $ arg $ Con c [ignoreReduced x',xs]) $ \y -> redBind (mkList nil cons toA fromA xs) (fmap $ \xs' -> arg $ Con c [defaultArg $ fromA y, xs']) $ \ys -> redReturn (y : ys) _ -> return $ NoReduction (reduced b) -- | Conceptually: @redBind m f k = either (return . Left . f) k =<< m@ redBind :: ReduceM (Reduced a a') -> (a -> b) -> (a' -> ReduceM (Reduced b b')) -> ReduceM (Reduced b b') redBind ma f k = do r <- ma case r of NoReduction x -> return $ NoReduction $ f x YesReduction _ y -> k y redReturn :: a -> ReduceM (Reduced a' a) redReturn = return . YesReduction YesSimplification fromReducedTerm :: (Term -> Maybe a) -> TCM (FromTermFunction a) fromReducedTerm f = return $ \t -> do b <- reduceB' t case f $ ignoreSharing $ unArg (ignoreBlocking b) of Just x -> return $ YesReduction NoSimplification x Nothing -> return $ NoReduction (reduced b) fromLiteral :: (Literal -> Maybe a) -> TCM (FromTermFunction a) fromLiteral f = fromReducedTerm $ \t -> case t of Lit lit -> f lit _ -> Nothing -- trustMe : {a : Level} {A : Set a} {x y : A} -> x ≡ y primTrustMe :: TCM PrimitiveImpl primTrustMe = do clo <- commandLineOptions when (optSafe clo) (typeError SafeFlagPrimTrustMe) t <- hPi "a" (el primLevel) $ hPi "A" (return $ sort $ varSort 0) $ hPi "x" (El (varSort 1) <$> varM 0) $ hPi "y" (El (varSort 2) <$> varM 1) $ El (varSort 3) <$> primEquality <#> varM 3 <#> varM 2 <@> varM 1 <@> varM 0 Con rf [] <- ignoreSharing <$> primRefl n <- conPars . theDef <$> getConInfo rf -- Andreas, 2015-02-27 Forced Big vs. Forced Small should not matter here let refl x | n == 2 = Con rf [setRelevance (Forced Small) $ hide $ defaultArg x] | n == 3 = Con rf [] | otherwise = __IMPOSSIBLE__ return $ PrimImpl t $ PrimFun __IMPOSSIBLE__ 4 $ \ts -> case ts of [a, t, u, v] -> do -- Andreas, 2013-07-22. -- Note that we cannot call the conversion checker here, -- because 'reduce' might be called in a context where -- some bound variables do not have a type (just 'Prop), -- and the conversion checker for eliminations does not -- like this. -- We can only do untyped equality, e.g., by normalisation. (u', v') <- normalise' (u, v) if u' == v' then redReturn (refl $ unArg u) else return (NoReduction $ map notReduced [a, t, u, v]) {- OLD: -- BAD: noConstraints $ equalTerm (El (Type $ lvlView $ unArg a) (unArg t)) (unArg u) (unArg v) redReturn (refl $ unArg u) `catchError` \_ -> return (NoReduction $ map notReduced [a, t, u, v]) -} _ -> __IMPOSSIBLE__ primQNameType :: TCM PrimitiveImpl primQNameType = mkPrimFun1TCM (el primQName --> el primAgdaType) (\q -> normalise' . defType =<< getConstInfo q) -- Note: gets the top-level type! All bounds variables have been lifted. primQNameDefinition :: TCM PrimitiveImpl primQNameDefinition = do kit <- quotingKit agdaFunDef <- primAgdaFunDef agdaFunDefCon <- primAgdaFunDefCon agdaDefinitionFunDef <- primAgdaDefinitionFunDef agdaDefinitionDataDef <- primAgdaDefinitionDataDef agdaDefinitionRecordDef <- primAgdaDefinitionRecordDef agdaDefinitionPostulate <- primAgdaDefinitionPostulate agdaDefinitionPrimitive <- primAgdaDefinitionPrimitive agdaDefinitionDataConstructor <- primAgdaDefinitionDataConstructor list <- buildList let qType = quoteTypeWithKit kit qClause = quoteClauseWithKit kit defapp f xs = apply f . map defaultArg <$> sequence xs qFunDef t cs = defapp agdaFunDefCon [qType t, list <$> mapM qClause cs] qQName = Lit . LitQName noRange con qn = do def <- getConstInfo qn case theDef def of Function{funClauses = cs} -> defapp agdaDefinitionFunDef [qFunDef (defType def) cs] Datatype{} -> defapp agdaDefinitionDataDef [pure $ qQName qn] Record{} -> defapp agdaDefinitionRecordDef [pure $ qQName qn] Axiom{} -> defapp agdaDefinitionPostulate [] Primitive{} -> defapp agdaDefinitionPrimitive [] Constructor{} -> defapp agdaDefinitionDataConstructor [] unquoteQName <- fromTerm t <- el primQName --> el primAgdaDefinition return $ PrimImpl t $ PrimFun __IMPOSSIBLE__ 1 $ \ts -> case ts of [v] -> redBind (unquoteQName v) (\v' -> [v']) $ \x -> redReturn =<< con x _ -> __IMPOSSIBLE__ primDataConstructors :: TCM PrimitiveImpl primDataConstructors = mkPrimFun1TCM (el primAgdaDataDef --> el (list primQName)) (fmap (dataCons . theDef) . getConstInfo) mkPrimLevelZero :: TCM PrimitiveImpl mkPrimLevelZero = do t <- primType (undefined :: Lvl) return $ PrimImpl t $ PrimFun __IMPOSSIBLE__ 0 $ \_ -> redReturn $ Level $ Max [] mkPrimLevelSuc :: TCM PrimitiveImpl mkPrimLevelSuc = do t <- primType (id :: Lvl -> Lvl) return $ PrimImpl t $ PrimFun __IMPOSSIBLE__ 1 $ \ ~[a] -> do l <- levelView' $ unArg a redReturn $ Level $ levelSuc l mkPrimLevelMax :: TCM PrimitiveImpl mkPrimLevelMax = do t <- primType (max :: Op Lvl) return $ PrimImpl t $ PrimFun __IMPOSSIBLE__ 2 $ \ ~[a, b] -> do Max as <- levelView' $ unArg a Max bs <- levelView' $ unArg b redReturn $ Level $ levelMax $ as ++ bs mkPrimFun1TCM :: (FromTerm a, ToTerm b, TermLike b) => TCM Type -> (a -> ReduceM b) -> TCM PrimitiveImpl mkPrimFun1TCM mt f = do toA <- fromTerm fromB <- toTermR t <- mt return $ PrimImpl t $ PrimFun __IMPOSSIBLE__ 1 $ \ts -> case ts of [v] -> redBind (toA v) (\v' -> [v']) $ \x -> do b <- f x case allMetas b of (m:_) -> return $ NoReduction [reduced (Blocked m v)] [] -> redReturn =<< fromB b _ -> __IMPOSSIBLE__ -- Tying the knot mkPrimFun1 :: (PrimType a, FromTerm a, PrimType b, ToTerm b) => (a -> b) -> TCM PrimitiveImpl mkPrimFun1 f = do toA <- fromTerm fromB <- toTerm t <- primType f return $ PrimImpl t $ PrimFun __IMPOSSIBLE__ 1 $ \ts -> case ts of [v] -> redBind (toA v) (\v' -> [v']) $ \x -> redReturn $ fromB $ f x _ -> __IMPOSSIBLE__ mkPrimFun2 :: ( PrimType a, FromTerm a, ToTerm a , PrimType b, FromTerm b , PrimType c, ToTerm c ) => (a -> b -> c) -> TCM PrimitiveImpl mkPrimFun2 f = do toA <- fromTerm fromA <- toTerm toB <- fromTerm fromC <- toTerm t <- primType f return $ PrimImpl t $ PrimFun __IMPOSSIBLE__ 2 $ \ts -> case ts of [v,w] -> redBind (toA v) (\v' -> [v', notReduced w]) $ \x -> redBind (toB w) (\w' -> [ reduced $ notBlocked $ Arg (argInfo v) (fromA x) , w']) $ \y -> redReturn $ fromC $ f x y _ -> __IMPOSSIBLE__ mkPrimFun4 :: ( PrimType a, FromTerm a, ToTerm a , PrimType b, FromTerm b, ToTerm b , PrimType c, FromTerm c, ToTerm c , PrimType d, FromTerm d , PrimType e, ToTerm e ) => (a -> b -> c -> d -> e) -> TCM PrimitiveImpl mkPrimFun4 f = do (toA, fromA) <- (,) <$> fromTerm <*> toTerm (toB, fromB) <- (,) <$> fromTerm <*> toTerm (toC, fromC) <- (,) <$> fromTerm <*> toTerm toD <- fromTerm fromE <- toTerm t <- primType f return $ PrimImpl t $ PrimFun __IMPOSSIBLE__ 4 $ \ts -> let argFrom fromX a x = reduced $ notBlocked $ Arg (argInfo a) (fromX x) in case ts of [a,b,c,d] -> redBind (toA a) (\a' -> a' : map notReduced [b,c,d]) $ \x -> redBind (toB b) (\b' -> [argFrom fromA a x, b', notReduced c, notReduced d]) $ \y -> redBind (toC c) (\c' -> [ argFrom fromA a x , argFrom fromB b y , c', notReduced d]) $ \z -> redBind (toD d) (\d' -> [ argFrom fromA a x , argFrom fromB b y , argFrom fromC c z , d']) $ \w -> redReturn $ fromE $ f x y z w _ -> __IMPOSSIBLE__ -- Type combinators infixr 4 --> infixr 4 .--> infixr 4 ..--> (-->), (.-->), (..-->) :: TCM Type -> TCM Type -> TCM Type a --> b = garr id a b a .--> b = garr (const $ Irrelevant) a b a ..--> b = garr (const $ NonStrict) a b garr :: (Relevance -> Relevance) -> TCM Type -> TCM Type -> TCM Type garr f a b = do a' <- a b' <- b return $ El (getSort a' `sLub` getSort b') $ Pi (Dom (mapRelevance f defaultArgInfo) a') (NoAbs "_" b') gpi :: I.ArgInfo -> String -> TCM Type -> TCM Type -> TCM Type gpi info name a b = do a <- a b <- addContext (name, Dom info a) b let y = stringToArgName name return $ El (getSort a `dLub` Abs y (getSort b)) (Pi (Dom info a) (Abs y b)) hPi, nPi :: String -> TCM Type -> TCM Type -> TCM Type hPi = gpi $ setHiding Hidden defaultArgInfo nPi = gpi defaultArgInfo varM :: Int -> TCM Term varM = return . var infixl 9 <@>, <#> gApply :: Hiding -> TCM Term -> TCM Term -> TCM Term gApply h a b = do x <- a y <- b return $ x `apply` [Arg (setHiding h defaultArgInfo) y] (<@>),(<#>) :: TCM Term -> TCM Term -> TCM Term (<@>) = gApply NotHidden (<#>) = gApply Hidden list :: TCM Term -> TCM Term list t = primList <@> t io :: TCM Term -> TCM Term io t = primIO <@> t el :: TCM Term -> TCM Type el t = El (mkType 0) <$> t tset :: TCM Type tset = return $ sort (mkType 0) tSetOmega :: TCM Type tSetOmega = return $ sort Inf tSizeUniv :: TCM Type tSizeUniv = return $ El SizeUniv $ Sort SizeUniv -- Andreas, 2015-03-16 Since equality checking for types -- includes equality checking for sorts, we cannot put -- SizeUniv in Setω. (SizeUniv : Setω) == (_0 : suc _0) -- will first instantiate _0 := Setω, which is wrong. -- tSizeUniv = return $ El Inf $ Sort SizeUniv -- | Abbreviation: @argN = 'Arg' 'defaultArgInfo'@. argN :: e -> I.Arg e argN = Arg defaultArgInfo domN :: e -> I.Dom e domN = Dom defaultArgInfo -- | Abbreviation: @argH = 'hide' 'Arg' 'defaultArgInfo'@. argH :: e -> I.Arg e argH = Arg $ setHiding Hidden defaultArgInfo domH :: e -> I.Dom e domH = Dom $ setHiding Hidden defaultArgInfo --------------------------------------------------------------------------- -- * The actual primitive functions --------------------------------------------------------------------------- type Op a = a -> a -> a type Fun a = a -> a type Rel a = a -> a -> Bool type Pred a = a -> Bool primitiveFunctions :: Map String (TCM PrimitiveImpl) primitiveFunctions = Map.fromList -- Integer functions [ "primIntegerPlus" |-> mkPrimFun2 ((+) :: Op Integer) , "primIntegerMinus" |-> mkPrimFun2 ((-) :: Op Integer) , "primIntegerTimes" |-> mkPrimFun2 ((*) :: Op Integer) , "primIntegerDiv" |-> mkPrimFun2 (div :: Op Integer) -- partial , "primIntegerMod" |-> mkPrimFun2 (mod :: Op Integer) -- partial , "primIntegerEquality" |-> mkPrimFun2 ((==) :: Rel Integer) , "primIntegerLess" |-> mkPrimFun2 ((<) :: Rel Integer) , "primIntegerAbs" |-> mkPrimFun1 (Nat . abs :: Integer -> Nat) , "primNatToInteger" |-> mkPrimFun1 (toInteger :: Nat -> Integer) , "primShowInteger" |-> mkPrimFun1 (Str . show :: Integer -> Str) -- Natural number functions , "primNatPlus" |-> mkPrimFun2 ((+) :: Op Nat) , "primNatMinus" |-> mkPrimFun2 ((\x y -> max 0 (x - y)) :: Op Nat) , "primNatTimes" |-> mkPrimFun2 ((*) :: Op Nat) , "primNatDivSucAux" |-> mkPrimFun4 ((\k m n j -> k + div (max 0 $ n + m - j) (m + 1)) :: Nat -> Nat -> Nat -> Nat -> Nat) , "primNatModSucAux" |-> let aux :: Nat -> Nat -> Nat -> Nat -> Nat aux k m n j | n > j = mod (n - j - 1) (m + 1) | otherwise = k + n in mkPrimFun4 aux , "primNatEquality" |-> mkPrimFun2 ((==) :: Rel Nat) , "primNatLess" |-> mkPrimFun2 ((<) :: Rel Nat) -- Level functions , "primLevelZero" |-> mkPrimLevelZero , "primLevelSuc" |-> mkPrimLevelSuc , "primLevelMax" |-> mkPrimLevelMax -- Floating point functions , "primIntegerToFloat" |-> mkPrimFun1 (fromIntegral :: Integer -> Double) , "primFloatPlus" |-> mkPrimFun2 ((+) :: Op Double) , "primFloatMinus" |-> mkPrimFun2 ((-) :: Op Double) , "primFloatTimes" |-> mkPrimFun2 ((*) :: Op Double) , "primFloatDiv" |-> mkPrimFun2 ((/) :: Op Double) , "primFloatEquality" |-> mkPrimFun2 ((==) :: Rel Double) , "primFloatLess" |-> mkPrimFun2 ((<) :: Rel Double) , "primRound" |-> mkPrimFun1 (round :: Double -> Integer) , "primFloor" |-> mkPrimFun1 (floor :: Double -> Integer) , "primCeiling" |-> mkPrimFun1 (ceiling :: Double -> Integer) , "primExp" |-> mkPrimFun1 (exp :: Fun Double) , "primLog" |-> mkPrimFun1 (log :: Fun Double) -- partial , "primSin" |-> mkPrimFun1 (sin :: Fun Double) , "primShowFloat" |-> mkPrimFun1 (Str . show :: Double -> Str) -- Character functions , "primCharEquality" |-> mkPrimFun2 ((==) :: Rel Char) , "primIsLower" |-> mkPrimFun1 isLower , "primIsDigit" |-> mkPrimFun1 isDigit , "primIsAlpha" |-> mkPrimFun1 isAlpha , "primIsSpace" |-> mkPrimFun1 isSpace , "primIsAscii" |-> mkPrimFun1 isAscii , "primIsLatin1" |-> mkPrimFun1 isLatin1 , "primIsPrint" |-> mkPrimFun1 isPrint , "primIsHexDigit" |-> mkPrimFun1 isHexDigit , "primToUpper" |-> mkPrimFun1 toUpper , "primToLower" |-> mkPrimFun1 toLower , "primCharToNat" |-> mkPrimFun1 (fromIntegral . fromEnum :: Char -> Nat) , "primNatToChar" |-> mkPrimFun1 (toEnum . fromIntegral :: Nat -> Char) , "primShowChar" |-> mkPrimFun1 (Str . show . pretty . LitChar noRange) -- String functions , "primStringToList" |-> mkPrimFun1 unStr , "primStringFromList" |-> mkPrimFun1 Str , "primStringAppend" |-> mkPrimFun2 (\s1 s2 -> Str $ unStr s1 ++ unStr s2) , "primStringEquality" |-> mkPrimFun2 ((==) :: Rel Str) , "primShowString" |-> mkPrimFun1 (Str . show . pretty . LitString noRange . unStr) -- Reflection , "primQNameType" |-> primQNameType , "primQNameDefinition" |-> primQNameDefinition , "primDataConstructors"|-> primDataConstructors -- Other stuff , "primTrustMe" |-> primTrustMe , "primQNameEquality" |-> mkPrimFun2 ((==) :: Rel QName) , "primShowQName" |-> mkPrimFun1 (Str . show :: QName -> Str) ] where (|->) = (,) lookupPrimitiveFunction :: String -> TCM PrimitiveImpl lookupPrimitiveFunction x = fromMaybe (typeError $ NoSuchPrimitiveFunction x) (Map.lookup x primitiveFunctions) lookupPrimitiveFunctionQ :: QName -> TCM (String, PrimitiveImpl) lookupPrimitiveFunctionQ q = do let s = case qnameName q of Name _ x _ _ -> show x PrimImpl t pf <- lookupPrimitiveFunction s return (s, PrimImpl t $ pf { primFunName = q }) Agda-2.4.2.5/src/full/Agda/TypeChecking/Substitute.hs0000644000000000000000000013027712635075266020403 0ustar0000000000000000{-# LANGUAGE CPP #-} {-# LANGUAGE DeriveDataTypeable #-} {-# LANGUAGE DeriveFunctor #-} {-# LANGUAGE FlexibleContexts #-} {-# LANGUAGE FlexibleInstances #-} {-# LANGUAGE PatternGuards #-} {-# LANGUAGE StandaloneDeriving #-} {-# LANGUAGE TupleSections #-} #if __GLASGOW_HASKELL__ <= 708 {-# LANGUAGE OverlappingInstances #-} #endif {-# OPTIONS_GHC -fno-warn-orphans #-} module Agda.TypeChecking.Substitute ( module Agda.TypeChecking.Substitute , Substitution(..) ) where import Control.Arrow ((***), first, second) import Data.Function import Data.Functor import Data.List hiding (sort, drop) import qualified Data.List as List import Data.Map (Map) import Data.Monoid import Data.Typeable (Typeable) import Debug.Trace (trace) import Agda.Syntax.Common hiding (Arg, Dom, NamedArg) import qualified Agda.Syntax.Common as Common import Agda.Syntax.Internal import Agda.Syntax.Position import Agda.TypeChecking.Monad.Base import Agda.TypeChecking.Free as Free import Agda.TypeChecking.CompiledClause import Agda.TypeChecking.Positivity.Occurrence as Occ import Agda.Utils.Empty import Agda.Utils.Functor import Agda.Utils.List import Agda.Utils.Monad import Agda.Utils.Permutation import Agda.Utils.Size import Agda.Utils.Tuple #include "undefined.h" import Agda.Utils.Impossible --------------------------------------------------------------------------- -- * Application --------------------------------------------------------------------------- -- | Apply something to a bunch of arguments. -- Preserves blocking tags (application can never resolve blocking). class Apply t where apply :: t -> Args -> t applyE :: t -> Elims -> t apply t args = applyE t $ map Apply args applyE t es = apply t $ map argFromElim es -- precondition: all @es@ are @Apply@s -- | Apply to a single argument. apply1 :: Apply t => t -> Term -> t apply1 t u = apply t [ defaultArg u ] instance Apply Term where applyE m [] = m applyE m es = case m of Var i es' -> Var i (es' ++ es) Def f es' -> defApp f es' es -- remove projection redexes Con c args -> conApp c args es Lam _ b -> case es of Apply a : es0 -> lazyAbsApp b (unArg a) `applyE` es0 _ -> __IMPOSSIBLE__ MetaV x es' -> MetaV x (es' ++ es) Shared p -> Shared $ applyE p es Lit{} -> __IMPOSSIBLE__ Level{} -> __IMPOSSIBLE__ Pi _ _ -> __IMPOSSIBLE__ Sort _ -> __IMPOSSIBLE__ DontCare mv -> dontCare $ mv `applyE` es -- Andreas, 2011-10-02 -- need to go under DontCare, since "with" might resurrect irrelevant term ExtLam _ _ -> __IMPOSSIBLE__ -- | If $v$ is a record value, @canProject f v@ -- returns its field @f@. canProject :: QName -> Term -> Maybe (Arg Term) canProject f v = case ignoreSharing v of (Con (ConHead _ _ fs) vs) -> do i <- elemIndex f fs headMaybe (drop i vs) _ -> Nothing -- | Eliminate a constructed term. conApp :: ConHead -> Args -> Elims -> Term conApp ch args [] = Con ch args conApp ch args (Apply a : es) = conApp ch (args ++ [a]) es conApp ch@(ConHead c _ fs) args (Proj f : es) = let failure = flip trace __IMPOSSIBLE__ $ "conApp: constructor " ++ show c ++ " with fields " ++ show fs ++ " projected by " ++ show f i = maybe failure id $ elemIndex f fs v = maybe failure argToDontCare $ headMaybe $ drop i args in applyE v es {- i = maybe failure id $ elemIndex f $ map unArg fs v = maybe failure unArg $ headMaybe $ drop i args -- Andreas, 2013-10-20 see Issue543a: -- protect result of irrelevant projection. r = maybe __IMPOSSIBLE__ getRelevance $ headMaybe $ drop i fs u | Irrelevant <- r = DontCare v | otherwise = v in applyE v es -} -- | @defApp f us vs@ applies @Def f us@ to further arguments @vs@, -- eliminating top projection redexes. -- If @us@ is not empty, we cannot have a projection redex, since -- the record argument is the first one. defApp :: QName -> Elims -> Elims -> Term defApp f [] (Apply a : es) | Just v <- canProject f (unArg a) = argToDontCare v `applyE` es defApp f es0 es = Def f $ es0 ++ es -- protect irrelevant fields (see issue 610) argToDontCare :: Common.Arg c Term -> Term argToDontCare (Common.Arg ai v) | Irrelevant <- getRelevance ai = dontCare v | otherwise = v instance Apply Type where apply = piApply -- Maybe an @applyE@ instance would be useful here as well. -- A record type could be applied to a projection name -- to yield the field type. -- However, this works only in the monad where we can -- look up the fields of a record type. instance Apply Sort where applyE s [] = s applyE s _ = __IMPOSSIBLE__ instance Apply a => Apply (Ptr a) where applyE p xs = fmap (`applyE` xs) p -- @applyE@ does not make sense for telecopes, definitions, clauses etc. instance Subst a => Apply (Tele a) where apply tel [] = tel apply EmptyTel _ = __IMPOSSIBLE__ apply (ExtendTel _ tel) (t : ts) = lazyAbsApp tel (unArg t) `apply` ts instance Apply Definition where apply (Defn info x t pol occ df m c inst d) args = Defn info x (piApply t args) (apply pol args) (apply occ args) df m c inst (apply d args) instance Apply RewriteRule where apply r args = RewriteRule { rewName = rewName r , rewContext = apply (rewContext r) args , rewLHS = applySubst sub (rewLHS r) , rewRHS = applySubst sub (rewRHS r) , rewType = applySubst sub (rewType r) } where sub = parallelS (map unArg args) #if __GLASGOW_HASKELL__ >= 710 instance {-# OVERLAPPING #-} Apply [Occ.Occurrence] where #else instance Apply [Occ.Occurrence] where #endif apply occ args = List.drop (length args) occ #if __GLASGOW_HASKELL__ >= 710 instance {-# OVERLAPPING #-} Apply [Polarity] where #else instance Apply [Polarity] where #endif apply pol args = List.drop (length args) pol instance Apply Projection where apply p args = p { projIndex = projIndex p - size args , projDropPars = projDropPars p `apply` args } instance Apply Defn where apply d [] = d apply d args = case d of Axiom{} -> d Function{ funClauses = cs, funCompiled = cc, funInv = inv , funProjection = Nothing } -> d { funClauses = apply cs args , funCompiled = apply cc args , funInv = apply inv args } Function{ funClauses = cs, funCompiled = cc, funInv = inv , funProjection = Just p0} -> case p0 `apply` args of p@Projection{ projIndex = n } | n < 0 -> __IMPOSSIBLE__ -- case: applied only to parameters | n > 0 -> d { funProjection = Just p } -- case: applied also to record value (n == 0) | otherwise -> d { funClauses = apply cs args' , funCompiled = apply cc args' , funInv = apply inv args' , funProjection = if isVar0 then Just p{ projIndex = 0 } else Nothing } where larg = last args -- the record value args' = [larg] isVar0 = case ignoreSharing $ unArg larg of Var 0 [] -> True; _ -> False {- Function{ funClauses = cs, funCompiled = cc, funInv = inv , funProjection = Just p@Projection{ projIndex = n } } -- case: only applying parameters | size args < n -> d { funProjection = Just $ p `apply` args } -- case: apply also to record value | otherwise -> d { funClauses = apply cs args' , funCompiled = apply cc args' , funInv = apply inv args' , funProjection = Just $ p { projIndex = 0 } -- Nothing ? } where args' = [last args] -- the record value -} Datatype{ dataPars = np, dataSmallPars = sps, dataNonLinPars = nlps, dataClause = cl {-, dataArgOccurrences = occ-} } -> d { dataPars = np - size args , dataSmallPars = apply sps args , dataNonLinPars = apply nlps args , dataClause = apply cl args -- , dataArgOccurrences = List.drop (length args) occ } Record{ recPars = np, recConType = t, recClause = cl, recTel = tel {-, recArgOccurrences = occ-} } -> d { recPars = np - size args, recConType = apply t args , recClause = apply cl args, recTel = apply tel args -- , recArgOccurrences = List.drop (length args) occ } Constructor{ conPars = np } -> d { conPars = np - size args } Primitive{ primClauses = cs } -> d { primClauses = apply cs args } instance Apply PrimFun where apply (PrimFun x ar def) args = PrimFun x (ar - size args) $ \vs -> def (args ++ vs) instance Apply Clause where apply (Clause r tel perm ps b t) args = Clause r (apply tel args) (apply perm args) (List.drop (size args) ps) (apply b args) (applySubst (parallelS (map unArg args)) t) instance Apply CompiledClauses where apply cc args = case cc of Fail -> Fail Done hs t | length hs >= len -> Done (List.drop len hs) (applySubst (parallelS $ [ var i | i <- [0..length hs - len - 1]] ++ map unArg args) t) | otherwise -> __IMPOSSIBLE__ Case n bs | n >= len -> Case (n - len) (apply bs args) | otherwise -> __IMPOSSIBLE__ where len = length args instance Apply a => Apply (WithArity a) where apply (WithArity n a) args = WithArity n $ apply a args applyE (WithArity n a) es = WithArity n $ applyE a es instance Apply a => Apply (Case a) where apply (Branches cop cs ls m) args = Branches cop (apply cs args) (apply ls args) (apply m args) applyE (Branches cop cs ls m) es = Branches cop (applyE cs es) (applyE ls es) (applyE m es) instance Apply FunctionInverse where apply NotInjective args = NotInjective apply (Inverse inv) args = Inverse $ apply inv args instance Apply ClauseBody where apply b [] = b apply (Bind b) (a:args) = lazyAbsApp b (unArg a) `apply` args apply (Body v) args = Body $ v `apply` args apply NoBody _ = NoBody applyE b [] = b applyE (Bind b) (Apply a : es) = lazyAbsApp b (unArg a) `applyE` es applyE (Bind b) (Proj{} : es) = __IMPOSSIBLE__ applyE (Body v) es = Body $ v `applyE` es applyE NoBody _ = NoBody instance Apply DisplayTerm where apply (DTerm v) args = DTerm $ apply v args apply (DDot v) args = DDot $ apply v args apply (DCon c vs) args = DCon c $ vs ++ map (fmap DTerm) args apply (DDef c es) args = DDef c $ es ++ map (Apply . fmap DTerm) args apply (DWithApp v ws args') args = DWithApp v ws $ args' ++ args #if __GLASGOW_HASKELL__ >= 710 instance {-# OVERLAPPABLE #-} Apply t => Apply [t] where #else instance Apply t => Apply [t] where #endif apply ts args = map (`apply` args) ts applyE ts es = map (`applyE` es) ts instance Apply t => Apply (Blocked t) where apply b args = fmap (`apply` args) b applyE b es = fmap (`applyE` es) b instance Apply t => Apply (Maybe t) where apply x args = fmap (`apply` args) x applyE x es = fmap (`applyE` es) x instance Apply v => Apply (Map k v) where apply x args = fmap (`apply` args) x applyE x es = fmap (`applyE` es) x instance (Apply a, Apply b) => Apply (a,b) where apply (x,y) args = (apply x args, apply y args) applyE (x,y) es = (applyE x es , applyE y es ) instance (Apply a, Apply b, Apply c) => Apply (a,b,c) where apply (x,y,z) args = (apply x args, apply y args, apply z args) applyE (x,y,z) es = (applyE x es , applyE y es , applyE z es ) instance DoDrop a => Apply (Drop a) where apply x args = dropMore (size args) x instance DoDrop a => Abstract (Drop a) where abstract tel x = unDrop (size tel) x instance Apply Permutation where -- The permutation must start with [0..m - 1] -- NB: section (- m) not possible (unary minus), hence (flip (-) m) apply (Perm n xs) args = Perm (n - m) $ map (flip (-) m) $ genericDrop m xs where m = size args instance Abstract Permutation where abstract tel (Perm n xs) = Perm (n + m) $ [0..m - 1] ++ map (+ m) xs where m = size tel -- | The type must contain the right number of pis without have to perform any -- reduction. piApply :: Type -> Args -> Type piApply t [] = t piApply (El _ (Pi _ b)) (a:args) = lazyAbsApp b (unArg a) `piApply` args piApply (El s (Shared p)) args = piApply (El s $ derefPtr p) args piApply t args = trace ("piApply t = " ++ show t ++ "\n args = " ++ show args) __IMPOSSIBLE__ --------------------------------------------------------------------------- -- * Abstraction --------------------------------------------------------------------------- -- | @(abstract args v) `apply` args --> v[args]@. class Abstract t where abstract :: Telescope -> t -> t instance Abstract Term where abstract = teleLam instance Abstract Type where abstract = telePi_ instance Abstract Sort where abstract EmptyTel s = s abstract _ s = __IMPOSSIBLE__ instance Abstract Telescope where EmptyTel `abstract` tel = tel ExtendTel arg xtel `abstract` tel = ExtendTel arg $ xtel <&> (`abstract` tel) instance Abstract Definition where abstract tel (Defn info x t pol occ df m c inst d) = Defn info x (abstract tel t) (abstract tel pol) (abstract tel occ) df m c inst (abstract tel d) -- | @tel ⊢ (Γ ⊢ lhs ↦ rhs : t)@ becomes @tel, Γ ⊢ lhs ↦ rhs : t)@ -- we do not need to change lhs, rhs, and t since they live in Γ. -- See 'Abstract Clause'. instance Abstract RewriteRule where abstract tel (RewriteRule q gamma lhs rhs t) = RewriteRule q (abstract tel gamma) lhs rhs t #if __GLASGOW_HASKELL__ >= 710 instance {-# OVERLAPPING #-} Abstract [Occ.Occurrence] where #else instance Abstract [Occ.Occurrence] where #endif abstract tel [] = [] abstract tel occ = replicate (size tel) Mixed ++ occ -- TODO: check occurrence #if __GLASGOW_HASKELL__ >= 710 instance {-# OVERLAPPING #-} Abstract [Polarity] where #else instance Abstract [Polarity] where #endif abstract tel [] = [] abstract tel pol = replicate (size tel) Invariant ++ pol -- TODO: check polarity instance Abstract Projection where abstract tel p = p { projIndex = size tel + projIndex p , projDropPars = abstract tel $ projDropPars p , projArgInfo = if projIndex p > 0 then projArgInfo p else domInfo $ last $ telToList tel } instance Abstract Defn where abstract tel d = case d of Axiom{} -> d Function{ funClauses = cs, funCompiled = cc, funInv = inv , funProjection = Nothing } -> d { funClauses = abstract tel cs , funCompiled = abstract tel cc , funInv = abstract tel inv } Function{ funClauses = cs, funCompiled = cc, funInv = inv , funProjection = Just p } -> -- Andreas, 2015-05-11 if projection was applied to Var 0 -- then abstract over last element of tel (the others are params). if projIndex p > 0 then d' else d' { funClauses = abstract tel1 cs , funCompiled = abstract tel1 cc , funInv = abstract tel1 inv } where d' = d { funProjection = Just $ abstract tel p } tel1 = telFromList $ drop (size tel - 1) $ telToList tel Datatype{ dataPars = np, dataSmallPars = sps, dataNonLinPars = nlps, dataClause = cl } -> d { dataPars = np + size tel , dataSmallPars = abstract tel sps , dataNonLinPars = abstract tel nlps , dataClause = abstract tel cl } Record{ recPars = np, recConType = t, recClause = cl, recTel = tel' } -> d { recPars = np + size tel , recConType = abstract tel t , recClause = abstract tel cl , recTel = abstract tel tel' } Constructor{ conPars = np } -> d { conPars = np + size tel } Primitive{ primClauses = cs } -> d { primClauses = abstract tel cs } instance Abstract PrimFun where abstract tel (PrimFun x ar def) = PrimFun x (ar + n) $ \ts -> def $ genericDrop n ts where n = size tel instance Abstract Clause where abstract tel (Clause r tel' perm ps b t) = Clause r (abstract tel tel') (abstract tel perm) (namedTelVars tel ++ ps) (abstract tel b) t -- nothing to do for t, since it lives under the telescope instance Abstract CompiledClauses where abstract tel Fail = Fail abstract tel (Done xs t) = Done (map (argFromDom . fmap fst) (telToList tel) ++ xs) t abstract tel (Case n bs) = Case (n + fromIntegral (size tel)) (abstract tel bs) instance Abstract a => Abstract (WithArity a) where abstract tel (WithArity n a) = WithArity n $ abstract tel a instance Abstract a => Abstract (Case a) where abstract tel (Branches cop cs ls m) = Branches cop (abstract tel cs) (abstract tel ls) (abstract tel m) telVars :: Telescope -> [Arg Pattern] telVars = map (fmap namedThing) . namedTelVars namedTelVars :: Telescope -> [NamedArg Pattern] namedTelVars EmptyTel = [] namedTelVars (ExtendTel (Common.Dom info a) tel) = Common.Arg info (namedVarP $ absName tel) : namedTelVars (unAbs tel) instance Abstract FunctionInverse where abstract tel NotInjective = NotInjective abstract tel (Inverse inv) = Inverse $ abstract tel inv instance Abstract ClauseBody where abstract EmptyTel b = b abstract (ExtendTel _ tel) b = Bind $ fmap (`abstract` b) tel #if __GLASGOW_HASKELL__ >= 710 instance {-# OVERLAPPABLE #-} Abstract t => Abstract [t] where #else instance Abstract t => Abstract [t] where #endif abstract tel = map (abstract tel) instance Abstract t => Abstract (Maybe t) where abstract tel x = fmap (abstract tel) x instance Abstract v => Abstract (Map k v) where abstract tel m = fmap (abstract tel) m abstractArgs :: Abstract a => Args -> a -> a abstractArgs args x = abstract tel x where tel = foldr (\(Common.Arg info x) -> ExtendTel (Common.Dom info $ sort Prop) . Abs x) EmptyTel $ zipWith (<$) names args names = cycle $ map (stringToArgName . (:[])) ['a'..'z'] --------------------------------------------------------------------------- -- * Explicit substitutions --------------------------------------------------------------------------- -- See Syntax.Internal for the definition. idS :: Substitution idS = IdS wkS :: Int -> Substitution -> Substitution wkS 0 rho = rho wkS n (Wk m rho) = Wk (n + m) rho wkS n EmptyS = EmptyS wkS n rho = Wk n rho raiseS :: Int -> Substitution raiseS n = wkS n idS consS :: Term -> Substitution -> Substitution consS (Var n []) (Wk m rho) | n + 1 == m = wkS (m - 1) (liftS 1 rho) consS u rho = seq u (u :# rho) -- | To replace index @n@ by term @u@, do @applySubst (singletonS n u)@. singletonS :: Int -> Term -> Substitution singletonS n u = map var [0..n-1] ++# consS u (raiseS n) -- ALT: foldl (\ s i -> var i `consS` s) (consS u $ raiseS n) $ downFrom n -- | Lift a substitution under k binders. liftS :: Int -> Substitution -> Substitution liftS 0 rho = rho liftS k IdS = IdS liftS k (Lift n rho) = Lift (n + k) rho liftS k rho = Lift k rho dropS :: Int -> Substitution -> Substitution dropS 0 rho = rho dropS n IdS = raiseS n dropS n (Wk m rho) = wkS m (dropS n rho) dropS n (u :# rho) = dropS (n - 1) rho dropS n (Strengthen _ rho) = dropS (n - 1) rho dropS n (Lift 0 rho) = __IMPOSSIBLE__ dropS n (Lift m rho) = wkS 1 $ dropS (n - 1) $ liftS (m - 1) rho dropS n EmptyS = __IMPOSSIBLE__ -- | @applySubst (ρ `composeS` σ) v == applySubst ρ (applySubst σ v)@ composeS :: Substitution -> Substitution -> Substitution composeS rho IdS = rho composeS IdS sgm = sgm composeS rho EmptyS = EmptyS composeS rho (Wk n sgm) = composeS (dropS n rho) sgm composeS rho (u :# sgm) = applySubst rho u :# composeS rho sgm composeS rho (Strengthen err sgm) = Strengthen err (composeS rho sgm) composeS rho (Lift 0 sgm) = __IMPOSSIBLE__ composeS (u :# rho) (Lift n sgm) = u :# composeS rho (liftS (n - 1) sgm) composeS rho (Lift n sgm) = lookupS rho 0 :# composeS rho (wkS 1 (liftS (n - 1) sgm)) -- If Γ ⊢ ρ : Δ, Θ then splitS |Θ| ρ = (σ, δ), with -- Γ ⊢ σ : Δ -- Γ ⊢ δ : Θσ splitS :: Int -> Substitution -> (Substitution, Substitution) splitS 0 rho = (rho, EmptyS) splitS n (u :# rho) = second (u :#) $ splitS (n - 1) rho splitS n (Strengthen err rho) = second (Strengthen err) $ splitS (n - 1) rho splitS n (Lift 0 _) = __IMPOSSIBLE__ splitS n (Wk m rho) = wkS m *** wkS m $ splitS n rho splitS n IdS = (raiseS n, liftS n EmptyS) splitS n (Lift m rho) = wkS 1 *** liftS 1 $ splitS (n - 1) (liftS (m - 1) rho) splitS n EmptyS = __IMPOSSIBLE__ infixr 4 ++# (++#) :: [Term] -> Substitution -> Substitution us ++# rho = foldr consS rho us prependS :: Empty -> [Maybe Term] -> Substitution -> Substitution prependS err us rho = foldr f rho us where f Nothing rho = Strengthen err rho f (Just u) rho = consS u rho parallelS :: [Term] -> Substitution parallelS us = us ++# idS compactS :: Empty -> [Maybe Term] -> Substitution compactS err us = prependS err us idS -- | Γ ⊢ (strengthenS ⊥ |Δ|) : Γ,Δ strengthenS :: Empty -> Int -> Substitution strengthenS err n | n < 0 = __IMPOSSIBLE__ | otherwise = iterate (Strengthen err) idS !! n lookupS :: Substitution -> Nat -> Term lookupS rho i = case rho of IdS -> var i Wk n IdS -> let j = i + n in if j < 0 then __IMPOSSIBLE__ else var j Wk n rho -> applySubst (raiseS n) (lookupS rho i) u :# rho | i == 0 -> u | i < 0 -> __IMPOSSIBLE__ | otherwise -> lookupS rho (i - 1) Strengthen err rho | i == 0 -> absurd err | i < 0 -> __IMPOSSIBLE__ | otherwise -> lookupS rho (i - 1) Lift n rho | i < n -> var i | otherwise -> raise n $ lookupS rho (i - n) EmptyS -> __IMPOSSIBLE__ --------------------------------------------------------------------------- -- * Substitution and raising/shifting/weakening --------------------------------------------------------------------------- -- | Apply a substitution. -- For terms: -- -- Γ ⊢ ρ : Δ -- Δ ⊢ t : σ -- ----------- -- Γ ⊢ tρ : σρ class Subst t where applySubst :: Substitution -> t -> t raise :: Subst t => Nat -> t -> t raise = raiseFrom 0 raiseFrom :: Subst t => Nat -> Nat -> t -> t raiseFrom n k = applySubst (liftS n $ raiseS k) -- | Replace de Bruijn index i by a 'Term' in something. subst :: Subst t => Int -> Term -> t -> t subst i u = applySubst $ singletonS i u strengthen :: Subst t => Empty -> t -> t strengthen err = applySubst (compactS err [Nothing]) -- | Replace what is now de Bruijn index 0, but go under n binders. -- @substUnder n u == subst n (raise n u)@. substUnder :: Subst t => Nat -> Term -> t -> t substUnder n u = applySubst (liftS n (singletonS 0 u)) instance Subst Substitution where applySubst rho sgm = composeS rho sgm instance Subst Term where applySubst IdS t = t applySubst rho t = case t of Var i es -> lookupS rho i `applyE` applySubst rho es Lam h m -> Lam h $ applySubst rho m Def f es -> defApp f [] $ applySubst rho es Con c vs -> Con c $ applySubst rho vs MetaV x es -> MetaV x $ applySubst rho es Lit l -> Lit l Level l -> levelTm $ applySubst rho l Pi a b -> uncurry Pi $ applySubst rho (a,b) Sort s -> sortTm $ applySubst rho s Shared p -> Shared $ applySubst rho p DontCare mv -> dontCare $ applySubst rho mv ExtLam cs es-> ExtLam (applySubst rho cs) (applySubst rho es) instance Subst a => Subst (Ptr a) where applySubst rho = fmap (applySubst rho) instance (Subst a) => Subst (Type' a) where applySubst rho (El s t) = applySubst rho s `El` applySubst rho t instance Subst Sort where applySubst rho s = case s of Type n -> levelSort $ sub n Prop -> Prop Inf -> Inf SizeUniv -> SizeUniv DLub s1 s2 -> DLub (sub s1) (sub s2) where sub x = applySubst rho x instance Subst Level where applySubst rho (Max as) = Max $ applySubst rho as instance Subst PlusLevel where applySubst rho l@ClosedLevel{} = l applySubst rho (Plus n l) = Plus n $ applySubst rho l instance Subst LevelAtom where applySubst rho (MetaLevel m vs) = MetaLevel m $ applySubst rho vs applySubst rho (BlockedLevel m v) = BlockedLevel m $ applySubst rho v applySubst rho (NeutralLevel _ v) = UnreducedLevel $ applySubst rho v applySubst rho (UnreducedLevel v) = UnreducedLevel $ applySubst rho v instance Subst Bool where applySubst rho = id #if __GLASGOW_HASKELL__ >= 710 instance {-# OVERLAPPING #-} Subst String where #else instance Subst String where #endif applySubst rho = id instance Subst Name where applySubst rho = id instance Subst ConPatternInfo where applySubst rho (ConPatternInfo mr mt) = ConPatternInfo mr $ applySubst rho mt instance Subst Pattern where applySubst rho p = case p of ConP c mt ps -> ConP c (applySubst rho mt) $ applySubst rho ps DotP t -> DotP $ applySubst rho t VarP s -> p LitP l -> p ProjP _ -> p instance Subst NLPat where applySubst rho p = case p of PVar i -> p PWild -> p PDef f es -> PDef f $ applySubst rho es PLam i u -> PLam i $ applySubst rho u PPi a b -> PPi (applySubst rho a) (applySubst rho b) PBoundVar i es -> PBoundVar i $ applySubst rho es PTerm u -> PTerm $ applySubst rho u instance Subst t => Subst (Blocked t) where applySubst rho b = fmap (applySubst rho) b instance Subst DisplayForm where applySubst rho (Display n ps v) = Display n (applySubst (liftS 1 rho) ps) (applySubst (liftS n rho) v) instance Subst DisplayTerm where applySubst rho (DTerm v) = DTerm $ applySubst rho v applySubst rho (DDot v) = DDot $ applySubst rho v applySubst rho (DCon c vs) = DCon c $ applySubst rho vs applySubst rho (DDef c es) = DDef c $ applySubst rho es applySubst rho (DWithApp v vs ws) = uncurry3 DWithApp $ applySubst rho (v, vs, ws) instance Subst a => Subst (Tele a) where applySubst rho EmptyTel = EmptyTel applySubst rho (ExtendTel t tel) = uncurry ExtendTel $ applySubst rho (t, tel) instance Subst Constraint where applySubst rho c = case c of ValueCmp cmp a u v -> ValueCmp cmp (rf a) (rf u) (rf v) ElimCmp ps a v e1 e2 -> ElimCmp ps (rf a) (rf v) (rf e1) (rf e2) TypeCmp cmp a b -> TypeCmp cmp (rf a) (rf b) TelCmp a b cmp tel1 tel2 -> TelCmp (rf a) (rf b) cmp (rf tel1) (rf tel2) SortCmp cmp s1 s2 -> SortCmp cmp (rf s1) (rf s2) LevelCmp cmp l1 l2 -> LevelCmp cmp (rf l1) (rf l2) Guarded c cs -> Guarded (rf c) cs IsEmpty r a -> IsEmpty r (rf a) CheckSizeLtSat t -> CheckSizeLtSat (rf t) FindInScope m cands -> FindInScope m (rf cands) UnBlock{} -> c where rf x = applySubst rho x instance Subst a => Subst (Elim' a) where applySubst rho e = case e of Apply v -> Apply $ applySubst rho v Proj{} -> e instance Subst a => Subst (Abs a) where applySubst rho (Abs x a) = Abs x $ applySubst (liftS 1 rho) a applySubst rho (NoAbs x a) = NoAbs x $ applySubst rho a instance Subst a => Subst (Arg a) where applySubst rho = fmap (applySubst rho) instance Subst a => Subst (Named name a) where applySubst rho = fmap (applySubst rho) instance Subst a => Subst (Dom a) where applySubst rho = fmap (applySubst rho) instance Subst a => Subst (Maybe a) where applySubst rho = fmap (applySubst rho) instance Subst a => Subst [a] where applySubst rho = map (applySubst rho) instance Subst () where applySubst _ _ = () instance (Subst a, Subst b) => Subst (a,b) where applySubst rho (x,y) = (applySubst rho x, applySubst rho y) instance (Subst a, Subst b, Subst c) => Subst (a,b,c) where applySubst rho (x,y,z) = (applySubst rho x, applySubst rho y, applySubst rho z) instance (Subst a, Subst b, Subst c, Subst d) => Subst (a,b,c,d) where applySubst rho (x,y,z,u) = (applySubst rho x, applySubst rho y, applySubst rho z, applySubst rho u) instance Subst ClauseBody where applySubst rho (Body t) = Body $ applySubst rho t applySubst rho (Bind b) = Bind $ applySubst rho b applySubst _ NoBody = NoBody instance Subst Clause where -- NOTE: This only happens when reifying extended lambdas, in which case there are -- no interesting dot patterns and we don't care about the type. applySubst rho c = c { clauseBody = applySubst rho $ clauseBody c } --------------------------------------------------------------------------- -- * Telescopes --------------------------------------------------------------------------- type TelView = TelV Type data TelV a = TelV { theTel :: Tele (Dom a), theCore :: a } deriving (Typeable, Show, Eq, Ord, Functor) type ListTel' a = [Dom (a, Type)] type ListTel = ListTel' ArgName telFromList' :: (a -> ArgName) -> ListTel' a -> Telescope telFromList' f = foldr extTel EmptyTel where extTel (Common.Dom info (x, a)) = ExtendTel (Common.Dom info a) . Abs (f x) telFromList :: ListTel -> Telescope telFromList = telFromList' id telToList :: Telescope -> ListTel telToList EmptyTel = [] telToList (ExtendTel arg tel) = fmap (absName tel,) arg : telToList (absBody tel) -- Andreas, 2013-12-14: This would work also for 'NoAbs', -- since 'absBody' raises. telToArgs :: Telescope -> [Arg ArgName] telToArgs tel = [ Common.Arg (domInfo d) (fst $ unDom d) | d <- telToList tel ] -- | Turn a typed binding @(x1 .. xn : A)@ into a telescope. bindsToTel' :: (Name -> a) -> [Name] -> Dom Type -> ListTel' a bindsToTel' f [] t = [] bindsToTel' f (x:xs) t = fmap (f x,) t : bindsToTel' f xs (raise 1 t) bindsToTel :: [Name] -> Dom Type -> ListTel bindsToTel = bindsToTel' nameToArgName -- | Turn a typed binding @(x1 .. xn : A)@ into a telescope. bindsWithHidingToTel' :: (Name -> a) -> [WithHiding Name] -> Dom Type -> ListTel' a bindsWithHidingToTel' f [] t = [] bindsWithHidingToTel' f (WithHiding h x : xs) t = fmap (f x,) (mapHiding (mappend h) t) : bindsWithHidingToTel' f xs (raise 1 t) bindsWithHidingToTel :: [WithHiding Name] -> Dom Type -> ListTel bindsWithHidingToTel = bindsWithHidingToTel' nameToArgName -- | Takes off all exposed function domains from the given type. -- This means that it does not reduce to expose @Pi@-types. telView' :: Type -> TelView telView' = telView'UpTo (-1) -- | @telView'UpTo n t@ takes off the first @n@ exposed function types of @t@. -- Takes off all (exposed ones) if @n < 0@. telView'UpTo :: Int -> Type -> TelView telView'UpTo 0 t = TelV EmptyTel t telView'UpTo n t = case ignoreSharing $ unEl t of Pi a b -> absV a (absName b) $ telView'UpTo (n - 1) (absBody b) _ -> TelV EmptyTel t where absV a x (TelV tel t) = TelV (ExtendTel a (Abs x tel)) t -- | @mkPi dom t = telePi (telFromList [dom]) t@ mkPi :: Dom (ArgName, Type) -> Type -> Type mkPi (Common.Dom info (x, a)) b = el $ Pi (Common.Dom info a) (mkAbs x b) where el = El $ dLub (getSort a) (Abs x (getSort b)) -- dLub checks x freeIn mkLam :: Arg ArgName -> Term -> Term mkLam a v = Lam (argInfo a) (Abs (unArg a) v) telePi' :: (Abs Type -> Abs Type) -> Telescope -> Type -> Type telePi' reAbs = telePi where telePi EmptyTel t = t telePi (ExtendTel u tel) t = el $ Pi u $ reAbs b where b = (`telePi` t) <$> tel s1 = getSort u s2 = getSort <$> b el = El $ dLub s1 s2 -- | Uses free variable analysis to introduce 'noAbs' bindings. telePi :: Telescope -> Type -> Type telePi = telePi' reAbs -- | Everything will be a 'Abs'. telePi_ :: Telescope -> Type -> Type telePi_ = telePi' id {- OLD -- | Everything will be a pi. telePi_ EmptyTel t = t telePi_ (ExtendTel u tel) t = el $ Pi u b where el = El (dLub s1 s2) b = fmap (flip telePi_ t) tel s1 = getSort $ unDom u s2 = fmap getSort b -} teleLam :: Telescope -> Term -> Term teleLam EmptyTel t = t teleLam (ExtendTel u tel) t = Lam (domInfo u) $ flip teleLam t <$> tel -- | Performs void ('noAbs') abstraction over telescope. class TeleNoAbs a where teleNoAbs :: a -> Term -> Term instance TeleNoAbs ListTel where teleNoAbs tel t = foldr (\ (Common.Dom ai (x, _)) -> Lam ai . NoAbs x) t tel instance TeleNoAbs Telescope where teleNoAbs tel = teleNoAbs $ telToList tel -- | Dependent least upper bound, to assign a level to expressions -- like @forall i -> Set i@. -- -- @dLub s1 \i.s2 = \omega@ if @i@ appears in the rigid variables of @s2@. dLub :: Sort -> Abs Sort -> Sort dLub s1 (NoAbs _ s2) = sLub s1 s2 dLub s1 b@(Abs _ s2) = case occurrence 0 s2 of Flexible -> DLub s1 b Irrelevantly -> DLub s1 b NoOccurrence -> sLub s1 (noabsApp __IMPOSSIBLE__ b) -- Free.Unused -> sLub s1 (absApp b __IMPOSSIBLE__) -- triggers Issue784 Free.Unused -> DLub s1 b StronglyRigid -> Inf Unguarded -> Inf WeaklyRigid -> Inf --------------------------------------------------------------------------- -- * Functions on abstractions -- and things we couldn't do before we could define 'absBody' --------------------------------------------------------------------------- -- | Instantiate an abstraction. Strict in the term. absApp :: Subst t => Abs t -> Term -> t absApp (Abs _ v) u = subst 0 u v absApp (NoAbs _ v) _ = v -- | Instantiate an abstraction. Lazy in the term, which allow it to be -- __IMPOSSIBLE__ in the case where the variable shouldn't be used but we -- cannot use 'noabsApp'. Used in Apply. lazyAbsApp :: Subst t => Abs t -> Term -> t lazyAbsApp (Abs _ v) u = applySubst (u :# IdS) v -- Note: do not use consS here! lazyAbsApp (NoAbs _ v) _ = v -- | Instantiate an abstraction that doesn't use its argument. noabsApp :: Subst t => Empty -> Abs t -> t noabsApp err (Abs _ v) = strengthen err v noabsApp _ (NoAbs _ v) = v absBody :: Subst t => Abs t -> t absBody (Abs _ v) = v absBody (NoAbs _ v) = raise 1 v mkAbs :: (Subst a, Free a) => ArgName -> a -> Abs a mkAbs x v | 0 `freeIn` v = Abs x v | otherwise = NoAbs x (raise (-1) v) reAbs :: (Subst a, Free a) => Abs a -> Abs a reAbs (NoAbs x v) = NoAbs x v reAbs (Abs x v) = mkAbs x v -- | @underAbs k a b@ applies @k@ to @a@ and the content of -- abstraction @b@ and puts the abstraction back. -- @a@ is raised if abstraction was proper such that -- at point of application of @k@ and the content of @b@ -- are at the same context. -- Precondition: @a@ and @b@ are at the same context at call time. underAbs :: Subst a => (a -> b -> b) -> a -> Abs b -> Abs b underAbs cont a b = case b of Abs x t -> Abs x $ cont (raise 1 a) t NoAbs x t -> NoAbs x $ cont a t -- | @underLambdas n k a b@ drops @n@ initial 'Lam's from @b@, -- performs operation @k@ on @a@ and the body of @b@, -- and puts the 'Lam's back. @a@ is raised correctly -- according to the number of abstractions. underLambdas :: Subst a => Int -> (a -> Term -> Term) -> a -> Term -> Term underLambdas n cont a v = loop n a v where loop 0 a v = cont a v loop n a v = case ignoreSharing v of Lam h b -> Lam h $ underAbs (loop $ n-1) a b _ -> __IMPOSSIBLE__ -- | Methods to retrieve the 'clauseBody'. class GetBody a where getBody :: a -> Maybe Term -- ^ Returns the properly raised clause 'Body', -- and 'Nothing' if 'NoBody'. getBodyUnraised :: a -> Maybe Term -- ^ Just grabs the body, without raising the de Bruijn indices. -- This is useful if you want to consider the body in context 'clauseTel'. instance GetBody ClauseBody where getBody NoBody = Nothing getBody (Body v) = Just v getBody (Bind b) = getBody $ absBody b -- Andreas, 2014-08-25: The following 'optimization' is WRONG, -- since it does not respect the order of Abs and NoAbs. -- (They do not commute w.r.t. raise!!) -- -- getBody = body 0 -- where -- -- collect all shiftings and do them in the end in one go -- body :: Int -> ClauseBody -> Maybe Term -- body _ NoBody = Nothing -- body n (Body v) = Just $ raise n v -- body n (Bind (NoAbs _ v)) = body (n + 1) v -- body n (Bind (Abs _ v)) = body n v getBodyUnraised NoBody = Nothing getBodyUnraised (Body v) = Just v getBodyUnraised (Bind b) = getBodyUnraised $ unAbs b -- Does not raise! instance GetBody Clause where getBody = getBody . clauseBody getBodyUnraised = getBodyUnraised . clauseBody --------------------------------------------------------------------------- -- * Syntactic equality and order --------------------------------------------------------------------------- deriving instance Eq Substitution deriving instance Ord Substitution deriving instance Eq Sort deriving instance Ord Sort deriving instance Eq Level deriving instance Ord Level deriving instance Eq PlusLevel deriving instance Ord LevelAtom deriving instance Eq NotBlocked deriving instance Ord NotBlocked deriving instance Eq t => Eq (Blocked t) deriving instance Ord t => Ord (Blocked t) deriving instance (Subst a, Eq a) => Eq (Elim' a) deriving instance (Subst a, Ord a) => Ord (Elim' a) deriving instance (Subst a, Eq a) => Eq (Tele a) deriving instance (Subst a, Ord a) => Ord (Tele a) deriving instance Eq Constraint deriving instance Eq Section instance Ord PlusLevel where compare ClosedLevel{} Plus{} = LT compare Plus{} ClosedLevel{} = GT compare (ClosedLevel n) (ClosedLevel m) = compare n m -- Compare on the atom first. Makes most sense for levelMax. compare (Plus n a) (Plus m b) = compare (a,n) (b,m) instance Eq LevelAtom where (==) = (==) `on` unLevelAtom -- | Syntactic 'Type' equality, ignores sort annotations. instance Eq a => Eq (Type' a) where (==) = (==) `on` unEl instance Ord a => Ord (Type' a) where compare = compare `on` unEl -- | Syntactic 'Term' equality, ignores stuff below @DontCare@ and sharing. instance Eq Term where Var x vs == Var x' vs' = x == x' && vs == vs' Lam h v == Lam h' v' = h == h' && v == v' Lit l == Lit l' = l == l' Def x vs == Def x' vs' = x == x' && vs == vs' Con x vs == Con x' vs' = x == x' && vs == vs' Pi a b == Pi a' b' = a == a' && b == b' Sort s == Sort s' = s == s' Level l == Level l' = l == l' MetaV m vs == MetaV m' vs' = m == m' && vs == vs' DontCare _ == DontCare _ = True Shared p == Shared q = p == q || derefPtr p == derefPtr q Shared p == b = derefPtr p == b a == Shared q = a == derefPtr q _ == _ = False instance Ord Term where ExtLam{} `compare` _ = __IMPOSSIBLE__ _ `compare` ExtLam{} = __IMPOSSIBLE__ Shared a `compare` Shared x | a == x = EQ Shared a `compare` x = compare (derefPtr a) x a `compare` Shared x = compare a (derefPtr x) Var a b `compare` Var x y = compare (a, b) (x, y) Var{} `compare` _ = LT _ `compare` Var{} = GT Def a b `compare` Def x y = compare (a, b) (x, y) Def{} `compare` _ = LT _ `compare` Def{} = GT Con a b `compare` Con x y = compare (a, b) (x, y) Con{} `compare` _ = LT _ `compare` Con{} = GT Lit a `compare` Lit x = compare a x Lit{} `compare` _ = LT _ `compare` Lit{} = GT Lam a b `compare` Lam x y = compare (a, b) (x, y) Lam{} `compare` _ = LT _ `compare` Lam{} = GT Pi a b `compare` Pi x y = compare (a, b) (x, y) Pi{} `compare` _ = LT _ `compare` Pi{} = GT Sort a `compare` Sort x = compare a x Sort{} `compare` _ = LT _ `compare` Sort{} = GT Level a `compare` Level x = compare a x Level{} `compare` _ = LT _ `compare` Level{} = GT MetaV a b `compare` MetaV x y = compare (a, b) (x, y) MetaV{} `compare` _ = LT _ `compare` MetaV{} = GT DontCare{} `compare` DontCare{} = EQ instance (Subst a, Eq a) => Eq (Abs a) where NoAbs _ a == NoAbs _ b = a == b Abs _ a == Abs _ b = a == b a == b = absBody a == absBody b instance (Subst a, Ord a) => Ord (Abs a) where NoAbs _ a `compare` NoAbs _ b = a `compare` b Abs _ a `compare` Abs _ b = a `compare` b a `compare` b = absBody a `compare` absBody b --------------------------------------------------------------------------- -- * Level stuff --------------------------------------------------------------------------- -- | The ``rule'', if Agda is considered as a functional -- pure type system (pts). -- -- TODO: This needs to be properly implemented, requiring -- refactoring of Agda's handling of levels. -- Without impredicativity or 'SizeUniv', Agda's pts rule is -- just the least upper bound, which is total and commutative. -- The handling of levels relies on this simplification. pts :: Sort -> Sort -> Sort pts = sLub sLub :: Sort -> Sort -> Sort sLub s Prop = s sLub Prop s = s sLub Inf _ = Inf sLub _ Inf = Inf sLub SizeUniv s = s -- one can freely quantify over sizes in any Set sLub _ SizeUniv = SizeUniv -- but everything resulting in a size lives in the SizeUniv sLub (Type (Max as)) (Type (Max bs)) = Type $ levelMax (as ++ bs) -- sLub (DLub a b) c = DLub (sLub a c) b -- no longer commutative! sLub (DLub a NoAbs{}) c = __IMPOSSIBLE__ sLub (DLub a (Abs x b)) c = DLub a $ Abs x $ sLub b $ raise 1 c sLub a (DLub b c) = DLub (sLub a b) c lvlView :: Term -> Level lvlView v = case ignoreSharing v of Level l -> l Sort (Type l) -> l _ -> Max [Plus 0 $ UnreducedLevel v] levelMax :: [PlusLevel] -> Level levelMax as0 = Max $ ns ++ List.sort bs where as = Prelude.concatMap expand as0 -- ns is empty or a singleton ns = case [ n | ClosedLevel n <- as, n > 0 ] of [] -> [] ns -> [ ClosedLevel n | let n = Prelude.maximum ns, n > greatestB ] bs = subsume [ b | b@Plus{} <- as ] greatestB | null bs = 0 | otherwise = Prelude.maximum [ n | Plus n _ <- bs ] expand l@ClosedLevel{} = [l] expand (Plus n l) = map (plus n) $ expand0 $ expandAtom l expand0 [] = [ClosedLevel 0] expand0 as = as expandAtom l = case l of BlockedLevel _ v -> expandTm v NeutralLevel _ v -> expandTm v UnreducedLevel v -> expandTm v MetaLevel{} -> [Plus 0 l] where expandTm v = case ignoreSharing v of Level (Max as) -> as Sort (Type (Max as)) -> as _ -> [Plus 0 l] plus n (ClosedLevel m) = ClosedLevel (n + m) plus n (Plus m l) = Plus (n + m) l subsume (ClosedLevel{} : _) = __IMPOSSIBLE__ subsume [] = [] subsume (Plus n a : bs) | not $ null ns = subsume bs | otherwise = Plus n a : subsume [ b | b@(Plus _ a') <- bs, a /= a' ] where ns = [ m | Plus m a' <- bs, a == a', m > n ] sortTm :: Sort -> Term sortTm (Type l) = Sort $ levelSort l sortTm s = Sort s levelSort :: Level -> Sort levelSort (Max as) | List.any (levelIs Inf ) as = Inf | List.any (levelIs SizeUniv) as = SizeUniv where levelIs s ClosedLevel{} = False levelIs s (Plus _ l) = atomIs s l atomIs s (NeutralLevel _ a) = tmIs s a atomIs s (UnreducedLevel a) = tmIs s a atomIs s MetaLevel{} = False atomIs s BlockedLevel{} = False tmIs s (Sort s') = s == s' tmIs s (Shared p) = tmIs s $ derefPtr p tmIs s _ = False levelSort l = case ignoreSharing $ levelTm l of Sort s -> s _ -> Type l levelTm :: Level -> Term levelTm l = case l of Max [Plus 0 l] -> unLevelAtom l _ -> Level l unLevelAtom :: LevelAtom -> Term unLevelAtom (MetaLevel x es) = MetaV x es unLevelAtom (NeutralLevel _ v) = v unLevelAtom (UnreducedLevel v) = v unLevelAtom (BlockedLevel _ v) = v Agda-2.4.2.5/src/full/Agda/TypeChecking/RecordPatterns.hs0000644000000000000000000007317112635075266021166 0ustar0000000000000000{-# LANGUAGE CPP #-} {-# LANGUAGE FlexibleInstances #-} {-# LANGUAGE GeneralizedNewtypeDeriving #-} {-# LANGUAGE PatternGuards #-} {-# LANGUAGE TupleSections #-} -- | Code which replaces pattern matching on record constructors with -- uses of projection functions. module Agda.TypeChecking.RecordPatterns ( translateRecordPatterns , translateCompiledClauses , translateSplitTree , recordPatternToProjections ) where import Control.Applicative import Control.Arrow (first, second) import Control.Monad.Fix import Control.Monad.Reader import Control.Monad.State import Data.List import Data.Maybe import qualified Data.Map as Map import qualified Data.Traversable as Trav import Agda.Syntax.Common import Agda.Syntax.Internal as I import Agda.TypeChecking.CompiledClause import Agda.TypeChecking.Coverage.SplitTree import Agda.TypeChecking.Datatypes import Agda.TypeChecking.Errors import Agda.TypeChecking.Monad import Agda.TypeChecking.Pretty hiding (pretty) import Agda.TypeChecking.Records import Agda.TypeChecking.Reduce import Agda.TypeChecking.Substitute import Agda.TypeChecking.Telescope import Agda.Utils.Either import Agda.Utils.List import qualified Agda.Utils.Map as Map import Agda.Utils.Maybe import Agda.Utils.Permutation hiding (dropFrom) import Agda.Utils.Pretty (Pretty(..)) import qualified Agda.Utils.Pretty as P import Agda.Utils.Size #include "undefined.h" import Agda.Utils.Impossible --------------------------------------------------------------------------- -- * Record pattern translation for let bindings --------------------------------------------------------------------------- -- | Take a record pattern @p@ and yield a list of projections -- corresponding to the pattern variables, from left to right. -- -- E.g. for @(x , (y , z))@ we return @[ fst, fst . snd, snd . snd ]@. -- -- If it is not a record pattern, error 'ShouldBeRecordPattern' is raised. recordPatternToProjections :: Pattern -> TCM [Term -> Term] recordPatternToProjections p = case p of VarP{} -> return [ \ x -> x ] LitP{} -> typeError $ ShouldBeRecordPattern p DotP{} -> typeError $ ShouldBeRecordPattern p ConP c ci ps -> do whenNothing (conPRecord ci) $ typeError $ ShouldBeRecordPattern p t <- reduce $ fromMaybe __IMPOSSIBLE__ $ conPType ci fields <- getRecordTypeFields (unArg t) concat <$> zipWithM comb (map proj fields) (map namedArg ps) ProjP{} -> __IMPOSSIBLE__ -- copattern cannot appear here where proj p = (`applyE` [Proj $ unArg p]) -- proj p = \ x -> Def (unArg p) [defaultArg x] comb :: (Term -> Term) -> Pattern -> TCM [Term -> Term] comb prj p = map (\ f -> f . prj) <$> recordPatternToProjections p --------------------------------------------------------------------------- -- * Record pattern translation for compiled clauses --------------------------------------------------------------------------- -- | Take a matrix of booleans (at least one row!) and summarize the columns -- using conjunction. conjColumns :: [[Bool]] -> [Bool] conjColumns = foldl1 (zipWith (&&)) -- | @insertColumn i a m@ inserts a column before the @i@th column in -- matrix @m@ and fills it with value @a@. insertColumn :: Int -> a -> [[a]] -> [[a]] insertColumn i a rows = map ins rows where ins row = let (init, last) = splitAt i row in init ++ a : last {- UNUSED -- | @cutColumn i m@ removes the @i@th column from matrix @m@. cutColumn :: Int -> [[a]] -> [[a]] cutColumn i rows = map cut rows where cut row = let (init, _:last) = splitAt i row in init ++ last -- | @cutColumns i n xss = (yss, xss')@ cuts out a submatrix @yss@ -- of width @n@ from @xss@, starting at column @i@. cutColumns :: Int -> Int -> [[a]] -> ([[a]], [[a]]) cutColumns i n rows = unzip (map (cutSublist i n) rows) -} -- | @cutSublist i n xs = (xs', ys, xs'')@ cuts out a sublist @ys@ -- of width @n@ from @xs@, starting at column @i@. cutSublist :: Int -> Int -> [a] -> ([a], [a], [a]) cutSublist i n row = let (init, rest) = splitAt i row (mid , last) = splitAt n rest in (init, mid, last) translateCompiledClauses :: CompiledClauses -> TCM CompiledClauses translateCompiledClauses cc = snd <$> loop cc where loop :: CompiledClauses -> TCM ([Bool], CompiledClauses) loop cc = case cc of Fail -> return (repeat True, cc) Done xs t -> return (map (const True) xs, cc) Case i cs -> loops i cs loops :: Int -- split variable -> Case CompiledClauses -- original split tree -> TCM ([Bool], CompiledClauses) loops i cs@Branches{ projPatterns = cop , conBranches = conMap , litBranches = litMap , catchAllBranch = catchAll } = do -- recurse on and compute variable status of catch-all clause (xssa, catchAll) <- unzipMaybe <$> Trav.mapM loop catchAll let xsa = maybe (repeat True) id xssa -- recurse on compute variable status of literal clauses (xssl, litMap) <- Map.unzip <$> Trav.mapM loop litMap let xsl = conjColumns (xsa : insertColumn i False (Map.elems xssl)) -- recurse on constructor clauses (ccs, xssc, conMap) <- Map.unzip3 <$> do Trav.forM (Map.mapWithKey (,) conMap) $ \ (c, WithArity ar cc) -> do (xs, cc) <- loop cc -- dataOrRecCon <- getConstructorArity c -- TODO: c could be a projection dataOrRecCon <- do isProj <- isProjection c case isProj of Nothing -> getConstructorArity c Just{} -> return $ Left 0 let (isRC, n) = either (False,) ((True,) . size) dataOrRecCon (xs0, rest) = genericSplitAt i xs (xs1, xs2 ) = genericSplitAt n rest -- if all dropped variables (xs1) are virgins and we are record cons. -- then new variable x is also virgin -- and we can translate away the split x = isRC && and xs1 -- xs' = updated variables xs' = xs0 ++ x : xs2 -- get the record fields fs = either __IMPOSSIBLE__ id dataOrRecCon -- if x we can translate mcc = if x then [replaceByProjections i (map unArg fs) cc] else [] when (n /= ar) __IMPOSSIBLE__ return (mcc, xs', WithArity ar cc) -- compute result let xs = conjColumns (xsl : Map.elems xssc) case concat $ Map.elems ccs of -- case: no record pattern was translated [] -> return (xs, Case i $ Branches { projPatterns = cop , conBranches = conMap , litBranches = litMap , catchAllBranch = catchAll }) -- case: translated away one record pattern [cc] -> do -- Andreas, 2013-03-22 -- Due to catch-all-expansion this is actually possible: -- -- we cannot have a catch-all if we had a record pattern -- whenJust catchAll __IMPOSSIBLE__ -- We just drop the catch-all clause. This is safe because -- for record patterns we have expanded all the catch-alls. return (xs, cc) -- mergeCatchAll cc catchAll) -- case: more than one record patterns (impossible) _ -> __IMPOSSIBLE__ {- UNUSED instance Monoid CompiledClauses where mempty = __IMPOSSIBLE__ mappend (Case n c) (Case n' c') | n == n' = Case n $ mappend c c' mappend _ _ = __IMPOSSIBLE__ mergeCatchAll :: CompiledClauses -> Maybe CompiledClauses -> CompiledClauses mergeCatchAll cc ca = maybe cc (mappend cc) ca {- case (cc, ca) of (_ , Nothing) -> cc (Case n c, Just (Case n' c')) | n == n' -> Case n $ mappend c c' _ -> __IMPOSSIBLE__ -- this would mean non-determinism -} -} -- | @replaceByProjections i projs cc@ replaces variables @i..i+n-1@ -- (counted from left) by projections @projs_1 i .. projs_n i@. -- -- If @n==0@, we matched on a zero-field record, which means that -- we are actually introduce a new variable, increasing split -- positions greater or equal to @i@ by one. -- Otherwise, we have to lower -- replaceByProjections :: Int -> [QName] -> CompiledClauses -> CompiledClauses replaceByProjections i projs cc = let n = length projs loop :: Int -> CompiledClauses -> CompiledClauses loop i cc = case cc of Case j cs -- if j < i, we leave j untouched, but we increase i by the number -- of variables replacing j in the branches | j < i -> Case j $ loops i cs -- if j >= i then we shrink j by (n-1) | otherwise -> Case (j - (n-1)) $ fmap (loop i) cs Done xs v -> -- we have to delete (n-1) variables from xs -- and instantiate v suitably with the projections let (xs0,xs1,xs2) = cutSublist i n xs names | null xs1 = ["r"] | otherwise = map unArg xs1 x = defaultArg $ foldr1 appendArgNames names xs' = xs0 ++ x : xs2 us = map (\ p -> Var 0 [Proj p]) (reverse projs) -- us = map (\ p -> Def p [defaultArg $ var 0]) (reverse projs) -- go from level (i + n - 1) to index (subtract from |xs|-1) index = length xs - (i + n) in Done xs' $ applySubst (liftS (length xs2) $ us ++# raiseS 1) v -- The body is NOT guarded by lambdas! -- WRONG: underLambdas i (flip apply) (map defaultArg us) v Fail -> Fail loops :: Int -> Case CompiledClauses -> Case CompiledClauses loops i Branches{ projPatterns = cop , conBranches = conMap , litBranches = litMap , catchAllBranch = catchAll } = Branches{ projPatterns = cop , conBranches = fmap (\ (WithArity n c) -> WithArity n $ loop (i + n - 1) c) conMap , litBranches = fmap (loop (i - 1)) litMap , catchAllBranch = fmap (loop i) catchAll } in loop i cc -- | Check if a split is on a record constructor, and return the projections -- if yes. isRecordCase :: Case c -> TCM (Maybe ([QName], c)) isRecordCase (Branches { conBranches = conMap , litBranches = litMap , catchAllBranch = Nothing }) | Map.null litMap , [(con, WithArity _ br)] <- Map.toList conMap = do isRC <- isRecordConstructor con case isRC of Just (r, Record { recFields = fs }) -> return $ Just (map unArg fs, br) Just (r, _) -> __IMPOSSIBLE__ Nothing -> return Nothing isRecordCase _ = return Nothing --------------------------------------------------------------------------- -- * Record pattern translation for split trees --------------------------------------------------------------------------- -- | Split tree annotation. data RecordSplitNode = RecordSplitNode { splitCon :: QName -- ^ Constructor name for this branch. , splitArity :: Int -- ^ Arity of the constructor. , splitRecordPattern :: Bool -- ^ Should we translate this split away? } -- | Split tree annotated for record pattern translation. type RecordSplitTree = SplitTree' RecordSplitNode type RecordSplitTrees = SplitTrees' RecordSplitNode -- | Bottom-up procedure to annotate split tree. recordSplitTree :: SplitTree -> TCM RecordSplitTree recordSplitTree t = snd <$> loop t where loop :: SplitTree -> TCM ([Bool], RecordSplitTree) loop t = case t of SplittingDone n -> return (replicate n True, SplittingDone n) SplitAt i ts -> do (xs, ts) <- loops i ts return (xs, SplitAt i ts) loops :: Int -> SplitTrees -> TCM ([Bool], RecordSplitTrees) loops i ts = do (xss, ts) <- unzip <$> do forM ts $ \ (c, t) -> do (xs, t) <- loop t (isRC, n) <- either (False,) ((True,) . size) <$> getConstructorArity c let (xs0, rest) = genericSplitAt i xs (xs1, xs2) = genericSplitAt n rest x = isRC && and xs1 xs' = xs0 ++ x : xs2 return (xs, (RecordSplitNode c n x, t)) return (foldl1 (zipWith (&&)) xss, ts) -- | Bottom-up procedure to record-pattern-translate split tree. translateSplitTree :: SplitTree -> TCM SplitTree translateSplitTree t = snd <$> loop t where -- @loop t = return (xs, t')@ returns the translated split tree @t'@ -- plus the status @xs@ of the clause variables -- True = variable will never be split on in @t'@ (virgin variable) -- False = variable will be spilt on in @t'@ loop :: SplitTree -> TCM ([Bool], SplitTree) loop t = case t of SplittingDone n -> -- start with n virgin variables return (replicate n True, SplittingDone n) SplitAt i ts -> do (x, xs, ts) <- loops i ts -- if we case on record constructor, drop case let t' = if x then case ts of [(c,t)] -> t _ -> __IMPOSSIBLE__ -- else retain case else SplitAt i ts return (xs, t') -- @loops i ts = return (x, xs, ts')@ cf. @loop@ -- @x@ says wether at arg @i@ we have a record pattern split -- that can be removed loops :: Int -> SplitTrees -> TCM (Bool, [Bool], SplitTrees) loops i ts = do -- note: ts not empty (rs, xss, ts) <- unzip3 <$> do forM ts $ \ (c, t) -> do (xs, t) <- loop t (isRC, n) <- either (False,) ((True,) . size) <$> getConstructorArity c -- now drop variables from i to i+n-1 let (xs0, rest) = genericSplitAt i xs (xs1, xs2) = genericSplitAt n rest -- if all dropped variables are virgins and we are record cons. -- then new variable x is also virgin -- and we can translate away the split x = isRC && and xs1 -- xs' = updated variables xs' = xs0 ++ x : xs2 -- delete splits from t if record match t' = if x then dropFrom i (n - 1) t else t return (x, xs', (c, t')) -- x = did we split on a record constructor? let x = and rs -- invariant: if record constructor, then exactly one constructor if x then unless (rs == [True]) __IMPOSSIBLE__ -- else no record constructor else unless (or rs == False) __IMPOSSIBLE__ return (x, conjColumns xss, ts) -- | @dropFrom i n@ drops arguments @j@ with @j < i + n@ and @j >= i@. -- NOTE: @n@ can be negative, in which case arguments are inserted. class DropFrom a where dropFrom :: Int -> Int -> a -> a instance DropFrom (SplitTree' c) where dropFrom i n t = case t of SplittingDone m -> SplittingDone (m - n) SplitAt j ts | j >= i + n -> SplitAt (j - n) $ dropFrom i n ts | j < i -> SplitAt j $ dropFrom i n ts | otherwise -> __IMPOSSIBLE__ instance DropFrom (c, SplitTree' c) where dropFrom i n (c, t) = (c, dropFrom i n t) instance DropFrom a => DropFrom [a] where dropFrom i n ts = map (dropFrom i n) ts {- -- | Check if a split is on a record constructor, and return the projections -- if yes. isRecordSplit :: SplitTrees -> TCM (Maybe ([QName], c)) isRecordSplit (Branches { conBranches = conMap , litBranches = litMap , catchAllBranch = Nothing }) | Map.null litBranches , [(con,br)] <- Map.toList conMap = do isRC <- isRecordConstructor con case isRC of Just (r, Record { recFields = fs }) -> return $ Just (map unArg fs, br) Just (r, _) -> __IMPOSSIBLE__ Nothing -> return Nothing isRecordSplit _ = return Nothing -} --------------------------------------------------------------------------- -- * Record pattern translation for function definitions --------------------------------------------------------------------------- -- | Replaces pattern matching on record constructors with uses of -- projection functions. Does not remove record constructor patterns -- which have sub-patterns containing non-record constructor or -- literal patterns. translateRecordPatterns :: Clause -> TCM Clause translateRecordPatterns clause = do -- ps: New patterns, in left-to-right order, in the context of the -- old RHS. -- s: Partial substitution taking the old pattern variables -- (including dot patterns; listed from left to right) to terms in -- the context of the new RHS. -- cs: List of changes, with types in the context of the old -- telescope. (ps, s, cs) <- runRecPatM $ translatePatterns $ namedClausePats clause let -- Number of variables + dot patterns in new clause. noNewPatternVars = size cs s' = reverse s mkSub s = s ++# raiseS noNewPatternVars -- Substitution used to convert terms in the old RHS's -- context to terms in the new RHS's context. rhsSubst = mkSub s' -- Substitution used to convert terms in the old telescope's -- context to terms in the new RHS's context. rhsSubst' = mkSub $ permute (reverseP $ clausePerm clause) s' -- TODO: Is it OK to replace the definition above with the -- following one? -- -- rhsSubst' = mkSub $ permute (clausePerm clause) s -- The old telescope, flattened and in textual left-to-right -- order (i.e. the type signature for the variable which occurs -- first in the list of patterns comes first). flattenedOldTel = permute (invertP __IMPOSSIBLE__ $ compactP $ clausePerm clause) $ zip (teleNames $ clauseTel clause) $ flattenTel $ clauseTel clause -- The new telescope, still flattened, with types in the context -- of the new RHS, in textual left-to-right order, and with -- Nothing in place of dot patterns. substTel = map . fmap . second . applySubst newTel' = substTel rhsSubst' $ translateTel cs $ flattenedOldTel -- Permutation taking the new variable and dot patterns to the -- new telescope. newPerm = adjustForDotPatterns $ reorderTel_ $ map (maybe dummyDom snd) newTel' -- It is important that dummyDom does not mention any variable -- (see the definition of reorderTel). where isDotP n = case genericIndex cs n of Left DotP{} -> True _ -> False adjustForDotPatterns (Perm n is) = Perm n (filter (not . isDotP) is) -- Substitution used to convert terms in the new RHS's context -- to terms in the new telescope's context. lhsSubst' = renaming (reverseP newPerm) -- Substitution used to convert terms in the old telescope's -- context to terms in the new telescope's context. lhsSubst = applySubst lhsSubst' rhsSubst' -- The new telescope. newTel = uncurry unflattenTel . unzip $ map (fromMaybe __IMPOSSIBLE__) $ permute newPerm $ substTel lhsSubst' $ newTel' -- New clause. c = clause { clauseTel = newTel , clausePerm = newPerm , namedClausePats = applySubst lhsSubst ps , clauseBody = translateBody cs rhsSubst $ clauseBody clause } reportSDoc "tc.lhs.recpat" 20 $ vcat [ text "Original clause:" , nest 2 $ inTopContext $ vcat [ text "delta =" <+> prettyTCM (clauseTel clause) , text "perm =" <+> prettyTCM (clausePerm clause) , text "pats =" <+> text (show $ clausePats clause) ] , text "Intermediate results:" , nest 2 $ vcat [ text "ps =" <+> text (show ps) , text "s =" <+> prettyList (map prettyTCM s) , text "cs =" <+> prettyList (map prettyTCM cs) , text "flattenedOldTel =" <+> (text . show) flattenedOldTel , text "newTel' =" <+> (text . show) newTel' , text "newPerm =" <+> prettyTCM newPerm ] ] reportSDoc "tc.lhs.recpat" 20 $ vcat [ text "lhsSubst' =" <+> (text . show) lhsSubst' , text "lhsSubst =" <+> (text . show) lhsSubst , text "newTel =" <+> prettyTCM newTel ] reportSDoc "tc.lhs.recpat" 10 $ escapeContext (size $ clauseTel clause) $ vcat [ text "Translated clause:" , nest 2 $ vcat [ text "delta =" <+> prettyTCM (clauseTel c) , text "perm =" <+> text (show $ clausePerm c) , text "ps =" <+> text (show $ clausePats c) , text "body =" <+> text (show $ clauseBody c) , text "body =" <+> prettyTCM (clauseBody c) ] ] return c ------------------------------------------------------------------------ -- Record pattern monad -- | A monad used to translate record patterns. -- -- The state records the number of variables produced so far, the -- reader records the total number of variables produced by the entire -- computation. Functions using this monad need to be sufficiently -- lazy in the reader component. newtype RecPatM a = RecPatM (TCMT (ReaderT Nat (StateT Nat IO)) a) deriving (Functor, Applicative, Monad, MonadIO, MonadTCM, MonadReader TCEnv, MonadState TCState) -- | Runs a computation in the 'RecPatM' monad. runRecPatM :: RecPatM a -> TCM a runRecPatM (RecPatM m) = mapTCMT (\m -> do (x, noVars) <- mfix $ \ ~(_, noVars) -> runStateT (runReaderT m noVars) 0 return x) m -- | Returns the next pattern variable, and the corresponding term. nextVar :: RecPatM (Pattern, Term) nextVar = RecPatM $ do n <- lift get lift $ put $ succ n noVars <- lift ask return (VarP "r", var $ noVars - n - 1) ------------------------------------------------------------------------ -- Types used to record changes to a clause -- | @VarPat@ stands for variable patterns, and @DotPat@ for dot -- patterns. data Kind = VarPat | DotPat deriving Eq -- | @'Left' p@ means that a variable (corresponding to the pattern -- @p@, a variable or dot pattern) should be kept unchanged. @'Right' -- (n, x, t)@ means that @n 'VarPat'@ variables, and @n 'DotPat'@ dot -- patterns, should be removed, and a new variable, with the name @x@, -- inserted instead. The type of the new variable is @t@. type Change = Either Pattern (Kind -> Nat, ArgName, I.Dom Type) type Changes = [Change] instance Pretty (Kind -> Nat) where pretty f = P.text "(VarPat:" P.<+> P.text (show $ f VarPat) P.<+> P.text "DotPat:" P.<+> P.text (show $ f DotPat) P.<> P.text ")" instance PrettyTCM (Kind -> Nat) where prettyTCM = return . pretty instance PrettyTCM Change where prettyTCM (Left p) = prettyTCM p prettyTCM (Right (f, x, t)) = text "Change" <+> prettyTCM f <+> text x <+> prettyTCM t -- | Record pattern trees. data RecordTree = Leaf Pattern -- ^ Corresponds to variable and dot patterns; contains the -- original pattern. | RecCon (I.Arg Type) [(Term -> Term, RecordTree)] -- ^ @RecCon t args@ stands for a record constructor application: -- @t@ is the type of the application, and the list contains a -- projection function and a tree for every argument. ------------------------------------------------------------------------ -- Record pattern trees -- | @projections t@ returns a projection for every non-dot leaf -- pattern in @t@. The term is the composition of the projection -- functions from the leaf to the root. -- -- Every term is tagged with its origin: a variable pattern or a dot -- pattern. projections :: RecordTree -> [(Term -> Term, Kind)] projections (Leaf (DotP{})) = [(id, DotPat)] projections (Leaf (VarP{})) = [(id, VarPat)] projections (Leaf _) = __IMPOSSIBLE__ projections (RecCon _ args) = concatMap (\ (p, t) -> map (first (. p)) $ projections t) args -- | Converts a record tree to a single pattern along with information -- about the deleted pattern variables. removeTree :: RecordTree -> RecPatM (Pattern, [Term], Changes) removeTree tree = do (pat, x) <- nextVar let ps = projections tree s = map (\(p, _) -> p x) ps count k = genericLength $ filter ((== k) . snd) ps return $ case tree of Leaf p -> (p, s, [Left p]) RecCon t _ -> (pat, s, [Right (count, "r", domFromArg t)]) ------------------------------------------------------------------------ -- Translation of patterns -- | Removes record constructors from patterns. -- -- Returns the following things: -- -- * The new pattern. -- -- * A substitution which maps the /old/ pattern variables (in the -- order they occurred in the pattern; not including dot patterns) -- to terms (either the new name of the variable, or a projection -- applied to a new pattern variable). -- -- * A list explaining the changes to the variables bound in the -- pattern. -- -- Record patterns containing non-record constructor patterns are not -- translated (though their sub-patterns may be). -- -- Example: The pattern @rec1 (con1 a) (rec2 b c) (rec3 d)@ should -- yield the pattern @rec1 (con1 x) y z@, along with a substitution -- similar to @[x, proj2-1 y, proj2-2 y, proj3-1 z]@. -- -- This function assumes that literals are never of record type. translatePattern :: Pattern -> RecPatM (Pattern, [Term], Changes) translatePattern p@(ConP c ci ps) -- Andreas, 2015-05-28 only translate implicit record patterns | Just ConPImplicit <- conPRecord ci = do r <- recordTree p case r of Left r -> r Right t -> removeTree t | otherwise = do (ps, s, cs) <- translatePatterns ps return (ConP c ci ps, s, cs) translatePattern p@VarP{} = removeTree (Leaf p) translatePattern p@DotP{} = removeTree (Leaf p) translatePattern p@LitP{} = return (p, [], []) translatePattern p@ProjP{}= return (p, [], []) translatePatterns :: [I.NamedArg Pattern] -> RecPatM ([I.NamedArg Pattern], [Term], Changes) translatePatterns ps = do (ps', ss, cs) <- unzip3 <$> mapM (translatePattern . namedArg) ps return (zipWith (\p -> fmap (p <$)) ps' ps, concat ss, concat cs) -- | Traverses a pattern and returns one of two things: -- -- * If there is no non-record constructor in the pattern, then -- @'Right' ps@ is returned, where @ps@ contains one projection for -- every variable in the input pattern (in the order they are -- encountered). -- -- * Otherwise the output is a computation returning the same kind of -- result as that coming from 'translatePattern'. (Computations are -- returned rather than values to ensure that variable numbers are -- allocated in the right order.) -- -- Assumes that literals are never of record type. recordTree :: Pattern -> RecPatM (Either (RecPatM (Pattern, [Term], Changes)) RecordTree) -- Andreas, 2015-05-28 only translate implicit record patterns recordTree (ConP c ci ps) | Just ConPImplicit <- conPRecord ci = do let t = fromMaybe __IMPOSSIBLE__ $ conPType ci rs <- mapM (recordTree . namedArg) ps case allRight rs of Nothing -> return $ Left $ do (ps', ss, cs) <- unzip3 <$> mapM (either id removeTree) rs return (ConP c ci (ps' `withNamedArgsFrom` ps), concat ss, concat cs) Just ts -> liftTCM $ do t <- reduce t fields <- getRecordTypeFields (unArg t) -- let proj p = \x -> Def (unArg p) [defaultArg x] let proj p = (`applyE` [Proj $ unArg p]) return $ Right $ RecCon t $ zip (map proj fields) ts recordTree p@(ConP _ ci _) = return $ Left $ translatePattern p recordTree p@VarP{} = return (Right (Leaf p)) recordTree p@DotP{} = return (Right (Leaf p)) recordTree p@LitP{} = return $ Left $ translatePattern p recordTree p@ProjP{}= return $ Left $ translatePattern p ------------------------------------------------------------------------ -- Translation of the clause telescope and body -- | Translates the telescope. translateTel :: Changes -- ^ Explanation of how the telescope should be changed. Types -- should be in the context of the old telescope. -> [(ArgName, I.Dom Type)] -- ^ Old telescope, flattened, in textual left-to-right -- order. -> [Maybe (ArgName, I.Dom Type)] -- ^ New telescope, flattened, in textual left-to-right order. -- 'Nothing' is used to indicate the locations of dot patterns. translateTel (Left (DotP{}) : rest) tel = Nothing : translateTel rest tel translateTel (Right (n, x, t) : rest) tel = Just (x, t) : translateTel rest (genericDrop (n VarPat) tel) translateTel (Left _ : rest) (t : tel) = Just t : translateTel rest tel translateTel [] [] = [] translateTel (Left _ : _) [] = __IMPOSSIBLE__ translateTel [] (_ : _) = __IMPOSSIBLE__ -- | Translates the clause body. The substitution should take things -- in the context of the old RHS to the new RHS's context. translateBody :: Changes -> Substitution -> ClauseBody -> ClauseBody translateBody _ s NoBody = NoBody translateBody (Right (n, x, _) : rest) s b = Bind $ Abs x $ translateBody rest s $ dropBinds n' b where n' = sum $ map n [VarPat, DotPat] translateBody (Left _ : rest) s (Bind b) = Bind $ fmap (translateBody rest s) b translateBody [] s (Body t) = Body $ applySubst s t translateBody _ _ _ = __IMPOSSIBLE__ ------------------------------------------------------------------------ -- Helper functions -- | @dropBinds n b@ drops the initial @n@ occurrences of 'Bind' from @b@. -- -- Precondition: @b@ has to start with @n@ occurrences of 'Bind'. dropBinds :: Nat -> ClauseBody -> ClauseBody dropBinds n b | n == 0 = b dropBinds n (Bind b) | n > 0 = dropBinds (pred n) (absBody b) dropBinds _ _ = __IMPOSSIBLE__ Agda-2.4.2.5/src/full/Agda/TypeChecking/Free/0000755000000000000000000000000012635075266016543 5ustar0000000000000000Agda-2.4.2.5/src/full/Agda/TypeChecking/Free/Tests.hs0000644000000000000000000000663312635075266020211 0ustar0000000000000000{-# LANGUAGE CPP #-} {-# LANGUAGE DeriveDataTypeable #-} {-# LANGUAGE DeriveFoldable #-} {-# LANGUAGE DeriveFunctor #-} {-# LANGUAGE DeriveTraversable #-} {-# LANGUAGE NoMonomorphismRestriction #-} {-# LANGUAGE ScopedTypeVariables #-} {-# LANGUAGE TemplateHaskell #-} #if __GLASGOW_HASKELL__ >= 710 {-# LANGUAGE FlexibleContexts #-} #endif {-# OPTIONS_GHC -fno-warn-missing-signatures #-} -- | Tests for free variable computations. module Agda.TypeChecking.Free.Tests (tests) where import Control.Applicative ((<*>)) import Data.Functor import Data.List as List import Data.Maybe import Data.Monoid import Test.QuickCheck import Test.QuickCheck.All import Agda.Syntax.Common import Agda.Syntax.Internal import Agda.TypeChecking.Free.Lazy hiding (FlexRig(..)) import Agda.TypeChecking.Free.Lazy (FlexRig) import qualified Agda.TypeChecking.Free.Lazy as Free import qualified Agda.TypeChecking.Free.Old as Old import Agda.TypeChecking.Free (freeIn) import qualified Agda.TypeChecking.Free as New import Agda.TypeChecking.Test.Generators import Agda.Utils.TestHelpers -- * Properties of 'FlexRig' -- | Ensure the correct linear order is derived. prop_FlexRig_min = minBound == Free.Flexible prop_FlexRig_order = strictlyAscending [ Free.Flexible, Free.WeaklyRigid, Free.Unguarded, Free.StronglyRigid ] strictlyAscending l = and $ zipWith (<) l $ tail l -- ** 'composeFlexRig' forms an idempotent commutative monoid with -- unit 'Unguarded' and zero 'Flexible' prop_composeFlexRig_associative = associative composeFlexRig prop_composeFlexRig_commutative = commutative composeFlexRig prop_composeFlexRig_idempotent = idempotent composeFlexRig prop_composeFlexRig_zero = isZero Free.Flexible composeFlexRig prop_composeFlexRig_unit = identity Free.Unguarded composeFlexRig prop_FlexRig_distributive = distributive composeFlexRig max -- Not true (I did not expect it to be true, just for sanity I checked): -- prop_FlexRig_distributive' = distributive max composeFlexRig -- ** 'maxVarOcc' prop_maxVarOcc_top = isZero topVarOcc maxVarOcc prop_maxVarOcc_bot = identity botVarOcc maxVarOcc -- * Unit tests prop_freeIn = all (0 `freeIn`) [ var 0 , Lam defaultArgInfo $ Abs "x" $ var 1 , Sort $ varSort 0 ] -- * Conformance with old implementation prop_old_freeVars_Pi = same_freeVars ty same_freeVars t = new_to_old_FV (New.freeVars t) == Old.freeVars t old_to_new_FV (Old.FV a b c d e f) = New.FV a b c d e f new_to_old_FV (New.FV a b c d e f) = Old.FV a b c d e f ty = Pi (defaultDom ab) $ Abs "x" $ El (Type $ Max []) $ var 5 where a = El Prop $ var 4 b = El (Type $ Max []) $ Sort $ Type $ Max [] ab = El (Type $ Max [ClosedLevel 1]) $ Pi (defaultDom a) (Abs "x" b) new_fv_ty :: New.FreeVars new_fv_ty = New.freeVars ty old_fv_ty :: Old.FreeVars old_fv_ty = Old.freeVars ty prop_old_freeVars_Term conf x = forAll (genC conf) $ \ (t :: Term) -> same_freeVars t prop_old_freeIn_Term conf x = forAll (genC conf) $ \ (t :: Term) -> New.freeIn x t == Old.freeIn x t prop_old_freeIn_Type conf x = forAll (genC conf) $ \ (t :: Type) -> New.freeIn x t == Old.freeIn x t -- Template Haskell hack to make the following $quickCheckAll work -- under ghc-7.8. return [] -- KEEP! -- | All tests as collected by 'quickCheckAll'. tests :: IO Bool tests = do putStrLn "Agda.TypeChecking.Free.Tests" $quickCheckAll Agda-2.4.2.5/src/full/Agda/TypeChecking/Free/Lazy.hs0000644000000000000000000003602012635075266020017 0ustar0000000000000000{-# LANGUAGE CPP #-} {-# LANGUAGE FlexibleContexts #-} {-# LANGUAGE FlexibleInstances #-} {-# LANGUAGE MultiParamTypeClasses #-} {-# LANGUAGE UndecidableInstances #-} -- | Computing the free variables of a term lazily. -- -- We implement a reduce (traversal into monoid) over internal syntax -- for a generic collection (monoid with singletons). This should allow -- a more efficient test for the presence of a particular variable. -- -- Worst-case complexity does not change (i.e. the case when a variable -- does not occur), but best case-complexity does matter. For instance, -- see 'Agda.TypeChecking.Substitute.mkAbs': each time we construct -- a dependent function type, we check it is actually dependent. -- -- The distinction between rigid and strongly rigid occurrences comes from: -- Jason C. Reed, PhD thesis, 2009, page 96 (see also his LFMTP 2009 paper) -- -- The main idea is that x = t(x) is unsolvable if x occurs strongly rigidly -- in t. It might have a solution if the occurrence is not strongly rigid, e.g. -- -- x = \f -> suc (f (x (\ y -> k))) has x = \f -> suc (f (suc k)) -- -- [Jason C. Reed, PhD thesis, page 106] -- -- Under coinductive constructors, occurrences are never strongly rigid. -- Also, function types and lambdas do not establish strong rigidity. -- Only inductive constructors do so. -- (See issue 1271). module Agda.TypeChecking.Free.Lazy where import Control.Applicative hiding (empty) import Control.Monad.Reader import Data.Foldable (foldMap) import Data.IntMap (IntMap) import Data.Monoid import Test.QuickCheck import qualified Agda.Benchmarking as Bench import Agda.Syntax.Common hiding (Arg, Dom, NamedArg) import Agda.Syntax.Internal -- import Agda.TypeChecking.Irrelevance import Agda.Utils.Function import Agda.Utils.Functor import Agda.Utils.Monad import Agda.Utils.Singleton import Agda.Utils.VarSet (VarSet) #include "undefined.h" import Agda.Utils.Impossible -- | Depending on the surrounding context of a variable, -- it's occurrence can be classified as flexible or rigid, -- with finer distinctions. -- -- The constructors are listed in increasing order (wrt. information content). data FlexRig = Flexible -- ^ In arguments of metas. | WeaklyRigid -- ^ In arguments to variables and definitions. | Unguarded -- ^ In top position, or only under inductive record constructors. | StronglyRigid -- ^ Under at least one and only inductive constructors. deriving (Eq, Ord, Show, Enum, Bounded) -- | 'FlexRig' composition. For accumulating the context of a variable. -- -- 'Flexible' is dominant. Once we are under a meta, we are flexible -- regardless what else comes. -- -- 'WeaklyRigid' is next in strength. Destroys strong rigidity. -- -- 'StronglyRigid' is still dominant over 'Unguarded'. -- -- 'Unguarded' is the unit. It is the top (identity) context. composeFlexRig :: FlexRig -> FlexRig -> FlexRig composeFlexRig o o' = case (o, o') of (Flexible, _) -> Flexible (_, Flexible) -> Flexible (WeaklyRigid, _) -> WeaklyRigid (_, WeaklyRigid) -> WeaklyRigid (StronglyRigid, _) -> StronglyRigid (_, StronglyRigid) -> StronglyRigid (Unguarded, Unguarded) -> Unguarded -- -- | 'FlexRig' supremum. Extract the most information about a variable. -- -- -- -- We make this the default 'Monoid' for 'FlexRig'. -- instance Monoid FlexRig where -- mempty = minBound -- mappend = max -- | Occurrence of free variables is classified by several dimensions. -- Currently, we have 'FlexRig' and 'Relevance'. data VarOcc = VarOcc { varFlexRig :: FlexRig , varRelevance :: Relevance } deriving (Eq, Show) -- | When we extract information about occurrence, we care most about -- about 'StronglyRigid' 'Relevant' occurrences. maxVarOcc :: VarOcc -> VarOcc -> VarOcc maxVarOcc (VarOcc o r) (VarOcc o' r') = VarOcc (max o o') (min r r') topVarOcc :: VarOcc topVarOcc = VarOcc StronglyRigid Relevant botVarOcc :: VarOcc botVarOcc = VarOcc Flexible Irrelevant type VarMap = IntMap VarOcc -- * Collecting free variables. -- | Where should we skip sorts in free variable analysis? data IgnoreSorts = IgnoreNot -- ^ Do not skip. | IgnoreInAnnotations -- ^ Skip when annotation to a type. | IgnoreAll -- ^ Skip unconditionally. deriving (Eq, Show) -- | The current context. data FreeEnv c = FreeEnv { feIgnoreSorts :: !IgnoreSorts -- ^ Ignore free variables in sorts. , feBinders :: !Int -- ^ Under how many binders have we stepped? , feFlexRig :: !FlexRig -- ^ Are we flexible or rigid? , feRelevance :: !Relevance -- ^ What is the current relevance? , feSingleton :: SingleVar c -- ^ Method to return a single variable. } type Variable = (Int, VarOcc) type SingleVar c = Variable -> c -- | The initial context. initFreeEnv :: SingleVar c -> FreeEnv c initFreeEnv sing = FreeEnv { feIgnoreSorts = IgnoreNot , feBinders = 0 , feFlexRig = Unguarded , feRelevance = Relevant , feSingleton = sing } type FreeM c = Reader (FreeEnv c) c instance Monoid c => Monoid (FreeM c) where mempty = pure mempty mappend = liftA2 mappend mconcat = mconcat <.> sequence -- instance Singleton a c => Singleton a (FreeM c) where -- singleton = pure . singleton -- | Base case: a variable. variable :: (Monoid c) => Int -> FreeM c variable n = do m <- (n -) <$> asks feBinders if m < 0 then mempty else do o <- asks feFlexRig r <- asks feRelevance s <- asks feSingleton pure $ s (m, VarOcc o r) -- | Going under a binder. bind :: FreeM a -> FreeM a bind = local $ \ e -> e { feBinders = 1 + feBinders e } -- | Changing the 'FlexRig' context. go :: FlexRig -> FreeM a -> FreeM a go o = local $ \ e -> e { feFlexRig = composeFlexRig o $ feFlexRig e } -- | Changing the 'Relevance'. goRel :: Relevance-> FreeM a -> FreeM a goRel r = local $ \ e -> e { feRelevance = composeRelevance r $ feRelevance e } -- | What happens to the variables occurring under a constructor? underConstructor :: ConHead -> FreeM a -> FreeM a underConstructor (ConHead c i fs) = case (i,fs) of -- Coinductive (record) constructors admit infinite cycles: (CoInductive, _) -> go WeaklyRigid -- Inductive data constructors do not admit infinite cycles: (Inductive, []) -> go StronglyRigid -- Inductive record constructors do not admit infinite cycles, -- but this cannot be proven inside Agda. -- Thus, unification should not prove it either. (Inductive, (_:_)) -> id -- | Gather free variables in a collection. class Free' a c where -- Misplaced SPECIALIZE pragma: -- {-# SPECIALIZE freeVars' :: a -> FreeM Any #-} -- So you cannot specialize all instances in one go. :( freeVars' :: (Monoid c) => a -> FreeM c instance Free' Term c where -- SPECIALIZE instance does not work as well, see -- https://ghc.haskell.org/trac/ghc/ticket/10434#ticket -- {-# SPECIALIZE instance Free' Term All #-} -- {-# SPECIALIZE freeVars' :: Term -> FreeM Any #-} -- {-# SPECIALIZE freeVars' :: Term -> FreeM All #-} -- {-# SPECIALIZE freeVars' :: Term -> FreeM VarSet #-} freeVars' t = case t of Var n ts -> variable n `mappend` do go WeaklyRigid $ freeVars' ts -- λ is not considered guarding, as -- we cannot prove that x ≡ λy.x is impossible. Lam _ t -> freeVars' t Lit _ -> mempty Def _ ts -> go WeaklyRigid $ freeVars' ts -- because we are not in TCM -- we cannot query whether we are dealing with a data/record (strongly r.) -- or a definition by pattern matching (weakly rigid) -- thus, we approximate, losing that x = List x is unsolvable Con c ts -> underConstructor c $ freeVars' ts -- Pi is not guarding, since we cannot prove that A ≡ B → A is impossible. -- Even as we do not permit infinite type expressions, -- we cannot prove their absence (as Set is not inductive). -- Also, this is incompatible with univalence (HoTT). Pi a b -> freeVars' (a,b) Sort s -> freeVars' s Level l -> freeVars' l MetaV _ ts -> go Flexible $ freeVars' ts DontCare mt -> goRel Irrelevant $ freeVars' mt Shared p -> freeVars' (derefPtr p) ExtLam cs ts -> freeVars' (cs, ts) instance Free' Type c where -- {-# SPECIALIZE instance Free' Type All #-} -- {-# SPECIALIZE freeVars' :: Type -> FreeM Any #-} -- {-# SPECIALIZE freeVars' :: Type -> FreeM All #-} -- {-# SPECIALIZE freeVars' :: Type -> FreeM VarSet #-} -- {-# SPECIALIZE freeVars' :: Type -> FreeM VarMap #-} freeVars' (El s t) = ifM ((IgnoreNot ==) <$> asks feIgnoreSorts) {- then -} (freeVars' (s, t)) {- else -} (freeVars' t) instance Free' Sort c where -- {-# SPECIALIZE instance Free' Sort All #-} -- {-# SPECIALIZE freeVars' :: Sort -> FreeM Any #-} -- {-# SPECIALIZE freeVars' :: Sort -> FreeM All #-} -- {-# SPECIALIZE freeVars' :: Sort -> FreeM VarSet #-} -- {-# SPECIALIZE freeVars' :: Sort -> FreeM VarMap #-} freeVars' s = ifM ((IgnoreAll ==) <$> asks feIgnoreSorts) mempty $ {- else -} case s of Type a -> freeVars' a Prop -> mempty Inf -> mempty SizeUniv -> mempty DLub s1 s2 -> go WeaklyRigid $ freeVars' (s1, s2) instance Free' Level c where -- {-# SPECIALIZE instance Free' Level All #-} -- {-# SPECIALIZE freeVars' :: Level -> FreeM Any #-} -- {-# SPECIALIZE freeVars' :: Level -> FreeM All #-} -- {-# SPECIALIZE freeVars' :: Level -> FreeM VarSet #-} -- {-# SPECIALIZE freeVars' :: Level -> FreeM VarMap #-} freeVars' (Max as) = freeVars' as instance Free' PlusLevel c where -- {-# SPECIALIZE instance Free' PlusLevel All #-} -- {-# SPECIALIZE freeVars' :: PlusLevel -> FreeM Any #-} -- {-# SPECIALIZE freeVars' :: PlusLevel -> FreeM All #-} -- {-# SPECIALIZE freeVars' :: PlusLevel -> FreeM VarSet #-} -- {-# SPECIALIZE freeVars' :: PlusLevel -> FreeM VarMap #-} freeVars' ClosedLevel{} = mempty freeVars' (Plus _ l) = freeVars' l instance Free' LevelAtom c where -- {-# SPECIALIZE instance Free' LevelAtom All #-} -- {-# SPECIALIZE freeVars' :: LevelAtom -> FreeM Any #-} -- {-# SPECIALIZE freeVars' :: LevelAtom -> FreeM All #-} -- {-# SPECIALIZE freeVars' :: LevelAtom -> FreeM VarSet #-} -- {-# SPECIALIZE freeVars' :: LevelAtom -> FreeM VarMap #-} freeVars' l = case l of MetaLevel _ vs -> go Flexible $ freeVars' vs NeutralLevel _ v -> freeVars' v BlockedLevel _ v -> freeVars' v UnreducedLevel v -> freeVars' v instance Free' a c => Free' [a] c where -- {-# SPECIALIZE instance Free' a All => Free' [a] All #-} -- {-# SPECIALIZE freeVars' :: Free' a Any => [a] -> FreeM Any #-} -- {-# SPECIALIZE freeVars' :: Free' a All => [a] -> FreeM All #-} -- {-# SPECIALIZE freeVars' :: Free' a VarSet => [a] -> FreeM VarSet #-} -- {-# SPECIALIZE freeVars' :: Free' a VarMap => [a] -> FreeM VarMap #-} freeVars' = foldMap freeVars' instance Free' a c => Free' (Maybe a) c where -- {-# SPECIALIZE instance Free' a All => Free' (Maybe a) All #-} -- {-# SPECIALIZE freeVars' :: Free' a Any => Maybe a -> FreeM Any #-} -- {-# SPECIALIZE freeVars' :: Free' a All => Maybe a -> FreeM All #-} -- {-# SPECIALIZE freeVars' :: Free' a VarSet => Maybe a -> FreeM VarSet #-} -- {-# SPECIALIZE freeVars' :: Free' a VarMap => Maybe a -> FreeM VarMap #-} freeVars' = foldMap freeVars' instance (Free' a c, Free' b c) => Free' (a,b) c where -- {-# SPECIALIZE instance (Free' a All, Free' b All) => Free' (a,b) All #-} -- {-# SPECIALIZE freeVars' :: (Free' a Any, Free' b Any) => (a,b) -> FreeM Any #-} -- {-# SPECIALIZE freeVars' :: (Free' a All, Free' b All) => (a,b) -> FreeM All #-} -- {-# SPECIALIZE freeVars' :: (Free' a VarSet, Free' b VarSet) => (a,b) -> FreeM VarSet #-} -- {-# SPECIALIZE freeVars' :: (Free' a VarMap, Free' b VarMap) => (a,b) -> FreeM VarMap #-} freeVars' (x,y) = freeVars' x `mappend` freeVars' y instance Free' a c => Free' (Elim' a) c where -- {-# SPECIALIZE instance Free' a All => Free' (Elim' a) All #-} -- {-# SPECIALIZE freeVars' :: Free' a Any => Elim' a -> FreeM Any #-} -- {-# SPECIALIZE freeVars' :: Free' a All => Elim' a -> FreeM All #-} -- {-# SPECIALIZE freeVars' :: Free' a VarSet => Elim' a -> FreeM VarSet #-} -- {-# SPECIALIZE freeVars' :: Free' a VarMap => Elim' a -> FreeM VarMap #-} freeVars' (Apply a) = freeVars' a freeVars' (Proj{} ) = mempty instance Free' a c => Free' (Arg a) c where -- {-# SPECIALIZE instance Free' a All => Free' (Arg a) All #-} -- {-# SPECIALIZE freeVars' :: Free' a Any => Arg a -> FreeM Any #-} -- {-# SPECIALIZE freeVars' :: Free' a All => Arg a -> FreeM All #-} -- {-# SPECIALIZE freeVars' :: Free' a VarSet => Arg a -> FreeM VarSet #-} -- {-# SPECIALIZE freeVars' :: Free' a VarMap => Arg a -> FreeM VarMap #-} freeVars' a = goRel (getRelevance a) $ freeVars' $ unArg a instance Free' a c => Free' (Dom a) c where -- {-# SPECIALIZE instance Free' a All => Free' (Dom a) All #-} -- {-# SPECIALIZE freeVars' :: Free' a Any => Dom a -> FreeM Any #-} -- {-# SPECIALIZE freeVars' :: Free' a All => Dom a -> FreeM All #-} -- {-# SPECIALIZE freeVars' :: Free' a VarSet => Dom a -> FreeM VarSet #-} -- {-# SPECIALIZE freeVars' :: Free' a VarMap => Dom a -> FreeM VarMap #-} freeVars' = freeVars' . unDom instance Free' a c => Free' (Abs a) c where -- {-# SPECIALIZE instance Free' a All => Free' (Abs a) All #-} -- {-# SPECIALIZE freeVars' :: Free' a Any => Abs a -> FreeM Any #-} -- {-# SPECIALIZE freeVars' :: Free' a All => Abs a -> FreeM All #-} -- {-# SPECIALIZE freeVars' :: Free' a VarSet => Abs a -> FreeM VarSet #-} -- {-# SPECIALIZE freeVars' :: Free' a VarMap => Abs a -> FreeM VarMap #-} freeVars' (Abs _ b) = bind $ freeVars' b freeVars' (NoAbs _ b) = freeVars' b instance Free' a c => Free' (Tele a) c where -- {-# SPECIALIZE instance Free' a All => Free' (Tele a) All #-} -- {-# SPECIALIZE freeVars' :: Free' a Any => Tele a -> FreeM Any #-} -- {-# SPECIALIZE freeVars' :: Free' a All => Tele a -> FreeM All #-} -- {-# SPECIALIZE freeVars' :: Free' a VarSet => Tele a -> FreeM VarSet #-} -- {-# SPECIALIZE freeVars' :: Free' a VarMap => Tele a -> FreeM VarMap #-} freeVars' EmptyTel = mempty freeVars' (ExtendTel a tel) = freeVars' (a, tel) instance Free' ClauseBody c where -- {-# SPECIALIZE instance Free' ClauseBody All #-} -- {-# SPECIALIZE freeVars' :: ClauseBody -> FreeM Any #-} -- {-# SPECIALIZE freeVars' :: ClauseBody -> FreeM All #-} -- {-# SPECIALIZE freeVars' :: ClauseBody -> FreeM VarSet #-} -- {-# SPECIALIZE freeVars' :: ClauseBody -> FreeM VarMap #-} freeVars' (Body t) = freeVars' t freeVars' (Bind b) = freeVars' b freeVars' NoBody = mempty instance Free' Clause c where -- {-# SPECIALIZE instance Free' Clause All #-} -- {-# SPECIALIZE freeVars' :: Clause -> FreeM Any #-} -- {-# SPECIALIZE freeVars' :: Clause -> FreeM All #-} -- {-# SPECIALIZE freeVars' :: Clause -> FreeM VarSet #-} -- {-# SPECIALIZE freeVars' :: Clause -> FreeM VarMap #-} freeVars' = freeVars' . clauseBody -- Generators instance Arbitrary FlexRig where arbitrary = arbitraryBoundedEnum instance Arbitrary VarOcc where arbitrary = VarOcc <$> arbitrary <*> arbitrary -- -} Agda-2.4.2.5/src/full/Agda/TypeChecking/Free/Old.hs0000644000000000000000000003011712635075266017617 0ustar0000000000000000{-# LANGUAGE CPP #-} {-# LANGUAGE FlexibleInstances #-} -- | Computing the free variables of a term. -- -- This is the old version of ''Agda.TypeChecking.Free'', using -- 'IntSet's for the separate variable categories. -- We keep it as a specification. -- -- The distinction between rigid and strongly rigid occurrences comes from: -- Jason C. Reed, PhD thesis, 2009, page 96 (see also his LFMTP 2009 paper) -- -- The main idea is that x = t(x) is unsolvable if x occurs strongly rigidly -- in t. It might have a solution if the occurrence is not strongly rigid, e.g. -- -- x = \f -> suc (f (x (\ y -> k))) has x = \f -> suc (f (suc k)) -- -- [Jason C. Reed, PhD thesis, page 106] -- -- Under coinductive constructors, occurrences are never strongly rigid. -- Also, function types and lambdas do not establish strong rigidity. -- Only inductive constructors do so. -- (See issue 1271). module Agda.TypeChecking.Free.Old ( FreeVars(..) , Free , IgnoreSorts(..) , freeVars , freeVarsIgnore , allVars , relevantVars , rigidVars , freeIn, isBinderUsed , freeInIgnoringSorts, freeInIgnoringSortAnn , relevantIn, relevantInIgnoringSortAnn , Occurrence(..) , occurrence ) where import Control.Applicative hiding (empty) import Control.Monad.Reader import Data.Foldable (foldMap) import Data.Monoid import Agda.Syntax.Common hiding (Arg, Dom, NamedArg) import Agda.Syntax.Internal import Agda.Utils.Function import Agda.Utils.Functor import Agda.Utils.Monad import Agda.Utils.VarSet (VarSet) import qualified Agda.Utils.VarSet as Set #include "undefined.h" import Agda.Utils.Impossible -- | Free variables of a term, (disjointly) partitioned into strongly and -- and weakly rigid variables, flexible variables and irrelevant variables. data FreeVars = FV { stronglyRigidVars :: VarSet -- ^ Variables under only and at least one inductive constructor(s). , unguardedVars :: VarSet -- ^ Variables at top or only under inductive record constructors -- λs and Πs. -- The purpose of recording these separately is that they -- can still become strongly rigid if put under a constructor -- whereas weakly rigid ones stay weakly rigid. , weaklyRigidVars :: VarSet -- ^ Ordinary rigid variables, e.g., in arguments of variables. , flexibleVars :: VarSet -- ^ Variables occuring in arguments of metas. -- These are only potentially free, depending how the meta variable is instantiated. , irrelevantVars :: VarSet -- ^ Variables in irrelevant arguments and under a @DontCare@, i.e., -- in irrelevant positions. , unusedVars :: VarSet -- ^ Variables in 'UnusedArg'uments. } deriving (Eq, Show) -- | Rigid variables: either strongly rigid, unguarded, or weakly rigid. rigidVars :: FreeVars -> VarSet rigidVars fv = Set.unions [ stronglyRigidVars fv , unguardedVars fv , weaklyRigidVars fv ] -- | All but the irrelevant variables. relevantVars :: FreeVars -> VarSet relevantVars fv = Set.unions [rigidVars fv, flexibleVars fv] -- | @allVars fv@ includes irrelevant variables. allVars :: FreeVars -> VarSet allVars fv = Set.unions [relevantVars fv, irrelevantVars fv, unusedVars fv] data Occurrence = NoOccurrence | Irrelevantly | StronglyRigid -- ^ Under at least one and only inductive constructors. | Unguarded -- ^ In top position, or only under inductive record constructors. | WeaklyRigid -- ^ In arguments to variables and definitions. | Flexible -- ^ In arguments of metas. | Unused deriving (Eq,Show) {- NO LONGER -- | @occurrence x fv@ ignores irrelevant variables in @fv@ -} occurrence :: Nat -> FreeVars -> Occurrence occurrence x fv | x `Set.member` stronglyRigidVars fv = StronglyRigid | x `Set.member` unguardedVars fv = Unguarded | x `Set.member` weaklyRigidVars fv = WeaklyRigid | x `Set.member` flexibleVars fv = Flexible | x `Set.member` irrelevantVars fv = Irrelevantly | x `Set.member` unusedVars fv = Unused | otherwise = NoOccurrence -- | Mark variables as flexible. Useful when traversing arguments of metas. flexible :: FreeVars -> FreeVars flexible fv = fv { stronglyRigidVars = Set.empty , unguardedVars = Set.empty , weaklyRigidVars = Set.empty , flexibleVars = relevantVars fv } -- | Mark rigid variables as non-strongly. Useful when traversion arguments of variables. weakly :: FreeVars -> FreeVars weakly fv = fv { stronglyRigidVars = Set.empty , unguardedVars = Set.empty , weaklyRigidVars = rigidVars fv } -- | Mark unguarded variables as strongly rigid. Useful when traversion arguments of inductive constructors. strongly :: FreeVars -> FreeVars strongly fv = fv { stronglyRigidVars = stronglyRigidVars fv `Set.union` unguardedVars fv , unguardedVars = Set.empty } -- | What happens to the variables occurring under a constructor? underConstructor :: ConHead -> FreeVars -> FreeVars underConstructor (ConHead c i fs) = case (i,fs) of -- Coinductive (record) constructors admit infinite cycles: (CoInductive, _) -> weakly -- Inductive data constructors do not admit infinite cycles: (Inductive, []) -> strongly -- Inductive record constructors do not admit infinite cycles, -- but this cannot be proven inside Agda. -- Thus, unification should not prove it either. (Inductive, (_:_)) -> id -- | Mark all free variables as irrelevant. irrelevantly :: FreeVars -> FreeVars irrelevantly fv = empty { irrelevantVars = allVars fv } -- | Mark all free variables as unused, except for irrelevant vars. unused :: FreeVars -> FreeVars unused fv = empty { irrelevantVars = irrelevantVars fv , unusedVars = Set.unions [ rigidVars fv, flexibleVars fv, unusedVars fv ] } -- | Pointwise union. union :: FreeVars -> FreeVars -> FreeVars union (FV sv1 gv1 rv1 fv1 iv1 uv1) (FV sv2 gv2 rv2 fv2 iv2 uv2) = FV (Set.union sv1 sv2) (Set.union gv1 gv2) (Set.union rv1 rv2) (Set.union fv1 fv2) (Set.union iv1 iv2) (Set.union uv1 uv2) unions :: [FreeVars] -> FreeVars unions = foldr union empty empty :: FreeVars empty = FV Set.empty Set.empty Set.empty Set.empty Set.empty Set.empty -- | Free variable sets form a monoid under 'union'. instance Monoid FreeVars where mempty = empty mappend = union mconcat = unions -- | @delete x fv@ deletes variable @x@ from variable set @fv@. delete :: Nat -> FreeVars -> FreeVars delete n (FV sv gv rv fv iv uv) = FV (Set.delete n sv) (Set.delete n gv) (Set.delete n rv) (Set.delete n fv) (Set.delete n iv) (Set.delete n uv) -- | @subtractFV n fv@ subtracts $n$ from each free variable in @fv@. subtractFV :: Nat -> FreeVars -> FreeVars subtractFV n (FV sv gv rv fv iv uv) = FV (Set.subtract n sv) (Set.subtract n gv) (Set.subtract n rv) (Set.subtract n fv) (Set.subtract n iv) (Set.subtract n uv) -- | A single unguarded variable. singleton :: Nat -> FreeVars singleton x = empty { unguardedVars = Set.singleton x } -- * Collecting free variables. -- | Where should we skip sorts in free variable analysis? data IgnoreSorts = IgnoreNot -- ^ Do not skip. | IgnoreInAnnotations -- ^ Skip when annotation to a type. | IgnoreAll -- ^ Skip unconditionally. deriving (Eq, Show) data FreeConf = FreeConf { fcIgnoreSorts :: !IgnoreSorts -- ^ Ignore free variables in sorts. , fcContext :: !Int -- ^ Under how many binders have we stepped? } initFreeConf :: FreeConf initFreeConf = FreeConf { fcIgnoreSorts = IgnoreNot , fcContext = 0 } -- | Doesn't go inside solved metas, but collects the variables from a -- metavariable application @X ts@ as @flexibleVars@. freeVars :: Free a => a -> FreeVars freeVars t = freeVars' t `runReader` initFreeConf freeVarsIgnore :: Free a => IgnoreSorts -> a -> FreeVars freeVarsIgnore i t = freeVars' t `runReader` initFreeConf{ fcIgnoreSorts = i } -- | Return type of fold over syntax. type FreeT = Reader FreeConf FreeVars instance Monoid FreeT where mempty = pure mempty mappend = liftA2 mappend mconcat = mconcat <.> sequence -- | Base case: a variable. variable :: Int -> FreeT variable n = do m <- (n -) <$> asks fcContext if m >= 0 then pure $ singleton m else mempty -- | Going under a binder. bind :: FreeT -> FreeT bind = local $ \ e -> e { fcContext = 1 + fcContext e } class Free a where freeVars' :: a -> FreeT instance Free Term where freeVars' t = case t of Var n ts -> variable n `mappend` do weakly <$> freeVars' ts -- λ is not considered guarding, as -- we cannot prove that x ≡ λy.x is impossible. Lam _ t -> freeVars' t Lit _ -> mempty Def _ ts -> weakly <$> freeVars' ts -- because we are not in TCM -- we cannot query whether we are dealing with a data/record (strongly r.) -- or a definition by pattern matching (weakly rigid) -- thus, we approximate, losing that x = List x is unsolvable Con c ts -> underConstructor c <$> freeVars' ts -- Pi is not guarding, since we cannot prove that A ≡ B → A is impossible. -- Even as we do not permit infinite type expressions, -- we cannot prove their absence (as Set is not inductive). -- Also, this is incompatible with univalence (HoTT). Pi a b -> freeVars' (a,b) Sort s -> freeVars' s Level l -> freeVars' l MetaV _ ts -> flexible <$> freeVars' ts DontCare mt -> irrelevantly <$> freeVars' mt Shared p -> freeVars' (derefPtr p) ExtLam cs ts -> freeVars' (cs, ts) instance Free Type where freeVars' (El s t) = ifM ((IgnoreNot ==) <$> asks fcIgnoreSorts) {- then -} (freeVars' (s, t)) {- else -} (freeVars' t) instance Free Sort where freeVars' s = ifM ((IgnoreAll ==) <$> asks fcIgnoreSorts) mempty $ {- else -} case s of Type a -> freeVars' a Prop -> mempty Inf -> mempty SizeUniv -> mempty DLub s1 s2 -> weakly <$> freeVars' (s1, s2) instance Free Level where freeVars' (Max as) = freeVars' as instance Free PlusLevel where freeVars' ClosedLevel{} = mempty freeVars' (Plus _ l) = freeVars' l instance Free LevelAtom where freeVars' l = case l of MetaLevel _ vs -> flexible <$> freeVars' vs NeutralLevel _ v -> freeVars' v BlockedLevel _ v -> freeVars' v UnreducedLevel v -> freeVars' v instance Free a => Free [a] where freeVars' = foldMap freeVars' instance Free a => Free (Maybe a) where freeVars' = foldMap freeVars' instance (Free a, Free b) => Free (a,b) where freeVars' (x,y) = freeVars' x `mappend` freeVars' y instance Free a => Free (Elim' a) where freeVars' (Apply a) = freeVars' a freeVars' (Proj{} ) = mempty instance Free a => Free (Arg a) where freeVars' a = f <$> freeVars' (unArg a) where f = case getRelevance a of Irrelevant -> irrelevantly UnusedArg -> unused _ -> id instance Free a => Free (Dom a) where freeVars' = freeVars' . unDom instance Free a => Free (Abs a) where freeVars' (Abs _ b) = bind $ freeVars' b freeVars' (NoAbs _ b) = freeVars' b instance Free a => Free (Tele a) where freeVars' EmptyTel = mempty freeVars' (ExtendTel a tel) = freeVars' (a, tel) instance Free ClauseBody where freeVars' (Body t) = freeVars' t freeVars' (Bind b) = freeVars' b freeVars' NoBody = mempty instance Free Clause where freeVars' = freeVars' . clauseBody freeIn :: Free a => Nat -> a -> Bool freeIn v t = v `Set.member` allVars (freeVars t) freeInIgnoringSorts :: Free a => Nat -> a -> Bool freeInIgnoringSorts v t = v `Set.member` allVars (freeVarsIgnore IgnoreAll t) freeInIgnoringSortAnn :: Free a => Nat -> a -> Bool freeInIgnoringSortAnn v t = v `Set.member` allVars (freeVarsIgnore IgnoreInAnnotations t) relevantInIgnoringSortAnn :: Free a => Nat -> a -> Bool relevantInIgnoringSortAnn v t = v `Set.member` relevantVars (freeVarsIgnore IgnoreInAnnotations t) relevantIn :: Free a => Nat -> a -> Bool relevantIn v t = v `Set.member` relevantVars (freeVarsIgnore IgnoreAll t) -- | Is the variable bound by the abstraction actually used? isBinderUsed :: Free a => Abs a -> Bool isBinderUsed NoAbs{} = False isBinderUsed (Abs _ x) = 0 `freeIn` x Agda-2.4.2.5/src/full/Agda/TypeChecking/Positivity/0000755000000000000000000000000012635075266020045 5ustar0000000000000000Agda-2.4.2.5/src/full/Agda/TypeChecking/Positivity/Tests.hs0000644000000000000000000000113112635075266021477 0ustar0000000000000000{-# LANGUAGE TemplateHaskell #-} module Agda.TypeChecking.Positivity.Tests where import Test.QuickCheck import Agda.TypeChecking.Positivity import Agda.Utils.SemiRing -- | The 'oplus' method for 'Occurrence' matches that for 'Edge'. prop_oplus_Occurrence_Edge :: Edge -> Edge -> Bool prop_oplus_Occurrence_Edge e1@(Edge o1 _) e2@(Edge o2 _) = case oplus e1 e2 of Edge o _ -> o == oplus o1 o2 -- Template Haskell hack to make the following $quickCheckAll work -- under GHC 7.8. return [] -- | Tests. tests :: IO Bool tests = do putStrLn "Agda.TypeChecking.Positivity" $quickCheckAll Agda-2.4.2.5/src/full/Agda/TypeChecking/Positivity/Occurrence.hs0000644000000000000000000001113112635075266022466 0ustar0000000000000000{-# LANGUAGE DeriveDataTypeable #-} {-# LANGUAGE TemplateHaskell #-} -- | Occurrences. module Agda.TypeChecking.Positivity.Occurrence where import Control.DeepSeq import Data.Typeable (Typeable) import Test.QuickCheck import Agda.Syntax.Position import Agda.Utils.Null import Agda.Utils.SemiRing -- | Subterm occurrences for positivity checking. -- The constructors are listed in increasing information they provide: -- @Mixed <= JustPos <= StrictPos <= GuardPos <= Unused@ -- @Mixed <= JustNeg <= Unused@. data Occurrence = Mixed -- ^ Arbitrary occurrence (positive and negative). | JustNeg -- ^ Negative occurrence. | JustPos -- ^ Positive occurrence, but not strictly positive. | StrictPos -- ^ Strictly positive occurrence. | GuardPos -- ^ Guarded strictly positive occurrence (i.e., under ∞). For checking recursive records. | Unused -- ^ No occurrence. deriving (Typeable, Show, Eq, Ord, Enum, Bounded) instance NFData Occurrence where rnf x = seq x () instance KillRange Occurrence where killRange = id instance Arbitrary Occurrence where arbitrary = elements [minBound .. maxBound] shrink Unused = [] shrink _ = [Unused] instance CoArbitrary Occurrence where coarbitrary = coarbitrary . fromEnum -- | 'Occurrence' is a complete lattice with least element 'Mixed' -- and greatest element 'Unused'. -- -- It forms a commutative semiring where 'oplus' is meet (glb) -- and 'otimes' is composition. Both operations are idempotent. -- -- For 'oplus', 'Unused' is neutral (zero) and 'Mixed' is dominant. -- For 'otimes', 'StrictPos' is neutral (one) and 'Unused' is dominant. instance SemiRing Occurrence where ozero = Unused oone = StrictPos oplus Mixed _ = Mixed -- dominant oplus _ Mixed = Mixed oplus Unused o = o -- neutral oplus o Unused = o oplus JustNeg JustNeg = JustNeg oplus JustNeg o = Mixed -- negative and any form of positve oplus o JustNeg = Mixed oplus GuardPos o = o -- second-rank neutral oplus o GuardPos = o oplus StrictPos o = o -- third-rank neutral oplus o StrictPos = o oplus JustPos JustPos = JustPos otimes Unused _ = Unused -- dominant otimes _ Unused = Unused otimes Mixed _ = Mixed -- second-rank dominance otimes _ Mixed = Mixed otimes JustNeg JustNeg = JustPos otimes JustNeg _ = JustNeg -- third-rank dominance otimes _ JustNeg = JustNeg otimes JustPos _ = JustPos -- fourth-rank dominance otimes _ JustPos = JustPos otimes GuardPos _ = GuardPos -- _ `elem` [StrictPos, GuardPos] otimes _ GuardPos = GuardPos otimes StrictPos StrictPos = StrictPos -- neutral instance StarSemiRing Occurrence where ostar Mixed = Mixed ostar JustNeg = Mixed ostar JustPos = JustPos ostar StrictPos = StrictPos ostar GuardPos = StrictPos ostar Unused = StrictPos instance Null Occurrence where empty = Unused ------------------------------------------------------------------------ -- Tests prop_Occurrence_oplus_associative :: Occurrence -> Occurrence -> Occurrence -> Bool prop_Occurrence_oplus_associative x y z = oplus x (oplus y z) == oplus (oplus x y) z prop_Occurrence_oplus_ozero :: Occurrence -> Bool prop_Occurrence_oplus_ozero x = oplus ozero x == x prop_Occurrence_oplus_commutative :: Occurrence -> Occurrence -> Bool prop_Occurrence_oplus_commutative x y = oplus x y == oplus y x prop_Occurrence_otimes_associative :: Occurrence -> Occurrence -> Occurrence -> Bool prop_Occurrence_otimes_associative x y z = otimes x (otimes y z) == otimes (otimes x y) z prop_Occurrence_otimes_oone :: Occurrence -> Bool prop_Occurrence_otimes_oone x = otimes oone x == x && otimes x oone == x prop_Occurrence_distributive :: Occurrence -> Occurrence -> Occurrence -> Bool prop_Occurrence_distributive x y z = otimes x (oplus y z) == oplus (otimes x y) (otimes x z) && otimes (oplus x y) z == oplus (otimes x z) (otimes y z) prop_Occurrence_otimes_ozero :: Occurrence -> Bool prop_Occurrence_otimes_ozero x = otimes ozero x == ozero && otimes x ozero == ozero prop_Occurrence_ostar :: Occurrence -> Bool prop_Occurrence_ostar x = ostar x == oplus oone (otimes x (ostar x)) && ostar x == oplus oone (otimes (ostar x) x) -- Template Haskell hack to make the following $quickCheckAll work -- under GHC 7.8. return [] -- | Tests. tests :: IO Bool tests = do putStrLn "Agda.TypeChecking.Positivity.Occurrence" $quickCheckAll Agda-2.4.2.5/src/full/Agda/TypeChecking/Coverage/0000755000000000000000000000000012635075266017415 5ustar0000000000000000Agda-2.4.2.5/src/full/Agda/TypeChecking/Coverage/Match.hs0000644000000000000000000002327412635075266021015 0ustar0000000000000000{-# LANGUAGE CPP #-} {-# LANGUAGE DeriveFunctor #-} {-# LANGUAGE PatternGuards #-} module Agda.TypeChecking.Coverage.Match where import Control.Applicative import Control.Monad.State import qualified Data.List as List import Data.Maybe (mapMaybe) import Data.Monoid import Data.Traversable (traverse) import Agda.Syntax.Abstract (IsProjP(..)) import Agda.Syntax.Common hiding (Arg, Dom, NamedArg) import Agda.Syntax.Internal import Agda.Syntax.Internal.Pattern () import Agda.Syntax.Literal import Agda.Utils.Permutation import Agda.Utils.Size import Agda.Utils.List #include "undefined.h" import Agda.Utils.Impossible {-| Given 1. the function clauses @cs@ 2. the patterns @ps@ and permutation @perm@ of a split clause we want to compute a variable index of the split clause to split on next. First, we find the set @cs'@ of all the clauses that are instances (via substitutions @rhos@) of the split clause. In these substitutions, we look for a column that has only constructor patterns. We try to split on this column first. -} -- | Match the given patterns against a list of clauses match :: [Clause] -> [Arg Pattern] -> Permutation -> Match Nat match cs ps perm = foldr choice No $ zipWith matchIt [0..] cs where mps = buildMPatterns perm ps -- If liberal matching on literals fails or blocks we go with that. -- If it succeeds we use the result from conservative literal matching. -- This is to make sure that we split enough when literals are involved. -- For instance, -- f ('x' :: 'y' :: _) = ... -- f (c :: s) = ... -- would never split the tail of the list if we only used conservative -- literal matching. matchIt i c = matchClause yesMatchLit mps i c +++ matchClause noMatchLit mps i c Yes _ +++ m = m No +++ _ = No Block x +++ _ = Block x BlockP +++ _ = BlockP -- | We use a special representation of the patterns we're trying to match -- against a clause. In particular we want to keep track of which variables -- are blocking a match. data MPat = VarMP Nat -- ^ De Bruijn index (usually, rightmost variable in patterns is 0). | ConMP ConHead [Arg MPat] | LitMP Literal | WildMP -- ^ For dot patterns that cannot be turned into patterns. | ProjMP QName -- ^ Projection copattern. buildMPatterns :: Permutation -> [Arg Pattern] -> [Arg MPat] buildMPatterns perm ps = evalState (mapM (traverse build) ps) xs where xs = permPicks $ flipP $ invertP __IMPOSSIBLE__ perm tick = do x : xs <- get; put xs; return x build (VarP _) = VarMP <$> tick build (ConP con _ ps) = ConMP con <$> mapM (traverse build . fmap namedThing) ps build (DotP t) = tick *> buildT t build (LitP l) = return $ LitMP l build (ProjP dest) = return $ ProjMP dest buildT (Con c args) = ConMP c <$> mapM (traverse buildT) args buildT (Var i []) = return (VarMP i) buildT _ = return WildMP -- | If matching is inconclusive (@Block@) we want to know which -- variables are blocking the match. data Match a = Yes a -- ^ Matches unconditionally. | No -- ^ Definitely does not match. | Block BlockingVars -- ^ Could match if non-empty list of blocking variables -- is instantiated properly. | BlockP -- ^ Could match if split on possible projections is performed. deriving (Functor) -- | Variable blocking a match. data BlockingVar = BlockingVar { blockingVarNo :: Nat -- ^ De Bruijn index of variable blocking the match. , blockingVarCons :: Maybe [ConHead] -- ^ @Nothing@ means there is an overlapping match for this variable. -- This happens if one clause has a constructor pattern at this position, -- and another a variable. It is also used for "just variable". -- -- @Just cons@ means that it is an non-overlapping match and -- @cons@ are the encountered constructors. } deriving (Show) type BlockingVars = [BlockingVar] mapBlockingVarCons :: (Maybe [ConHead] -> Maybe [ConHead]) -> BlockingVar -> BlockingVar mapBlockingVarCons f b = b { blockingVarCons = f (blockingVarCons b) } clearBlockingVarCons :: BlockingVar -> BlockingVar clearBlockingVarCons = mapBlockingVarCons $ const Nothing overlapping :: BlockingVars -> BlockingVars overlapping = map clearBlockingVarCons -- | Left dominant merge of blocking vars. zipBlockingVars :: BlockingVars -> BlockingVars -> BlockingVars zipBlockingVars xs ys = map upd xs where upd (BlockingVar x (Just cons)) | Just (BlockingVar _ (Just cons')) <- List.find ((x ==) . blockingVarNo) ys = BlockingVar x (Just $ cons ++ cons') upd (BlockingVar x _) = BlockingVar x Nothing -- | @choice m m'@ combines the match results @m@ of a function clause -- with the (already combined) match results $m'$ of the later clauses. -- It is for skipping clauses that definitely do not match ('No'). -- It is left-strict, to be used with @foldr@. -- If one clause unconditionally matches ('Yes') we do not look further. choice :: Match a -> Match a -> Match a choice (Yes a) _ = Yes a choice (Block x) (Block y) = Block (zipBlockingVars x y) choice (Block x) (Yes _) = Block $ overlapping x choice (Block x) _ = Block x choice BlockP m = BlockP choice No m = m type MatchLit = Literal -> MPat -> Match () noMatchLit :: MatchLit noMatchLit _ _ = No yesMatchLit :: MatchLit yesMatchLit _ VarMP{} = Yes () yesMatchLit _ WildMP{} = Yes () yesMatchLit _ _ = No -- | Check if a clause could match given generously chosen literals matchLits :: Clause -> [Arg Pattern] -> Permutation -> Bool matchLits c ps perm = case matchClause yesMatchLit (buildMPatterns perm ps) 0 c of Yes _ -> True _ -> False -- | @matchClause mlit qs i c@ checks whether clause @c@ number @i@ -- covers a split clause with patterns @qs@. matchClause :: MatchLit -> [Arg MPat] -> Nat -> Clause -> Match Nat matchClause mlit qs i c = i <$ matchPats mlit (clausePats c) qs -- | @matchPats mlit ps qs@ checks whether a function clause with patterns -- @ps@ covers a split clause with patterns @qs@. -- -- Issue 842: if in case of functions with varying arity, -- the split clause has proper patterns left, we refuse to match, -- because it would be troublesome to construct the split tree later. -- We would have to move bindings from the rhs to the lhs. -- For example, this is rejected: -- @ -- F : Bool -> Set1 -- F true = Set -- F = \ x -> Set -- @ matchPats :: MatchLit -> [Arg Pattern] -> [Arg MPat] -> Match () matchPats mlit ps qs = mconcat $ properMatchesLeft : zipWith (matchPat mlit) (map unArg ps) (map unArg qs) ++ [ projPatternsLeft ] where projPatternsLeft = let psrest = map unArg $ drop (length qs) ps in if null $ mapMaybe isProjP psrest -- not $ any properlyMatching psrest then Yes () -- no proj. patterns left else BlockP -- proj. patterns left properMatchesLeft = if any (properMatch . unArg) $ drop (length ps) qs then No else Yes () properMatch ConMP{} = True properMatch LitMP{} = True properMatch _ = False -- | Combine results of checking whether function clause patterns -- covers split clause patterns. -- -- 'No' is dominant: if one function clause pattern is disjoint to -- the corresponding split clause pattern, then -- the whole clauses are disjoint. -- -- 'Yes' is neutral: for a match, all patterns have to match. -- -- 'Block' accumulates variables of the split clause -- that have to be instantiated -- to make the split clause an instance of the function clause. -- -- 'BlockP' yields to 'Block', since blocking vars can also -- block the result type. instance Monoid a => Monoid (Match a) where mempty = Yes mempty Yes a `mappend` Yes b = Yes $ mappend a b Yes _ `mappend` m = m No `mappend` _ = No Block x `mappend` No = No Block x `mappend` Block y = Block $ mappend x y Block x `mappend` _ = Block x BlockP `mappend` No = No BlockP `mappend` Block y = Block y BlockP `mappend` _ = BlockP -- | @matchPat mlit p q@ checks whether a function clause pattern @p@ -- covers a split clause pattern @q@. There are three results: -- @Yes ()@ means it covers, because @p@ is a variable -- pattern or @q@ is a wildcard. -- @No@ means it does not cover. -- @Block [x]@ means @p@ is a proper instance of @q@ and could become -- a cover if @q@ was split on variable @x@. matchPat :: MatchLit -> Pattern -> MPat -> Match () matchPat _ (VarP _) _ = Yes () matchPat _ (DotP _) _ = Yes () matchPat mlit (LitP l) q = mlit l q matchPat _ (ProjP d) (ProjMP d') = if d == d' then Yes () else No matchPat _ (ProjP d) _ = __IMPOSSIBLE__ -- matchPat mlit (ConP c (Just _) ps) q | recordPattern ps = Yes () -- Andreas, 2012-07-25 record patterns always match! matchPat mlit (ConP c _ ps) q = case q of VarMP x -> Block [BlockingVar x (Just [c])] WildMP{} -> No -- Andreas, 2013-05-15 this was "Yes()" triggering issue 849 ConMP c' qs | c == c' -> matchPats mlit (map (fmap namedThing) ps) qs | otherwise -> No LitMP _ -> __IMPOSSIBLE__ ProjMP _ -> __IMPOSSIBLE__ {- UNUSED class RecordPattern a where recordPattern :: a -> Bool instance RecordPattern Pattern where recordPattern VarP{} = True recordPattern DotP{} = False recordPattern LitP{} = False recordPattern (ConP _ Nothing _) = False recordPattern (ConP _ (Just _) ps) = recordPattern ps instance RecordPattern a => RecordPattern [a] where recordPattern = all recordPattern instance RecordPattern a => RecordPattern (Arg a) where recordPattern = recordPattern . unArg -} Agda-2.4.2.5/src/full/Agda/TypeChecking/Coverage/SplitTree.hs0000644000000000000000000000631012635075266021664 0ustar0000000000000000{-# LANGUAGE CPP #-} {-| Split tree for transforming pattern clauses into case trees. The coverage checker generates a split tree from the clauses. The clause compiler uses it to transform clauses to case trees. The initial problem is a set of clauses. The root node designates on which argument to split and has subtrees for all the constructors. Splitting continues until there is only a single clause left at each leaf of the split tree. -} module Agda.TypeChecking.Coverage.SplitTree where import Data.Tree import Test.QuickCheck import Agda.Syntax.Abstract.Name import Agda.Utils.Monad #include "undefined.h" import Agda.Utils.Impossible type SplitTree = SplitTree' QName type SplitTrees = SplitTrees' QName -- | Abstract case tree shape. data SplitTree' a = -- | No more splits coming. We are at a single, all-variable -- clause. SplittingDone { splitBindings :: Int -- ^ The number of variables bound in the clause } | -- | A split is necessary. SplitAt { splitArg :: Int -- ^ Arg. no to split at. , splitTrees :: SplitTrees' a -- ^ Sub split trees. } deriving (Eq) -- | Split tree branching. A finite map from constructor names to splittrees -- A list representation seems appropriate, since we are expecting not -- so many constructors per data type, and there is no need for -- random access. type SplitTrees' a = [(a, SplitTree' a)] -- * Printing a split tree data SplitTreeLabel a = SplitTreeLabel { lblConstructorName :: Maybe a -- ^ 'Nothing' for root of split tree , lblSplitArg :: Maybe Int , lblBindings :: Maybe Int } instance Show a => Show (SplitTreeLabel a) where show (SplitTreeLabel Nothing Nothing (Just n)) = "done, " ++ show n ++ " bindings" show (SplitTreeLabel Nothing (Just n) Nothing) = "split at " ++ show n show (SplitTreeLabel (Just q) Nothing (Just n)) = show q ++ " -> done, " ++ show n ++ " bindings" show (SplitTreeLabel (Just q) (Just n) Nothing) = show q ++ " -> split at " ++ show n show _ = __IMPOSSIBLE__ -- | Convert a split tree into a 'Data.Tree' (for printing). toTree :: SplitTree' a -> Tree (SplitTreeLabel a) toTree t = case t of SplittingDone n -> Node (SplitTreeLabel Nothing Nothing (Just n)) [] SplitAt n ts -> Node (SplitTreeLabel Nothing (Just n) Nothing) $ toTrees ts toTrees :: SplitTrees' a -> Forest (SplitTreeLabel a) toTrees = map (\ (c,t) -> setCons c $ toTree t) where setCons :: a -> Tree (SplitTreeLabel a) -> Tree (SplitTreeLabel a) setCons c (Node l ts) = Node (l { lblConstructorName = Just c }) ts instance Show a => Show (SplitTree' a) where show = drawTree . fmap show . toTree -- * Generating random split trees for testing instance Arbitrary a => Arbitrary (SplitTree' a) where arbitrary = frequency [ (5, return $ SplittingDone 0) , (3, SplitAt <$> choose (1,5) <*> (take 3 <$> listOf1 arbitrary)) ] -- * Testing the printer newtype CName = CName String instance Show CName where show (CName s) = s instance Arbitrary CName where arbitrary = CName <$> elements [ "zero", "suc", "nil", "cons", "left", "right", "just", "nothing" ] testSplitTreePrinting :: IO () testSplitTreePrinting = sample (arbitrary :: Gen (SplitTree' CName)) Agda-2.4.2.5/src/full/Agda/TypeChecking/Reduce/0000755000000000000000000000000012635075266017071 5ustar0000000000000000Agda-2.4.2.5/src/full/Agda/TypeChecking/Reduce/Monad.hs0000644000000000000000000001560612635075266020473 0ustar0000000000000000{-# LANGUAGE CPP #-} {-# LANGUAGE FlexibleContexts #-} {-# LANGUAGE TupleSections #-} {-# LANGUAGE RankNTypes #-} {-# OPTIONS_GHC -fno-warn-orphans #-} module Agda.TypeChecking.Reduce.Monad ( constructorForm , enterClosure , underAbstraction_ , getConstInfo , isInstantiatedMeta , lookupMeta , reportSDoc, reportSLn , traceSLn, traceSDoc , askR, applyWhenVerboseS ) where import Prelude hiding (null) import Control.Arrow ((***), first, second) import Control.Applicative hiding (empty) import Control.Monad.Reader import Control.Monad.Identity import qualified Data.Map as Map import Data.Maybe import Data.Monoid import Debug.Trace import System.IO.Unsafe import Agda.Syntax.Common (unDom) import Agda.Syntax.Position import Agda.Syntax.Internal import Agda.TypeChecking.Monad hiding ( enterClosure, underAbstraction_, underAbstraction, addCtx, mkContextEntry, isInstantiatedMeta, verboseS, reportSDoc, reportSLn, typeOfConst, lookupMeta ) import Agda.TypeChecking.Monad.Builtin hiding ( constructorForm ) import Agda.TypeChecking.Substitute import Agda.Interaction.Options import qualified Agda.Utils.HashMap as HMap import Agda.Utils.Lens import Agda.Utils.Monad import Agda.Utils.Null import Agda.Utils.Pretty #include "undefined.h" import Agda.Utils.Impossible gets :: (TCState -> a) -> ReduceM a gets f = f . redSt <$> ReduceM ask useR :: Lens' a TCState -> ReduceM a useR l = gets (^.l) askR :: ReduceM ReduceEnv askR = ReduceM ask localR :: (ReduceEnv -> ReduceEnv) -> ReduceM a -> ReduceM a localR f = ReduceM . local f . unReduceM instance HasOptions ReduceM where pragmaOptions = useR stPragmaOptions commandLineOptions = do p <- useR stPragmaOptions cl <- gets $ stPersistentOptions . stPersistentState return $ cl{ optPragmaOptions = p } instance HasBuiltins ReduceM where getBuiltinThing b = liftM2 mplus (Map.lookup b <$> useR stLocalBuiltins) (Map.lookup b <$> useR stImportedBuiltins) constructorForm :: Term -> ReduceM Term constructorForm v = do mz <- getBuiltin' builtinZero ms <- getBuiltin' builtinSuc return $ fromMaybe v $ constructorForm' mz ms v enterClosure :: Closure a -> (a -> ReduceM b) -> ReduceM b enterClosure (Closure sig env scope x) f = localR (mapRedEnvSt inEnv inState) (f x) where inEnv e = env { envAllowDestructiveUpdate = envAllowDestructiveUpdate e } inState s = set stScope scope s -- TODO: use the signature here? would that fix parts of issue 118? withFreshR :: HasFresh i => (i -> ReduceM a) -> ReduceM a withFreshR f = do s <- gets id let (i, s') = nextFresh s localR (mapRedSt $ const s') (f i) withFreshName :: Range -> ArgName -> (Name -> ReduceM a) -> ReduceM a withFreshName r s k = withFreshR $ \i -> k (mkName r i s) withFreshName_ :: ArgName -> (Name -> ReduceM a) -> ReduceM a withFreshName_ = withFreshName noRange mkContextEntry :: Dom (Name, Type) -> (ContextEntry -> ReduceM a) -> ReduceM a mkContextEntry x k = withFreshR $ \i -> k (Ctx i x) addCtx :: Name -> Dom Type -> ReduceM a -> ReduceM a addCtx x a ret = do ctx <- asks $ map (nameConcrete . fst . unDom . ctxEntry) . envContext let x' = head $ filter (notTaken ctx) $ iterate nextName x mkContextEntry ((x',) <$> a) $ \ce -> local (\e -> e { envContext = ce : envContext e }) ret -- let-bindings keep track of own their context where notTaken xs x = isNoName x || nameConcrete x `notElem` xs underAbstraction :: Subst a => Dom Type -> Abs a -> (a -> ReduceM b) -> ReduceM b underAbstraction _ (NoAbs _ v) f = f v underAbstraction t a f = withFreshName_ (realName $ absName a) $ \x -> addCtx x t $ f (absBody a) where realName s = if isNoName s then "x" else s underAbstraction_ :: Subst a => Abs a -> (a -> ReduceM b) -> ReduceM b underAbstraction_ = underAbstraction dummyDom lookupMeta :: MetaId -> ReduceM MetaVariable lookupMeta i = fromMaybe __IMPOSSIBLE__ . Map.lookup i <$> useR stMetaStore isInstantiatedMeta :: MetaId -> ReduceM Bool isInstantiatedMeta i = do mv <- lookupMeta i return $ case mvInstantiation mv of InstV{} -> True InstS{} -> True _ -> False -- | Run a computation if a certain verbosity level is activated. -- -- Precondition: The level must be non-negative. verboseS :: VerboseKey -> Int -> ReduceM () -> ReduceM () verboseS k n action = whenM (hasVerbosity k n) action reportSDoc :: VerboseKey -> Int -> TCM Doc -> ReduceM () reportSDoc k n doc = return () -- Cannot implement this! reportSLn :: VerboseKey -> Int -> String -> ReduceM () reportSLn k n s = return () -- Cannot implement this! -- | Apply a function if a certain verbosity level is activated. -- -- Precondition: The level must be non-negative. {-# SPECIALIZE applyWhenVerboseS :: VerboseKey -> Int -> (ReduceM a -> ReduceM a) -> ReduceM a-> ReduceM a #-} applyWhenVerboseS :: HasOptions m => VerboseKey -> Int -> (m a -> m a) -> m a -> m a applyWhenVerboseS k n f a = ifM (hasVerbosity k n) (f a) a traceSDoc :: VerboseKey -> Int -> TCM Doc -> ReduceM a -> ReduceM a traceSDoc k n doc = applyWhenVerboseS k n $ \ cont -> do ReduceEnv env st <- askR -- return $! unsafePerformIO $ do print . fst =<< runTCM env st doc trace (show $ fst $ unsafePerformIO $ runTCM env st doc) cont -- traceSDoc :: VerboseKey -> Int -> TCM Doc -> ReduceM a -> ReduceM a -- traceSDoc k n doc = verboseS k n $ ReduceM $ do -- ReduceEnv env st <- ask -- -- return $! unsafePerformIO $ do print . fst =<< runTCM env st doc -- trace (show $ fst $ unsafePerformIO $ runTCM env st doc) $ return () {-# SPECIALIZE traceSLn :: VerboseKey -> Int -> String -> ReduceM a -> ReduceM a #-} traceSLn :: HasOptions m => VerboseKey -> Int -> String -> m a -> m a traceSLn k n s = applyWhenVerboseS k n (trace s) instance HasConstInfo ReduceM where getRewriteRulesFor = defaultGetRewriteRulesFor (gets id) getConstInfo q = ReduceM $ ReaderT $ \(ReduceEnv env st) -> Identity $ let defs = st^.(stSignature . sigDefinitions) idefs = st^.(stImports . sigDefinitions) in case catMaybes [HMap.lookup q defs, HMap.lookup q idefs] of [] -> trace ("Unbound name: " ++ show q ++ " " ++ showQNameId q) __IMPOSSIBLE__ [d] -> mkAbs env d ds -> trace ("Ambiguous name: " ++ show q) __IMPOSSIBLE__ where mkAbs env d | treatAbstractly' q' env = fromMaybe err $ makeAbstract d | otherwise = d where err = trace ("Not in scope: " ++ show q) __IMPOSSIBLE__ q' = case theDef d of -- Hack to make abstract constructors work properly. The constructors -- live in a module with the same name as the datatype, but for 'abstract' -- purposes they're considered to be in the same module as the datatype. Constructor{} -> dropLastModule q _ -> q dropLastModule q@QName{ qnameModule = m } = q{ qnameModule = mnameFromList $ ifNull (mnameToList m) __IMPOSSIBLE__ init } Agda-2.4.2.5/src/full/Agda/TypeChecking/CompiledClause/0000755000000000000000000000000012635075266020553 5ustar0000000000000000Agda-2.4.2.5/src/full/Agda/TypeChecking/CompiledClause/Compile.hs0000644000000000000000000002223412635075266022502 0ustar0000000000000000{-# LANGUAGE CPP #-} {-# LANGUAGE TupleSections #-} module Agda.TypeChecking.CompiledClause.Compile where import Prelude hiding (null) import Data.Maybe import Data.Monoid import qualified Data.Map as Map import Data.List (genericReplicate, nubBy, findIndex) import Data.Function import Debug.Trace import Agda.Syntax.Common import Agda.Syntax.Internal as I import Agda.TypeChecking.CompiledClause import Agda.TypeChecking.Coverage import Agda.TypeChecking.Coverage.SplitTree import Agda.TypeChecking.Monad import Agda.TypeChecking.RecordPatterns import Agda.TypeChecking.Substitute import Agda.TypeChecking.Pretty (prettyTCM, nest, sep, text) import Agda.Utils.Functor import Agda.Utils.Maybe import Agda.Utils.Null import Agda.Utils.List import Agda.Utils.Pretty (Pretty(..), prettyShow) import qualified Agda.Utils.Pretty as P #include "undefined.h" import Agda.Utils.Impossible -- | Process function clauses into case tree. -- This involves: -- 1. Coverage checking, generating a split tree. -- 2. Translation of lhs record patterns into rhs uses of projection. -- Update the split tree. -- 3. Generating a case tree from the split tree. -- Phases 1. and 2. are skipped if @Nothing@. compileClauses :: Maybe (QName, Type) -- ^ Translate record patterns and coverage check with given type? -> [Clause] -> TCM CompiledClauses compileClauses mt cs = do let cls = [ Cl (clausePats c) (clauseBody c) | c <- cs ] case mt of Nothing -> return $ compile cls Just (q, t) -> do splitTree <- coverageCheck q t cs reportSDoc "tc.cc" 30 $ sep $ do (text "clauses patterns before compilation") : do map (prettyTCM . map unArg . clPats) cls reportSDoc "tc.cc" 50 $ do sep [ text "clauses before compilation" , (nest 2 . text . show) cs ] let cc = compileWithSplitTree splitTree cls reportSDoc "tc.cc" 12 $ sep [ text "compiled clauses (still containing record splits)" , nest 2 $ text (show cc) ] cc <- translateCompiledClauses cc return cc -- | Stripped-down version of 'Agda.Syntax.Internal.Clause' -- used in clause compiler. data Cl = Cl { clPats :: [I.Arg Pattern] , clBody :: ClauseBody } deriving (Show) instance Pretty Cl where pretty (Cl ps b) = P.prettyList ps P.<+> P.text "->" P.<+> pretty b type Cls = [Cl] compileWithSplitTree :: SplitTree -> Cls -> CompiledClauses compileWithSplitTree t cs = case t of SplitAt i ts -> Case i $ compiles ts $ splitOn (length ts == 1) i cs -- if there is just one case, we force expansion of catch-alls -- this is needed to generate a sound tree on which we can -- collapse record pattern splits SplittingDone n -> compile cs -- after end of split tree, continue with left-to-right strategy where compiles :: SplitTrees -> Case Cls -> Case CompiledClauses compiles ts br@Branches{ projPatterns = cop , conBranches = cons , litBranches = lits , catchAllBranch = catchAll } = Branches { projPatterns = cop , conBranches = updCons cons , litBranches = compile <$> lits , catchAllBranch = compile <$> catchAll } where updCons = Map.mapWithKey $ \ c cl -> caseMaybe (lookup c ts) compile compileWithSplitTree <$> cl -- When the split tree is finished, we continue with @compile@. compile :: Cls -> CompiledClauses compile cs = case nextSplit cs of Just (isRecP, n)-> Case n $ fmap compile $ splitOn isRecP n cs Nothing -> case map (getBody . clBody) cs of -- It's possible to get more than one clause here due to -- catch-all expansion. Just t : _ -> Done (map (fmap name) $ clPats $ head cs) (shared t) Nothing : _ -> Fail [] -> __IMPOSSIBLE__ where name (VarP x) = x name (DotP _) = underscore name ConP{} = __IMPOSSIBLE__ name LitP{} = __IMPOSSIBLE__ name ProjP{} = __IMPOSSIBLE__ -- | Get the index of the next argument we need to split on. -- This the number of the first pattern that does a match in the first clause. nextSplit :: Cls -> Maybe (Bool, Int) nextSplit [] = __IMPOSSIBLE__ nextSplit (Cl ps _ : _) = headMaybe $ catMaybes $ zipWith (\ p n -> (,n) <$> properSplit (unArg p)) ps [0..] -- | Is is not a variable pattern? -- And if yes, is it a record pattern? properSplit :: Pattern -> Maybe Bool properSplit (ConP _ cpi _) = Just $ isJust $ conPRecord cpi properSplit LitP{} = Just False properSplit ProjP{} = Just False properSplit VarP{} = Nothing properSplit DotP{} = Nothing -- | Is this a variable pattern? -- -- Maintain invariant: @isVar = isNothing . properSplit@! isVar :: Pattern -> Bool isVar VarP{} = True isVar DotP{} = True isVar ConP{} = False isVar LitP{} = False isVar ProjP{} = False -- | @splitOn single n cs@ will force expansion of catch-alls -- if @single@. splitOn :: Bool -> Int -> Cls -> Case Cls splitOn single n cs = mconcat $ map (fmap (:[]) . splitC n) $ -- (\ cs -> trace ("splitting on " ++ show n ++ " after expandCatchAlls " ++ show single ++ ": " ++ prettyShow (P.prettyList cs)) cs) $ expandCatchAlls single n cs splitC :: Int -> Cl -> Case Cl splitC n (Cl ps b) = case unArg p of ProjP d -> projCase d $ Cl (ps0 ++ ps1) b ConP c _ qs -> conCase (conName c) $ WithArity (length qs) $ Cl (ps0 ++ map (fmap namedThing) qs ++ ps1) b LitP l -> litCase l $ Cl (ps0 ++ ps1) b VarP{} -> catchAll $ Cl ps b DotP{} -> catchAll $ Cl ps b where (ps0, p, ps1) = extractNthElement' n ps -- | Expand catch-alls that appear before actual matches. -- -- Example: -- -- @ -- true y -- x false -- false y -- @ -- -- will expand the catch-all @x@ to @false@. -- -- Catch-alls need also to be expanded if -- they come before/after a record pattern, otherwise we get into -- trouble when we want to eliminate splits on records later. -- -- Another example (see Issue 1650): -- @ -- f (x, (y, z)) true = a -- f _ false = b -- @ -- Split tree: -- @ -- 0 (first argument of f) -- \- 1 (second component of the pair) -- \- 3 (last argument of f) -- \-- true -> a -- \- false -> b -- @ -- We would like to get the following case tree: -- @ -- case 0 of -- _,_ -> case 1 of -- _,_ -> case 3 of true -> a; false -> b -- _ -> case 3 of true -> a; false -> b -- _ -> case 3 of true -> a; false -> b -- @ expandCatchAlls :: Bool -> Int -> Cls -> Cls expandCatchAlls single n cs = -- Andreas, 2013-03-22 -- if there is a single case (such as for record splits) -- we force expansion if single then doExpand =<< cs else case cs of _ | all (isCatchAllNth . clPats) cs -> cs Cl ps b : cs | not (isCatchAllNth ps) -> Cl ps b : expandCatchAlls False n cs | otherwise -> map (expand ps b) expansions ++ Cl ps b : expandCatchAlls False n cs _ -> __IMPOSSIBLE__ where -- In case there is only one branch in the split tree, we expand all -- catch-alls for this position -- The @expansions@ are collected from all the clauses @cs@ then. -- Note: @expansions@ could be empty, so we keep the orignal clause. doExpand c@(Cl ps b) | isVar $ unArg $ nth ps = map (expand ps b) expansions ++ [c] | otherwise = [c] -- True if nth pattern is variable or there are less than n patterns. isCatchAllNth ps = all (isVar . unArg) $ take 1 $ drop n ps nth qs = headWithDefault __IMPOSSIBLE__ $ drop n qs classify (LitP l) = Left l classify (ConP c _ _) = Right c classify _ = __IMPOSSIBLE__ -- All non-catch-all patterns following this one (at position n). -- These are the cases the wildcard needs to be expanded into. expansions = nubBy ((==) `on` (classify . unArg)) . filter (not . isVar . unArg) . map (nth . clPats) $ cs expand ps b q = case unArg q of ConP c mt qs' -> Cl (ps0 ++ [q $> ConP c mt conPArgs] ++ ps1) (substBody n' m (Con c conArgs) b) where m = length qs' -- replace all direct subpatterns of q by _ conPArgs = map (fmap ($> VarP underscore)) qs' conArgs = zipWith (\ q n -> q $> var n) qs' $ downFrom m LitP l -> Cl (ps0 ++ [q $> LitP l] ++ ps1) (substBody n' 0 (Lit l) b) _ -> __IMPOSSIBLE__ where (ps0, rest) = splitAt n ps ps1 = maybe __IMPOSSIBLE__ snd $ uncons rest n' = countVars ps0 countVars = sum . map (count . unArg) count VarP{} = 1 count (ConP _ _ ps) = countVars $ map (fmap namedThing) ps count DotP{} = 1 -- dot patterns are treated as variables in the clauses count _ = 0 substBody :: Int -> Int -> Term -> ClauseBody -> ClauseBody substBody _ _ _ NoBody = NoBody substBody 0 m v b = case b of Bind b -> foldr (.) id (replicate m (Bind . Abs underscore)) $ subst 0 v (absBody $ raise m b) _ -> __IMPOSSIBLE__ substBody n m v b = case b of Bind b -> Bind $ fmap (substBody (n - 1) m v) b _ -> __IMPOSSIBLE__ Agda-2.4.2.5/src/full/Agda/TypeChecking/CompiledClause/Match.hs0000644000000000000000000002000712635075266022142 0ustar0000000000000000{-# LANGUAGE CPP #-} {-# LANGUAGE ScopedTypeVariables #-} #if __GLASGOW_HASKELL__ >= 710 {-# LANGUAGE FlexibleContexts #-} #endif module Agda.TypeChecking.CompiledClause.Match where import Control.Applicative import Control.Monad.Reader (asks) import Data.List import Data.Monoid import qualified Data.Map as Map import Debug.Trace (trace) import Agda.Syntax.Internal import Agda.Syntax.Common import Agda.TypeChecking.CompiledClause import Agda.TypeChecking.Monad hiding (reportSDoc, reportSLn) import Agda.TypeChecking.Pretty import Agda.TypeChecking.Reduce import Agda.TypeChecking.Reduce.Monad as RedM import Agda.TypeChecking.Substitute import Agda.Utils.Maybe #include "undefined.h" import Agda.Utils.Impossible matchCompiled :: CompiledClauses -> MaybeReducedArgs -> ReduceM (Reduced (Blocked Args) Term) matchCompiled c args = do r <- matchCompiledE c $ map (fmap Apply) args case r of YesReduction simpl v -> return $ YesReduction simpl v NoReduction bes -> return $ NoReduction $ fmap (map fromElim) bes where fromElim (Apply v) = v fromElim (Proj f ) = __IMPOSSIBLE__ -- | @matchCompiledE c es@ takes a function given by case tree @c@ and -- and a spine @es@ and tries to apply the function to @es@. matchCompiledE :: CompiledClauses -> MaybeReducedElims -> ReduceM (Reduced (Blocked Elims) Term) matchCompiledE c args = match' [(c, args, id)] -- | A stack entry is a triple consisting of -- 1. the part of the case tree to continue matching, -- 2. the current argument vector, and -- 3. a patch function taking the current argument vector back -- to the original argument vector. type Frame = (CompiledClauses, MaybeReducedElims, Elims -> Elims) type Stack = [Frame] -- | @match'@ tries to solve the matching problems on the @Stack@. -- In each iteration, the top problem is removed and handled. -- -- If the top problem was a @Done@, we succeed. -- -- If the top problem was a @Case n@ and the @n@th argument of the problem -- is not a constructor or literal, we are stuck, thus, fail. -- -- If we have a branch for the constructor/literal, we put it on the stack -- to continue. -- If we do not have a branch, we fall through to the next problem, which -- should be the corresponding catch-all branch. -- -- An empty stack is an exception that can come only from an incomplete -- function definition. -- TODO: literal/constructor pattern conflict (for Nat) match' :: Stack -> ReduceM (Reduced (Blocked Elims) Term) match' ((c, es, patch) : stack) = do let debug = do traceSDoc "reduce.compiled" 95 $ vcat $ [ text "reducing case" <+> do caseMaybeM (asks envAppDef) __IMPOSSIBLE__ $ \ f -> do sep $ prettyTCM f : map prettyTCM es , text $ "trying clause " ++ show c ] let no blocking es = return $ NoReduction $ blocking $ patch $ map ignoreReduced es yes t = flip YesReduction t <$> asks envSimplification -- traceSLn "reduce.compiled" 95 "CompiledClause.Match.match'" $ do debug $ do case c of -- impossible case Fail -> no (NotBlocked AbsurdMatch) es -- done matching Done xs t -- if the function was partially applied, return a lambda | m < n -> yes $ applySubst (toSubst es) $ foldr lam t (drop m xs) -- otherwise, just apply instantiation to body -- apply the result to any extra arguments | otherwise -> yes $ applySubst (toSubst es0) t `applyE` map ignoreReduced es1 where n = length xs m = length es -- at least the first @n@ elims must be @Apply@s, so we can -- turn them into a subsitution toSubst = parallelS . reverse . map (unArg . argFromElim . ignoreReduced) -- Andreas, 2013-05-21 why introduce sharing only here, -- and not in underapplied case also? (es0, es1) = splitAt n $ map (fmap $ fmap shared) es lam x t = Lam (argInfo x) (Abs (unArg x) t) -- splitting on the @n@th elimination Case n bs -> do case genericSplitAt n es of -- if the @n@th elimination is not supplied, no match (_, []) -> no (NotBlocked Underapplied) es -- if the @n@th elimination is @e0@ (es0, MaybeRed red e0 : es1) -> do -- get the reduced form of @e0@ eb :: Blocked Elim <- do case red of Reduced b -> return $ e0 <$ b NotReduced -> unfoldCorecursionE e0 let e = ignoreBlocking eb -- replace the @n@th argument by its reduced form es' = es0 ++ [MaybeRed red e] ++ es1 -- if a catch-all clause exists, put it on the stack catchAllFrame stack = maybe stack (\c -> (c, es', patch) : stack) (catchAllBranch bs) -- If our argument is @Lit l@, we push @litFrame l@ onto the stack. litFrame l stack = case Map.lookup l (litBranches bs) of Nothing -> stack Just cc -> (cc, es0 ++ es1, patchLit) : stack -- If our argument (or its constructor form) is @Con c vs@ -- we push @conFrame c vs@ onto the stack. conFrame c vs stack = case Map.lookup (conName c) (conBranches bs) of Nothing -> stack Just cc -> ( content cc , es0 ++ map (MaybeRed red . Apply) vs ++ es1 , patchCon c (length vs) ) : stack -- If our argument is @Proj p@, we push @projFrame p@ onto the stack. projFrame p stack = case Map.lookup p (conBranches bs) of Nothing -> stack Just cc -> (content cc, es0 ++ es1, patchLit) : stack -- The new patch function restores the @n@th argument to @v@: -- In case we matched a literal, just put @v@ back. patchLit es = patch (es0 ++ [e] ++ es1) where (es0, es1) = splitAt n es -- In case we matched constructor @c@ with @m@ arguments, -- contract these @m@ arguments @vs@ to @Con c vs@. patchCon c m es = patch (es0 ++ [Con c vs <$ e] ++ es2) where (es0, rest) = splitAt n es (es1, es2) = splitAt m rest vs = map argFromElim es1 -- Now do the matching on the @n@ths argument: case fmap ignoreSharing <$> eb of Blocked x _ -> no (Blocked x) es' NotBlocked _ (Apply (Arg info (MetaV x _))) -> no (Blocked x) es' -- In case of a literal, try also its constructor form NotBlocked _ (Apply (Arg info v@(Lit l))) -> performedSimplification $ do cv <- constructorForm v let cFrame stack = case ignoreSharing cv of Con c vs -> conFrame c vs stack _ -> stack match' $ litFrame l $ cFrame $ catchAllFrame stack -- In case of a constructor, push the conFrame NotBlocked _ (Apply (Arg info (Con c vs))) -> performedSimplification $ match' $ conFrame c vs $ catchAllFrame $ stack -- In case of a projection, push the litFrame NotBlocked _ (Proj p) -> performedSimplification $ match' $ projFrame p $ stack -- Otherwise, we are stuck. If we were stuck before, -- we keep the old reason, otherwise we give reason StuckOn here. NotBlocked blocked e -> no (NotBlocked $ stuckOn e blocked) es' -- If we reach the empty stack, then pattern matching was incomplete match' [] = {- new line here since __IMPOSSIBLE__ does not like the ' in match' -} caseMaybeM (asks envAppDef) __IMPOSSIBLE__ $ \ f -> do traceSLn "impossible" 10 ("Incomplete pattern matching when applying " ++ show f) __IMPOSSIBLE__ Agda-2.4.2.5/src/full/Agda/TypeChecking/CompiledClause/Match.hs-boot0000644000000000000000000000064212635075266023106 0ustar0000000000000000 module Agda.TypeChecking.CompiledClause.Match where -- import Agda.Syntax.Common import Agda.Syntax.Internal import Agda.TypeChecking.Monad.Base import Agda.TypeChecking.Reduce.Monad import Agda.TypeChecking.CompiledClause matchCompiled :: CompiledClauses -> MaybeReducedArgs -> ReduceM (Reduced (Blocked Args) Term) matchCompiledE :: CompiledClauses -> MaybeReducedElims -> ReduceM (Reduced (Blocked [Elim]) Term) Agda-2.4.2.5/src/full/Agda/TypeChecking/CompiledClause/Compile.hs-boot0000644000000000000000000000035112635075266023437 0ustar0000000000000000module Agda.TypeChecking.CompiledClause.Compile where import Agda.Syntax.Internal import Agda.TypeChecking.CompiledClause import Agda.TypeChecking.Monad.Base compileClauses :: Maybe (QName, Type) -> [Clause] -> TCM CompiledClauses Agda-2.4.2.5/src/full/Agda/TypeChecking/Rewriting/0000755000000000000000000000000012635075266017634 5ustar0000000000000000Agda-2.4.2.5/src/full/Agda/TypeChecking/Rewriting/NonLinMatch.hs0000644000000000000000000002263112635075266022346 0ustar0000000000000000{-# LANGUAGE CPP #-} {-# LANGUAGE FlexibleContexts #-} {-# LANGUAGE FlexibleInstances #-} {-# LANGUAGE MultiParamTypeClasses #-} {- | Non-linear matching of the lhs of a rewrite rule against a neutral term. Given a lhs Δ ⊢ lhs : B and a candidate term Γ ⊢ t : A we seek a substitution Γ ⊢ σ : Δ such that Γ ⊢ B[σ] = A and Γ ⊢ lhs[σ] = t : A -} module Agda.TypeChecking.Rewriting.NonLinMatch where import Prelude hiding (null, sequence) import Control.Arrow (first, second) import Control.Monad.Trans.Maybe import Control.Monad.State import Debug.Trace import System.IO.Unsafe import Data.Maybe import Data.Functor import Data.Traversable hiding (for) import Data.IntMap (IntMap) import qualified Data.IntMap as IntMap import Data.IntSet (IntSet) import qualified Data.IntSet as IntSet import Agda.Syntax.Common (unArg) import qualified Agda.Syntax.Common as C import Agda.Syntax.Internal import Agda.TypeChecking.EtaContract import Agda.TypeChecking.Free import Agda.TypeChecking.Monad import Agda.TypeChecking.Pretty import Agda.TypeChecking.Reduce import Agda.TypeChecking.Reduce.Monad import Agda.TypeChecking.Substitute import Agda.Utils.Either import Agda.Utils.Except import Agda.Utils.Functor import Agda.Utils.Maybe import Agda.Utils.Monad import Agda.Utils.Null import Agda.Utils.Singleton #include "undefined.h" import Agda.Utils.Impossible -- | Turn a term into a non-linear pattern, treating the -- free variables as pattern variables. -- The first argument is the number of bound variables. class PatternFrom a b where patternFrom :: Int -> a -> TCM b instance (PatternFrom a b) => PatternFrom [a] [b] where patternFrom k = traverse $ patternFrom k instance (PatternFrom a b) => PatternFrom (Arg a) (Arg b) where patternFrom k = traverse $ patternFrom k instance (PatternFrom a b) => PatternFrom (Elim' a) (Elim' b) where patternFrom k = traverse $ patternFrom k instance (PatternFrom a b) => PatternFrom (Dom a) (Dom b) where patternFrom k = traverse $ patternFrom k instance (PatternFrom a b) => PatternFrom (Type' a) (Type' b) where patternFrom k = traverse $ patternFrom k instance PatternFrom Term NLPat where patternFrom k v = do v <- etaContract =<< reduce v let done = return $ PTerm v case ignoreSharing v of Var i es | i < k -> PBoundVar i <$> patternFrom k es | otherwise -> if null es then return $ PVar (i-k) else done Lam i t -> PLam i <$> patternFrom k t Lit{} -> done Def f es -> PDef f <$> patternFrom k es Con c vs -> PDef (conName c) <$> patternFrom k (Apply <$> vs) Pi a b -> PPi <$> patternFrom k a <*> patternFrom k b Sort{} -> done Level{} -> return PWild -- TODO: unLevel and continue DontCare{} -> return PWild MetaV{} -> __IMPOSSIBLE__ Shared{} -> __IMPOSSIBLE__ ExtLam{} -> __IMPOSSIBLE__ instance (PatternFrom a b) => PatternFrom (Abs a) (Abs b) where patternFrom k (Abs n x) = Abs n <$> patternFrom (k+1) x patternFrom k (NoAbs n x) = NoAbs n <$> patternFrom k x -- | Monad for non-linear matching. type NLM = ExceptT Blocked_ (StateT NLMState ReduceM) type NLMState = (Sub, PostponedEquations) liftRed :: ReduceM a -> NLM a liftRed = lift . lift instance HasOptions NLM where pragmaOptions = liftRed pragmaOptions commandLineOptions = liftRed commandLineOptions runNLM :: NLM () -> ReduceM (Either Blocked_ NLMState) runNLM nlm = do (ok,out) <- runStateT (runExceptT nlm) empty case ok of Left block -> return $ Left block Right _ -> return $ Right out traceSDocNLM :: VerboseKey -> Int -> TCM Doc -> NLM a -> NLM a traceSDocNLM k n doc = applyWhenVerboseS k n $ \ cont -> do ReduceEnv env st <- liftRed askR trace (show $ fst $ unsafePerformIO $ runTCM env st doc) cont matchingBlocked :: Blocked_ -> NLM () matchingBlocked = throwError -- | Add substitution @i |-> v@ to result of matching. tellSub :: Int -> Term -> NLM () tellSub i v = do caseMaybeM (IntMap.lookup i <$> gets fst) (modify $ first $ IntMap.insert i v) $ \v' -> do unlessM (liftRed $ equal v v') $ matchingBlocked $ NotBlocked ReallyNotBlocked () -- lies! tellEq :: Int -> Term -> Term -> NLM () tellEq k u v = traceSDocNLM "rewriting" 60 (sep [ text "adding equality between" <+> prettyTCM u , text " and " <+> prettyTCM v , text ("(with " ++ show k ++ " free variables)") ]) $ do modify $ second $ (PostponedEquation k u v:) type Sub = IntMap Term -- | Matching against a term produces a constraint -- which we have to verify after applying -- the substitution computed by matching. data PostponedEquation = PostponedEquation { eqFreeVars :: Int -- ^ Number of free variables in the equation , eqLhs :: Term -- ^ Term from pattern, living in pattern context. , eqRhs :: Term -- ^ Term from scrutinee, living in context where matching was invoked. } type PostponedEquations = [PostponedEquation] -- | Match a non-linear pattern against a neutral term, -- returning a substitution. class Match a b where match :: Int -> a -> b -> NLM () instance Match a b => Match [a] [b] where match k ps vs | length ps == length vs = zipWithM_ (match k) ps vs | otherwise = matchingBlocked $ NotBlocked ReallyNotBlocked () instance Match a b => Match (Arg a) (Arg b) where match k p v = match k (unArg p) (unArg v) instance Match a b => Match (Elim' a) (Elim' b) where match k p v = case (p, v) of (Apply p, Apply v) -> match k p v (Proj x , Proj y ) -> if x == y then return () else traceSDocNLM "rewriting" 100 (sep [ text "mismatch between projections " <+> prettyTCM x , text " and " <+> prettyTCM y ]) mzero (Apply{}, Proj{} ) -> __IMPOSSIBLE__ (Proj{} , Apply{}) -> __IMPOSSIBLE__ instance Match a b => Match (Dom a) (Dom b) where match k p v = match k (C.unDom p) (C.unDom v) instance Match a b => Match (Type' a) (Type' b) where match k p v = match k (unEl p) (unEl v) instance (Match a b, Subst b, Free b, PrettyTCM a, PrettyTCM b) => Match (Abs a) (Abs b) where match k (Abs _ p) (Abs _ v) = match (k+1) p v match k (Abs _ p) (NoAbs _ v) = match (k+1) p (raise 1 v) match k (NoAbs _ p) (Abs _ v) = if (0 `freeIn` v) then no else match k p (raise (-1) v) where no = traceSDocNLM "rewriting" 100 (sep [ text "mismatch between" <+> prettyTCM p , text " and " <+> prettyTCM v ]) mzero match k (NoAbs _ p) (NoAbs _ v) = match k p v instance Match NLPat Term where match k p v = do let yes = return () no = traceSDocNLM "rewriting" 100 (sep [ text "mismatch between" <+> prettyTCM p , text " and " <+> prettyTCM v]) mzero case p of PWild -> yes PVar i -> if null (allFreeVars v `IntSet.intersection` IntSet.fromList [0..(k-1)]) then tellSub i (raise (-k) v) else no PDef f ps -> do v <- liftRed $ constructorForm v case ignoreSharing v of Def f' es | f == f' -> matchArgs k ps es | otherwise -> no Con c vs | f == conName c -> matchArgs k ps (Apply <$> vs) | otherwise -> no MetaV m es -> do matchingBlocked $ Blocked m () _ -> no PLam i p' -> do let body = Abs (absName p') $ raise 1 v `apply` [C.Arg i (var 0)] body <- liftRed (etaContract =<< reduce' body) match k p' body PPi pa pb -> case ignoreSharing v of Pi a b -> match k pa a >> match k pb b _ -> no PBoundVar i ps -> case ignoreSharing v of Var i' es | i == i' -> matchArgs k ps es _ -> no PTerm u -> tellEq k u v where matchArgs :: Int -> [Elim' NLPat] -> Elims -> NLM () matchArgs k ps es = match k ps =<< liftRed (etaContract =<< reduce' es) makeSubstitution :: Sub -> Substitution makeSubstitution sub | IntMap.null sub = idS | otherwise = map val [0 .. highestIndex] ++# raiseS (highestIndex + 1) where highestIndex = fst $ IntMap.findMax sub -- find highest key val i = fromMaybe (var i) $ IntMap.lookup i sub checkPostponedEquations :: Substitution -> PostponedEquations -> ReduceM Bool checkPostponedEquations sub eqs = andM $ for eqs $ \ (PostponedEquation k lhs rhs) -> equal (applySubst (liftS k sub) lhs) rhs -- main function nonLinMatch :: (Match a b) => a -> b -> ReduceM (Either Blocked_ Substitution) nonLinMatch p v = do let no msg b = traceSDoc "rewriting" 100 (sep [ text "matching failed during" <+> text msg , text "blocking: " <+> text (show b) ]) $ return (Left b) caseEitherM (runNLM $ match 0 p v) (no "matching") $ \ (s, eqs) -> do let sub = makeSubstitution s traceSDoc "rewriting" 90 (text $ "sub = " ++ show sub) $ do ifM (checkPostponedEquations sub eqs) (return $ Right sub) (no "checking of postponed equations" $ NotBlocked ReallyNotBlocked ()) -- more lies -- | Untyped βη-equality, does not handle things like empty record types. equal :: Term -> Term -> ReduceM Bool equal u v = do (u, v) <- etaContract =<< normalise' (u, v) let ok = u == v if ok then return True else traceSDoc "rewriting" 100 (sep [ text "mismatch between " <+> prettyTCM u , text " and " <+> prettyTCM v ]) $ return False Agda-2.4.2.5/src/full/Agda/TypeChecking/Test/0000755000000000000000000000000012635075266016601 5ustar0000000000000000Agda-2.4.2.5/src/full/Agda/TypeChecking/Test/Generators.hs0000644000000000000000000004453512635075266021261 0ustar0000000000000000{-# LANGUAGE CPP #-} {-# LANGUAGE FlexibleContexts #-} {-# LANGUAGE FlexibleInstances #-} {-# LANGUAGE FunctionalDependencies #-} {-# LANGUAGE MultiParamTypeClasses #-} {-# LANGUAGE UndecidableInstances #-} module Agda.TypeChecking.Test.Generators where import Control.Applicative import Control.Monad.State import qualified Data.List as List (sort, nub) import Agda.Syntax.Position import Agda.Syntax.Common as Common import Agda.Syntax.Literal import Agda.Syntax.Fixity import Agda.Syntax.Internal as I import qualified Agda.Syntax.Concrete.Name as C import Agda.TypeChecking.Free import Agda.TypeChecking.Substitute import Agda.Utils.QuickCheck hiding (Args) import Agda.Utils.TestHelpers import qualified Agda.Utils.VarSet as Set #include "undefined.h" import Agda.Utils.Impossible data TermConfiguration = TermConf { tcDefinedNames :: [QName] , tcConstructorNames :: [QName] , tcProjectionNames :: [QName] , tcFreeVariables :: [Nat] , tcLiterals :: UseLiterals , tcFrequencies :: Frequencies , tcFixSize :: Maybe Int -- ^ Maximum size of the generated element. When @Nothing@ this value -- is initialized from the 'Test.QuickCheck.size' parameter. , tcIsType :: Bool -- ^ When this is true no lambdas, literals, or constructors are -- generated } deriving Show data Frequencies = Freqs { hiddenFreqs :: HiddenFreqs , elimFreqs :: ElimFreqs , sortFreqs :: SortFreqs , termFreqs :: TermFreqs } deriving Show data TermFreqs = TermFreqs { varFreq :: Int , defFreq :: Int , conFreq :: Int , litFreq :: Int , sortFreq :: Int , lamFreq :: Int , piFreq :: Int , funFreq :: Int } deriving Show data ElimFreqs = ElimFreqs { applyFreq :: Int , projFreq :: Int } deriving Show data HiddenFreqs = HiddenFreqs { hiddenFreq :: Int , notHiddenFreq :: Int } deriving Show data SortFreqs = SortFreqs { setFreqs :: [Int] , propFreq :: Int } deriving Show defaultFrequencies :: Frequencies defaultFrequencies = Freqs { termFreqs = TermFreqs { varFreq = 24, defFreq = 8, conFreq = 8, litFreq = 1, sortFreq = 2, lamFreq = 10, piFreq = 5, funFreq = 5 } , elimFreqs = ElimFreqs { applyFreq = 9, projFreq = 1 } , hiddenFreqs = HiddenFreqs { hiddenFreq = 1, notHiddenFreq = 5 } , sortFreqs = SortFreqs { setFreqs = [3, 1], propFreq = 1 } } noProp :: TermConfiguration -> TermConfiguration noProp conf = conf { tcFrequencies = fq { sortFreqs = sfq { propFreq = 0 } } } where fq = tcFrequencies conf sfq = sortFreqs fq data UseLiterals = UseLit { useLitInt :: Bool , useLitFloat :: Bool , useLitString :: Bool , useLitChar :: Bool } deriving Show noLiterals :: UseLiterals noLiterals = UseLit False False False False fixSizeConf :: Int -> TermConfiguration -> TermConfiguration fixSizeConf n conf = conf { tcFixSize = Just n } resizeConf :: (Int -> Int) -> TermConfiguration -> TermConfiguration resizeConf f conf = conf { tcFixSize = fmap f $ tcFixSize conf} decrConf :: TermConfiguration -> TermConfiguration decrConf = resizeConf (flip (-) 1) divConf :: TermConfiguration -> Int -> TermConfiguration divConf conf k = resizeConf (`div` k) conf isTypeConf :: TermConfiguration -> TermConfiguration isTypeConf conf = conf { tcIsType = True } isntTypeConf :: TermConfiguration -> TermConfiguration isntTypeConf conf = conf { tcIsType = False } extendConf :: TermConfiguration -> TermConfiguration extendConf conf = conf { tcFreeVariables = 0 : map (1+) (tcFreeVariables conf) } extendWithTelConf :: Telescope -> TermConfiguration -> TermConfiguration extendWithTelConf tel conf = foldr (const extendConf) conf (telToList tel) makeConfiguration :: [RawName] -> [RawName] -> [RawName] -> [Nat] -> TermConfiguration makeConfiguration ds cs ps vs = TermConf { tcDefinedNames = defs , tcConstructorNames = cons , tcProjectionNames = projs , tcFreeVariables = List.sort $ List.nub vs , tcFrequencies = defaultFrequencies , tcLiterals = noLiterals , tcFixSize = Nothing , tcIsType = False } where (defs, cons, projs) = flip evalState 0 $ do (,,) <$> mapM mkName ds <*> mapM mkName cs <*> mapM mkName ps tick = do x <- get; put (x + 1); return x mkName s = do n <- tick return $ QName { qnameModule = MName [] , qnameName = Name { nameId = NameId n 1 , nameConcrete = C.Name noRange [C.Id s] , nameBindingSite = noRange , nameFixity = defaultFixity' } } class GenC a where genC :: TermConfiguration -> Gen a newtype YesType a = YesType { unYesType :: a } newtype NoType a = NoType { unNoType :: a } newtype VarName = VarName { unVarName :: Nat } newtype DefName = DefName { unDefName :: QName } newtype ConName = ConName { unConName :: ConHead } newtype ProjName = ProjName { unProjName :: QName } newtype SizedList a = SizedList { unSizedList :: [a] } fixSize :: TermConfiguration -> Gen a -> Gen a fixSize conf g = sized $ \n -> resize (maybe n id $ tcFixSize conf) g instance GenC a => GenC (SizedList a) where genC conf = do n <- fixSize conf natural SizedList <$> vectorOf n (genC $ divConf conf n) instance GenC a => GenC [a] where genC conf = do n <- natural vectorOf n $ genC $ divConf conf n instance (GenC a, GenC b) => GenC (a, b) where genC conf = (,) <$> genC conf2 <*> genC conf2 where conf2 = divConf conf 2 instance GenC Range where genC _ = return noRange instance GenC Hiding where genC conf = frequency [ (hideF, return Hidden), (nohideF, return NotHidden) ] where HiddenFreqs {hiddenFreq = hideF, notHiddenFreq = nohideF } = hiddenFreqs $ tcFrequencies conf instance (GenC c, GenC a) => GenC (Common.Arg c a) where genC conf = (\ (h, a) -> Arg (setHiding h defaultArgInfo) a) <$> genC conf instance (GenC c, GenC a) => GenC (Common.Dom c a) where genC conf = (\ (h, a) -> Dom (setHiding h defaultArgInfo) a) <$> genC conf instance GenC a => GenC (Abs a) where genC conf = Abs x <$> genC (extendConf conf) where x = stringToArgName "x" instance GenC a => GenC (Elim' a) where genC conf = frequency [ (applyF, Apply <$> genC conf) , (projF, Proj . unProjName <$> genC conf) ] where ElimFreqs {applyFreq = applyF, projFreq = projF } = elimFreqs $ tcFrequencies conf instance GenC DefName where genC conf = DefName <$> do elements $ tcDefinedNames conf instance GenC ProjName where genC conf = ProjName <$> do elements $ tcProjectionNames conf genArgs :: TermConfiguration -> Gen Args genArgs conf = unSizedList <$> genC (isntTypeConf conf) genElims :: TermConfiguration -> Gen Elims genElims conf = unSizedList <$> genC (isntTypeConf conf) instance GenC Sort where genC conf = frequency $ (propF, return Prop) : zip setFs (map (return . mkType) [0..]) where freq f = f $ tcFrequencies conf setFs = freq (setFreqs . sortFreqs) propF = freq (propFreq . sortFreqs) instance GenC Char where genC _ = elements [' '..'~'] -- TODO instance GenC Double where genC _ = arbitrary instance GenC Integer where genC _ = arbitrary instance GenC Literal where genC conf = oneof (concat $ zipWith gen useLits [ uncurry LitInt <$> genC conf , uncurry LitFloat <$> genC conf , uncurry LitString <$> genC conf , uncurry LitChar <$> genC conf ] ) where useLits = map ($ tcLiterals conf) [ useLitInt, useLitFloat, useLitString, useLitChar ] gen True g = [g] gen False g = [] instance GenC Telescope where genC conf = do n <- fixSize conf natural let confs = take n $ iterate extendConf (divConf conf n) telFromList <$> mapM genC confs instance GenC Type where genC conf = El <$> genC conf <*> genC (isTypeConf conf) instance GenC Term where genC conf = case tcFixSize conf of Nothing -> sized $ \n -> genC $ fixSizeConf n conf Just n | n <= 0 -> genLeaf | otherwise -> frequency [ (varF, genVar $ genElims conf) , (defF, genDef $ genElims conf) , (conF, genCon $ genArgs conf) , (litF, Lit <$> genC conf) , (sortF, Sort <$> genC conf) , (lamF, genLam) , (piF, genPi) ] where defs = tcDefinedNames conf cons = tcConstructorNames conf vars = tcFreeVariables conf freq f = f $ tcFrequencies conf isType = tcIsType conf useLits = map ($ tcLiterals conf) [ useLitInt, useLitFloat, useLitString, useLitChar ] varF | null vars = 0 | otherwise = freq (varFreq . termFreqs) defF | null defs = 0 | otherwise = freq (defFreq . termFreqs) conF | null cons || isType = 0 | otherwise = freq (conFreq . termFreqs) litF | or useLits && not isType = freq (litFreq . termFreqs) | otherwise = 0 lamF | isType = 0 | otherwise = freq (lamFreq . termFreqs) sortF = freq (sortFreq . termFreqs) piF = freq (piFreq . termFreqs) genLam :: Gen Term genLam = Lam <$> (flip setHiding defaultArgInfo <$> genC conf) <*> genC (isntTypeConf $ decrConf conf) genPi :: Gen Term genPi = uncurry Pi <$> genC conf genVar, genDef :: Gen Elims -> Gen Term genVar args = Var <$> elements vars <*> args genDef args = Def <$> elements defs <*> args genCon :: Gen Args -> Gen Term genCon args = Con <$> ((\ c -> ConHead c Inductive []) <$> elements cons) <*> args genLeaf :: Gen Term genLeaf = frequency [ (varF, genVar $ return []) , (defF, genDef $ return []) , (conF, genCon $ return []) , (litF, Lit <$> genC conf) , (sortF, Sort <$> genC conf) ] -- | Only generates default configurations. Names and free variables varies. genConf :: Gen TermConfiguration genConf = do ds <- listOf $ elements defs cs <- listOf $ elements cons ps <- listOf1 $ elements projs vs <- listOf natural return $ makeConfiguration ds cs ps vs where defs = [ stringToRawName [c] | c <- ['a'..'n'] ++ ['r'..'z'] ] cons = [ stringToRawName [c] | c <- ['A'..'Z'] ] projs= [ stringToRawName [c] | c <- ['o'..'q'] ] instance Arbitrary TermConfiguration where arbitrary = genConf -- Shrinking -------------------------------------------------------------- class ShrinkC a b | a -> b where shrinkC :: TermConfiguration -> a -> [b] noShrink :: a -> b instance ShrinkC a b => ShrinkC (YesType a) b where shrinkC conf (YesType x) = shrinkC (isTypeConf conf) x noShrink (YesType x) = noShrink x instance ShrinkC a b => ShrinkC (NoType a) b where shrinkC conf (NoType x) = shrinkC (isntTypeConf conf) x noShrink (NoType x) = noShrink x instance ShrinkC a b => ShrinkC [a] [b] where noShrink = map noShrink shrinkC conf xs = noShrink (removeChunks xs) ++ shrinkOne xs where -- Code stolen from Test.QuickCheck.Arbitrary removeChunks xs = rem (length xs) xs where rem 0 _ = [] rem 1 _ = [[]] rem n xs = xs1 : xs2 : ( [ xs1' ++ xs2 | xs1' <- rem n1 xs1, not (null xs1') ] `ilv` [ xs1 ++ xs2' | xs2' <- rem n2 xs2, not (null xs2') ] ) where n1 = n `div` 2 xs1 = take n1 xs n2 = n - n1 xs2 = drop n1 xs [] `ilv` ys = ys xs `ilv` [] = xs (x:xs) `ilv` (y:ys) = x : y : (xs `ilv` ys) shrinkOne [] = [] shrinkOne (x:xs) = [ x' : noShrink xs | x' <- shrinkC conf x ] ++ [ noShrink x : xs' | xs' <- shrinkOne xs ] instance (ShrinkC a a', ShrinkC b b') => ShrinkC (a, b) (a', b') where noShrink (x, y) = (noShrink x, noShrink y) shrinkC conf (x, y) = [ (x', noShrink y) | x' <- shrinkC conf x ] ++ [ (noShrink x, y') | y' <- shrinkC conf y ] instance ShrinkC VarName Nat where shrinkC conf (VarName x) = [ y | y <- tcFreeVariables conf, y < x ] noShrink = unVarName instance ShrinkC DefName QName where shrinkC conf (DefName c) = takeWhile (/= c) $ tcDefinedNames conf noShrink = unDefName instance ShrinkC ConName ConHead where shrinkC conf (ConName (ConHead{conName = c})) = map (\ c -> ConHead c Inductive []) $ takeWhile (/= c) $ tcConstructorNames conf noShrink = unConName instance ShrinkC Literal Literal where shrinkC _ (LitInt _ 0) = [] shrinkC conf l = LitInt noRange 0 : case l of LitInt r n -> LitInt r <$> shrink n LitString r s -> LitString r <$> shrinkC conf s LitChar r c -> LitChar r <$> shrinkC conf c LitFloat r x -> LitFloat r <$> shrink x LitQName r x -> [] noShrink = id instance ShrinkC Char Char where shrinkC _ 'a' = [] shrinkC _ _ = ['a'] noShrink = id instance ShrinkC Hiding Hiding where shrinkC _ Hidden = [NotHidden] shrinkC _ Instance = [Instance] shrinkC _ NotHidden = [] noShrink = id instance ShrinkC a b => ShrinkC (Abs a) (Abs b) where shrinkC conf (NoAbs s x) = NoAbs s <$> shrinkC conf x shrinkC conf (Abs s x) = Abs s <$> shrinkC (extendConf conf) x noShrink = fmap noShrink instance ShrinkC a b => ShrinkC (I.Arg a) (I.Arg b) where shrinkC conf (Arg info x) = (\ (h,x) -> Arg (setHiding h info) x) <$> shrinkC conf (argInfoHiding info, x) noShrink = fmap noShrink instance ShrinkC a b => ShrinkC (I.Dom a) (I.Dom b) where shrinkC conf (Dom info x) = (\ (h,x) -> Dom (setHiding h info) x) <$> shrinkC conf (argInfoHiding info, x) noShrink = fmap noShrink instance ShrinkC a b => ShrinkC (Blocked a) (Blocked b) where shrinkC conf (Blocked m x) = Blocked m <$> shrinkC conf x shrinkC conf (NotBlocked r x) = NotBlocked r <$> shrinkC conf x noShrink = fmap noShrink instance ShrinkC a b => ShrinkC (Elim' a) (Elim' b) where shrinkC conf (Apply a) = Apply <$> shrinkC conf a shrinkC conf (Proj p) = [] noShrink = fmap noShrink -- Andreas 2010-09-21: simplify? since Sort Prop is no longer abused as DontCare instance ShrinkC Sort Sort where shrinkC conf Prop = [] shrinkC conf s = Prop : case s of Type n -> [] -- No Level instance yet -- Type <$> shrinkC conf n Prop -> __IMPOSSIBLE__ Inf -> [] SizeUniv -> [] DLub s1 s2 -> __IMPOSSIBLE__ noShrink = id instance ShrinkC Telescope Telescope where shrinkC conf EmptyTel = [] shrinkC conf (ExtendTel a tel) = killAbs tel : (uncurry ExtendTel <$> shrinkC conf (a, tel)) noShrink = id instance ShrinkC Type Type where shrinkC conf (El s t) = uncurry El <$> shrinkC conf (s, YesType t) noShrink = id instance ShrinkC Term Term where shrinkC conf (DontCare _) = [] shrinkC conf (Sort Prop) = [] shrinkC conf t = filter validType $ case ignoreSharing t of Var i es -> map unArg (argsFromElims es) ++ (uncurry Var <$> shrinkC conf (VarName i, NoType es)) Def d es -> map unArg (argsFromElims es) ++ (uncurry Def <$> shrinkC conf (DefName d, NoType es)) Con c args -> map unArg args ++ (uncurry Con <$> shrinkC conf (ConName c, NoType args)) Lit l -> Lit <$> shrinkC conf l Level l -> [] -- TODO Lam info b -> killAbs b : ((\(h,x) -> Lam (setHiding h defaultArgInfo) x) <$> shrinkC conf (argInfoHiding info, b)) Pi a b -> unEl (unDom a) : unEl (killAbs b) : (uncurry Pi <$> shrinkC conf (a, b)) Sort s -> Sort <$> shrinkC conf s MetaV m es -> map unArg (argsFromElims es) ++ (MetaV m <$> shrinkC conf (NoType es)) DontCare _ -> [] Shared{} -> __IMPOSSIBLE__ ExtLam _ _ -> __IMPOSSIBLE__ where validType t | not (tcIsType conf) = True | otherwise = case t of Con _ _ -> False Lam _ _ -> False Lit _ -> False _ -> True noShrink = id killAbs :: KillVar a => Abs a -> a killAbs (Abs _ x) = killVar 0 x killAbs (NoAbs _ x) = x class KillVar a where killVar :: Nat -> a -> a instance KillVar Term where killVar i t = case ignoreSharing t of Var j args | j == i -> DontCare (Var j []) | j > i -> Var (j - 1) $ killVar i args | otherwise -> Var j $ killVar i args Def c args -> Def c $ killVar i args Con c args -> Con c $ killVar i args Lit l -> Lit l Level l -> Level l -- TODO Sort s -> Sort s Lam h b -> Lam h $ killVar i b Pi a b -> uncurry Pi $ killVar i (a, b) MetaV m args -> MetaV m $ killVar i args DontCare mv -> DontCare $ killVar i mv Shared{} -> __IMPOSSIBLE__ ExtLam _ _ -> __IMPOSSIBLE__ instance KillVar Type where killVar i (El s t) = El s $ killVar i t instance KillVar Telescope where killVar i EmptyTel = EmptyTel killVar i (ExtendTel a tel) = uncurry ExtendTel $ killVar i (a, tel) instance KillVar a => KillVar (Elim' a) where killVar i = fmap (killVar i) instance KillVar a => KillVar (I.Arg a) where killVar i = fmap (killVar i) instance KillVar a => KillVar (I.Dom a) where killVar i = fmap (killVar i) instance KillVar a => KillVar (Abs a) where killVar i = fmap (killVar (i + 1)) instance KillVar a => KillVar [a] where killVar i = map (killVar i) instance KillVar a => KillVar (Maybe a) where killVar i = fmap (killVar i) instance (KillVar a, KillVar b) => KillVar (a, b) where killVar i (x, y) = (killVar i x, killVar i y) -- Tests ------------------------------------------------------------------ isWellScoped :: FreeVS a => TermConfiguration -> a -> Bool isWellScoped conf t = allFreeVars t `Set.isSubsetOf` Set.fromList (tcFreeVariables conf) -- | Check that the generated terms don't have any out of scope variables. prop_wellScopedVars :: TermConfiguration -> Property prop_wellScopedVars conf = forAllShrink (genC conf) (shrinkC conf) $ \t -> isWellScoped conf (t :: Term) Agda-2.4.2.5/src/full/Agda/TypeChecking/Rules/0000755000000000000000000000000012635075266016754 5ustar0000000000000000Agda-2.4.2.5/src/full/Agda/TypeChecking/Rules/Data.hs0000644000000000000000000004342212635075266020166 0ustar0000000000000000{-# LANGUAGE CPP #-} #if __GLASGOW_HASKELL__ >= 710 {-# LANGUAGE FlexibleContexts #-} #endif module Agda.TypeChecking.Rules.Data where import Control.Applicative import Control.Monad import Data.List (genericTake) import Data.Maybe (fromMaybe) import qualified Data.Set as Set import qualified Agda.Syntax.Abstract as A import Agda.Syntax.Internal import Agda.Syntax.Common import Agda.Syntax.Position import qualified Agda.Syntax.Info as Info import Agda.TypeChecking.Monad import Agda.TypeChecking.Monad.Builtin (primLevel) import Agda.TypeChecking.Conversion import Agda.TypeChecking.Substitute import Agda.TypeChecking.MetaVars import Agda.TypeChecking.Reduce import Agda.TypeChecking.Pretty import Agda.TypeChecking.Free import Agda.TypeChecking.Forcing import Agda.TypeChecking.Irrelevance import Agda.TypeChecking.Telescope import {-# SOURCE #-} Agda.TypeChecking.Rules.Term ( isType_ ) import Agda.Utils.List import Agda.Utils.Monad import Agda.Utils.Permutation import Agda.Utils.Size import Agda.Utils.Tuple import qualified Agda.Utils.VarSet as VarSet #include "undefined.h" import Agda.Utils.Impossible --------------------------------------------------------------------------- -- * Datatypes --------------------------------------------------------------------------- -- | Type check a datatype definition. Assumes that the type has already been -- checked. checkDataDef :: Info.DefInfo -> QName -> [A.LamBinding] -> [A.Constructor] -> TCM () checkDataDef i name ps cs = traceCall (CheckDataDef (getRange name) (qnameName name) ps cs) $ do -- TODO!! (qnameName) let countPars A.DomainFree{} = 1 countPars (A.DomainFull (A.TypedBindings _ (Arg _ b))) = case b of A.TLet{} -> 0 A.TBind _ xs _ -> size xs npars = sum $ map countPars ps -- Add the datatype module addSection (qnameToMName name) -- Look up the type of the datatype. t <- instantiateFull =<< typeOfConst name -- Make sure the shape of the type is visible let unTelV (TelV tel a) = telePi tel a t <- unTelV <$> telView t -- Top level free vars freeVars <- getContextArgs -- The parameters are in scope when checking the constructors. dataDef <- bindParameters ps t $ \tel t0 -> do -- Parameters are always hidden in constructors let tel' = hideAndRelParams <$> tel -- let tel' = hideTel tel -- The type we get from bindParameters is Θ -> s where Θ is the type of -- the indices. We count the number of indices and return s. -- We check that s is a sort. (nofIxs, s) <- splitType t0 when (any (`freeIn` s) [0..nofIxs - 1]) $ do err <- fsep [ text "The sort of" <+> prettyTCM name , text "cannot depend on its indices in the type" , prettyTCM t0 ] typeError $ GenericError $ show err s <- return $ raise (-nofIxs) s -- the small parameters are taken into consideration for --without-K smallPars <- smallParams tel s reportSDoc "tc.data.sort" 20 $ vcat [ text "checking datatype" <+> prettyTCM name , nest 2 $ vcat [ text "type (parameters instantiated): " <+> prettyTCM t0 , text "type (full): " <+> prettyTCM t , text "sort: " <+> prettyTCM s , text "indices:" <+> text (show nofIxs) , text "params:" <+> text (show ps) , text "small params:" <+> text (show smallPars) ] ] -- Change the datatype from an axiom to a datatype with no constructors. let dataDef = Datatype { dataPars = npars , dataSmallPars = Perm npars smallPars , dataNonLinPars = Drop 0 $ Perm npars [] , dataIxs = nofIxs , dataInduction = Inductive , dataClause = Nothing , dataCons = [] -- Constructors are added later , dataSort = s , dataAbstr = Info.defAbstract i , dataMutual = [] } escapeContext (size tel) $ do addConstant name $ defaultDefn defaultArgInfo name t dataDef -- polarity and argOcc.s determined by the positivity checker -- Check the types of the constructors -- collect the non-linear parameters of each constructor nonLins <- mapM (checkConstructor name tel' nofIxs s) cs -- compute the ascending list of non-linear parameters of the data type let nonLinPars0 = Set.toAscList $ Set.unions $ map Set.fromList nonLins -- The constructors are analyzed in the absolute context, -- but the data definition happens in the relative module context, -- so we apply to the free module variables. -- Unfortunately, we lose precision here, since 'abstract', which -- is then performed by addConstant, cannot restore the linearity info. nonLinPars = Drop (size freeVars) $ Perm (npars + size freeVars) nonLinPars0 -- Return the data definition return dataDef{ dataNonLinPars = nonLinPars } let s = dataSort dataDef cons = map A.axiomName cs -- get constructor names -- If proof irrelevance is enabled we have to check that datatypes in -- Prop contain at most one element. do proofIrr <- proofIrrelevance case (proofIrr, s, cs) of (True, Prop, _:_:_) -> setCurrentRange cons $ typeError PropMustBeSingleton _ -> return () -- Add the datatype to the signature with its constructors. -- It was previously added without them. addConstant name $ defaultDefn defaultArgInfo name t $ dataDef{ dataCons = cons } -- Andreas 2012-02-13: postpone polarity computation until after positivity check -- computePolarity name where -- Take a type of form @tel -> a@ and return -- @size tel@ (number of data type indices) and -- @a@ as a sort (either @a@ directly if it is a sort, -- or a fresh sort meta set equal to a. splitType :: Type -> TCM (Int, Sort) splitType t = case ignoreSharing $ unEl t of Pi a b -> mapFst (+ 1) <$> do addContext (absName b, a) $ splitType (absBody b) Sort s -> return (0, s) _ -> do s <- newSortMeta equalType t (sort s) return (0, s) -- | A parameter is small if its sort fits into the data sort. -- @smallParams@ overapproximates the small parameters (in doubt: small). smallParams :: Telescope -> Sort -> TCM [Int] smallParams tel s = do -- get the types of the parameters let as = map (snd . unDom) $ telToList tel -- get the big parameters concat <$> do forM (zip [0..] as) $ \ (i, a) -> do -- A type is small if it is not Level or its sort is <= the data sort. -- In doubt (unsolvable constraints), a type is small. -- So, only if we have a solid error, the type is big. localTCState $ do ([] <$ do equalTerm topSort (unEl a) =<< primLevel) -- NB: if primLevel fails, the next alternative is picked <|> ([i] <$ (getSort a `leqSort` s)) <|> return [] where (<|>) m1 m2 = m1 `catchError_` (const m2) -- | Type check a constructor declaration. Checks that the constructor targets -- the datatype and that it fits inside the declared sort. -- Returns the non-linear parameters. checkConstructor :: QName -- ^ Name of data type. -> Telescope -- ^ Parameter telescope. -> Nat -- ^ Number of indices of the data type. -> Sort -- ^ Sort of the data type. -> A.Constructor -- ^ Constructor declaration (type signature). -> TCM [Int] -- ^ Non-linear parameters. checkConstructor d tel nofIxs s (A.ScopedDecl scope [con]) = do setScope scope checkConstructor d tel nofIxs s con checkConstructor d tel nofIxs s con@(A.Axiom _ i _ c e) = traceCall (CheckConstructor d tel s con) $ do {- WRONG -- Andreas, 2011-04-26: the following happens to the right of ':' -- we may use irrelevant arguments in a non-strict way in types t' <- workOnTypes $ do -} -- check that the type of the constructor is well-formed debugEnter c e t <- isType_ e -- check that the type of the constructor ends in the data type n <- getContextSize -- OLD: n <- size <$> getContextTelescope debugEndsIn t d n nonLinPars <- constructs n t d debugNonLinPars nonLinPars -- check that the sort (universe level) of the constructor type -- is contained in the sort of the data type -- (to avoid impredicative existential types) debugFitsIn s t `fitsIn` s -- check which constructor arguments are determined by the type ('forcing') t' <- addForcingAnnotations t debugAdd c t' -- add parameters to constructor type and put into signature let con = ConHead c Inductive [] -- data constructors have no projectable fields and are always inductive escapeContext (size tel) $ addConstant c $ defaultDefn defaultArgInfo c (telePi tel t') $ Constructor (size tel) con d (Info.defAbstract i) Inductive -- declare the constructor as eligible for instance search addNamedInstance c d return nonLinPars where debugEnter c e = reportSDoc "tc.data.con" 5 $ vcat [ text "checking constructor" <+> prettyTCM c <+> text ":" <+> prettyTCM e ] debugEndsIn t d n = reportSDoc "tc.data.con" 15 $ vcat [ sep [ text "checking that" , nest 2 $ prettyTCM t , text "ends in" <+> prettyTCM d ] , nest 2 $ text "nofPars =" <+> text (show n) ] debugNonLinPars xs = reportSDoc "tc.data.con" 15 $ text $ "these constructor parameters are non-linear: " ++ show xs debugFitsIn s = reportSDoc "tc.data.con" 15 $ sep [ text "checking that the type fits in" , nest 2 $ prettyTCM s ] debugAdd c t = reportSDoc "tc.data.con" 5 $ vcat [ text "adding constructor" <+> prettyTCM c <+> text ":" <+> prettyTCM t ] checkConstructor _ _ _ _ _ = __IMPOSSIBLE__ -- constructors are axioms -- | Bind the parameters of a datatype. bindParameters :: [A.LamBinding] -> Type -> (Telescope -> Type -> TCM a) -> TCM a bindParameters [] a ret = ret EmptyTel a bindParameters (A.DomainFull (A.TypedBindings _ (Arg info (A.TBind _ xs _))) : bs) a ret = bindParameters (map (mergeHiding . fmap (A.DomainFree info)) xs ++ bs) a ret bindParameters (A.DomainFull (A.TypedBindings _ (Arg info (A.TLet _ lbs))) : bs) a ret = __IMPOSSIBLE__ bindParameters ps0@(A.DomainFree info x : ps) (El _ (Pi arg@(Dom info' a) b)) ret -- Andreas, 2011-04-07 ignore relevance information in binding?! | argInfoHiding info /= argInfoHiding info' = __IMPOSSIBLE__ | otherwise = addContext (x, arg) $ bindParameters ps (absBody b) $ \tel s -> ret (ExtendTel arg $ Abs (nameToArgName x) tel) s bindParameters bs (El s (Shared p)) ret = bindParameters bs (El s $ derefPtr p) ret bindParameters (b : bs) t _ = __IMPOSSIBLE__ {- Andreas, 2012-01-17 Concrete.Definitions ensures number and hiding of parameters to be correct -- Andreas, 2012-01-13 due to separation of data declaration/definition, the user -- could give more parameters than declared. bindParameters (b : bs) t _ = typeError $ DataTooManyParameters -} -- | Check that the arguments to a constructor fits inside the sort of the datatype. -- The first argument is the type of the constructor. fitsIn :: Type -> Sort -> TCM () fitsIn t s = do reportSDoc "tc.data.fits" 10 $ sep [ text "does" <+> prettyTCM t , text "of sort" <+> prettyTCM (getSort t) , text "fit in" <+> prettyTCM s <+> text "?" ] -- The code below would be simpler, but doesn't allow datatypes -- to be indexed by the universe level. -- s' <- instantiateFull (getSort t) -- noConstraints $ s' `leqSort` s t <- reduce t case ignoreSharing $ unEl t of Pi dom b -> do sa <- reduce $ getSort dom unless (sa == SizeUniv) $ sa `leqSort` s addContext (absName b, dom) $ fitsIn (absBody b) (raise 1 s) _ -> return () -- getSort t `leqSort` s -- Andreas, 2013-04-13 not necessary since constructor type ends in data type -- | Return the parameters that share variables with the indices -- nonLinearParameters :: Int -> Type -> TCM [Int] -- nonLinearParameters nPars t = -- | Check that a type constructs something of the given datatype. The first -- argument is the number of parameters to the datatype. -- -- As a side effect, return the parameters that occur free in indices. -- E.g. in @data Eq (A : Set)(a : A) : A -> Set where refl : Eq A a a@ -- this would include parameter @a@, but not @A@. -- -- TODO: what if there's a meta here? constructs :: Int -> Type -> QName -> TCM [Int] constructs nofPars t q = constrT 0 t where {- OLD constrT :: Nat -> Type -> TCM () constrT n (El s v) = constr n s v constr :: Nat -> Sort -> Term -> TCM () constr n s v = do v <- reduce v case ignoreSharing v of Pi _ (NoAbs _ b) -> constrT n b Pi a b -> underAbstraction a b $ constrT (n + 1) Def d vs | d == q -> checkParams n =<< reduce (take nofPars vs) -- we only check the parameters _ -> bad $ El s v bad t = typeError $ ShouldEndInApplicationOfTheDatatype t -} constrT :: Nat -> Type -> TCM [Int] constrT n t = do t <- reduce t case ignoreSharing $ unEl t of Pi _ (NoAbs _ b) -> constrT n b Pi a b -> underAbstraction a b $ constrT (n + 1) -- OR: addCxtString (absName b) a $ constrT (n + 1) (absBody b) Def d es | d == q -> do let vs = fromMaybe __IMPOSSIBLE__ $ allApplyElims es (pars, ixs) <- normalise $ splitAt nofPars vs -- check that the constructor parameters are the data parameters checkParams n pars -- compute the non-linear parameters m <- getContextSize -- Note: n /= m if NoAbs encountered let nl = nonLinearParams m pars ixs -- assert that these are correct indices into the parameter vector when (any (< 0) nl) __IMPOSSIBLE__ when (any (>= nofPars) nl) __IMPOSSIBLE__ return nl _ -> typeError $ ShouldEndInApplicationOfTheDatatype t checkParams n vs = zipWithM_ sameVar vs ps where nvs = size vs ps = genericTake nvs $ downFrom (n + nvs) sameVar arg i -- skip irrelevant parameters | isIrrelevant arg = return () | otherwise = do t <- typeOfBV i equalTerm t (unArg arg) (var i) -- return the parameters (numbered 0,1,...,size pars-1 from left to right) -- that occur relevantly in the indices nonLinearParams n pars ixs = -- compute the free de Bruijn indices in the data indices -- ALT: Ignore all sorts? let fv = allRelevantVarsIgnoring IgnoreInAnnotations ixs -- keep relevant ones, convert to de Bruijn levels -- note: xs is descending list xs = map ((n-1) -) $ VarSet.toList fv -- keep those that correspond to parameters -- in ascending list in reverse $ filter (< size pars) xs {- UNUSED, Andreas 2012-09-13 -- | Force a type to be a specific datatype. forceData :: QName -> Type -> TCM Type forceData d (El s0 t) = liftTCM $ do t' <- reduce t d <- canonicalName d case ignoreSharing t' of Def d' _ | d == d' -> return $ El s0 t' | otherwise -> fail $ "wrong datatype " ++ show d ++ " != " ++ show d' MetaV m vs -> do Defn {defType = t, theDef = Datatype{dataSort = s}} <- getConstInfo d ps <- newArgsMeta t noConstraints $ leqType (El s0 t') (El s (Def d ps)) -- TODO: need equalType? reduce $ El s0 t' _ -> typeError $ ShouldBeApplicationOf (El s0 t) d -} -- | Is the type coinductive? Returns 'Nothing' if the answer cannot -- be determined. isCoinductive :: Type -> TCM (Maybe Bool) isCoinductive t = do El s t <- reduce t case ignoreSharing t of Def q _ -> do def <- getConstInfo q case theDef def of Axiom {} -> return (Just False) Function {} -> return Nothing Datatype { dataInduction = CoInductive } -> return (Just True) Datatype { dataInduction = Inductive } -> return (Just False) Record { recInduction = Just CoInductive } -> return (Just True) Record { recInduction = _ } -> return (Just False) Constructor {} -> __IMPOSSIBLE__ Primitive {} -> __IMPOSSIBLE__ Var {} -> return Nothing Lam {} -> __IMPOSSIBLE__ Lit {} -> __IMPOSSIBLE__ Level {} -> __IMPOSSIBLE__ Con {} -> __IMPOSSIBLE__ Pi {} -> return (Just False) Sort {} -> return (Just False) MetaV {} -> return Nothing Shared{} -> __IMPOSSIBLE__ DontCare{} -> __IMPOSSIBLE__ ExtLam{} -> __IMPOSSIBLE__ Agda-2.4.2.5/src/full/Agda/TypeChecking/Rules/Record.hs0000644000000000000000000004477012635075266020542 0ustar0000000000000000{-# LANGUAGE CPP #-} module Agda.TypeChecking.Rules.Record where import Control.Applicative import Data.Maybe import qualified Agda.Syntax.Abstract as A import Agda.Syntax.Common import Agda.Syntax.Internal as I import Agda.Syntax.Position import qualified Agda.Syntax.Info as Info import Agda.TypeChecking.Monad import Agda.TypeChecking.Substitute import Agda.TypeChecking.Telescope import Agda.TypeChecking.Reduce import Agda.TypeChecking.Positivity.Occurrence import Agda.TypeChecking.Pretty import Agda.TypeChecking.Polarity import Agda.TypeChecking.Irrelevance import Agda.TypeChecking.CompiledClause.Compile import Agda.TypeChecking.Rules.Data ( bindParameters, fitsIn ) import Agda.TypeChecking.Rules.Term ( isType_, ConvColor(..) ) import {-# SOURCE #-} Agda.TypeChecking.Rules.Decl (checkDecl) import Agda.Utils.Size import Agda.Utils.Permutation import Agda.Utils.Monad import Agda.Interaction.Options #include "undefined.h" import Agda.Utils.Impossible --------------------------------------------------------------------------- -- * Records --------------------------------------------------------------------------- -- | @checkRecDef i name con ps contel fields@ -- -- [@name@] Record type identifier. -- -- [@con@] Maybe constructor name and info. -- -- [@ps@] Record parameters. -- -- [@contel@] Approximate type of constructor (@fields@ -> Set). -- Does not include record parameters. -- -- [@fields@] List of field signatures. -- checkRecDef :: Info.DefInfo -- ^ Position and other info. -> QName -- ^ Record type identifier. -> Maybe (Ranged Induction) -- ^ Optional: (co)inductive declaration. -> Maybe A.QName -- ^ Optional: constructor name. -> [A.LamBinding] -- ^ Record parameters. -> A.Expr -- ^ Approximate type of constructor (@fields@ -> Set). -- Does not include record parameters. -> [A.Field] -- ^ Field signatures. -> TCM () checkRecDef i name ind con ps contel fields = traceCall (CheckRecDef (getRange name) (qnameName name) ps fields) $ do reportSDoc "tc.rec" 10 $ vcat [ text "checking record def" <+> prettyTCM name , nest 2 $ text "ps =" <+> prettyList (map prettyAs ps) , nest 2 $ text "contel =" <+> prettyA contel , nest 2 $ text "fields =" <+> prettyA (map Constr fields) ] -- get type of record t <- instantiateFull =<< typeOfConst name bindParameters ps t $ \tel t0 -> do -- Generate type of constructor from field telescope @contel@, -- which is the approximate constructor type (target missing). -- Check and evaluate field types. reportSDoc "tc.rec" 15 $ text "checking fields" -- WRONG: contype <- workOnTypes $ killRange <$> (instantiateFull =<< isType_ contel) contype <- killRange <$> (instantiateFull =<< isType_ contel) reportSDoc "tc.rec" 20 $ vcat [ text "contype = " <+> prettyTCM contype ] -- compute the field telescope (does not include record parameters) let TelV ftel _ = telView' contype -- A record is irrelevant if all of its fields are. -- In this case, the associated module parameter will be irrelevant. -- See issue 392. recordRelevance = minimum $ Irrelevant : (map getRelevance $ telToList ftel) -- Compute correct type of constructor -- t = tel -> t0 where t0 must be a sort s t0' <- normalise t0 s <- case ignoreSharing $ unEl t0' of Sort s -> return s _ -> typeError $ ShouldBeASort t0 gamma <- getContextTelescope -- the record params (incl. module params) reportSDoc "tc.rec" 20 $ vcat [ text "gamma = " <+> inTopContext (prettyTCM gamma) ] -- record type (name applied to parameters) let rect = El s $ Def name $ map Apply $ teleArgs gamma -- Put in @rect@ as correct target of constructor type. -- Andreas, 2011-05-10 use telePi_ instead of telePi to preserve -- even names of non-dependent fields in constructor type (Issue 322). let contype = telePi_ ftel (raise (size ftel) rect) -- NB: contype does not contain the parameter telescope -- Obtain name of constructor (if present). (hasNamedCon, conName, conInfo) <- case con of Just c -> return (True, c, i) Nothing -> do m <- killRange <$> currentModule c <- qualify m <$> freshName_ ("recCon-NOT-PRINTED" :: String) return (False, c, i) -- Add record type to signature. reportSDoc "tc.rec" 15 $ text "adding record type to signature" let getName :: A.Declaration -> [A.Arg QName] getName (A.Field _ x arg) = [x <$ arg] getName (A.ScopedDecl _ [f]) = getName f getName _ = [] fs = concatMap (convColor . getName) fields -- indCo is what the user wrote: inductive/coinductive/Nothing. -- We drop the Range. indCo = rangedThing <$> ind -- A constructor is inductive unless declared coinductive. conInduction = fromMaybe Inductive indCo haveEta = conInduction == Inductive con = ConHead conName conInduction $ map unArg fs reportSDoc "tc.rec" 30 $ text "record constructor is " <+> text (show con) addConstant name $ defaultDefn defaultArgInfo name t0 $ Record { recPars = 0 , recClause = Nothing , recConHead = con , recNamedCon = hasNamedCon , recConType = contype -- addConstant adds params! , recFields = fs , recTel = ftel -- addConstant adds params! , recAbstr = Info.defAbstract i , recEtaEquality = haveEta , recInduction = indCo -- we retain the original user declaration, in case the record turns out to be recursive -- determined by positivity checker: , recRecursive = False , recMutual = [] } -- Add record constructor to signature -- Andreas, 2011-05-19 moved this here, it was below the record module -- creation addConstant conName $ defaultDefn defaultArgInfo conName contype $ Constructor { conPars = 0 , conSrcCon = con , conData = name , conAbstr = Info.defAbstract conInfo , conInd = conInduction } -- Declare the constructor as eligible for instance search addNamedInstance conName name -- Check that the fields fit inside the sort contype `fitsIn` s {- Andreas, 2011-04-27 WRONG because field types are checked again and then non-stricts should not yet be irrelevant -- make record parameters hidden and non-stricts irrelevant -- ctx <- (reverse . map hideAndRelParams . take (size tel)) <$> getContext -} {- Andreas, 2013-09-13 DEBUGGING the debug printout reportSDoc "tc.rec" 80 $ sep [ text "current module record telescope" , nest 2 $ (prettyTCM =<< getContextTelescope) ] reportSDoc "tc.rec" 80 $ sep [ text "current module record telescope" , nest 2 $ (text . show =<< getContextTelescope) ] reportSDoc "tc.rec" 80 $ sep [ text "current module record telescope" , nest 2 $ (inTopContext . prettyTCM =<< getContextTelescope) ] reportSDoc "tc.rec" 80 $ sep [ text "current module record telescope" , nest 2 $ do tel <- getContextTelescope text (show tel) $+$ do inContext [] $ do prettyTCM tel $+$ do telA <- reify tel text (show telA) $+$ do ctx <- getContextTelescope text "should be empty:" <+> prettyTCM ctx ] -} let -- name of record module m = qnameToMName name -- make record parameters hidden and non-stricts irrelevant htel = map hideAndRelParams $ telToList tel info = setRelevance recordRelevance defaultArgInfo tel' = telFromList $ htel ++ [Dom info ("r", rect)] ext (Dom info (x, t)) = addCtx x (Dom info t) -- Add the record section -- make record parameters hidden ctx <- (reverse . map (setHiding Hidden) . take (size tel)) <$> getContext reportSDoc "tc.rec" 80 $ sep [ text "visibility-modified record telescope" , nest 2 $ text "ctx =" <+> prettyTCM ctx ] escapeContext (size tel) $ flip (foldr ext) ctx $ -- the record variable has the empty name by intention, see issue 208 underAbstraction (Dom info rect) (Abs "" ()) $ \_ -> do reportSDoc "tc.rec.def" 10 $ sep [ text "record section:" , nest 2 $ sep [ prettyTCM m <+> (inTopContext . prettyTCM =<< getContextTelescope) , fsep $ punctuate comma $ map (text . show . getName) fields ] ] reportSDoc "tc.rec.def" 15 $ nest 2 $ vcat [ text "field tel =" <+> escapeContext 1 (prettyTCM ftel) ] addSection m -- Check the types of the fields -- Andreas, 2013-09-13 all module telescopes count as parameters to the record projections -- thus, we set all context entries to @Hidden@ modifyContext (modifyContextEntries (setHiding Hidden)) $ do underAbstraction (Dom info rect) (Abs "" ()) $ \_ -> do withCurrentModule m $ do tel' <- getContextTelescope checkRecordProjections m name con tel' (raise 1 ftel) fields -- Andreas, 2011-05-19 here was the code "Add record constr..." -- Andreas 2012-02-13: postpone polarity computation until after positivity check -- computePolarity name return () {-| @checkRecordProjections m r q tel ftel fs@. [@m@ ] name of the generated module [@r@ ] name of the record type [@con@ ] name of the record constructor [@tel@ ] parameters and record variable r ("self") [@ftel@ ] telescope of fields [@fs@ ] the fields to be checked -} checkRecordProjections :: ModuleName -> QName -> ConHead -> Telescope -> Telescope -> [A.Declaration] -> TCM () checkRecordProjections m r con tel ftel fs = do checkProjs EmptyTel ftel fs where checkProjs :: Telescope -> Telescope -> [A.Declaration] -> TCM () checkProjs _ _ [] = return () checkProjs ftel1 ftel2 (A.ScopedDecl scope fs' : fs) = setScope scope >> checkProjs ftel1 ftel2 (fs' ++ fs) checkProjs ftel1 (ExtendTel (Dom ai t) ftel2) (A.Field info x _ : fs) = do -- Andreas, 2012-06-07: -- Issue 387: It is wrong to just type check field types again -- because then meta variables are created again. -- Instead, we take the field type t from the field telescope. reportSDoc "tc.rec.proj" 5 $ sep [ text "checking projection" <+> text (show x) , nest 2 $ vcat [ text "top =" <+> (inTopContext . prettyTCM =<< getContextTelescope) , text "tel =" <+> (inTopContext . prettyTCM $ tel) , text "ftel1 =" <+> prettyTCM ftel1 , text "t =" <+> prettyTCM t , text "ftel2 =" <+> addCtxTel ftel1 (underAbstraction_ ftel2 prettyTCM) ] ] -- Andreas, 2010-09-09 The following comments are misleading, TODO: update -- in fact, tel includes the variable of record type as last one -- e.g. for cartesion product it is -- -- tel = {A' : Set} {B' : Set} (r : Prod A' B') -- create the projection functions (instantiate the type with the values -- of the previous fields) {- what are the contexts? Γ, tel ⊢ t Γ, tel, r ⊢ vs Γ, tel, r, ftel₁ ⊢ raiseFrom (size ftel₁) 1 t -} -- The type of the projection function should be -- {tel} -> (r : R Δ) -> t -- where Δ = Γ, tel is the current context let finalt = telePi (replaceEmptyName "r" tel) t projname = qualify m $ qnameName x projcall = Var 0 [Proj projname] -- projcall = Def projname [defaultArg $ var 0] rel = getRelevance ai -- the recursive call recurse = checkProjs (abstract ftel1 $ ExtendTel (Dom ai t) $ Abs (nameToArgName $ qnameName projname) EmptyTel) (ftel2 `absApp` projcall) fs reportSDoc "tc.rec.proj" 25 $ nest 2 $ text "finalt=" <+> do inTopContext $ prettyTCM finalt -- Andreas, 2012-02-20 do not add irrelevant projections if -- disabled by --no-irrelevant-projections ifM (return (rel == Irrelevant) `and2M` do not . optIrrelevantProjections <$> pragmaOptions) recurse $ do reportSDoc "tc.rec.proj" 10 $ sep [ text "adding projection" , nest 2 $ prettyTCM projname <+> text ":" <+> inTopContext (prettyTCM finalt) ] -- The body should be -- P.xi {tel} (r _ .. x .. _) = x -- Ulf, 2011-08-22: actually we're dropping the parameters from the -- projection functions so the body is now -- P.xi (r _ .. x .. _) = x -- Andreas, 2012-01-12: irrelevant projections get translated to -- P.xi (r _ .. x .. _) = irrAxiom {level of t} {t} x -- PROBLEM: because of dropped parameters, cannot refer to t -- compute body modification for irrelevant projections let bodyMod = case rel of Relevant -> id Irrelevant -> DontCare _ -> __IMPOSSIBLE__ -- 2012-04-02: DontCare instead of irrAxiom -- Irrelevant -> do -- irrAxiom <- primIrrAxiom -- let sortToLevel (Type l) = l -- sortToLevel _ = Max [ClosedLevel 0] -- something random here, we don't care a lot -- levelOfT = Level $ sortToLevel $ getSort t -- return $ \ n x -> let -- mkArg t = Arg Hidden Relevant $ raise n t -- -- ERR: Variables of t not in Scope! -- mkArg t = Arg Hidden Relevant $ Sort Prop -- in apply irrAxiom [mkArg levelOfT, mkArg (unEl t), Arg NotHidden Irrelevant x] let -- Andreas, 2010-09-09: comment for existing code -- split the telescope into parameters (ptel) and the type or the record -- (rt) which should be R ptel (ptel,[rt]) = splitAt (size tel - 1) $ telToList tel projArgI = domInfo rt cpi = ConPatternInfo (Just ConPRec) (Just $ argFromDom $ fmap snd rt) conp = defaultArg $ ConP con cpi $ [ Arg info $ unnamed $ VarP "x" | Dom info _ <- telToList ftel ] nobind 0 = id nobind n = Bind . Abs "_" . nobind (n - 1) body = nobind (size ftel1) $ Bind . Abs "x" $ nobind (size ftel2) $ Body $ bodyMod $ var (size ftel2) cltel = ftel clause = Clause { clauseRange = getRange info , clauseTel = killRange cltel , clausePerm = idP $ size ftel , namedClausePats = [Named Nothing <$> conp] , clauseBody = body , clauseType = Just $ Arg ai t } -- Andreas, 2013-10-20 -- creating the projection construction function let core = Lam projArgI $ Abs "r" $ bodyMod $ projcall -- leading lambdas are to ignore parameter applications proj = teleNoAbs ptel core -- proj = foldr (\ (Dom ai (x, _)) -> Lam ai . NoAbs x) core ptel projection = Projection { projProper = Just projname -- name of the record type: , projFromType = r -- index of the record argument (in the type), -- start counting with 1: , projIndex = size ptel + 1 -- which is @size tel@ , projDropPars = proj , projArgInfo = projArgI } reportSDoc "tc.rec.proj" 80 $ sep [ text "adding projection" , nest 2 $ prettyTCM projname <+> text (show clause) ] reportSDoc "tc.rec.proj" 70 $ sep [ text "adding projection" , nest 2 $ prettyTCM projname <+> text (show (clausePats clause)) <+> text "=" <+> inTopContext (addCtxTel ftel (prettyTCM (clauseBody clause))) ] reportSDoc "tc.rec.proj" 10 $ sep [ text "adding projection" , nest 2 $ prettyTCM (QNamed projname clause) ] -- Record patterns should /not/ be translated when the -- projection functions are defined. Record pattern -- translation is defined in terms of projection -- functions. cc <- compileClauses Nothing [clause] reportSDoc "tc.cc" 10 $ do sep [ text "compiled clauses of " <+> prettyTCM projname , nest 2 $ text (show cc) ] escapeContext (size tel) $ do addConstant projname $ (defaultDefn ai projname (killRange finalt) Function { funClauses = [clause] , funCompiled = Just cc , funDelayed = NotDelayed , funInv = NotInjective , funAbstr = ConcreteDef , funMutual = [] , funProjection = Just projection , funStatic = False , funCopy = False , funTerminates = Just True , funExtLam = Nothing , funWith = Nothing , funCopatternLHS = isCopatternLHS [clause] }) { defArgOccurrences = [StrictPos] } computePolarity projname recurse checkProjs ftel1 ftel2 (d : fs) = do checkDecl d checkProjs ftel1 ftel2 fs Agda-2.4.2.5/src/full/Agda/TypeChecking/Rules/LHS.hs0000644000000000000000000010643512635075266017747 0ustar0000000000000000{-# LANGUAGE CPP #-} {-# LANGUAGE FlexibleInstances #-} {-# LANGUAGE PatternGuards #-} {-# LANGUAGE TypeSynonymInstances #-} module Agda.TypeChecking.Rules.LHS where import Prelude hiding (mapM) import Data.Maybe import Control.Applicative import Control.Monad hiding (mapM) import Control.Monad.State hiding (mapM) import Control.Monad.Trans.Maybe import Data.Traversable import Agda.Interaction.Options import Agda.Interaction.Options.Lenses import Agda.Syntax.Internal as I hiding (Substitution) import Agda.Syntax.Internal.Pattern import Agda.Syntax.Abstract (IsProjP(..)) import qualified Agda.Syntax.Abstract as A import Agda.Syntax.Abstract.Views (asView) import Agda.Syntax.Common as Common import Agda.Syntax.Info import Agda.Syntax.Position import Agda.TypeChecking.Monad import Agda.TypeChecking.Conversion import Agda.TypeChecking.Constraints import Agda.TypeChecking.Datatypes import Agda.TypeChecking.Irrelevance import {-# SOURCE #-} Agda.TypeChecking.Empty import Agda.TypeChecking.Patterns.Abstract import Agda.TypeChecking.Pretty import Agda.TypeChecking.Records import Agda.TypeChecking.Reduce import Agda.TypeChecking.Substitute hiding (Substitution) import qualified Agda.TypeChecking.Substitute as S (Substitution) import Agda.TypeChecking.Telescope import {-# SOURCE #-} Agda.TypeChecking.Rules.Term (checkExpr) import Agda.TypeChecking.Rules.LHS.Problem import Agda.TypeChecking.Rules.LHS.ProblemRest import Agda.TypeChecking.Rules.LHS.Unify import Agda.TypeChecking.Rules.LHS.Split import Agda.TypeChecking.Rules.LHS.Implicit import Agda.TypeChecking.Rules.LHS.Instantiate import Agda.TypeChecking.Rules.Data import Agda.Utils.Except (MonadError(..)) import Agda.Utils.Functor import Agda.Utils.List import Agda.Utils.ListT import Agda.Utils.Monad import Agda.Utils.Permutation import Agda.Utils.Size #include "undefined.h" import Agda.Utils.Impossible -- | Compute the set of flexible patterns in a list of patterns. The result is -- the deBruijn indices of the flexible patterns. flexiblePatterns :: [A.NamedArg A.Pattern] -> TCM FlexibleVars flexiblePatterns nps = do forMaybeM (zip (downFrom $ length nps) nps) $ \ (i, Arg ai p) -> do runMaybeT $ (\ f -> FlexibleVar (getHiding ai) f i) <$> maybeFlexiblePattern p -- | A pattern is flexible if it is dotted or implicit, or a record pattern -- with only flexible subpatterns. class IsFlexiblePattern a where maybeFlexiblePattern :: a -> MaybeT TCM FlexibleVarKind isFlexiblePattern :: a -> TCM Bool isFlexiblePattern p = isJust <$> runMaybeT (maybeFlexiblePattern p) instance IsFlexiblePattern A.Pattern where maybeFlexiblePattern p = case p of A.DotP{} -> return DotFlex A.WildP{} -> return ImplicitFlex A.ConP _ (A.AmbQ [c]) qs -> ifM (isNothing <$> isRecordConstructor c) mzero {-else-} (maybeFlexiblePattern qs) _ -> mzero instance IsFlexiblePattern (I.Pattern' a) where maybeFlexiblePattern p = case p of I.DotP{} -> return DotFlex I.ConP _ i ps | Just ConPImplicit <- conPRecord i -> return ImplicitFlex -- expanded from ImplicitP | Just _ <- conPRecord i -> maybeFlexiblePattern ps | otherwise -> mzero I.VarP{} -> mzero I.LitP{} -> mzero I.ProjP{} -> mzero -- | Lists of flexible patterns are 'RecordFlex'. instance IsFlexiblePattern a => IsFlexiblePattern [a] where maybeFlexiblePattern ps = RecordFlex <$> mapM maybeFlexiblePattern ps instance IsFlexiblePattern a => IsFlexiblePattern (Common.Arg c a) where maybeFlexiblePattern = maybeFlexiblePattern . unArg instance IsFlexiblePattern a => IsFlexiblePattern (Common.Named name a) where maybeFlexiblePattern = maybeFlexiblePattern . namedThing -- | Compute the dot pattern instantiations. dotPatternInsts :: [A.NamedArg A.Pattern] -> Substitution -> [I.Dom Type] -> TCM [DotPatternInst] dotPatternInsts ps s as = dpi (map namedArg ps) (reverse s) as where dpi (_ : _) [] _ = __IMPOSSIBLE__ dpi (_ : _) (Just _ : _) [] = __IMPOSSIBLE__ -- the substitution also contains entries for module parameters, so it can -- be longer than the pattern dpi [] _ _ = return [] dpi (_ : ps) (Nothing : s) as = dpi ps s as dpi (p : ps) (Just u : s) (a : as) = case p of A.DotP _ e -> (DPI e u a :) <$> dpi ps s as A.WildP _ -> dpi ps s as -- record pattern A.ConP _ (A.AmbQ [c]) qs -> do Def r es <- ignoreSharing <$> reduce (unEl $ unDom a) let Just vs = allApplyElims es (ftel, us) <- etaExpandRecord r vs u qs <- insertImplicitPatterns ExpandLast qs ftel let instTel EmptyTel _ = [] instTel (ExtendTel arg tel) (u : us) = arg : instTel (absApp tel u) us instTel ExtendTel{} [] = __IMPOSSIBLE__ bs0 = instTel ftel (map unArg us) -- Andreas, 2012-09-19 propagate relevance info to dot patterns bs = map (mapRelevance (composeRelevance (getRelevance a))) bs0 dpi (map namedArg qs ++ ps) (map (Just . unArg) us ++ s) (bs ++ as) _ -> __IMPOSSIBLE__ -- | In an internal pattern, replace some pattern variables -- by dot patterns, according to the given substitution. instantiatePattern :: Substitution -- ^ Partial substitution for the pattern variables, -- given in order of the clause telescope, -- (not in the order of occurrence in the patterns). -> Permutation -- ^ Map from the pattern variables to the telescope variables. -> [I.NamedArg Pattern] -- ^ Input patterns. -> [I.NamedArg Pattern] -- ^ Output patterns, with some @VarP@ replaced by @DotP@ -- according to the @Substitution@. instantiatePattern sub perm ps | length sub /= length hps = error $ unlines [ "instantiatePattern:" , " sub = " ++ show sub , " perm = " ++ show perm , " ps = " ++ show ps ] | otherwise = foldr merge ps $ zipWith inst (reverse sub) hps where -- For each pattern variable get a copy of the patterns -- focusing on this variable. -- Order them in the dependency (telescope) order. hps = permute perm $ allHoles ps -- If we do not want to substitute a variable, we -- throw away the corresponding one-hole pattern. inst Nothing hps = Nothing -- If we want to substitute, we replace the variable -- by the dot pattern. inst (Just t) hps = Just $ plugHole (DotP t) hps -- If we did not instantiate a variable, we can keep the original -- patterns in this iteration. merge Nothing ps = ps -- Otherwise, we merge the changes in @qs@ into @ps@. -- This means we walk simultaneously through @qs@ and @ps@ -- and expect them to be the same everywhere except that -- a @q@ can be a @DotP@ and the corresponding @p@ a @VarP@. -- In this case, we take the @DotP@. -- Apparently, the other way round can also happen (why?). merge (Just qs) ps = zipWith mergeA qs ps where mergeA a1 a2 = fmap (mergeP (namedArg a1) (namedArg a2) <$) a1 mergeP (DotP s) (DotP t) | s == t = DotP s | otherwise = __IMPOSSIBLE__ -- interesting cases: mergeP (DotP t) (VarP _) = DotP t mergeP (VarP _) (DotP t) = DotP t -- the rest is homomorphical mergeP (DotP _) _ = __IMPOSSIBLE__ mergeP _ (DotP _) = __IMPOSSIBLE__ mergeP (ConP c1 i1 ps) (ConP c2 i2 qs) | c1 == c2 = ConP (c1 `withRangeOf` c2) (mergeCPI i1 i2) $ zipWith mergeA ps qs | otherwise = __IMPOSSIBLE__ mergeP (LitP l1) (LitP l2) | l1 == l2 = LitP (l1 `withRangeOf` l2) | otherwise = __IMPOSSIBLE__ mergeP (VarP x) (VarP y) | x == y = VarP x | otherwise = __IMPOSSIBLE__ mergeP (ConP _ _ _) (VarP _) = __IMPOSSIBLE__ mergeP (ConP _ _ _) (LitP _) = __IMPOSSIBLE__ mergeP (VarP _) (ConP _ _ _) = __IMPOSSIBLE__ mergeP (VarP _) (LitP _) = __IMPOSSIBLE__ mergeP (LitP _) (ConP _ _ _) = __IMPOSSIBLE__ mergeP (LitP _) (VarP _) = __IMPOSSIBLE__ mergeP (ProjP x) (ProjP y) | x == y = ProjP x | otherwise = __IMPOSSIBLE__ mergeP ProjP{} _ = __IMPOSSIBLE__ mergeP _ ProjP{} = __IMPOSSIBLE__ mergeCPI (ConPatternInfo mr1 mt1) (ConPatternInfo mr2 mt2) = ConPatternInfo (mplus mr1 mr2) (mplus mt1 mt2) -- | In an internal pattern, replace some pattern variables -- by dot patterns, according to the given substitution. instantiatePattern' :: Substitution -- ^ Partial substitution for the pattern variables, -- given in order of the clause telescope, -- (not in the order of occurrence in the patterns). -> Permutation -- ^ Map from the pattern variables to the telescope variables. -> [I.NamedArg Pattern] -- ^ Input patterns. -> [I.NamedArg Pattern] -- ^ Output patterns, with some @VarP@ replaced by @DotP@ -- according to the @Substitution@. instantiatePattern' sub perm ps = evalState (mapM goArg ps) 0 where -- get a partial substitution from pattern variables to terms sub' = inversePermute perm sub -- get next pattern variable next = do n <- get; put (n+1); return n goArg = traverse goNamed goNamed = traverse goPat goPat p = case p of VarP x -> replace p DotP t -> replace p ConP c mt ps -> ConP c mt <$> mapM goArg ps LitP{} -> return p ProjP{} -> return p replace p = do i <- next let s = case sub' !!! i of Nothing -> __IMPOSSIBLE__ Just s -> s return $ fromMaybe p $ DotP <$> s -- | Check if a problem is solved. That is, if the patterns are all variables. isSolvedProblem :: Problem -> Bool isSolvedProblem problem = null (restPats $ problemRest problem) && all (isSolved . snd . asView . namedArg) (problemInPat problem) where -- need further splitting: isSolved A.ConP{} = False isSolved A.DotP{} = False isSolved A.LitP{} = False isSolved A.DefP{} = False -- projection pattern -- solved: isSolved A.VarP{} = True isSolved A.WildP{} = True isSolved A.AbsurdP{} = True -- impossible: isSolved A.AsP{} = __IMPOSSIBLE__ -- removed by asView isSolved A.PatternSynP{} = __IMPOSSIBLE__ -- expanded before -- | For each user-defined pattern variable in the 'Problem', check -- that the corresponding data type (if any) does not contain a -- constructor of the same name (which is not in scope); this -- \"shadowing\" could indicate an error, and is not allowed. -- -- Precondition: The problem has to be solved. noShadowingOfConstructors :: Call -- ^ Trace, e.g., @CheckPatternShadowing clause@ -> Problem -> TCM () noShadowingOfConstructors mkCall problem = traceCall mkCall $ do let pat = map (snd . asView . namedArg) $ problemInPat problem tel = map (unEl . snd . unDom) $ telToList $ problemTel problem zipWithM_ noShadowing pat tel -- TODO: does not work for flexible arity and projection patterns return () where noShadowing (A.WildP {}) t = return () noShadowing (A.AbsurdP {}) t = return () noShadowing (A.ConP {}) t = return () -- only happens for eta expanded record patterns noShadowing (A.DefP {}) t = return () -- projection pattern noShadowing (A.AsP {}) t = __IMPOSSIBLE__ noShadowing (A.DotP {}) t = __IMPOSSIBLE__ noShadowing (A.LitP {}) t = __IMPOSSIBLE__ noShadowing (A.PatternSynP {}) t = __IMPOSSIBLE__ noShadowing (A.VarP x) t = do reportSDoc "tc.lhs.shadow" 30 $ vcat [ text $ "checking whether pattern variable " ++ show x ++ " shadows a constructor" , nest 2 $ text "type of variable =" <+> prettyTCM t ] reportSLn "tc.lhs.shadow" 70 $ " t = " ++ show t t <- reduce t case t of Def t _ -> do d <- theDef <$> getConstInfo t case d of Datatype { dataCons = cs } -> do case filter ((A.nameConcrete x ==) . A.nameConcrete . A.qnameName) cs of [] -> return () (c : _) -> setCurrentRange x $ typeError $ PatternShadowsConstructor x c Axiom {} -> return () Function {} -> return () Record {} -> return () Constructor {} -> __IMPOSSIBLE__ Primitive {} -> __IMPOSSIBLE__ Var {} -> return () Pi {} -> return () Sort {} -> return () Shared p -> noShadowing (A.VarP x) $ derefPtr p MetaV {} -> return () -- TODO: If the type is a meta-variable, should the test be -- postponed? If there is a problem, then it will be caught when -- the completed module is type checked, so it is safe to skip -- the test here. However, users may be annoyed if they get an -- error in code which has already passed the type checker. Lam {} -> __IMPOSSIBLE__ Lit {} -> __IMPOSSIBLE__ Level {} -> __IMPOSSIBLE__ Con {} -> __IMPOSSIBLE__ DontCare{} -> __IMPOSSIBLE__ ExtLam{} -> __IMPOSSIBLE__ -- | Check that a dot pattern matches it's instantiation. checkDotPattern :: DotPatternInst -> TCM () checkDotPattern (DPI e v (Dom info a)) = traceCall (CheckDotPattern e v) $ do reportSDoc "tc.lhs.dot" 15 $ sep [ text "checking dot pattern" , nest 2 $ prettyA e , nest 2 $ text "=" <+> prettyTCM v , nest 2 $ text ":" <+> prettyTCM a ] applyRelevanceToContext (argInfoRelevance info) $ do u <- checkExpr e a -- Should be ok to do noConstraints here noConstraints $ equalTerm a u v -- | Bind the variables in a left hand side and check that 'Hiding' of -- the patterns matches the hiding info in the type. -- -- Precondition: the patterns should -- all be 'A.VarP', 'A.WildP', or 'A.AbsurdP' and the -- telescope should have the same size as the pattern list. -- There could also be 'A.ConP's resulting from eta expanded implicit record -- patterns. bindLHSVars :: [A.NamedArg A.Pattern] -> Telescope -> TCM a -> TCM a bindLHSVars [] tel@ExtendTel{} _ = do reportSDoc "impossible" 10 $ text "bindLHSVars: no patterns left, but tel =" <+> prettyTCM tel __IMPOSSIBLE__ bindLHSVars (_ : _) EmptyTel _ = __IMPOSSIBLE__ bindLHSVars [] EmptyTel ret = ret bindLHSVars (p : ps) (ExtendTel a tel) ret = do unless (getHiding p == getHiding a) $ typeError WrongHidingInLHS case namedArg p of A.VarP x -> addContext (x, a) $ bindLHSVars ps (absBody tel) ret A.WildP _ -> bindDummy (absName tel) -- @bindDummy underscore@ does not fix issue 819, but -- introduces unwanted underscores in error messages -- (Andreas, 2015-05-28) A.AbsurdP pi -> do -- Andreas, 2012-03-15: allow postponement of emptyness check isEmptyType (getRange pi) $ unDom a -- OLD CODE: isReallyEmptyType $ unArg a bindDummy (absName tel) A.ConP _ (A.AmbQ [c]) qs -> do -- eta expanded record pattern Def r es <- reduce (unEl $ unDom a) let Just vs = allApplyElims es ftel <- (`apply` vs) <$> getRecordFieldTypes r con <- getConHead c let n = size ftel eta = Con con [ var i <$ (namedThing <$> setArgColors [] q) | (q, i) <- zip qs [n - 1, n - 2..0] ] -- ^ TODO guilhem bindLHSVars (qs ++ ps) (ftel `abstract` absApp (raise (size ftel) tel) eta) ret A.ConP{} -> __IMPOSSIBLE__ A.DefP{} -> __IMPOSSIBLE__ A.AsP{} -> __IMPOSSIBLE__ A.DotP{} -> __IMPOSSIBLE__ A.LitP{} -> __IMPOSSIBLE__ A.PatternSynP{} -> __IMPOSSIBLE__ where bindDummy s = do x <- if isUnderscore s then freshNoName_ else freshName_ ("." ++ argNameToString s) addContext (x, a) $ bindLHSVars ps (absBody tel) ret -- | Bind as patterns bindAsPatterns :: [AsBinding] -> TCM a -> TCM a bindAsPatterns [] ret = ret bindAsPatterns (AsB x v a : asb) ret = do reportSDoc "tc.lhs.as" 10 $ text "as pattern" <+> prettyTCM x <+> sep [ text ":" <+> prettyTCM a , text "=" <+> prettyTCM v ] addLetBinding defaultArgInfo x v a $ bindAsPatterns asb ret -- | Result of checking the LHS of a clause. data LHSResult = LHSResult { lhsVarTele :: Telescope -- ^ Δ : The types of the pattern variables, in internal dependency order. -- Corresponds to 'clauseTel'. , lhsPatterns :: [I.NamedArg Pattern] -- ^ The patterns in internal syntax. , lhsBodyType :: I.Arg Type -- ^ The type of the body. Is @bσ@ if @Γ@ is defined. -- 'Irrelevant' to indicate the rhs must be checked in irrelevant mode. , lhsPermutation :: Permutation -- ^ The permutation from pattern vars to @Δ@. -- Corresponds to 'clausePerm'. } instance InstantiateFull LHSResult where instantiateFull' (LHSResult tel ps t perm) = LHSResult <$> instantiateFull' tel <*> instantiateFull' ps <*> instantiateFull' t <*> return perm -- | Check a LHS. Main function. -- -- @checkLeftHandSide a ps a ret@ checks that user patterns @ps@ eliminate -- the type @a@ of the defined function, and calls continuation @ret@ -- if successful. checkLeftHandSide :: Call -- ^ Trace, e.g. @CheckPatternShadowing clause@ -> Maybe QName -- ^ The name of the definition we are checking. -> [A.NamedArg A.Pattern] -- ^ The patterns. -> Type -- ^ The expected type @a = Γ → b@. -> (LHSResult -> TCM a) -- ^ Continuation. -> TCM a checkLeftHandSide c f ps a ret = do problem0 <- problemFromPats ps a -- Andreas, 2013-03-15 deactivating the following test allows -- flexible arity -- unless (noProblemRest problem) $ typeError $ TooManyArgumentsInLHS a -- doing the splits: LHSState problem@(Problem ps (perm, qs) delta rest) sigma dpi asb <- checkLHS f $ LHSState problem0 idS [] [] unless (null $ restPats rest) $ typeError $ TooManyArgumentsInLHS a noShadowingOfConstructors c problem noPatternMatchingOnCodata qs reportSDoc "tc.lhs.top" 10 $ vcat [ text "checked lhs:" , nest 2 $ vcat [ text "ps = " <+> fsep (map prettyA ps) , text "perm = " <+> text (show perm) , text "delta = " <+> prettyTCM delta , text "dpi = " <+> brackets (fsep $ punctuate comma $ map prettyTCM dpi) , text "asb = " <+> brackets (fsep $ punctuate comma $ map prettyTCM asb) , text "qs = " <+> text (show qs) ] ] let b' = restType rest bindLHSVars (filter (isNothing . isProjP) ps) delta $ bindAsPatterns asb $ do reportSDoc "tc.lhs.top" 10 $ text "bound pattern variables" reportSDoc "tc.lhs.top" 10 $ nest 2 $ text "type = " <+> prettyTCM b' -- Check dot patterns mapM_ checkDotPattern dpi lhsResult <- return $ LHSResult delta qs b' perm applyRelevanceToContext (getRelevance b') $ ret lhsResult -- | The loop (tail-recursive): split at a variable in the problem until problem is solved checkLHS :: Maybe QName -- ^ The name of the definition we are checking. -> LHSState -- ^ The current state. -> TCM LHSState -- ^ The final state after all splitting is completed checkLHS f st@(LHSState problem sigma dpi asb) = do problem <- insertImplicitProblem problem -- Note: inserting implicits no longer preserve solvedness, -- since we might insert eta expanded record patterns. if isSolvedProblem problem then return $ st { lhsProblem = problem } else do unlessM (optPatternMatching <$> gets getPragmaOptions) $ typeError $ GenericError $ "Pattern matching is disabled" foldListT trySplit nothingToSplit $ splitProblem f problem where nothingToSplit = do reportSLn "tc.lhs.split" 50 $ "checkLHS: nothing to split in problem " ++ show problem nothingToSplitError problem -- Split problem rest (projection pattern, does not fail as there is no call to unifier) trySplit (SplitRest projPat projType) _ = do -- Compute the new problem let Problem ps1 (iperm, ip) delta (ProblemRest (p:ps2) b) = problem -- ps' = ps1 ++ [p] ps' = ps1 -- drop the projection pattern (already splitted) rest = ProblemRest ps2 (projPat $> projType) ip' = ip ++ [fmap (Named Nothing . ProjP) projPat] problem' = Problem ps' (iperm, ip') delta rest -- Jump the trampolin st' <- updateProblemRest (LHSState problem' sigma dpi asb) -- If the field is irrelevant, we need to continue in irr. cxt. -- (see Issue 939). applyRelevanceToContext (getRelevance projPat) $ do checkLHS f st' -- Split on literal pattern (does not fail as there is no call to unifier) trySplit (Split p0 xs (Arg _ (LitFocus lit iph hix a)) p1) _ = do -- plug the hole with a lit pattern let ip = plugHole (LitP lit) iph iperm = expandP hix 0 $ fst (problemOutPat problem) -- substitute the literal in p1 and sigma and dpi and asb let delta1 = problemTel p0 delta2 = absApp (fmap problemTel p1) (Lit lit) rho = singletonS (size delta2) (Lit lit) -- Andreas, 2015-06-13 Literals are closed, so need to raise them! -- rho = liftS (size delta2) $ singletonS 0 (Lit lit) -- rho = [ var i | i <- [0..size delta2 - 1] ] -- ++ [ raise (size delta2) $ Lit lit ] -- ++ [ var i | i <- [size delta2 ..] ] sigma' = applySubst rho sigma dpi' = applySubst rho dpi asb0 = applySubst rho asb ip' = applySubst rho ip rest' = applySubst rho (problemRest problem) -- Compute the new problem let ps' = problemInPat p0 ++ problemInPat (absBody p1) delta' = abstract delta1 delta2 problem' = Problem ps' (iperm, ip') delta' rest' asb' = raise (size delta2) (map (\x -> AsB x (Lit lit) a) xs) ++ asb0 st' <- updateProblemRest (LHSState problem' sigma' dpi' asb') checkLHS f st' -- Split on constructor pattern (unifier might fail) trySplit (Split p0 xs focus@(Arg info Focus{}) p1) tryNextSplit = do res <- trySplitConstructor p0 xs focus p1 case res of -- Success. Continue checking LHS. Unifies st' -> checkLHS f st' -- Mismatch. Report and abort. NoUnify tcerr -> throwError tcerr -- Unclear situation. Try next split. -- If no split works, give error from first split. -- This is conservative, but might not be the best behavior. -- It might be better to collect all the errors and print all of them. DontKnow tcerr -> tryNextSplit `catchError` \ _ -> throwError tcerr whenUnifies :: UnificationResult' a -> (a -> TCM (UnificationResult' b)) -> TCM (UnificationResult' b) whenUnifies res cont = do case res of Unifies a -> cont a NoUnify tcerr -> return $ NoUnify tcerr DontKnow tcerr -> return $ DontKnow tcerr trySplitConstructor p0 xs (Arg info LitFocus{}) p1 = __IMPOSSIBLE__ trySplitConstructor p0 xs (Arg info (Focus { focusCon = c , focusPatOrigin= porigin , focusConArgs = qs , focusRange = r , focusOutPat = iph , focusHoleIx = hix , focusDatatype = d , focusParams = vs , focusIndices = ws , focusType = a } )) p1 = do traceCall (CheckPattern (A.ConP (ConPatInfo porigin $ PatRange r) (A.AmbQ [c]) qs) (problemTel p0) (El Prop $ Def d $ map Apply $ vs ++ ws)) $ do let delta1 = problemTel p0 let typeOfSplitVar = Arg info a reportSDoc "tc.lhs.split" 10 $ sep [ text "checking lhs" , nest 2 $ text "tel =" <+> prettyTCM (problemTel problem) , nest 2 $ text "rel =" <+> (text $ show $ argInfoRelevance info) ] reportSDoc "tc.lhs.split" 15 $ sep [ text "split problem" , nest 2 $ vcat [ text "delta1 = " <+> prettyTCM delta1 , text "typeOfSplitVar =" <+> prettyTCM typeOfSplitVar , text "focusOutPat =" <+> (text . show) iph , text "delta2 = " <+> prettyTCM (problemTel $ absBody p1) ] ] c <- (`withRangeOf` c) <$> getConForm c ca <- defType <$> getConInfo c reportSDoc "tc.lhs.split" 20 $ nest 2 $ vcat [ text "ca =" <+> prettyTCM ca , text "vs =" <+> prettyList (map prettyTCM vs) ] -- Lookup the type of the constructor at the given parameters let a = ca `piApply` vs -- It will end in an application of the datatype (gamma', ca, d', us) <- do TelV gamma' ca@(El _ def) <- telView a let Def d' es = ignoreSharing def Just us = allApplyElims es return (gamma', ca, d', us) -- This should be the same datatype as we split on unless (d == d') $ typeError $ ShouldBeApplicationOf ca d' -- reportSDoc "tc.lhs.top" 20 $ nest 2 $ vcat -- [ text "gamma' =" <+> text (show gamma') -- ] -- Andreas 2010-09-07 propagate relevance info to new vars let updRel = composeRelevance (getRelevance info) gamma' <- return $ mapRelevance updRel <$> gamma' -- Insert implicit patterns qs' <- insertImplicitPatterns ExpandLast qs gamma' unless (size qs' == size gamma') $ typeError $ WrongNumberOfConstructorArguments (conName c) (size gamma') (size qs') let gamma = useNamesFromPattern qs' gamma' -- Get the type of the datatype. da <- (`piApply` vs) . defType <$> getConstInfo d -- Compute the flexible variables flex <- flexiblePatterns (problemInPat p0 ++ qs') -- Compute the constructor indices by dropping the parameters let us' = drop (size vs) us reportSDoc "tc.lhs.top" 15 $ addCtxTel delta1 $ sep [ text "preparing to unify" , nest 2 $ vcat [ text "c =" <+> prettyTCM c <+> text ":" <+> prettyTCM a , text "d =" <+> prettyTCM d <+> text ":" <+> prettyTCM da , text "gamma =" <+> prettyTCM gamma , text "gamma' =" <+> prettyTCM gamma' , text "vs =" <+> brackets (fsep $ punctuate comma $ map prettyTCM vs) , text "us' =" <+> brackets (fsep $ punctuate comma $ map prettyTCM us') , text "ws =" <+> brackets (fsep $ punctuate comma $ map prettyTCM ws) ] ] -- Unify constructor target and given type (in Δ₁Γ) res <- addCtxTel (delta1 `abstract` gamma) $ unifyIndices flex (raise (size gamma) da) us' (raise (size gamma) ws) whenUnifies res $ \ sub0 -> do -- Andreas 2014-11-25 clear 'Forced' and 'Unused' -- Andreas 2015-01-19 ... only after unification gamma <- return $ mapRelevance ignoreForced <$> gamma -- We should substitute c ys for x in Δ₂ and sigma let ys = teleArgs gamma delta2 = absApp (raise (size gamma) $ fmap problemTel p1) (Con c ys) rho0 = liftS (size delta2) $ consS (Con c ys) $ raiseS (size gamma) -- rho0 = [ var i | i <- [0..size delta2 - 1] ] -- ++ [ raise (size delta2) $ Con c ys ] -- ++ [ var i | i <- [size delta2 + size gamma ..] ] sigma0 = applySubst rho0 sigma dpi0 = applySubst rho0 dpi asb0 = applySubst rho0 asb rest0 = applySubst rho0 (problemRest problem) reportSDoc "tc.lhs.top" 15 $ addCtxTel (delta1 `abstract` gamma) $ nest 2 $ vcat [ text "delta2 =" <+> prettyTCM delta2 , text "sub0 =" <+> brackets (fsep $ punctuate comma $ map (maybe (text "_") prettyTCM) sub0) ] reportSDoc "tc.lhs.top" 15 $ addCtxTel (delta1 `abstract` gamma `abstract` delta2) $ nest 2 $ vcat [ text "dpi0 = " <+> brackets (fsep $ punctuate comma $ map prettyTCM dpi0) , text "asb0 = " <+> brackets (fsep $ punctuate comma $ map prettyTCM asb0) ] -- Andreas, 2010-09-09, save the type. -- It is relative to delta1, but it should be relative to -- all variables which will be bound by patterns. -- Thus, it has to be raised by 1 (the "hole" variable) -- plus the length of delta2 (the variables coming after the hole). let storedPatternType = raise (1 + size delta2) typeOfSplitVar -- Also remember if we are a record pattern and from an implicit pattern. isRec <- isRecord d let cpi = ConPatternInfo (isRec $> porigin) (Just storedPatternType) -- Plug the hole in the out pattern with c ys let ysp = map (argFromDom . fmap (namedVarP . fst)) $ telToList gamma ip = plugHole (ConP c cpi ysp) iph ip0 = applySubst rho0 ip -- Δ₁Γ ⊢ sub0, we need something in Δ₁ΓΔ₂ -- Also needs to be padded with Nothing's to have the right length. let pad n xs x = xs ++ replicate (max 0 $ n - size xs) x newTel = problemTel p0 `abstract` (gamma `abstract` delta2) sub = replicate (size delta2) Nothing ++ pad (size delta1 + size gamma) (raise (size delta2) sub0) Nothing reportSDoc "tc.lhs.top" 15 $ nest 2 $ vcat [ text "newTel =" <+> prettyTCM newTel , addCtxTel newTel $ text "sub =" <+> brackets (fsep $ punctuate comma $ map (maybe (text "_") prettyTCM) sub) , text "ip =" <+> do prettyList $ map (prettyTCM . namedArg) ip , text "ip0 =" <+> do prettyList $ map (prettyTCM . namedArg) ip0 ] reportSDoc "tc.lhs.top" 15 $ nest 2 $ vcat [ text "rho0 =" <+> text (show rho0) ] -- Instantiate the new telescope with the given substitution (delta', perm, rho, instTypes) <- instantiateTel sub newTel reportSDoc "tc.lhs.inst" 12 $ vcat [ sep [ text "instantiateTel" , nest 4 $ brackets $ fsep $ punctuate comma $ map (maybe (text "_") prettyTCM) sub , nest 4 $ prettyTCM newTel ] , nest 2 $ text "delta' =" <+> prettyTCM delta' , nest 2 $ text "perm =" <+> text (show perm) , nest 2 $ text "itypes =" <+> fsep (punctuate comma $ map prettyTCM instTypes) ] {- -- Andreas, 2010-09-09 -- temporary error message to find non-id perms let sorted (Perm _ xs) = xs == List.sort xs unless (sorted (perm)) $ typeError $ GenericError $ "detected proper permutation " ++ show perm -} -- Compute the new dot pattern instantiations let ps0' = problemInPat p0 ++ qs' ++ problemInPat (absBody p1) reportSDoc "tc.lhs.top" 15 $ nest 2 $ vcat [ text "subst rho sub =" <+> brackets (fsep $ punctuate comma $ map (maybe (text "_") prettyTCM) (applySubst rho sub)) , text "ps0' =" <+> brackets (fsep $ punctuate comma $ map prettyA ps0') ] newDpi <- dotPatternInsts ps0' (applySubst rho sub) instTypes -- The final dpis and asbs are the new ones plus the old ones substituted by ρ let dpi' = applySubst rho dpi0 ++ newDpi asb' = applySubst rho $ asb0 ++ raise (size delta2) (map (\x -> AsB x (Con c ys) ca) xs) reportSDoc "tc.lhs.top" 15 $ nest 2 $ vcat [ text "dpi' = " <+> brackets (fsep $ punctuate comma $ map prettyTCM dpi') , text "asb' = " <+> brackets (fsep $ punctuate comma $ map prettyTCM asb') ] -- Apply the substitution to the type let sigma' = applySubst rho sigma0 rest' = applySubst rho rest0 reportSDoc "tc.lhs.inst" 15 $ nest 2 $ text "ps0 = " <+> brackets (fsep $ punctuate comma $ map prettyA ps0') -- Permute the in patterns let ps' = permute perm ps0' -- Compute the new permutation of the out patterns. This is the composition of -- the new permutation with the expansion of the old permutation to -- reflect the split. let perm' = expandP hix (size gamma) $ fst (problemOutPat problem) iperm' = perm `composeP` perm' -- Instantiate the out patterns let ip' = instantiatePattern sub perm' ip0 newip = applySubst rho ip' -- Construct the new problem let problem' = Problem ps' (iperm', newip) delta' rest' reportSDoc "tc.lhs.top" 12 $ sep [ text "new problem" , nest 2 $ vcat [ text "ps' = " <+> fsep (map prettyA ps') , text "delta' = " <+> prettyTCM delta' ] ] reportSDoc "tc.lhs.top" 14 $ nest 2 $ vcat [ text "perm' =" <+> text (show perm') , text "iperm' =" <+> text (show iperm') ] reportSDoc "tc.lhs.top" 14 $ nest 2 $ vcat [ text "ip' =" <+> prettyList (map (prettyTCM . namedArg) ip') , text "newip =" <+> prettyList (map (prettyTCM . namedArg) newip) ] reportSDoc "tc.lhs.top" 60 $ nest 2 $ vcat [ text "ip' =" <+> text (show ip') , text "newip =" <+> text (show newip) ] -- if rest type reduces, -- extend the split problem by previously not considered patterns st'@(LHSState problem'@(Problem ps' (iperm', ip') delta' rest') sigma' dpi' asb') <- updateProblemRest $ LHSState problem' sigma' dpi' asb' reportSDoc "tc.lhs.top" 12 $ sep [ text "new problem from rest" , nest 2 $ vcat [ text "ps' = " <+> fsep (map prettyA ps') , text "delta' = " <+> prettyTCM delta' , text "ip' = " <+> prettyList (map (prettyTCM . namedArg) ip') , text "iperm' = " <+> text (show iperm') ] ] return $ Unifies st' -- | Ensures that we are not performing pattern matching on codata. noPatternMatchingOnCodata :: [I.NamedArg Pattern] -> TCM () noPatternMatchingOnCodata = mapM_ (check . namedArg) where check (VarP {}) = return () check (DotP {}) = return () check (ProjP{}) = return () check (LitP {}) = return () -- Literals are assumed not to be coinductive. check (ConP con _ ps) = do TelV _ t <- telView' . defType <$> do getConstInfo $ conName con c <- isCoinductive t case c of Nothing -> __IMPOSSIBLE__ Just False -> mapM_ (check . namedArg) ps Just True -> typeError $ GenericError "Pattern matching on coinductive types is not allowed" Agda-2.4.2.5/src/full/Agda/TypeChecking/Rules/Decl.hs-boot0000644000000000000000000000066612635075266021130 0ustar0000000000000000 module Agda.TypeChecking.Rules.Decl where import Data.Map (Map) import Agda.Syntax.Info (ModuleInfo) import Agda.Syntax.Abstract (QName, Declaration, ModuleName, ModuleApplication, Ren) import Agda.TypeChecking.Monad (TCM) checkDecls :: [Declaration] -> TCM () checkDecl :: Declaration -> TCM () checkSectionApplication :: ModuleInfo -> ModuleName -> ModuleApplication -> Ren QName -> Ren ModuleName -> TCM () Agda-2.4.2.5/src/full/Agda/TypeChecking/Rules/Def.hs-boot0000644000000000000000000000065712635075266020757 0ustar0000000000000000module Agda.TypeChecking.Rules.Def where import Agda.Syntax.Abstract import Agda.Syntax.Common import Agda.Syntax.Info import Agda.TypeChecking.Monad import qualified Agda.Syntax.Internal as I checkFunDef :: Delayed -> DefInfo -> QName -> [Clause] -> TCM () checkFunDef' :: I.Type -> I.ArgInfo -> Delayed -> Maybe ExtLamInfo -> Maybe QName -> DefInfo -> QName -> [Clause] -> TCM () useTerPragma :: Definition -> TCM Definition Agda-2.4.2.5/src/full/Agda/TypeChecking/Rules/Def.hs0000644000000000000000000007445312635075266020023 0ustar0000000000000000{-# LANGUAGE CPP #-} {-# LANGUAGE PatternGuards #-} module Agda.TypeChecking.Rules.Def where import Prelude hiding (mapM) import Control.Arrow ((***)) import Control.Applicative import Control.Monad.State hiding (forM, mapM) import Control.Monad.Reader hiding (forM, mapM) import Data.Function import Data.List hiding (sort) import Data.Maybe import Data.Traversable import Agda.Syntax.Common import Agda.Syntax.Position import qualified Agda.Syntax.Abstract as A import Agda.Syntax.Internal as I import qualified Agda.Syntax.Info as Info import Agda.Syntax.Fixity import Agda.Syntax.Translation.InternalToAbstract import Agda.Syntax.Info import Agda.TypeChecking.Monad import Agda.TypeChecking.Monad.Builtin (primRefl, primEqualityName) import qualified Agda.TypeChecking.Monad.Benchmark as Bench import Agda.TypeChecking.Constraints import Agda.TypeChecking.Conversion import Agda.TypeChecking.MetaVars import Agda.TypeChecking.Reduce import Agda.TypeChecking.Patterns.Abstract (expandPatternSynonyms) import Agda.TypeChecking.Pretty import Agda.TypeChecking.Substitute import Agda.TypeChecking.Free import Agda.TypeChecking.CheckInternal (checkType) import Agda.TypeChecking.With import Agda.TypeChecking.Telescope import Agda.TypeChecking.Injectivity import Agda.TypeChecking.Irrelevance import Agda.TypeChecking.SizedTypes.Solve import Agda.TypeChecking.RecordPatterns import Agda.TypeChecking.CompiledClause (CompiledClauses(..)) import Agda.TypeChecking.CompiledClause.Compile import Agda.TypeChecking.Rules.Term ( checkExpr, inferExpr, inferExprForWith, checkDontExpandLast, checkTelescope, ConvColor(..) ) import Agda.TypeChecking.Rules.LHS ( checkLeftHandSide, LHSResult(..) ) import {-# SOURCE #-} Agda.TypeChecking.Rules.Decl ( checkDecls ) import Agda.Utils.Except ( MonadError(catchError, throwError) ) import Agda.Utils.Lens import Agda.Utils.Maybe ( whenNothing ) import Agda.Utils.Monad import Agda.Utils.Permutation import Agda.Utils.Size #include "undefined.h" import Agda.Utils.Impossible --------------------------------------------------------------------------- -- * Definitions by pattern matching --------------------------------------------------------------------------- checkFunDef :: Delayed -> Info.DefInfo -> QName -> [A.Clause] -> TCM () checkFunDef delayed i name cs = do -- Get the type and relevance of the function t <- typeOfConst name info <- flip setRelevance defaultArgInfo <$> relOfConst name case isAlias cs t of Just (e, x) -> traceCall (CheckFunDef (getRange i) (qnameName name) cs) $ do -- Andreas, 2012-11-22: if the alias is in an abstract block -- it has been frozen. We unfreeze it to enable type inference. -- See issue 729. whenM (isFrozen x) $ unfreezeMeta x checkAlias t info delayed i name e _ -> checkFunDef' t info delayed Nothing Nothing i name cs -- | A single clause without arguments and without type signature is an alias. isAlias :: [A.Clause] -> Type -> Maybe (A.Expr, MetaId) isAlias cs t = case trivialClause cs of -- if we have just one clause without pattern matching and -- without a type signature, then infer, to allow -- "aliases" for things starting with hidden abstractions Just e | Just x <- isMeta (ignoreSharing $ unEl t) -> Just (e, x) _ -> Nothing where isMeta (MetaV x _) = Just x isMeta _ = Nothing trivialClause [A.Clause (A.LHS i (A.LHSHead f []) []) (A.RHS e) []] = Just e trivialClause _ = Nothing -- | Check a trivial definition of the form @f = e@ checkAlias :: Type -> I.ArgInfo -> Delayed -> Info.DefInfo -> QName -> A.Expr -> TCM () checkAlias t' ai delayed i name e = do reportSDoc "tc.def.alias" 10 $ text "checkAlias" <+> vcat [ text (show name) <+> colon <+> prettyTCM t' , text (show name) <+> equals <+> prettyTCM e ] {- -- Infer the type of the rhs (v, t) <- applyRelevanceToContext (argInfoRelevance ai) $ inferOrCheck e (Just t') -- v <- coerce v t t' -} -- Infer the type of the rhs v <- applyRelevanceToContext (getRelevance ai) $ checkDontExpandLast e t' let t = t' reportSDoc "tc.def.alias" 20 $ text "checkAlias: finished checking" solveSizeConstraints v <- instantiateFull v -- if we omit this, we loop (stdlib: Relation.Binary.Sum) -- or the termination checker might stumble over levels in sorts -- that cannot be converted to expressions without the level built-ins -- (test/succeed/Issue655.agda) -- Add the definition addConstant name $ defaultDefn ai name t $ Function { funClauses = [ Clause -- trivial clause @name = v@ { clauseRange = getRange i , clauseTel = EmptyTel , clausePerm = idP 0 , namedClausePats = [] , clauseBody = Body v , clauseType = Just $ Arg ai t } ] , funCompiled = Just $ Done [] v , funDelayed = delayed , funInv = NotInjective , funAbstr = Info.defAbstract i , funMutual = [] , funProjection = Nothing , funStatic = False , funCopy = False , funTerminates = Nothing , funExtLam = Nothing , funWith = Nothing , funCopatternLHS = False } reportSDoc "tc.def.alias" 20 $ text "checkAlias: leaving" -- | Type check a definition by pattern matching. checkFunDef' :: Type -- ^ the type we expect the function to have -> I.ArgInfo -- ^ is it irrelevant (for instance) -> Delayed -- ^ are the clauses delayed (not unfolded willy-nilly) -> Maybe ExtLamInfo -- ^ does the definition come from an extended lambda -- (if so, we need to know some stuff about lambda-lifted args) -> Maybe QName -- ^ is it a with function (if so, what's the name of the parent function) -> Info.DefInfo -- ^ range info -> QName -- ^ the name of the function -> [A.Clause] -- ^ the clauses to check -> TCM () checkFunDef' t ai delayed extlam with i name cs = traceCall (CheckFunDef (getRange i) (qnameName name) cs) $ do -- TODO!! (qnameName) reportSDoc "tc.def.fun" 10 $ sep [ text "checking body of" <+> prettyTCM name , nest 2 $ text ":" <+> prettyTCM t , nest 2 $ text "full type:" <+> (prettyTCM . defType =<< getConstInfo name) ] cs <- return $ map A.lhsToSpine cs -- Ensure that all clauses have the same number of trailing hidden patterns -- This is necessary since trailing implicits are no longer eagerly inserted. -- Andreas, 2013-10-13 -- Since we have flexible function arity, it is no longer necessary -- to patch clauses to same arity -- cs <- trailingImplicits t cs -- Check the clauses cs <- traceCall NoHighlighting $ do -- To avoid flicker. forM cs $ \ c -> do c <- applyRelevanceToContext (argInfoRelevance ai) $ do checkClause t c -- Andreas, 2013-11-23 do not solve size constraints here yet -- in case we are checking the body of an extended lambda. -- 2014-04-24: The size solver requires each clause to be -- checked individually, since otherwise we get constraints -- in typing contexts which are not prefixes of each other. whenNothing extlam solveSizeConstraints -- Andreas, 2013-10-27 add clause as soon it is type-checked -- TODO: instantiateFull? addClauses name [c] return c -- After checking, remove the clauses again. -- (Otherwise, @checkInjectivity@ loops for issue 801). modifyFunClauses name (const []) -- Check that all clauses have the same number of arguments -- unless (allEqual $ map npats cs) $ typeError DifferentArities -- Andreas, 2013-03-15 disable this check to allow flexible arity (issue 727) reportSDoc "tc.cc" 25 $ do sep [ text "clauses before injectivity test" , nest 2 $ prettyTCM $ map (QNamed name) cs -- broken, reify (QNamed n cl) expect cl to live at top level ] reportSDoc "tc.cc" 60 $ do sep [ text "raw clauses: " , nest 2 $ sep $ map (text . show . QNamed name) cs ] -- Annotate the clauses with which arguments are actually used. cs <- instantiateFull {- =<< mapM rebindClause -} cs -- Andreas, 2010-11-12 -- rebindClause is the identity, and instantiateFull eta-contracts -- removing this eta-contraction fixes issue 361 -- however, Data.Star.Decoration.gmapAll no longer type-checks -- possibly due to missing eta-contraction!? -- Check if the function is injective. -- Andreas, 2015-07-01 we do it here in order to resolve metas -- in mutual definitions, e.g. the U/El definition in succeed/Issue439.agda -- We do it again for the mutual block after polarity analysis, see Rules.Decl. reportSLn "tc.inj.def" 20 $ "checkFunDef': checking injectivity..." inv <- Bench.billTo [Bench.Injectivity] $ checkInjectivity name cs reportSDoc "tc.cc" 15 $ do sep [ text "clauses before compilation" , nest 2 $ sep $ map (prettyTCM . QNamed name) cs ] -- add clauses for the coverage checker (needs to reduce) addClauses name cs -- Coverage check and compile the clauses cc <- Bench.billTo [Bench.Coverage] $ compileClauses (Just (name, t)) cs reportSDoc "tc.cc" 10 $ do sep [ text "compiled clauses of" <+> prettyTCM name , nest 2 $ text (show cc) ] -- Add the definition addConstant name =<< do -- If there was a pragma for this definition, we can set the -- funTerminates field directly. useTerPragma $ defaultDefn ai name t $ Function { funClauses = cs , funCompiled = Just cc , funDelayed = delayed , funInv = inv , funAbstr = Info.defAbstract i , funMutual = [] , funProjection = Nothing , funStatic = False , funCopy = False , funTerminates = Nothing , funExtLam = extlam , funWith = with , funCopatternLHS = isCopatternLHS cs } -- Andreas 2012-02-13: postpone polarity computation until after positivity check -- computePolarity name reportSDoc "tc.def.fun" 10 $ do sep [ text "added " <+> prettyTCM name <+> text ":" , nest 2 $ prettyTCM . defType =<< getConstInfo name ] where npats = size . clausePats -- | Set 'funTerminates' according to termination info in 'TCEnv', -- which comes from a possible termination pragma. useTerPragma :: Definition -> TCM Definition useTerPragma def@Defn{ defName = name, theDef = fun@Function{}} = do tc <- asks envTerminationCheck let terminates = case tc of NonTerminating -> Just False Terminating -> Just True _ -> Nothing reportSLn "tc.fundef" 30 $ unlines $ [ "funTerminates of " ++ show name ++ " set to " ++ show terminates , " tc = " ++ show tc ] return $ def { theDef = fun { funTerminates = terminates }} useTerPragma def = return def -- | Insert some patterns in the in with-clauses LHS of the given RHS insertPatterns :: [A.Pattern] -> A.RHS -> A.RHS insertPatterns pats (A.WithRHS aux es cs) = A.WithRHS aux es (map insertToClause cs) where insertToClause (A.Clause (A.LHS i lhscore ps) rhs ds) = A.Clause (A.LHS i lhscore (pats ++ ps)) (insertPatterns pats rhs) ds insertPatterns pats (A.RewriteRHS qes rhs wh) = A.RewriteRHS qes (insertPatterns pats rhs) wh insertPatterns pats rhs = rhs -- | Parameters for creating a @with@-function. data WithFunctionProblem = NoWithFunction | WithFunction { wfParentName :: QName -- ^ Parent function name. , wfName :: QName -- ^ With function name. , wfParentType :: Type -- ^ Type of the parent function. , wfBeforeTel :: Telescope -- ^ Types of arguments to the with function before the with expressions (needed vars). , wfAfterTel :: Telescope -- ^ Types of arguments to the with function after the with expressions (unneeded vars). , wfExprs :: [Term] -- ^ With expressions. , wfExprTypes :: [Type] -- ^ Types of the with expressions. , wfRHSType :: Type -- ^ Type of the right hand side. , wfParentPats :: [I.NamedArg Pattern] -- ^ Parent patterns. , wfPermSplit :: Permutation -- ^ Permutation resulting from splitting the telescope into needed and unneeded vars. , wfPermParent :: Permutation -- ^ Permutation reordering the variables in the parent pattern. , wfPermFinal :: Permutation -- ^ Final permutation (including permutation for the parent clause). , wfClauses :: [A.Clause] -- ^ The given clauses for the with function } -- | Create a clause body from a term. -- -- As we have type checked the term in the clause telescope, but the final -- body should have bindings in the order of the pattern variables, -- we need to apply the permutation to the checked term. mkBody :: Permutation -> Term -> ClauseBody mkBody perm v = foldr (\ x t -> Bind $ Abs x t) b xs where b = Body $ applySubst (renamingR perm) v xs = [ stringToArgName $ "h" ++ show n | n <- [0 .. permRange perm - 1] ] -- | Type check a function clause. checkClause :: Type -- ^ Type of function defined by this clause. -> A.SpineClause -- ^ Clause. -> TCM Clause -- ^ Type-checked clause. checkClause t c@(A.Clause (A.SpineLHS i x aps withPats) rhs0 wh) = do reportSDoc "tc.with.top" 30 $ text "Checking clause" $$ prettyA c unless (null withPats) $ typeError $ UnexpectedWithPatterns withPats traceCall (CheckClause t c) $ do aps <- expandPatternSynonyms aps checkLeftHandSide (CheckPatternShadowing c) (Just x) aps t $ \ lhsResult@(LHSResult delta ps trhs perm) -> do -- Note that we might now be in irrelevant context, -- in case checkLeftHandSide walked over an irrelevant projection pattern. (body, with) <- checkWhere (unArg trhs) wh $ checkRHS i x aps t lhsResult rhs0 escapeContext (size delta) $ checkWithFunction with reportSDoc "tc.lhs.top" 10 $ escapeContext (size delta) $ vcat [ text "Clause before translation:" , nest 2 $ vcat [ text "delta =" <+> prettyTCM delta , text "perm =" <+> text (show perm) , text "ps =" <+> text (show ps) , text "body =" <+> text (show body) , text "body =" <+> prettyTCM body ] ] return $ Clause { clauseRange = getRange i , clauseTel = killRange delta , clausePerm = perm , namedClausePats = ps , clauseBody = body , clauseType = Just trhs } -- | Type check the @with@ and @rewrite@ lhss and/or the rhs. checkRHS :: LHSInfo -- ^ Range of lhs. -> QName -- ^ Name of function. -> [A.NamedArg A.Pattern] -- ^ Patterns in lhs. -> Type -- ^ Type of function. -> LHSResult -- ^ Result of type-checking patterns -> A.RHS -- ^ Rhs to check. -> TCM (ClauseBody, WithFunctionProblem) checkRHS i x aps t (LHSResult delta ps trhs perm) rhs0 = handleRHS rhs0 where aps' = convColor aps absurdPat = any (containsAbsurdPattern . namedArg) aps handleRHS rhs = case rhs of -- Case: ordinary RHS A.RHS e -> do when absurdPat $ typeError $ AbsurdPatternRequiresNoRHS aps' v <- checkExpr e $ unArg trhs return (mkBody perm v, NoWithFunction) -- Case: no RHS A.AbsurdRHS -> do unless absurdPat $ typeError $ NoRHSRequiresAbsurdPattern aps' return (NoBody, NoWithFunction) -- Case: @rewrite@ A.RewriteRHS [] rhs [] -> handleRHS rhs -- Andreas, 2014-01-17, Issue 1402: -- If the rewrites are discarded since lhs=rhs, then -- we can actually have where clauses. A.RewriteRHS [] rhs wh -> checkWhere (unArg trhs) wh $ handleRHS rhs A.RewriteRHS ((qname,eq):qes) rhs wh -> do -- Action for skipping this rewrite. -- We do not want to create unsolved metas in case of -- a futile rewrite with a reflexive equation. -- Thus, we restore the state in this case, -- unless the rewrite expression contains questionmarks. st <- get let recurse = do st' <- get -- Comparing the whole stInteractionPoints maps is a bit -- wasteful, but we assume -- 1. rewriting with a reflexive equality to happen rarely, -- 2. especially with ?-holes in the rewrite expression -- 3. and a large overall number of ?s. let sameIP = (==) `on` (^.stInteractionPoints) when (sameIP st st') $ put st handleRHS $ A.RewriteRHS qes rhs wh -- Get value and type of rewrite-expression. (proof,t) <- inferExpr eq -- Get the names of builtins EQUALITY and REFL. equality <- primEqualityName Con reflCon [] <- ignoreSharing <$> primRefl -- Check that the type is actually an equality (lhs ≡ rhs) -- and extract lhs, rhs, and their type. t' <- reduce =<< instantiateFull t (rewriteType,rewriteFrom,rewriteTo) <- do case ignoreSharing $ unEl t' of Def equality' [ _level , Apply (Arg (ArgInfo Hidden Relevant _) rewriteType) , Apply (Arg (ArgInfo NotHidden Relevant _) rewriteFrom) , Apply (Arg (ArgInfo NotHidden Relevant _) rewriteTo) ] | equality' == equality -> return (El (getSort t') rewriteType, rewriteFrom, rewriteTo) _ -> do err <- text "Cannot rewrite by equation of type" <+> prettyTCM t' typeError $ GenericDocError err -- Andreas, 2014-05-17 Issue 1110: -- Rewriting with a reflexive equation has no effect, but gives an -- incomprehensible error message about the generated -- with clause. Thus, we rather do simply nothing if -- rewriting with @a ≡ a@ is attempted. let isReflexive = tryConversion $ dontAssignMetas $ equalTerm rewriteType rewriteFrom rewriteTo ifM isReflexive recurse $ {- else -} do -- Transform 'rewrite' clause into a 'with' clause, -- going back to abstract syntax. -- Andreas, 2015-02-09 Issue 1421: kill ranges -- as reify puts in ranges that may point to other files. (rewriteFromExpr,rewriteToExpr,rewriteTypeExpr, proofExpr) <- killRange <$> do disableDisplayForms $ withShowAllArguments $ reify (rewriteFrom, rewriteTo, rewriteType , proof) let (inner, outer) -- the where clauses should go on the inner-most with | null qes = ([], wh) | otherwise = (wh, []) -- Andreas, 2014-03-05 kill range of copied patterns -- since they really do not have a source location. newRhs = A.WithRHS qname [rewriteFromExpr, proofExpr] [A.Clause (A.LHS i (A.LHSHead x (killRange aps)) pats) -- Note: handleRHS (A.RewriteRHS _ eqs _ _) -- is defined by induction on eqs. (A.RewriteRHS qes (insertPatterns pats rhs) inner) outer] cinfo = ConPatInfo ConPCon patNoRange pats = [ A.WildP patNoRange , A.ConP cinfo (AmbQ [conName reflCon]) []] reportSDoc "tc.rewrite.top" 25 $ vcat [ text "rewrite" , text " from = " <+> prettyTCM rewriteFromExpr , text " to = " <+> prettyTCM rewriteToExpr , text " typ = " <+> prettyTCM rewriteType , text " proof = " <+> prettyTCM proofExpr , text " equ = " <+> prettyTCM t' ] handleRHS newRhs -- Case: @with@ A.WithRHS aux es cs -> do reportSDoc "tc.with.top" 15 $ vcat [ text "TC.Rules.Def.checkclause reached A.WithRHS" , sep $ prettyA aux : map (parens . prettyA) es ] reportSDoc "tc.with.top" 20 $ do nfv <- getCurrentModuleFreeVars m <- currentModule sep [ text "with function module:" <+> prettyList (map prettyTCM $ mnameToList m) , text $ "free variables: " ++ show nfv ] -- Infer the types of the with expressions (vs0, as) <- unzip <$> mapM inferExprForWith es (vs, as) <- normalise (vs0, as) -- Andreas, 2012-09-17: for printing delta, -- we should remove it from the context first reportSDoc "tc.with.top" 25 $ escapeContext (size delta) $ vcat [ text "delta =" <+> prettyTCM delta ] reportSDoc "tc.with.top" 25 $ vcat [ text "vs =" <+> prettyTCM vs , text "as =" <+> prettyTCM as , text "perm =" <+> text (show perm) ] -- Split the telescope into the part needed to type the with arguments -- and all the other stuff (delta1, delta2, perm', t', as, vs) <- return $ splitTelForWith delta (unArg trhs) as vs let finalPerm = composeP perm' perm reportSLn "tc.with.top" 75 $ "delta = " ++ show delta -- Andreas, 2012-09-17: for printing delta, -- we should remove it from the context first reportSDoc "tc.with.top" 25 $ escapeContext (size delta) $ vcat [ text "delta1 =" <+> prettyTCM delta1 , text "delta2 =" <+> addCtxTel delta1 (prettyTCM delta2) ] reportSDoc "tc.with.top" 25 $ vcat [ text "perm' =" <+> text (show perm') , text "fPerm =" <+> text (show finalPerm) ] -- Create the body of the original function -- All the context variables us <- getContextArgs let n = size us m = size delta -- First the variables bound outside this definition (us0, us1') = genericSplitAt (n - m) us -- Then permute the rest and grab those needed to for the with arguments (us1, us2) = genericSplitAt (size delta1) $ permute perm' us1' -- Now stuff the with arguments in between and finish with the remaining variables v = Def aux $ map Apply $ us0 ++ us1 ++ (map defaultArg vs0) ++ us2 body = mkBody perm v -- Andreas, 2013-02-26 add with-name to signature for printing purposes addConstant aux =<< do useTerPragma $ Defn defaultArgInfo aux typeDontCare [] [] [] 0 noCompiledRep Nothing emptyFunction -- Andreas, 2013-02-26 separate msgs to see which goes wrong reportSDoc "tc.with.top" 20 $ text " with arguments" <+> do escapeContext (size delta) $ addContext delta1 $ addContext delta2 $ prettyList (map prettyTCM vs) reportSDoc "tc.with.top" 20 $ text " types" <+> do escapeContext (size delta) $ addContext delta1 $ prettyList (map prettyTCM as) reportSDoc "tc.with.top" 20 $ text "with function call" <+> prettyTCM v reportSDoc "tc.with.top" 20 $ text " context" <+> (prettyTCM =<< getContextTelescope) reportSDoc "tc.with.top" 20 $ text " delta" <+> do escapeContext (size delta) $ prettyTCM delta reportSDoc "tc.with.top" 20 $ text " body" <+> (addCtxTel delta $ prettyTCM body) return (body, WithFunction x aux t delta1 delta2 vs as t' ps perm' perm finalPerm cs) checkWithFunction :: WithFunctionProblem -> TCM () checkWithFunction NoWithFunction = return () checkWithFunction (WithFunction f aux t delta1 delta2 vs as b qs perm' perm finalPerm cs) = do reportSDoc "tc.with.top" 10 $ vcat [ text "checkWithFunction" , nest 2 $ vcat [ text "delta1 =" <+> prettyTCM delta1 , text "delta2 =" <+> addCtxTel delta1 (prettyTCM delta2) , text "t =" <+> prettyTCM t , text "as =" <+> addCtxTel delta1 (prettyTCM as) , text "vs =" <+> do addCtxTel delta1 $ addCtxTel delta2 $ prettyTCM vs , text "b =" <+> do addCtxTel delta1 $ addCtxTel delta2 $ prettyTCM b , text "qs =" <+> text (show qs) , text "perm' =" <+> text (show perm') , text "perm =" <+> text (show perm) , text "fperm =" <+> text (show finalPerm) ] ] -- Add the type of the auxiliary function to the signature -- With display forms are closed df <- makeClosed <$> withDisplayForm f aux delta1 delta2 (size as) qs perm' perm reportSLn "tc.with.top" 20 "created with display form" -- Generate the type of the with function delta1 <- normalise delta1 -- Issue 1332: checkInternal is picky about argInfo -- but module application is sloppy. -- We normalise to get rid of Def's coming -- from module applications. candidateType <- withFunctionType delta1 vs as delta2 b reportSDoc "tc.with.type" 10 $ sep [ text "candidate type:", nest 2 $ prettyTCM candidateType ] reportSDoc "tc.with.type" 50 $ sep [ text "candidate type:", nest 2 $ text $ show candidateType ] {- OLD, going through abstract syntax absAuxType <- withShowAllArguments $ disableDisplayForms $ dontReifyInteractionPoints $ reify candidateType reportSDoc "tc.with.type" 15 $ vcat [ text "type of with function:" , nest 2 $ prettyTCM absAuxType ] reportSDoc "tc.with.type" 50 $ vcat [ text "type of with function:" , nest 2 $ text $ show absAuxType ] -- The ranges in the generated type are completely bogus, so we kill them. auxType <- setCurrentRange cs (traceCall NoHighlighting $ -- To avoid flicker. isType_ $ killRange absAuxType) `catchError` \err -> case err of TypeError s e -> put s >> enterClosure e (traceCall (CheckWithFunctionType absAuxType) . typeError) _ -> throwError err -} -- Andreas, 2013-10-21 -- Check generated type directly in internal syntax. absAuxType <- reify candidateType let auxType = candidateType setCurrentRange cs (traceCall NoHighlighting $ -- To avoid flicker. checkType auxType) `catchError` \err -> case err of TypeError s e -> do put s enterClosure e $ do traceCall (CheckWithFunctionType absAuxType) . typeError err -> throwError err case df of OpenThing _ (Display n ts dt) -> reportSDoc "tc.with.top" 20 $ text "Display" <+> fsep [ text (show n) , prettyList $ map prettyTCM ts , prettyTCM dt ] addConstant aux =<< do useTerPragma $ Defn defaultArgInfo aux auxType [] [] [df] 0 noCompiledRep Nothing emptyFunction -- solveSizeConstraints -- Andreas, 2012-10-16 does not seem necessary reportSDoc "tc.with.top" 10 $ sep [ text "added with function" <+> (prettyTCM aux) <+> text "of type" , nest 2 $ prettyTCM auxType , nest 2 $ text "-|" <+> (prettyTCM =<< getContextTelescope) ] -- Construct the body for the with function cs <- return $ map (A.lhsToSpine) cs cs <- buildWithFunction f aux t qs finalPerm (size delta1) (size as) cs cs <- return $ map (A.spineToLhs) cs -- Check the with function checkFunDef' auxType defaultArgInfo NotDelayed Nothing (Just f) info aux cs where info = Info.mkDefInfo (nameConcrete $ qnameName aux) defaultFixity' PublicAccess ConcreteDef (getRange cs) -- | Type check a where clause. checkWhere :: Type -- ^ Type of rhs. -> [A.Declaration] -- ^ Where-declarations to check. -> TCM a -- ^ Continutation. -> TCM a checkWhere trhs ds ret0 = do -- Temporarily add trailing hidden arguments to check where-declarartions. TelV htel _ <- telViewUpTo' (-1) (not . visible) trhs let -- Remove htel after checking ds. ret = escapeContext (size htel) $ ret0 loop ds = case ds of [] -> ret [A.ScopedDecl scope ds] -> withScope_ scope $ loop ds [A.Section _ m tel ds] -> do checkTelescope tel $ \ tel' -> do reportSDoc "tc.def.where" 10 $ text "adding section:" <+> prettyTCM m <+> text (show (size tel')) addSection m verboseS "tc.def.where" 10 $ do dx <- prettyTCM m dtel <- mapM prettyAs tel dtel' <- prettyTCM =<< lookupSection m reportSLn "tc.def.where" 10 $ "checking where section " ++ show dx ++ " " ++ show dtel reportSLn "tc.def.where" 10 $ " actual tele: " ++ show dtel' withCurrentModule m $ checkDecls ds >> ret _ -> __IMPOSSIBLE__ -- Add htel to check ds. addCtxTel htel $ loop ds -- | Check if a pattern contains an absurd pattern. For instance, @suc ()@ containsAbsurdPattern :: A.Pattern -> Bool containsAbsurdPattern p = case p of A.AbsurdP _ -> True A.VarP _ -> False A.WildP _ -> False A.DotP _ _ -> False A.LitP _ -> False A.AsP _ _ p -> containsAbsurdPattern p A.ConP _ _ ps -> any (containsAbsurdPattern . namedArg) ps A.DefP _ _ _ -> False -- projection pattern A.PatternSynP _ _ _ -> __IMPOSSIBLE__ -- False Agda-2.4.2.5/src/full/Agda/TypeChecking/Rules/Term.hs-boot0000644000000000000000000000136712635075266021167 0ustar0000000000000000 module Agda.TypeChecking.Rules.Term where import Agda.Syntax.Common (WithHiding) import qualified Agda.Syntax.Abstract as A import Agda.Syntax.Internal as I import Agda.Syntax.Position import Agda.TypeChecking.Monad.Base import Agda.Utils.Except ( ExceptT ) isType_ :: A.Expr -> TCM Type checkExpr :: A.Expr -> Type -> TCM Term checkArguments :: ExpandHidden -> ExpandInstances -> Range -> [NamedArg A.Expr] -> Type -> Type -> ExceptT (Args, [NamedArg A.Expr], Type) TCM (Args, Type) checkArguments' :: ExpandHidden -> ExpandInstances -> Range -> [NamedArg A.Expr] -> Type -> Type -> (Args -> Type -> TCM Term) -> TCM Term checkPostponedLambda :: I.Arg ([WithHiding Name], Maybe Type) -> A.Expr -> Type -> TCM Term Agda-2.4.2.5/src/full/Agda/TypeChecking/Rules/Term.hs0000644000000000000000000022024312635075266020222 0ustar0000000000000000{-# LANGUAGE CPP #-} {-# LANGUAGE FlexibleInstances #-} {-# LANGUAGE LambdaCase #-} {-# LANGUAGE NamedFieldPuns #-} {-# LANGUAGE NondecreasingIndentation #-} {-# LANGUAGE MultiParamTypeClasses #-} {-# LANGUAGE PatternGuards #-} {-# LANGUAGE ScopedTypeVariables #-} {-# LANGUAGE TupleSections #-} #if __GLASGOW_HASKELL__ >= 710 {-# LANGUAGE FlexibleContexts #-} #endif module Agda.TypeChecking.Rules.Term where import Prelude hiding (null) import Control.Applicative hiding (empty) import Control.Monad.Trans import Control.Monad.Reader import Data.Maybe import Data.Monoid (mappend) import Data.List hiding (sort, null) import qualified Data.Map as Map import Data.Traversable (sequenceA) import Agda.Interaction.Options import Agda.Interaction.Highlighting.Generate (storeDisambiguatedName) import qualified Agda.Syntax.Abstract as A import Agda.Syntax.Abstract.Views as A import qualified Agda.Syntax.Info as A import Agda.Syntax.Concrete.Pretty () -- only Pretty instances import qualified Agda.Syntax.Concrete.Name as C import Agda.Syntax.Common import Agda.Syntax.Fixity import Agda.Syntax.Internal as I import Agda.Syntax.Position import Agda.Syntax.Literal import Agda.Syntax.Scope.Base (emptyScopeInfo) import Agda.Syntax.Translation.InternalToAbstract (reify) import Agda.TypeChecking.Monad import Agda.TypeChecking.Monad.Builtin import Agda.TypeChecking.CompiledClause import Agda.TypeChecking.Constraints import Agda.TypeChecking.Conversion import Agda.TypeChecking.Datatypes import Agda.TypeChecking.EtaContract import Agda.TypeChecking.Free (isBinderUsed) import Agda.TypeChecking.Implicit import Agda.TypeChecking.InstanceArguments import Agda.TypeChecking.Irrelevance import Agda.TypeChecking.Level import Agda.TypeChecking.MetaVars import Agda.TypeChecking.Patterns.Abstract import Agda.TypeChecking.Positivity.Occurrence import Agda.TypeChecking.Pretty import Agda.TypeChecking.Primitive import Agda.TypeChecking.Quote import Agda.TypeChecking.RecordPatterns import Agda.TypeChecking.Records import Agda.TypeChecking.Reduce import Agda.TypeChecking.SizedTypes import Agda.TypeChecking.Substitute import Agda.TypeChecking.Telescope import Agda.TypeChecking.Rules.LHS (checkLeftHandSide, LHSResult(..)) import Agda.TypeChecking.Unquote import {-# SOURCE #-} Agda.TypeChecking.Empty (isEmptyType) import {-# SOURCE #-} Agda.TypeChecking.Rules.Decl (checkSectionApplication) import {-# SOURCE #-} Agda.TypeChecking.Rules.Def (checkFunDef, checkFunDef', useTerPragma) import Agda.Utils.Except ( Error(noMsg, strMsg) , ExceptT , MonadError(catchError, throwError) , runExceptT ) import Agda.Utils.Functor (($>)) import Agda.Utils.Maybe import Agda.Utils.Monad import Agda.Utils.Null import Agda.Utils.Permutation import Agda.Utils.Size import Agda.Utils.Tuple #include "undefined.h" import Agda.Utils.Impossible --------------------------------------------------------------------------- -- * Types --------------------------------------------------------------------------- -- | Check that an expression is a type. isType :: A.Expr -> Sort -> TCM Type isType e s = traceCall (IsTypeCall e s) $ do v <- checkExpr e (sort s) return $ El s v -- | Check that an expression is a type without knowing the sort. isType_ :: A.Expr -> TCM Type isType_ e = traceCall (IsType_ e) $ sharedType <$> do let fallback = isType e =<< do workOnTypes $ newSortMeta case unScope e of A.Fun i (Arg info t) b -> do a <- Dom info <$> isType_ t b <- isType_ b s <- ptsRule a b let t' = El s $ Pi (convColor a) $ NoAbs underscore b noFunctionsIntoSize b t' return t' A.Pi _ tel e | null tel -> isType_ e A.Pi _ tel e -> do (t0, t') <- checkPiTelescope tel $ \ tel -> do t0 <- instantiateFull =<< isType_ e tel <- instantiateFull tel return (t0, telePi tel t0) noFunctionsIntoSize t0 t' return t' A.Set _ n -> do n <- ifM typeInType (return 0) (return n) return $ sort (mkType n) A.App i s (Arg (ArgInfo NotHidden r cs) l) | A.Set _ 0 <- unScope s -> ifNotM hasUniversePolymorphism (typeError $ GenericError "Use --universe-polymorphism to enable level arguments to Set") $ {- else -} do lvl <- levelType -- allow NonStrict variables when checking level -- Set : (NonStrict) Level -> Set\omega n <- levelView =<< do applyRelevanceToContext NonStrict $ checkExpr (namedThing l) lvl return $ sort (Type n) _ -> fallback ptsRule :: (LensSort a, LensSort b) => a -> b -> TCM Sort ptsRule a b = pts <$> reduce (getSort a) <*> reduce (getSort b) -- | Ensure that a (freshly created) function type does not inhabit 'SizeUniv'. -- Precondition: When @noFunctionsIntoSize t tBlame@ is called, -- we are in the context of @tBlame@ in order to print it correctly. -- Not being in context of @t@ should not matter, as we are only -- checking whether its sort reduces to 'SizeUniv'. noFunctionsIntoSize :: Type -> Type -> TCM () noFunctionsIntoSize t tBlame = do reportSDoc "tc.fun" 20 $ do let El s (Pi dom b) = ignoreSharing <$> tBlame sep [ text "created function type " <+> prettyTCM tBlame , text "with pts rule" <+> prettyTCM (getSort dom, getSort b, s) ] s <- reduce $ getSort t when (s == SizeUniv) $ do -- Andreas, 2015-02-14 -- We have constructed a function type in SizeUniv -- which is illegal to prevent issue 1428. typeError $ FunctionTypeInSizeUniv $ unEl tBlame -- | Check that an expression is a type which is equal to a given type. isTypeEqualTo :: A.Expr -> Type -> TCM Type isTypeEqualTo e t = case e of A.ScopedExpr _ e -> isTypeEqualTo e t A.Underscore i | A.metaNumber i == Nothing -> return t e -> workOnTypes $ do t' <- isType e (getSort t) t' <$ leqType t t' leqType_ :: Type -> Type -> TCM () leqType_ t t' = workOnTypes $ leqType t t' {- UNUSED -- | Force a type to be a Pi. Instantiates if necessary. The 'Hiding' is only -- used when instantiating a meta variable. forcePi :: Hiding -> String -> Type -> TCM Type forcePi h name (El s t) = do t' <- reduce t case t' of Pi _ _ -> return $ El s t' _ -> do sa <- newSortMeta sb <- newSortMeta let s' = sLub sa sb a <- newTypeMeta sa x <- freshName_ name let arg = setHiding h $ defaultDom a b <- addCtx x arg $ newTypeMeta sb let ty = El s' $ Pi arg (Abs (show x) b) equalType (El s t') ty ty' <- reduce ty return ty' -} --------------------------------------------------------------------------- -- * Telescopes --------------------------------------------------------------------------- -- | Type check a (module) telescope. -- Binds the variables defined by the telescope. checkTelescope :: A.Telescope -> (Telescope -> TCM a) -> TCM a checkTelescope = checkTelescope' LamNotPi -- | Type check the telescope of a dependent function type. -- Binds the resurrected variables defined by the telescope. -- The returned telescope is unmodified (not resurrected). checkPiTelescope :: A.Telescope -> (Telescope -> TCM a) -> TCM a checkPiTelescope = checkTelescope' PiNotLam -- | Flag to control resurrection on domains. data LamOrPi = LamNotPi -- ^ We are checking a module telescope. -- We pass into the type world to check the domain type. -- This resurrects the whole context. | PiNotLam -- ^ We are checking a telescope in a Pi-type. -- We stay in the term world, but add resurrected -- domains to the context to check the remaining -- domains and codomain of the Pi-type. deriving (Eq, Show) -- | Type check a telescope. Binds the variables defined by the telescope. checkTelescope' :: LamOrPi -> A.Telescope -> (Telescope -> TCM a) -> TCM a checkTelescope' lamOrPi [] ret = ret EmptyTel checkTelescope' lamOrPi (b : tel) ret = checkTypedBindings lamOrPi b $ \tel1 -> checkTelescope' lamOrPi tel $ \tel2 -> ret $ abstract tel1 tel2 -- | Check a typed binding and extends the context with the bound variables. -- The telescope passed to the continuation is valid in the original context. -- -- Parametrized by a flag wether we check a typed lambda or a Pi. This flag -- is needed for irrelevance. checkTypedBindings :: LamOrPi -> A.TypedBindings -> (Telescope -> TCM a) -> TCM a checkTypedBindings lamOrPi (A.TypedBindings i (Arg info b)) ret = checkTypedBinding lamOrPi info b $ \ bs -> ret $ telFromList bs checkTypedBinding :: LamOrPi -> A.ArgInfo -> A.TypedBinding -> (ListTel -> TCM a) -> TCM a checkTypedBinding lamOrPi info (A.TBind i xs e) ret = do -- Andreas, 2011-04-26 irrelevant function arguments may appear -- non-strictly in the codomain type -- 2011-10-04 if flag --experimental-irrelevance is set allowed <- optExperimentalIrrelevance <$> pragmaOptions t <- modEnv lamOrPi allowed $ isType_ e let info' = mapRelevance (modRel lamOrPi allowed) info addContext (xs, convColor (Dom info' t) :: I.Dom Type) $ ret $ bindsWithHidingToTel xs (convColor $ Dom info t) where -- if we are checking a typed lambda, we resurrect before we check the -- types, but do not modify the new context entries -- otherwise, if we are checking a pi, we do not resurrect, but -- modify the new context entries modEnv LamNotPi True = doWorkOnTypes modEnv _ _ = id modRel PiNotLam True = irrToNonStrict modRel _ _ = id checkTypedBinding lamOrPi info (A.TLet _ lbs) ret = do checkLetBindings lbs (ret []) --------------------------------------------------------------------------- -- * Lambda abstractions --------------------------------------------------------------------------- -- | Type check a lambda expression. checkLambda :: I.Arg A.TypedBinding -> A.Expr -> Type -> TCM Term checkLambda (Arg _ (A.TLet _ lbs)) body target = checkLetBindings lbs (checkExpr body target) checkLambda (Arg info (A.TBind _ xs typ)) body target = do reportSLn "tc.term.lambda" 60 $ "checkLambda xs = " ++ show xs let numbinds = length xs TelV tel btyp <- telViewUpTo numbinds target if size tel < numbinds || numbinds /= 1 then dontUseTargetType else useTargetType tel btyp where dontUseTargetType = do -- Checking λ (xs : argsT) → body : target verboseS "tc.term.lambda" 5 $ tick "lambda-no-target-type" -- First check that argsT is a valid type argsT <- workOnTypes $ Dom info <$> isType_ typ -- Andreas, 2015-05-28 Issue 1523 -- If argsT is a SizeLt, it must be non-empty to avoid non-termination. -- TODO: do we need to block checkExpr? checkSizeLtSat $ unDom argsT -- In order to have as much type information as possible when checking -- body, we first unify (xs : argsT) → ?t₁ with the target type. If this -- is inconclusive we need to block the resulting term so we create a -- fresh problem for the check. let tel = telFromList $ bindsWithHidingToTel xs argsT reportSLn "tc.term.lambda" 60 $ "dontUseTargetType tel = " ++ show tel -- DONT USE tel for addContext, as it loses NameIds. -- WRONG: t1 <- addContext tel $ workOnTypes newTypeMeta_ t1 <- addContext (xs, argsT) $ workOnTypes newTypeMeta_ -- Do not coerce hidden lambdas if notVisible info || any notVisible xs then do pid <- newProblem_ $ leqType (telePi tel t1) target -- Now check body : ?t₁ -- WRONG: v <- addContext tel $ checkExpr body t1 v <- addContext (xs, argsT) $ checkExpr body t1 -- Block on the type comparison blockTermOnProblem target (teleLam tel v) pid else do -- Now check body : ?t₁ -- WRONG: v <- addContext tel $ checkExpr body t1 v <- addContext (xs, argsT) $ checkExpr body t1 -- Block on the type comparison coerce (teleLam tel v) (telePi tel t1) target useTargetType tel@(ExtendTel arg (Abs y EmptyTel)) btyp = do verboseS "tc.term.lambda" 5 $ tick "lambda-with-target-type" reportSLn "tc.term.lambda" 60 $ "useTargetType y = " ++ show y -- merge in the hiding info of the TBind info <- return $ mapHiding (mappend h) info unless (getHiding arg == getHiding info) $ typeError $ WrongHidingInLambda target -- Andreas, 2011-10-01 ignore relevance in lambda if not explicitly given let r = getRelevance info r' = getRelevance arg -- relevance of function type when (r == Irrelevant && r' /= r) $ typeError $ WrongIrrelevanceInLambda target -- Andreas, 2015-05-28 Issue 1523 -- Ensure we are not stepping under a possibly non-existing size. -- TODO: do we need to block checkExpr? let a = unDom arg checkSizeLtSat a -- We only need to block the final term on the argument type -- comparison. The body will be blocked if necessary. We still want to -- compare the argument types first, so we spawn a new problem for that -- check. (pid, argT) <- newProblem $ isTypeEqualTo typ a v <- add (notInScopeName y) (Dom (setRelevance r' info) argT) $ checkExpr body btyp blockTermOnProblem target (Lam info $ Abs (nameToArgName x) v) pid where [WithHiding h x] = xs -- Andreas, Issue 630: take name from function type if lambda name is "_" add y dom | isNoName x = addContext (y, dom) | otherwise = addContext (x, dom) useTargetType _ _ = __IMPOSSIBLE__ -- | Checking a lambda whose domain type has already been checked. checkPostponedLambda :: I.Arg ([WithHiding Name], Maybe Type) -> A.Expr -> Type -> TCM Term checkPostponedLambda args@(Arg _ ([] , _ )) body target = do checkExpr body target checkPostponedLambda args@(Arg info (WithHiding h x : xs, mt)) body target = do let postpone _ t = postponeTypeCheckingProblem_ $ CheckLambda args body t lamHiding = mappend h $ getHiding info insertHiddenLambdas lamHiding target postpone $ \ t@(El _ (Pi dom b)) -> do -- Andreas, 2011-10-01 ignore relevance in lambda if not explicitly given let r = getRelevance info -- relevance of lambda r' = getRelevance dom -- relevance of function type info' = setHiding lamHiding $ setRelevance r' info when (r == Irrelevant && r' /= r) $ typeError $ WrongIrrelevanceInLambda target -- We only need to block the final term on the argument type -- comparison. The body will be blocked if necessary. We still want to -- compare the argument types first, so we spawn a new problem for that -- check. mpid <- caseMaybe mt (return Nothing) $ \ ascribedType -> Just <$> do newProblem_ $ leqType (unDom dom) ascribedType -- We type-check the body with the ascribedType given by the user -- to get better error messages. -- Using the type dom from the usage context would be more precise, -- though. let add dom | isNoName x = addContext (absName b, dom) | otherwise = addContext (x, dom) v <- add (maybe dom (dom $>) mt) $ checkPostponedLambda (Arg info (xs, mt)) body $ absBody b let v' = Lam info' $ Abs (nameToArgName x) v maybe (return v') (blockTermOnProblem t v') mpid -- | Insert hidden lambda until the hiding info of the domain type -- matches the expected hiding info. -- Throws 'WrongHidingInLambda' insertHiddenLambdas :: Hiding -- ^ Expected hiding. -> Type -- ^ Expected to be a function type. -> (MetaId -> Type -> TCM Term) -- ^ Continuation on blocked type. -> (Type -> TCM Term) -- ^ Continuation when expected hiding found. -- The continuation may assume that the @Type@ -- is of the form @(El _ (Pi _ _))@. -> TCM Term -- ^ Term with hidden lambda inserted. insertHiddenLambdas h target postpone ret = do -- If the target type is blocked, we postpone, -- because we do not know if a hidden lambda needs to be inserted. ifBlockedType target postpone $ \ t0 -> do let t = ignoreSharing <$> t0 case unEl t of Pi dom b -> do let h' = getHiding dom -- Found expected hiding: return function type. if h == h' then ret t else do -- Found a visible argument but expected a hidden one: -- That's an error, as we cannot insert a visible lambda. if visible h' then typeError $ WrongHidingInLambda target else do -- Otherwise, we found a hidden argument that we can insert. let x = absName b Lam (domInfo dom) . Abs x <$> do addContext (x, dom) $ insertHiddenLambdas h (absBody b) postpone ret _ -> typeError . GenericDocError =<< do text "Expected " <+> prettyTCM target <+> text " to be a function type" -- | @checkAbsurdLambda i h e t@ checks absurd lambda against type @t@. -- Precondition: @e = AbsurdLam i h@ checkAbsurdLambda :: A.ExprInfo -> Hiding -> A.Expr -> Type -> TCM Term checkAbsurdLambda i h e t = do t <- instantiateFull t ifBlockedType t (\ m t' -> postponeTypeCheckingProblem_ $ CheckExpr e t') $ \ t' -> do case ignoreSharing $ unEl t' of Pi dom@(Dom info' a) b | h /= getHiding info' -> typeError $ WrongHidingInLambda t' | not (null $ allMetas a) -> postponeTypeCheckingProblem (CheckExpr e t') $ null . allMetas <$> instantiateFull a | otherwise -> blockTerm t' $ do isEmptyType (getRange i) a -- Add helper function top <- currentModule aux <- qualify top <$> freshName_ (getRange i, absurdLambdaName) -- if we are in irrelevant position, the helper function -- is added as irrelevant rel <- asks envRelevance reportSDoc "tc.term.absurd" 10 $ vcat [ text "Adding absurd function" <+> prettyTCM rel <> prettyTCM aux , nest 2 $ text "of type" <+> prettyTCM t' ] addConstant aux $ Defn (setRelevance rel info') aux t' [Nonvariant] [Unused] (defaultDisplayForm aux) 0 noCompiledRep Nothing $ Function { funClauses = [Clause { clauseRange = getRange e , clauseTel = EmptyTel -- telFromList [fmap ("()",) dom] , clausePerm = Perm 1 [] -- Perm 1 [0] , namedClausePats = [Arg info' $ Named (Just $ unranged $ absName b) $ VarP "()"] , clauseBody = Bind $ NoAbs "()" NoBody , clauseType = Just $ setRelevance rel $ defaultArg $ absBody b } ] , funCompiled = Just Fail , funDelayed = NotDelayed , funInv = NotInjective , funAbstr = ConcreteDef , funMutual = [] , funProjection = Nothing , funStatic = False , funCopy = False , funTerminates = Just True , funExtLam = Nothing , funWith = Nothing , funCopatternLHS = False } -- Andreas 2012-01-30: since aux is lifted to toplevel -- it needs to be applied to the current telescope (issue 557) tel <- getContextTelescope return $ Def aux $ map Apply $ teleArgs tel _ -> typeError $ ShouldBePi t' -- | @checkExtendedLambda i di qname cs e t@ check pattern matching lambda. -- Precondition: @e = ExtendedLam i di qname cs@ checkExtendedLambda :: A.ExprInfo -> A.DefInfo -> QName -> [A.Clause] -> A.Expr -> Type -> TCM Term checkExtendedLambda i di qname cs e t = do t <- instantiateFull t ifBlockedType t (\ m t' -> postponeTypeCheckingProblem_ $ CheckExpr e t') $ \ t -> do j <- currentOrFreshMutualBlock rel <- asks envRelevance let info = setRelevance rel defaultArgInfo -- Andreas, 2013-12-28: add extendedlambda as @Function@, not as @Axiom@; -- otherwise, @addClause@ in @checkFunDef'@ fails (see issue 1009). addConstant qname =<< do useTerPragma $ (defaultDefn info qname t emptyFunction) { defMutual = j } reportSDoc "tc.term.exlam" 20 $ text (show $ A.defAbstract di) <+> text "extended lambda's implementation \"" <> prettyTCM qname <> text "\" has type: " $$ prettyTCM t -- <+> text " where clauses: " <+> text (show cs) args <- getContextArgs freevars <- getCurrentModuleFreeVars let argsNoParam = genericDrop freevars args -- don't count module parameters let (hid, notHid) = partition isHidden argsNoParam reportSDoc "tc.term.exlam" 30 $ vcat $ [ text "dropped args: " <+> prettyTCM (take freevars args) , text "hidden args: " <+> prettyTCM hid , text "visible args: " <+> prettyTCM notHid ] abstract (A.defAbstract di) $ checkFunDef' t info NotDelayed (Just $ ExtLamInfo (length hid) (length notHid)) Nothing di qname cs return $ Def qname $ map Apply args where -- Concrete definitions cannot use information about abstract things. abstract ConcreteDef = inConcreteMode abstract AbstractDef = inAbstractMode --------------------------------------------------------------------------- -- * Records --------------------------------------------------------------------------- -- | @checkRecordExpression fs e t@ checks record construction against type @t@. -- Precondition @e = Rec _ fs@. checkRecordExpression :: A.Assigns -> A.Expr -> Type -> TCM Term checkRecordExpression fs e t = do reportSDoc "tc.term.rec" 10 $ sep [ text "checking record expression" , prettyA e ] ifBlockedType t (\ _ t -> guessRecordType t) {-else-} $ \ t -> do case ignoreSharing $ unEl t of -- Case: We know the type of the record already. Def r es -> do let ~(Just vs) = allApplyElims es reportSDoc "tc.term.rec" 20 $ text $ " r = " ++ show r reportSDoc "tc.term.rec" 30 $ text " xs = " <> do text =<< show . map unArg <$> getRecordFieldNames r reportSDoc "tc.term.rec" 30 $ text " ftel= " <> do prettyTCM =<< getRecordFieldTypes r reportSDoc "tc.term.rec" 30 $ text " con = " <> do text =<< show <$> getRecordConstructor r def <- getRecordDef r let -- Field names with ArgInfo. axs = recordFieldNames def -- Just field names. xs = map unArg axs -- Record constructor. con = killRange $ recConHead def reportSDoc "tc.term.rec" 20 $ vcat [ text $ " xs = " ++ show xs , text " ftel= " <> prettyTCM (recTel def) , text $ " con = " ++ show con ] -- Compute the list of given fields, decorated with the ArgInfo from the record def. let arg x e = case [ a | a <- axs, unArg a == x ] of [a] -> unnamed e <$ a _ -> defaultNamedArg e -- we only end up here if the field names are bad givenFields = [ (x, Just $ arg x e) | (x, e) <- fs ] -- Compute a list of metas for the missing visible fields. scope <- getScope let re = getRange e meta x = A.Underscore $ A.MetaInfo re scope Nothing (show x) missingExplicits = [ (unArg a, Just $ unnamed . meta <$> a) | a <- axs, notHidden a , notElem (unArg a) (map fst fs) ] -- In es omitted explicit fields are replaced by underscores -- (from missingExplicits). Omitted implicit or instance fields -- are still left out and inserted later by checkArguments_. es <- catMaybes <$> do -- Default value @Nothing@ will only be used for missing hidden fields. -- These can be ignored as they will be inserted by @checkArguments_@. orderFields r Nothing xs $ givenFields ++ missingExplicits args <- checkArguments_ ExpandLast re es (recTel def `apply` vs) >>= \case (args, remainingTel) | null remainingTel -> return args _ -> __IMPOSSIBLE__ -- Don't need to block here! reportSDoc "tc.term.rec" 20 $ text $ "finished record expression" return $ Con con args _ -> typeError $ ShouldBeRecordType t where guessRecordType t = do let fields = map fst fs rs <- findPossibleRecords fields case rs of -- If there are no records with the right fields we might as well fail right away. [] -> case fs of [] -> typeError $ GenericError "There are no records in scope" [(f, _)] -> typeError $ GenericError $ "There is no known record with the field " ++ show f _ -> typeError $ GenericError $ "There is no known record with the fields " ++ unwords (map show fields) -- If there's only one record with the appropriate fields, go with that. [r] -> do def <- getConstInfo r let rt = defType def vs <- newArgsMeta rt target <- reduce $ piApply rt vs s <- case ignoreSharing $ unEl target of Level l -> return $ Type l Sort s -> return s v -> do reportSDoc "impossible" 10 $ vcat [ text "The impossible happened when checking record expression against meta" , text "Candidate record type r = " <+> prettyTCM r , text "Type of r = " <+> prettyTCM rt , text "Ends in (should be sort)= " <+> prettyTCM v , text $ " Raw = " ++ show v ] __IMPOSSIBLE__ let inferred = El s $ Def r $ map Apply vs v <- checkExpr e inferred coerce v inferred t -- Andreas 2012-04-21: OLD CODE, WRONG DIRECTION, I GUESS: -- blockTerm t $ v <$ leqType_ t inferred -- If there are more than one possible record we postpone _:_:_ -> do reportSDoc "tc.term.expr.rec" 10 $ sep [ text "Postponing type checking of" , nest 2 $ prettyA e <+> text ":" <+> prettyTCM t ] postponeTypeCheckingProblem_ $ CheckExpr e t -- | @checkRecordUpdate ei recexpr fs e t@ -- Precondition @e = RecUpdate ei recexpr fs@. checkRecordUpdate :: A.ExprInfo -> A.Expr -> A.Assigns -> A.Expr -> Type -> TCM Term checkRecordUpdate ei recexpr fs e t = do case ignoreSharing $ unEl t of Def r vs -> do v <- checkExpr recexpr t name <- freshNoName (getRange recexpr) addLetBinding defaultArgInfo name v t $ do projs <- recFields <$> getRecordDef r axs <- getRecordFieldNames r scope <- getScope let xs = map unArg axs es <- orderFields r Nothing xs $ map (\(x, e) -> (x, Just e)) fs let es' = zipWith (replaceFields name ei) projs es checkExpr (A.Rec ei [ (x, e) | (x, Just e) <- zip xs es' ]) t MetaV _ _ -> do inferred <- inferExpr recexpr >>= reduce . snd case ignoreSharing $ unEl inferred of MetaV _ _ -> postponeTypeCheckingProblem_ $ CheckExpr e t _ -> do v <- checkExpr e inferred coerce v inferred t _ -> typeError $ ShouldBeRecordType t where replaceFields :: Name -> A.ExprInfo -> I.Arg A.QName -> Maybe A.Expr -> Maybe A.Expr replaceFields n ei a@(Arg _ p) Nothing | notHidden a = Just $ A.App ei (A.Def p) $ defaultNamedArg $ A.Var n replaceFields _ _ (Arg _ _) Nothing = Nothing replaceFields _ _ _ (Just e) = Just $ e --------------------------------------------------------------------------- -- * Literal --------------------------------------------------------------------------- checkLiteral :: Literal -> Type -> TCM Term checkLiteral lit t = do t' <- litType lit coerce (Lit lit) t' t --------------------------------------------------------------------------- -- * Terms --------------------------------------------------------------------------- -- | @checkArguments' exph r args t0 t k@ tries @checkArguments exph args t0 t@. -- If it succeeds, it continues @k@ with the returned results. If it fails, -- it registers a postponed typechecking problem and returns the resulting new -- meta variable. -- -- Checks @e := ((_ : t0) args) : t@. checkArguments' :: ExpandHidden -> ExpandInstances -> Range -> [I.NamedArg A.Expr] -> Type -> Type -> (Args -> Type -> TCM Term) -> TCM Term checkArguments' exph expIFS r args t0 t k = do z <- runExceptT $ checkArguments exph expIFS r args t0 t case z of Right (vs, t1) -> k vs t1 -- vs = evaluated args -- t1 = remaining type (needs to be subtype of t) Left (us, es, t0) -> do reportSDoc "tc.term.expr.args" 80 $ sep [ text "postponed checking arguments" , nest 4 $ prettyList (map (prettyA . namedThing . unArg) args) , nest 2 $ text "against" , nest 4 $ prettyTCM t0 ] $$ sep [ text "progress:" , nest 2 $ text "checked" <+> prettyList (map prettyTCM us) , nest 2 $ text "remaining" <+> sep [ prettyList (map (prettyA . namedThing . unArg) es) , nest 2 $ text ":" <+> prettyTCM t0 ] ] postponeTypeCheckingProblem_ (CheckArgs exph expIFS r es t0 t $ \vs t -> k (us ++ vs) t) -- if unsuccessful, postpone checking until t0 unblocks -- | Type check an expression. checkExpr :: A.Expr -> Type -> TCM Term checkExpr e t0 = verboseBracket "tc.term.expr.top" 5 "checkExpr" $ traceCall (CheckExprCall e t0) $ localScope $ doExpandLast $ shared <$> do reportSDoc "tc.term.expr.top" 15 $ text "Checking" <+> sep [ fsep [ prettyTCM e, text ":", prettyTCM t0 ] , nest 2 $ text "at " <+> (text . show =<< getCurrentRange) ] reportSDoc "tc.term.expr.top.detailed" 80 $ text "Checking" <+> fsep [ prettyTCM e, text ":", text (show t0) ] t <- reduce t0 reportSDoc "tc.term.expr.top" 15 $ text " --> " <+> prettyTCM t let scopedExpr (A.ScopedExpr scope e) = setScope scope >> scopedExpr e scopedExpr e = return e e <- scopedExpr e case e of A.ScopedExpr scope e -> __IMPOSSIBLE__ -- setScope scope >> checkExpr e t -- Insert hidden lambda if all of the following conditions are met: -- type is a hidden function type, {x : A} -> B or {{x : A} -> B _ | Pi (Dom info _) b <- ignoreSharing $ unEl t , let h = getHiding info , notVisible h -- expression is not a matching hidden lambda or question mark , not (hiddenLambdaOrHole h e) -> do x <- freshName rx $ notInScopeName $ absName b info <- reify info reportSLn "tc.term.expr.impl" 15 $ "Inserting implicit lambda" checkExpr (A.Lam (A.ExprRange re) (domainFree info x) e) t where re = getRange e rx = caseMaybe (rStart re) noRange $ \ pos -> posToRange pos pos hiddenLambdaOrHole h e = case e of A.AbsurdLam _ h' -> h == h' A.ExtendedLam _ _ _ cls -> any hiddenLHS cls A.Lam _ bind _ -> h == getHiding bind A.QuestionMark{} -> True _ -> False hiddenLHS (A.Clause (A.LHS _ (A.LHSHead _ (a : _)) _) _ _) = notVisible a hiddenLHS _ = False -- a meta variable without arguments: type check directly for efficiency A.QuestionMark i ii -> do reportSDoc "tc.interaction" 20 $ sep [ text "Found interaction point" , text (show ii) , text ":" , prettyTCM t0 ] reportSDoc "tc.interaction" 40 $ sep [ text "Raw:" , text (show t0) ] checkMeta (newQuestionMark ii) t0 i -- Andreas, 2013-05-22 use unreduced type t0! A.Underscore i -> checkMeta (newValueMeta RunMetaOccursCheck) t0 i A.WithApp _ e es -> typeError $ NotImplemented "type checking of with application" -- check |- Set l : t (requires universe polymorphism) A.App i s (Arg ai l) | A.Set _ 0 <- unScope s, visible ai -> ifNotM hasUniversePolymorphism (typeError $ GenericError "Use --universe-polymorphism to enable level arguments to Set") $ {- else -} do lvl <- levelType -- allow NonStrict variables when checking level -- Set : (NonStrict) Level -> Set\omega n <- levelView =<< do applyRelevanceToContext NonStrict $ checkExpr (namedThing l) lvl -- check that Set (l+1) <= t reportSDoc "tc.univ.poly" 10 $ text "checking Set " <+> prettyTCM n <+> text "against" <+> prettyTCM t coerce (Sort $ Type n) (sort $ sSuc $ Type n) t A.App i q (Arg ai e) | A.Quote _ <- unScope q, visible ai -> do let quoted (A.Def x) = return x quoted (A.Proj x) = return x quoted (A.Con (AmbQ [x])) = return x quoted (A.Con (AmbQ xs)) = typeError $ GenericError $ "quote: Ambigous name: " ++ show xs quoted (A.ScopedExpr _ e) = quoted e quoted _ = typeError $ GenericError $ "quote: not a defined name" x <- quoted (namedThing e) ty <- qNameType coerce (quoteName x) ty t | A.QuoteTerm _ <- unScope q -> do (et, _) <- inferExpr (namedThing e) q <- quoteTerm =<< etaContract =<< normalise et ty <- el primAgdaTerm coerce q ty t A.Quote _ -> typeError $ GenericError "quote must be applied to a defined name" A.QuoteTerm _ -> typeError $ GenericError "quoteTerm must be applied to a term" A.Unquote _ -> typeError $ GenericError "unquote must be applied to a term" A.AbsurdLam i h -> checkAbsurdLambda i h e t A.ExtendedLam i di qname cs -> checkExtendedLambda i di qname cs e t A.Lam i (A.DomainFull (A.TypedBindings _ b)) e -> checkLambda (convColor b) e t A.Lam i (A.DomainFree info x) e0 -> checkExpr (A.Lam i (domainFree info x) e0) t A.Lit lit -> checkLiteral lit t A.Let i ds e -> checkLetBindings ds $ checkExpr e t A.Pi _ tel e | null tel -> checkExpr e t A.Pi _ tel e -> do (t0, t') <- checkPiTelescope tel $ \ tel -> do t0 <- instantiateFull =<< isType_ e tel <- instantiateFull tel return (t0, telePi tel t0) noFunctionsIntoSize t0 t' let s = getSort t' v = unEl t' when (s == Inf) $ reportSDoc "tc.term.sort" 20 $ vcat [ text ("reduced to omega:") , nest 2 $ text "t =" <+> prettyTCM t' , nest 2 $ text "cxt =" <+> (prettyTCM =<< getContextTelescope) ] coerce v (sort s) t A.Fun _ (Arg info a) b -> do a' <- isType_ a b' <- isType_ b s <- ptsRule a' b' let v = Pi (convColor $ Dom info a') (NoAbs underscore b') noFunctionsIntoSize b' $ El s v coerce v (sort s) t A.Set _ n -> do n <- ifM typeInType (return 0) (return n) coerce (Sort $ mkType n) (sort $ mkType $ n + 1) t A.Prop _ -> do typeError $ GenericError "Prop is no longer supported" A.Rec _ fs -> checkRecordExpression fs e t A.RecUpdate ei recexpr fs -> checkRecordUpdate ei recexpr fs e t A.DontCare e -> -- resurrect vars ifM ((Irrelevant ==) <$> asks envRelevance) (dontCare <$> do applyRelevanceToContext Irrelevant $ checkExpr e t) (internalError "DontCare may only appear in irrelevant contexts") e0@(A.QuoteGoal _ x e) -> do t' <- etaContract =<< normalise t let metas = allMetas t' case metas of _:_ -> postponeTypeCheckingProblem (CheckExpr e0 t') $ andM $ map isInstantiatedMeta metas [] -> do quoted <- quoteTerm (unEl t') tmType <- agdaTermType (v, ty) <- addLetBinding defaultArgInfo x quoted tmType (inferExpr e) blockTerm t' $ coerce v ty t' e0@(A.QuoteContext _ x e) -> do ctx <- getContext thisModule <- currentModule -- Disabled let bindings for now, as there is no way to get your hands on the -- associated terms using the current reflection mechanism. -- lets <- envLetBindings <$> ask -- let letNames = map (quoteName . qualify thisModule) $ Map.keys lets let contextNames = map (\(Dom _ (nm,_)) -> quoteName $ qualify thisModule nm) ctx let names = contextNames -- ++ letNames nameList <- buildList <*> return names ctxType <- el (list primQName) (v, ctxType) <- addLetBinding defaultArgInfo x nameList ctxType (inferExpr e) blockTerm t $ coerce v ctxType t A.ETel _ -> __IMPOSSIBLE__ -- Application _ | Application hd args <- appView e -> checkApplication hd args e t -- | @checkApplication hd args e t@ checks an application. -- Precondition: @Application hs args = appView e@ -- -- @checkApplication@ disambiguates constructors -- (and continues to 'checkConstructorApplication') -- and resolves pattern synonyms. checkApplication :: A.Expr -> A.Args -> A.Expr -> Type -> TCM Term checkApplication hd args e t = do case hd of -- Subcase: ambiguous constructor A.Con (AmbQ cs@(_:_:_)) -> do -- First we should figure out which constructor we want. reportSLn "tc.check.term" 40 $ "Ambiguous constructor: " ++ show cs -- Get the datatypes of the various constructors let getData Constructor{conData = d} = d getData _ = __IMPOSSIBLE__ reportSLn "tc.check.term" 40 $ " ranges before: " ++ show (getRange cs) -- We use the reduced constructor when disambiguating, but -- the original constructor for type checking. This is important -- since they may have different types (different parameters). -- See issue 279. cons <- mapM getConForm cs reportSLn "tc.check.term" 40 $ " reduced: " ++ show cons dcs <- zipWithM (\ c con -> (, setConName c con) . getData . theDef <$> getConInfo con) cs cons -- Type error let badCon t = typeError $ DoesNotConstructAnElementOf (head cs) t -- Lets look at the target type at this point let getCon :: TCM (Maybe ConHead) getCon = do TelV tel t1 <- telView t addCtxTel tel $ do reportSDoc "tc.check.term.con" 40 $ nest 2 $ text "target type: " <+> prettyTCM t1 ifBlockedType t1 (\ m t -> return Nothing) $ \ t' -> caseMaybeM (isDataOrRecord $ unEl t') (badCon t') $ \ d -> case [ c | (d', c) <- dcs, d == d' ] of [c] -> do reportSLn "tc.check.term" 40 $ " decided on: " ++ show c storeDisambiguatedName $ conName c return $ Just c [] -> badCon $ t' $> Def d [] cs -> typeError $ CantResolveOverloadedConstructorsTargetingSameDatatype d $ map conName cs let unblock = isJust <$> getCon -- to unblock, call getCon later again mc <- getCon case mc of Just c -> checkConstructorApplication e t c $ map convColor args Nothing -> postponeTypeCheckingProblem (CheckExpr e t) unblock -- Subcase: non-ambiguous constructor A.Con (AmbQ [c]) -> do -- augment c with record fields, but do not revert to original name con <- getOrigConHead c checkConstructorApplication e t con $ map convColor args -- Subcase: pattern synonym A.PatternSyn n -> do (ns, p) <- lookupPatternSyn n p <- setRange (getRange n) . killRange <$> expandPatternSynonyms p -- expand recursive pattern synonyms -- Expand the pattern synonym by substituting for -- the arguments we have got and lambda-lifting -- over the ones we haven't. let meta r = A.Underscore $ A.emptyMetaInfo{ A.metaRange = r } -- TODO: name suggestion case A.insertImplicitPatSynArgs meta (getRange n) ns args of Nothing -> typeError $ BadArgumentsToPatternSynonym n Just (s, ns) -> do let p' = A.patternToExpr p e' = A.lambdaLiftExpr (map unArg ns) (A.substExpr s p') checkExpr e' t -- Subcase: unquote A.Unquote _ | [arg] <- args -> do e <- unquoteTerm (namedArg arg) checkExpr e t | arg : args <- args -> do e <- unquoteTerm (namedArg arg) checkHeadApplication e t e $ map convColor args where unquoteTerm qv = do qv <- checkExpr qv =<< el primAgdaTerm mv <- runUnquoteM $ unquote qv case mv of Left err -> typeError $ UnquoteFailed err Right v -> do e <- reifyUnquoted (v :: Term) reportSDoc "tc.unquote.term" 10 $ vcat [ text "unquote" <+> prettyTCM qv , nest 2 $ text "-->" <+> prettyA e ] return (killRange e) -- Subcase: defined symbol or variable. _ -> checkHeadApplication e t hd $ map convColor args -- | Turn a domain-free binding (e.g. lambda) into a domain-full one, -- by inserting an underscore for the missing type. domainFree :: A.ArgInfo -> A.Name -> A.LamBinding domainFree info x = A.DomainFull $ A.TypedBindings r $ Arg info $ A.TBind r [pure x] $ A.Underscore underscoreInfo where r = getRange x underscoreInfo = A.MetaInfo { A.metaRange = r , A.metaScope = emptyScopeInfo , A.metaNumber = Nothing , A.metaNameSuggestion = show $ A.nameConcrete x } --------------------------------------------------------------------------- -- * Meta variables --------------------------------------------------------------------------- checkMeta :: (Type -> TCM Term) -> Type -> A.MetaInfo -> TCM Term checkMeta newMeta t i = fst <$> checkOrInferMeta newMeta (Just t) i inferMeta :: (Type -> TCM Term) -> A.MetaInfo -> TCM (Args -> Term, Type) inferMeta newMeta i = mapFst apply <$> checkOrInferMeta newMeta Nothing i -- | Type check a meta variable. -- If its type is not given, we return its type, or a fresh one, if it is a new meta. -- If its type is given, we check that the meta has this type, and we return the same -- type. checkOrInferMeta :: (Type -> TCM Term) -> Maybe Type -> A.MetaInfo -> TCM (Term, Type) checkOrInferMeta newMeta mt i = do case A.metaNumber i of Nothing -> do setScope (A.metaScope i) t <- maybe (workOnTypes $ newTypeMeta_) return mt v <- newMeta t setValueMetaName v (A.metaNameSuggestion i) return (v, t) -- Rechecking an existing metavariable Just x -> do let v = MetaV x [] t' <- jMetaType . mvJudgement <$> lookupMeta x case mt of Nothing -> return (v, t') Just t -> (,t) <$> coerce v t' t --------------------------------------------------------------------------- -- * Applications --------------------------------------------------------------------------- inferHeadDef :: QName -> TCM (Args -> Term, Type) inferHeadDef x = do proj <- isProjection x let app = case proj of Nothing -> \ f args -> return $ Def f $ map Apply args Just p -> \ f args -> return $ projDropPars p `apply` args mapFst apply <$> inferDef app x -- | Infer the type of a head thing (variable, function symbol, or constructor). -- We return a function that applies the head to arguments. -- This is because in case of a constructor we want to drop the parameters. inferHead :: A.Expr -> TCM (Args -> Term, Type) inferHead e = do case e of (A.Var x) -> do -- traceCall (InferVar x) $ do (u, a) <- getVarInfo x when (unusableRelevance $ getRelevance a) $ typeError $ VariableIsIrrelevant x return (apply u, unDom a) (A.Def x) -> inferHeadDef x (A.Proj x) -> inferHeadDef x (A.Con (AmbQ [c])) -> do -- Constructors are polymorphic internally. -- So, when building the constructor term -- we should throw away arguments corresponding to parameters. -- First, inferDef will try to apply the constructor -- to the free parameters of the current context. We ignore that. (u, a) <- inferDef (\ c _ -> getOrigConTerm c) c -- Next get the number of parameters in the current context. Constructor{conPars = n} <- theDef <$> (instantiateDef =<< getConstInfo c) reportSLn "tc.term.con" 7 $ unwords [show c, "has", show n, "parameters."] -- So when applying the constructor throw away the parameters. return (apply u . genericDrop n, a) (A.Con _) -> __IMPOSSIBLE__ -- inferHead will only be called on unambiguous constructors (A.QuestionMark i ii) -> inferMeta (newQuestionMark ii) i (A.Underscore i) -> inferMeta (newValueMeta RunMetaOccursCheck) i e -> do (term, t) <- inferExpr e return (apply term, t) inferDef :: (QName -> Args -> TCM Term) -> QName -> TCM (Term, Type) inferDef mkTerm x = traceCall (InferDef (getRange x) x) $ do -- getConstInfo retrieves the *absolute* (closed) type of x -- instantiateDef relativizes it to the current context d <- instantiateDef =<< getConstInfo x -- irrelevant defs are only allowed in irrelevant position let drel = defRelevance d when (drel /= Relevant) $ do rel <- asks envRelevance reportSDoc "tc.irr" 50 $ vcat [ text "declaration relevance =" <+> text (show drel) , text "context relevance =" <+> text (show rel) ] unless (drel `moreRelevant` rel) $ typeError $ DefinitionIsIrrelevant x -- since x is considered living in the top-level, we have to -- apply it to the current context vs <- freeVarsToApply x reportSDoc "tc.term.def" 10 $ do text "inferred def " <+> prettyTCM x <+> hsep (map prettyTCM vs) let t = defType d reportSDoc "tc.term.def" 10 $ nest 2 $ text " : " <+> prettyTCM t v <- mkTerm x vs reportSDoc "tc.term.def" 10 $ nest 2 $ text " --> " <+> prettyTCM v return (v, t) -- | Check the type of a constructor application. This is easier than -- a general application since the implicit arguments can be inserted -- without looking at the arguments to the constructor. checkConstructorApplication :: A.Expr -> Type -> ConHead -> [I.NamedArg A.Expr] -> TCM Term checkConstructorApplication org t c args = do reportSDoc "tc.term.con" 50 $ vcat [ text "entering checkConstructorApplication" , nest 2 $ vcat [ text "org =" <+> prettyTCM org , text "t =" <+> prettyTCM t , text "c =" <+> prettyTCM c , text "args =" <+> prettyTCM args ] ] let paramsGiven = checkForParams args if paramsGiven then fallback else do reportSDoc "tc.term.con" 50 $ text "checkConstructorApplication: no parameters explicitly supplied, continuing..." cdef <- getConInfo c let Constructor{conData = d} = theDef cdef reportSDoc "tc.term.con" 50 $ nest 2 $ text "d =" <+> prettyTCM d -- Issue 661: t maybe an evaluated form of d .., so we evaluate d -- as well and then check wether we deal with the same datatype t0 <- reduce (Def d []) case (ignoreSharing t0, ignoreSharing $ unEl t) of -- Only fully applied constructors get special treatment (Def d0 _, Def d' es) -> do let ~(Just vs) = allApplyElims es reportSDoc "tc.term.con" 50 $ nest 2 $ text "d0 =" <+> prettyTCM d0 reportSDoc "tc.term.con" 50 $ nest 2 $ text "d' =" <+> prettyTCM d' reportSDoc "tc.term.con" 50 $ nest 2 $ text "vs =" <+> prettyTCM vs if d' /= d0 then fallback else do -- Issue 661: d' may take more parameters than d, in particular -- these additional parameters could be a module parameter telescope. -- Since we get the constructor type ctype from d but the parameters -- from t = Def d' vs, we drop the additional parameters. npars <- getNumberOfParameters d npars' <- getNumberOfParameters d' caseMaybe (sequenceA $ List2 (npars, npars')) fallback $ \ (List2 (n,n')) -> do reportSDoc "tc.term.con" 50 $ nest 2 $ text $ "n = " ++ show n reportSDoc "tc.term.con" 50 $ nest 2 $ text $ "n' = " ++ show n' when (n > n') -- preprocessor does not like ', so put on next line __IMPOSSIBLE__ let ps = genericTake n $ genericDrop (n' - n) vs ctype = defType cdef reportSDoc "tc.term.con" 20 $ vcat [ text "special checking of constructor application of" <+> prettyTCM c , nest 2 $ vcat [ text "ps =" <+> prettyTCM ps , text "ctype =" <+> prettyTCM ctype ] ] let ctype' = ctype `piApply` ps reportSDoc "tc.term.con" 20 $ nest 2 $ text "ctype' =" <+> prettyTCM ctype' -- get the parameter names TelV ptel _ <- telViewUpTo n ctype let pnames = map (fst . unDom) $ telToList ptel -- drop the parameter arguments args' = dropArgs pnames args -- check the non-parameter arguments expandLast <- asks envExpandLast checkArguments' expandLast ExpandInstanceArguments (getRange c) args' ctype' t $ \us t' -> do reportSDoc "tc.term.con" 20 $ nest 2 $ vcat [ text "us =" <+> prettyTCM us , text "t' =" <+> prettyTCM t' ] coerce (Con c us) t' t _ -> do reportSDoc "tc.term.con" 50 $ nest 2 $ text "we are not at a datatype, falling back" fallback where fallback = checkHeadApplication org t (A.Con (AmbQ [conName c])) args -- Check if there are explicitly given hidden arguments, -- in which case we fall back to default type checking. -- We could work harder, but let's not for now. -- -- Andreas, 2012-04-18: if all inital args are underscores, ignore them checkForParams args = let (hargs, rest) = span isHidden args notUnderscore A.Underscore{} = False notUnderscore _ = True in any notUnderscore $ map (unScope . namedArg) hargs -- Drop the constructor arguments that correspond to parameters. dropArgs [] args = args dropArgs ps [] = args dropArgs ps args@(arg : _) | not (isHidden arg) = args dropArgs (p:ps) args@(arg : args') | elem name [Nothing, Just p] = dropArgs ps args' | otherwise = dropArgs ps args where name = fmap rangedThing . nameOf $ unArg arg {- UNUSED CODE, BUT DON'T REMOVE (2012-04-18) -- Split the arguments to a constructor into those corresponding -- to parameters and those that don't. Dummy underscores are inserted -- for parameters that are not given explicitly. splitArgs [] args = ([], args) splitArgs ps [] = (map (const dummyUnderscore) ps, args) splitArgs ps args@(Arg NotHidden _ _ : _) = (map (const dummyUnderscore) ps, args) splitArgs (p:ps) (arg : args) | elem mname [Nothing, Just p] = (arg :) *** id $ splitArgs ps args | otherwise = (dummyUnderscore :) *** id $ splitArgs ps (arg:args) where mname = nameOf (unArg arg) dummyUnderscore = Arg Hidden Relevant (unnamed $ A.Underscore $ A.MetaInfo noRange emptyScopeInfo Nothing) -} -- | @checkHeadApplication e t hd args@ checks that @e@ has type @t@, -- assuming that @e@ has the form @hd args@. The corresponding -- type-checked term is returned. -- -- If the head term @hd@ is a coinductive constructor, then a -- top-level definition @fresh tel = hd args@ (where the clause is -- delayed) is added, where @tel@ corresponds to the current -- telescope. The returned term is @fresh tel@. -- -- Precondition: The head @hd@ has to be unambiguous, and there should -- not be any need to insert hidden lambdas. checkHeadApplication :: A.Expr -> Type -> A.Expr -> [I.NamedArg A.Expr] -> TCM Term checkHeadApplication e t hd args = do kit <- coinductionKit case hd of A.Con (AmbQ [c]) | Just c == (nameOfSharp <$> kit) -> do -- Type checking # generated #-wrapper. The # that the user can write will be a Def, -- but the sharp we generate in the body of the wrapper is a Con. defaultResult A.Con (AmbQ [c]) -> do (f, t0) <- inferHead hd reportSDoc "tc.term.con" 5 $ vcat [ text "checkHeadApplication inferred" <+> prettyTCM c <+> text ":" <+> prettyTCM t0 ] expandLast <- asks envExpandLast checkArguments' expandLast ExpandInstanceArguments (getRange hd) args t0 t $ \vs t1 -> do TelV eTel eType <- telView t -- If the expected type @eType@ is a metavariable we have to make -- sure it's instantiated to the proper pi type TelV fTel fType <- telViewUpTo (size eTel) t1 -- We know that the target type of the constructor (fType) -- does not depend on fTel so we can compare fType and eType -- first. when (size eTel > size fTel) $ typeError $ UnequalTypes CmpLeq t1 t -- switch because of contravariance -- Andreas, 2011-05-10 report error about types rather telescopes -- compareTel CmpLeq eTel fTel >> return () -- This will fail! reportSDoc "tc.term.con" 10 $ addCtxTel eTel $ vcat [ text "checking" <+> prettyTCM fType <+> text "?<=" <+> prettyTCM eType ] blockTerm t $ f vs <$ workOnTypes (do addCtxTel eTel $ leqType fType eType compareTel t t1 CmpLeq eTel fTel) (A.Def c) | Just c == (nameOfSharp <$> kit) -> do -- TODO: Handle coinductive constructors under lets. lets <- envLetBindings <$> ask unless (Map.null lets) $ typeError $ NotImplemented "coinductive constructor in the scope of a let-bound variable" arg <- case args of [a] | getHiding a == NotHidden -> return $ namedArg a _ -> typeError $ GenericError $ show c ++ " must be applied to exactly one argument." -- The name of the fresh function. i <- fresh :: TCM Int let name = filter (/= '_') (show $ A.nameConcrete $ A.qnameName c) ++ "-" ++ show i c' <- setRange (getRange c) <$> liftM2 qualify (killRange <$> currentModule) (freshName_ name) kit <- coinductionKit' let flat = nameOfFlat kit inf = nameOfInf kit -- The application of the fresh function to the relevant -- arguments. e' <- Def c' . map Apply <$> getContextArgs -- Add the type signature of the fresh function to the -- signature. -- To make sure we can type check the generated function we have to make -- sure that its type is \inf. The reason for this is that we don't yet -- postpone checking of patterns when we don't know their types (Issue480). forcedType <- do lvl <- levelType l <- newValueMeta RunMetaOccursCheck lvl lv <- levelView l a <- newValueMeta RunMetaOccursCheck (sort $ Type lv) return $ El (Type lv) $ Def inf [Apply $ setHiding Hidden $ defaultArg l, Apply $ defaultArg a] i <- currentOrFreshMutualBlock tel <- getContextTelescope -- If we are in irrelevant position, add definition irrelevantly. -- TODO: is this sufficient? rel <- asks envRelevance addConstant c' =<< do let ai = setRelevance rel defaultArgInfo useTerPragma $ Defn ai c' forcedType [] [] (defaultDisplayForm c') i noCompiledRep Nothing $ emptyFunction -- Define and type check the fresh function. ctx <- getContext >>= mapM (\d -> flip Dom (unDom d) <$> reify (domInfo d)) let info = A.mkDefInfo (A.nameConcrete $ A.qnameName c') defaultFixity' PublicAccess ConcreteDef noRange pats = map (\ (Dom info (n, _)) -> Arg info $ Named Nothing $ A.VarP n) $ reverse ctx core = A.LHSProj { A.lhsDestructor = flat , A.lhsPatsLeft = [] , A.lhsFocus = defaultNamedArg $ A.LHSHead c' pats , A.lhsPatsRight = [] } clause = A.Clause (A.LHS (A.LHSRange noRange) core []) (A.RHS arg) [] reportSDoc "tc.term.expr.coind" 15 $ vcat $ [ text "The coinductive constructor application" , nest 2 $ prettyTCM e , text "was translated into the application" , nest 2 $ prettyTCM e' , text "and the function" , nest 2 $ prettyTCM rel <> prettyTCM c' <+> text ":" , nest 4 $ prettyTCM (telePi tel t) , nest 2 $ prettyA clause <> text "." ] inTopContext $ checkFunDef NotDelayed info c' [clause] reportSDoc "tc.term.expr.coind" 15 $ do def <- theDef <$> getConstInfo c' text "The definition is" <+> text (show $ funDelayed def) <> text "." blockTerm t $ e' <$ workOnTypes (leqType forcedType t) A.Con _ -> __IMPOSSIBLE__ _ -> defaultResult where defaultResult = do (f, t0) <- inferHead hd expandLast <- asks envExpandLast checkArguments' expandLast ExpandInstanceArguments (getRange hd) args t0 t $ \vs t1 -> do coerce (f vs) t1 t traceCallE :: Error e => Call -> ExceptT e TCM r -> ExceptT e TCM r traceCallE call m = do z <- lift $ traceCall call $ runExceptT m case z of Right e -> return e Left err -> throwError err -- | Check a list of arguments: @checkArgs args t0 t1@ checks that -- @t0 = Delta -> t0'@ and @args : Delta@. Inserts hidden arguments to -- make this happen. Returns the evaluated arguments @vs@, the remaining -- type @t0'@ (which should be a subtype of @t1@) and any constraints @cs@ -- that have to be solved for everything to be well-formed. checkArguments :: ExpandHidden -> ExpandInstances -> Range -> [I.NamedArg A.Expr] -> Type -> Type -> ExceptT (Args, [I.NamedArg A.Expr], Type) TCM (Args, Type) -- Case: no arguments, do not insert trailing hidden arguments: We are done. checkArguments DontExpandLast DontExpandInstanceArguments _ [] t0 t1 = return ([], t0) -- Case: no arguments, but need to insert trailing hiddens. checkArguments exh expandIFS r [] t0 t1 = traceCallE (CheckArguments r [] t0 t1) $ lift $ do t1' <- unEl <$> reduce t1 implicitArgs (-1) (expand t1') t0 where expand (Pi (Dom info _) _) Hidden = getHiding info /= Hidden && exh == ExpandLast expand _ Hidden = exh == ExpandLast expand (Pi (Dom info _) _) Instance = getHiding info /= Instance && expandIFS == ExpandInstanceArguments expand _ Instance = expandIFS == ExpandInstanceArguments expand _ NotHidden = False -- Case: argument given. checkArguments exh expandIFS r args0@(arg@(Arg info e) : args) t0 t1 = traceCallE (CheckArguments r args0 t0 t1) $ do lift $ reportSDoc "tc.term.args" 30 $ sep [ text "checkArguments" -- , text " args0 =" <+> prettyA args0 , nest 2 $ vcat [ text "e =" <+> prettyA e , text "t0 =" <+> prettyTCM t0 , text "t1 =" <+> prettyTCM t1 ] ] -- First, insert implicit arguments, depending on current argument @arg@. let hx = getHiding info -- hiding of current argument mx = fmap rangedThing $ nameOf e -- name of current argument -- do not insert visible arguments expand NotHidden y = False -- insert a hidden argument if arg is not hidden or has different name -- insert an instance argument if arg is not instance or has different name expand hy y = hy /= hx || maybe False (y /=) mx (nargs, t) <- lift $ implicitNamedArgs (-1) expand t0 -- Separate names from args. let (mxs, us) = unzip $ map (\ (Arg ai (Named mx u)) -> (mx, Arg ai u)) nargs xs = catMaybes mxs -- We are done inserting implicit args. Now, try to check @arg@. ifBlockedType t (\ m t -> throwError (us, args0, t)) $ \ t0' -> do -- What can go wrong? -- 1. We ran out of function types. let shouldBePi -- a) It is an explicit argument, but we ran out of function types. | notHidden info = lift $ typeError $ ShouldBePi t0' -- b) It is an implicit argument, and we did not insert any implicits. -- Thus, the type was not a function type to start with. | null xs = lift $ typeError $ ShouldBePi t0' -- c) We did insert implicits, but we ran out of implicit function types. -- Then, we should inform the user that we did not find his one. | otherwise = lift $ typeError $ WrongNamedArgument arg -- 2. We have a function type left, but it is the wrong one. -- Our argument must be implicit, case a) is impossible. -- (Otherwise we would have ran out of function types instead.) let wrongPi info' -- b) We have not inserted any implicits. | null xs = lift $ typeError $ WrongHidingInApplication t0' -- c) We inserted implicits, but did not find his one. | otherwise = lift $ typeError $ WrongNamedArgument arg -- t0' <- lift $ forcePi (getHiding info) (maybe "_" rangedThing $ nameOf e) t0' case ignoreSharing $ unEl t0' of Pi (Dom info' a) b | getHiding info == getHiding info' && (notHidden info || maybe True ((absName b ==) . rangedThing) (nameOf e)) -> do u <- lift $ applyRelevanceToContext (getRelevance info') $ -- Andreas, 2014-05-30 experiment to check non-dependent arguments -- after the spine has been processed. Allows to propagate type info -- from ascribed type into extended-lambdas. Would solve issue 1159. -- However, leaves unsolved type checking problems in the test suite. -- I do not know what I am doing wrong here. -- Could be extreme order-sensitivity or my abuse of the postponing -- mechanism. -- if not $ isBinderUsed b -- then postponeTypeCheckingProblem (CheckExpr (namedThing e) a) (return True) else checkExpr (namedThing e) a -- save relevance info' from domain in argument addCheckedArgs us (Arg info' u) $ checkArguments exh expandIFS (fuseRange r e) args (absApp b u) t1 | otherwise -> wrongPi info' _ -> shouldBePi where addCheckedArgs us u rec = (mapFst ((us ++) . (u :)) <$> rec) `catchError` \(vs, es, t) -> throwError (us ++ u : vs, es, t) -- | Check that a list of arguments fits a telescope. -- Inserts hidden arguments as necessary. -- Returns the type-checked arguments and the remaining telescope. checkArguments_ :: ExpandHidden -- ^ Eagerly insert trailing hidden arguments? -> Range -- ^ Range of application. -> [I.NamedArg A.Expr] -- ^ Arguments to check. -> Telescope -- ^ Telescope to check arguments against. -> TCM (Args, Telescope) -- ^ Checked arguments and remaining telescope if successful. checkArguments_ exh r args tel = do z <- runExceptT $ checkArguments exh ExpandInstanceArguments r args (telePi tel typeDontCare) typeDontCare case z of Right (args, t) -> do let TelV tel' _ = telView' t return (args, tel') Left _ -> __IMPOSSIBLE__ -- type cannot be blocked as it is generated by telePi -- | Infer the type of an expression. Implemented by checking against a meta -- variable. Except for neutrals, for them a polymorphic type is inferred. inferExpr :: A.Expr -> TCM (Term, Type) -- inferExpr e = inferOrCheck e Nothing inferExpr = inferExpr' DontExpandLast inferExpr' :: ExpandHidden -> A.Expr -> TCM (Term, Type) inferExpr' exh e = case e of _ | Application hd args <- appView e, defOrVar hd -> traceCall (InferExpr e) $ do (f, t0) <- inferHead hd res <- runExceptT $ checkArguments exh ExpandInstanceArguments (getRange hd) (map convColor args) t0 (sort Prop) case res of Right (vs, t1) -> return (f vs, t1) Left t1 -> fallback -- blocked on type t1 _ -> fallback where fallback = do t <- workOnTypes $ newTypeMeta_ v <- checkExpr e t return (v,t) defOrVar :: A.Expr -> Bool defOrVar A.Var{} = True defOrVar A.Def{} = True defOrVar A.Proj{} = True defOrVar (A.ScopedExpr _ e) = defOrVar e defOrVar _ = False -- | Used to check aliases @f = e@. -- Switches off 'ExpandLast' for the checking of top-level application. checkDontExpandLast :: A.Expr -> Type -> TCM Term checkDontExpandLast e t = case e of _ | Application hd args <- appView e, defOrVar hd -> traceCall (CheckExprCall e t) $ localScope $ dontExpandLast $ shared <$> do checkApplication hd args e t _ -> checkExpr e t -- note that checkExpr always sets ExpandLast {- Andreas, 2013-03-15 UNUSED, but don't remove inferOrCheck :: A.Expr -> Maybe Type -> TCM (Term, Type) inferOrCheck e mt = case e of _ | Application hd args <- appView e, defOrVar hd -> traceCall (InferExpr e) $ do (f, t0) <- inferHead hd res <- runErrorT $ checkArguments DontExpandLast ExpandInstanceArguments (getRange hd) (map convColor args) t0 $ maybe (sort Prop) id mt case res of Right (vs, t1) -> maybe (return (f vs, t1)) (\ t -> (,t) <$> coerce (f vs) t1 t) mt Left t1 -> fallback -- blocked on type t1 _ -> fallback where fallback = do t <- maybe (workOnTypes $ newTypeMeta_) return mt v <- checkExpr e t return (v,t) -} -- | Check whether a de Bruijn index is bound by a module telescope. isModuleFreeVar :: Int -> TCM Bool isModuleFreeVar i = do nfv <- getCurrentModuleFreeVars n <- getContextSize -- The first de Bruijn index that points to a module -- free variable. let firstModuleVar = n - nfv when (firstModuleVar < 0) __IMPOSSIBLE__ return $ i >= firstModuleVar -- | Infer the type of an expression, and if it is of the form -- @{tel} -> D vs@ for some datatype @D@ then insert the hidden -- arguments. Otherwise, leave the type polymorphic. inferExprForWith :: A.Expr -> TCM (Term, Type) inferExprForWith e = do reportSDoc "tc.with.infer" 20 $ text "inferExprforWith " <+> prettyTCM e reportSLn "tc.with.infer" 80 $ "inferExprforWith " ++ show e traceCall (InferExpr e) $ do -- With wants type and term fully instantiated! (v, t) <- instantiateFull =<< inferExpr e v0 <- reduce v -- Andreas 2014-11-06, issue 1342. -- Check that we do not `with` on a module parameter! case ignoreSharing v0 of Var i [] -> whenM (isModuleFreeVar i) $ typeError $ WithOnFreeVariable e _ -> return () -- Possibly insert hidden arguments. TelV tel t0 <- telViewUpTo' (-1) ((NotHidden /=) . getHiding) t case ignoreSharing $ unEl t0 of Def d vs -> do res <- isDataOrRecordType d case res of Nothing -> return (v, t) Just{} -> do (args, t1) <- implicitArgs (-1) (NotHidden /=) t return (v `apply` args, t1) _ -> return (v, t) --------------------------------------------------------------------------- -- * Let bindings --------------------------------------------------------------------------- checkLetBindings :: [A.LetBinding] -> TCM a -> TCM a checkLetBindings = foldr (.) id . map checkLetBinding checkLetBinding :: A.LetBinding -> TCM a -> TCM a checkLetBinding b@(A.LetBind i info x t e) ret = traceCallCPS_ (CheckLetBinding b) ret $ \ret -> do t <- isType_ t v <- applyRelevanceToContext (getRelevance info) $ checkDontExpandLast e t addLetBinding (convColor info) x v t ret checkLetBinding b@(A.LetPatBind i p e) ret = traceCallCPS_ (CheckLetBinding b) ret $ \ret -> do p <- expandPatternSynonyms p (v, t) <- inferExpr' ExpandLast e let -- construct a type t -> dummy for use in checkLeftHandSide t0 = El (getSort t) $ Pi (Dom defaultArgInfo t) (NoAbs underscore typeDontCare) p0 = Arg defaultArgInfo (Named Nothing p) reportSDoc "tc.term.let.pattern" 10 $ vcat [ text "let-binding pattern p at type t" , nest 2 $ vcat [ text "p (A) =" <+> text (show p) -- prettyTCM p , text "t =" <+> prettyTCM t ] ] checkLeftHandSide (CheckPattern p EmptyTel t) Nothing [p0] t0 $ \ (LHSResult delta ps _t _perm) -> do -- A single pattern in internal syntax is returned. let p = case ps of [p] -> namedArg p; _ -> __IMPOSSIBLE__ reportSDoc "tc.term.let.pattern" 20 $ nest 2 $ vcat [ text "p (I) =" <+> text (show p) , text "delta =" <+> text (show delta) ] -- We translate it into a list of projections. fs <- recordPatternToProjections p -- We remove the bindings for the pattern variables from the context. cxt0 <- getContext let (binds, cxt) = splitAt (size delta) cxt0 escapeContext (length binds) $ do reportSDoc "tc.term.let.pattern" 20 $ nest 2 $ vcat [ text "delta =" <+> prettyTCM delta , text "binds =" <+> text (show binds) -- prettyTCM binds ] {- WE CANNOT USE THIS BINDING -- We add a first let-binding for the value of e. x <- freshNoName (getRange e) addLetBinding Relevant x v t $ do -} -- We create a substitution for the let-bound variables -- (unfortunately, we cannot refer to x in internal syntax -- so we have to copy v). let sigma = zipWith ($) fs (repeat v) -- We apply the types of the let bound-variables to this substitution. -- The 0th variable in a context is the last one, so we reverse. -- Further, we need to lower all other de Bruijn indices by -- the size of delta, so we append the identity substitution. let sub = parallelS (reverse sigma) let fdelta = flattenTel delta reportSDoc "tc.term.let.pattern" 20 $ nest 2 $ vcat [ text "fdelta =" <+> text (show fdelta) ] let tsl = applySubst sub fdelta -- We get a list of types let ts = map unDom tsl -- and relevances. let infos = map domInfo tsl -- We get list of names of the let-bound vars from the context. let xs = map (fst . unDom) (reverse binds) -- We add all the bindings to the context. foldr (uncurry4 addLetBinding) ret $ zip4 infos xs sigma ts checkLetBinding (A.LetApply i x modapp rd rm) ret = do -- Any variables in the context that doesn't belong to the current -- module should go with the new module. fv <- getCurrentModuleFreeVars n <- getContextSize let new = n - fv reportSLn "tc.term.let.apply" 10 $ "Applying " ++ show modapp ++ " with " ++ show new ++ " free variables" reportSDoc "tc.term.let.apply" 20 $ vcat [ text "context =" <+> (prettyTCM =<< getContextTelescope) , text "module =" <+> (prettyTCM =<< currentModule) , text "fv =" <+> (text $ show fv) ] checkSectionApplication i x modapp rd rm withAnonymousModule x new ret -- LetOpen is only used for highlighting and has no semantics checkLetBinding A.LetOpen{} ret = ret class ConvColor a i where convColor :: a -> i instance ConvColor A.ArgInfo I.ArgInfo where convColor = mapArgInfoColors $ const [] -- "TODO guilhem 5" instance ConvColor (A.Arg e) (I.Arg e) where convColor = mapArgInfo convColor instance ConvColor (A.Dom e) (I.Dom e) where convColor = mapDomInfo convColor instance ConvColor a i => ConvColor [a] [i] where convColor = map convColor Agda-2.4.2.5/src/full/Agda/TypeChecking/Rules/Builtin.hs0000644000000000000000000005377712635075266020741 0ustar0000000000000000{-# LANGUAGE CPP #-} {-# LANGUAGE PatternGuards #-} {-# LANGUAGE ScopedTypeVariables #-} {-# LANGUAGE TupleSections #-} module Agda.TypeChecking.Rules.Builtin ( bindBuiltin , bindBuiltinNoDef , bindPostulatedName ) where import Control.Applicative hiding (empty) import Control.Monad import Data.List (find) import qualified Agda.Syntax.Abstract as A import Agda.Syntax.Common import Agda.Syntax.Internal import Agda.Syntax.Position import Agda.TypeChecking.Monad import Agda.TypeChecking.Monad.Builtin import Agda.TypeChecking.Monad.SizedTypes ( builtinSizeHook ) import Agda.TypeChecking.Conversion import Agda.TypeChecking.Constraints import Agda.TypeChecking.EtaContract import Agda.TypeChecking.Irrelevance import Agda.TypeChecking.Primitive import Agda.TypeChecking.Reduce import Agda.TypeChecking.Substitute import Agda.TypeChecking.Rules.Term ( checkExpr , inferExpr ) import {-# SOURCE #-} Agda.TypeChecking.Rules.Builtin.Coinduction import {-# SOURCE #-} Agda.TypeChecking.Rewriting import Agda.Utils.Except ( MonadError(catchError) ) import Agda.Utils.Maybe import Agda.Utils.Monad import Agda.Utils.Null import Agda.Utils.Size #include "undefined.h" import Agda.Utils.Impossible --------------------------------------------------------------------------- -- * Checking builtin pragmas --------------------------------------------------------------------------- builtinPostulate :: TCM Type -> BuiltinDescriptor builtinPostulate = BuiltinPostulate Relevant coreBuiltins :: [BuiltinInfo] coreBuiltins = map (\ (x, z) -> BuiltinInfo x z) [ (builtinList |-> BuiltinData (tset --> tset) [builtinNil, builtinCons]) , (builtinArg |-> BuiltinData (tset --> tset) [builtinArgArg]) , (builtinArgInfo |-> BuiltinData tset [builtinArgArgInfo]) , (builtinBool |-> BuiltinData tset [builtinTrue, builtinFalse]) , (builtinNat |-> BuiltinData tset [builtinZero, builtinSuc]) , (builtinAgdaLiteral |-> BuiltinData tset [builtinAgdaLitNat, builtinAgdaLitFloat, builtinAgdaLitChar, builtinAgdaLitString, builtinAgdaLitQName]) , (builtinAgdaPattern |-> BuiltinData tset [builtinAgdaPatVar, builtinAgdaPatCon, builtinAgdaPatDot, builtinAgdaPatLit, builtinAgdaPatProj, builtinAgdaPatAbsurd]) , (builtinAgdaPatVar |-> BuiltinDataCons tpat) , (builtinAgdaPatCon |-> BuiltinDataCons (tqname --> tlist (targ tpat) --> tpat)) , (builtinAgdaPatDot |-> BuiltinDataCons tpat) , (builtinAgdaPatLit |-> BuiltinDataCons (tliteral --> tpat)) , (builtinAgdaPatProj |-> BuiltinDataCons (tqname --> tpat)) , (builtinAgdaPatAbsurd |-> BuiltinDataCons tpat) , (builtinLevel |-> builtinPostulate tset) , (builtinInteger |-> builtinPostulate tset) , (builtinFloat |-> builtinPostulate tset) , (builtinChar |-> builtinPostulate tset) , (builtinString |-> builtinPostulate tset) , (builtinQName |-> builtinPostulate tset) , (builtinIO |-> builtinPostulate (tset --> tset)) , (builtinAgdaSort |-> BuiltinData tset [builtinAgdaSortSet, builtinAgdaSortLit, builtinAgdaSortUnsupported]) , (builtinAgdaType |-> BuiltinData tset [builtinAgdaTypeEl]) , (builtinAgdaTerm |-> BuiltinData tset [ builtinAgdaTermVar, builtinAgdaTermLam, builtinAgdaTermExtLam , builtinAgdaTermDef, builtinAgdaTermCon , builtinAgdaTermPi, builtinAgdaTermSort , builtinAgdaTermLit, builtinAgdaTermUnsupported]) , (builtinEquality |-> BuiltinData (hPi "a" (el primLevel) $ hPi "A" (return $ sort $ varSort 0) $ (El (varSort 1) <$> varM 0) --> (El (varSort 1) <$> varM 0) --> return (sort $ varSort 1)) [builtinRefl]) , (builtinHiding |-> BuiltinData tset [builtinHidden, builtinInstance, builtinVisible]) , (builtinRelevance |-> BuiltinData tset [builtinRelevant, builtinIrrelevant]) , (builtinRefl |-> BuiltinDataCons (hPi "a" (el primLevel) $ hPi "A" (return $ sort $ varSort 0) $ hPi "x" (El (varSort 1) <$> varM 0) $ El (varSort 2) <$> primEquality <#> varM 2 <#> varM 1 <@> varM 0 <@> varM 0)) , (builtinRewrite |-> BuiltinUnknown Nothing verifyBuiltinRewrite) , (builtinNil |-> BuiltinDataCons (hPi "A" tset (el (list v0)))) , (builtinCons |-> BuiltinDataCons (hPi "A" tset (tv0 --> el (list v0) --> el (list v0)))) , (builtinZero |-> BuiltinDataCons tnat) , (builtinSuc |-> BuiltinDataCons (tnat --> tnat)) , (builtinTrue |-> BuiltinDataCons tbool) , (builtinFalse |-> BuiltinDataCons tbool) , (builtinArgArg |-> BuiltinDataCons (hPi "A" tset (targinfo --> tv0 --> targ tv0))) , (builtinArgArgInfo |-> BuiltinDataCons (thiding --> trelevance --> targinfo)) , (builtinAgdaTypeEl |-> BuiltinDataCons (tsort --> tterm --> ttype)) , (builtinAgdaTermVar |-> BuiltinDataCons (tnat --> targs --> tterm)) , (builtinAgdaTermLam |-> BuiltinDataCons (thiding --> tterm --> tterm)) , (builtinAgdaTermExtLam |-> BuiltinDataCons (tlist tclause --> targs --> tterm)) , (builtinAgdaTermDef |-> BuiltinDataCons (tqname --> targs --> tterm)) , (builtinAgdaTermCon |-> BuiltinDataCons (tqname --> targs --> tterm)) , (builtinAgdaTermPi |-> BuiltinDataCons (targ ttype --> ttype --> tterm)) , (builtinAgdaTermSort |-> BuiltinDataCons (tsort --> tterm)) , (builtinAgdaTermLit |-> BuiltinDataCons (tliteral --> tterm)) , (builtinAgdaTermUnsupported|-> BuiltinDataCons tterm) , (builtinAgdaLitNat |-> BuiltinDataCons (tnat --> tliteral)) , (builtinAgdaLitFloat |-> BuiltinDataCons (tfloat --> tliteral)) , (builtinAgdaLitChar |-> BuiltinDataCons (tchar --> tliteral)) , (builtinAgdaLitString |-> BuiltinDataCons (tstring --> tliteral)) , (builtinAgdaLitQName |-> BuiltinDataCons (tqname --> tliteral)) , (builtinHidden |-> BuiltinDataCons thiding) , (builtinInstance |-> BuiltinDataCons thiding) , (builtinVisible |-> BuiltinDataCons thiding) , (builtinRelevant |-> BuiltinDataCons trelevance) , (builtinIrrelevant |-> BuiltinDataCons trelevance) , (builtinSizeUniv |-> builtinPostulate tSizeUniv) -- SizeUniv : SizeUniv -- See comment on tSizeUniv: the following does not work currently. -- , (builtinSizeUniv |-> builtinPostulate tSetOmega) -- SizeUniv : Setω , (builtinSize |-> builtinPostulate tSizeUniv) , (builtinSizeLt |-> builtinPostulate (tsize ..--> tSizeUniv)) , (builtinSizeSuc |-> builtinPostulate (tsize --> tsize)) , (builtinSizeInf |-> builtinPostulate tsize) -- postulate max : {i : Size} -> Size< i -> Size< i -> Size< i , (builtinSizeMax |-> builtinPostulate (tsize --> tsize --> tsize)) -- (hPi "i" tsize $ let a = el $ primSizeLt <@> v0 in (a --> a --> a))) -- postulate .irrelevant : {a : Level}{A : Set a} -> .A -> A , (builtinIrrAxiom |-> BuiltinPostulate Irrelevant (hPi "a" (el primLevel) $ hPi "A" (return $ sort $ varSort 0) $ (El (varSort 1) <$> varM 0) .--> (El (varSort 1) <$> varM 0))) , (builtinAgdaSortSet |-> BuiltinDataCons (tterm --> tsort)) , (builtinAgdaSortLit |-> BuiltinDataCons (tnat --> tsort)) , (builtinAgdaSortUnsupported|-> BuiltinDataCons tsort) , (builtinNatPlus |-> BuiltinPrim "primNatPlus" verifyPlus) , (builtinNatMinus |-> BuiltinPrim "primNatMinus" verifyMinus) , (builtinNatTimes |-> BuiltinPrim "primNatTimes" verifyTimes) , (builtinNatDivSucAux |-> BuiltinPrim "primNatDivSucAux" verifyDivSucAux) , (builtinNatModSucAux |-> BuiltinPrim "primNatModSucAux" verifyModSucAux) , (builtinNatEquals |-> BuiltinPrim "primNatEquality" verifyEquals) , (builtinNatLess |-> BuiltinPrim "primNatLess" verifyLess) , (builtinLevelZero |-> BuiltinPrim "primLevelZero" (const $ return ())) , (builtinLevelSuc |-> BuiltinPrim "primLevelSuc" (const $ return ())) , (builtinLevelMax |-> BuiltinPrim "primLevelMax" verifyMax) , (builtinAgdaFunDef |-> BuiltinData tset [builtinAgdaFunDefCon]) , (builtinAgdaFunDefCon |-> BuiltinDataCons (ttype --> tlist tclause --> tfun)) , (builtinAgdaClause |-> BuiltinData tset [builtinAgdaClauseClause, builtinAgdaClauseAbsurd]) , (builtinAgdaClauseClause |-> BuiltinDataCons (tlist (targ tpat) --> tterm --> tclause)) , (builtinAgdaClauseAbsurd |-> BuiltinDataCons (tlist (targ tpat) --> tclause)) , (builtinAgdaDataDef |-> builtinPostulate tset) -- internally this is QName , (builtinAgdaRecordDef |-> builtinPostulate tset) -- internally this is QName , (builtinAgdaDefinition |-> BuiltinData tset [builtinAgdaDefinitionFunDef ,builtinAgdaDefinitionDataDef ,builtinAgdaDefinitionDataConstructor ,builtinAgdaDefinitionRecordDef ,builtinAgdaDefinitionPostulate ,builtinAgdaDefinitionPrimitive]) , (builtinAgdaDefinitionFunDef |-> BuiltinDataCons (tfun --> tdefn)) , (builtinAgdaDefinitionDataDef |-> BuiltinDataCons (tdtype --> tdefn)) , (builtinAgdaDefinitionDataConstructor |-> BuiltinDataCons tdefn) , (builtinAgdaDefinitionRecordDef |-> BuiltinDataCons (trec --> tdefn)) , (builtinAgdaDefinitionPostulate |-> BuiltinDataCons tdefn) , (builtinAgdaDefinitionPrimitive |-> BuiltinDataCons tdefn) ] where (|->) = (,) v0 = varM 0 v1 = varM 1 tv0,tv1 :: TCM Type tv0 = el v0 tv1 = el v1 arg :: TCM Term -> TCM Term arg t = primArg <@> t tlist x = el $ list (fmap unEl x) targ x = el (arg (fmap unEl x)) targs = el (list (arg primAgdaTerm)) tterm = el primAgdaTerm tnat = el primNat tfloat = el primFloat tchar = el primChar tstring = el primString tqname = el primQName tsize = El SizeUniv <$> primSize tbool = el primBool thiding = el primHiding trelevance = el primRelevance -- tcolors = el (list primAgdaTerm) -- TODO guilhem targinfo = el primArgInfo ttype = el primAgdaType tsort = el primAgdaSort tdefn = el primAgdaDefinition tfun = el primAgdaFunDef tdtype = el primAgdaDataDef trec = el primAgdaRecordDef tliteral = el primAgdaLiteral tpat = el primAgdaPattern tclause = el primAgdaClause verifyPlus plus = verify ["n","m"] $ \(@@) zero suc (==) (===) choice -> do let m = var 0 n = var 1 x + y = plus @@ x @@ y -- We allow recursion on any argument choice [ do n + zero == n n + suc m == suc (n + m) , do suc n + m == suc (n + m) zero + m == m ] verifyMinus minus = verify ["n","m"] $ \(@@) zero suc (==) (===) choice -> do let m = var 0 n = var 1 x - y = minus @@ x @@ y -- We allow recursion on any argument zero - zero == zero zero - suc m == zero suc n - zero == suc n suc n - suc m == (n - m) verifyTimes times = do plus <- primNatPlus verify ["n","m"] $ \(@@) zero suc (==) (===) choice -> do let m = var 0 n = var 1 x + y = plus @@ x @@ y x * y = times @@ x @@ y choice [ do n * zero == zero choice [ (n * suc m) == (n + (n * m)) , (n * suc m) == ((n * m) + n) ] , do zero * n == zero choice [ (suc n * m) == (m + (n * m)) , (suc n * m) == ((n * m) + m) ] ] verifyDivSucAux dsAux = verify ["k","m","n","j"] $ \(@@) zero suc (==) (===) choice -> do let aux k m n j = dsAux @@ k @@ m @@ n @@ j k = var 0 m = var 1 n = var 2 j = var 3 aux k m zero j == k aux k m (suc n) zero == aux (suc k) m n m aux k m (suc n) (suc j) == aux k m n j verifyModSucAux dsAux = verify ["k","m","n","j"] $ \(@@) zero suc (==) (===) choice -> do let aux k m n j = dsAux @@ k @@ m @@ n @@ j k = var 0 m = var 1 n = var 2 j = var 3 aux k m zero j == k aux k m (suc n) zero == aux zero m n m aux k m (suc n) (suc j) == aux (suc k) m n j verifyEquals eq = verify ["n","m"] $ \(@@) zero suc (==) (===) choice -> do true <- primTrue false <- primFalse let x == y = eq @@ x @@ y m = var 0 n = var 1 (zero == zero ) === true (suc n == suc m) === (n == m) (suc n == zero ) === false (zero == suc n) === false verifyLess leq = verify ["n","m"] $ \(@@) zero suc (==) (===) choice -> do true <- primTrue false <- primFalse let x < y = leq @@ x @@ y m = var 0 n = var 1 (n < zero) === false (suc n < suc m) === (n < m) (zero < suc m) === true verifyMax maxV = return () -- TODO: make max a postulate verify xs = verify' primNat primZero primSuc xs verify' :: TCM Term -> TCM Term -> TCM Term -> [String] -> ( (Term -> Term -> Term) -> Term -> (Term -> Term) -> (Term -> Term -> TCM ()) -> (Term -> Term -> TCM ()) -> ([TCM ()] -> TCM ()) -> TCM a) -> TCM a verify' pNat pZero pSuc xs f = do nat <- El (mkType 0) <$> pNat zero <- pZero s <- pSuc let x @@ y = x `apply` [defaultArg y] x == y = noConstraints $ equalTerm nat x y -- Andreas: 2013-10-21 I put primBool here on the inside -- since some Nat-builtins do not require Bool-builtins x === y = do bool <- El (mkType 0) <$> primBool noConstraints $ equalTerm bool x y suc n = s @@ n choice = foldr1 (\x y -> x `catchError` \_ -> y) xs <- mapM freshName_ xs addCtxs xs (domFromArg $ defaultArg nat) $ f (@@) zero suc (==) (===) choice inductiveCheck :: String -> Int -> Term -> TCM () inductiveCheck b n t = do t <- etaContract =<< normalise t let err = typeError (NotInductive t) case ignoreSharing t of Def t _ -> do t <- theDef <$> getConstInfo t case t of Datatype { dataInduction = Inductive , dataCons = cs } | length cs == n -> return () | otherwise -> typeError $ GenericError $ unwords [ "The builtin", b , "must be a datatype with", show n , "constructors" ] _ -> err _ -> err -- | @bindPostulatedName builtin e m@ checks that @e@ is a postulated -- name @q@, and binds the builtin @builtin@ to the term @m q def@, -- where @def@ is the current 'Definition' of @q@. bindPostulatedName :: String -> A.Expr -> (QName -> Definition -> TCM Term) -> TCM () bindPostulatedName builtin e m = do q <- getName e def <- ignoreAbstractMode $ getConstInfo q case theDef def of Axiom {} -> bindBuiltinName builtin =<< m q def _ -> err where err = typeError $ GenericError $ "The argument to BUILTIN " ++ builtin ++ " must be a postulated name" getName (A.Def q) = return q getName (A.ScopedExpr _ e) = getName e getName _ = err bindBuiltinNat :: Term -> TCM () bindBuiltinNat t = do t' <- etaContract =<< normalise t case ignoreSharing t' of Def nat _ -> do def <- theDef <$> getConstInfo nat case def of Datatype { dataCons = [c1, c2] } -> do bindBuiltinName builtinNat t let getArity c = arity <$> (normalise . defType =<< getConstInfo c) [a1, a2] <- mapM getArity [c1, c2] let (zero, suc) | a2 > a1 = (c1, c2) | otherwise = (c2, c1) tnat = el primNat rerange = setRange (getRange nat) bindBuiltinInfo (BuiltinInfo builtinZero $ BuiltinDataCons tnat) (A.Con $ AmbQ [rerange zero]) bindBuiltinInfo (BuiltinInfo builtinSuc $ BuiltinDataCons (tnat --> tnat)) (A.Con $ AmbQ [rerange suc]) _ -> __IMPOSSIBLE__ _ -> __IMPOSSIBLE__ bindBuiltinInfo :: BuiltinInfo -> A.Expr -> TCM () bindBuiltinInfo i (A.ScopedExpr scope e) = setScope scope >> bindBuiltinInfo i e bindBuiltinInfo (BuiltinInfo s d) e = do case d of BuiltinData t cs -> do e' <- checkExpr e =<< t let n = length cs inductiveCheck s n e' if s == builtinNat then bindBuiltinNat e' else bindBuiltinName s e' BuiltinDataCons t -> do let name (Lam h b) = name (absBody b) name (Con c _) = Con c [] name (Shared p) = name $ ignoreSharing (derefPtr p) name _ = __IMPOSSIBLE__ e' <- checkExpr e =<< t case e of A.Con _ -> return () _ -> typeError $ BuiltinMustBeConstructor s e bindBuiltinName s (name e') BuiltinPrim pfname axioms -> do case e of A.Def qx -> do PrimImpl t pf <- lookupPrimitiveFunction pfname v <- checkExpr e t axioms v info <- getConstInfo qx let cls = defClauses info a = defAbstract info mcc = defCompiled info bindPrimitive pfname $ pf { primFunName = qx } addConstant qx $ info { theDef = Primitive a pfname cls mcc } -- needed? yes, for checking equations for mul bindBuiltinName s v _ -> typeError $ GenericError $ "Builtin " ++ s ++ " must be bound to a function" BuiltinPostulate rel t -> do t' <- t e' <- applyRelevanceToContext rel $ checkExpr e t' let err = typeError $ GenericError $ "The argument to BUILTIN " ++ s ++ " must be a postulated name" case e of A.Def q -> do def <- ignoreAbstractMode $ getConstInfo q case theDef def of Axiom {} -> do builtinSizeHook s q t' bindBuiltinName s e' _ -> err _ -> err BuiltinUnknown mt f -> do (v, t) <- caseMaybe mt (inferExpr e) $ \ tcmt -> do t <- tcmt (,t) <$> checkExpr e t f v t bindBuiltinName s v -- | Bind a builtin thing to an expression. bindBuiltin :: String -> A.Expr -> TCM () bindBuiltin b e = do unlessM ((0 ==) <$> getContextSize) $ typeError $ BuiltinInParameterisedModule b case b of _ | b == builtinZero -> nowNat b _ | b == builtinSuc -> nowNat b _ | b == builtinInf -> bindBuiltinInf e _ | b == builtinSharp -> bindBuiltinSharp e _ | b == builtinFlat -> bindBuiltinFlat e _ | Just i <- find ((b ==) . builtinName) coreBuiltins -> bindBuiltinInfo i e _ -> typeError $ NoSuchBuiltinName b where nowNat b = genericError $ "Builtin " ++ b ++ " does no longer exist. " ++ "It is now bound by BUILTIN " ++ builtinNat -- | Bind a builtin thing to a new name. bindBuiltinNoDef :: String -> A.QName -> TCM () bindBuiltinNoDef b q = do unlessM ((0 ==) <$> getContextSize) $ typeError $ BuiltinInParameterisedModule b case lookup b $ map (\ (BuiltinInfo b i) -> (b, i)) coreBuiltins of Just (BuiltinPostulate rel mt) -> do t <- mt addConstant q $ defaultDefn (setRelevance rel defaultArgInfo) q t def builtinSizeHook b q t bindBuiltinName b $ Def q [] where -- Andreas, 2015-02-14 -- Special treatment of SizeUniv, should maybe be a primitive. def | b == builtinSizeUniv = emptyFunction { funClauses = [ (empty :: Clause) { clauseBody = Body $ Sort SizeUniv } ] , funTerminates = Just True } | otherwise = Axiom Just{} -> __IMPOSSIBLE__ Nothing -> __IMPOSSIBLE__ -- typeError $ NoSuchBuiltinName b Agda-2.4.2.5/src/full/Agda/TypeChecking/Rules/Decl.hs0000644000000000000000000010405512635075266020164 0ustar0000000000000000{-# LANGUAGE CPP #-} {-# LANGUAGE LambdaCase #-} {-# LANGUAGE TupleSections #-} #if __GLASGOW_HASKELL__ >= 710 {-# LANGUAGE FlexibleContexts #-} #endif module Agda.TypeChecking.Rules.Decl where import Control.Monad import Control.Monad.Reader import Control.Monad.State (modify) import qualified Data.Foldable as Fold import Data.Maybe import Data.Map (Map) import qualified Data.Set as Set import Data.Set (Set) import Data.Sequence ((|>)) import Agda.Compiler.HaskellTypes import Agda.Interaction.Options import Agda.Interaction.Highlighting.Generate import qualified Agda.Syntax.Abstract as A import Agda.Syntax.Internal as I import qualified Agda.Syntax.Info as Info import Agda.Syntax.Position import Agda.Syntax.Common import Agda.Syntax.Translation.InternalToAbstract import Agda.TypeChecking.Monad import Agda.TypeChecking.Monad.Builtin import qualified Agda.TypeChecking.Monad.Benchmark as Bench import Agda.TypeChecking.Constraints import Agda.TypeChecking.Conversion import Agda.TypeChecking.Errors import Agda.TypeChecking.Injectivity import Agda.TypeChecking.Irrelevance import Agda.TypeChecking.Positivity import Agda.TypeChecking.Polarity import Agda.TypeChecking.Pretty import Agda.TypeChecking.Primitive import Agda.TypeChecking.ProjectionLike import Agda.TypeChecking.Quote import Agda.TypeChecking.Records import Agda.TypeChecking.Reduce import Agda.TypeChecking.Rewriting import Agda.TypeChecking.SizedTypes.Solve import Agda.TypeChecking.Substitute import Agda.TypeChecking.Telescope import Agda.TypeChecking.Unquote import Agda.TypeChecking.Rules.Term import Agda.TypeChecking.Rules.Data ( checkDataDef ) import Agda.TypeChecking.Rules.Record ( checkRecDef ) import Agda.TypeChecking.Rules.Def ( checkFunDef, useTerPragma ) import Agda.TypeChecking.Rules.Builtin import Agda.Termination.TermCheck import qualified Agda.Utils.HashMap as HMap import Agda.Utils.Maybe import Agda.Utils.Monad import Agda.Utils.Pretty (prettyShow) import Agda.Utils.Size #include "undefined.h" import Agda.Utils.Impossible -- | Type check a sequence of declarations. checkDecls :: [A.Declaration] -> TCM () checkDecls ds = do reportSLn "tc.decl" 45 $ "Checking " ++ show (length ds) ++ " declarations..." mapM_ checkDecl ds -- Andreas, 2011-05-30, unfreezing moved to Interaction/Imports -- whenM onTopLevel unfreezeMetas -- | Type check a single declaration. checkDecl :: A.Declaration -> TCM () checkDecl d = setCurrentRange d $ do reportSDoc "tc.decl" 10 $ text "checking declaration" debugPrintDecl d reportSDoc "tc.decl" 90 $ (text . show) d reportSDoc "tc.decl" 10 $ prettyA d -- Might loop, see e.g. Issue 1597 -- Issue 418 fix: freeze metas before checking an abstract thing when_ isAbstract freezeMetas let -- What kind of final checks/computations should be performed -- if we're not inside a mutual block? none m = m >> return Nothing meta m = m >> return (Just (return ())) mutual i ds m = m >>= return . Just . mutualChecks i d ds impossible m = m >> return __IMPOSSIBLE__ -- We're definitely inside a mutual block. let mi = Info.MutualInfo TerminationCheck noRange finalChecks <- case d of A.Axiom{} -> meta $ checkTypeSignature d A.Field{} -> typeError FieldOutsideRecord A.Primitive i x e -> meta $ checkPrimitive i x e A.Mutual i ds -> mutual i ds $ checkMutual i ds A.Section i x tel ds -> meta $ checkSection i x tel ds A.Apply i x modapp rd rm -> meta $ checkSectionApplication i x modapp rd rm A.Import i x -> none $ checkImport i x A.Pragma i p -> none $ checkPragma i p A.ScopedDecl scope ds -> none $ setScope scope >> checkDecls ds A.FunDef i x delayed cs -> impossible $ check x i $ checkFunDef delayed i x cs A.DataDef i x ps cs -> impossible $ check x i $ checkDataDef i x ps cs A.RecDef i x ind c ps tel cs -> mutual mi [d] $ check x i $ do checkRecDef i x ind c ps tel cs return (Set.singleton x) A.DataSig i x ps t -> impossible $ checkSig i x ps t A.RecSig i x ps t -> none $ checkSig i x ps t -- A record signature is always followed by a -- record definition. Metas should not be -- frozen until after the definition has been -- checked. NOTE: Metas are not frozen -- immediately after the last field. Perhaps -- they should be (unless we're in a mutual -- block). A.Open{} -> none $ return () A.PatternSynDef{} -> none $ return () -- Open and PatternSynDef are just artifacts -- from the concrete syntax, retained for -- highlighting purposes. A.UnquoteDecl mi i x e -> checkUnquoteDecl mi i x e whenNothingM (asks envMutualBlock) $ do -- Syntax highlighting. highlight_ d -- Post-typing checks. whenJust finalChecks $ \ theMutualChecks -> do solveSizeConstraints wakeupConstraints_ -- solve emptiness constraints _ <- freezeMetas theMutualChecks where unScope (A.ScopedDecl scope ds) = setScope scope >> unScope d unScope d = return d -- check record or data type signature checkSig i x ps t = checkTypeSignature $ A.Axiom A.NoFunSig i defaultArgInfo x (A.Pi (Info.ExprRange (fuseRange ps t)) ps t) check x i m = do reportSDoc "tc.decl" 5 $ text "Checking" <+> prettyTCM x <> text "." reportSLn "tc.decl.abstract" 25 $ show (Info.defAbstract i) r <- abstract (Info.defAbstract i) m reportSDoc "tc.decl" 5 $ text "Checked" <+> prettyTCM x <> text "." return r isAbstract = fmap Info.defAbstract (A.getDefInfo d) == Just AbstractDef -- Concrete definitions cannot use information about abstract things. abstract ConcreteDef = inConcreteMode abstract AbstractDef = inAbstractMode -- Some checks that should be run at the end of a mutual -- block (or non-mutual record declaration). The set names -- contains the names defined in the mutual block. mutualChecks :: Info.MutualInfo -> A.Declaration -> [A.Declaration] -> Set QName -> TCM () mutualChecks i d ds names = do -- Andreas, 2014-04-11: instantiate metas in definition types mapM_ instantiateDefinitionType $ Set.toList names -- Andreas, 2013-02-27: check termination before injectivity, -- to avoid making the injectivity checker loop. checkTermination_ d checkPositivity_ names -- Andreas, 2015-03-26 Issue 1470: -- Restricting coinduction to recursive does not solve the -- actual problem, and prevents interesting sound applications -- of sized types. -- checkCoinductiveRecords ds -- Andreas, 2012-09-11: Injectivity check stores clauses -- whose 'Relevance' is affected by polarity computation, -- so do it here (again). -- Andreas, 2015-07-01: In particular, 'UnusedArg's of local functions -- are only recognized after the polarity computation. -- See Issue 1366 for an example where injectivity of a local function -- is used to solve metas. It fails if we do injectivity analysis -- before polarity only. checkInjectivity_ names checkProjectionLikeness_ names type FinalChecks = Maybe (TCM ()) checkUnquoteDecl :: Info.MutualInfo -> Info.DefInfo -> QName -> A.Expr -> TCM FinalChecks checkUnquoteDecl mi i x e = do reportSDoc "tc.unquote.decl" 20 $ text "Checking unquoteDecl" <+> prettyTCM x fundef <- primAgdaFunDef v <- checkExpr e $ El (mkType 0) fundef reportSDoc "tc.unquote.decl" 20 $ text "unquoteDecl: Checked term" uv <- runUnquoteM $ unquote v case uv of Left err -> typeError $ UnquoteFailed err Right (UnQFun a cs) -> do reportSDoc "tc.unquote.decl" 20 $ vcat $ text "unquoteDecl: Unquoted term" : [ nest 2 $ text (show c) | c <- cs ] -- Add x to signature, otherwise reification gets unhappy. addConstant x =<< do useTerPragma $ defaultDefn defaultArgInfo x a emptyFunction a <- reifyUnquoted $ killRange a reportSDoc "tc.unquote.decl" 10 $ vcat [ text "unquoteDecl" <+> prettyTCM x <+> text "-->" , prettyTCM x <+> text ":" <+> prettyA a ] tel <- getContextTelescope let tel' = replaceEmptyName "r" $ killRange tel cs <- mapM (reifyUnquoted . QNamed x . killRange . abstract tel) cs reportSDoc "tc.unquote.decl" 10 $ vcat $ map prettyA cs let ds = [ A.Axiom A.FunSig i defaultArgInfo x a -- TODO other than defaultArg , A.FunDef i x NotDelayed cs ] xs <- checkMutual mi ds return $ Just $ mutualChecks mi (A.Mutual mi ds) ds xs -- | Instantiate all metas in 'Definition' associated to 'QName'. -- Makes sense after freezing metas. -- Some checks, like free variable analysis, are not in 'TCM', -- so they will be more precise (see issue 1099) after meta instantiation. -- -- Precondition: name has been added to signature already. instantiateDefinitionType :: QName -> TCM () instantiateDefinitionType q = do reportSLn "tc.decl.inst" 20 $ "instantiating type of " ++ show q sig <- getSignature let t = defType $ fromMaybe __IMPOSSIBLE__ $ lookupDefinition q sig t <- instantiateFull t modifySignature $ updateDefinition q $ \ def -> def { defType = t } -- Andreas, 2014-04-11 -- UNUSED, costs a couple of sec on the std-lib -- -- | Instantiate all metas in 'Definition' associated to 'QName'. -- -- Makes sense after freezing metas. -- -- Some checks, like free variable analysis, are not in 'TCM', -- -- so they will be more precise (see issue 1099) after meta instantiation. -- -- -- -- Precondition: name has been added to signature already. -- instantiateDefinition :: QName -> TCM () -- instantiateDefinition q = do -- reportSLn "tc.decl.inst" 20 $ "instantiating " ++ show q -- sig <- getSignature -- let def = fromMaybe __IMPOSSIBLE__ $ lookupDefinition q sig -- def <- instantiateFull def -- modifySignature $ updateDefinition q $ const def -- | Highlight a declaration. highlight_ :: A.Declaration -> TCM () highlight_ d = do let highlight d = generateAndPrintSyntaxInfo d Full Bench.billTo [Bench.Highlighting] $ case d of A.Axiom{} -> highlight d A.Field{} -> __IMPOSSIBLE__ A.Primitive{} -> highlight d A.Mutual{} -> highlight d A.Apply{} -> highlight d A.Import{} -> highlight d A.Pragma{} -> highlight d A.ScopedDecl{} -> return () A.FunDef{} -> __IMPOSSIBLE__ A.DataDef{} -> __IMPOSSIBLE__ A.DataSig{} -> __IMPOSSIBLE__ A.Open{} -> highlight d A.PatternSynDef{} -> highlight d A.UnquoteDecl{} -> highlight d A.Section i x tel _ -> highlight (A.Section i x tel []) -- Each block in the section has already been highlighted, -- all that remains is the module declaration. A.RecSig{} -> highlight d A.RecDef i x ind c ps tel cs -> highlight (A.RecDef i x ind c [] tel (fields cs)) -- The telescope and all record module declarations except -- for the fields have already been highlighted. where fields (A.ScopedDecl _ ds1 : ds2) = fields ds1 ++ fields ds2 fields (d@A.Field{} : ds) = d : fields ds fields (_ : ds) = fields ds fields [] = [] -- | Termination check a declaration. checkTermination_ :: A.Declaration -> TCM () checkTermination_ d = Bench.billTo [Bench.Termination] $ do reportSLn "tc.decl" 20 $ "checkDecl: checking termination..." whenM (optTerminationCheck <$> pragmaOptions) $ do case d of -- Record module definitions should not be termination-checked twice. A.RecDef {} -> return () _ -> disableDestructiveUpdate $ do termErrs <- termDecl d unless (null termErrs) $ typeError $ TerminationCheckFailed termErrs -- | Check a set of mutual names for positivity. checkPositivity_ :: Set QName -> TCM () checkPositivity_ names = Bench.billTo [Bench.Positivity] $ do -- Positivity checking. reportSLn "tc.decl" 20 $ "checkDecl: checking positivity..." checkStrictlyPositive names -- Andreas, 2012-02-13: Polarity computation uses info from -- positivity check, so it needs happen after positivity -- check. mapM_ computePolarity $ Set.toList names -- | Check that all coinductive records are actually recursive. -- (Otherwise, one can implement invalid recursion schemes just like -- for the old coinduction.) checkCoinductiveRecords :: [A.Declaration] -> TCM () checkCoinductiveRecords ds = forM_ ds $ \ d -> case d of A.RecDef _ q (Just (Ranged r CoInductive)) _ _ _ _ -> setCurrentRange r $ do unlessM (isRecursiveRecord q) $ typeError $ GenericError $ "Only recursive records can be coinductive" _ -> return () -- | Check a set of mutual names for constructor-headedness. checkInjectivity_ :: Set QName -> TCM () checkInjectivity_ names = Bench.billTo [Bench.Injectivity] $ do reportSLn "tc.decl" 20 $ "checkDecl: checking injectivity..." -- Andreas, 2015-07-01, see Issue1366b: -- Injectivity check needs also to be run for abstract definitions. -- Fold.forM_ names $ \ q -> ignoreAbstractMode $ do -- NOT NECESSARY after all Fold.forM_ names $ \ q -> inConcreteOrAbstractMode q $ do -- For abstract q, we should be inAbstractMode, -- otherwise getConstInfo returns Axiom. -- -- Andreas, 2015-07-01: -- Quite surprisingly, inAbstractMode does not allow us to look -- at a local definition (@where@ block) of an abstract definition. -- This is because the local definition is defined in a strict submodule. -- We can only see through abstract definitions in the current module -- or super modules inAbstractMode. -- I changed that in Monad.Signature.treatAbstractly', so we can see -- our own local definitions. def <- getConstInfo q case theDef def of d@Function{ funClauses = cs, funTerminates = term } -> do case term of Just True -> do inv <- checkInjectivity q cs modifySignature $ updateDefinition q $ const $ def { theDef = d { funInv = inv }} _ -> reportSLn "tc.inj.check" 20 $ show q ++ " is not verified as terminating, thus, not considered for injectivity" _ -> do abstr <- asks envAbstractMode reportSLn "tc.inj.check" 20 $ "we are in " ++ show abstr ++ " and " ++ show q ++ " is abstract or not a function, thus, not considered for injectivity" -- | Check a set of mutual names for projection likeness. -- -- Only a single, non-abstract function can be projection-like. -- Making an abstract function projection-like would break the -- invariant that the type of the principle argument of a projection-like -- function is always inferable. checkProjectionLikeness_ :: Set QName -> TCM () checkProjectionLikeness_ names = Bench.billTo [Bench.ProjectionLikeness] $ do -- Non-mutual definitions can be considered for -- projection likeness let ds = Set.toList names reportSLn "tc.proj.like" 20 $ "checkDecl: checking projection-likeness of " ++ show ds case ds of [d] -> do def <- getConstInfo d -- For abstract identifiers, getConstInfo returns Axiom. -- Thus, abstract definitions are not considered for projection-likeness. case theDef def of Function{} -> makeProjection (defName def) _ -> reportSLn "tc.proj.like" 25 $ show d ++ " is abstract or not a function, thus, not considered for projection-likeness" _ -> reportSLn "tc.proj.like" 25 $ "mutual definitions are not considered for projection-likeness" -- | Type check an axiom. checkAxiom :: A.Axiom -> Info.DefInfo -> A.ArgInfo -> QName -> A.Expr -> TCM () checkAxiom funSig i info0 x e = do -- Andreas, 2012-04-18 if we are in irrelevant context, axioms is irrelevant -- even if not declared as such (Issue 610). rel <- max (getRelevance info0) <$> asks envRelevance let info = setRelevance rel $ convColor info0 -- rel <- ifM ((Irrelevant ==) <$> asks envRelevance) (return Irrelevant) (return rel0) t <- workOnTypes $ isType_ e reportSDoc "tc.decl.ax" 10 $ sep [ text $ "checked type signature" , nest 2 $ prettyTCM rel <> prettyTCM x <+> text ":" <+> prettyTCM t , nest 2 $ text "of sort " <+> prettyTCM (getSort t) ] -- Andreas, 2015-03-17 Issue 1428: Do not postulate sizes in parametrized -- modules! when (funSig == A.NoFunSig) $ do whenM ((== SizeUniv) <$> do reduce $ getSort t) $ do whenM ((> 0) <$> getContextSize) $ do typeError $ GenericError $ "We don't like postulated sizes in parametrized modules." -- Not safe. See Issue 330 -- t <- addForcingAnnotations t addConstant x =<< do useTerPragma $ defaultDefn info x t $ case funSig of A.FunSig -> emptyFunction A.NoFunSig -> Axiom -- NB: used also for data and record type sigs -- Add the definition to the instance table, if needed when (Info.defInstance i == InstanceDef) $ do addTypedInstance x t traceCall (IsType_ e) $ solveSizeConstraints -- need Range for error message -- Andreas, 2011-05-31, that freezing below is probably wrong: -- when_ (Info.defAbstract i == AbstractDef) $ freezeMetas -- | Type check a primitive function declaration. checkPrimitive :: Info.DefInfo -> QName -> A.Expr -> TCM () checkPrimitive i x e = traceCall (CheckPrimitive (getRange i) (qnameName x) e) $ do -- TODO!! (qnameName) (_, PrimImpl t' pf) <- lookupPrimitiveFunctionQ x t <- isType_ e noConstraints $ equalType t t' let s = prettyShow $ qnameName x bindPrimitive s pf addConstant x $ defaultDefn defaultArgInfo x t $ Primitive (Info.defAbstract i) s [] Nothing -- | Check a pragma. checkPragma :: Range -> A.Pragma -> TCM () checkPragma r p = traceCall (CheckPragma r p) $ case p of A.BuiltinPragma x e -> bindBuiltin x e A.BuiltinNoDefPragma b x -> bindBuiltinNoDef b x A.RewritePragma q -> addRewriteRule q A.CompiledTypePragma x hs -> do def <- getConstInfo x case theDef def of Axiom{} -> addHaskellType x hs _ -> typeError $ GenericError "COMPILED_TYPE directive only works on postulates" A.CompiledDataPragma x hs hcs -> do def <- getConstInfo x -- Check that the pragma appears in the same module -- as the datatype. do m <- currentModule let m' = qnameModule $ defName def unless (m == m') $ typeError $ GenericError $ "COMPILED_DATA directives must appear in the same module " ++ "as their corresponding datatype definition," let addCompiledData cs = do addHaskellType x hs let computeHaskellType c = do def <- getConstInfo c let Constructor{ conPars = np } = theDef def underPars 0 a = haskellType a underPars n a = do a <- reduce a case unEl a of Pi a (NoAbs _ b) -> underPars (n - 1) b Pi a b -> underAbstraction a b $ \b -> hsForall <$> getHsVar 0 <*> underPars (n - 1) b _ -> __IMPOSSIBLE__ ty <- underPars np $ defType def reportSLn "tc.pragma.compile" 10 $ "Haskell type for " ++ show c ++ ": " ++ ty return ty hts <- mapM computeHaskellType cs sequence_ $ zipWith3 addHaskellCode cs hts hcs case theDef def of Datatype{dataCons = cs} | length cs /= length hcs -> do let n_forms_are = case length hcs of 1 -> "1 compiled form is" n -> show n ++ " compiled forms are" only | null hcs = "" | length hcs < length cs = "only " | otherwise = "" err <- fsep $ [prettyTCM x] ++ pwords ("has " ++ show (length cs) ++ " constructors, but " ++ only ++ n_forms_are ++ " given [" ++ unwords hcs ++ "]") typeError $ GenericError $ show err | otherwise -> addCompiledData cs Record{recConHead = ch} | length hcs == 1 -> addCompiledData [conName ch] | otherwise -> do err <- fsep $ [prettyTCM x] ++ pwords ("has 1 constructor, but " ++ show (length hcs) ++ " Haskell constructors are given [" ++ unwords hcs ++ "]") typeError $ GenericError $ show err _ -> typeError $ GenericError "COMPILED_DATA on non datatype" A.CompiledPragma x hs -> do def <- getConstInfo x case theDef def of Axiom{} -> do ty <- haskellType $ defType def reportSLn "tc.pragma.compile" 10 $ "Haskell type for " ++ show x ++ ": " ++ ty addHaskellCode x ty hs _ -> typeError $ GenericError "COMPILED directive only works on postulates" A.CompiledExportPragma x hs -> do def <- getConstInfo x let correct = case theDef def of -- Axiom{} -> do -- ty <- haskellType $ defType def -- reportSLn "tc.pragma.compile" 10 $ "Haskell type for " ++ show x ++ ": " ++ ty -- addHaskellCode x ty hs Function{} -> True Constructor{} -> False _ -> False if not correct then typeError $ GenericError "COMPILED_EXPORT directive only works on functions" else do ty <- haskellType $ defType def addHaskellExport x ty hs A.CompiledEpicPragma x ep -> do def <- getConstInfo x case theDef def of Axiom{} -> do --ty <- haskellType $ defType def --reportSLn "tc.pragma.compile" 10 $ "Haskell type for " ++ show x ++ ": " ++ ty addEpicCode x ep _ -> typeError $ GenericError "COMPILED_EPIC directive only works on postulates" A.CompiledJSPragma x ep -> addJSCode x ep A.StaticPragma x -> do def <- getConstInfo x case theDef def of Function{} -> markStatic x _ -> typeError $ GenericError "STATIC directive only works on functions" A.OptionsPragma{} -> typeError $ GenericError $ "OPTIONS pragma only allowed at beginning of file, before top module declaration" A.EtaPragma r -> do whenNothingM (isRecord r) $ typeError $ GenericError $ "ETA pragma is only applicable to records" modifySignature $ updateDefinition r $ updateTheDef $ setEta where setEta d = case d of Record{} -> d { recEtaEquality = True } _ -> __IMPOSSIBLE__ -- | Type check a bunch of mutual inductive recursive definitions. -- -- All definitions which have so far been assigned to the given mutual -- block are returned. checkMutual :: Info.MutualInfo -> [A.Declaration] -> TCM (Set QName) checkMutual i ds = inMutualBlock $ do verboseS "tc.decl.mutual" 20 $ do blockId <- currentOrFreshMutualBlock reportSDoc "tc.decl.mutual" 20 $ vcat $ (text "Checking mutual block" <+> text (show blockId) <> text ":") : map (nest 2 . prettyA) ds local (\e -> e { envTerminationCheck = () <$ Info.mutualTermCheck i }) $ mapM_ checkDecl ds lookupMutualBlock =<< currentOrFreshMutualBlock -- | Type check the type signature of an inductive or recursive definition. checkTypeSignature :: A.TypeSignature -> TCM () checkTypeSignature (A.ScopedDecl scope ds) = do setScope scope mapM_ checkTypeSignature ds checkTypeSignature (A.Axiom funSig i info x e) = case Info.defAccess i of PublicAccess -> inConcreteMode $ checkAxiom funSig i info x e PrivateAccess -> inAbstractMode $ checkAxiom funSig i info x e OnlyQualified -> __IMPOSSIBLE__ checkTypeSignature _ = __IMPOSSIBLE__ -- type signatures are always axioms -- | Type check a module. checkSection :: Info.ModuleInfo -> ModuleName -> A.Telescope -> [A.Declaration] -> TCM () checkSection i x tel ds = checkTelescope tel $ \ tel' -> do addSection x verboseS "tc.mod.check" 10 $ do dx <- prettyTCM x dtel <- mapM prettyAs tel dtel' <- prettyTCM =<< lookupSection x reportSLn "tc.mod.check" 10 $ "checking section " ++ show dx ++ " " ++ show dtel reportSLn "tc.mod.check" 10 $ " actual tele: " ++ show dtel' withCurrentModule x $ checkDecls ds -- | Helper for 'checkSectionApplication'. -- -- Matches the arguments of the module application with the -- module parameters. -- -- Returns the remaining module parameters as an open telescope. -- Warning: the returned telescope is /not/ the final result, -- an actual instantiation of the parameters does not occur. checkModuleArity :: ModuleName -- ^ Name of applied module. -> Telescope -- ^ The module parameters. -> [I.NamedArg A.Expr] -- ^ The arguments this module is applied to. -> TCM Telescope -- ^ The remaining module parameters (has free de Bruijn indices!). checkModuleArity m tel args = check tel args where bad = typeError $ ModuleArityMismatch m tel args check tel [] = return tel check EmptyTel (_:_) = bad check (ExtendTel (Dom info _) btel) args0@(Arg info' (Named rname _) : args) = let name = fmap rangedThing rname y = absName btel tel = absBody btel in case (argInfoHiding info, argInfoHiding info', name) of (Instance, NotHidden, _) -> check tel args0 (Instance, Hidden, _) -> check tel args0 (Instance, Instance, Nothing) -> check tel args (Instance, Instance, Just x) | x == y -> check tel args | otherwise -> check tel args0 (Hidden, NotHidden, _) -> check tel args0 (Hidden, Instance, _) -> check tel args0 (Hidden, Hidden, Nothing) -> check tel args (Hidden, Hidden, Just x) | x == y -> check tel args | otherwise -> check tel args0 (NotHidden, NotHidden, _) -> check tel args (NotHidden, Hidden, _) -> bad (NotHidden, Instance, _) -> bad -- | Check an application of a section (top-level function, includes @'traceCall'@). checkSectionApplication :: Info.ModuleInfo -> ModuleName -- ^ Name @m1@ of module defined by the module macro. -> A.ModuleApplication -- ^ The module macro @λ tel → m2 args@. -> A.Ren QName -- ^ Imported names (given as renaming). -> A.Ren ModuleName -- ^ Imported modules (given as renaming). -> TCM () checkSectionApplication i m1 modapp rd rm = traceCall (CheckSectionApplication (getRange i) m1 modapp) $ checkSectionApplication' i m1 modapp rd rm -- | Check an application of a section. checkSectionApplication' :: Info.ModuleInfo -> ModuleName -- ^ Name @m1@ of module defined by the module macro. -> A.ModuleApplication -- ^ The module macro @λ tel → m2 args@. -> A.Ren QName -- ^ Imported names (given as renaming). -> A.Ren ModuleName -- ^ Imported modules (given as renaming). -> TCM () checkSectionApplication' i m1 (A.SectionApp ptel m2 args) rd rm = do -- Module applications can appear in lets, in which case we treat -- lambda-bound variables as additional parameters to the module. extraParams <- do mfv <- getCurrentModuleFreeVars fv <- size <$> getContextTelescope return (fv - mfv) when (extraParams > 0) $ reportSLn "tc.mod.apply" 30 $ "Extra parameters to " ++ show m1 ++ ": " ++ show extraParams -- Type-check the LHS (ptel) of the module macro. checkTelescope ptel $ \ ptel -> do -- We are now in the context @ptel@. -- Get the correct parameter telescope of @m2@. tel <- lookupSection m2 vs <- freeVarsToApply $ mnameToQName m2 let tel' = apply tel vs args' = convColor args -- Compute the remaining parameter telescope after stripping of -- the initial parameters that are determined by the @args@. -- Warning: @etaTel@ is not well-formed in @ptel@, since -- the actual application has not happened. etaTel <- checkModuleArity m2 tel' args' -- Take the module parameters that will be instantiated by @args@. let tel'' = telFromList $ take (size tel' - size etaTel) $ telToList tel' reportSDoc "tc.mod.apply" 15 $ vcat [ text "applying section" <+> prettyTCM m2 , nest 2 $ text "args =" <+> sep (map prettyA args) , nest 2 $ text "ptel =" <+> escapeContext (size ptel) (prettyTCM ptel) , nest 2 $ text "tel =" <+> prettyTCM tel , nest 2 $ text "tel' =" <+> prettyTCM tel' , nest 2 $ text "tel''=" <+> prettyTCM tel'' , nest 2 $ text "eta =" <+> escapeContext (size ptel) (addContext tel'' $ prettyTCM etaTel) ] -- Now, type check arguments. ts <- (noConstraints $ checkArguments_ DontExpandLast (getRange i) args' tel') >>= \case (ts, etaTel') | (size etaTel == size etaTel') -> return ts _ -> __IMPOSSIBLE__ -- Perform the application of the module parameters. let aTel = tel' `apply` ts reportSDoc "tc.mod.apply" 15 $ vcat [ nest 2 $ text "aTel =" <+> prettyTCM aTel ] -- Andreas, 2014-04-06, Issue 1094: -- Add the section with well-formed telescope. addCtxTel aTel $ addSection m1 reportSDoc "tc.mod.apply" 20 $ vcat [ sep [ text "applySection", prettyTCM m1, text "=", prettyTCM m2, fsep $ map prettyTCM (vs ++ ts) ] , nest 2 $ text " defs:" <+> text (show rd) , nest 2 $ text " mods:" <+> text (show rm) ] args <- instantiateFull $ vs ++ ts applySection m1 ptel m2 args rd rm checkSectionApplication' i m1 (A.RecordModuleIFS x) rd rm = do let name = mnameToQName x tel' <- lookupSection x vs <- freeVarsToApply name let tel = tel' `apply` vs args = teleArgs tel telInst :: Telescope telInst = instFinal tel -- Locate last (rightmost) parameter and make it @Instance@. instFinal :: Telescope -> Telescope -- Telescopes do not have @NoAbs@. instFinal (ExtendTel _ NoAbs{}) = __IMPOSSIBLE__ -- Found last parameter: switch it to @Instance@. instFinal (ExtendTel (Dom info t) (Abs n EmptyTel)) = ExtendTel (Dom ifo' t) (Abs n EmptyTel) where ifo' = setHiding Instance info -- Otherwise, keep searchinf for last parameter: instFinal (ExtendTel arg (Abs n tel)) = ExtendTel arg (Abs n (instFinal tel)) -- Before instFinal is invoked, we have checked that the @tel@ is not empty. instFinal EmptyTel = __IMPOSSIBLE__ reportSDoc "tc.mod.apply" 20 $ vcat [ sep [ text "applySection", prettyTCM name, text "{{...}}" ] , nest 2 $ text "x =" <+> prettyTCM x , nest 2 $ text "name =" <+> prettyTCM name , nest 2 $ text "tel =" <+> prettyTCM tel , nest 2 $ text "telInst =" <+> prettyTCM telInst , nest 2 $ text "vs =" <+> sep (map prettyTCM vs) -- , nest 2 $ text "args =" <+> sep (map prettyTCM args) ] reportSDoc "tc.mod.apply" 60 $ vcat [ nest 2 $ text "vs =" <+> text (show vs) -- , nest 2 $ text "args =" <+> text (show args) ] when (tel == EmptyTel) $ typeError $ GenericError $ show (qnameToConcrete name) ++ " is not a parameterised section" addCtxTel telInst $ do vs <- freeVarsToApply name reportSDoc "tc.mod.apply" 20 $ vcat [ nest 2 $ text "vs =" <+> sep (map prettyTCM vs) , nest 2 $ text "args =" <+> sep (map (parens . prettyTCM) args) ] reportSDoc "tc.mod.apply" 60 $ vcat [ nest 2 $ text "vs =" <+> text (show vs) , nest 2 $ text "args =" <+> text (show args) ] applySection m1 telInst x (vs ++ args) rd rm -- | Type check an import declaration. Actually doesn't do anything, since all -- the work is done when scope checking. checkImport :: Info.ModuleInfo -> ModuleName -> TCM () checkImport i x = return () ------------------------------------------------------------------------ -- * Debugging ------------------------------------------------------------------------ class ShowHead a where showHead :: a -> String instance ShowHead A.Declaration where showHead d = case d of A.Axiom {} -> "Axiom" A.Field {} -> "Field" A.Primitive {} -> "Primitive" A.Mutual {} -> "Mutual" A.Section {} -> "Section" A.Apply {} -> "Apply" A.Import {} -> "Import" A.Pragma {} -> "Pragma" A.Open {} -> "Open" A.FunDef {} -> "FunDef" A.DataSig {} -> "DataSig" A.DataDef {} -> "DataDef" A.RecSig {} -> "RecSig" A.RecDef {} -> "RecDef" A.PatternSynDef{} -> "PatternSynDef" A.UnquoteDecl {} -> "UnquoteDecl" A.ScopedDecl {} -> "ScopedDecl" debugPrintDecl :: A.Declaration -> TCM () debugPrintDecl d = do verboseS "tc.decl" 45 $ do reportSLn "tc.decl" 45 $ "checking a " ++ showHead d case d of A.Section info mname tel ds -> do reportSLn "tc.decl" 45 $ "section " ++ show mname ++ " has " ++ show (length tel) ++ " parameters and " ++ show (length ds) ++ " declarations" reportSDoc "tc.decl" 45 $ prettyA $ A.Section info mname tel [] forM_ ds $ \ d -> do reportSDoc "tc.decl" 45 $ prettyA d _ -> return () Agda-2.4.2.5/src/full/Agda/TypeChecking/Rules/Builtin/0000755000000000000000000000000012635075266020362 5ustar0000000000000000Agda-2.4.2.5/src/full/Agda/TypeChecking/Rules/Builtin/Coinduction.hs-boot0000644000000000000000000000070112635075266024133 0ustar0000000000000000module Agda.TypeChecking.Rules.Builtin.Coinduction where import Agda.Syntax.Abstract import Agda.TypeChecking.Monad bindBuiltinInf :: Expr -> TCM () bindBuiltinSharp :: Expr -> TCM () bindBuiltinFlat :: Expr -> TCM () {- MOVED to TypeChecking.Monad.Builtin data CoinductionKit nameOfInf :: CoinductionKit -> QName nameOfSharp :: CoinductionKit -> QName nameOfFlat :: CoinductionKit -> QName coinductionKit :: TCM (Maybe CoinductionKit) -} Agda-2.4.2.5/src/full/Agda/TypeChecking/Rules/Builtin/Coinduction.hs0000644000000000000000000001536312635075266023204 0ustar0000000000000000-- {-# LANGUAGE CPP #-} ------------------------------------------------------------------------ -- | Handling of the INFINITY, SHARP and FLAT builtins. ------------------------------------------------------------------------ module Agda.TypeChecking.Rules.Builtin.Coinduction where import Control.Applicative import qualified Data.Map as Map import qualified Agda.Syntax.Abstract as A import Agda.Syntax.Common import Agda.Syntax.Internal import Agda.Syntax.Position import Agda.TypeChecking.CompiledClause import Agda.TypeChecking.Level import Agda.TypeChecking.Monad import Agda.TypeChecking.Monad.Builtin import Agda.TypeChecking.Positivity.Occurrence import Agda.TypeChecking.Primitive import Agda.TypeChecking.Reduce import Agda.TypeChecking.Substitute import Agda.TypeChecking.Telescope import Agda.TypeChecking.Rules.Builtin import Agda.TypeChecking.Rules.Term import Agda.Utils.Permutation -- | The type of @∞@. typeOfInf :: TCM Type typeOfInf = hPi "a" (el primLevel) $ (return . sort $ varSort 0) --> (return . sort $ varSort 0) -- | The type of @♯_@. typeOfSharp :: TCM Type typeOfSharp = hPi "a" (el primLevel) $ hPi "A" (return . sort $ varSort 0) $ (El (varSort 1) <$> varM 0) --> (El (varSort 1) <$> primInf <#> varM 1 <@> varM 0) -- | The type of @♭@. typeOfFlat :: TCM Type typeOfFlat = hPi "a" (el primLevel) $ hPi "A" (return . sort $ varSort 0) $ (El (varSort 1) <$> primInf <#> varM 1 <@> varM 0) --> (El (varSort 1) <$> varM 0) -- | Binds the INFINITY builtin, but does not change the type's -- definition. bindBuiltinInf :: A.Expr -> TCM () bindBuiltinInf e = bindPostulatedName builtinInf e $ \inf _ -> instantiateFull =<< checkExpr (A.Def inf) =<< typeOfInf -- | Binds the SHARP builtin, and changes the definitions of INFINITY -- and SHARP. -- The following (no longer supported) definition is used: -- -- codata ∞ {a} (A : Set a) : Set a where -- ♯_ : (x : A) → ∞ A bindBuiltinSharp :: A.Expr -> TCM () bindBuiltinSharp e = bindPostulatedName builtinSharp e $ \sharp sharpDefn -> do sharpType <- typeOfSharp TelV fieldTel _ <- telView sharpType sharpE <- instantiateFull =<< checkExpr (A.Def sharp) sharpType Def inf _ <- ignoreSharing <$> primInf infDefn <- getConstInfo inf addConstant (defName infDefn) $ infDefn { defPolarity = [] -- not monotone , defArgOccurrences = [Unused, StrictPos] , theDef = Record { recPars = 2 , recInduction = Just CoInductive , recClause = Nothing , recConHead = ConHead sharp CoInductive [] -- flat is added later , recConType = sharpType , recNamedCon = True , recFields = [] -- flat is added later , recTel = fieldTel , recRecursive = False , recEtaEquality = False , recMutual = [] , recAbstr = ConcreteDef } } addConstant sharp $ sharpDefn { theDef = Constructor { conPars = 2 , conSrcCon = ConHead sharp CoInductive [] -- flat is added as field later , conData = defName infDefn , conAbstr = ConcreteDef , conInd = CoInductive } } return sharpE -- | Binds the FLAT builtin, and changes its definition. -- The following (no longer supported) definition is used: -- -- ♭ : ∀ {a} {A : Set a} → ∞ A → A -- ♭ (♯ x) = x bindBuiltinFlat :: A.Expr -> TCM () bindBuiltinFlat e = bindPostulatedName builtinFlat e $ \ flat flatDefn -> do flatE <- instantiateFull =<< checkExpr (A.Def flat) =<< typeOfFlat Def sharp _ <- ignoreSharing <$> primSharp kit <- requireLevels Def inf _ <- ignoreSharing <$> primInf let sharpCon = ConHead sharp CoInductive [flat] level = El (mkType 0) $ Def (typeName kit) [] tel :: Telescope tel = ExtendTel (domH $ level) $ Abs "a" $ ExtendTel (domH $ sort $ varSort 0) $ Abs "A" $ ExtendTel (domN $ El (varSort 1) $ var 0) $ Abs "x" $ EmptyTel infA = El (varSort 2) $ Def inf [ Apply $ defaultArg $ var 1 ] cpi = ConPatternInfo Nothing $ Just $ defaultArg infA let clause = Clause { clauseRange = noRange , clauseTel = tel , clausePerm = idP 1 , namedClausePats = [ argN $ Named Nothing $ ConP sharpCon cpi [ argN $ Named Nothing $ VarP "x" ] ] , clauseBody = Bind $ Abs "x" $ Body $ var 0 , clauseType = Just $ defaultArg $ El (varSort 2) $ var 1 } cc = Case 0 $ Branches False (Map.singleton sharp $ WithArity 1 $ Done [defaultArg "x"] $ var 0) Map.empty Nothing projection = Projection { projProper = Just flat , projFromType = inf , projIndex = 3 , projDropPars = teleNoAbs (take 2 $ telToList tel) $ Lam defaultArgInfo $ Abs "x" $ Var 0 [Proj flat] , projArgInfo = defaultArgInfo } addConstant flat $ flatDefn { defPolarity = [] , defArgOccurrences = [StrictPos] -- changing that to [Mixed] destroys monotonicity of 'Rec' in test/succeed/GuardednessPreservingTypeConstructors , theDef = Function { funClauses = [clause] , funCompiled = Just $ cc , funInv = NotInjective , funMutual = [] , funAbstr = ConcreteDef , funDelayed = NotDelayed , funProjection = Just projection , funStatic = False , funCopy = False , funTerminates = Just True , funExtLam = Nothing , funWith = Nothing , funCopatternLHS = isCopatternLHS [clause] } } -- register flat as record field for constructor sharp modifySignature $ updateDefinition sharp $ updateTheDef $ \ def -> def { conSrcCon = sharpCon } modifySignature $ updateDefinition inf $ updateTheDef $ \ def -> def { recConHead = sharpCon, recFields = [defaultArg flat] } return flatE -- The coinductive primitives. -- moved to TypeChecking.Monad.Builtin Agda-2.4.2.5/src/full/Agda/TypeChecking/Rules/LHS/0000755000000000000000000000000012635075266017402 5ustar0000000000000000Agda-2.4.2.5/src/full/Agda/TypeChecking/Rules/LHS/ProblemRest.hs0000644000000000000000000001401712635075266022177 0ustar0000000000000000{-# LANGUAGE CPP #-} {-# LANGUAGE TupleSections #-} module Agda.TypeChecking.Rules.LHS.ProblemRest where import Agda.Syntax.Common import Agda.Syntax.Internal as I import qualified Agda.Syntax.Abstract as A import Agda.TypeChecking.Monad import Agda.TypeChecking.Pretty import Agda.TypeChecking.Telescope import Agda.TypeChecking.Substitute import Agda.TypeChecking.Rules.LHS.Problem import Agda.TypeChecking.Rules.LHS.Implicit import Agda.Utils.Functor (($>)) import Agda.Utils.Size import Agda.Utils.Permutation #include "undefined.h" import Agda.Utils.Impossible -- MOVED from LHS: -- | Rename the variables in a telescope using the names from a given pattern useNamesFromPattern :: [A.NamedArg A.Pattern] -> Telescope -> Telescope useNamesFromPattern ps = telFromList . zipWith ren (toPats ps ++ repeat dummy) . telToList where dummy = A.WildP __IMPOSSIBLE__ ren (A.VarP x) (Dom info (_, a)) | notHidden info = Dom info (nameToArgName x, a) ren A.AbsurdP{} (Dom info (_, a)) | notHidden info = Dom info ("()", a) -- Andreas, 2013-03-13: inserted the following line in the hope to fix issue 819 -- but it does not do the job, instead, it puts a lot of "_"s -- instead of more sensible names into error messages. -- ren A.WildP{} (Dom info (_, a)) | notHidden info = Dom info ("_", a) ren A.PatternSynP{} _ = __IMPOSSIBLE__ -- ensure there are no syns left ren _ a = a toPats = map namedArg -- | Are there any untyped user patterns left? noProblemRest :: Problem -> Bool noProblemRest (Problem _ _ _ (ProblemRest ps _)) = null ps -- | Construct an initial 'split' 'Problem' from user patterns. -- Example: -- @ -- -- Case : {A : Set} → Maybe A → Set → Set → Set -- Case nothing B C = B -- Case (just _) B C = C -- -- sample : {A : Set} (m : Maybe A) → Case m Bool (Maybe A → Bool) -- sample (just a) (just b) = true -- sample (just a) nothing = false -- sample nothing = true -- @ -- The problem generated for the first clause of @sample@ -- with patterns @just a, just b@ would be: -- @ -- problemInPat = ["_", "just a"] -- problemOutPat = [identity-permutation, ["A", "m"]] -- problemTel = [A : Set, m : Maybe A] -- problemRest = -- restPats = ["just b"] -- restType = "Case m Bool (Maybe A -> Bool)" -- @ problemFromPats :: [A.NamedArg A.Pattern] -- ^ The user patterns. -> Type -- ^ The type the user patterns eliminate. -> TCM Problem -- ^ The initial problem constructed from the user patterns. problemFromPats ps a = do -- For the initial problem, do not insert trailing implicits. -- This has the effect of not including trailing hidden domains in the problem telescope. -- In all later call to insertImplicitPatterns, we can then use ExpandLast. ps <- insertImplicitPatternsT DontExpandLast ps a -- unless (size tel0' >= size ps) $ typeError $ TooManyArgumentsInLHS a -- Redo the telView, in order to *not* normalize the clause type further than necessary. -- (See issue 734.) TelV tel0 b <- telViewUpTo (length ps) a let gamma = useNamesFromPattern ps tel0 as = telToList gamma (ps1,ps2) = splitAt (size as) ps -- now (gamma -> b) = a and |gamma| = |ps1| pr = ProblemRest ps2 $ defaultArg b -- internal patterns start as all variables let ips = map (argFromDom . fmap (namedVarP . fst)) as -- the initial problem for starting the splitting let problem = Problem ps1 (idP $ size ps1, ips) gamma pr :: Problem reportSDoc "tc.lhs.problem" 10 $ vcat [ text "checking lhs -- generated an initial split problem:" , nest 2 $ vcat [ text "ps =" <+> fsep (map prettyA ps) , text "a =" <+> prettyTCM a , text "xs =" <+> text (show $ map (fst . unDom) as) , text "ps1 =" <+> fsep (map prettyA ps1) -- , text "ips =" <+> prettyTCM ips -- no prettyTCM instance , text "gamma =" <+> prettyTCM gamma , text "ps2 =" <+> fsep (map prettyA ps2) , text "b =" <+> addCtxTel gamma (prettyTCM b) ] ] return problem -- | Try to move patterns from the problem rest into the problem. -- Possible if type of problem rest has been updated to a function type. updateProblemRest_ :: Problem -> TCM (Nat, Problem) updateProblemRest_ p@(Problem ps0 (perm0@(Perm n0 is0), qs0) tel0 (ProblemRest ps a)) = do ps <- insertImplicitPatternsT DontExpandLast ps $ unArg a -- (Issue 734: Do only the necessary telView to preserve clause types as much as possible.) TelV tel b <- telViewUpTo (length ps) $ unArg a let gamma = useNamesFromPattern ps tel as = telToList gamma (ps1,ps2) = splitAt (size as) ps tel1 = telFromList $ telToList tel0 ++ as pr = ProblemRest ps2 (a $> b) qs1 = map (argFromDom . fmap (namedVarP . fst)) as n = size as perm1 = liftP n perm0 -- IS: Perm (n0 + n) $ is0 ++ [n0..n0+n-1] reportSDoc "tc.lhs.problem" 10 $ addCtxTel tel0 $ vcat [ text "checking lhs -- updated split problem:" , nest 2 $ vcat [ text "ps =" <+> fsep (map prettyA ps) , text "a =" <+> prettyTCM a , text "xs =" <+> text (show $ map (fst . unDom) as) , text "ps1 =" <+> fsep (map prettyA ps1) , text "gamma =" <+> prettyTCM gamma , text "ps2 =" <+> fsep (map prettyA ps2) , text "b =" <+> addCtxTel gamma (prettyTCM b) ] ] return $ (n,) $ Problem (ps0 ++ ps1) (perm1, raise n qs0 ++ qs1) tel1 pr updateProblemRest :: LHSState -> TCM LHSState updateProblemRest st@LHSState { lhsProblem = p } = do (n, p') <- updateProblemRest_ p if (n == 0) then return st else do let tau = raiseS n return $ LHSState { lhsProblem = p' , lhsSubst = applySubst tau (lhsSubst st) , lhsDPI = applySubst tau (lhsDPI st) , lhsAsB = applySubst tau (lhsAsB st) } Agda-2.4.2.5/src/full/Agda/TypeChecking/Rules/LHS/Implicit.hs0000644000000000000000000001426012635075266021513 0ustar0000000000000000{-# LANGUAGE CPP #-} {-# LANGUAGE PatternGuards #-} module Agda.TypeChecking.Rules.LHS.Implicit where import Prelude hiding (null) import Control.Applicative hiding (empty) import Control.Monad (forM) import Agda.Syntax.Common import Agda.Syntax.Position import Agda.Syntax.Info import Agda.Syntax.Internal as I import Agda.Syntax.Abstract (IsProjP(..)) import qualified Agda.Syntax.Abstract as A import Agda.Syntax.Translation.InternalToAbstract (reify) import Agda.TypeChecking.Monad import Agda.TypeChecking.Implicit import Agda.TypeChecking.Substitute import Agda.TypeChecking.Pretty import Agda.TypeChecking.Records import Agda.TypeChecking.Reduce import Agda.TypeChecking.Telescope import Agda.TypeChecking.Rules.LHS.Problem import Agda.Utils.Function import Agda.Utils.Functor import Agda.Utils.Maybe import Agda.Utils.Monad import Agda.Utils.Null #include "undefined.h" import Agda.Utils.Impossible -- | Insert implicit patterns in a problem. insertImplicitProblem :: Problem -> TCM Problem insertImplicitProblem (Problem ps qs tel pr) = do reportSDoc "tc.lhs.imp" 15 $ sep [ text "insertImplicits" , nest 2 $ text "ps = " <+> do brackets $ fsep $ punctuate comma $ map prettyA ps , nest 2 $ text "tel = " <+> prettyTCM tel ] ps' <- insertImplicitPatterns ExpandLast ps tel reportSDoc "tc.lhs.imp" 15 $ sep [ text "insertImplicits finished" , nest 2 $ text "ps' = " <+> do brackets $ fsep $ punctuate comma $ map prettyA ps' ] return $ Problem ps' qs tel pr -- | Eta-expand implicit pattern if of record type. expandImplicitPattern :: Type -> A.NamedArg A.Pattern -> TCM (A.NamedArg A.Pattern) expandImplicitPattern a p = maybe (return p) return =<< expandImplicitPattern' a p -- | Try to eta-expand implicit pattern. -- Returns 'Nothing' unless dealing with a record type that has eta-expansion -- and a constructor @c@. In this case, it returns 'Just' @c _ _ ... _@ -- (record constructor applied to as many implicit patterns as there are fields). expandImplicitPattern' :: Type -> A.NamedArg A.Pattern -> TCM (Maybe (A.NamedArg A.Pattern)) expandImplicitPattern' a p | A.WildP{} <- namedArg p, getHiding p /= Instance = do -- Eta expand implicit patterns of record type (issue 473), -- but not instance arguments since then they won't be found -- by the instance search caseMaybeM (isEtaRecordType =<< reduce a) (return Nothing) $ \ (d, _) -> do -- Andreas, 2012-06-10: only expand guarded records, -- otherwise we might run into an infinite loop def <- getRecordDef d -- Andreas, 2013-03-21: only expand records that have a constructor: if not (recNamedCon def) then return Nothing else do -- generate one implicit pattern for each field qs <- forM (recFields def) $ \ f -> flip Arg implicitP <$> reify (argInfo f) -- generate the pattern (c _ _ ... _) let q = A.ConP (ConPatInfo ConPImplicit patNoRange) (A.AmbQ [recCon def]) qs -- equip it with the name/arginfo of the original implicit pattern p' = updateNamedArg (const q) p -- WAS: ((q <$) <$> p) -- Andreas, 2013-03-21 forbiddingly cryptic return $ Just p' | otherwise = return Nothing implicitP :: Named_ A.Pattern implicitP = unnamed $ A.WildP $ PatRange $ noRange -- | Insert implicit patterns in a list of patterns. -- Even if 'DontExpandLast', trailing SIZELT patterns are inserted. insertImplicitPatterns :: ExpandHidden -> [A.NamedArg A.Pattern] -> Telescope -> TCM [A.NamedArg A.Pattern] insertImplicitPatterns exh ps tel = insertImplicitPatternsT exh ps (telePi tel typeDontCare) -- | Insert trailing SizeLt patterns, if any. insertImplicitSizeLtPatterns :: Type -> TCM [A.NamedArg A.Pattern] insertImplicitSizeLtPatterns t = do -- Testing for SizeLt. In case of blocked type, we return no. -- We assume that on the LHS, we know the type. (TODO: Sufficient?) isSize <- isSizeTypeTest let isBounded BoundedNo = False isBounded BoundedLt{} = True isSizeLt t = maybe False isBounded . isSize <$> reduce t -- Search for the last SizeLt type among the hidden arguments. TelV tel _ <- telView t let ts = reverse $ takeWhile (not . visible) $ telToList tel keep <- reverse <$> dropWhileM (not <.> isSizeLt . snd . unDom) ts -- Insert implicit patterns upto (including) the last SizeLt type. forM keep $ \ (Dom ai _) -> flip Arg implicitP <$> reify ai -- | Insert implicit patterns in a list of patterns. -- Even if 'DontExpandLast', trailing SIZELT patterns are inserted. insertImplicitPatternsT :: ExpandHidden -> [A.NamedArg A.Pattern] -> Type -> TCM [A.NamedArg A.Pattern] insertImplicitPatternsT DontExpandLast [] a = insertImplicitSizeLtPatterns a insertImplicitPatternsT exh ps a = do TelV tel b <- telViewUpTo' (-1) (not . visible) a reportSDoc "tc.lhs.imp" 20 $ sep [ text "insertImplicitPatternsT" , nest 2 $ text "ps = " <+> do brackets $ fsep $ punctuate comma $ map prettyA ps , nest 2 $ text "tel = " <+> prettyTCM tel , nest 2 $ text "b = " <+> prettyTCM b ] case ps of [] -> insImp dummy tel p : ps -> do -- Andreas, 2015-05-11. -- If p is a projection pattern, make it visible for the purpose of -- calling insImp / insertImplicit, to get correct behavior. let p' = applyWhen (isJust $ isProjP p) (setHiding NotHidden) p hs <- insImp p' tel case hs of [] -> do a <- reduce a case ignoreSharing $ unEl a of Pi arg b -> do p <- expandImplicitPattern (unDom arg) p (p :) <$> insertImplicitPatternsT exh ps (absBody b) _ -> return (p : ps) hs -> insertImplicitPatternsT exh (hs ++ p : ps) (telePi tel b) where dummy = defaultNamedArg (A.VarP __IMPOSSIBLE__) insImp p EmptyTel = return [] insImp p tel = case insertImplicit p $ map (argFromDom . fmap fst) $ telToList tel of BadImplicits -> typeError WrongHidingInLHS NoSuchName x -> typeError WrongHidingInLHS ImpInsert n -> return $ map implicitArg n NoInsertNeeded -> return [] implicitArg h = setHiding h $ defaultArg implicitP Agda-2.4.2.5/src/full/Agda/TypeChecking/Rules/LHS/Problem.hs0000644000000000000000000001650512635075266021345 0ustar0000000000000000-- {-# LANGUAGE CPP #-} {-# LANGUAGE DeriveFoldable #-} {-# LANGUAGE DeriveFunctor #-} {-# LANGUAGE DeriveTraversable #-} {-# LANGUAGE FlexibleInstances #-} module Agda.TypeChecking.Rules.LHS.Problem where import Prelude hiding (null) import Data.Foldable ( Foldable ) import Data.Traversable import Agda.Syntax.Common import Agda.Syntax.Literal import Agda.Syntax.Position import Agda.Syntax.Internal as I import Agda.Syntax.Internal.Pattern import qualified Agda.Syntax.Abstract as A import Agda.TypeChecking.Substitute as S import Agda.TypeChecking.Pretty import Agda.Utils.Except ( Error(noMsg, strMsg) ) import Agda.Utils.Null import Agda.Utils.Permutation type Substitution = [Maybe Term] type FlexibleVars = [FlexibleVar Nat] -- | When we encounter a flexible variable in the unifier, where did it come from? -- The alternatives are ordered such that we will assign the higher one first, -- i.e., first we try to assign a @DotFlex@, then... data FlexibleVarKind = RecordFlex [FlexibleVarKind] -- ^ From a record pattern ('ConP'). -- Saves the 'FlexibleVarKind' of its subpatterns. | ImplicitFlex -- ^ From a hidden formal argument or underscore ('WildP'). | DotFlex -- ^ From a dot pattern ('DotP'). deriving (Eq, Ord, Show) -- | Flexible variables are equipped with information where they come from, -- in order to make a choice which one to assign when two flexibles are unified. data FlexibleVar a = FlexibleVar { flexHiding :: Hiding , flexKind :: FlexibleVarKind , flexVar :: a } deriving (Eq, Show, Functor, Foldable, Traversable) instance LensHiding (FlexibleVar a) where getHiding = flexHiding mapHiding f x = x { flexHiding = f (flexHiding x) } defaultFlexibleVar :: a -> FlexibleVar a defaultFlexibleVar a = FlexibleVar Hidden ImplicitFlex a flexibleVarFromHiding :: Hiding -> a -> FlexibleVar a flexibleVarFromHiding h a = FlexibleVar h ImplicitFlex a instance Ord (FlexibleVar Nat) where (FlexibleVar h2 f2 i2) <= (FlexibleVar h1 f1 i1) = f1 > f2 || (f1 == f2 && (hgt h1 h2 || (h1 == h2 && i1 <= i2))) where hgt x y | x == y = False hgt Hidden _ = True hgt _ Hidden = False hgt Instance _ = True hgt _ _ = False -- | State of typechecking a LHS; input to 'split'. -- [Ulf Norell's PhD, page. 35] -- -- In @Problem ps p delta@, -- @ps@ are the user patterns of supposed type @delta@. -- @p@ is the pattern resulting from the splitting. data Problem' p = Problem { problemInPat :: [A.NamedArg A.Pattern] -- ^ User patterns. , problemOutPat :: p -- ^ Patterns after splitting. , problemTel :: Telescope -- ^ Type of patterns. , problemRest :: ProblemRest -- ^ Patterns that cannot be typed yet. } deriving Show -- | The permutation should permute @allHoles@ of the patterns to correspond to -- the abstract patterns in the problem. type Problem = Problem' (Permutation, [I.NamedArg Pattern]) type ProblemPart = Problem' () -- | User patterns that could not be given a type yet. -- -- Example: -- @ -- f : (b : Bool) -> if b then Nat else Nat -> Nat -- f true = zero -- f false zero = zero -- f false (suc n) = n -- @ -- In this sitation, for clause 2, we construct an initial problem -- @ -- problemInPat = [false] -- problemTel = (b : Bool) -- problemRest.restPats = [zero] -- problemRest.restType = if b then Nat else Nat -> Nat -- @ -- As we instantiate @b@ to @false@, the 'restType' reduces to -- @Nat -> Nat@ and we can move pattern @zero@ over to @problemInPat@. data ProblemRest = ProblemRest { restPats :: [A.NamedArg A.Pattern] -- ^ List of user patterns which could not yet be typed. , restType :: I.Arg Type -- ^ Type eliminated by 'restPats'. -- Can be 'Irrelevant' to indicate that we came by -- an irrelevant projection and, hence, the rhs must -- be type-checked in irrelevant mode. } deriving Show data Focus = Focus { focusCon :: QName , focusPatOrigin:: ConPOrigin -- ^ Do we come from an implicit or record pattern? , focusConArgs :: [A.NamedArg A.Pattern] , focusRange :: Range , focusOutPat :: OneHolePatterns , focusHoleIx :: Int -- ^ Index of focused variable in the out patterns. , focusDatatype :: QName , focusParams :: [I.Arg Term] , focusIndices :: [I.Arg Term] , focusType :: Type -- ^ Type of variable we are splitting, kept for record patterns. } | LitFocus Literal OneHolePatterns Int Type -- | Result of 'splitProblem': Determines position for the next split. data SplitProblem = -- | Split on constructor pattern. Split { splitLPats :: ProblemPart -- ^ The typed user patterns left of the split position. -- Invariant: @'problemRest' == empty@. , splitAsNames :: [Name] -- ^ The as-bindings for the focus. , splitFocus :: I.Arg Focus -- ^ How to split the variable at the split position. , splitRPats :: Abs ProblemPart -- ^ The typed user patterns right of the split position. } | -- | Split on projection pattern. SplitRest { splitProjection :: I.Arg QName -- ^ The projection could be belonging to an irrelevant record field. , splitRestType :: Type } -- | Put a typed pattern on the very left of a @SplitProblem@. consSplitProblem :: A.NamedArg A.Pattern -- ^ @p@ A pattern. -> ArgName -- ^ @x@ The name of the argument (from its type). -> I.Dom Type -- ^ @t@ Its type. -> SplitProblem -- ^ The split problem, containing 'splitLPats' @ps;xs:ts@. -> SplitProblem -- ^ The result, now containing 'splitLPats' @(p,ps);(x,xs):(t,ts)@. consSplitProblem p x dom s@SplitRest{} = s consSplitProblem p x dom s@Split{ splitLPats = ps } = s{ splitLPats = consProblem' ps } where consProblem' (Problem ps () tel pr) = Problem (p:ps) () (ExtendTel dom $ Abs x tel) pr data DotPatternInst = DPI A.Expr Term (I.Dom Type) data AsBinding = AsB Name Term Type -- | State worked on during the main loop of checking a lhs. data LHSState = LHSState { lhsProblem :: Problem , lhsSubst :: S.Substitution , lhsDPI :: [DotPatternInst] , lhsAsB :: [AsBinding] } instance Subst ProblemRest where applySubst rho p = p { restType = applySubst rho $ restType p } instance Subst (Problem' p) where applySubst rho p = p { problemTel = applySubst rho $ problemTel p , problemRest = applySubst rho $ problemRest p } instance Subst DotPatternInst where applySubst rho (DPI e v a) = uncurry (DPI e) $ applySubst rho (v,a) instance Subst AsBinding where applySubst rho (AsB x v a) = uncurry (AsB x) $ applySubst rho (v, a) instance PrettyTCM DotPatternInst where prettyTCM (DPI e v a) = sep [ prettyA e <+> text "=" , nest 2 $ prettyTCM v <+> text ":" , nest 2 $ prettyTCM a ] instance PrettyTCM AsBinding where prettyTCM (AsB x v a) = sep [ prettyTCM x <> text "@" <> parens (prettyTCM v) , nest 2 $ text ":" <+> prettyTCM a ] instance Null ProblemRest where null = null . restPats empty = ProblemRest { restPats = [], restType = defaultArg typeDontCare } instance Null a => Null (Problem' a) where null p = null (problemInPat p) && null (problemRest p) empty = Problem empty empty empty empty Agda-2.4.2.5/src/full/Agda/TypeChecking/Rules/LHS/Split.hs0000644000000000000000000003531112635075266021034 0ustar0000000000000000{-# LANGUAGE CPP #-} {-# LANGUAGE PatternGuards #-} {-# LANGUAGE ScopedTypeVariables #-} module Agda.TypeChecking.Rules.LHS.Split ( splitProblem ) where import Prelude hiding (null) import Control.Applicative hiding (empty) import Control.Monad.Trans ( lift ) import Control.Monad.Trans.Maybe import Data.Maybe (fromMaybe) import Data.List hiding (null) import Data.Traversable hiding (mapM, sequence) import Agda.Interaction.Options import Agda.Interaction.Highlighting.Generate (storeDisambiguatedName) import Agda.Syntax.Common import Agda.Syntax.Literal import Agda.Syntax.Position import Agda.Syntax.Internal as I import Agda.Syntax.Internal.Pattern import Agda.Syntax.Abstract (IsProjP(..)) import qualified Agda.Syntax.Abstract as A import Agda.Syntax.Abstract.Views (asView) import qualified Agda.Syntax.Info as A import Agda.TypeChecking.Monad import Agda.TypeChecking.Monad.Builtin import Agda.TypeChecking.Constraints import Agda.TypeChecking.Conversion import Agda.TypeChecking.Datatypes import Agda.TypeChecking.Free import Agda.TypeChecking.Irrelevance import Agda.TypeChecking.MetaVars import Agda.TypeChecking.Patterns.Abstract import Agda.TypeChecking.Pretty import Agda.TypeChecking.Records import Agda.TypeChecking.Reduce import Agda.TypeChecking.Substitute import Agda.TypeChecking.Rules.LHS.Problem import Agda.Utils.Functor ((<.>)) import Agda.Utils.List import Agda.Utils.ListT import Agda.Utils.Maybe import Agda.Utils.Monad import Agda.Utils.Null import Agda.Utils.Permutation import Agda.Utils.Tuple import qualified Agda.Utils.Pretty as P #include "undefined.h" import Agda.Utils.Impossible -- | Split a problem at the first constructor pattern which is -- actually of datatype type. -- -- Or, if there is no constructor pattern left and the rest type -- is a record type and the first rest pattern is a projection -- pattern, split the rest type. -- -- Implicit patterns should have been inserted. splitProblem :: Maybe QName -- ^ The definition we are checking at the moment. -> Problem -- ^ The current state of the lhs patterns. -> ListT TCM SplitProblem splitProblem mf (Problem ps (perm, qs) tel pr) = do lift $ do reportSLn "tc.lhs.split" 20 $ "initiating splitting" ++ maybe "" ((" for definition " ++) . show) mf reportSDoc "tc.lhs.split" 30 $ sep [ nest 2 $ text "ps =" <+> sep (map (P.parens <.> prettyA) ps) , nest 2 $ text "qs =" <+> sep (map (P.parens <.> prettyTCM . namedArg) qs) , nest 2 $ text "perm =" <+> prettyTCM perm , nest 2 $ text "tel =" <+> prettyTCM tel ] splitP ps (permute perm $ zip [0..] $ allHoles qs) tel where -- Result splitting splitRest :: ProblemRest -> ListT TCM SplitProblem splitRest (ProblemRest (p : ps) b) | Just f <- mf = do let failure = typeError $ CannotEliminateWithPattern p $ unArg b notProjP = typeError $ NotAProjectionPattern p notRecord = failure -- lift $ typeError $ ShouldBeRecordType $ unArg b wrongHiding :: MonadTCM tcm => QName -> tcm a wrongHiding d = typeError . GenericDocError =<< do liftTCM $ text "Wrong hiding used for projection " <+> prettyTCM d lift $ reportSDoc "tc.lhs.split" 20 $ sep [ text "splitting problem rest" , nest 2 $ text "pattern p =" <+> prettyA p , nest 2 $ text "eliminates type b =" <+> prettyTCM b ] -- If the pattern is not a projection pattern, that's an error. -- Probably then there were too many arguments. caseMaybe (isProjP p) failure $ \ d -> do -- So it is a projection pattern (d = projection name), is it? caseMaybeM (lift $ isProjection d) notProjP $ \ proj -> case proj of -- Andreas, 2015-05-06 issue 1413 projProper=Nothing is not impossible Projection{projProper = Nothing} -> notProjP Projection{projProper = Just d, projIndex = n, projArgInfo = ai} -> do -- If projIndex==0, then the projection is already applied -- to the record value (like in @open R r@), and then it -- is no longer a projection but a record field. unless (n > 0) notProjP unless (getHiding p == getHiding ai) $ wrongHiding d lift $ reportSLn "tc.lhs.split" 90 "we are a projection pattern" -- If the target is not a record type, that's an error. -- It could be a meta, but since we cannot postpone lhs checking, we crash here. caseMaybeM (lift $ isRecordType $ unArg b) notRecord $ \(r, vs, def) -> case def of Record{ recFields = fs } -> do lift $ reportSDoc "tc.lhs.split" 20 $ sep [ text $ "we are of record type r = " ++ show r , text "applied to parameters vs = " <+> prettyTCM vs , text $ "and have fields fs = " ++ show fs , text $ "original proj d = " ++ show d ] -- Get the field decoration. -- If the projection pattern @d@ is not a field name, that's an error. argd <- maybe failure return $ find ((d ==) . unArg) fs let es = patternsToElims perm qs -- the record "self" is the definition f applied to the patterns fvs <- lift $ freeVarsToApply f let self = defaultArg $ Def f (map Apply fvs) `applyE` es -- get the type of projection d applied to "self" dType <- lift $ defType <$> getConstInfo d -- full type! lift $ reportSDoc "tc.lhs.split" 20 $ sep [ text "we are self = " <+> prettyTCM (unArg self) , text "being projected by dType = " <+> prettyTCM dType ] return $ SplitRest argd $ dType `apply` (vs ++ [self]) _ -> __IMPOSSIBLE__ -- if there are no more patterns left in the problem rest, there is nothing to split: splitRest _ = mzero -- | In @splitP aps iqs tel@, -- @aps@ are the user patterns on which we are splitting (inPats), -- @ips@ are the one-hole patterns of the current split state (outPats) -- in one-to-one correspondence with the pattern variables -- recorded in @tel@. splitP :: [A.NamedArg A.Pattern] -> [(Int, OneHolePatterns)] -> Telescope -> ListT TCM SplitProblem -- the next two cases violate the one-to-one correspondence of qs and tel splitP _ [] (ExtendTel _ _) = __IMPOSSIBLE__ splitP _ (_:_) EmptyTel = __IMPOSSIBLE__ -- no more patterns? pull them from the rest splitP [] _ _ = splitRest pr -- patterns but no types for them? Impossible. splitP ps [] EmptyTel = __IMPOSSIBLE__ -- (we can never have an ExtendTel without Abs) splitP _ _ (ExtendTel _ NoAbs{}) = __IMPOSSIBLE__ -- pattern with type? Let's get to work: splitP ps0@(p : ps) qs0@((i, q) : qs) tel0@(ExtendTel dom@(Dom ai a) xtel@(Abs x tel)) = do liftTCM $ reportSDoc "tc.lhs.split" 30 $ sep [ text "splitP looking at pattern" , nest 2 $ text "p =" <+> prettyA p , nest 2 $ text "dom =" <+> prettyTCM dom ] -- Possible reinvokations: let -- 1. Redo this argument (after meta instantiation). tryAgain = splitP ps0 qs0 tel0 -- 2. Try to split on next argument. keepGoing = consSplitProblem p x dom <$> do underAbstraction dom xtel $ \ tel -> splitP ps qs tel p <- lift $ expandLitPattern p case asView $ namedArg p of -- Case: projection pattern. That's an error. (_, A.DefP _ d ps) -> typeError $ if null ps then CannotEliminateWithPattern p (telePi tel0 $ unArg $ restType pr) else IllformedProjectionPattern $ namedArg p -- Case: literal pattern. (xs, p@(A.LitP lit)) -> do -- Note that, in the presence of --without-K, this branch is -- based on the assumption that the types of literals are -- not indexed. -- Andreas, 2010-09-07 cannot split on irrelevant args when (unusableRelevance $ getRelevance ai) $ typeError $ SplitOnIrrelevant p dom -- Succeed if the split type is (already) equal to the type of the literal. ifNotM (lift $ tryConversion $ equalType a =<< litType lit) {- then -} keepGoing $ {- else -} return Split { splitLPats = empty , splitAsNames = xs , splitFocus = Arg ai $ LitFocus lit q i a , splitRPats = Abs x $ Problem ps () tel __IMPOSSIBLE__ } `mplus` keepGoing -- Case: constructor pattern. (xs, p@(A.ConP ci (A.AmbQ cs) args)) -> do let tryInstantiate a' | [c] <- cs = do -- Type is blocked by a meta and constructor is unambiguous, -- in this case try to instantiate the meta. ok <- lift $ do Constructor{ conData = d } <- theDef <$> getConstInfo c dt <- defType <$> getConstInfo d vs <- newArgsMeta dt Sort s <- ignoreSharing . unEl <$> reduce (apply dt vs) tryConversion $ equalType a' (El s $ Def d $ map Apply vs) if ok then tryAgain else keepGoing | otherwise = keepGoing -- ifBlockedType reduces the type ifBlockedType a (const tryInstantiate) $ \ a' -> do case ignoreSharing $ unEl a' of -- Subcase: split type is a Def. Def d es -> do def <- liftTCM $ theDef <$> getConstInfo d -- We cannot split on (shape-)irrelevant non-records. -- Andreas, 2011-10-04 unless allowed by option unless (defIsRecord def) $ when (unusableRelevance $ getRelevance ai) $ unlessM (liftTCM $ optExperimentalIrrelevance <$> pragmaOptions) $ typeError $ SplitOnIrrelevant p dom -- Check that we are at record or data type and return -- the number of parameters. let mp = case def of Datatype{dataPars = np} -> Just np Record{recPars = np} -> Just np _ -> Nothing case mp of Nothing -> keepGoing Just np -> do let vs = fromMaybe __IMPOSSIBLE__ $ allApplyElims es traceCall (CheckPattern p EmptyTel a) $ do -- TODO: wrong telescope -- Check that we construct something in the right datatype c <- lift $ do cs' <- mapM canonicalName cs d' <- canonicalName d let cons def = case theDef def of Datatype{dataCons = cs} -> cs Record{recConHead = c} -> [conName c] _ -> __IMPOSSIBLE__ cs0 <- cons <$> getConstInfo d' case [ c | (c, c') <- zip cs cs', elem c' cs0 ] of [c] -> do -- If constructor pattern was ambiguous, -- remember our choice for highlighting info. when (length cs >= 2) $ storeDisambiguatedName c return c [] -> typeError $ ConstructorPatternInWrongDatatype (head cs) d cs -> -- if there are more than one we give up (they might have different types) typeError $ CantResolveOverloadedConstructorsTargetingSameDatatype d cs let (pars, ixs) = genericSplitAt np vs lift $ reportSDoc "tc.lhs.split" 10 $ vcat [ sep [ text "splitting on" , nest 2 $ fsep [ prettyA p, text ":", prettyTCM dom ] ] , nest 2 $ text "pars =" <+> fsep (punctuate comma $ map prettyTCM pars) , nest 2 $ text "ixs =" <+> fsep (punctuate comma $ map prettyTCM ixs) ] -- Andreas, 2013-03-22 fixing issue 279 -- To resolve ambiguous constructors, Agda always looks up -- their original definition and reconstructs the parameters -- from the type @Def d vs@ we check against. -- However, the constructor could come from a module instantiation -- with some of the parameters already fixed. -- Agda did not make sure the two parameter lists coincide, -- so we add a check here. -- I guess this issue could be solved more systematically, -- but the extra check here is non-invasive to the existing code. checkParsIfUnambiguous cs d pars (return Split { splitLPats = empty , splitAsNames = xs , splitFocus = Arg ai $ Focus c (A.patOrigin ci) args (getRange p) q i d pars ixs a , splitRPats = Abs x $ Problem ps () tel __IMPOSSIBLE__ }) `mplus` keepGoing -- Subcase: split type is not a Def. _ -> keepGoing -- Case: neither literal nor constructor pattern. _ -> keepGoing -- | @checkParsIfUnambiguous [c] d pars@ checks that the data/record type -- behind @c@ is has initial parameters (coming e.g. from a module instantiation) -- that coincide with an prefix of @pars@. checkParsIfUnambiguous :: MonadTCM tcm => [QName] -> QName -> Args -> tcm () checkParsIfUnambiguous [c] d pars = liftTCM $ do dc <- getConstructorData c a <- reduce (Def dc []) case ignoreSharing a of Def d0 es -> do -- compare parameters let vs = fromMaybe __IMPOSSIBLE__ $ allApplyElims es reportSDoc "tc.lhs.split" 40 $ vcat [ nest 2 $ text "d =" <+> prettyTCM d , nest 2 $ text "d0 (should be == d) =" <+> prettyTCM d0 , nest 2 $ text "dc =" <+> prettyTCM dc ] -- when (d0 /= d) __IMPOSSIBLE__ -- d could have extra qualification t <- typeOfConst d compareArgs [] t (Def d []) vs (take (length vs) pars) _ -> __IMPOSSIBLE__ checkParsIfUnambiguous _ _ _ = return () Agda-2.4.2.5/src/full/Agda/TypeChecking/Rules/LHS/Unify.hs0000644000000000000000000012354612635075266021043 0ustar0000000000000000{-# LANGUAGE CPP #-} {-# LANGUAGE DeriveDataTypeable #-} {-# LANGUAGE DeriveFoldable #-} {-# LANGUAGE DeriveFunctor #-} {-# LANGUAGE DeriveTraversable #-} {-# LANGUAGE FlexibleContexts #-} {-# LANGUAGE FlexibleInstances #-} {-# LANGUAGE GeneralizedNewtypeDeriving #-} {-# LANGUAGE MultiParamTypeClasses #-} {-# LANGUAGE PatternGuards #-} {-# LANGUAGE TupleSections #-} module Agda.TypeChecking.Rules.LHS.Unify where import Prelude hiding (null) import Control.Arrow ((***)) import Control.Applicative hiding (empty) import Control.Monad.State import Control.Monad.Reader import Control.Monad.Writer (WriterT(..), MonadWriter(..), Monoid(..)) import Data.IntMap (IntMap) import qualified Data.IntMap as IntMap import Data.Map (Map) import qualified Data.Map as Map import Data.List hiding (null, sort) import Data.Typeable (Typeable) import Data.Foldable (Foldable) import Data.Traversable (Traversable,traverse) import Agda.Interaction.Options (optInjectiveTypeConstructors) import Agda.Syntax.Common import Agda.Syntax.Internal as I hiding (Substitution) import Agda.Syntax.Literal import Agda.Syntax.Position import Agda.TypeChecking.Monad import Agda.TypeChecking.Monad.Exception import Agda.TypeChecking.Monad.Builtin (constructorForm) import Agda.TypeChecking.Conversion -- equalTerm import Agda.TypeChecking.Constraints import Agda.TypeChecking.Datatypes import Agda.TypeChecking.DropArgs import Agda.TypeChecking.Level (reallyUnLevelView) import Agda.TypeChecking.Reduce import Agda.TypeChecking.Pretty import Agda.TypeChecking.Substitute hiding (Substitution) import qualified Agda.TypeChecking.Substitute as S import Agda.TypeChecking.Telescope import Agda.TypeChecking.Free import Agda.TypeChecking.Records import Agda.TypeChecking.MetaVars (assignV, newArgsMetaCtx) import Agda.TypeChecking.EtaContract import Agda.Interaction.Options (optInjectiveTypeConstructors, optWithoutK) import Agda.TypeChecking.Rules.LHS.Problem -- import Agda.TypeChecking.SyntacticEquality import Agda.Utils.Except ( Error(noMsg, strMsg) , MonadError(catchError, throwError) ) import Agda.Utils.Either import Agda.Utils.List import Agda.Utils.Maybe import Agda.Utils.Monad import Agda.Utils.Null import Agda.Utils.Size #include "undefined.h" import Agda.Utils.Impossible -- | Result of 'unifyIndices'. type UnificationResult = UnificationResult' Substitution data UnificationResult' a = Unifies a -- ^ Unification succeeded. | NoUnify TCErr -- ^ Terms are not unifiable. | DontKnow TCErr -- ^ Some other error happened, unification got stuck. deriving (Typeable, Show, Functor, Foldable, Traversable) -- | Monad for unification. newtype Unify a = U { unUnify :: ReaderT UnifyEnv ( WriterT UnifyOutput ( ExceptionT UnifyException ( StateT UnifyState TCM))) a } deriving ( Monad, MonadIO, Functor, Applicative , MonadException UnifyException, MonadWriter UnifyOutput) instance MonadTCM Unify where liftTCM = U . lift . lift . lift . lift instance MonadState TCState Unify where get = liftTCM $ get put = liftTCM . put instance MonadReader TCEnv Unify where ask = U $ ReaderT $ \ _ -> ask local cont (U (ReaderT f)) = U $ ReaderT $ \ a -> local cont (f a) instance HasConstInfo Unify where getConstInfo = U . lift . lift . lift . lift . getConstInfo getRewriteRulesFor = U . lift . lift . lift . lift . getRewriteRulesFor -- UnifyEnv ------------------------------------------------------------------------ data UnifyMayPostpone = MayPostpone | MayNotPostpone type UnifyEnv = UnifyMayPostpone emptyUEnv :: UnifyEnv emptyUEnv = MayPostpone noPostponing :: Unify a -> Unify a noPostponing = U . local (const MayNotPostpone) . unUnify askPostpone :: Unify UnifyMayPostpone askPostpone = U $ ask -- | Output the result of unification (success or maybe). type UnifyOutput = Unifiable -- | Were two terms unifiable or did we have to postpone some equation such that we are not sure? data Unifiable = Definitely -- ^ Unification succeeded. | Possibly -- ^ Unification did not fail, but we had to postpone a part. -- | Conjunctive monoid. instance Monoid Unifiable where mempty = Definitely mappend Definitely Definitely = Definitely mappend _ _ = Possibly -- | Tell that something could not be unified right now, -- so the unification succeeds only 'Possibly'. reportPostponing :: Unify () reportPostponing = tell Possibly -- | Check whether unification proceeded without postponement. ifClean :: Unify () -> Unify a -> Unify a -> Unify a ifClean m t e = do ok <- snd <$> listen m case ok of Definitely -> t Possibly -> e data Equality = Equal TypeHH Term Term type Sub = IntMap Term data UnifyException = ConstructorMismatch Type Term Term | StronglyRigidOccurrence Type Term Term | UnclearOccurrence Type Term Term | WithoutKException Type Term Term | GenericUnifyException String instance Error UnifyException where strMsg = GenericUnifyException data UnifyState = USt { uniSub :: Sub , uniConstr :: [Equality] } emptyUState :: UnifyState emptyUState = USt IntMap.empty [] -- | Throw-away error message. projectionMismatch :: QName -> QName -> Unify a projectionMismatch f f' = throwException $ GenericUnifyException $ "projections " ++ show f ++ " and " ++ show f' ++ " do not match" constructorMismatch :: Type -> Term -> Term -> Unify a constructorMismatch a u v = throwException $ ConstructorMismatch a u v constructorMismatchHH :: TypeHH -> Term -> Term -> Unify a constructorMismatchHH aHH u v = do ifM (liftTCM fullyApplied `and2M` canCompare aHH) {- then -} (constructorMismatch (leftHH aHH) u v) -- do not report heterogenity {- else -} (throwException (UnclearOccurrence (leftHH aHH) u v)) where -- Comparing constructors at different types is incompatible with univalence canCompare (Het s t) = ifM (liftTCM $ optWithoutK <$> pragmaOptions) (liftTCM $ tryConversion $ equalType s t) -- no constraints left (return True) canCompare Hom{} = return True -- Issue 1497: only fully applied constructors can mismatch fullyApplied = case (ignoreSharing u, ignoreSharing v) of (Con c us, Con d vs) -> do when (c == d) __IMPOSSIBLE__ car <- fromLeft length <$> getConstructorArity (conName c) dar <- fromLeft length <$> getConstructorArity (conName d) return $ length us == car && length vs == dar _ -> return True -- could be literals instance Subst Equality where applySubst rho (Equal a s t) = Equal (applySubst rho a) (applySubst rho s) (applySubst rho t) getSub :: Unify Sub getSub = U $ gets uniSub modSub :: (Sub -> Sub) -> Unify () modSub f = U $ modify $ \s -> s { uniSub = f $ uniSub s } checkEqualities :: [Equality] -> TCM () checkEqualities eqs = noConstraints $ mapM_ checkEq eqs where checkEq (Equal (Hom a) s t) = equalTerm a s t checkEq (Equal (Het a1 a2) s t) = typeError $ HeterogeneousEquality s a1 t a2 -- Andreas, 2014-03-03: Alternatively, one could try to get back -- to a homogeneous situation. Unless there is a case where this -- actually helps, I leave it deactivated. -- KEEP: -- -- checkEq (Equal (Het a1 a2) s t) = do -- noConstraints $ do -- equalType a1 a2 -- equalTerm a1 s t -- `catchError` \ _ -> typeError $ HeterogeneousEquality s a1 t a2 -- | Force equality now instead of postponing it using 'addEquality'. checkEquality :: Type -> Term -> Term -> TCM () checkEquality a u v = noConstraints $ equalTerm a u v -- | Try equality. If constraints remain, postpone (enter unsafe mode). -- Heterogeneous equalities cannot be tried nor reawakened, -- so we can throw them away and flag "dirty". checkEqualityHH :: TypeHH -> Term -> Term -> Unify () checkEqualityHH (Hom a) u v = do ok <- liftTCM $ tryConversion $ equalTerm a u v -- no constraints left -- Jesper, 2013-11-21: Refuse to solve reflexive equations when --without-K is enabled if ok then (whenM (liftTCM $ optWithoutK <$> pragmaOptions) (throwException $ WithoutKException a u v)) else (addEquality a u v) checkEqualityHH aHH@(Het a1 a2) u v = -- reportPostponing -- enter "dirty" mode addEqualityHH aHH u v -- postpone, enter "dirty" mode -- | Check whether heterogeneous situation is really homogeneous. -- If not, give up. forceHom :: TypeHH -> TCM Type forceHom (Hom a) = return a forceHom (Het a1 a2) = a1 <$ do noConstraints $ equalType a1 a2 -- | Check whether heterogeneous situation is really homogeneous. -- If not, return Nothing. makeHom :: TypeHH -> TCM (Maybe Type) makeHom aHH = (Just <$> forceHom aHH) `catchError` \ err -> return Nothing -- | Try to make a possibly heterogeneous term situation homogeneous. tryHom :: TypeHH -> Term -> Term -> TCM TermHH tryHom aHH u v = do a <- forceHom aHH Hom u <$ checkEquality a u v `catchError` \ err -> return $ Het u v addEquality :: Type -> Term -> Term -> Unify () addEquality a = addEqualityHH (Hom a) addEqualityHH :: TypeHH -> Term -> Term -> Unify () addEqualityHH aHH u v = do reportPostponing U $ modify $ \s -> s { uniConstr = Equal aHH u v : uniConstr s } takeEqualities :: Unify [Equality] takeEqualities = U $ do s <- get put $ s { uniConstr = [] } return $ uniConstr s -- | Includes flexible occurrences, metas need to be solved. TODO: relax? -- TODO: later solutions may remove flexible occurences occursCheck :: Nat -> Term -> Type -> Unify () occursCheck i u a = do let v = var i case occurrence i u of -- Andreas, 2011-04-14 -- a strongly rigid recursive occurrences signals unsolvability StronglyRigid -> do liftTCM $ reportSDoc "tc.lhs.unify" 20 $ prettyTCM v <+> text "occurs strongly rigidly in" <+> prettyTCM u throwException $ StronglyRigidOccurrence a v u NoOccurrence -> return () -- this includes irrelevant occurrences! -- any other recursive occurrence leads to unclear situation _ -> do liftTCM $ reportSDoc "tc.lhs.unify" 20 $ prettyTCM v <+> text "occurs in" <+> prettyTCM u throwException $ UnclearOccurrence a v u -- | Assignment with preceding occurs check. (|->) :: Nat -> (Term, Type) -> Unify () i |-> (u, a) = do occursCheck i u a liftTCM $ reportSDoc "tc.lhs.unify.assign" 10 $ prettyTCM (var i) <+> text ":=" <+> prettyTCM u modSub $ IntMap.insert i (killRange u) -- Apply substitution to itself (issue 552) rho <- getSub rho' <- traverse ureduce rho modSub $ const rho' makeSubstitution :: Sub -> S.Substitution makeSubstitution sub | null sub = idS | otherwise = map val [0 .. highestIndex] ++# raiseS (highestIndex + 1) where highestIndex = fst $ IntMap.findMax sub val i = fromMaybe (var i) $ IntMap.lookup i sub -- | Apply the current substitution on a term and reduce to weak head normal form. class UReduce t where ureduce :: t -> Unify t instance UReduce Term where ureduce u = doEtaContractImplicit $ do rho <- makeSubstitution <$> getSub -- Andreas, 2013-10-24 the following call to 'normalise' is problematic -- (see issue 924). Instead, we only normalize if unifyAtomHH is undecided. -- liftTCM $ etaContract =<< normalise (applySubst rho u) -- Andreas, 2011-06-22, fix related to issue 423 -- To make eta contraction work better, I switched reduce to normalise. -- I hope the performance penalty is not big (since we are dealing with -- l.h.s. terms only). -- A systematic solution would make unification type-directed and -- eta-insensitive... liftTCM $ etaContract =<< reduce (applySubst rho u) instance UReduce Type where ureduce (El s t) = El s <$> ureduce t instance UReduce t => UReduce (HomHet t) where ureduce (Hom t) = Hom <$> ureduce t ureduce (Het t1 t2) = Het <$> ureduce t1 <*> ureduce t2 -- Andreas, 2014-03-03 A variant of ureduce that tries to get back -- to a homogeneous situation by checking syntactic equality. -- Did not solve issue 1071, so I am reverting to the old ureduce. -- However, KEEP THIS as an alternative to reconsider. -- Remember to import TypeChecking.SyntacticEquality! -- -- instance (SynEq t, UReduce t) => UReduce (HomHet t) where -- ureduce (Hom t) = Hom <$> ureduce t -- ureduce (Het t1 t2) = do -- t1 <- ureduce t1 -- t2 <- ureduce t2 -- ((t1,t2),equal) <- liftTCM $ checkSyntacticEquality t1 t2 -- -- BRITTLE: syntactic equality only -- return $ if equal then Hom t1 else Het t1 t2 instance UReduce t => UReduce (Maybe t) where ureduce Nothing = return Nothing ureduce (Just t) = Just <$> ureduce t instance (UReduce a, UReduce b) => UReduce (a, b) where ureduce (a, b) = (,) <$> ureduce a <*> ureduce b instance (UReduce a, UReduce b, UReduce c) => UReduce (a, b, c) where ureduce (a, b, c) = (\x y z -> (x, y, z)) <$> ureduce a <*> ureduce b <*> ureduce c instance (UReduce a) => UReduce (I.Arg a) where ureduce (Arg c e) = Arg c <$> ureduce e instance (UReduce a) => UReduce [ a ] where ureduce = sequence . (map ureduce) -- | Take a substitution σ and ensure that no variables from the domain appear -- in the targets. The context of the targets is not changed. -- TODO: can this be expressed using makeSubstitution and applySubst? flattenSubstitution :: Substitution -> Substitution flattenSubstitution s = foldr instantiate s is where -- instantiated variables is = [ i | (i, Just _) <- zip [0..] s ] instantiate :: Nat -> Substitution -> Substitution instantiate i s = map (fmap $ inst i u) s where u = case s !!! i of Just (Just u) -> u _ -> __IMPOSSIBLE__ -- @inst i u v@ replaces index @i@ in @v@ by @u@, without removing the index. inst :: Nat -> Term -> Term -> Term inst i u v = applySubst us v where us = [ var j | j <- [0..i - 1] ] ++# consS u (raiseS $ i + 1) -- | Are we in a homogeneous (one type) or heterogeneous (two types) situation? data HomHet a = Hom a -- ^ homogeneous | Het a a -- ^ heterogeneous deriving (Typeable, Show, Eq, Ord, Functor, Foldable, Traversable) isHom :: HomHet a -> Bool isHom Hom{} = True isHom Het{} = False fromHom :: HomHet a -> a fromHom (Hom a) = a fromHom (Het{}) = __IMPOSSIBLE__ leftHH :: HomHet a -> a leftHH (Hom a) = a leftHH (Het a1 a2) = a1 rightHH :: HomHet a -> a rightHH (Hom a) = a rightHH (Het a1 a2) = a2 instance (Subst a) => Subst (HomHet a) where applySubst rho u = fmap (applySubst rho) u instance (PrettyTCM a) => PrettyTCM (HomHet a) where prettyTCM (Hom a) = prettyTCM a prettyTCM (Het a1 a2) = prettyTCM a1 <+> text "||" <+> prettyTCM a2 type TermHH = HomHet Term type TypeHH = HomHet Type --type FunViewHH = FunV TypeHH type TelHH = Tele (I.Dom TypeHH) type TelViewHH = TelV TypeHH type ArgsHH = HomHet Args absAppHH :: SubstHH t tHH => Abs t -> TermHH -> tHH absAppHH (Abs _ t) u = substHH u t absAppHH (NoAbs _ t) u = trivialHH t class ApplyHH t where applyHH :: t -> HomHet Args -> HomHet t instance ApplyHH Term where applyHH t = fmap (apply t) instance ApplyHH Type where applyHH t = fmap (apply t) substHH :: SubstHH t tHH => TermHH -> t -> tHH substHH = substUnderHH 0 -- | @substHH u t@ substitutes @u@ for the 0th variable in @t@. class SubstHH t tHH where substUnderHH :: Nat -> TermHH -> t -> tHH trivialHH :: t -> tHH instance (Free a, Subst a) => SubstHH (HomHet a) (HomHet a) where substUnderHH n (Hom u) t = fmap (substUnder n u) t substUnderHH n (Het u1 u2) (Hom t) = if n `relevantIn` t then Het (substUnder n u1 t) (substUnder n u2 t) else Hom (substUnder n u1 t) substUnderHH n (Het u1 u2) (Het t1 t2) = Het (substUnder n u1 t1) (substUnder n u2 t2) trivialHH = id instance SubstHH Term (HomHet Term) where substUnderHH n uHH t = fmap (\ u -> substUnder n u t) uHH trivialHH = Hom instance SubstHH Type (HomHet Type) where substUnderHH n uHH (El s t) = fmap (\ u -> El s $ substUnder n u t) uHH -- fmap $ fmap (\ (El s v) -> El s $ substUnderHH n u v) -- we ignore sorts in substitution, since they do not contain -- terms we can match on trivialHH = Hom instance SubstHH a b => SubstHH (I.Arg a) (I.Arg b) where substUnderHH n u = fmap $ substUnderHH n u trivialHH = fmap trivialHH instance SubstHH a b => SubstHH (I.Dom a) (I.Dom b) where substUnderHH n u = fmap $ substUnderHH n u trivialHH = fmap trivialHH instance SubstHH a b => SubstHH (Abs a) (Abs b) where substUnderHH n u (Abs x v) = Abs x $ substUnderHH (n + 1) u v substUnderHH n u (NoAbs x v) = NoAbs x $ substUnderHH n u v trivialHH = fmap trivialHH instance (SubstHH a a', SubstHH b b') => SubstHH (a,b) (a',b') where substUnderHH n u (x,y) = (substUnderHH n u x, substUnderHH n u y) trivialHH = trivialHH *** trivialHH instance SubstHH a b => SubstHH (Tele a) (Tele b) where substUnderHH n u EmptyTel = EmptyTel substUnderHH n u (ExtendTel t tel) = uncurry ExtendTel $ substUnderHH n u (t, tel) trivialHH = fmap trivialHH -- | Unify indices. -- -- In @unifyIndices_ flex a us vs@, -- -- @a@ is the type eliminated by @us@ and @vs@ -- (usally the type of a constructor), -- need not be reduced, -- -- @us@ and @vs@ are the argument lists to unify, -- -- @flex@ is the set of flexible (instantiable) variabes in @us@ and @vs@. -- -- The result is the most general unifier of @us@ and @vs@. unifyIndices_ :: MonadTCM tcm => FlexibleVars -> Type -> Args -> Args -> tcm Substitution unifyIndices_ flex a us vs = liftTCM $ do r <- unifyIndices flex a us vs case r of Unifies sub -> return sub DontKnow err -> throwError err NoUnify err -> throwError err unifyIndices :: MonadTCM tcm => FlexibleVars -> Type -> Args -> Args -> tcm UnificationResult unifyIndices flex a us vs = liftTCM $ do a <- reduce a reportSDoc "tc.lhs.unify" 10 $ sep [ text "unifyIndices" , nest 2 $ text (show flex) , nest 2 $ parens (prettyTCM a) , nest 2 $ prettyList $ map prettyTCM us , nest 2 $ prettyList $ map prettyTCM vs , nest 2 $ text "context: " <+> (prettyTCM =<< getContextTelescope) ] (r, USt s eqs) <- flip runStateT emptyUState . runExceptionT . runWriterT . flip runReaderT emptyUEnv . unUnify $ do ifClean (unifyConstructorArgs (Hom a) us vs) -- clean: continue unifying recheckConstraints -- dirty: just check equalities to trigger error message recheckEqualities case r of Left (ConstructorMismatch a u v) -> noUnify a u v -- Andreas 2011-04-14: Left (StronglyRigidOccurrence a u v) -> noUnify a u v Left (UnclearOccurrence a u v) -> typeError $ UnequalTerms CmpEq u v a Left (WithoutKException a u v) -> typeError $ WithoutKError a u v Left (GenericUnifyException err) -> typeError $ GenericError err Right _ -> do checkEqualities $ applySubst (makeSubstitution s) eqs let n = maximum $ (-1) : flex' return $ Unifies $ flattenSubstitution [ IntMap.lookup i s | i <- [0..n] ] `catchError` \err -> case err of TypeError _ (Closure {clValue = WithoutKError{}}) -> throwError err _ -> return $ DontKnow err where noUnify a u v = NoUnify <$> do typeError_ $ UnequalTerms CmpEq u v a flex' = map flexVar flex flexible i = i `elem` flex' findFlexible i = find ((i ==) . flexVar) flex flexibleHid i = fmap getHiding $ findFlexible i flexibleTerm (Var i []) = flexible i flexibleTerm (Shared p) = flexibleTerm (derefPtr p) flexibleTerm _ = False {- Andreas, 2011-09-12 We unify constructors in heterogeneous situations, as long as the two types have the same shape (construct the same datatype). -} unifyConstructorArgs :: TypeHH -- ^ The ureduced type of the constructor, instantiated to the parameters. -- Possibly heterogeneous, since pars of lhs and rhs might differ. -> [I.Arg Term] -- ^ the arguments of the constructor (lhs) -> [I.Arg Term] -- ^ the arguments of the constructor (rhs) -> Unify () unifyConstructorArgs a12 [] [] = return () unifyConstructorArgs a12 vs1 vs2 = do liftTCM $ reportSDoc "tc.lhs.unify" 15 $ sep [ text "unifyConstructorArgs" -- , nest 2 $ parens (prettyTCM tel0) , nest 2 $ prettyList $ map prettyTCM vs1 , nest 2 $ prettyList $ map prettyTCM vs2 , nest 2 $ text "constructor type:" <+> prettyTCM a12 ] let n = genericLength vs1 -- since c vs1 and c vs2 have same-shaped type -- vs1 and vs2 must have same length when (n /= genericLength vs2) $ __IMPOSSIBLE__ TelV tel12 _ <- telViewUpToHH n a12 -- if the length of tel12 is not n, then something is wrong -- e.g. a12 is not a same-shaped pair of types when (n /= size tel12) $ __IMPOSSIBLE__ unifyConArgs tel12 vs1 vs2 unifyConArgs :: TelHH -- ^ The telescope(s) of the constructor args [length = n]. -> Args -- ^ the arguments of the constructor (lhs) [length = n]. -> Args -- ^ the arguments of the constructor (rhs) [length = n]. -> Unify () unifyConArgs _ (_ : _) [] = __IMPOSSIBLE__ unifyConArgs _ [] (_ : _) = __IMPOSSIBLE__ unifyConArgs _ [] [] = return () unifyConArgs EmptyTel _ _ = __IMPOSSIBLE__ unifyConArgs tel0@(ExtendTel a@(Dom _ bHH) tel) us0@(arg@(Arg _ u) : us) vs0@(Arg _ v : vs) = do liftTCM $ reportSDoc "tc.lhs.unify" 15 $ sep [ text "unifyConArgs" -- , nest 2 $ parens (prettyTCM tel0) , nest 2 $ prettyList $ map prettyTCM us0 , nest 2 $ prettyList $ map prettyTCM vs0 , nest 2 $ text "at telescope" <+> prettyTCM bHH <+> text ("(" ++ show (getRelevance a) ++ ") ...") ] liftTCM $ reportSDoc "tc.lhs.unify" 25 $ (text $ "tel0 = " ++ show tel0) -- Andreas, Ulf, 2011-09-08 (AIM XIV) -- in case of dependent function type, we cannot postpone -- unification of u and v, otherwise us or vs might be ill-typed -- skip irrelevant parts uHH <- if getRelevance a == Irrelevant then return $ Hom u else -- Andreas, 2015-01-19 Forced constructor arguments are not unified. -- Andreas, 2015-02-26 Restricting this to big forced arguments; -- this still addresses issue 1406. if getRelevance a == Forced Big then liftTCM $ tryHom bHH u v else ifClean (unifyHH bHH u v) (return $ Hom u) (return $ Het u v) liftTCM $ reportSDoc "tc.lhs.unify" 25 $ (text "uHH (before ureduce) =" <+> prettyTCM uHH) uHH <- traverse ureduce uHH liftTCM $ reportSDoc "tc.lhs.unify" 25 $ (text "uHH (after ureduce) =" <+> prettyTCM uHH) unifyConArgs (tel `absAppHH` uHH) us vs -- | Used for arguments of a 'Def' (data/record/postulate), not 'Con'. unifyArgs :: Type -> [I.Arg Term] -> [I.Arg Term] -> Unify () unifyArgs _ (_ : _) [] = __IMPOSSIBLE__ unifyArgs _ [] (_ : _) = __IMPOSSIBLE__ unifyArgs _ [] [] = return () unifyArgs a us0@(arg@(Arg _ u) : us) vs0@(Arg _ v : vs) = do liftTCM $ reportSDoc "tc.lhs.unify" 15 $ sep [ text "unifyArgs" , nest 2 $ parens (prettyTCM a) , nest 2 $ prettyList $ map prettyTCM us0 , nest 2 $ prettyList $ map prettyTCM vs0 ] a <- ureduce a -- Q: reduce sufficient? case ignoreSharing $ unEl a of Pi b _ -> do -- Andreas, Ulf, 2011-09-08 (AIM XVI) -- in case of dependent function type, we cannot postpone -- unification of u and v, otherwise us or vs might be ill-typed let dep = dependent $ unEl a -- skip irrelevant parts unless (isIrrelevant b) $ (if dep then noPostponing else id) $ unify (unDom b) u v arg <- traverse ureduce arg unifyArgs (a `piApply` [arg]) us vs _ -> __IMPOSSIBLE__ where dependent (Pi _ NoAbs{}) = False dependent (Pi b c) = 0 `relevantIn` absBody c dependent (Shared p) = dependent (derefPtr p) dependent _ = False -- | Check using conversion check. recheckEqualities :: Unify () recheckEqualities = do eqs <- takeEqualities liftTCM $ checkEqualities eqs -- | Check using unifier. recheckConstraints :: Unify () recheckConstraints = mapM_ unifyEquality =<< takeEqualities unifyEquality :: Equality -> Unify () unifyEquality (Equal aHH u v) = unifyHH aHH u v i |->> x = do i |-> x recheckConstraints maybeAssign h i x = (i |->> x) `catchException` \e -> case e of UnclearOccurrence{} -> h _ -> throwException e unifySizes :: Term -> Term -> Unify () unifySizes u v = do sz <- liftTCM sizeType su <- liftTCM $ sizeView u sv <- liftTCM $ sizeView v case (su, sv) of (SizeSuc u, SizeSuc v) -> unify sz u v (SizeSuc u, SizeInf) -> unify sz u v (SizeInf, SizeSuc v) -> unify sz u v _ -> unifyAtomHH (Hom sz) u v checkEqualityHH -- | Possibly heterogeneous unification (but at same-shaped types). -- In het. situations, we only search for a mismatch! -- -- TODO: eta for records! unifyHH :: TypeHH -- ^ one or two types, need not be in (u)reduced form -> Term -> Term -> Unify () unifyHH aHH u v = do liftTCM $ reportSDoc "tc.lhs.unify" 15 $ sep [ text "unifyHH" , nest 2 $ (parens $ prettyTCM u) <+> text "=?=" , nest 2 $ parens $ prettyTCM v , nest 2 $ text ":" <+> prettyTCM aHH ] u <- liftTCM . constructorForm =<< ureduce u v <- liftTCM . constructorForm =<< ureduce v aHH <- ureduce aHH liftTCM $ reportSDoc "tc.lhs.unify" 25 $ sep [ text "unifyHH (reduced)" , nest 2 $ (parens $ prettyTCM u) <+> text "=?=" , nest 2 $ parens $ prettyTCM v , nest 2 $ text ":" <+> prettyTCM aHH ] -- obtain the (== Size) function isSizeName <- liftTCM isSizeNameTest -- Andreas, 2013-10-24 (fixing issue 924) -- Only if we cannot make progress, we try full normalization! let tryAgain aHH u v = do u <- liftTCM $ etaContract =<< normalise u v <- liftTCM $ etaContract =<< normalise v unifyAtomHH aHH u v $ \ aHH u v -> do -- Andreas, 2014-03-03 (issue 1061) -- As a last resort, normalize types to maybe get back -- to the homogeneous case caseMaybeM (liftTCM $ makeHom aHH) (checkEqualityHH aHH u v) $ \ a -> do unifyAtomHH (Hom a) u v checkEqualityHH -- check whether types have the same shape (aHH, sh) <- shapeViewHH aHH case sh of ElseSh -> checkEqualityHH aHH u v -- not a type or not same types DefSh d | isSizeName d -> unifySizes u v _ -> unifyAtomHH aHH u v tryAgain unifyAtomHH :: TypeHH -- ^ in ureduced form -> Term -> Term -> (TypeHH -> Term -> Term -> Unify ()) -- ^ continuation in case unification was inconclusive -> Unify () unifyAtomHH aHH0 u v tryAgain = do let (aHH, homogeneous, a) = case aHH0 of Hom a -> (aHH0, True, a) Het a1 a2 | a1 == a2 -> (Hom a1, True, a1) -- BRITTLE: just checking syn.eq. _ -> (aHH0, False, __IMPOSSIBLE__) -- use @a@ only if 'homogeneous' holds! fallback = tryAgain aHH u v -- Try again if occurs check fails non-rigidly. It might be -- that normalising gets rid of the occurrence. (|->?) = maybeAssign fallback liftTCM $ reportSDoc "tc.lhs.unify" 15 $ sep [ text "unifyAtom" , nest 2 $ prettyTCM u <> if flexibleTerm u then text " (flexible)" else empty , nest 2 $ text "=?=" , nest 2 $ prettyTCM v <> if flexibleTerm v then text " (flexible)" else empty , nest 2 $ text ":" <+> prettyTCM aHH ] liftTCM $ reportSDoc "tc.lhs.unify" 60 $ text $ "aHH = " ++ show aHH case (ignoreSharing u, ignoreSharing v) of -- Ulf, 2011-06-19 -- We don't want to worry about levels here. (Level l, _) -> do u <- liftTCM $ reallyUnLevelView l unifyAtomHH aHH u v tryAgain (_, Level l) -> do v <- liftTCM $ reallyUnLevelView l unifyAtomHH aHH u v tryAgain (Var i us, Var j vs) | i == j -> checkEqualityHH aHH u v -- Andreas, 2013-03-05: the following flex/flex case is an attempt at -- better dotting (see Issue811). Does not work perfectly, maybe the best choice -- which variable to assign cannot made locally, but would need a look at the full -- picture!? Or maybe the information on flexible variables in not yet good enough -- in the call to split in Coverage. (Var i [], Var j []) | homogeneous, Just fi <- findFlexible i, Just fj <- findFlexible j -> do liftTCM $ reportSDoc "tc.lhs.unify.flexflex" 20 $ sep [ text "unifying flexible/flexible" , nest 2 $ text "i =" <+> prettyTCM u <+> text ("; fi = " ++ show fi) , nest 2 $ text "j =" <+> prettyTCM v <+> text ("; fj = " ++ show fj) ] -- We assign the "bigger" variable, where dotted, hidden, earlier is bigger -- (in this order, see Problem.hs). -- The comparison is total. if fj >= fi then j |->? (u, a) else i |->? (v, a) (Var i [], _) | homogeneous && flexible i -> i |->? (v, a) (_, Var j []) | homogeneous && flexible j -> j |->? (u, a) (Con c us, Con c' vs) | c == c' -> do r <- liftTCM (dataOrRecordTypeHH' c aHH) case r of Just (d, b, parsIxsHH) -> do (b, parsIxsHH) <- ureduce (b, parsIxsHH) -- Jesper, 2014-05-03: When --without-K is enabled, we reconstruct -- datatype indices and unify them as well withoutKEnabled <- liftTCM $ optWithoutK <$> pragmaOptions when withoutKEnabled $ do def <- liftTCM $ getConstInfo d let parsHH = fst <$> parsIxsHH ixsHH = snd <$> parsIxsHH dtypeHH = defType def `applyHH` parsHH unifyConstructorArgs dtypeHH (leftHH ixsHH) (rightHH ixsHH) let a'HH = (b `apply`) . fst <$> parsIxsHH unifyConstructorArgs a'HH us vs Nothing -> checkEqualityHH aHH u v | otherwise -> constructorMismatchHH aHH u v -- Definitions are ok as long as they can't reduce (i.e. datatypes/axioms) (Def d es, Def d' es') | d == d' -> do -- d must be a data, record or axiom def <- getConstInfo d let ok = case theDef def of Datatype{} -> True Record{} -> True Axiom{} -> True _ -> False inj <- liftTCM $ optInjectiveTypeConstructors <$> pragmaOptions if inj && ok then do let us = fromMaybe __IMPOSSIBLE__ $ allApplyElims es vs = fromMaybe __IMPOSSIBLE__ $ allApplyElims es' unifyArgs (defType def) us vs `catchException` \ _ -> constructorMismatchHH aHH u v else checkEqualityHH aHH u v -- Andreas, 2011-05-30: if heads disagree, abort -- but do not raise "mismatch" because otherwise type constructors -- would be distinct | otherwise -> checkEqualityHH aHH u v -- typeError $ UnequalTerms CmpEq u v a (Lit l1, Lit l2) | l1 == l2 -> return () | otherwise -> constructorMismatchHH aHH u v -- We can instantiate metas if the other term is inert (constructor application) -- Andreas, 2011-09-13: test/succeed/IndexInference needs this feature. (MetaV m us, _) | homogeneous -> do ok <- liftTCM $ instMetaE a m us v liftTCM $ reportSDoc "tc.lhs.unify" 40 $ vcat [ fsep [ text "inst meta", text $ if ok then "(ok)" else "(not ok)" ] , nest 2 $ sep [ prettyTCM u, text ":=", prettyTCM =<< normalise u ] ] if ok then unify a u v else addEquality a u v (_, MetaV m vs) | homogeneous -> do ok <- liftTCM $ instMetaE a m vs u liftTCM $ reportSDoc "tc.lhs.unify" 40 $ vcat [ fsep [ text "inst meta", text $ if ok then "(ok)" else "(not ok)" ] , nest 2 $ sep [ prettyTCM v, text ":=", prettyTCM =<< normalise v ] ] if ok then unify a u v else addEquality a u v (Con c us, _) -> do md <- isEtaRecordTypeHH aHH case md of Just (d, parsHH) -> do (tel, vs) <- liftTCM $ etaExpandRecord d (rightHH parsHH) v b <- liftTCM $ getRecordConstructorType d bHH <- ureduce (b `applyHH` parsHH) unifyConstructorArgs bHH us vs Nothing -> fallback (_, Con c vs) -> do md <- isEtaRecordTypeHH aHH case md of Just (d, parsHH) -> do (tel, us) <- liftTCM $ etaExpandRecord d (leftHH parsHH) u b <- liftTCM $ getRecordConstructorType d bHH <- ureduce (b `applyHH` parsHH) unifyConstructorArgs bHH us vs Nothing -> fallback -- Andreas, 2011-05-30: If I put checkEquality below, then Issue81 fails -- because there are definitions blocked by flexibles that need postponement _ -> fallback unify :: Type -> Term -> Term -> Unify () unify a = unifyHH (Hom a) -- The contexts are transient when unifying, so we should just instantiate to -- constructor heads and generate fresh metas for the arguments. Beware of -- constructors that aren't fully applied. instMetaE :: Type -> MetaId -> Elims -> Term -> TCM Bool instMetaE a m es v = do case allApplyElims es of Just us -> instMeta a m us v Nothing -> return False instMeta :: Type -> MetaId -> Args -> Term -> TCM Bool instMeta a m us v = do app <- inertApplication a v reportSDoc "tc.lhs.unify" 50 $ sep [ text "inert" <+> sep [ text (show m), text (show us), parens $ prettyTCM v ] , nest 2 $ text "==" <+> text (show app) ] case app of Nothing -> return False Just (v', b, vs) -> do margs <- do -- The new metas should have the same dependencies as the original meta mv <- lookupMeta m -- Only generate metas for the arguments v' is actually applied to -- (in case of partial application) TelV tel0 _ <- telView b let tel = telFromList $ take (length vs) $ telToList tel0 b' = telePi tel (sort Prop) withMetaInfo' mv $ do tel <- getContextTelescope -- important: create the meta in the same environment as the original meta newArgsMetaCtx b' tel us noConstraints $ assignV DirEq m us (v' `apply` margs) return True `catchError` \_ -> return False inertApplication :: Type -> Term -> TCM (Maybe (Term, Type, Args)) inertApplication a v = case ignoreSharing v of Con c vs -> fmap (\ b -> (Con c [], b, vs)) <$> dataOrRecordType c a Def d es | Just vs <- allApplyElims es -> do def <- getConstInfo d let ans = Just (Def d [], defType def, vs) return $ case theDef def of Datatype{} -> ans Record{} -> ans Axiom{} -> ans _ -> Nothing _ -> return Nothing -- | Given the type of a constructor application the corresponding -- data or record type, applied to its parameters (extracted from the -- given type), is returned. -- -- Precondition: The type has to correspond to an application of the -- given constructor. dataOrRecordType :: ConHead -- ^ Constructor name. -> Type -- ^ Type of constructor application (must end in data/record). -> TCM (Maybe Type) -- ^ Type of constructor, applied to pars. dataOrRecordType c a = fmap (\ (d, b, pars, _) -> b `apply` pars) <$> dataOrRecordType' c a dataOrRecordType' :: ConHead -- ^ Constructor name. -> Type -- ^ Type of constructor application (must end in data/record). -> TCM (Maybe (QName, Type, Args, Args)) -- ^ Name of data/record type, -- type of constructor to be applied, -- data/record parameters, and -- data indices dataOrRecordType' c a = do -- The telescope ends with a datatype or a record. (d, args) <- do TelV _ (El _ def) <- telView a let Def d es = ignoreSharing def args = fromMaybe __IMPOSSIBLE__ $ allApplyElims es return (d, args) def <- theDef <$> getConstInfo d case def of Datatype{dataPars = n} -> do a' <- defType <$> getConInfo c let (pars, ixs) = genericSplitAt n args return $ Just (d, a', pars, ixs) Record{} -> do a' <- getRecordConstructorType d return $ Just (d, a', args, []) _ -> return Nothing -- | Heterogeneous situation. -- @a1@ and @a2@ need to end in same datatype/record. dataOrRecordTypeHH :: ConHead -- ^ Constructor name. -> TypeHH -- ^ Type(s) of constructor application (must end in same data/record). -> TCM (Maybe TypeHH) -- ^ Type of constructor, instantiated possibly heterogeneously to parameters. dataOrRecordTypeHH c (Hom a) = fmap Hom <$> dataOrRecordType c a dataOrRecordTypeHH c (Het a1 a2) = do r1 <- dataOrRecordType' c a1 r2 <- dataOrRecordType' c a2 -- b2 may have different parameters than b1! return $ case (r1, r2) of (Just (d1, b1, pars1, _), Just (d2, b2, pars2, _)) | d1 == d2 -> Just $ -- Andreas, 2011-09-15 if no parameters, we can stay homogeneous if null pars1 && null pars2 then Hom b1 -- if parameters, go heterogeneous -- TODO: make this smarter, because parameters could be equal! else Het (b1 `apply` pars1) (b2 `apply` pars2) _ -> Nothing dataOrRecordTypeHH' :: ConHead -> TypeHH -> TCM (Maybe (QName, Type, HomHet (Args, Args))) dataOrRecordTypeHH' c (Hom a) = do r <- dataOrRecordType' c a case r of Just (d, a', pars, ixs) -> return $ Just (d, a', Hom (pars, ixs)) Nothing -> return $ Nothing dataOrRecordTypeHH' c (Het a1 a2) = do r1 <- dataOrRecordType' c a1 r2 <- dataOrRecordType' c a2 case (r1, r2) of (Just (d1, b1, pars1, ixs1), Just (d2, b2, pars2, ixs2)) | d1 == d2 -> do -- Same constructors have same types, of course. unless (b1 == b2) __IMPOSSIBLE__ return $ Just $ if null pars1 && null pars2 && null ixs1 && null ixs2 then (d1, b1, Hom ([], [])) else (d1, b1, Het (pars1, ixs1) (pars2, ixs2)) _ -> return Nothing -- | Return record type identifier if argument is a record type. isEtaRecordTypeHH :: MonadTCM tcm => TypeHH -> tcm (Maybe (QName, HomHet Args)) isEtaRecordTypeHH (Hom a) = fmap (\ (d, ps) -> (d, Hom ps)) <$> liftTCM (isEtaRecordType a) isEtaRecordTypeHH (Het a1 a2) = do m1 <- liftTCM $ isEtaRecordType a1 m2 <- liftTCM $ isEtaRecordType a2 case (m1, m2) of (Just (d1, as1), Just (d2, as2)) | d1 == d2 -> return $ Just (d1, Het as1 as2) _ -> return Nothing -- | Views an expression (pair) as type shape. Fails if not same shape. data ShapeView a = PiSh (I.Dom a) (I.Abs a) | FunSh (I.Dom a) a | DefSh QName -- ^ data/record | VarSh Nat -- ^ neutral type | LitSh Literal -- ^ built-in type | SortSh | MetaSh -- ^ some meta | ElseSh -- ^ not a type or not definitely same shape deriving (Typeable, Show, Eq, Ord, Functor) -- | Return the type and its shape. Expects input in (u)reduced form. shapeView :: Type -> Unify (Type, ShapeView Type) shapeView t = do return . (t,) $ case ignoreSharing $ unEl t of Pi a (NoAbs _ b) -> FunSh a b Pi a (Abs x b) -> PiSh a (Abs x b) Def d vs -> DefSh d Var x vs -> VarSh x Lit l -> LitSh l Sort s -> SortSh MetaV m vs -> MetaSh _ -> ElseSh -- | Return the reduced type(s) and the common shape. shapeViewHH :: TypeHH -> Unify (TypeHH, ShapeView TypeHH) shapeViewHH (Hom a) = do (a, sh) <- shapeView a return (Hom a, fmap Hom sh) shapeViewHH (Het a1 a2) = do (a1, sh1) <- shapeView a1 (a2, sh2) <- shapeView a2 return . (Het a1 a2,) $ case (sh1, sh2) of (PiSh d1@(Dom i1 a1) b1, PiSh (Dom i2 a2) b2) | argInfoHiding i1 == argInfoHiding i2 -> PiSh (Dom (setRelevance (min (getRelevance i1) (getRelevance i2)) i1) (Het a1 a2)) (Abs (absName b1) (Het (absBody b1) (absBody b2))) (FunSh d1@(Dom i1 a1) b1, FunSh (Dom i2 a2) b2) | argInfoHiding i1 == argInfoHiding i2 -> FunSh (Dom (setRelevance (min (getRelevance i1) (getRelevance i2)) i1) (Het a1 a2)) (Het b1 b2) (DefSh d1, DefSh d2) | d1 == d2 -> DefSh d1 (VarSh x1, VarSh x2) | x1 == x2 -> VarSh x1 (LitSh l1, LitSh l2) | l1 == l2 -> LitSh l1 (SortSh, SortSh) -> SortSh _ -> ElseSh -- not types, or metas, or not same shape -- | @telViewUpToHH n t@ takes off the first @n@ function types of @t@. -- Takes off all if $n < 0$. telViewUpToHH :: Int -> TypeHH -> Unify TelViewHH telViewUpToHH 0 t = return $ TelV EmptyTel t telViewUpToHH n t = do (t, sh) <- shapeViewHH =<< liftTCM (traverse reduce t) case sh of PiSh a b -> absV a (absName b) <$> telViewUpToHH (n-1) (absBody b) FunSh a b -> absV a underscore <$> telViewUpToHH (n-1) (raise 1 b) _ -> return $ TelV EmptyTel t where absV a x (TelV tel t) = TelV (ExtendTel a (Abs x tel)) t Agda-2.4.2.5/src/full/Agda/TypeChecking/Rules/LHS/Instantiate.hs0000644000000000000000000001427712635075266022234 0ustar0000000000000000{-# LANGUAGE CPP #-} module Agda.TypeChecking.Rules.LHS.Instantiate where import Agda.Syntax.Common import Agda.Syntax.Internal as I hiding (Substitution) import qualified Agda.Syntax.Abstract as A import Agda.Syntax.Abstract.Views ( asView ) import Agda.TypeChecking.Monad import Agda.TypeChecking.Substitute hiding (Substitution) import qualified Agda.TypeChecking.Substitute as S (Substitution) import Agda.TypeChecking.Pretty import Agda.TypeChecking.Reduce import Agda.TypeChecking.Telescope import Agda.TypeChecking.Rules.LHS.Problem import Agda.Utils.List import Agda.Utils.Permutation import Agda.Utils.Size #include "undefined.h" import Agda.Utils.Impossible -- | Instantiate a telescope with a substitution. Might reorder the telescope. -- @instantiateTel (Γ : Tel)(σ : Γ --> Γ) = Γσ~@ -- Monadic only for debugging purposes. instantiateTel :: Substitution -> Telescope -> TCM (Telescope, Permutation, S.Substitution, [I.Dom Type]) instantiateTel s tel = liftTCM $ do reportSDoc "tc.lhs.inst" 10 $ vcat [ text "instantiateTel " , nest 2 $ text "s =" <+> do addCtxTel tel $ fsep $ punctuate comma $ map (maybe (text "_") prettyTCM) s , nest 2 $ text "tel =" <+> prettyTCM tel -- , nest 2 $ text "tel =" <+> text (show tel) ] {- -- Andreas, 2013-10-27 -- Why is normalization necessary? Issue 234 seems to need it. -- But it is better done right before where it is needed (see below). tel <- normalise tel reportSDoc "tc.lhs.inst" 15 $ vcat [ nest 2 $ text "tel (normalized)=" <+> prettyTCM tel ] -} -- Shrinking permutation (removing Justs) (and its complement, and reverse) let n = size s {- OLD CODE, leave as documentation ps = Perm n [ i | (i, Nothing) <- zip [0..] $ reverse s ] psR = reverseP ps psC = Perm n [ i | (i, Just _) <- zip [0..] $ reverse s ] -} deal (i, Nothing) = Left i deal (i, Just _ ) = Right i (is, isC) = mapEither deal $ zip [0..] $ reverse s ps = Perm n is psR = reverseP ps psC = Perm n isC reportSDoc "tc.lhs.inst" 10 $ vcat [ nest 2 $ text $ "ps = " ++ show ps , nest 2 $ text $ "psR = " ++ show psR , nest 2 $ text $ "psC = " ++ show psC ] -- s' : Substitution Γσ let s' = renameP psR s reportSDoc "tc.lhs.inst" 15 $ nest 2 $ text "s' =" <+> fsep (punctuate comma $ map (maybe (text "_") prettyTCM) s') -- rho : [Tm Γσ]Γ let rho = mkSubst s' reportSDoc "tc.lhs.inst" 15 $ nest 2 $ text "rho = " <+> text (show rho) -- tel1 : [Type Γ]Γ let tel1 = flattenTel tel names1 = teleNames tel reportSDoc "tc.lhs.inst" 15 $ nest 2 $ vcat [ text "tel1 =" <+> brackets (fsep $ punctuate comma $ map prettyTCM tel1) -- , text "tel1 =" <+> text (show tel1) ] -- tel2 : [Type Γσ]Γ let tel2 = applySubst rho tel1 reportSDoc "tc.lhs.inst" 15 $ nest 2 $ text "tel2 =" <+> brackets (fsep $ punctuate comma $ map prettyTCM tel2) -- tel3 : [Type Γσ]Γσ -- -- Andreas, 2013-10-27 -- @reorderTel@ below uses free variable analysis, so @tel3@ should be -- fully instantiated and normalized. (See issue 234.) -- Ulf, 2014-02-05: Only normalise if reordering fails! tel3 <- instantiateFull $ permute ps tel2 let names3 = permute ps names1 reportSDoc "tc.lhs.inst" 15 $ nest 2 $ text "tel3 =" <+> brackets (fsep $ punctuate comma $ map prettyTCM tel3) -- Raise error if telescope cannot be ordered. let failToReorder = inTopContext $ addContext names3 $ do err <- sep [ text "Recursive telescope in left hand side:" , fsep [ parens (text (argNameToString x) <+> text ":" <+> prettyTCM t) | (x, t) <- zip names3 tel3 ] ] typeError $ GenericError $ show err tryNormalisedReorder = do tel3 <- normalise tel3 reportSDoc "tc.lhs.inst" 30 $ text "failed to reorder unnormalised, trying again with" $$ nest 2 (text "norm =" <+> brackets (fsep $ punctuate comma $ map prettyTCM tel3)) p <- maybe failToReorder return . reorderTel =<< normalise tel3 return (p, tel3) -- p : Permutation (Γσ -> Γσ ~) (p, tel3) <- maybe tryNormalisedReorder (\p -> return (p, tel3)) $ reorderTel tel3 reportSLn "tc.lhs.inst" 10 $ " p = " ++ show p -- rho' : [Term Γσ~]Γσ let rho' = renaming (reverseP p) -- tel4 : [Type Γσ~]Γσ~ let tel4 = applySubst rho' (permute p tel3) names4 = permute p names3 reportSDoc "tc.lhs.inst" 15 $ nest 2 $ text "tel4 =" <+> brackets (fsep $ punctuate comma $ map prettyTCM tel4) -- tel5 = Γσ~ let tel5 = unflattenTel names4 tel4 reportSDoc "tc.lhs.inst" 15 $ nest 2 $ text "tel5 =" <+> prettyTCM tel5 -- remember the types of the instantiations -- itypes : [Type Γσ~]Γ* let itypes = applySubst rho' $ permute psC tel2 return (tel5, composeP p ps, applySubst rho' rho, itypes) where -- Turn a Substitution ([Maybe Term]) into a substitution (S.Substitution) mkSubst :: [Maybe Term] -> S.Substitution mkSubst s = rho 0 s' where s' = s rho i (Nothing : s) = consS (var i) $ rho (i + 1) s rho i (Just u : s) = consS u $ rho i s rho i [] = raiseS i -- | Produce a nice error message when splitting failed nothingToSplitError :: Problem -> TCM a nothingToSplitError (Problem ps _ tel pr) = splitError ps tel where splitError [] EmptyTel = do if null $ restPats pr then __IMPOSSIBLE__ else do typeError $ GenericError $ "Arguments left we cannot split on. TODO: better error message" splitError (_:_) EmptyTel = __IMPOSSIBLE__ splitError [] ExtendTel{} = __IMPOSSIBLE__ splitError (p : ps) (ExtendTel a tel) | isBad p = traceCall (CheckPattern (strip p) EmptyTel (unDom a)) $ case strip p of A.DotP _ e -> typeError $ UninstantiatedDotPattern e p -> typeError $ IlltypedPattern p (unDom a) | otherwise = underAbstraction a tel $ \tel -> splitError ps tel where strip = snd . asView . namedArg isBad p = case strip p of A.DotP _ _ -> True A.ConP _ _ _ -> True A.LitP _ -> True _ -> False Agda-2.4.2.5/src/full/Agda/TypeChecking/MetaVars/0000755000000000000000000000000012635075266017404 5ustar0000000000000000Agda-2.4.2.5/src/full/Agda/TypeChecking/MetaVars/Mention.hs0000644000000000000000000000766212635075266021364 0ustar0000000000000000{-# LANGUAGE CPP #-} {-# LANGUAGE FlexibleInstances #-} module Agda.TypeChecking.MetaVars.Mention where import Agda.Syntax.Common import Agda.Syntax.Internal as I import Agda.TypeChecking.Monad import Agda.Utils.Impossible #include "undefined.h" class MentionsMeta t where mentionsMeta :: MetaId -> t -> Bool instance MentionsMeta Term where mentionsMeta x v = case v of Var _ args -> mm args Lam _ b -> mm b Lit{} -> False Def _ args -> mm args Con _ args -> mm args Pi a b -> mm (a, b) Sort s -> mm s Level l -> mm l DontCare v -> False -- we don't have to look inside don't cares when deciding to wake constraints MetaV y args -> x == y || mm args -- TODO: we really only have to look one level deep at meta args Shared p -> mm $ derefPtr p ExtLam{} -> __IMPOSSIBLE__ where mm v = mentionsMeta x v instance MentionsMeta Level where mentionsMeta x (Max as) = mentionsMeta x as instance MentionsMeta PlusLevel where mentionsMeta x ClosedLevel{} = False mentionsMeta x (Plus _ a) = mentionsMeta x a instance MentionsMeta LevelAtom where mentionsMeta x l = case l of MetaLevel m vs -> x == m || mentionsMeta x vs BlockedLevel m _ -> x == m -- if it's blocked on a different meta it doesn't matter if it mentions the meta somewhere else UnreducedLevel l -> mentionsMeta x l NeutralLevel _ l -> mentionsMeta x l instance MentionsMeta Type where mentionsMeta x (El s t) = mentionsMeta x (s, t) instance MentionsMeta Sort where mentionsMeta x s = case s of Type l -> mentionsMeta x l Prop -> False Inf -> False SizeUniv -> False DLub s1 s2 -> mentionsMeta x (s1, s2) instance MentionsMeta t => MentionsMeta (Abs t) where mentionsMeta x = mentionsMeta x . unAbs instance MentionsMeta t => MentionsMeta (I.Arg t) where mentionsMeta x a | isIrrelevant a = False -- ^ we don't have to look inside irrelevant arguments when deciding to wake constraints mentionsMeta x a = mentionsMeta x (unArg a) instance MentionsMeta t => MentionsMeta (I.Dom t) where mentionsMeta x = mentionsMeta x . unDom instance MentionsMeta t => MentionsMeta [t] where mentionsMeta x = any (mentionsMeta x) instance MentionsMeta t => MentionsMeta (Maybe t) where mentionsMeta x = maybe False (mentionsMeta x) instance (MentionsMeta a, MentionsMeta b) => MentionsMeta (a, b) where mentionsMeta x (a, b) = mentionsMeta x a || mentionsMeta x b instance (MentionsMeta a, MentionsMeta b, MentionsMeta c) => MentionsMeta (a, b, c) where mentionsMeta x (a, b, c) = mentionsMeta x a || mentionsMeta x b || mentionsMeta x c instance MentionsMeta a => MentionsMeta (Closure a) where mentionsMeta x cl = mentionsMeta x (clValue cl) instance MentionsMeta Elim where mentionsMeta x Proj{} = False mentionsMeta x (Apply v) = mentionsMeta x v instance MentionsMeta a => MentionsMeta (Tele a) where mentionsMeta x EmptyTel = False mentionsMeta x (ExtendTel a b) = mentionsMeta x (a, b) instance MentionsMeta ProblemConstraint where mentionsMeta x = mentionsMeta x . theConstraint instance MentionsMeta Constraint where mentionsMeta x c = case c of ValueCmp _ t u v -> mm (t, u, v) ElimCmp _ t v as bs -> mm ((t, v), (as, bs)) LevelCmp _ u v -> mm (u, v) TypeCmp _ a b -> mm (a, b) TelCmp a b _ u v -> mm ((a, b), (u, v)) SortCmp _ a b -> mm (a, b) Guarded c _ -> mm c UnBlock _ -> True -- this might be a postponed typechecking -- problem and we don't have a handle on -- what metas it depends on FindInScope{} -> True -- this needs to be woken up for any meta IsEmpty r t -> mm t CheckSizeLtSat t -> mm t where mm v = mentionsMeta x v -- instance (Ord k, MentionsMeta e) => MentionsMeta (Map k e) where -- mentionsMeta = traverse mentionsMeta Agda-2.4.2.5/src/full/Agda/TypeChecking/MetaVars/Occurs.hs0000644000000000000000000007023112635075266021201 0ustar0000000000000000{-# LANGUAGE CPP #-} {-# LANGUAGE FlexibleContexts #-} {-# LANGUAGE FlexibleInstances #-} {-# LANGUAGE NoMonomorphismRestriction #-} {- | The occurs check for unification. Does pruning on the fly. When hitting a meta variable: - Compute flex/rigid for its arguments. - Compare to allowed variables. - Mark arguments with rigid occurrences of disallowed variables for deletion. - Attempt to delete marked arguments. - We don't need to check for success, we can just continue occurs checking. -} module Agda.TypeChecking.MetaVars.Occurs where import Control.Applicative import Control.Monad import Control.Monad.Reader import Control.Monad.State import Data.Foldable (foldMap) import Data.List import Data.Maybe import Data.Monoid import Data.Set (Set) import qualified Data.Set as Set import qualified Agda.Benchmarking as Bench import Agda.Syntax.Common import Agda.Syntax.Internal as I import Agda.TypeChecking.Monad import qualified Agda.TypeChecking.Monad.Benchmark as Bench import Agda.TypeChecking.Reduce import Agda.TypeChecking.Pretty import Agda.TypeChecking.Free hiding (Occurrence(..)) import Agda.TypeChecking.Substitute import Agda.TypeChecking.Records import {-# SOURCE #-} Agda.TypeChecking.MetaVars -- import Agda.TypeChecking.MetaVars import Agda.Utils.Either import Agda.Utils.Except ( ExceptT , MonadError(catchError, throwError) , runExceptT ) import Agda.Utils.Lens import Agda.Utils.List (takeWhileJust) import Agda.Utils.Maybe import Agda.Utils.Monad import Agda.Utils.Permutation import Agda.Utils.Pretty (prettyShow) import Agda.Utils.Size import qualified Agda.Utils.VarSet as VarSet #include "undefined.h" import Agda.Utils.Impossible {- To address issue 585 (meta var occurrences in mutual defs) data B : Set where inn : A -> B out : B -> A out (inn a) = a postulate P : (y : A) (z : Unit -> B) → Set p : (x : Unit -> B) → P (out (x unit)) x mutual d : Unit -> B d unit = inn _ -- Y g : P (out (d unit)) d g = p _ -- X -- Agda solves d unit = inn (out (d unit)) -- -- out (X unit) = out (d unit) = out (inn Y) = Y -- X = d When doing the occurs check on d, we need to look at the definition of d to discover that it mentions X. To this end, we extend the state by names of definitions that have to be checked when they occur. At the beginning, this is initialized with the names in the current mutual block. Each time we encounter a name in the list during occurs check, we delete it (if check is successful). This way, we do not duplicate work. -} modifyOccursCheckDefs :: (Set QName -> Set QName) -> TCM () modifyOccursCheckDefs f = stOccursCheckDefs %= f -- | Set the names of definitions to be looked at -- to the defs in the current mutual block. initOccursCheck :: MetaVariable -> TCM () initOccursCheck mv = modifyOccursCheckDefs . const =<< if (miMetaOccursCheck (mvInfo mv) == DontRunMetaOccursCheck) then do reportSLn "tc.meta.occurs" 20 $ "initOccursCheck: we do not look into definitions" return Set.empty else do reportSLn "tc.meta.occurs" 20 $ "initOccursCheck: we look into the following definitions:" mb <- asks envMutualBlock case mb of Nothing -> do reportSLn "tc.meta.occurs" 20 $ "(none)" return Set.empty Just b -> do ds <- lookupMutualBlock b reportSDoc "tc.meta.occurs" 20 $ sep $ map prettyTCM $ Set.toList ds return ds -- | Is a def in the list of stuff to be checked? defNeedsChecking :: QName -> TCM Bool defNeedsChecking d = Set.member d <$> use stOccursCheckDefs -- | Remove a def from the list of defs to be looked at. tallyDef :: QName -> TCM () tallyDef d = modifyOccursCheckDefs $ \ s -> Set.delete d s data OccursCtx = Flex -- ^ we are in arguments of a meta | Rigid -- ^ we are not in arguments of a meta but a bound var | StronglyRigid -- ^ we are at the start or in the arguments of a constructor | Top -- ^ we are at the term root (this turns into @StronglyRigid@) | Irrel -- ^ we are in an irrelevant argument deriving (Eq, Show) data UnfoldStrategy = YesUnfold | NoUnfold deriving (Eq, Show) defArgs :: UnfoldStrategy -> OccursCtx -> OccursCtx defArgs NoUnfold _ = Flex defArgs YesUnfold ctx = weakly ctx unfold :: UnfoldStrategy -> Term -> TCM (Blocked Term) unfold NoUnfold v = notBlocked <$> instantiate v unfold YesUnfold v = reduceB v -- | Leave the top position. leaveTop :: OccursCtx -> OccursCtx leaveTop Top = StronglyRigid leaveTop ctx = ctx -- | Leave the strongly rigid position. weakly :: OccursCtx -> OccursCtx weakly Top = Rigid weakly StronglyRigid = Rigid weakly ctx = ctx strongly :: OccursCtx -> OccursCtx strongly Rigid = StronglyRigid strongly ctx = ctx patternViolation' :: Int -> String -> TCM a patternViolation' n err = do reportSLn "tc.meta.occurs" n err patternViolation abort :: OccursCtx -> TypeError -> TCM a abort Top err = typeError err abort StronglyRigid err = typeError err -- here, throw an uncatchable error (unsolvable constraint) abort Flex err = patternViolation' 70 (show err) -- throws a PatternErr, which leads to delayed constraint abort Rigid err = patternViolation' 70 (show err) abort Irrel err = patternViolation' 70 (show err) -- | Distinguish relevant and irrelevant variables in occurs check. type Vars = ([Nat],[Nat]) goIrrelevant :: Vars -> Vars goIrrelevant (relVs, irrVs) = (irrVs ++ relVs, []) allowedVar :: Nat -> Vars -> Bool allowedVar i (relVs, irrVs) = i `elem` relVs takeRelevant :: Vars -> [Nat] takeRelevant = fst liftUnderAbs :: Vars -> Vars liftUnderAbs (relVs, irrVs) = (0 : map (1+) relVs, map (1+) irrVs) -- | Extended occurs check. class Occurs t where occurs :: UnfoldStrategy -> OccursCtx -> MetaId -> Vars -> t -> TCM t metaOccurs :: MetaId -> t -> TCM () -- raise exception if meta occurs in t -- | When assigning @m xs := v@, check that @m@ does not occur in @v@ -- and that the free variables of @v@ are contained in @xs@. occursCheck :: (Occurs a, InstantiateFull a, PrettyTCM a) => MetaId -> Vars -> a -> TCM a occursCheck m xs v = Bench.billTo [ Bench.Typing, Bench.OccursCheck ] $ do mv <- lookupMeta m initOccursCheck mv -- TODO: Can we do this in a better way? let redo m = m -- disableDestructiveUpdate m >> m -- First try without normalising the term redo (occurs NoUnfold Top m xs v) `catchError` \_ -> do initOccursCheck mv redo (occurs YesUnfold Top m xs v) `catchError` \err -> case err of -- Produce nicer error messages TypeError _ cl -> case clValue cl of MetaOccursInItself{} -> typeError . GenericError . show =<< fsep [ text ("Refuse to construct infinite term by instantiating " ++ prettyShow m ++ " to") , prettyTCM =<< instantiateFull v ] MetaCannotDependOn _ _ i -> ifM (isSortMeta m `and2M` (not <$> hasUniversePolymorphism)) ( typeError . GenericError . show =<< fsep [ text ("Cannot instantiate the metavariable " ++ prettyShow m ++ " to") , prettyTCM v , text "since universe polymorphism is disabled" ] ) {- else -} ( typeError . GenericError . show =<< fsep [ text ("Cannot instantiate the metavariable " ++ prettyShow m ++ " to solution") , prettyTCM v , text "since it contains the variable" , enterClosure cl $ \_ -> prettyTCM (Var i []) , text $ "which is not in scope of the metavariable or irrelevant in the metavariable but relevant in the solution" ] ) _ -> throwError err _ -> throwError err instance Occurs Term where occurs red ctx m xs v = do v <- unfold red v -- occurs' ctx $ ignoreBlocking v -- fails test/succeed/DontPruneBlocked case v of -- Don't fail on blocked terms or metas NotBlocked _ v -> occurs' ctx v -- Blocked _ v@MetaV{} -> occurs' ctx v -- does not help with issue 856 Blocked _ v -> occurs' Flex v where occurs' ctx v = do reportSDoc "tc.meta.occurs" 45 $ text ("occursCheck " ++ prettyShow m ++ " (" ++ show ctx ++ ") of ") <+> prettyTCM v reportSDoc "tc.meta.occurs" 70 $ nest 2 $ text $ show v case v of Var i es -> do if (i `allowedVar` xs) then Var i <$> occ (weakly ctx) es else do -- if the offending variable is of singleton type, -- eta-expand it away isST <- isSingletonType =<< typeOfBV i case isST of -- cannot decide, blocked by meta-var Left mid -> patternViolation' 70 $ "Disallowed var " ++ show i ++ " not obviously singleton" -- not a singleton type Right Nothing -> -- abort Rigid turns this error into PatternErr abort (strongly ctx) $ MetaCannotDependOn m (takeRelevant xs) i -- is a singleton type with unique inhabitant sv Right (Just sv) -> return $ sv `applyE` es Lam h f -> Lam h <$> occ (leaveTop ctx) f Level l -> Level <$> occ ctx l -- stay in Top Lit l -> return v DontCare v -> dontCare <$> occurs red Irrel m (goIrrelevant xs) v Def d es -> Def d <$> occDef d (leaveTop ctx) es Con c vs -> Con c <$> occ (leaveTop ctx) vs -- if strongly rigid, remain so Pi a b -> uncurry Pi <$> occ (leaveTop ctx) (a,b) Sort s -> Sort <$> occ (leaveTop ctx) s v@Shared{} -> updateSharedTerm (occ ctx) v ExtLam{} -> __IMPOSSIBLE__ MetaV m' es -> do -- Check for loop -- don't fail hard on this, since we might still be on the top-level -- after some killing (Issue 442) -- -- Andreas, 2013-02-18 Issue 795 demonstrates that a recursive -- occurrence of a meta could be solved by the identity. -- ? (Q A) = Q (? A) -- So, do not throw an error. -- I guess the error was there from times when occurrence check -- was done after the "lhs=linear variables" check, but now -- occurrence check comes first. -- WAS: -- when (m == m') $ if ctx == Top then patternViolation else -- abort ctx $ MetaOccursInItself m' when (m == m') $ patternViolation' 50 $ "occursCheck failed: Found " ++ prettyShow m -- The arguments of a meta are in a flexible position (MetaV m' <$> occurs red Flex m xs es) `catchError` \err -> do reportSDoc "tc.meta.kill" 25 $ vcat [ text $ "error during flexible occurs check, we are " ++ show ctx , text $ show err ] case err of -- On pattern violations try to remove offending -- flexible occurrences (if not already in a flexible context) PatternErr{} | ctx /= Flex -> do reportSLn "tc.meta.kill" 20 $ "oops, pattern violation for " ++ prettyShow m' -- Andreas, 2014-03-02, see issue 1070: -- Do not prune when meta is projected! caseMaybe (allApplyElims es) (throwError err) $ \ vs -> do killResult <- prune m' vs (takeRelevant xs) if (killResult == PrunedEverything) -- after successful pruning, restart occurs check then occurs red ctx m xs =<< instantiate (MetaV m' es) else throwError err _ -> throwError err where occ ctx v = occurs red ctx m xs v -- a data or record type constructor propagates strong occurrences -- since e.g. x = List x is unsolvable occDef d ctx vs = do def <- theDef <$> getConstInfo d whenM (defNeedsChecking d) $ do tallyDef d reportSLn "tc.meta.occurs" 30 $ "Checking for occurrences in " ++ show d metaOccurs m def if (defIsDataOrRecord def) then (occ ctx vs) else (occ (defArgs red ctx) vs) metaOccurs m v = do v <- instantiate v case v of Var i vs -> metaOccurs m vs Lam h f -> metaOccurs m f Level l -> metaOccurs m l Lit l -> return () DontCare v -> metaOccurs m v Def d vs -> metaOccurs m d >> metaOccurs m vs Con c vs -> metaOccurs m vs Pi a b -> metaOccurs m (a,b) Sort s -> metaOccurs m s Shared p -> metaOccurs m $ derefPtr p ExtLam{} -> __IMPOSSIBLE__ MetaV m' vs | m == m' -> patternViolation' 50 $ "Found occurrence of " ++ prettyShow m | otherwise -> metaOccurs m vs instance Occurs QName where occurs red ctx m xs d = __IMPOSSIBLE__ metaOccurs m d = whenM (defNeedsChecking d) $ do tallyDef d reportSLn "tc.meta.occurs" 30 $ "Checking for occurrences in " ++ show d metaOccurs m . theDef =<< getConstInfo d instance Occurs Defn where occurs red ctx m xs def = __IMPOSSIBLE__ metaOccurs m Axiom{} = return () metaOccurs m Function{ funClauses = cls } = metaOccurs m cls -- since a datatype is isomorphic to the sum of its constructor types -- we check the constructor types metaOccurs m Datatype{ dataCons = cs } = mapM_ mocc cs where mocc c = metaOccurs m . defType =<< getConstInfo c metaOccurs m Record{ recConType = v } = metaOccurs m v metaOccurs m Constructor{} = return () metaOccurs m Primitive{} = return () instance Occurs Clause where occurs red ctx m xs cl = __IMPOSSIBLE__ metaOccurs m (Clause { clauseBody = body }) = walk body where walk NoBody = return () walk (Body v) = metaOccurs m v walk (Bind b) = underAbstraction_ b walk instance Occurs Level where occurs red ctx m xs (Max as) = Max <$> occurs red ctx m xs as metaOccurs m (Max as) = metaOccurs m as instance Occurs PlusLevel where occurs red ctx m xs l@ClosedLevel{} = return l occurs red ctx m xs (Plus n l) = Plus n <$> occurs red ctx' m xs l where ctx' | n == 0 = ctx | otherwise = leaveTop ctx -- we leave Top only if we encounter at least one successor metaOccurs m ClosedLevel{} = return () metaOccurs m (Plus n l) = metaOccurs m l instance Occurs LevelAtom where occurs red ctx m xs l = do l <- case red of YesUnfold -> reduce l NoUnfold -> instantiate l case l of MetaLevel m' args -> do MetaV m' args <- ignoreSharing <$> occurs red ctx m xs (MetaV m' args) return $ MetaLevel m' args NeutralLevel r v -> NeutralLevel r <$> occurs red ctx m xs v BlockedLevel m' v -> BlockedLevel m' <$> occurs red Flex m xs v UnreducedLevel v -> UnreducedLevel <$> occurs red ctx m xs v metaOccurs m l = do l <- instantiate l case l of MetaLevel m' args -> metaOccurs m $ MetaV m' args NeutralLevel _ v -> metaOccurs m v BlockedLevel _ v -> metaOccurs m v UnreducedLevel v -> metaOccurs m v instance Occurs Type where occurs red ctx m xs (El s v) = uncurry El <$> occurs red ctx m xs (s,v) metaOccurs m (El s v) = metaOccurs m (s,v) instance Occurs Sort where occurs red ctx m xs s = do s' <- case red of YesUnfold -> reduce s NoUnfold -> instantiate s case s' of DLub s1 s2 -> uncurry DLub <$> occurs red (weakly ctx) m xs (s1,s2) Type a -> Type <$> occurs red ctx m xs a Prop -> return s' Inf -> return s' SizeUniv -> return s' metaOccurs m s = do s <- instantiate s case s of DLub s1 s2 -> metaOccurs m (s1,s2) Type a -> metaOccurs m a Prop -> return () Inf -> return () SizeUniv -> return () instance Occurs a => Occurs (Elim' a) where occurs red ctx m xs e@Proj{} = return e occurs red ctx m xs (Apply a) = Apply <$> occurs red ctx m xs a metaOccurs m (Proj{} ) = return () metaOccurs m (Apply a) = metaOccurs m a instance (Occurs a, Subst a) => Occurs (Abs a) where occurs red ctx m xs b@(Abs s x) = Abs s <$> underAbstraction_ b (occurs red ctx m (liftUnderAbs xs)) occurs red ctx m xs b@(NoAbs s x) = NoAbs s <$> occurs red ctx m xs x metaOccurs m (Abs s x) = metaOccurs m x metaOccurs m (NoAbs s x) = metaOccurs m x instance Occurs a => Occurs (I.Arg a) where occurs red ctx m xs (Arg info x) | isIrrelevant info = Arg info <$> occurs red Irrel m (goIrrelevant xs) x occurs red ctx m xs (Arg info x) = Arg info <$> occurs red ctx m xs x metaOccurs m a = metaOccurs m (unArg a) instance Occurs a => Occurs (I.Dom a) where occurs red ctx m xs (Dom info x) = Dom info <$> occurs red ctx m xs x metaOccurs m = metaOccurs m . unDom instance (Occurs a, Occurs b) => Occurs (a,b) where occurs red ctx m xs (x,y) = (,) <$> occurs red ctx m xs x <*> occurs red ctx m xs y metaOccurs m (x,y) = metaOccurs m x >> metaOccurs m y instance Occurs a => Occurs [a] where occurs red ctx m xs ys = mapM (occurs red ctx m xs) ys metaOccurs m ys = mapM_ (metaOccurs m) ys -- * Getting rid of flexible occurrences -- | @prune m' vs xs@ attempts to remove all arguments from @vs@ whose -- free variables are not contained in @xs@. -- If successful, @m'@ is solved by the new, pruned meta variable and we -- return @True@ else @False@. -- -- Issue 1147: -- If any of the meta args @vs@ is matchable, e.g., is a constructor term, -- we cannot prune, because the offending variables could be removed by -- reduction for a suitable instantiation of the meta variable. prune :: MetaId -> Args -> [Nat] -> TCM PruneResult prune m' vs xs = do caseEitherM (runExceptT $ mapM (hasBadRigid xs) $ map unArg vs) (const $ return PrunedNothing) $ \ kills -> do reportSDoc "tc.meta.kill" 10 $ vcat [ text "attempting kills" , nest 2 $ vcat [ text "m' =" <+> pretty m' -- , text "xs =" <+> text (show xs) , text "xs =" <+> prettyList (map (prettyTCM . var) xs) , text "vs =" <+> prettyList (map prettyTCM vs) , text "kills =" <+> text (show kills) ] ] killArgs kills m' -- | @hasBadRigid xs v = Just True@ iff one of the rigid variables in @v@ is not in @xs@. -- Actually we can only prune if a bad variable is in the head. See issue 458. -- Or in a non-eliminateable position (see succeed/PruningNonMillerPattern). -- -- @hasBadRigid xs v = Nothing@ means that -- we cannot prune at all as one of the meta args is matchable. -- (See issue 1147.) hasBadRigid :: [Nat] -> Term -> ExceptT () TCM Bool hasBadRigid xs t = do -- We fail if we encounter a matchable argument. let failure = throwError () tb <- liftTCM $ reduceB t let t = ignoreBlocking tb case ignoreSharing t of Var x _ -> return $ notElem x xs -- Issue 1153: A lambda has to be considered matchable. -- Lam _ v -> hasBadRigid (0 : map (+1) xs) (absBody v) Lam _ v -> failure DontCare v -> hasBadRigid xs v -- The following types of arguments cannot be eliminated by a pattern -- match: data, record, Pi, levels, sorts -- Thus, their offending rigid variables are bad. v@(Def f es) -> ifNotM (isNeutral tb f es) failure $ {- else -} do es `rigidVarsNotContainedIn` xs -- Andreas, 2012-05-03: There is room for further improvement. -- We could also consider a defined f which is not blocked by a meta. Pi a b -> (a,b) `rigidVarsNotContainedIn` xs Level v -> v `rigidVarsNotContainedIn` xs Sort s -> s `rigidVarsNotContainedIn` xs -- Since constructors can be eliminated by pattern-matching, -- offending variables under a constructor could be removed by -- the right instantiation of the meta variable. -- Thus, they are not rigid. Con c args -> do ifM (liftTCM $ isEtaCon (conName c)) -- in case of a record con, we can in principle prune -- (but not this argument; the meta could become a projection!) (and <$> mapM (hasBadRigid xs . unArg) args) -- not andM, we need to force the exceptions! failure Lit{} -> failure -- matchable MetaV{} -> failure -- potentially matchable Shared p -> __IMPOSSIBLE__ ExtLam{} -> __IMPOSSIBLE__ -- | Check whether a term @Def f es@ is finally stuck. -- Currently, we give only a crude approximation. isNeutral :: MonadTCM tcm => Blocked t -> QName -> Elims -> tcm Bool isNeutral b f es = liftTCM $ do let yes = return True no = return False def <- getConstInfo f case theDef def of Axiom{} -> yes Datatype{} -> yes Record{} -> yes Function{} -> case b of NotBlocked StuckOn{} _ -> yes NotBlocked AbsurdMatch _ -> yes _ -> no _ -> no -- | Check whether any of the variables (given as de Bruijn indices) -- occurs *definitely* in the term in a rigid position. -- Reduces the term successively to remove variables in dead subterms. -- This fixes issue 1386. rigidVarsNotContainedIn :: (MonadTCM tcm, FoldRigid a) => a -> [Nat] -> tcm Bool rigidVarsNotContainedIn v is = liftTCM $ do n0 <- getContextSize let -- allowed variables as de Bruijn levels levels = Set.fromList $ map (n0-1 -) is -- test if index is forbidden by converting it to level test i = do n <- getContextSize -- get de Bruijn level for i let l = n-1 - i -- If l >= n0 then it is a bound variable and can be -- ignored. Otherwise, it has to be in the allowed levels. forbidden = l < n0 && not (l `Set.member` levels) when forbidden $ reportSLn "tc.meta.kill" 20 $ "found forbidden de Bruijn level " ++ show l return $ Any forbidden getAny <$> foldRigid id test v -- | Collect the *definitely* rigid variables in a monoid. -- We need to successively reduce the expression to do this. class FoldRigid a where -- foldRigid :: (MonadTCM tcm, Monoid (tcm m)) => (tcm m -> tcm m) -> (Nat -> tcm m) -> a -> tcm m foldRigid :: (Monoid (TCM m)) => (TCM m -> TCM m) -> (Nat -> TCM m) -> a -> TCM m instance FoldRigid Term where foldRigid abs f t = do b <- liftTCM $ reduceB t case ignoreSharing $ ignoreBlocking b of Var i es -> f i `mappend` fold es Lam _ t -> fold t Lit{} -> mempty Def f es -> case b of Blocked{} -> mempty NotBlocked MissingClauses _ -> mempty _ -> fold es Con _ ts -> fold ts Pi a b -> fold (a,b) Sort s -> fold s Level l -> fold l MetaV{} -> mempty DontCare{} -> mempty Shared{} -> __IMPOSSIBLE__ ExtLam{} -> __IMPOSSIBLE__ where fold = foldRigid abs f instance FoldRigid Type where foldRigid abs f (El s t) = foldRigid abs f (s,t) instance FoldRigid Sort where foldRigid abs f s = case s of Type l -> fold l Prop -> mempty Inf -> mempty SizeUniv -> mempty DLub s1 s2 -> fold (s1, s2) where fold = foldRigid abs f instance FoldRigid Level where foldRigid abs f (Max ls) = foldRigid abs f ls instance FoldRigid PlusLevel where foldRigid abs f ClosedLevel{} = mempty foldRigid abs f (Plus _ l) = foldRigid abs f l instance FoldRigid LevelAtom where foldRigid abs f l = case l of MetaLevel{} -> mempty NeutralLevel MissingClauses _ -> mempty NeutralLevel _ l -> fold l BlockedLevel _ l -> fold l UnreducedLevel l -> fold l where fold = foldRigid abs f instance (Subst a, FoldRigid a) => FoldRigid (Abs a) where foldRigid abs f b = underAbstraction_ b $ foldRigid abs f instance FoldRigid a => FoldRigid (I.Arg a) where foldRigid abs f a = case getRelevance a of Irrelevant -> mempty UnusedArg -> mempty _ -> foldRigid abs f $ unArg a instance FoldRigid a => FoldRigid (I.Dom a) where foldRigid abs f dom = foldRigid abs f $ unDom dom instance FoldRigid a => FoldRigid (Elim' a) where foldRigid abs f (Apply a) = foldRigid abs f a foldRigid abs f Proj{} = mempty instance FoldRigid a => FoldRigid [a] where foldRigid abs f = foldMap $ foldRigid abs f instance (FoldRigid a, FoldRigid b) => FoldRigid (a,b) where foldRigid abs f (a,b) = foldRigid abs f a `mappend` foldRigid abs f b data PruneResult = NothingToPrune -- ^ the kill list is empty or only @False@s | PrunedNothing -- ^ there is no possible kill (because of type dep.) | PrunedSomething -- ^ managed to kill some args in the list | PrunedEverything -- ^ all prescribed kills where performed deriving (Eq, Show) -- | @killArgs [k1,...,kn] X@ prunes argument @i@ from metavar @X@ if @ki==True@. -- Pruning is carried out whenever > 0 arguments can be pruned. -- @True@ is only returned if all arguments could be pruned. killArgs :: [Bool] -> MetaId -> TCM PruneResult killArgs kills _ | not (or kills) = return NothingToPrune -- nothing to kill killArgs kills m = do mv <- lookupMeta m allowAssign <- asks envAssignMetas if mvFrozen mv == Frozen || not allowAssign then return PrunedNothing else do -- Andreas 2011-04-26, we allow pruning in MetaV and MetaS let a = jMetaType $ mvJudgement mv TelV tel b <- telView' <$> instantiateFull a let args = zip (telToList tel) (kills ++ repeat False) (kills', a') = killedType args b dbg kills' a a' -- If there is any prunable argument, perform the pruning if not (any unArg kills') then return PrunedNothing else do performKill (reverse kills') m a' -- Only successful if all occurrences were killed -- Andreas, 2011-05-09 more precisely, check that at least -- the in 'kills' prescribed kills were carried out return $ if (and $ zipWith implies kills $ map unArg kills') then PrunedEverything else PrunedSomething where implies :: Bool -> Bool -> Bool implies False _ = True implies True x = x dbg kills' a a' = reportSDoc "tc.meta.kill" 10 $ vcat [ text "after kill analysis" , nest 2 $ vcat [ text "metavar =" <+> prettyTCM m , text "kills =" <+> text (show kills) , text "kills' =" <+> text (show kills') , text "oldType =" <+> prettyTCM a , text "newType =" <+> prettyTCM a' ] ] -- | @killedType [((x1,a1),k1)..((xn,an),kn)] b = ([k'1..k'n],t')@ -- (ignoring @Dom@). Let @t' = (xs:as) -> b@. -- Invariant: @k'i == True@ iff @ki == True@ and pruning the @i@th argument from -- type @b@ is possible without creating unbound variables. -- @t'@ is type @t@ after pruning all @k'i==True@. killedType :: [(I.Dom (ArgName, Type), Bool)] -> Type -> ([I.Arg Bool], Type) killedType [] b = ([], b) killedType ((arg@(Dom info _), kill) : kills) b | dontKill = (Arg info False : args, mkPi arg b') | otherwise = (Arg info True : args, strengthen __IMPOSSIBLE__ b') where (args, b') = killedType kills b dontKill = not kill || 0 `freeIn` b' -- The list starts with the last argument performKill :: [I.Arg Bool] -> MetaId -> Type -> TCM () performKill kills m a = do mv <- lookupMeta m when (mvFrozen mv == Frozen) __IMPOSSIBLE__ let perm = Perm (size kills) [ i | (i, Arg _ False) <- zip [0..] (reverse kills) ] m' <- newMeta (mvInfo mv) (mvPriority mv) perm (HasType __IMPOSSIBLE__ a) -- Andreas, 2010-10-15 eta expand new meta variable if necessary etaExpandMetaSafe m' let vars = reverse [ Arg info (var i) | (i, Arg info False) <- zip [0..] kills ] lam b a = Lam (argInfo a) (Abs "v" b) tel = map ("v" <$) (reverse kills) u = MetaV m' $ map Apply vars dbg m' u assignTerm m tel u where dbg m' u = reportSDoc "tc.meta.kill" 10 $ vcat [ text "actual killing" , nest 2 $ vcat [ text "new meta:" <+> pretty m' , text "kills :" <+> text (show kills) , text "inst :" <+> pretty m <+> text ":=" <+> prettyTCM u ] ] Agda-2.4.2.5/src/full/Agda/TypeChecking/Patterns/0000755000000000000000000000000012635075266017462 5ustar0000000000000000Agda-2.4.2.5/src/full/Agda/TypeChecking/Patterns/Abstract.hs0000644000000000000000000000712312635075266021564 0ustar0000000000000000{-# LANGUAGE CPP #-} {-# LANGUAGE FlexibleInstances #-} {-# LANGUAGE ScopedTypeVariables #-} -- | Tools to manipulate patterns in abstract syntax -- in the TCM (type checking monad). module Agda.TypeChecking.Patterns.Abstract where import Data.List import Data.Traversable hiding (mapM, sequence) import qualified Agda.Syntax.Abstract as A import Agda.Syntax.Abstract.Views import Agda.Syntax.Common as Common import Agda.Syntax.Info as A import Agda.Syntax.Internal as I import Agda.Syntax.Literal import Agda.Syntax.Position import Agda.TypeChecking.Monad import Agda.TypeChecking.Monad.Builtin import Agda.Utils.Functor #include "undefined.h" import Agda.Utils.Impossible -- | Expand literal integer pattern into suc/zero constructor patterns. -- expandLitPattern :: A.NamedArg A.Pattern -> TCM (A.NamedArg A.Pattern) expandLitPattern p = traverse (traverse expand) p where expand p = case asView p of (xs, A.LitP (LitInt r n)) | n < 0 -> __IMPOSSIBLE__ | n > 20 -> tooBig | otherwise -> do Con z _ <- ignoreSharing <$> primZero Con s _ <- ignoreSharing <$> primSuc let zero = A.ConP cinfo (A.AmbQ [setRange r $ conName z]) [] suc p = A.ConP cinfo (A.AmbQ [setRange r $ conName s]) [defaultNamedArg p] info = A.PatRange r cinfo = A.ConPatInfo ConPCon info p' = foldr ($) zero $ genericReplicate n suc return $ foldr (A.AsP info) p' xs _ -> return p tooBig = typeError $ GenericError $ "Matching on natural number literals is done by expanding " ++ "the literal to the corresponding constructor pattern, so " ++ "you probably don't want to do it this way." -- | Expand away (deeply) all pattern synonyms in a pattern. class ExpandPatternSynonyms a where expandPatternSynonyms :: a -> TCM a instance ExpandPatternSynonyms a => ExpandPatternSynonyms (Maybe a) where expandPatternSynonyms = traverse expandPatternSynonyms instance ExpandPatternSynonyms a => ExpandPatternSynonyms [a] where expandPatternSynonyms = traverse expandPatternSynonyms instance ExpandPatternSynonyms a => ExpandPatternSynonyms (Common.Arg c a) where expandPatternSynonyms = traverse expandPatternSynonyms instance ExpandPatternSynonyms a => ExpandPatternSynonyms (Named n a) where expandPatternSynonyms = traverse expandPatternSynonyms instance ExpandPatternSynonyms A.Pattern where expandPatternSynonyms p = case p of A.VarP{} -> return p A.WildP{} -> return p A.DotP{} -> return p A.LitP{} -> return p A.AbsurdP{} -> return p A.ConP i ds as -> A.ConP i ds <$> expandPatternSynonyms as A.DefP i q as -> A.DefP i q <$> expandPatternSynonyms as A.AsP i x p -> A.AsP i x <$> expandPatternSynonyms p A.PatternSynP i x as -> setCurrentRange i $ do p <- killRange <$> lookupPatternSyn x -- Must expand arguments before instantiating otherwise pattern -- synonyms could get into dot patterns (which is __IMPOSSIBLE__) instPatternSyn p =<< expandPatternSynonyms as where instPatternSyn :: A.PatternSynDefn -> [A.NamedArg A.Pattern] -> TCM A.Pattern instPatternSyn (ns, p) as = do p <- expandPatternSynonyms p case A.insertImplicitPatSynArgs (A.WildP . PatRange) (getRange x) ns as of Nothing -> typeError $ BadArgumentsToPatternSynonym x Just (_, _:_) -> typeError $ TooFewArgumentsToPatternSynonym x Just (s, []) -> return $ setRange (getRange i) $ A.substPattern s p Agda-2.4.2.5/src/full/Agda/TypeChecking/Patterns/Match.hs0000644000000000000000000002133112635075266021052 0ustar0000000000000000{-# LANGUAGE CPP #-} {-# LANGUAGE DeriveFunctor #-} {-# LANGUAGE ScopedTypeVariables #-} -- | Pattern matcher used in the reducer for clauses that -- have not been compiled to case trees yet. module Agda.TypeChecking.Patterns.Match where import Prelude hiding (null) import Data.Monoid import Data.Traversable (traverse) import Agda.Syntax.Common import Agda.Syntax.Internal as I import Agda.TypeChecking.Reduce import Agda.TypeChecking.Reduce.Monad import Agda.TypeChecking.Substitute import Agda.TypeChecking.Monad hiding (reportSDoc) import Agda.TypeChecking.Pretty import Agda.Utils.Functor (for, ($>)) import Agda.Utils.Monad import Agda.Utils.Null import Agda.Utils.Size import Agda.Utils.Tuple #include "undefined.h" import Agda.Utils.Impossible -- | If matching is inconclusive (@DontKnow@) we want to know whether -- it is due to a particular meta variable. data Match a = Yes Simplification [a] | No | DontKnow (Blocked ()) deriving Functor instance Null (Match a) where empty = Yes empty empty null (Yes simpl as) = null simpl && null as null _ = False -- 'mappend' is UNUSED. -- -- instance Monoid (Match a) where -- mempty = Yes mempty [] -- Yes s us `mappend` Yes s' vs = Yes (s `mappend` s') (us ++ vs) -- Yes _ _ `mappend` No = No -- Yes _ _ `mappend` DontKnow m = DontKnow m -- No `mappend` _ = No -- -- @NotBlocked (StuckOn e)@ means blocked by a variable. -- -- In this case, no instantiation of -- -- meta-variables will make progress. -- DontKnow b `mappend` DontKnow b' = DontKnow $ b `mappend` b' -- -- One could imagine DontKnow _ `mappend` No = No, but would break the -- -- equivalence to case-trees. -- DontKnow m `mappend` _ = DontKnow m -- | Instead of 'zipWithM', we need to use this lazy version -- of combining pattern matching computations. -- Andreas, 2014-05-08, see Issue 1124: -- -- Due to a bug in TypeChecking.Patterns.Match -- a failed match of (C n b) against (C O unit) -- turned into (C n unit). -- This was because all patterns were matched in -- parallel, and evaluations of successfull matches -- (and a record constructor like unit can always -- be successfully matched) were returned, leading -- to a reassembly of (C n b) as (C n unit) which is -- illtyped. -- Now patterns are matched left to right and -- upon failure, no further matching is performed. foldMatch :: forall p v . (p -> v -> ReduceM (Match Term, v)) -> [p] -> [v] -> ReduceM (Match Term, [v]) foldMatch match = loop where loop :: [p] -> [v] -> ReduceM (Match Term, [v]) loop ps0 vs0 = do case (ps0, vs0) of ([], []) -> return (empty, []) (p : ps, v : vs) -> do (r, v') <- match p v case r of No -> return (No , v' : vs) DontKnow m -> return (DontKnow m, v' : vs) Yes s us -> do (r', vs') <- loop ps vs let vs1 = v' : vs' case r' of Yes s' us' -> return (Yes (s `mappend` s') (us ++ us'), vs1) No -> return (No , vs1) DontKnow m -> return (DontKnow m , vs1) _ -> __IMPOSSIBLE__ -- | @matchCopatterns ps es@ matches spine @es@ against copattern spine @ps@. -- -- Returns 'Yes' and a substitution for the pattern variables -- (in form of [Term]) if matching was successful. -- -- Returns 'No' if there was a constructor or projection mismatch. -- -- Returns 'DontKnow' if an argument could not be evaluated to -- constructor form because of a blocking meta variable. -- -- In any case, also returns spine @es@ in reduced form -- (with all the weak head reductions performed that were necessary -- to come to a decision). matchCopatterns :: [I.NamedArg Pattern] -> [Elim] -> ReduceM (Match Term, [Elim]) matchCopatterns ps vs = do traceSDoc "tc.match" 50 (vcat [ text "matchCopatterns" , nest 2 $ text "ps =" <+> fsep (punctuate comma $ map (prettyTCM . namedArg) ps) , nest 2 $ text "vs =" <+> fsep (punctuate comma $ map prettyTCM vs) ]) $ do -- Buggy, see issue 1124: -- mapFst mconcat . unzip <$> zipWithM' (matchCopattern . namedArg) ps vs foldMatch (matchCopattern . namedArg) ps vs -- | Match a single copattern. matchCopattern :: Pattern -> Elim -> ReduceM (Match Term, Elim) matchCopattern (ProjP p) elim@(Proj q) | p == q = return (Yes YesSimplification [], elim) | otherwise = return (No , elim) matchCopattern ProjP{} Apply{} = __IMPOSSIBLE__ matchCopattern _ Proj{} = __IMPOSSIBLE__ matchCopattern p (Apply v) = mapSnd Apply <$> matchPattern p v matchPatterns :: [I.NamedArg Pattern] -> [I.Arg Term] -> ReduceM (Match Term, [I.Arg Term]) matchPatterns ps vs = do traceSDoc "tc.match" 50 (vcat [ text "matchPatterns" , nest 2 $ text "ps =" <+> fsep (punctuate comma $ map (text . show) ps) , nest 2 $ text "vs =" <+> fsep (punctuate comma $ map prettyTCM vs) ]) $ do -- Buggy, see issue 1124: -- (ms,vs) <- unzip <$> zipWithM' (matchPattern . namedArg) ps vs -- return (mconcat ms, vs) foldMatch (matchPattern . namedArg) ps vs -- | Match a single pattern. matchPattern :: Pattern -> I.Arg Term -> ReduceM (Match Term, I.Arg Term) matchPattern p u = case (p, u) of (ProjP{}, _ ) -> __IMPOSSIBLE__ (VarP _ , arg@(Arg _ v)) -> return (Yes NoSimplification [v], arg) (DotP _ , arg@(Arg _ v)) -> return (Yes NoSimplification [v], arg) (LitP l , arg@(Arg _ v)) -> do w <- reduceB' v let arg' = arg $> ignoreBlocking w case ignoreSharing <$> w of NotBlocked _ (Lit l') | l == l' -> return (Yes YesSimplification [] , arg') | otherwise -> return (No , arg') NotBlocked _ (MetaV x _) -> return (DontKnow $ Blocked x () , arg') Blocked x _ -> return (DontKnow $ Blocked x () , arg') NotBlocked r t -> return (DontKnow $ NotBlocked r' () , arg') where r' = stuckOn (Apply arg') r -- Case record pattern: always succeed! -- This case is necessary if we want to use the clauses before -- record pattern translation (e.g., in type-checking definitions by copatterns). (ConP con@(ConHead c _ ds) ConPatternInfo{conPRecord = Just{}} ps, arg@(Arg info v)) -- precondition: con actually comes with the record fields | size ds == size ps -> mapSnd (Arg info . Con con) <$> do matchPatterns ps $ for ds $ \ d -> Arg info $ v `applyE` [Proj d] -- TODO: correct info for projected terms | otherwise -> __IMPOSSIBLE__ -- Case data constructor pattern. (ConP c _ ps, Arg info v) -> do w <- traverse constructorForm =<< reduceB' v -- Unfold delayed (corecursive) definitions one step. This is -- only necessary if c is a coinductive constructor, but -- 1) it does not hurt to do it all the time, and -- 2) whatInduction c sometimes crashes because c may point to -- an axiom at this stage (if we are checking the -- projection functions for a record type). {- w <- case ignoreSharing <$> w of NotBlocked r (Def f es) -> -- Andreas, 2014-06-12 TODO: r == ReallyNotBlocked sufficient? unfoldDefinitionE True reduceB' (Def f []) f es -- reduceB is used here because some constructors -- are actually definitions which need to be -- unfolded (due to open public). _ -> return w -} w <- case w of NotBlocked r u -> unfoldCorecursion u -- Andreas, 2014-06-12 TODO: r == ReallyNotBlocked sufficient? _ -> return w let v = ignoreBlocking w arg = Arg info v -- the reduced argument case ignoreSharing <$> w of NotBlocked _ (Con c' vs) | c == c' -> do (m, vs) <- yesSimplification <$> matchPatterns ps vs return (m, Arg info $ Con c' vs) | otherwise -> return (No , arg) NotBlocked _ (MetaV x vs) -> return (DontKnow $ Blocked x () , arg) Blocked x _ -> return (DontKnow $ Blocked x () , arg) NotBlocked r _ -> return (DontKnow $ NotBlocked r' () , arg) where r' = stuckOn (Apply arg) r -- ASR (08 November 2014). The type of the function could be -- -- @(Match Term, [I.Arg Term]) -> (Match Term, [I.Arg Term])@. yesSimplification :: (Match a, b) -> (Match a, b) yesSimplification (Yes _ vs, us) = (Yes YesSimplification vs, us) yesSimplification r = r Agda-2.4.2.5/src/full/Agda/TypeChecking/Patterns/Match.hs-boot0000644000000000000000000000056112635075266022015 0ustar0000000000000000 module Agda.TypeChecking.Patterns.Match where import Agda.Syntax.Internal import Agda.TypeChecking.Monad import Agda.TypeChecking.Reduce.Monad data Match a = Yes Simplification [a] | No | DontKnow (Blocked ()) matchPatterns :: [NamedArg Pattern] -> Args -> ReduceM (Match Term, Args) matchCopatterns :: [NamedArg Pattern] -> Elims -> ReduceM (Match Term, Elims) Agda-2.4.2.5/src/full/Agda/TypeChecking/Monad/0000755000000000000000000000000012635075266016720 5ustar0000000000000000Agda-2.4.2.5/src/full/Agda/TypeChecking/Monad/Base.hs-boot0000644000000000000000000000112612635075266021067 0ustar0000000000000000module Agda.TypeChecking.Monad.Base where import Control.Applicative (Applicative) import Control.Monad.IO.Class (MonadIO) import Data.IORef (IORef) import Data.Map (Map) import Agda.Syntax.Concrete.Name (TopLevelModuleName) import Agda.Utils.FileName (AbsolutePath) data TCEnv data TCState newtype TCMT m a = TCM { unTCM :: IORef TCState -> TCEnv -> m a } instance MonadIO m => Applicative (TCMT m) instance MonadIO m => Functor (TCMT m) instance MonadIO m => Monad (TCMT m) instance MonadIO m => MonadIO (TCMT m) type TCM = TCMT IO type ModuleToSource = Map TopLevelModuleName AbsolutePath Agda-2.4.2.5/src/full/Agda/TypeChecking/Monad/Benchmark.hs0000644000000000000000000000502712635075266021152 0ustar0000000000000000{-# LANGUAGE CPP #-} #if __GLASGOW_HASKELL__ <= 708 {-# LANGUAGE OverlappingInstances #-} #endif -- | Measure CPU time for individual phases of the Agda pipeline. module Agda.TypeChecking.Monad.Benchmark ( module Agda.Benchmarking , MonadBench , getBenchmark , updateBenchmarkingStatus , billTo, billPureTo , print ) where import Prelude hiding (print) import qualified Control.Exception as E (evaluate) import Control.Monad.State import Data.List import qualified Text.PrettyPrint.Boxes as Boxes import Agda.Benchmarking import Agda.TypeChecking.Monad.Base import{-# SOURCE #-} Agda.TypeChecking.Monad.Options import Agda.Utils.Benchmark (MonadBench(..), billTo, billPureTo) import qualified Agda.Utils.Benchmark as B import Agda.Utils.Monad import Agda.Utils.Pretty (prettyShow) #include "undefined.h" import Agda.Utils.Impossible benchmarkKey :: String benchmarkKey = "profile" benchmarkLevel :: Int benchmarkLevel = 7 -- | When verbosity is set or changes, we need to turn benchmarking on or off. updateBenchmarkingStatus :: TCM () -- {-# SPECIALIZE updateBenchmarkingStatus :: TCM () #-} -- updateBenchmarkingStatus :: (HasOptions m, MonadBench a m) => m () updateBenchmarkingStatus = B.setBenchmarking =<< hasVerbosity benchmarkKey benchmarkLevel -- | Check whether benchmarking is activated. {-# SPECIALIZE benchmarking :: TCM Bool #-} benchmarking :: MonadTCM tcm => tcm Bool benchmarking = liftTCM $ hasVerbosity benchmarkKey benchmarkLevel -- | Prints the accumulated benchmark results. Does nothing if -- profiling is not activated at level 7. print :: MonadTCM tcm => tcm () print = liftTCM $ whenM benchmarking $ do b <- getBenchmark reportSLn benchmarkKey benchmarkLevel $ prettyShow b -- -- | Bill a computation to a specific account. -- {-# SPECIALIZE billTo :: Account -> TCM a -> TCM a #-} -- billTo :: MonadTCM tcm => Account -> tcm a -> tcm a -- billTo account = lift1TCM $ B.billTo account -- Andreas, 2015-05-23 -- FAILS as lift1TCM :: (TCM a -> TCM b) -> tcm a -> tcm b -- cannot be implemented lazily in general. -- With `lazily` I mean that embedded IO computations in @tcm a@ are -- not executed, but passed on to @TCM a -> TCM b@ unevaluated. -- If they are treated strictly, then the whole benchmarking is inaccurate -- of course, as the computation is done before the clock is started. -- -- | Bill a pure computation to a specific account. -- {-# SPECIALIZE billPureTo :: Account -> a -> TCM a #-} -- billPureTo :: MonadTCM tcm => Account -> a -> tcm a -- billPureTo k a = billTo k $ return a Agda-2.4.2.5/src/full/Agda/TypeChecking/Monad/Base.hs0000644000000000000000000027431512635075266020142 0ustar0000000000000000{-# LANGUAGE CPP #-} {-# LANGUAGE DeriveDataTypeable #-} {-# LANGUAGE DeriveFoldable #-} {-# LANGUAGE DeriveFunctor #-} {-# LANGUAGE DeriveTraversable #-} {-# LANGUAGE ExistentialQuantification #-} {-# LANGUAGE FlexibleContexts #-} {-# LANGUAGE FlexibleInstances #-} {-# LANGUAGE GeneralizedNewtypeDeriving #-} {-# LANGUAGE MultiParamTypeClasses #-} {-# LANGUAGE NamedFieldPuns #-} {-# LANGUAGE Rank2Types #-} {-# LANGUAGE ScopedTypeVariables #-} {-# LANGUAGE UndecidableInstances #-} module Agda.TypeChecking.Monad.Base where import Prelude hiding (null) import Control.Arrow ((***), first, second) import qualified Control.Concurrent as C import Control.Exception as E import Control.Monad.State import Control.Monad.Reader import Control.Monad.Writer import Control.Monad.Trans.Maybe import Control.Applicative hiding (empty) import Data.Function import Data.Int import Data.IntMap (IntMap) import qualified Data.IntMap as IntMap import qualified Data.List as List import Data.Maybe import Data.Map (Map) import qualified Data.Map as Map -- hiding (singleton, null, empty) import Data.Set (Set) import qualified Data.Set as Set -- hiding (singleton, null, empty) import Data.Typeable (Typeable) import Data.Foldable import Data.Traversable import Data.IORef import qualified System.Console.Haskeline as Haskeline import Agda.Benchmarking (Benchmark, Phase) import Agda.Syntax.Concrete (TopLevelModuleName) import Agda.Syntax.Common hiding (Arg, Dom, NamedArg, ArgInfo) import qualified Agda.Syntax.Common as Common import qualified Agda.Syntax.Concrete as C import qualified Agda.Syntax.Concrete.Definitions as D import qualified Agda.Syntax.Abstract as A import Agda.Syntax.Abstract (AllNames) import Agda.Syntax.Internal as I import Agda.Syntax.Internal.Pattern () import Agda.Syntax.Fixity import Agda.Syntax.Position import Agda.Syntax.Scope.Base import Agda.TypeChecking.CompiledClause import Agda.TypeChecking.Positivity.Occurrence import Agda.Interaction.Exceptions -- import {-# SOURCE #-} Agda.Interaction.FindFile import Agda.Interaction.Options import Agda.Interaction.Response (InteractionOutputCallback, defaultInteractionOutputCallback, Response) import Agda.Interaction.Highlighting.Precise (CompressedFile, HighlightingInfo) import qualified Agda.Compiler.JS.Syntax as JS import Agda.Utils.Except ( Error(noMsg, strMsg) , ExceptT , MonadError(catchError, throwError) ) import Agda.Utils.Benchmark (MonadBench(..)) import Agda.Utils.FileName import Agda.Utils.HashMap (HashMap) import qualified Agda.Utils.HashMap as HMap import Agda.Utils.Hash import Agda.Utils.Lens import Agda.Utils.ListT import Agda.Utils.Monad import Agda.Utils.Null import Agda.Utils.Permutation import Agda.Utils.Pretty import Agda.Utils.Singleton import Agda.Utils.Time #include "undefined.h" import Agda.Utils.Impossible --------------------------------------------------------------------------- -- * Type checking state --------------------------------------------------------------------------- data TCState = TCSt { stPreScopeState :: !PreScopeState -- ^ The state which is frozen after scope checking. , stPostScopeState :: !PostScopeState -- ^ The state which is modified after scope checking. , stPersistentState :: !PersistentTCState -- ^ State which is forever, like a diamond. } data PreScopeState = PreScopeState { stPreTokens :: CompressedFile -- from lexer -- ^ Highlighting info for tokens (but not those tokens for -- which highlighting exists in 'stSyntaxInfo'). , stPreInteractionPoints :: InteractionPoints -- scope checker first , stPreImports :: Signature -- XX populated by scopec hecker -- ^ Imported declared identifiers. -- Those most not be serialized! , stPreImportedModules :: Set ModuleName -- imports logic , stPreModuleToSource :: ModuleToSource -- imports , stPreVisitedModules :: VisitedModules -- imports , stPreScope :: ScopeInfo -- generated by scope checker, current file: which modules you have, public definitions, current file, maps concrete names to abstract names. , stPrePatternSyns :: A.PatternSynDefns -- ^ Pattern synonyms of the current file. Serialized. , stPrePatternSynImports :: A.PatternSynDefns -- ^ Imported pattern synonyms. Must not be serialized! , stPrePragmaOptions :: PragmaOptions -- ^ Options applying to the current file. @OPTIONS@ -- pragmas only affect this field. , stPreImportedBuiltins :: BuiltinThings PrimFun , stPreHaskellImports :: Set String -- ^ Imports that should be generated by the compiler (this -- includes imports from imported modules). , stPreFreshInteractionId :: InteractionId , stPreFreshNameId :: NameId } type DisambiguatedNames = IntMap A.QName data PostScopeState = PostScopeState { stPostSyntaxInfo :: CompressedFile -- ^ Highlighting info. , stPostDisambiguatedNames :: !DisambiguatedNames -- ^ Disambiguation carried out by the type checker. -- Maps position of first name character to disambiguated @'A.QName'@ -- for each @'A.AmbiguousQName'@ already passed by the type checker. , stPostMetaStore :: MetaStore , stPostInteractionPoints :: InteractionPoints -- scope checker first , stPostAwakeConstraints :: Constraints , stPostSleepingConstraints :: Constraints , stPostDirty :: Bool -- local -- ^ Dirty when a constraint is added, used to prevent pointer update. -- Currently unused. , stPostOccursCheckDefs :: Set QName -- local -- ^ Definitions to be considered during occurs check. -- Initialized to the current mutual block before the check. -- During occurs check, we remove definitions from this set -- as soon we have checked them. , stPostSignature :: Signature -- ^ Declared identifiers of the current file. -- These will be serialized after successful type checking. , stPostCurrentModule :: Maybe ModuleName -- ^ The current module is available after it has been type -- checked. , stPostInstanceDefs :: TempInstanceTable , stPostStatistics :: Statistics -- ^ Counters to collect various statistics about meta variables etc. -- Only for current file. , stPostMutualBlocks :: Map MutualId (Set QName) , stPostLocalBuiltins :: BuiltinThings PrimFun , stPostFreshMetaId :: MetaId , stPostFreshMutualId :: MutualId , stPostFreshCtxId :: CtxId , stPostFreshProblemId :: ProblemId , stPostFreshInt :: Int } -- | A part of the state which is not reverted when an error is thrown -- or the state is reset. data PersistentTCState = PersistentTCSt { stDecodedModules :: DecodedModules , stPersistentOptions :: CommandLineOptions , stInteractionOutputCallback :: InteractionOutputCallback -- ^ Callback function to call when there is a response -- to give to the interactive frontend. -- See the documentation of 'InteractionOutputCallback'. , stBenchmark :: !Benchmark -- ^ Structure to track how much CPU time was spent on which Agda phase. -- Needs to be a strict field to avoid space leaks! , stAccumStatistics :: !Statistics -- ^ Should be strict field. } -- | Empty persistent state. initPersistentState :: PersistentTCState initPersistentState = PersistentTCSt { stPersistentOptions = defaultOptions , stDecodedModules = Map.empty , stInteractionOutputCallback = defaultInteractionOutputCallback , stBenchmark = empty , stAccumStatistics = Map.empty } -- | Empty state of type checker. initPreScopeState :: PreScopeState initPreScopeState = PreScopeState { stPreTokens = mempty , stPreInteractionPoints = Map.empty , stPreImports = emptySignature , stPreImportedModules = Set.empty , stPreModuleToSource = Map.empty , stPreVisitedModules = Map.empty , stPreScope = emptyScopeInfo , stPrePatternSyns = Map.empty , stPrePatternSynImports = Map.empty , stPrePragmaOptions = defaultInteractionOptions , stPreImportedBuiltins = Map.empty , stPreHaskellImports = Set.empty , stPreFreshInteractionId = 0 , stPreFreshNameId = NameId 0 0 } initPostScopeState :: PostScopeState initPostScopeState = PostScopeState { stPostSyntaxInfo = mempty , stPostDisambiguatedNames = IntMap.empty , stPostMetaStore = Map.empty , stPostInteractionPoints = Map.empty , stPostAwakeConstraints = [] , stPostSleepingConstraints = [] , stPostDirty = False , stPostOccursCheckDefs = Set.empty , stPostSignature = emptySignature , stPostCurrentModule = Nothing , stPostInstanceDefs = (Map.empty , []) , stPostStatistics = Map.empty , stPostMutualBlocks = Map.empty , stPostLocalBuiltins = Map.empty , stPostFreshMetaId = 0 , stPostFreshMutualId = 0 , stPostFreshCtxId = 0 , stPostFreshProblemId = 1 , stPostFreshInt = 0 } initState :: TCState initState = TCSt { stPreScopeState = initPreScopeState , stPostScopeState = initPostScopeState , stPersistentState = initPersistentState } -- * st-prefixed lenses ------------------------------------------------------------------------ stTokens :: Lens' CompressedFile TCState stTokens f s = f (stPreTokens (stPreScopeState s)) <&> \x -> s {stPreScopeState = (stPreScopeState s) {stPreTokens = x}} stImports :: Lens' Signature TCState stImports f s = f (stPreImports (stPreScopeState s)) <&> \x -> s {stPreScopeState = (stPreScopeState s) {stPreImports = x}} stImportedModules :: Lens' (Set ModuleName) TCState stImportedModules f s = f (stPreImportedModules (stPreScopeState s)) <&> \x -> s {stPreScopeState = (stPreScopeState s) {stPreImportedModules = x}} stModuleToSource :: Lens' ModuleToSource TCState stModuleToSource f s = f (stPreModuleToSource (stPreScopeState s)) <&> \x -> s {stPreScopeState = (stPreScopeState s) {stPreModuleToSource = x}} stVisitedModules :: Lens' VisitedModules TCState stVisitedModules f s = f (stPreVisitedModules (stPreScopeState s)) <&> \x -> s {stPreScopeState = (stPreScopeState s) {stPreVisitedModules = x}} stScope :: Lens' ScopeInfo TCState stScope f s = f (stPreScope (stPreScopeState s)) <&> \x -> s {stPreScopeState = (stPreScopeState s) {stPreScope = x}} stPatternSyns :: Lens' A.PatternSynDefns TCState stPatternSyns f s = f (stPrePatternSyns (stPreScopeState s)) <&> \x -> s {stPreScopeState = (stPreScopeState s) {stPrePatternSyns = x}} stPatternSynImports :: Lens' A.PatternSynDefns TCState stPatternSynImports f s = f (stPrePatternSynImports (stPreScopeState s)) <&> \x -> s {stPreScopeState = (stPreScopeState s) {stPrePatternSynImports = x}} stPragmaOptions :: Lens' PragmaOptions TCState stPragmaOptions f s = f (stPrePragmaOptions (stPreScopeState s)) <&> \x -> s {stPreScopeState = (stPreScopeState s) {stPrePragmaOptions = x}} stImportedBuiltins :: Lens' (BuiltinThings PrimFun) TCState stImportedBuiltins f s = f (stPreImportedBuiltins (stPreScopeState s)) <&> \x -> s {stPreScopeState = (stPreScopeState s) {stPreImportedBuiltins = x}} stHaskellImports :: Lens' (Set String) TCState stHaskellImports f s = f (stPreHaskellImports (stPreScopeState s)) <&> \x -> s {stPreScopeState = (stPreScopeState s) {stPreHaskellImports = x}} stFreshInteractionId :: Lens' InteractionId TCState stFreshInteractionId f s = f (stPreFreshInteractionId (stPreScopeState s)) <&> \x -> s {stPreScopeState = (stPreScopeState s) {stPreFreshInteractionId = x}} stFreshNameId :: Lens' NameId TCState stFreshNameId f s = f (stPreFreshNameId (stPreScopeState s)) <&> \x -> s {stPreScopeState = (stPreScopeState s) {stPreFreshNameId = x}} stSyntaxInfo :: Lens' CompressedFile TCState stSyntaxInfo f s = f (stPostSyntaxInfo (stPostScopeState s)) <&> \x -> s {stPostScopeState = (stPostScopeState s) {stPostSyntaxInfo = x}} stDisambiguatedNames :: Lens' DisambiguatedNames TCState stDisambiguatedNames f s = f (stPostDisambiguatedNames (stPostScopeState s)) <&> \x -> s {stPostScopeState = (stPostScopeState s) {stPostDisambiguatedNames = x}} stMetaStore :: Lens' MetaStore TCState stMetaStore f s = f (stPostMetaStore (stPostScopeState s)) <&> \x -> s {stPostScopeState = (stPostScopeState s) {stPostMetaStore = x}} stInteractionPoints :: Lens' InteractionPoints TCState stInteractionPoints f s = f (stPostInteractionPoints (stPostScopeState s)) <&> \x -> s {stPostScopeState = (stPostScopeState s) {stPostInteractionPoints = x}} stAwakeConstraints :: Lens' Constraints TCState stAwakeConstraints f s = f (stPostAwakeConstraints (stPostScopeState s)) <&> \x -> s {stPostScopeState = (stPostScopeState s) {stPostAwakeConstraints = x}} stSleepingConstraints :: Lens' Constraints TCState stSleepingConstraints f s = f (stPostSleepingConstraints (stPostScopeState s)) <&> \x -> s {stPostScopeState = (stPostScopeState s) {stPostSleepingConstraints = x}} stDirty :: Lens' Bool TCState stDirty f s = f (stPostDirty (stPostScopeState s)) <&> \x -> s {stPostScopeState = (stPostScopeState s) {stPostDirty = x}} stOccursCheckDefs :: Lens' (Set QName) TCState stOccursCheckDefs f s = f (stPostOccursCheckDefs (stPostScopeState s)) <&> \x -> s {stPostScopeState = (stPostScopeState s) {stPostOccursCheckDefs = x}} stSignature :: Lens' Signature TCState stSignature f s = f (stPostSignature (stPostScopeState s)) <&> \x -> s {stPostScopeState = (stPostScopeState s) {stPostSignature = x}} stCurrentModule :: Lens' (Maybe ModuleName) TCState stCurrentModule f s = f (stPostCurrentModule (stPostScopeState s)) <&> \x -> s {stPostScopeState = (stPostScopeState s) {stPostCurrentModule = x}} stInstanceDefs :: Lens' TempInstanceTable TCState stInstanceDefs f s = f (stPostInstanceDefs (stPostScopeState s)) <&> \x -> s {stPostScopeState = (stPostScopeState s) {stPostInstanceDefs = x}} stStatistics :: Lens' Statistics TCState stStatistics f s = f (stPostStatistics (stPostScopeState s)) <&> \x -> s {stPostScopeState = (stPostScopeState s) {stPostStatistics = x}} stMutualBlocks :: Lens' (Map MutualId (Set QName)) TCState stMutualBlocks f s = f (stPostMutualBlocks (stPostScopeState s)) <&> \x -> s {stPostScopeState = (stPostScopeState s) {stPostMutualBlocks = x}} stLocalBuiltins :: Lens' (BuiltinThings PrimFun) TCState stLocalBuiltins f s = f (stPostLocalBuiltins (stPostScopeState s)) <&> \x -> s {stPostScopeState = (stPostScopeState s) {stPostLocalBuiltins = x}} stFreshMetaId :: Lens' MetaId TCState stFreshMetaId f s = f (stPostFreshMetaId (stPostScopeState s)) <&> \x -> s {stPostScopeState = (stPostScopeState s) {stPostFreshMetaId = x}} stFreshMutualId :: Lens' MutualId TCState stFreshMutualId f s = f (stPostFreshMutualId (stPostScopeState s)) <&> \x -> s {stPostScopeState = (stPostScopeState s) {stPostFreshMutualId = x}} stFreshCtxId :: Lens' CtxId TCState stFreshCtxId f s = f (stPostFreshCtxId (stPostScopeState s)) <&> \x -> s {stPostScopeState = (stPostScopeState s) {stPostFreshCtxId = x}} stFreshProblemId :: Lens' ProblemId TCState stFreshProblemId f s = f (stPostFreshProblemId (stPostScopeState s)) <&> \x -> s {stPostScopeState = (stPostScopeState s) {stPostFreshProblemId = x}} stFreshInt :: Lens' Int TCState stFreshInt f s = f (stPostFreshInt (stPostScopeState s)) <&> \x -> s {stPostScopeState = (stPostScopeState s) {stPostFreshInt = x}} stBuiltinThings :: TCState -> BuiltinThings PrimFun stBuiltinThings s = (s^.stLocalBuiltins) `Map.union` (s^.stImportedBuiltins) -- * Fresh things ------------------------------------------------------------------------ class Enum i => HasFresh i where freshLens :: Lens' i TCState nextFresh :: HasFresh i => TCState -> (i, TCState) nextFresh s = let c = s^.freshLens in (c, set freshLens (succ c) s) fresh :: (HasFresh i, MonadState TCState m) => m i fresh = do c <- use freshLens freshLens .= succ c return c instance HasFresh MetaId where freshLens = stFreshMetaId instance HasFresh MutualId where freshLens = stFreshMutualId instance HasFresh InteractionId where freshLens = stFreshInteractionId instance HasFresh NameId where freshLens = stFreshNameId instance HasFresh CtxId where freshLens = stFreshCtxId instance HasFresh Int where freshLens = stFreshInt newtype ProblemId = ProblemId Nat deriving (Typeable, Eq, Ord, Enum, Real, Integral, Num) -- TODO: 'Show' should output Haskell-parseable representations. -- The following instance is deprecated, and Pretty[TCM] should be used -- instead. Later, simply derive Show for this type. -- ASR (28 December 2014). This instance is not used anymore (module -- the test suite) when reporting errors. See Issue 1293. instance Show ProblemId where show (ProblemId n) = show n instance Pretty ProblemId where pretty (ProblemId n) = pretty n instance HasFresh ProblemId where freshLens = stFreshProblemId freshName :: (MonadState TCState m, HasFresh NameId) => Range -> String -> m Name freshName r s = do i <- fresh return $ mkName r i s freshNoName :: (MonadState TCState m, HasFresh NameId) => Range -> m Name freshNoName r = do i <- fresh return $ Name i (C.NoName noRange i) r defaultFixity' freshNoName_ :: (MonadState TCState m, HasFresh NameId) => m Name freshNoName_ = freshNoName noRange -- | Create a fresh name from @a@. class FreshName a where freshName_ :: (MonadState TCState m, HasFresh NameId) => a -> m Name instance FreshName (Range, String) where freshName_ = uncurry freshName instance FreshName String where freshName_ = freshName noRange instance FreshName Range where freshName_ = freshNoName instance FreshName () where freshName_ () = freshNoName_ --------------------------------------------------------------------------- -- ** Managing file names --------------------------------------------------------------------------- -- | Maps top-level module names to the corresponding source file -- names. type ModuleToSource = Map TopLevelModuleName AbsolutePath -- | Maps source file names to the corresponding top-level module -- names. type SourceToModule = Map AbsolutePath TopLevelModuleName -- | Creates a 'SourceToModule' map based on 'stModuleToSource'. sourceToModule :: TCM SourceToModule sourceToModule = Map.fromList . List.map (\(m, f) -> (f, m)) . Map.toList <$> use stModuleToSource --------------------------------------------------------------------------- -- ** Interface --------------------------------------------------------------------------- data ModuleInfo = ModuleInfo { miInterface :: Interface , miWarnings :: Bool -- ^ 'True' if warnings were encountered when the module was type -- checked. } -- Note that the use of 'C.TopLevelModuleName' here is a potential -- performance problem, because these names do not contain unique -- identifiers. type VisitedModules = Map C.TopLevelModuleName ModuleInfo type DecodedModules = Map C.TopLevelModuleName Interface data Interface = Interface { iSourceHash :: Hash -- ^ Hash of the source code. , iImportedModules :: [(ModuleName, Hash)] -- ^ Imported modules and their hashes. , iModuleName :: ModuleName -- ^ Module name of this interface. , iScope :: Map ModuleName Scope -- ^ Scope defined by this module. , iInsideScope :: ScopeInfo -- ^ Scope after we loaded this interface. -- Used in 'Agda.Interaction.BasicOps.AtTopLevel' -- and 'Agda.Interaction.CommandLine.interactionLoop'. -- -- Andreas, AIM XX: For performance reason, this field is -- not serialized, so if you deserialize an interface, @iInsideScope@ -- will be empty. You need to type-check the file to get @iInsideScope@. , iSignature :: Signature , iBuiltin :: BuiltinThings (String, QName) , iHaskellImports :: Set String -- ^ Haskell imports listed in -- (transitively) imported modules are -- not included here. , iHighlighting :: HighlightingInfo , iPragmaOptions :: [OptionsPragma] -- ^ Pragma options set in the file. , iPatternSyns :: A.PatternSynDefns } deriving (Typeable, Show) instance Pretty Interface where pretty (Interface sourceH importedM moduleN scope insideS signature builtin haskellI highlighting pragmaO patternS) = hang (text "Interface") 2 $ vcat [ text "source hash:" <+> (pretty . show) sourceH , text "imported modules:" <+> (pretty . show) importedM , text "module name:" <+> pretty moduleN , text "scope:" <+> (pretty . show) scope , text "inside scope:" <+> (pretty . show) insideS , text "signature:" <+> (pretty . show) signature , text "builtin:" <+> (pretty . show) builtin , text "Haskell imports:" <+> (pretty . show) haskellI , text "highlighting:" <+> (pretty . show) highlighting , text "pragma options:" <+> (pretty . show) pragmaO , text "pattern syns:" <+> (pretty . show) patternS ] -- | Combines the source hash and the (full) hashes of the imported modules. iFullHash :: Interface -> Hash iFullHash i = combineHashes $ iSourceHash i : List.map snd (iImportedModules i) --------------------------------------------------------------------------- -- ** Closure --------------------------------------------------------------------------- data Closure a = Closure { clSignature :: Signature , clEnv :: TCEnv , clScope :: ScopeInfo , clValue :: a } deriving (Typeable) instance Show a => Show (Closure a) where show cl = "Closure " ++ show (clValue cl) instance HasRange a => HasRange (Closure a) where getRange = getRange . clValue buildClosure :: a -> TCM (Closure a) buildClosure x = do env <- ask sig <- use stSignature scope <- use stScope return $ Closure sig env scope x --------------------------------------------------------------------------- -- ** Constraints --------------------------------------------------------------------------- type Constraints = [ProblemConstraint] data ProblemConstraint = PConstr { constraintProblem :: ProblemId , theConstraint :: Closure Constraint } deriving (Typeable, Show) instance HasRange ProblemConstraint where getRange = getRange . theConstraint data Constraint = ValueCmp Comparison Type Term Term | ElimCmp [Polarity] Type Term [Elim] [Elim] | TypeCmp Comparison Type Type | TelCmp Type Type Comparison Telescope Telescope -- ^ the two types are for the error message only | SortCmp Comparison Sort Sort | LevelCmp Comparison Level Level -- | ShortCut MetaId Term Type -- -- ^ A delayed instantiation. Replaces @ValueCmp@ in 'postponeTypeCheckingProblem'. | UnBlock MetaId | Guarded Constraint ProblemId | IsEmpty Range Type -- ^ The range is the one of the absurd pattern. | CheckSizeLtSat Type -- ^ Check that the 'Type' is either not a SIZELT or a non-empty SIZELT. | FindInScope MetaId (Maybe [(Term, Type)]) deriving (Typeable, Show) instance HasRange Constraint where getRange (IsEmpty r t) = r getRange _ = noRange {- no Range instances for Term, Type, Elm, Tele, Sort, Level, MetaId getRange (ValueCmp cmp a u v) = getRange (a,u,v) getRange (ElimCmp pol a v es es') = getRange (a,v,es,es') getRange (TypeCmp cmp a b) = getRange (a,b) getRange (TelCmp a b cmp tel tel') = getRange (a,b,tel,tel') getRange (SortCmp cmp s s') = getRange (s,s') getRange (LevelCmp cmp l l') = getRange (l,l') getRange (UnBlock x) = getRange x getRange (Guarded c pid) = getRange c getRange (FindInScope x cands) = getRange x -} data Comparison = CmpEq | CmpLeq deriving (Eq, Typeable) -- TODO: 'Show' should output Haskell-parseable representations. -- The following instance is deprecated, and Pretty[TCM] should be used -- instead. Later, simply derive Show for this type. -- ASR (27 December 2014). This instance is not used anymore (module -- the test suite) when reporting errors. See Issue 1293. instance Show Comparison where show CmpEq = "=" show CmpLeq = "=<" instance Pretty Comparison where pretty CmpEq = text "=" pretty CmpLeq = text "=<" -- | An extension of 'Comparison' to @>=@. data CompareDirection = DirEq | DirLeq | DirGeq deriving (Eq, Typeable) instance Show CompareDirection where show DirEq = "=" show DirLeq = "=<" show DirGeq = ">=" -- | Embed 'Comparison' into 'CompareDirection'. fromCmp :: Comparison -> CompareDirection fromCmp CmpEq = DirEq fromCmp CmpLeq = DirLeq -- | Flip the direction of comparison. flipCmp :: CompareDirection -> CompareDirection flipCmp DirEq = DirEq flipCmp DirLeq = DirGeq flipCmp DirGeq = DirLeq -- | Turn a 'Comparison' function into a 'CompareDirection' function. -- -- Property: @dirToCmp f (fromCmp cmp) = f cmp@ dirToCmp :: (Comparison -> a -> a -> c) -> CompareDirection -> a -> a -> c dirToCmp cont DirEq = cont CmpEq dirToCmp cont DirLeq = cont CmpLeq dirToCmp cont DirGeq = flip $ cont CmpLeq --------------------------------------------------------------------------- -- * Open things --------------------------------------------------------------------------- -- | A thing tagged with the context it came from. data Open a = OpenThing { openThingCtxIds :: [CtxId], openThing :: a } deriving (Typeable, Show, Functor) --------------------------------------------------------------------------- -- * Judgements -- -- Used exclusively for typing of meta variables. --------------------------------------------------------------------------- -- | Parametrized since it is used without MetaId when creating a new meta. data Judgement a = HasType { jMetaId :: a, jMetaType :: Type } | IsSort { jMetaId :: a, jMetaType :: Type } -- Andreas, 2011-04-26: type needed for higher-order sort metas deriving (Typeable) instance Show a => Show (Judgement a) where show (HasType a t) = show a ++ " : " ++ show t show (IsSort a t) = show a ++ " :sort " ++ show t --------------------------------------------------------------------------- -- ** Meta variables --------------------------------------------------------------------------- data MetaVariable = MetaVar { mvInfo :: MetaInfo , mvPriority :: MetaPriority -- ^ some metavariables are more eager to be instantiated , mvPermutation :: Permutation -- ^ a metavariable doesn't have to depend on all variables -- in the context, this "permutation" will throw away the -- ones it does not depend on , mvJudgement :: Judgement MetaId , mvInstantiation :: MetaInstantiation , mvListeners :: Set Listener -- ^ meta variables scheduled for eta-expansion but blocked by this one , mvFrozen :: Frozen -- ^ are we past the point where we can instantiate this meta variable? } deriving (Typeable) data Listener = EtaExpand MetaId | CheckConstraint Nat ProblemConstraint deriving (Typeable) instance Eq Listener where EtaExpand x == EtaExpand y = x == y CheckConstraint x _ == CheckConstraint y _ = x == y _ == _ = False instance Ord Listener where EtaExpand x `compare` EtaExpand y = x `compare` y CheckConstraint x _ `compare` CheckConstraint y _ = x `compare` y EtaExpand{} `compare` CheckConstraint{} = LT CheckConstraint{} `compare` EtaExpand{} = GT -- | Frozen meta variable cannot be instantiated by unification. -- This serves to prevent the completion of a definition by its use -- outside of the current block. -- (See issues 118, 288, 399). data Frozen = Frozen -- ^ Do not instantiate. | Instantiable deriving (Eq, Show) data MetaInstantiation = InstV [Arg String] Term -- ^ solved by term (abstracted over some free variables) | InstS Term -- ^ solved by @Lam .. Sort s@ | Open -- ^ unsolved | OpenIFS -- ^ open, to be instantiated as "implicit from scope" | BlockedConst Term -- ^ solution blocked by unsolved constraints | PostponedTypeCheckingProblem (Closure TypeCheckingProblem) (TCM Bool) deriving (Typeable) data TypeCheckingProblem = CheckExpr A.Expr Type | CheckArgs ExpandHidden ExpandInstances Range [I.NamedArg A.Expr] Type Type (Args -> Type -> TCM Term) | CheckLambda (Arg ([WithHiding Name], Maybe Type)) A.Expr Type -- ^ @(λ (xs : t₀) → e) : t@ -- This is not an instance of 'CheckExpr' as the domain type -- has already been checked. -- For example, when checking -- @(λ (x y : Fin _) → e) : (x : Fin n) → ?@ -- we want to postpone @(λ (y : Fin n) → e) : ?@ where @Fin n@ -- is a 'Type' rather than an 'A.Expr'. deriving (Typeable) instance Show MetaInstantiation where show (InstV tel t) = "InstV " ++ show tel ++ " (" ++ show t ++ ")" show (InstS s) = "InstS (" ++ show s ++ ")" show Open = "Open" show OpenIFS = "OpenIFS" show (BlockedConst t) = "BlockedConst (" ++ show t ++ ")" show (PostponedTypeCheckingProblem{}) = "PostponedTypeCheckingProblem (...)" -- | Meta variable priority: -- When we have an equation between meta-variables, which one -- should be instantiated? -- -- Higher value means higher priority to be instantiated. newtype MetaPriority = MetaPriority Int deriving (Eq, Ord, Show) data RunMetaOccursCheck = RunMetaOccursCheck | DontRunMetaOccursCheck deriving (Eq, Ord, Show) -- | @MetaInfo@ is cloned from one meta to the next during pruning. data MetaInfo = MetaInfo { miClosRange :: Closure Range -- TODO: Not so nice. But we want both to have the environment of the meta (Closure) and its range. -- , miRelevance :: Relevance -- ^ Created in irrelevant position? , miMetaOccursCheck :: RunMetaOccursCheck -- ^ Run the extended occurs check that goes in definitions? , miNameSuggestion :: MetaNameSuggestion -- ^ Used for printing. -- @Just x@ if meta-variable comes from omitted argument with name @x@. } -- | Name suggestion for meta variable. Empty string means no suggestion. type MetaNameSuggestion = String -- | For printing, we couple a meta with its name suggestion. data NamedMeta = NamedMeta { nmSuggestion :: MetaNameSuggestion , nmid :: MetaId } instance Pretty NamedMeta where pretty (NamedMeta "" x) = pretty x pretty (NamedMeta s x) = text $ "_" ++ s ++ prettyShow x type MetaStore = Map MetaId MetaVariable instance HasRange MetaInfo where getRange = clValue . miClosRange instance HasRange MetaVariable where getRange m = getRange $ getMetaInfo m instance SetRange MetaInfo where setRange r m = m { miClosRange = (miClosRange m) { clValue = r }} instance SetRange MetaVariable where setRange r m = m { mvInfo = setRange r (mvInfo m) } normalMetaPriority :: MetaPriority normalMetaPriority = MetaPriority 0 lowMetaPriority :: MetaPriority lowMetaPriority = MetaPriority (-10) highMetaPriority :: MetaPriority highMetaPriority = MetaPriority 10 getMetaInfo :: MetaVariable -> Closure Range getMetaInfo = miClosRange . mvInfo getMetaScope :: MetaVariable -> ScopeInfo getMetaScope m = clScope $ getMetaInfo m getMetaEnv :: MetaVariable -> TCEnv getMetaEnv m = clEnv $ getMetaInfo m getMetaSig :: MetaVariable -> Signature getMetaSig m = clSignature $ getMetaInfo m getMetaRelevance :: MetaVariable -> Relevance getMetaRelevance = envRelevance . getMetaEnv getMetaColors :: MetaVariable -> [Color] getMetaColors = envColors . getMetaEnv --------------------------------------------------------------------------- -- ** Interaction meta variables --------------------------------------------------------------------------- -- | Interaction points are created by the scope checker who sets the range. -- The meta variable is created by the type checker and then hooked up to the -- interaction point. data InteractionPoint = InteractionPoint { ipRange :: Range -- ^ The position of the interaction point. , ipMeta :: Maybe MetaId -- ^ The meta variable, if any, holding the type etc. } instance Eq InteractionPoint where (==) = (==) `on` ipMeta -- | Data structure managing the interaction points. type InteractionPoints = Map InteractionId InteractionPoint --------------------------------------------------------------------------- -- ** Signature --------------------------------------------------------------------------- data Signature = Sig { _sigSections :: Sections , _sigDefinitions :: Definitions , _sigRewriteRules:: RewriteRuleMap -- ^ The rewrite rules defined in this file. } deriving (Typeable, Show) sigSections :: Lens' Sections Signature sigSections f s = f (_sigSections s) <&> \x -> s {_sigSections = x} sigDefinitions :: Lens' Definitions Signature sigDefinitions f s = f (_sigDefinitions s) <&> \x -> s {_sigDefinitions = x} sigRewriteRules :: Lens' RewriteRuleMap Signature sigRewriteRules f s = f (_sigRewriteRules s) <&> \x -> s {_sigRewriteRules = x} type Sections = Map ModuleName Section type Definitions = HashMap QName Definition type RewriteRuleMap = HashMap QName RewriteRules data Section = Section { _secTelescope :: Telescope } deriving (Typeable, Show) secTelescope :: Lens' Telescope Section secTelescope f s = f (_secTelescope s) <&> \x -> s {_secTelescope = x} emptySignature :: Signature emptySignature = Sig Map.empty HMap.empty HMap.empty -- | A @DisplayForm@ is in essence a rewrite rule -- @ -- q ts --> dt -- @ -- for a defined symbol (could be a constructor as well) @q@. -- The right hand side is a 'DisplayTerm' which is used to -- 'reify' to a more readable 'Abstract.Syntax'. -- -- The patterns @ts@ are just terms, but @var 0@ is interpreted -- as a hole. Each occurrence of @var 0@ is a new hole (pattern var). -- For each *occurrence* of @var0@ the rhs @dt@ has a free variable. -- These are instantiated when matching a display form against a -- term @q vs@ succeeds. data DisplayForm = Display { dfFreeVars :: Nat -- ^ Number @n@ of free variables in 'dfRHS'. , dfPats :: [Term] -- ^ Left hand side patterns, where @var 0@ stands for a pattern -- variable. There should be @n@ occurrences of @var0@ in -- 'dfPats'. , dfRHS :: DisplayTerm -- ^ Right hand side, with @n@ free variables. } deriving (Typeable, Show) -- | A structured presentation of a 'Term' for reification into -- 'Abstract.Syntax'. data DisplayTerm = DWithApp DisplayTerm [DisplayTerm] Args -- ^ @(f vs | ws) us@. -- The first 'DisplayTerm' is the parent function @f@ with its args @vs@. -- The list of 'DisplayTerm's are the with expressions @ws@. -- The 'Args' are additional arguments @us@ -- (possible in case the with-application is of function type). | DCon ConHead [Arg DisplayTerm] -- ^ @c vs@. | DDef QName [Elim' DisplayTerm] -- ^ @d vs@. | DDot Term -- ^ @.v@. | DTerm Term -- ^ @v@. deriving (Typeable, Show) -- | By default, we have no display form. defaultDisplayForm :: QName -> [Open DisplayForm] defaultDisplayForm c = [] defRelevance :: Definition -> Relevance defRelevance = argInfoRelevance . defArgInfo defColors :: Definition -> [Color] defColors = argInfoColors . defArgInfo -- | Non-linear (non-constructor) first-order pattern. data NLPat = PVar {-# UNPACK #-} !Int -- ^ Matches anything (modulo non-linearity). | PWild -- ^ Matches anything (e.g. irrelevant terms). | PDef QName PElims -- ^ Matches @f es@ | PLam ArgInfo (Abs NLPat) -- ^ Matches @λ x → t@ | PPi (Dom (Type' NLPat)) (Abs (Type' NLPat)) -- ^ Matches @(x : A) → B@ | PBoundVar {-# UNPACK #-} !Int PElims -- ^ Matches @x es@ where x is a lambda-bound variable | PTerm Term -- ^ Matches the term modulo β (ideally βη). deriving (Typeable, Show) type PElims = [Elim' NLPat] type RewriteRules = [RewriteRule] -- | Rewrite rules can be added independently from function clauses. data RewriteRule = RewriteRule { rewName :: QName -- ^ Name of rewrite rule @q : Γ → lhs ≡ rhs@ -- where @≡@ is the rewrite relation. , rewContext :: Telescope -- ^ @Γ@. , rewLHS :: NLPat -- ^ @Γ ⊢ lhs : t@. , rewRHS :: Term -- ^ @Γ ⊢ rhs : t@. , rewType :: Type -- ^ @Γ ⊢ t@. } deriving (Typeable, Show) data Definition = Defn { defArgInfo :: ArgInfo -- ^ Hiding should not be used. , defName :: QName , defType :: Type -- ^ Type of the lifted definition. , defPolarity :: [Polarity] -- ^ Variance information on arguments of the definition. -- Does not include info for dropped parameters to -- projection(-like) functions and constructors. , defArgOccurrences :: [Occurrence] -- ^ Positivity information on arguments of the definition. -- Does not include info for dropped parameters to -- projection(-like) functions and constructors. , defDisplay :: [Open DisplayForm] , defMutual :: MutualId , defCompiledRep :: CompiledRepresentation , defInstance :: Maybe QName -- ^ @Just q@ when this definition is an instance of class q , theDef :: Defn } deriving (Typeable, Show) -- | Create a definition with sensible defaults. defaultDefn :: ArgInfo -> QName -> Type -> Defn -> Definition defaultDefn info x t def = Defn { defArgInfo = info , defName = x , defType = t , defPolarity = [] , defArgOccurrences = [] , defDisplay = defaultDisplayForm x , defMutual = 0 , defCompiledRep = noCompiledRep , defInstance = Nothing , theDef = def } type HaskellCode = String type HaskellType = String type EpicCode = String type JSCode = JS.Exp data HaskellRepresentation = HsDefn HaskellType HaskellCode | HsType HaskellType deriving (Typeable, Show) data HaskellExport = HsExport HaskellType String deriving (Show, Typeable) -- | Polarity for equality and subtype checking. data Polarity = Covariant -- ^ monotone | Contravariant -- ^ antitone | Invariant -- ^ no information (mixed variance) | Nonvariant -- ^ constant deriving (Typeable, Show, Eq) data CompiledRepresentation = CompiledRep { compiledHaskell :: Maybe HaskellRepresentation , exportHaskell :: Maybe HaskellExport , compiledEpic :: Maybe EpicCode , compiledJS :: Maybe JSCode } deriving (Typeable, Show) noCompiledRep :: CompiledRepresentation noCompiledRep = CompiledRep Nothing Nothing Nothing Nothing -- | Additional information for extended lambdas. data ExtLamInfo = ExtLamInfo { extLamNumHidden :: Int -- Number of hidden args to be dropped when printing. , extLamNumNonHid :: Int -- Number of visible args to be dropped when printing. } deriving (Typeable, Eq, Ord, Show) -- | Additional information for projection 'Function's. data Projection = Projection { projProper :: Maybe QName -- ^ @Nothing@ if only projection-like, @Just q@ if record projection, -- where @q@ is the original projection name -- (current name could be from module app). , projFromType :: QName -- ^ Type projected from. Record type if @projProper = Just{}@. , projIndex :: Int -- ^ Index of the record argument. -- Start counting with 1, because 0 means that -- it is already applied to the record value. -- This can happen in module instantiation, but -- then either the record value is @var 0@, or @funProjection == Nothing@. , projDropPars :: Term -- ^ Term @t@ to be be applied to record parameters and record value. -- The parameters will be dropped. -- In case of a proper projection, a postfix projection application -- will be created: @t = \ pars r -> r .p@ -- (Invariant: the number of abstractions equals 'projIndex'.) -- In case of a projection-like function, just the function symbol -- is returned as 'Def': @t = \ pars -> f@. , projArgInfo :: I.ArgInfo -- ^ The info of the principal (record) argument. } deriving (Typeable, Show) data Defn = Axiom -- ^ Postulate. | Function { funClauses :: [Clause] , funCompiled :: Maybe CompiledClauses -- ^ 'Nothing' while function is still type-checked. -- @Just cc@ after type and coverage checking and -- translation to case trees. , funInv :: FunctionInverse , funMutual :: [QName] -- ^ Mutually recursive functions, @data@s and @record@s. -- Does not include this function. , funAbstr :: IsAbstract , funDelayed :: Delayed -- ^ Are the clauses of this definition delayed? , funProjection :: Maybe Projection -- ^ Is it a record projection? -- If yes, then return the name of the record type and index of -- the record argument. Start counting with 1, because 0 means that -- it is already applied to the record. (Can happen in module -- instantiation.) This information is used in the termination -- checker. , funStatic :: Bool -- ^ Should calls to this function be normalised at compile-time? , funCopy :: Bool -- ^ Has this function been created by a module -- instantiation? , funTerminates :: Maybe Bool -- ^ Has this function been termination checked? Did it pass? , funExtLam :: Maybe ExtLamInfo -- ^ Is this function generated from an extended lambda? -- If yes, then return the number of hidden and non-hidden lambda-lifted arguments , funWith :: Maybe QName -- ^ Is this a generated with-function? If yes, then what's the -- name of the parent function. , funCopatternLHS :: Bool -- ^ Is this a function defined by copatterns? } | Datatype { dataPars :: Nat -- ^ Number of parameters. , dataSmallPars :: Permutation -- ^ Parameters that are maybe small. , dataNonLinPars :: Drop Permutation -- ^ Parameters that appear in indices. , dataIxs :: Nat -- ^ Number of indices. , dataInduction :: Induction -- ^ @data@ or @codata@ (legacy). , dataClause :: (Maybe Clause) -- ^ This might be in an instantiated module. , dataCons :: [QName] -- ^ Constructor names. , dataSort :: Sort , dataMutual :: [QName] -- ^ Mutually recursive functions, @data@s and @record@s. Does not include this data type. , dataAbstr :: IsAbstract } | Record { recPars :: Nat -- ^ Number of parameters. , recClause :: Maybe Clause , recConHead :: ConHead -- ^ Constructor name and fields. , recNamedCon :: Bool , recConType :: Type -- ^ The record constructor's type. (Includes record parameters.) , recFields :: [Arg QName] , recTel :: Telescope -- ^ The record field telescope. (Includes record parameters.) -- Note: @TelV recTel _ == telView' recConType@. -- Thus, @recTel@ is redundant. , recMutual :: [QName] -- ^ Mutually recursive functions, @data@s and @record@s. Does not include this record. , recEtaEquality :: Bool -- ^ Eta-expand at this record type. @False@ for unguarded recursive records and coinductive records. , recInduction :: Maybe Induction -- ^ 'Inductive' or 'CoInductive'? Matters only for recursive records. -- 'Nothing' means that the user did not specify it, which is an error -- for recursive records. , recRecursive :: Bool -- ^ Recursive record. Implies @recEtaEquality = False@. Projections are not size-preserving. , recAbstr :: IsAbstract } | Constructor { conPars :: Nat -- ^ Number of parameters. , conSrcCon :: ConHead -- ^ Name of (original) constructor and fields. (This might be in a module instance.) , conData :: QName -- ^ Name of datatype or record type. , conAbstr :: IsAbstract , conInd :: Induction -- ^ Inductive or coinductive? } | Primitive { primAbstr :: IsAbstract , primName :: String , primClauses :: [Clause] -- ^ 'null' for primitive functions, @not null@ for builtin functions. , primCompiled :: Maybe CompiledClauses -- ^ 'Nothing' for primitive functions, -- @'Just' something@ for builtin functions. } -- ^ Primitive or builtin functions. deriving (Typeable, Show) -- | A template for creating 'Function' definitions, with sensible defaults. emptyFunction :: Defn emptyFunction = Function { funClauses = [] , funCompiled = Nothing , funInv = NotInjective , funMutual = [] , funAbstr = ConcreteDef , funDelayed = NotDelayed , funProjection = Nothing , funStatic = False , funCopy = False , funTerminates = Nothing , funExtLam = Nothing , funWith = Nothing , funCopatternLHS = False } -- | Checking whether we are dealing with a function yet to be defined. isEmptyFunction :: Defn -> Bool isEmptyFunction def = case def of Function { funClauses = [] } -> True _ -> False isCopatternLHS :: [Clause] -> Bool isCopatternLHS = List.any (List.any (isJust . A.isProjP) . clausePats) recCon :: Defn -> QName recCon Record{ recConHead } = conName recConHead recCon _ = __IMPOSSIBLE__ defIsRecord :: Defn -> Bool defIsRecord Record{} = True defIsRecord _ = False defIsDataOrRecord :: Defn -> Bool defIsDataOrRecord Record{} = True defIsDataOrRecord Datatype{} = True defIsDataOrRecord _ = False newtype Fields = Fields [(C.Name, Type)] deriving (Typeable, Null) -- | Did we encounter a simplifying reduction? -- In terms of CIC, that would be a iota-reduction. -- In terms of Agda, this is a constructor or literal -- pattern that matched. -- Just beta-reduction (substitution) or delta-reduction -- (unfolding of definitions) does not count as simplifying? data Simplification = YesSimplification | NoSimplification deriving (Typeable, Eq, Show) instance Null Simplification where empty = NoSimplification null = (== NoSimplification) instance Monoid Simplification where mempty = NoSimplification mappend YesSimplification _ = YesSimplification mappend NoSimplification s = s data Reduced no yes = NoReduction no | YesReduction Simplification yes deriving (Typeable, Functor) -- | Three cases: 1. not reduced, 2. reduced, but blocked, 3. reduced, not blocked. data IsReduced = NotReduced | Reduced (Blocked ()) data MaybeReduced a = MaybeRed { isReduced :: IsReduced , ignoreReduced :: a } deriving (Functor) instance IsProjElim e => IsProjElim (MaybeReduced e) where isProjElim = isProjElim . ignoreReduced type MaybeReducedArgs = [MaybeReduced (Arg Term)] type MaybeReducedElims = [MaybeReduced Elim] notReduced :: a -> MaybeReduced a notReduced x = MaybeRed NotReduced x reduced :: Blocked (Arg Term) -> MaybeReduced (Arg Term) reduced b = case fmap ignoreSharing <$> b of NotBlocked _ (Common.Arg _ (MetaV x _)) -> MaybeRed (Reduced $ Blocked x ()) v _ -> MaybeRed (Reduced $ () <$ b) v where v = ignoreBlocking b -- | Controlling 'reduce'. data AllowedReduction = ProjectionReductions -- ^ (Projection and) projection-like functions may be reduced. | FunctionReductions -- ^ Functions which are not projections may be reduced. | LevelReductions -- ^ Reduce @'Level'@ terms. | NonTerminatingReductions -- ^ Functions that have not passed termination checking. deriving (Show, Eq, Ord, Enum, Bounded) type AllowedReductions = [AllowedReduction] -- | Not quite all reductions (skip non-terminating reductions) allReductions :: AllowedReductions allReductions = [minBound..pred maxBound] data PrimFun = PrimFun { primFunName :: QName , primFunArity :: Arity , primFunImplementation :: [Arg Term] -> ReduceM (Reduced MaybeReducedArgs Term) } deriving (Typeable) defClauses :: Definition -> [Clause] defClauses Defn{theDef = Function{funClauses = cs}} = cs defClauses Defn{theDef = Primitive{primClauses = cs}} = cs defClauses Defn{theDef = Datatype{dataClause = Just c}} = [c] defClauses Defn{theDef = Record{recClause = Just c}} = [c] defClauses _ = [] defCompiled :: Definition -> Maybe CompiledClauses defCompiled Defn{theDef = Function {funCompiled = mcc}} = mcc defCompiled Defn{theDef = Primitive{primCompiled = mcc}} = mcc defCompiled _ = Nothing defJSDef :: Definition -> Maybe JSCode defJSDef = compiledJS . defCompiledRep defEpicDef :: Definition -> Maybe EpicCode defEpicDef = compiledEpic . defCompiledRep -- | Are the clauses of this definition delayed? defDelayed :: Definition -> Delayed defDelayed Defn{theDef = Function{funDelayed = d}} = d defDelayed _ = NotDelayed -- | Has the definition failed the termination checker? defNonterminating :: Definition -> Bool defNonterminating Defn{theDef = Function{funTerminates = Just False}} = True defNonterminating _ = False -- | Is the definition just a copy created by a module instantiation? defCopy :: Definition -> Bool defCopy Defn{theDef = Function{funCopy = b}} = b defCopy _ = False -- | Beware when using this function on a @def@ obtained with @getConstInfo q@! -- If the identifier @q@ is abstract, 'getConstInfo' will turn its @def@ into -- an 'Axiom' and you always get 'ConcreteDef', paradoxically. -- Use it in 'IgnoreAbstractMode', like this: -- @ -- a <- ignoreAbstractMode $ defAbstract <$> getConstInfo q -- @ defAbstract :: Definition -> IsAbstract defAbstract d = case theDef d of Axiom{} -> ConcreteDef Function{funAbstr = a} -> a Datatype{dataAbstr = a} -> a Record{recAbstr = a} -> a Constructor{conAbstr = a} -> a Primitive{primAbstr = a} -> a --------------------------------------------------------------------------- -- ** Injectivity --------------------------------------------------------------------------- type FunctionInverse = FunctionInverse' Clause data FunctionInverse' c = NotInjective | Inverse (Map TermHead c) deriving (Typeable, Show, Functor) data TermHead = SortHead | PiHead | ConsHead QName deriving (Typeable, Eq, Ord, Show) --------------------------------------------------------------------------- -- ** Mutual blocks --------------------------------------------------------------------------- newtype MutualId = MutId Int32 deriving (Typeable, Eq, Ord, Show, Num, Enum) --------------------------------------------------------------------------- -- ** Statistics --------------------------------------------------------------------------- type Statistics = Map String Integer --------------------------------------------------------------------------- -- ** Trace --------------------------------------------------------------------------- data Call = CheckClause Type A.SpineClause | CheckPattern A.Pattern Telescope Type | CheckLetBinding A.LetBinding | InferExpr A.Expr | CheckExprCall A.Expr Type | CheckDotPattern A.Expr Term | CheckPatternShadowing A.SpineClause | IsTypeCall A.Expr Sort | IsType_ A.Expr | InferVar Name | InferDef Range QName | CheckArguments Range [NamedArg A.Expr] Type Type | CheckDataDef Range Name [A.LamBinding] [A.Constructor] | CheckRecDef Range Name [A.LamBinding] [A.Constructor] | CheckConstructor QName Telescope Sort A.Constructor | CheckFunDef Range Name [A.Clause] | CheckPragma Range A.Pragma | CheckPrimitive Range Name A.Expr | CheckIsEmpty Range Type | CheckWithFunctionType A.Expr | CheckSectionApplication Range ModuleName A.ModuleApplication | ScopeCheckExpr C.Expr | ScopeCheckDeclaration D.NiceDeclaration | ScopeCheckLHS C.Name C.Pattern | NoHighlighting | SetRange Range -- ^ used by 'setCurrentRange' deriving (Typeable) instance Pretty Call where pretty CheckClause{} = text "CheckClause" pretty CheckPattern{} = text "CheckPattern" pretty InferExpr{} = text "InferExpr" pretty CheckExprCall{} = text "CheckExprCall" pretty CheckLetBinding{} = text "CheckLetBinding" pretty IsTypeCall{} = text "IsTypeCall" pretty IsType_{} = text "IsType_" pretty InferVar{} = text "InferVar" pretty InferDef{} = text "InferDef" pretty CheckArguments{} = text "CheckArguments" pretty CheckDataDef{} = text "CheckDataDef" pretty CheckRecDef{} = text "CheckRecDef" pretty CheckConstructor{} = text "CheckConstructor" pretty CheckFunDef{} = text "CheckFunDef" pretty CheckPragma{} = text "CheckPragma" pretty CheckPrimitive{} = text "CheckPrimitive" pretty CheckWithFunctionType{} = text "CheckWithFunctionType" pretty ScopeCheckExpr{} = text "ScopeCheckExpr" pretty ScopeCheckDeclaration{} = text "ScopeCheckDeclaration" pretty ScopeCheckLHS{} = text "ScopeCheckLHS" pretty CheckDotPattern{} = text "CheckDotPattern" pretty CheckPatternShadowing{} = text "CheckPatternShadowing" pretty SetRange{} = text "SetRange" pretty CheckSectionApplication{} = text "CheckSectionApplication" pretty CheckIsEmpty{} = text "CheckIsEmpty" pretty NoHighlighting{} = text "NoHighlighting" instance HasRange Call where getRange (CheckClause _ c) = getRange c getRange (CheckPattern p _ _) = getRange p getRange (InferExpr e) = getRange e getRange (CheckExprCall e _) = getRange e getRange (CheckLetBinding b) = getRange b getRange (IsTypeCall e s) = getRange e getRange (IsType_ e) = getRange e getRange (InferVar x) = getRange x getRange (InferDef _ f) = getRange f getRange (CheckArguments r _ _ _) = r getRange (CheckDataDef i _ _ _) = getRange i getRange (CheckRecDef i _ _ _) = getRange i getRange (CheckConstructor _ _ _ c) = getRange c getRange (CheckFunDef i _ _) = getRange i getRange (CheckPragma r _) = r getRange (CheckPrimitive i _ _) = getRange i getRange CheckWithFunctionType{} = noRange getRange (ScopeCheckExpr e) = getRange e getRange (ScopeCheckDeclaration d) = getRange d getRange (ScopeCheckLHS _ p) = getRange p getRange (CheckDotPattern e _) = getRange e getRange (CheckPatternShadowing c) = getRange c getRange (SetRange r) = r getRange (CheckSectionApplication r _ _) = r getRange (CheckIsEmpty r _) = r getRange NoHighlighting = noRange --------------------------------------------------------------------------- -- ** Instance table --------------------------------------------------------------------------- -- | The instance table is a @Map@ associating to every name of -- record/data type/postulate its list of instances type InstanceTable = Map QName [QName] -- | When typechecking something of the following form: -- -- instance -- x : _ -- x = y -- -- it's not yet known where to add @x@, so we add it to a list of -- unresolved instances and we'll deal with it later. type TempInstanceTable = (InstanceTable , [QName]) --------------------------------------------------------------------------- -- ** Builtin things --------------------------------------------------------------------------- data BuiltinDescriptor = BuiltinData (TCM Type) [String] | BuiltinDataCons (TCM Type) | BuiltinPrim String (Term -> TCM ()) | BuiltinPostulate Relevance (TCM Type) | BuiltinUnknown (Maybe (TCM Type)) (Term -> Type -> TCM ()) -- ^ Builtin of any kind. -- Type can be checked (@Just t@) or inferred (@Nothing@). -- The second argument is the hook for the verification function. data BuiltinInfo = BuiltinInfo { builtinName :: String , builtinDesc :: BuiltinDescriptor } type BuiltinThings pf = Map String (Builtin pf) data Builtin pf = Builtin Term | Prim pf deriving (Typeable, Show, Functor, Foldable, Traversable) --------------------------------------------------------------------------- -- * Highlighting levels --------------------------------------------------------------------------- -- | How much highlighting should be sent to the user interface? data HighlightingLevel = None | NonInteractive | Interactive -- ^ This includes both non-interactive highlighting and -- interactive highlighting of the expression that is currently -- being type-checked. deriving (Eq, Ord, Show, Read) -- | How should highlighting be sent to the user interface? data HighlightingMethod = Direct -- ^ Via stdout. | Indirect -- ^ Both via files and via stdout. deriving (Eq, Show, Read) -- | @ifTopLevelAndHighlightingLevelIs l m@ runs @m@ when we're -- type-checking the top-level module and the highlighting level is -- /at least/ @l@. ifTopLevelAndHighlightingLevelIs :: MonadTCM tcm => HighlightingLevel -> tcm () -> tcm () ifTopLevelAndHighlightingLevelIs l m = do e <- ask when (envModuleNestingLevel e == 0 && envHighlightingLevel e >= l) m --------------------------------------------------------------------------- -- * Type checking environment --------------------------------------------------------------------------- data TCEnv = TCEnv { envContext :: Context , envLetBindings :: LetBindings , envCurrentModule :: ModuleName , envCurrentPath :: Maybe AbsolutePath -- ^ The path to the file that is currently being -- type-checked. 'Nothing' if we do not have a file -- (like in interactive mode see @CommandLine@). , envAnonymousModules :: [(ModuleName, Nat)] -- ^ anonymous modules and their number of free variables , envImportPath :: [C.TopLevelModuleName] -- ^ to detect import cycles , envMutualBlock :: Maybe MutualId -- ^ the current (if any) mutual block , envTerminationCheck :: TerminationCheck () -- ^ are we inside the scope of a termination pragma , envSolvingConstraints :: Bool -- ^ Are we currently in the process of solving active constraints? , envAssignMetas :: Bool -- ^ Are we allowed to assign metas? , envActiveProblems :: [ProblemId] , envAbstractMode :: AbstractMode -- ^ When checking the typesignature of a public definition -- or the body of a non-abstract definition this is true. -- To prevent information about abstract things leaking -- outside the module. , envRelevance :: Relevance -- ^ Are we checking an irrelevant argument? (=@Irrelevant@) -- Then top-level irrelevant declarations are enabled. -- Other value: @Relevant@, then only relevant decls. are avail. , envColors :: [Color] , envDisplayFormsEnabled :: Bool -- ^ Sometimes we want to disable display forms. , envReifyInteractionPoints :: Bool -- ^ should we try to recover interaction points when reifying? -- disabled when generating types for with functions , envEtaContractImplicit :: Bool -- ^ it's safe to eta contract implicit lambdas as long as we're -- not going to reify and retypecheck (like when doing with -- abstraction) , envRange :: Range , envHighlightingRange :: Range -- ^ Interactive highlighting uses this range rather -- than 'envRange'. , envCall :: Maybe (Closure Call) -- ^ what we're doing at the moment , envHighlightingLevel :: HighlightingLevel -- ^ Set to 'None' when imported modules are -- type-checked. , envHighlightingMethod :: HighlightingMethod , envModuleNestingLevel :: Integer -- ^ This number indicates how far away from the -- top-level module Agda has come when chasing -- modules. The level of a given module is not -- necessarily the same as the length, in the module -- dependency graph, of the shortest path from the -- top-level module; it depends on in which order -- Agda chooses to chase dependencies. , envAllowDestructiveUpdate :: Bool -- ^ When True, allows destructively shared updating terms -- during evaluation or unification. This is disabled when -- doing speculative checking, like solve instance metas, or -- when updating might break abstraction, as is the case when -- checking abstract definitions. , envExpandLast :: ExpandHidden -- ^ When type-checking an alias f=e, we do not want -- to insert hidden arguments in the end, because -- these will become unsolved metas. , envAppDef :: Maybe QName -- ^ We are reducing an application of this function. -- (For debugging of incomplete matches only.) , envSimplification :: Simplification -- ^ Did we encounter a simplification (proper match) -- during the current reduction process? , envAllowedReductions :: AllowedReductions , envCompareBlocked :: Bool -- ^ Can we compare blocked things during conversion? -- No by default. -- Yes for rewriting feature. , envPrintDomainFreePi :: Bool -- ^ When True types will be omitted from printed pi types if they -- can be inferred , envInsideDotPattern :: Bool -- ^ Used by the scope checker to make sure that certain forms -- of expressions are not used inside dot patterns: extended -- lambdas and let-expressions. , envReifyUnquoted :: Bool -- ^ The rules for translating internal to abstract syntax are -- slightly different when the internal term comes from an -- unquote. } deriving (Typeable) initEnv :: TCEnv initEnv = TCEnv { envContext = [] , envLetBindings = Map.empty , envCurrentModule = noModuleName , envCurrentPath = Nothing , envAnonymousModules = [] , envImportPath = [] , envMutualBlock = Nothing , envTerminationCheck = TerminationCheck , envSolvingConstraints = False , envActiveProblems = [0] , envAssignMetas = True , envAbstractMode = ConcreteMode -- Andreas, 2013-02-21: This was 'AbstractMode' until now. -- However, top-level checks for mutual blocks, such as -- constructor-headedness, should not be able to look into -- abstract definitions unless abstract themselves. -- (See also discussion on issue 796.) -- The initial mode should be 'ConcreteMode', ensuring you -- can only look into abstract things in an abstract -- definition (which sets 'AbstractMode'). , envRelevance = Relevant , envColors = [] , envDisplayFormsEnabled = True , envReifyInteractionPoints = True , envEtaContractImplicit = True , envRange = noRange , envHighlightingRange = noRange , envCall = Nothing , envHighlightingLevel = None , envHighlightingMethod = Indirect , envModuleNestingLevel = -1 , envAllowDestructiveUpdate = True , envExpandLast = ExpandLast , envAppDef = Nothing , envSimplification = NoSimplification , envAllowedReductions = allReductions , envCompareBlocked = False , envPrintDomainFreePi = False , envInsideDotPattern = False , envReifyUnquoted = False } --------------------------------------------------------------------------- -- ** Context --------------------------------------------------------------------------- -- | The @Context@ is a stack of 'ContextEntry's. type Context = [ContextEntry] data ContextEntry = Ctx { ctxId :: CtxId , ctxEntry :: Dom (Name, Type) } deriving (Typeable) newtype CtxId = CtxId Nat deriving (Typeable, Eq, Ord, Show, Enum, Real, Integral, Num) --------------------------------------------------------------------------- -- ** Let bindings --------------------------------------------------------------------------- type LetBindings = Map Name (Open (Term, Dom Type)) --------------------------------------------------------------------------- -- ** Abstract mode --------------------------------------------------------------------------- data AbstractMode = AbstractMode -- ^ Abstract things in the current module can be accessed. | ConcreteMode -- ^ No abstract things can be accessed. | IgnoreAbstractMode -- ^ All abstract things can be accessed. deriving (Typeable, Show) --------------------------------------------------------------------------- -- ** Insertion of implicit arguments --------------------------------------------------------------------------- data ExpandHidden = ExpandLast -- ^ Add implicit arguments in the end until type is no longer hidden 'Pi'. | DontExpandLast -- ^ Do not append implicit arguments. deriving (Eq) data ExpandInstances = ExpandInstanceArguments | DontExpandInstanceArguments deriving (Eq) --------------------------------------------------------------------------- -- * Type checking errors --------------------------------------------------------------------------- -- Occurence of a name in a datatype definition data Occ = OccCon { occDatatype :: QName , occConstructor :: QName , occPosition :: OccPos } | OccClause { occFunction :: QName , occClause :: Int , occPosition :: OccPos } deriving (Show) data OccPos = NonPositively | ArgumentTo Nat QName deriving (Show) -- | Information about a call. data CallInfo = CallInfo { callInfoTarget :: QName -- ^ Target function name. , callInfoRange :: Range -- ^ Range of the target function. , callInfoCall :: Closure Term -- ^ To be formatted representation of the call. } deriving Typeable -- no Eq, Ord instances: too expensive! (see issues 851, 852) -- | We only 'show' the name of the callee. instance Show CallInfo where show = show . callInfoTarget instance Pretty CallInfo where pretty = text . show instance AllNames CallInfo where allNames = singleton . callInfoTarget -- UNUSED, but keep! -- -- | Call pathes are sequences of 'CallInfo's starting from a 'callSource'. -- data CallPath = CallPath -- { callSource :: QName -- -- ^ The originator of the first call. -- , callInfos :: [CallInfo] -- -- ^ The calls, in order from source to final target. -- } -- deriving (Show) -- -- | 'CallPath'es can be connected, but there is no empty callpath. -- -- Thus, they form a semigroup, but we choose to abuse 'Monoid'. -- instance Monoid CallPath where -- mempty = __IMPOSSIBLE__ -- mappend (CallPath src cs) (CallPath _ cs') = CallPath src $ cs ++ cs' -- | Information about a mutual block which did not pass the -- termination checker. data TerminationError = TerminationError { termErrFunctions :: [QName] -- ^ The functions which failed to check. (May not include -- automatically generated functions.) , termErrCalls :: [CallInfo] -- ^ The problematic call sites. } deriving (Typeable, Show) -- | Error when splitting a pattern variable into possible constructor patterns. data SplitError = NotADatatype (Closure Type) -- ^ Neither data type nor record. | IrrelevantDatatype (Closure Type) -- ^ Data type, but in irrelevant position. | CoinductiveDatatype (Closure Type) -- ^ Split on codata not allowed. -- UNUSED, but keep! -- -- | NoRecordConstructor Type -- ^ record type, but no constructor | CantSplit { cantSplitConName :: QName -- ^ Constructor. , cantSplitTel :: Telescope -- ^ Context for indices. , cantSplitConIdx :: Args -- ^ Inferred indices (from type of constructor). , cantSplitGivenIdx :: Args -- ^ Expected indices (from checking pattern). } | GenericSplitError String deriving (Show) instance Error SplitError where strMsg = GenericSplitError data UnquoteError = BadVisibility String (I.Arg I.Term) | ConInsteadOfDef QName String String | DefInsteadOfCon QName String String | NotAConstructor String I.Term -- ^ @NotAConstructor kind term@ | NotALiteral String I.Term | RhsUsesDottedVar [Int] I.Term | BlockedOnMeta MetaId | UnquotePanic String deriving (Show) instance Error UnquoteError where strMsg msg = UnquotePanic msg data TypeError = InternalError String | NotImplemented String | NotSupported String | CompilationError String | TerminationCheckFailed [TerminationError] | PropMustBeSingleton | DataMustEndInSort Term {- UNUSED | DataTooManyParameters -- ^ In @data D xs where@ the number of parameters @xs@ does not fit the -- the parameters given in the forward declaraion @data D Gamma : T@. -} | ShouldEndInApplicationOfTheDatatype Type -- ^ The target of a constructor isn't an application of its -- datatype. The 'Type' records what it does target. | ShouldBeAppliedToTheDatatypeParameters Term Term -- ^ The target of a constructor isn't its datatype applied to -- something that isn't the parameters. First term is the correct -- target and the second term is the actual target. | ShouldBeApplicationOf Type QName -- ^ Expected a type to be an application of a particular datatype. | ConstructorPatternInWrongDatatype QName QName -- ^ constructor, datatype | IndicesNotConstructorApplications [Arg Term] -- ^ Indices. | IndexVariablesNotDistinct [Nat] [Arg Term] -- ^ Variables, indices. | IndicesFreeInParameters [Nat] [Arg Term] [Arg Term] -- ^ Indices (variables), index expressions (with -- constructors applied to reconstructed parameters), -- parameters. | CantResolveOverloadedConstructorsTargetingSameDatatype QName [QName] -- ^ Datatype, constructors. | DoesNotConstructAnElementOf QName Type -- ^ constructor, type | DifferentArities -- ^ Varying number of arguments for a function. | WrongHidingInLHS -- ^ The left hand side of a function definition has a hidden argument -- where a non-hidden was expected. | WrongHidingInLambda Type -- ^ Expected a non-hidden function and found a hidden lambda. | WrongHidingInApplication Type -- ^ A function is applied to a hidden argument where a non-hidden was expected. | WrongNamedArgument (I.NamedArg A.Expr) -- ^ A function is applied to a hidden named argument it does not have. | WrongIrrelevanceInLambda Type -- ^ Expected a relevant function and found an irrelevant lambda. | HidingMismatch Hiding Hiding -- ^ The given hiding does not correspond to the expected hiding. | RelevanceMismatch Relevance Relevance -- ^ The given relevance does not correspond to the expected relevane. | ColorMismatch [Color] [Color] -- ^ The given color does not correspond to the expected color. | NotInductive Term -- ^ The term does not correspond to an inductive data type. | UninstantiatedDotPattern A.Expr | IlltypedPattern A.Pattern Type | IllformedProjectionPattern A.Pattern | CannotEliminateWithPattern (A.NamedArg A.Pattern) Type | TooManyArgumentsInLHS Type | WrongNumberOfConstructorArguments QName Nat Nat | ShouldBeEmpty Type [Pattern] | ShouldBeASort Type -- ^ The given type should have been a sort. | ShouldBePi Type -- ^ The given type should have been a pi. | ShouldBeRecordType Type | ShouldBeRecordPattern Pattern | NotAProjectionPattern (A.NamedArg A.Pattern) | NotAProperTerm | SetOmegaNotValidType | InvalidTypeSort Sort -- ^ This sort is not a type expression. | InvalidType Term -- ^ This term is not a type expression. | FunctionTypeInSizeUniv Term -- ^ This term, a function type constructor, lives in -- @SizeUniv@, which is not allowed. | SplitOnIrrelevant A.Pattern (Dom Type) | DefinitionIsIrrelevant QName | VariableIsIrrelevant Name -- | UnequalLevel Comparison Term Term -- UNUSED | UnequalTerms Comparison Term Term Type | UnequalTypes Comparison Type Type -- | UnequalTelescopes Comparison Telescope Telescope -- UNUSED | UnequalRelevance Comparison Term Term -- ^ The two function types have different relevance. | UnequalHiding Term Term -- ^ The two function types have different hiding. | UnequalColors Term Term -- ^ The two function types have different color. | UnequalSorts Sort Sort | UnequalBecauseOfUniverseConflict Comparison Term Term | HeterogeneousEquality Term Type Term Type -- ^ We ended up with an equality constraint where the terms -- have different types. This is not supported. | NotLeqSort Sort Sort | MetaCannotDependOn MetaId [Nat] Nat -- ^ The arguments are the meta variable, the parameters it can -- depend on and the paratemeter that it wants to depend on. | MetaOccursInItself MetaId | GenericError String | GenericDocError Doc | BuiltinMustBeConstructor String A.Expr | NoSuchBuiltinName String | DuplicateBuiltinBinding String Term Term | NoBindingForBuiltin String | NoSuchPrimitiveFunction String | ShadowedModule C.Name [A.ModuleName] | BuiltinInParameterisedModule String | IllegalLetInTelescope C.TypedBinding | NoRHSRequiresAbsurdPattern [NamedArg A.Pattern] | AbsurdPatternRequiresNoRHS [NamedArg A.Pattern] | TooFewFields QName [C.Name] | TooManyFields QName [C.Name] | DuplicateFields [C.Name] | DuplicateConstructors [C.Name] | WithOnFreeVariable A.Expr | UnexpectedWithPatterns [A.Pattern] | WithClausePatternMismatch A.Pattern Pattern | FieldOutsideRecord | ModuleArityMismatch A.ModuleName Telescope [NamedArg A.Expr] -- Coverage errors -- TODO: Remove some of the constructors in this section, now that -- the SplitError constructor has been added? | IncompletePatternMatching Term [Elim] -- can only happen if coverage checking is switched off | CoverageFailure QName [[Arg Pattern]] | UnreachableClauses QName [[Arg Pattern]] | CoverageCantSplitOn QName Telescope Args Args | CoverageCantSplitIrrelevantType Type | CoverageCantSplitType Type | WithoutKError Type Term Term | SplitError SplitError -- Positivity errors | NotStrictlyPositive QName [Occ] -- Import errors | LocalVsImportedModuleClash ModuleName | UnsolvedMetas [Range] | UnsolvedConstraints Constraints | SolvedButOpenHoles -- ^ Some interaction points (holes) have not be filled by user. -- There are not 'UnsolvedMetas' since unification solved them. -- This is an error, since interaction points are never filled -- without user interaction. | CyclicModuleDependency [C.TopLevelModuleName] | FileNotFound C.TopLevelModuleName [AbsolutePath] | OverlappingProjects AbsolutePath C.TopLevelModuleName C.TopLevelModuleName | AmbiguousTopLevelModuleName C.TopLevelModuleName [AbsolutePath] | ModuleNameDoesntMatchFileName C.TopLevelModuleName [AbsolutePath] | ClashingFileNamesFor ModuleName [AbsolutePath] | ModuleDefinedInOtherFile C.TopLevelModuleName AbsolutePath AbsolutePath -- ^ Module name, file from which it was loaded, file which -- the include path says contains the module. -- Scope errors | BothWithAndRHS | NotInScope [C.QName] | NoSuchModule C.QName | AmbiguousName C.QName [A.QName] | AmbiguousModule C.QName [A.ModuleName] | UninstantiatedModule C.QName | ClashingDefinition C.QName A.QName | ClashingModule A.ModuleName A.ModuleName | ClashingImport C.Name A.QName | ClashingModuleImport C.Name A.ModuleName | PatternShadowsConstructor A.Name A.QName | ModuleDoesntExport C.QName [C.ImportedName] | DuplicateImports C.QName [C.ImportedName] | InvalidPattern C.Pattern | RepeatedVariablesInPattern [C.Name] -- Concrete to Abstract errors | NotAModuleExpr C.Expr -- ^ The expr was used in the right hand side of an implicit module -- definition, but it wasn't of the form @m Delta@. | NotAnExpression C.Expr | NotAValidLetBinding D.NiceDeclaration | NothingAppliedToHiddenArg C.Expr | NothingAppliedToInstanceArg C.Expr -- Pattern synonym errors | BadArgumentsToPatternSynonym A.QName | TooFewArgumentsToPatternSynonym A.QName | UnusedVariableInPatternSynonym -- Operator errors | NoParseForApplication [C.Expr] | AmbiguousParseForApplication [C.Expr] [C.Expr] | NoParseForLHS LHSOrPatSyn C.Pattern | AmbiguousParseForLHS LHSOrPatSyn C.Pattern [C.Pattern] {- UNUSED | NoParseForPatternSynonym C.Pattern | AmbiguousParseForPatternSynonym C.Pattern [C.Pattern] -} -- Usage errors -- Implicit From Scope errors | IFSNoCandidateInScope Type -- Reflection errors | UnquoteFailed UnquoteError -- Safe flag errors | SafeFlagPostulate C.Name | SafeFlagPragma [String] | SafeFlagNoTerminationCheck | SafeFlagNonTerminating | SafeFlagTerminating | SafeFlagPrimTrustMe -- Language option errors | NeedOptionCopatterns | NeedOptionRewriting deriving (Typeable, Show) -- | Distinguish error message when parsing lhs or pattern synonym, resp. data LHSOrPatSyn = IsLHS | IsPatSyn deriving (Eq, Show) -- instance Show TypeError where -- show _ = "" -- TODO: more info? #if !MIN_VERSION_transformers(0,4,1) instance Error TypeError where strMsg = GenericError #endif -- | Type-checking errors. data TCErr = TypeError TCState (Closure TypeError) | Exception Range Doc | IOException Range E.IOException | PatternErr -- TCState -- ^ for pattern violations {- AbortAssign TCState -- ^ used to abort assignment to meta when there are instantiations -- UNUSED -} deriving (Typeable) instance Error TCErr where strMsg = Exception noRange . text . strMsg instance Show TCErr where show (TypeError _ e) = show (envRange $ clEnv e) ++ ": " ++ show (clValue e) show (Exception r d) = show r ++ ": " ++ render d show (IOException r e) = show r ++ ": " ++ show e show PatternErr{} = "Pattern violation (you shouldn't see this)" {- show (AbortAssign _) = "Abort assignment (you shouldn't see this)" -- UNUSED -} instance HasRange TCErr where getRange (TypeError _ cl) = envRange $ clEnv cl getRange (Exception r _) = r getRange (IOException r _) = r getRange PatternErr{} = noRange {- getRange (AbortAssign s) = noRange -- UNUSED -} instance Exception TCErr ----------------------------------------------------------------------------- -- * The reduce monad ----------------------------------------------------------------------------- -- | Environment of the reduce monad. data ReduceEnv = ReduceEnv { redEnv :: TCEnv -- ^ Read only access to environment. , redSt :: TCState -- ^ Read only access to state (signature, metas...). } mapRedEnv :: (TCEnv -> TCEnv) -> ReduceEnv -> ReduceEnv mapRedEnv f s = s { redEnv = f (redEnv s) } mapRedSt :: (TCState -> TCState) -> ReduceEnv -> ReduceEnv mapRedSt f s = s { redSt = f (redSt s) } mapRedEnvSt :: (TCEnv -> TCEnv) -> (TCState -> TCState) -> ReduceEnv -> ReduceEnv mapRedEnvSt f g (ReduceEnv e s) = ReduceEnv (f e) (g s) newtype ReduceM a = ReduceM { unReduceM :: Reader ReduceEnv a } deriving (Functor, Applicative, Monad) runReduceM :: ReduceM a -> TCM a runReduceM m = do e <- ask s <- get return $ runReader (unReduceM m) (ReduceEnv e s) runReduceF :: (a -> ReduceM b) -> TCM (a -> b) runReduceF f = do e <- ask s <- get return $ \x -> runReader (unReduceM (f x)) (ReduceEnv e s) instance MonadReader TCEnv ReduceM where ask = redEnv <$> ReduceM ask local f = ReduceM . local (mapRedEnv f) . unReduceM --------------------------------------------------------------------------- -- * Type checking monad transformer --------------------------------------------------------------------------- newtype TCMT m a = TCM { unTCM :: IORef TCState -> TCEnv -> m a } -- TODO: make dedicated MonadTCEnv and MonadTCState service classes instance MonadIO m => MonadReader TCEnv (TCMT m) where ask = TCM $ \s e -> return e local f (TCM m) = TCM $ \s e -> m s (f e) instance MonadIO m => MonadState TCState (TCMT m) where get = TCM $ \s _ -> liftIO (readIORef s) put s = TCM $ \r _ -> liftIO (writeIORef r s) type TCM = TCMT IO class ( Applicative tcm, MonadIO tcm , MonadReader TCEnv tcm , MonadState TCState tcm ) => MonadTCM tcm where liftTCM :: TCM a -> tcm a instance MonadError TCErr (TCMT IO) where throwError = liftIO . throwIO catchError m h = TCM $ \r e -> do oldState <- liftIO (readIORef r) unTCM m r e `E.catch` \err -> do -- Reset the state, but do not forget changes to the persistent -- component. Not for pattern violations. case err of PatternErr -> return () _ -> liftIO $ do newState <- readIORef r writeIORef r $ oldState { stPersistentState = stPersistentState newState } unTCM (h err) r e -- | Interaction monad. type IM = TCMT (Haskeline.InputT IO) runIM :: IM a -> TCM a runIM = mapTCMT (Haskeline.runInputT Haskeline.defaultSettings) instance MonadError TCErr IM where throwError = liftIO . throwIO catchError m h = mapTCMT liftIO $ runIM m `catchError` (runIM . h) -- | Preserve the state of the failing computation. catchError_ :: TCM a -> (TCErr -> TCM a) -> TCM a catchError_ m h = TCM $ \r e -> unTCM m r e `E.catch` \err -> unTCM (h err) r e -- | Execute a finalizer even when an exception is thrown. -- Does not catch any errors. -- In case both the regular computation and the finalizer -- throw an exception, the one of the finalizer is propagated. finally_ :: TCM a -> TCM b -> TCM a finally_ m f = do x <- m `catchError_` \ err -> f >> throwError err _ <- f return x {-# SPECIALIZE INLINE mapTCMT :: (forall a. IO a -> IO a) -> TCM a -> TCM a #-} mapTCMT :: (forall a. m a -> n a) -> TCMT m a -> TCMT n a mapTCMT f (TCM m) = TCM $ \s e -> f (m s e) pureTCM :: MonadIO m => (TCState -> TCEnv -> a) -> TCMT m a pureTCM f = TCM $ \r e -> do s <- liftIO $ readIORef r return (f s e) {-# RULES "liftTCM/id" liftTCM = id #-} instance MonadIO m => MonadTCM (TCMT m) where liftTCM = mapTCMT liftIO instance MonadTCM tcm => MonadTCM (MaybeT tcm) where liftTCM = lift . liftTCM instance MonadTCM tcm => MonadTCM (ListT tcm) where liftTCM = lift . liftTCM instance (Error err, MonadTCM tcm) => MonadTCM (ExceptT err tcm) where liftTCM = lift . liftTCM instance (Monoid w, MonadTCM tcm) => MonadTCM (WriterT w tcm) where liftTCM = lift . liftTCM {- The following is not possible since MonadTCM needs to be a -- MonadState TCState and a MonadReader TCEnv instance (MonadTCM tcm) => MonadTCM (StateT s tcm) where liftTCM = lift . liftTCM instance (MonadTCM tcm) => MonadTCM (ReaderT r tcm) where liftTCM = lift . liftTCM -} instance MonadTrans TCMT where lift m = TCM $ \_ _ -> m -- We want a special monad implementation of fail. instance MonadIO m => Monad (TCMT m) where return = returnTCMT (>>=) = bindTCMT (>>) = thenTCMT fail = internalError -- One goal of the definitions and pragmas below is to inline the -- monad operations as much as possible. This doesn't seem to have a -- large effect on the performance of the normal executable, but (at -- least on one machine/configuration) it has a massive effect on the -- performance of the profiling executable [1], and reduces the time -- attributed to bind from over 90% to about 25%. -- -- [1] When compiled with -auto-all and run with -p: roughly 750% -- faster for one example. returnTCMT :: MonadIO m => a -> TCMT m a returnTCMT = \x -> TCM $ \_ _ -> return x {-# INLINE returnTCMT #-} bindTCMT :: MonadIO m => TCMT m a -> (a -> TCMT m b) -> TCMT m b bindTCMT = \(TCM m) k -> TCM $ \r e -> m r e >>= \x -> unTCM (k x) r e {-# INLINE bindTCMT #-} thenTCMT :: MonadIO m => TCMT m a -> TCMT m b -> TCMT m b thenTCMT = \(TCM m1) (TCM m2) -> TCM $ \r e -> m1 r e >> m2 r e {-# INLINE thenTCMT #-} instance MonadIO m => Functor (TCMT m) where fmap = fmapTCMT fmapTCMT :: MonadIO m => (a -> b) -> TCMT m a -> TCMT m b fmapTCMT = \f (TCM m) -> TCM $ \r e -> liftM f (m r e) {-# INLINE fmapTCMT #-} instance MonadIO m => Applicative (TCMT m) where pure = returnTCMT (<*>) = apTCMT apTCMT :: MonadIO m => TCMT m (a -> b) -> TCMT m a -> TCMT m b apTCMT = \(TCM mf) (TCM m) -> TCM $ \r e -> ap (mf r e) (m r e) {-# INLINE apTCMT #-} instance MonadIO m => MonadIO (TCMT m) where liftIO m = TCM $ \s e -> do let r = envRange e liftIO $ wrap r $ do x <- m x `seq` return x where wrap r m = failOnException handleException $ E.catch m (handleIOException r) handleIOException r e = throwIO $ IOException r e handleException r s = throwIO $ Exception r s -- | We store benchmark statistics in an IORef. -- This enables benchmarking pure computation, see -- "Agda.Benchmarking". instance MonadBench Phase TCM where getBenchmark = liftIO $ getBenchmark putBenchmark = liftIO . putBenchmark finally = finally_ instance Null (TCM Doc) where empty = return empty null = __IMPOSSIBLE__ -- | Short-cutting disjunction forms a monoid. instance Monoid (TCM Any) where mempty = return mempty ma `mappend` mb = Any <$> do (getAny <$> ma) `or2M` (getAny <$> mb) patternViolation :: TCM a patternViolation = throwError PatternErr internalError :: MonadTCM tcm => String -> tcm a internalError s = typeError $ InternalError s genericError :: MonadTCM tcm => String -> tcm a genericError = typeError . GenericError {-# SPECIALIZE typeError :: TypeError -> TCM a #-} typeError :: MonadTCM tcm => TypeError -> tcm a typeError err = liftTCM $ throwError =<< typeError_ err {-# SPECIALIZE typeError_ :: TypeError -> TCM TCErr #-} typeError_ :: MonadTCM tcm => TypeError -> tcm TCErr typeError_ err = liftTCM $ TypeError <$> get <*> buildClosure err -- | Running the type checking monad (most general form). {-# SPECIALIZE runTCM :: TCEnv -> TCState -> TCM a -> IO (a, TCState) #-} runTCM :: MonadIO m => TCEnv -> TCState -> TCMT m a -> m (a, TCState) runTCM e s m = do r <- liftIO $ newIORef s a <- unTCM m r e s <- liftIO $ readIORef r return (a, s) -- | Running the type checking monad on toplevel (with initial state). runTCMTop :: TCM a -> IO (Either TCErr a) runTCMTop m = (Right <$> runTCMTop' m) `E.catch` (return . Left) runTCMTop' :: MonadIO m => TCMT m a -> m a runTCMTop' m = do r <- liftIO $ newIORef initState unTCM m r initEnv -- | 'runSafeTCM' runs a safe 'TCM' action (a 'TCM' action which cannot fail) -- in the initial environment. runSafeTCM :: TCM a -> TCState -> IO (a, TCState) runSafeTCM m st = runTCM initEnv st m `E.catch` (\ (e :: TCErr) -> __IMPOSSIBLE__) -- runSafeTCM m st = either__IMPOSSIBLE__ return <$> do -- -- Errors must be impossible. -- runTCM $ do -- put st -- a <- m -- st <- get -- return (a, st) -- | Runs the given computation in a separate thread, with /a copy/ of -- the current state and environment. -- -- Note that Agda sometimes uses actual, mutable state. If the -- computation given to @forkTCM@ tries to /modify/ this state, then -- bad things can happen, because accesses are not mutually exclusive. -- The @forkTCM@ function has been added mainly to allow the thread to -- /read/ (a snapshot of) the current state in a convenient way. -- -- Note also that exceptions which are raised in the thread are not -- propagated to the parent, so the thread should not do anything -- important. forkTCM :: TCM a -> TCM () forkTCM m = do s <- get e <- ask liftIO $ void $ C.forkIO $ void $ runTCM e s m -- | Base name for extended lambda patterns extendedLambdaName :: String extendedLambdaName = ".extendedlambda" -- | Name of absurdLambda definitions. absurdLambdaName :: String absurdLambdaName = ".absurdlambda" -- | Check whether we have an definition from an absurd lambda. isAbsurdLambdaName :: QName -> Bool isAbsurdLambdaName = (absurdLambdaName ==) . prettyShow . qnameName --------------------------------------------------------------------------- -- * KillRange instances --------------------------------------------------------------------------- instance KillRange Signature where killRange (Sig secs defs rews) = killRange2 Sig secs defs rews instance KillRange Sections where killRange = fmap killRange instance KillRange Definitions where killRange = fmap killRange instance KillRange RewriteRuleMap where killRange = fmap killRange instance KillRange Section where killRange (Section tel) = killRange1 Section tel instance KillRange Definition where killRange (Defn ai name t pols occs displ mut compiled inst def) = killRange10 Defn ai name t pols occs displ mut compiled inst def -- TODO clarify: Keep the range in the defName field? instance KillRange NLPat where killRange (PVar x) = killRange1 PVar x killRange (PWild) = PWild killRange (PDef x y) = killRange2 PDef x y killRange (PLam x y) = killRange2 PLam x y killRange (PPi x y) = killRange2 PPi x y killRange (PBoundVar x y) = killRange2 PBoundVar x y killRange (PTerm x) = killRange1 PTerm x instance KillRange RewriteRule where killRange (RewriteRule q gamma lhs rhs t) = killRange5 RewriteRule q gamma lhs rhs t instance KillRange CompiledRepresentation where killRange = id instance KillRange ExtLamInfo where killRange = id instance KillRange Defn where killRange def = case def of Axiom -> Axiom Function cls comp inv mut isAbs delayed proj static copy term extlam with cop -> killRange13 Function cls comp inv mut isAbs delayed proj static copy term extlam with cop Datatype a b c d e f g h i j -> killRange10 Datatype a b c d e f g h i j Record a b c d e f g h i j k l -> killRange12 Record a b c d e f g h i j k l Constructor a b c d e -> killRange5 Constructor a b c d e Primitive a b c d -> killRange4 Primitive a b c d instance KillRange MutualId where killRange = id instance KillRange c => KillRange (FunctionInverse' c) where killRange NotInjective = NotInjective killRange (Inverse m) = Inverse $ killRangeMap m instance KillRange TermHead where killRange SortHead = SortHead killRange PiHead = PiHead killRange (ConsHead q) = ConsHead $ killRange q instance KillRange Projection where killRange (Projection a b c d e) = killRange4 Projection a b c d e instance KillRange a => KillRange (Open a) where killRange = fmap killRange instance KillRange DisplayForm where killRange (Display n vs dt) = killRange3 Display n vs dt instance KillRange Polarity where killRange = id instance KillRange DisplayTerm where killRange dt = case dt of DWithApp dt dts args -> killRange3 DWithApp dt dts args DCon q dts -> killRange2 DCon q dts DDef q dts -> killRange2 DDef q dts DDot v -> killRange1 DDot v DTerm v -> killRange1 DTerm v Agda-2.4.2.5/src/full/Agda/TypeChecking/Monad/Statistics.hs0000644000000000000000000000477112635075266021417 0ustar0000000000000000-- | Collect statistics. module Agda.TypeChecking.Monad.Statistics ( tick, tickN, tickMax, getStatistics, modifyStatistics, printStatistics ) where import Control.Monad.State import Data.Map (Map) import qualified Data.Map as Map import qualified Text.PrettyPrint.Boxes as Boxes import Agda.Syntax.Concrete.Name as C import Agda.TypeChecking.Monad.Base import Agda.TypeChecking.Monad.Options import Agda.TypeChecking.Monad.State import Agda.Utils.Lens import Agda.Utils.Maybe import Agda.Utils.Null import Agda.Utils.Pretty import Agda.Utils.String -- | Get the statistics. getStatistics :: TCM Statistics getStatistics = use stStatistics -- | Modify the statistics via given function. modifyStatistics :: (Statistics -> Statistics) -> TCM () modifyStatistics f = stStatistics %= f -- | Increase specified counter by @1@. tick :: String -> TCM () tick x = tickN x 1 -- | Increase specified counter by @n@. tickN :: String -> Integer -> TCM () tickN s n = modifyCounter s (n +) -- | Set the specified counter to the maximum of its current value and @n@. tickMax :: String -> Integer -> TCM () tickMax s n = modifyCounter s (max n) -- | Modify specified counter by a function @f@. modifyCounter :: String -> (Integer -> Integer) -> TCM () modifyCounter x f = modifyStatistics $ force . update where -- We need to be strict in the map. -- Andreas, 2014-03-22: Could we take Data.Map.Strict instead of this hack? -- Or force the map by looking up the very element we inserted? -- force m = Map.lookup x m `seq` m -- Or use insertLookupWithKey? -- update m = old `seq` m' where -- (old, m') = Map.insertLookupWithKey (\ _ new old -> f old) x dummy m force m = sum (Map.elems m) `seq` m update = Map.insertWith (\ new old -> f old) x dummy dummy = f 0 -- | Print the given statistics if verbosity "profile" is given. printStatistics :: Int -> Maybe C.TopLevelModuleName -> Statistics -> TCM () printStatistics vl mmname stats = verboseS "profile" vl $ do unlessNull (Map.toList stats) $ \ stats -> do let -- First column (left aligned) is accounts. col1 = Boxes.vcat Boxes.left $ map (Boxes.text . fst) stats -- Second column (right aligned) is numbers. col2 = Boxes.vcat Boxes.right $ map (Boxes.text . showThousandSep . snd) stats table = Boxes.hsep 1 Boxes.left [col1, col2] reportSLn "profile" 1 $ caseMaybe mmname "Accumlated statistics" $ \ mname -> "Statistics for " ++ prettyShow mname reportSLn "profile" 1 $ Boxes.render table Agda-2.4.2.5/src/full/Agda/TypeChecking/Monad/Trace.hs0000644000000000000000000001073412635075266020317 0ustar0000000000000000{-# LANGUAGE CPP #-} module Agda.TypeChecking.Monad.Trace where import Prelude hiding (null) import Control.Monad.Reader import {-# SOURCE #-} Agda.Interaction.Highlighting.Generate (highlightAsTypeChecked) import Agda.Syntax.Position import Agda.TypeChecking.Monad.Base import Agda.TypeChecking.Monad.Options import Agda.Utils.Function import Agda.Utils.List import Agda.Utils.Maybe import Agda.Utils.Monad import Agda.Utils.Null import Agda.Utils.Pretty (prettyShow) #include "undefined.h" import Agda.Utils.Impossible --------------------------------------------------------------------------- -- * Trace --------------------------------------------------------------------------- interestingCall :: Closure Call -> Bool interestingCall cl = case clValue cl of InferVar{} -> False InferDef{} -> False CheckArguments _ [] _ _ -> False SetRange{} -> False NoHighlighting{} -> False _ -> True traceCallM :: MonadTCM tcm => tcm Call -> tcm a -> tcm a traceCallM mkCall m = flip traceCall m =<< mkCall -- | Record a function call in the trace. {-# SPECIALIZE traceCall :: Call -> TCM a -> TCM a #-} traceCall :: MonadTCM tcm => Call -> tcm a -> tcm a traceCall mkCall m = do let call = mkCall callRange = getRange call -- Andreas, 2015-02-09 Make sure we do not set a range -- outside the current file unlessNull callRange $ \ (Range is) -> unlessNull (mapMaybe srcFile $ map iStart is ++ map iEnd is) $ \ files -> do whenJustM (asks envCurrentPath) $ \ currentFile -> do unlessNull (filter (/= currentFile) files) $ \ wrongFiles -> do reportSLn "impossible" 10 $ prettyShow call ++ " is trying to set the current range to " ++ show callRange ++ " which is outside of the current file " ++ show currentFile __IMPOSSIBLE__ cl <- liftTCM $ buildClosure call let trace = local $ foldr (.) id $ [ \e -> e { envCall = Just cl } | interestingCall cl ] ++ [ \e -> e { envHighlightingRange = callRange } | callRange /= noRange && highlightCall call || isNoHighlighting call ] ++ [ \e -> e { envRange = callRange } | callRange /= noRange ] wrap <- ifM (do l <- envHighlightingLevel <$> ask return (l == Interactive && highlightCall call)) (do oldRange <- envHighlightingRange <$> ask return $ highlightAsTypeChecked oldRange callRange) (return id) wrap $ trace m where -- | Should the given call trigger interactive highlighting? highlightCall call = case call of CheckClause{} -> True CheckPattern{} -> True CheckLetBinding{} -> True InferExpr{} -> True CheckExprCall{} -> True CheckDotPattern{} -> True CheckPatternShadowing{} -> True IsTypeCall{} -> True IsType_{} -> True InferVar{} -> True InferDef{} -> True CheckArguments{} -> True CheckDataDef{} -> True CheckRecDef{} -> True CheckConstructor{} -> True CheckFunDef{} -> True CheckPragma{} -> True CheckPrimitive{} -> True CheckIsEmpty{} -> True CheckWithFunctionType{} -> True CheckSectionApplication{} -> True ScopeCheckExpr{} -> False ScopeCheckDeclaration{} -> False ScopeCheckLHS{} -> False NoHighlighting{} -> True SetRange{} -> False isNoHighlighting NoHighlighting{} = True isNoHighlighting _ = False {-# SPECIALIZE traceCallCPS :: Call -> (r -> TCM a) -> ((r -> TCM a) -> TCM b) -> TCM b #-} traceCallCPS :: MonadTCM tcm => Call -> (r -> tcm a) -> ((r -> tcm a) -> tcm b) -> tcm b traceCallCPS mkCall ret cc = traceCall mkCall (cc ret) {-# SPECIALIZE traceCallCPS_ :: Call -> TCM a -> (TCM a -> TCM b) -> TCM b #-} traceCallCPS_ :: MonadTCM tcm => Call -> tcm a -> (tcm a -> tcm b) -> tcm b traceCallCPS_ mkCall ret cc = traceCallCPS mkCall (const ret) (\k -> cc $ k ()) getCurrentRange :: TCM Range getCurrentRange = asks envRange -- | Sets the current range (for error messages etc.) to the range -- of the given object, if it has a range (i.e., its range is not 'noRange'). setCurrentRange :: HasRange x => x -> TCM a -> TCM a setCurrentRange x = applyUnless (null r) $ traceCall $ SetRange r where r = getRange x Agda-2.4.2.5/src/full/Agda/TypeChecking/Monad/Signature.hs0000644000000000000000000010076212635075266021223 0ustar0000000000000000{-# LANGUAGE CPP #-} {-# LANGUAGE DoAndIfThenElse #-} {-# LANGUAGE FlexibleContexts #-} {-# LANGUAGE FlexibleInstances #-} {-# LANGUAGE PatternGuards #-} module Agda.TypeChecking.Monad.Signature where import Prelude hiding (null) import Control.Arrow (first, second, (***)) import Control.Applicative hiding (empty) import Control.Monad.State import Control.Monad.Reader import Data.List hiding (null) import Data.Map (Map) import qualified Data.Map as Map import Data.Maybe import Data.Monoid import Agda.Syntax.Abstract.Name import Agda.Syntax.Abstract (Ren) import Agda.Syntax.Common import Agda.Syntax.Internal as I import Agda.Syntax.Position import qualified Agda.Compiler.JS.Parser as JS import Agda.TypeChecking.Monad.Base import Agda.TypeChecking.Monad.Context import Agda.TypeChecking.Monad.Options import Agda.TypeChecking.Monad.Env import Agda.TypeChecking.Monad.Exception ( ExceptionT ) import Agda.TypeChecking.Monad.Mutual import Agda.TypeChecking.Monad.Open import Agda.TypeChecking.Monad.State import Agda.TypeChecking.Positivity.Occurrence import Agda.TypeChecking.Substitute import {-# SOURCE #-} Agda.TypeChecking.CompiledClause.Compile import {-# SOURCE #-} Agda.TypeChecking.Polarity import {-# SOURCE #-} Agda.TypeChecking.ProjectionLike import Agda.Utils.Except ( Error ) import Agda.Utils.Functor import Agda.Utils.Lens import Agda.Utils.List import Agda.Utils.Map as Map import Agda.Utils.Maybe import Agda.Utils.Monad import Agda.Utils.Null import Agda.Utils.Permutation import Agda.Utils.Pretty import Agda.Utils.Size import qualified Agda.Utils.HashMap as HMap #include "undefined.h" import Agda.Utils.Impossible -- | Add a constant to the signature. Lifts the definition to top level. addConstant :: QName -> Definition -> TCM () addConstant q d = do reportSLn "tc.signature" 20 $ "adding constant " ++ show q ++ " to signature" tel <- getContextTelescope let tel' = replaceEmptyName "r" $ killRange $ case theDef d of Constructor{} -> fmap (setHiding Hidden) tel _ -> tel let d' = abstract tel' $ d { defName = q } reportSLn "tc.signature" 30 $ "lambda-lifted definition = " ++ show d' modifySignature $ updateDefinitions $ HMap.insertWith (+++) q d' i <- currentOrFreshMutualBlock setMutualBlock i q where new +++ old = new { defDisplay = defDisplay new ++ defDisplay old , defInstance = defInstance new `mplus` defInstance old } -- | Set termination info of a defined function symbol. setTerminates :: QName -> Bool -> TCM () setTerminates q b = modifySignature $ updateDefinition q $ updateTheDef $ setT where setT def@Function{} = def { funTerminates = Just b } setT def = def -- | Modify the clauses of a function. modifyFunClauses :: QName -> ([Clause] -> [Clause]) -> TCM () modifyFunClauses q f = modifySignature $ updateDefinition q $ updateTheDef $ updateFunClauses f -- | Lifts clauses to the top-level and adds them to definition. addClauses :: QName -> [Clause] -> TCM () addClauses q cls = do tel <- getContextTelescope modifyFunClauses q (++ abstract tel cls) addHaskellCode :: QName -> HaskellType -> HaskellCode -> TCM () addHaskellCode q hsTy hsDef = modifySignature $ updateDefinition q $ updateDefCompiledRep $ addHs -- TODO: sanity checking where addHs crep = crep { compiledHaskell = Just $ HsDefn hsTy hsDef } addHaskellExport :: QName -> HaskellType -> String -> TCM () addHaskellExport q hsTy hsName = modifySignature $ updateDefinition q $ updateDefCompiledRep $ addHs -- TODO: sanity checking where addHs crep = crep { exportHaskell = Just (HsExport hsTy hsName)} addHaskellType :: QName -> HaskellType -> TCM () addHaskellType q hsTy = modifySignature $ updateDefinition q $ updateDefCompiledRep $ addHs -- TODO: sanity checking where addHs crep = crep { compiledHaskell = Just $ HsType hsTy } addEpicCode :: QName -> EpicCode -> TCM () addEpicCode q epDef = modifySignature $ updateDefinition q $ updateDefCompiledRep $ addEp -- TODO: sanity checking where addEp crep = crep { compiledEpic = Just epDef } addJSCode :: QName -> String -> TCM () addJSCode q jsDef = case JS.parse jsDef of Left e -> modifySignature $ updateDefinition q $ updateDefCompiledRep $ addJS (Just e) Right s -> typeError (CompilationError ("Failed to parse ECMAScript (..." ++ s ++ ") for " ++ show q)) where addJS e crep = crep { compiledJS = e } markStatic :: QName -> TCM () markStatic q = modifySignature $ updateDefinition q $ mark where mark def@Defn{theDef = fun@Function{}} = def{theDef = fun{funStatic = True}} mark def = def unionSignatures :: [Signature] -> Signature unionSignatures ss = foldr unionSignature emptySignature ss where unionSignature (Sig a b c) (Sig a' b' c') = Sig (Map.union a a') (HMap.union b b') -- definitions are unique (in at most one module) (HMap.unionWith mappend c c') -- rewrite rules are accumulated -- | Add a section to the signature. -- -- The current context will be stored as the cumulative module parameters -- for this section. addSection :: ModuleName -> TCM () addSection m = do tel <- getContextTelescope let sec = Section tel -- Make sure we do not overwrite an existing section! whenJustM (getSection m) $ \ sec' -> do -- At least not with different content! if (sec == sec') then do -- Andreas, 2015-12-02: test/Succeed/Issue1701II.agda -- reports a "redundantly adding existing section". reportSLn "tc.section" 10 $ "warning: redundantly adding existing section " ++ show m reportSLn "tc.section" 60 $ "with content " ++ show sec else do reportSLn "impossible" 10 $ "overwriting existing section " ++ show m reportSLn "impossible" 60 $ "of content " ++ show sec' reportSLn "impossible" 60 $ "with content " ++ show sec __IMPOSSIBLE__ -- Add the new section. modifySignature $ over sigSections $ Map.insert m sec -- | Lookup a section. If it doesn't exist that just means that the module -- wasn't parameterised. lookupSection :: ModuleName -> TCM Telescope lookupSection m = do sig <- use $ stSignature . sigSections isig <- use $ stImports . sigSections return $ maybe EmptyTel (^. secTelescope) $ Map.lookup m sig `mplus` Map.lookup m isig -- Add display forms to all names @xn@ such that @x = x1 es1@, ... @xn-1 = xn esn@. addDisplayForms :: QName -> TCM () addDisplayForms x = do def <- getConstInfo x args <- getContextArgs add (drop (projectionArgs $ theDef def) args) x x [] where add args top x vs0 = do def <- getConstInfo x let cs = defClauses def isCopy = defCopy def case cs of [ Clause{ namedClausePats = pats, clauseBody = b } ] | isCopy , all (isVar . namedArg) pats , Just (m, Def y es) <- strip (b `apply` vs0) , Just vs <- mapM isApplyElim es -> do let ps = raise 1 $ map unArg vs df = Display 0 ps $ DTerm $ Def top $ map Apply args reportSLn "tc.display.section" 20 $ "adding display form " ++ show y ++ " --> " ++ show top ++ "\n " ++ show df addDisplayForm y df add args top y vs _ -> do let reason = if not isCopy then "not a copy" else case cs of [] -> "no clauses" _:_:_ -> "many clauses" [ Clause{ clauseBody = b } ] -> case strip b of Nothing -> "bad body" Just (m, Def y es) | m < length args -> "too few args" | m > length args -> "too many args" | otherwise -> "args=" ++ show args ++ " es=" ++ show es Just (m, v) -> "not a def body" reportSLn "tc.display.section" 30 $ "no display form from " ++ show x ++ " because " ++ reason strip (Body v) = return (0, unSpine v) strip NoBody = Nothing strip (Bind b) = do (n, v) <- strip $ absBody b return (n + 1, ignoreSharing v) isVar VarP{} = True isVar _ = False -- | Module application (followed by module parameter abstraction). applySection :: ModuleName -- ^ Name of new module defined by the module macro. -> Telescope -- ^ Parameters of new module. -> ModuleName -- ^ Name of old module applied to arguments. -> Args -- ^ Arguments of module application. -> Ren QName -- ^ Imported names (given as renaming). -> Ren ModuleName -- ^ Imported modules (given as renaming). -> TCM () applySection new ptel old ts rd rm = do applySection' new ptel old ts rd rm applySection' :: ModuleName -> Telescope -> ModuleName -> Args -> Ren QName -> Ren ModuleName -> TCM () applySection' new ptel old ts rd rm = do reportSLn "tc.mod.apply" 10 $ render $ vcat [ text "applySection" , text "new =" <+> text (show new) , text "ptel =" <+> text (show ptel) , text "old =" <+> text (show old) , text "ts =" <+> text (show ts) ] reportSLn "tc.mod.apply" 80 $ render $ vcat [ text "arguments: " <+> text (show ts) ] mapM_ (copyDef ts) rd mapM_ (copySec ts) rm mapM_ computePolarity (map snd rd) where -- Andreas, 2013-10-29 -- Here, if the name x is not imported, it persists as -- old, possibly out-of-scope name. -- This old name may used by the case split tactic, leading to -- names that cannot be printed properly. -- I guess it would make sense to mark non-imported names -- as such (out-of-scope) and let splitting fail if it would -- produce out-of-scope constructors. copyName x = fromMaybe x $ lookup x rd argsToUse x = do let m = commonParentModule old x reportSLn "tc.mod.apply" 80 $ "Common prefix: " ++ show m size <$> lookupSection m copyDef :: Args -> (QName, QName) -> TCM () copyDef ts (x, y) = do def <- getConstInfo x np <- argsToUse (qnameModule x) copyDef' np def where copyDef' np d = do reportSLn "tc.mod.apply" 60 $ "making new def for " ++ show y ++ " from " ++ show x ++ " with " ++ show np ++ " args " ++ show abstr reportSLn "tc.mod.apply" 80 $ "args = " ++ show ts' ++ "\n" ++ "old type = " ++ prettyShow (defType d) ++ "\n" ++ "new type = " ++ prettyShow t addConstant y =<< nd y makeProjection y -- Issue1238: the copied def should be an 'instance' if the original -- def is one. Skip constructors since the original constructor will -- still work as an instance. unless isCon $ whenJust inst $ \ c -> addNamedInstance y c -- Set display form for the old name if it's not a constructor. {- BREAKS fail/Issue478 -- Andreas, 2012-10-20 and if we are not an anonymous module -- unless (isAnonymousModuleName new || isCon || size ptel > 0) $ do -} -- BREAKS fail/Issue1643a -- -- Andreas, 2015-09-09 Issue 1643: -- -- Do not add a display form for a bare module alias. -- when (not isCon && size ptel == 0 && not (null ts)) $ do when (not isCon && size ptel == 0) $ do addDisplayForms y where ts' = take np ts t = defType d `apply` ts' pol = defPolarity d `apply` ts' occ = defArgOccurrences d `apply` ts' inst = defInstance d abstr = defAbstract d -- the name is set by the addConstant function nd :: QName -> TCM Definition nd y = Defn (defArgInfo d) y t pol occ [] (-1) noCompiledRep inst <$> def -- TODO: mutual block? oldDef = theDef d isCon = case oldDef of { Constructor{} -> True ; _ -> False } mutual = case oldDef of { Function{funMutual = m} -> m ; _ -> [] } extlam = case oldDef of { Function{funExtLam = e} -> e ; _ -> Nothing } with = case oldDef of { Function{funWith = w} -> copyName <$> w ; _ -> Nothing } -- Andreas, 2015-05-11, to fix issue 1413: -- Even if we apply the record argument (must be @var 0@), we stay a projection. -- This is because we may abstract the record argument later again. -- See succeed/ProjectionNotNormalized.agda isVar0 t = case ignoreSharing $ unArg t of Var 0 [] -> True; _ -> False proj = case oldDef of Function{funProjection = Just p@Projection{projIndex = n}} | size ts < n || (size ts == n && isVar0 (last ts)) -> Just $ p { projIndex = n - size ts , projDropPars = projDropPars p `apply` ts } _ -> Nothing def = case oldDef of Constructor{ conPars = np, conData = d } -> return $ oldDef { conPars = np - size ts' , conData = copyName d } Datatype{ dataPars = np, dataCons = cs } -> return $ oldDef { dataPars = np - size ts' , dataClause = Just cl , dataCons = map copyName cs } Record{ recPars = np, recConType = t, recTel = tel } -> return $ oldDef { recPars = np - size ts' , recClause = Just cl , recConType = apply t ts' , recTel = apply tel ts' } _ -> do cc <- compileClauses Nothing [cl] -- Andreas, 2012-10-07 non need for record pattern translation let newDef = Function { funClauses = [cl] , funCompiled = Just $ cc , funDelayed = NotDelayed , funInv = NotInjective , funMutual = mutual , funAbstr = ConcreteDef -- OR: abstr -- ?! , funProjection = proj , funStatic = False , funCopy = True , funTerminates = Just True , funExtLam = extlam , funWith = with , funCopatternLHS = isCopatternLHS [cl] } reportSLn "tc.mod.apply" 80 $ "new def for " ++ show x ++ "\n " ++ show newDef return newDef head = case oldDef of Function{funProjection = Just Projection{ projDropPars = f}} -> f _ -> Def x [] cl = Clause { clauseRange = getRange $ defClauses d , clauseTel = EmptyTel , clausePerm = idP 0 , namedClausePats = [] , clauseBody = Body $ head `apply` ts' , clauseType = Just $ defaultArg t } {- Example module Top Θ where module A Γ where module M Φ where module B Δ where module N Ψ where module O Ψ' where open A public -- introduces only M --> A.M into the *scope* module C Ξ = Top.B ts new section C tel = Ξ.(Θ.Δ)[ts] calls 1. copySec ts (Top.A.M, C.M) 2. copySec ts (Top.B.N, C.N) 3. copySec ts (Top.B.N.O, C.N.O) with old = Top.B For 1. Common prefix is: Top totalArgs = |Θ| (section Top) tel = Θ.Γ.Φ (section Top.A.M) ts' = take totalArgs ts Θ₂ = drop totalArgs Θ new section C.M tel = Θ₂.Γ.Φ[ts'] -} copySec :: Args -> (ModuleName, ModuleName) -> TCM () copySec ts (x, y) = do totalArgs <- argsToUse x tel <- lookupSection x let sectionTel = apply tel $ take totalArgs ts reportSLn "tc.mod.apply" 80 $ "Copying section " ++ show x ++ " to " ++ show y reportSLn "tc.mod.apply" 80 $ " ts = " ++ intercalate "; " (map prettyShow ts) reportSLn "tc.mod.apply" 80 $ " totalArgs = " ++ show totalArgs reportSLn "tc.mod.apply" 80 $ " tel = " ++ intercalate " " (map (fst . unDom) $ telToList tel) -- only names reportSLn "tc.mod.apply" 80 $ " sectionTel = " ++ intercalate " " (map (fst . unDom) $ telToList ptel) -- only names addCtxTel sectionTel $ addSection y -- | Add a display form to a definition (could be in this or imported signature). addDisplayForm :: QName -> DisplayForm -> TCM () addDisplayForm x df = do d <- makeOpen df let add = updateDefinition x $ \ def -> def{ defDisplay = d : defDisplay def } modifyImportedSignature add modifySignature add canonicalName :: QName -> TCM QName canonicalName x = do def <- theDef <$> getConstInfo x case def of Constructor{conSrcCon = c} -> return $ conName c Record{recClause = Just (Clause{ clauseBody = body })} -> canonicalName $ extract body Datatype{dataClause = Just (Clause{ clauseBody = body })} -> canonicalName $ extract body _ -> return x where extract NoBody = __IMPOSSIBLE__ extract (Body (Def x _)) = x extract (Body (Shared p)) = extract (Body $ derefPtr p) extract (Body _) = __IMPOSSIBLE__ extract (Bind b) = extract (unAbs b) sameDef :: QName -> QName -> TCM (Maybe QName) sameDef d1 d2 = do c1 <- canonicalName d1 c2 <- canonicalName d2 if (c1 == c2) then return $ Just c1 else return Nothing -- | Can be called on either a (co)datatype, a record type or a -- (co)constructor. whatInduction :: QName -> TCM Induction whatInduction c = do def <- theDef <$> getConstInfo c case def of Datatype{ dataInduction = i } -> return i Record{ recRecursive = False} -> return Inductive Record{ recInduction = i } -> return $ fromMaybe Inductive i Constructor{ conInd = i } -> return i _ -> __IMPOSSIBLE__ -- | Does the given constructor come from a single-constructor type? -- -- Precondition: The name has to refer to a constructor. singleConstructorType :: QName -> TCM Bool singleConstructorType q = do d <- theDef <$> getConstInfo q case d of Record {} -> return True Constructor { conData = d } -> do di <- theDef <$> getConstInfo d return $ case di of Record {} -> True Datatype { dataCons = cs } -> length cs == 1 _ -> __IMPOSSIBLE__ _ -> __IMPOSSIBLE__ class (Functor m, Applicative m, Monad m) => HasConstInfo m where -- | Lookup the definition of a name. The result is a closed thing, all free -- variables have been abstracted over. getConstInfo :: QName -> m Definition -- | Lookup the rewrite rules with the given head symbol. getRewriteRulesFor :: QName -> m RewriteRules {-# SPECIALIZE getConstInfo :: QName -> TCM Definition #-} defaultGetRewriteRulesFor :: (Monad m) => m TCState -> QName -> m RewriteRules defaultGetRewriteRulesFor getTCState q = do st <- getTCState let sig = st^.stSignature imp = st^.stImports look s = HMap.lookup q $ s ^. sigRewriteRules return $ mconcat $ catMaybes [look sig, look imp] instance HasConstInfo (TCMT IO) where getRewriteRulesFor = defaultGetRewriteRulesFor get getConstInfo q = join $ pureTCM $ \st env -> let defs = st^.(stSignature . sigDefinitions) idefs = st^.(stImports . sigDefinitions) in case catMaybes [HMap.lookup q defs, HMap.lookup q idefs] of [] -> fail $ "Unbound name: " ++ show q ++ " " ++ showQNameId q [d] -> mkAbs env d ds -> fail $ "Ambiguous name: " ++ show q where mkAbs env d | treatAbstractly' q' env = case makeAbstract d of Just d -> return d Nothing -> notInScope $ qnameToConcrete q -- the above can happen since the scope checker is a bit sloppy with 'abstract' | otherwise = return d where q' = case theDef d of -- Hack to make abstract constructors work properly. The constructors -- live in a module with the same name as the datatype, but for 'abstract' -- purposes they're considered to be in the same module as the datatype. Constructor{} -> dropLastModule q _ -> q dropLastModule q@QName{ qnameModule = m } = q{ qnameModule = mnameFromList $ ifNull (mnameToList m) __IMPOSSIBLE__ init } instance (HasConstInfo m, Error err) => HasConstInfo (ExceptionT err m) where getConstInfo = lift . getConstInfo getRewriteRulesFor = lift . getRewriteRulesFor {-# INLINE getConInfo #-} getConInfo :: MonadTCM tcm => ConHead -> tcm Definition getConInfo = liftTCM . getConstInfo . conName -- | Look up the polarity of a definition. getPolarity :: QName -> TCM [Polarity] getPolarity q = defPolarity <$> getConstInfo q -- | Look up polarity of a definition and compose with polarity -- represented by 'Comparison'. getPolarity' :: Comparison -> QName -> TCM [Polarity] getPolarity' CmpEq q = map (composePol Invariant) <$> getPolarity q -- return [] getPolarity' CmpLeq q = getPolarity q -- composition with Covariant is identity -- | Set the polarity of a definition. setPolarity :: QName -> [Polarity] -> TCM () setPolarity q pol = modifySignature $ updateDefinition q $ updateDefPolarity $ const pol -- | Get argument occurrence info for argument @i@ of definition @d@ (never fails). getArgOccurrence :: QName -> Nat -> TCM Occurrence getArgOccurrence d i = do def <- getConstInfo d return $ case theDef def of Constructor{} -> StrictPos _ -> fromMaybe Mixed $ defArgOccurrences def !!! i setArgOccurrences :: QName -> [Occurrence] -> TCM () setArgOccurrences d os = modifyArgOccurrences d $ const os modifyArgOccurrences :: QName -> ([Occurrence] -> [Occurrence]) -> TCM () modifyArgOccurrences d f = modifySignature $ updateDefinition d $ updateDefArgOccurrences f -- | Get the mutually recursive identifiers. getMutual :: QName -> TCM [QName] getMutual d = do def <- theDef <$> getConstInfo d return $ case def of Function { funMutual = m } -> m Datatype { dataMutual = m } -> m Record { recMutual = m } -> m _ -> [] -- | Set the mutually recursive identifiers. setMutual :: QName -> [QName] -> TCM () setMutual d m = modifySignature $ updateDefinition d $ updateTheDef $ \ def -> case def of Function{} -> def { funMutual = m } Datatype{} -> def {dataMutual = m } Record{} -> def { recMutual = m } _ -> __IMPOSSIBLE__ -- | Check whether two definitions are mutually recursive. mutuallyRecursive :: QName -> QName -> TCM Bool mutuallyRecursive d d' = (d `elem`) <$> getMutual d' -- | Why Maybe? The reason is that we look up all prefixes of a module to -- compute number of parameters, and for hierarchical top-level modules, -- A.B.C say, A and A.B do not exist. getSection :: ModuleName -> TCM (Maybe Section) getSection m = do sig <- use $ stSignature . sigSections isig <- use $ stImports . sigSections return $ Map.lookup m sig <|> Map.lookup m isig -- | Get the number of parameters to the current module. getCurrentModuleFreeVars :: TCM Nat getCurrentModuleFreeVars = size <$> (lookupSection =<< currentModule) -- | Compute the number of free variables of a defined name. This is the sum of -- number of parameters shared with the current module and the number of -- anonymous variables (if the name comes from a let-bound module). getDefFreeVars :: QName -> TCM Nat getDefFreeVars q = do let m = qnameModule q m0 <- commonParentModule m <$> currentModule (+) <$> getAnonymousVariables m <*> (size <$> lookupSection m0) -- | Compute the context variables to apply a definition to. freeVarsToApply :: QName -> TCM Args freeVarsToApply x = genericTake <$> getDefFreeVars x <*> getContextArgs -- | Instantiate a closed definition with the correct part of the current -- context. instantiateDef :: Definition -> TCM Definition instantiateDef d = do vs <- freeVarsToApply $ defName d verboseS "tc.sig.inst" 30 $ do ctx <- getContext m <- currentModule reportSLn "tc.sig.inst" 30 $ "instDef in " ++ show m ++ ": " ++ show (defName d) ++ " " ++ unwords (map show . take (size vs) . reverse . map (fst . unDom) $ ctx) return $ d `apply` vs -- | Give the abstract view of a definition. makeAbstract :: Definition -> Maybe Definition makeAbstract d = case defAbstract d of ConcreteDef -> return d AbstractDef -> do def <- makeAbs $ theDef d return d { defArgOccurrences = [] -- no positivity info for abstract things! , defPolarity = [] -- no polarity info for abstract things! , theDef = def } where makeAbs Datatype {} = Just Axiom makeAbs Function {} = Just Axiom makeAbs Constructor{} = Nothing -- Andreas, 2012-11-18: Make record constructor and projections abstract. makeAbs d@Record{} = Just Axiom -- Q: what about primitive? makeAbs d = Just d -- | Enter abstract mode. Abstract definition in the current module are transparent. inAbstractMode :: TCM a -> TCM a inAbstractMode = local $ \e -> e { envAbstractMode = AbstractMode, envAllowDestructiveUpdate = False } -- Allowing destructive updates when seeing through -- abstract may break the abstraction. -- | Not in abstract mode. All abstract definitions are opaque. inConcreteMode :: TCM a -> TCM a inConcreteMode = local $ \e -> e { envAbstractMode = ConcreteMode } -- | Ignore abstract mode. All abstract definitions are transparent. ignoreAbstractMode :: MonadReader TCEnv m => m a -> m a ignoreAbstractMode = local $ \e -> e { envAbstractMode = IgnoreAbstractMode, envAllowDestructiveUpdate = False } -- Allowing destructive updates when ignoring -- abstract may break the abstraction. -- | Enter concrete or abstract mode depending on whether the given identifier -- is concrete or abstract. inConcreteOrAbstractMode :: QName -> TCM a -> TCM a inConcreteOrAbstractMode q cont = do -- Andreas, 2015-07-01: If we do not ignoreAbstractMode here, -- we will get ConcreteDef for abstract things, as they are turned into axioms. a <- ignoreAbstractMode $ defAbstract <$> getConstInfo q case a of AbstractDef -> inAbstractMode cont ConcreteDef -> inConcreteMode cont -- | Check whether a name might have to be treated abstractly (either if we're -- 'inAbstractMode' or it's not a local name). Returns true for things not -- declared abstract as well, but for those 'makeAbstract' will have no effect. treatAbstractly :: MonadReader TCEnv m => QName -> m Bool treatAbstractly q = asks $ treatAbstractly' q -- | Andreas, 2015-07-01: -- If the @current@ module is a weak suffix of the identifier module, -- we can see through its abstract definition if we are abstract. -- (Then @treatAbstractly'@ returns @False@). -- -- If I am not mistaken, then we cannot see definitions in the @where@ -- block of an abstract function from the perspective of the function, -- because then the current module is a strict prefix of the module -- of the local identifier. -- This problem is fixed by removing trailing anonymous module name parts -- (underscores) from both names. treatAbstractly' :: QName -> TCEnv -> Bool treatAbstractly' q env = case envAbstractMode env of ConcreteMode -> True IgnoreAbstractMode -> False AbstractMode -> not $ current == m || current `isSubModuleOf` m where current = dropAnon $ envCurrentModule env m = dropAnon $ qnameModule q dropAnon (MName ms) = MName $ reverse $ dropWhile isNoName $ reverse ms -- | Get type of a constant, instantiated to the current context. typeOfConst :: QName -> TCM Type typeOfConst q = defType <$> (instantiateDef =<< getConstInfo q) -- | Get relevance of a constant. relOfConst :: QName -> TCM Relevance relOfConst q = defRelevance <$> getConstInfo q -- | Get colors of a constant. colOfConst :: QName -> TCM [Color] colOfConst q = defColors <$> getConstInfo q -- | The name must be a datatype. sortOfConst :: QName -> TCM Sort sortOfConst q = do d <- theDef <$> getConstInfo q case d of Datatype{dataSort = s} -> return s _ -> fail $ "Expected " ++ show q ++ " to be a datatype." -- | The number of parameters of a definition. defPars :: Definition -> Int defPars d = case theDef d of Axiom{} -> 0 def@Function{} -> projectionArgs def Datatype {dataPars = n} -> n Record {recPars = n} -> n Constructor{conPars = n} -> n Primitive{} -> 0 -- | The number of dropped parameters for a definition. -- 0 except for projection(-like) functions and constructors. droppedPars :: Definition -> Int droppedPars d = case theDef d of Axiom{} -> 0 def@Function{} -> projectionArgs def Datatype {dataPars = _} -> 0 -- not dropped Record {recPars = _} -> 0 -- not dropped Constructor{conPars = n} -> n Primitive{} -> 0 -- | Is it the name of a record projection? {-# SPECIALIZE isProjection :: QName -> TCM (Maybe Projection) #-} isProjection :: HasConstInfo m => QName -> m (Maybe Projection) isProjection qn = isProjection_ . theDef <$> getConstInfo qn isProjection_ :: Defn -> Maybe Projection isProjection_ def = case def of Function { funProjection = result } -> result _ -> Nothing -- | Returns @True@ if we are dealing with a proper projection, -- i.e., not a projection-like function nor a record field value -- (projection applied to argument). isProperProjection :: Defn -> Bool isProperProjection d = caseMaybe (isProjection_ d) False $ \ isP -> if projIndex isP <= 0 then False else isJust $ projProper isP -- | Number of dropped initial arguments of a projection(-like) function. projectionArgs :: Defn -> Int projectionArgs = maybe 0 (max 0 . pred . projIndex) . isProjection_ -- | Check whether a definition uses copatterns. usesCopatterns :: QName -> TCM Bool usesCopatterns q = do d <- theDef <$> getConstInfo q return $ case d of Function{ funCopatternLHS = b } -> b _ -> False -- | Apply a function @f@ to its first argument, producing the proper -- postfix projection if @f@ is a projection. applyDef :: QName -> I.Arg Term -> TCM Term applyDef f a = do let fallback = return $ Def f [Apply a] caseMaybeM (isProjection f) fallback $ \ isP -> do if projIndex isP <= 0 then fallback else do -- Get the original projection, if existing. caseMaybe (projProper isP) fallback $ \ f' -> do return $ unArg a `applyE` [Proj f'] -- | @getDefType f t@ computes the type of (possibly projection-(like)) -- function @t@ whose first argument has type @t@. -- The `parameters' for @f@ are extracted from @t@. -- @Nothing@ if @f@ is projection(like) but -- @t@ is not a data/record/axiom type. -- -- Precondition: @t@ is reduced. -- -- See also: 'Agda.TypeChecking.Datatypes.getConType' getDefType :: QName -> Type -> TCM (Maybe Type) getDefType f t = do def <- getConstInfo f let a = defType def -- if @f@ is not a projection (like) function, @a@ is the correct type fallback = return $ Just a caseMaybe (isProjection_ $ theDef def) fallback $ \ (Projection{ projIndex = n }) -> if n <= 0 then fallback else do -- otherwise, we have to instantiate @a@ to the "parameters" of @f@ let npars | n == 0 = __IMPOSSIBLE__ | otherwise = n - 1 -- we get the parameters from type @t@ case ignoreSharing $ unEl t of Def d es -> do -- Andreas, 2013-10-22 -- we need to check this @Def@ is fully reduced. -- If it is stuck due to disabled reductions -- (because of failed termination check), -- we will produce garbage parameters. flip (ifM $ eligibleForProjectionLike d) (return Nothing) $ do -- now we know it is reduced, we can safely take the parameters let pars = fromMaybe __IMPOSSIBLE__ $ allApplyElims $ take npars es -- pars <- maybe (return Nothing) return $ allApplyElims $ take npars es return $ Just $ a `apply` pars _ -> return Nothing Agda-2.4.2.5/src/full/Agda/TypeChecking/Monad/Env.hs0000644000000000000000000000766012635075266020015 0ustar0000000000000000{-# LANGUAGE FlexibleContexts #-} module Agda.TypeChecking.Monad.Env where import Control.Monad.Reader import Data.List import Data.Monoid import Agda.Syntax.Common import Agda.Syntax.Abstract.Name import Agda.TypeChecking.Monad.Base -- | Get the name of the current module, if any. currentModule :: TCM ModuleName currentModule = asks envCurrentModule -- | Set the name of the current module. withCurrentModule :: ModuleName -> TCM a -> TCM a withCurrentModule m = local $ \e -> e { envCurrentModule = m } -- | Get the number of variables bound by anonymous modules. getAnonymousVariables :: ModuleName -> TCM Nat getAnonymousVariables m = do ms <- asks envAnonymousModules return $ sum [ n | (m', n) <- ms, mnameToList m' `isPrefixOf` mnameToList m ] -- | Add variables bound by an anonymous module. withAnonymousModule :: ModuleName -> Nat -> TCM a -> TCM a withAnonymousModule m n = local $ \e -> e { envAnonymousModules = (m, n) : envAnonymousModules e } -- | Set the current environment to the given withEnv :: TCEnv -> TCM a -> TCM a withEnv env m = local (\env0 -> env { envAllowDestructiveUpdate = envAllowDestructiveUpdate env0 }) m -- | Get the current environment getEnv :: TCM TCEnv getEnv = ask -- | Increases the module nesting level by one in the given -- computation. withIncreasedModuleNestingLevel :: TCM a -> TCM a withIncreasedModuleNestingLevel = local (\e -> e { envModuleNestingLevel = envModuleNestingLevel e + 1 }) -- | Set highlighting level withHighlightingLevel :: HighlightingLevel -> TCM a -> TCM a withHighlightingLevel h = local $ \e -> e { envHighlightingLevel = h } -- | Restore setting for 'ExpandLast' to default. doExpandLast :: TCM a -> TCM a doExpandLast = local $ \ e -> e { envExpandLast = ExpandLast } dontExpandLast :: TCM a -> TCM a dontExpandLast = local $ \ e -> e { envExpandLast = DontExpandLast } -- | If the reduced did a proper match (constructor or literal pattern), -- then record this as simplification step. {-# SPECIALIZE performedSimplification :: TCM a -> TCM a #-} performedSimplification :: MonadReader TCEnv m => m a -> m a performedSimplification = local $ \ e -> e { envSimplification = YesSimplification } {-# SPECIALIZE performedSimplification' :: Simplification -> TCM a -> TCM a #-} performedSimplification' :: MonadReader TCEnv m => Simplification -> m a -> m a performedSimplification' simpl = local $ \ e -> e { envSimplification = simpl `mappend` envSimplification e } getSimplification :: MonadReader TCEnv m => m Simplification getSimplification = asks envSimplification -- * Controlling reduction. -- | Lens for 'AllowedReductions'. updateAllowedReductions :: (AllowedReductions -> AllowedReductions) -> TCEnv -> TCEnv updateAllowedReductions f e = e { envAllowedReductions = f (envAllowedReductions e) } modifyAllowedReductions :: (AllowedReductions -> AllowedReductions) -> TCM a -> TCM a modifyAllowedReductions = local . updateAllowedReductions putAllowedReductions :: AllowedReductions -> TCM a -> TCM a putAllowedReductions = modifyAllowedReductions . const -- | Reduce @Def f vs@ only if @f@ is a projection. onlyReduceProjections :: TCM a -> TCM a onlyReduceProjections = putAllowedReductions [ProjectionReductions] -- | Allow all reductions except for non-terminating functions (default). allowAllReductions :: TCM a -> TCM a allowAllReductions = putAllowedReductions allReductions -- | Allow all reductions including non-terminating functions. allowNonTerminatingReductions :: TCM a -> TCM a allowNonTerminatingReductions = putAllowedReductions $ [NonTerminatingReductions] ++ allReductions insideDotPattern :: TCM a -> TCM a insideDotPattern = local $ \e -> e { envInsideDotPattern = True } isInsideDotPattern :: TCM Bool isInsideDotPattern = asks envInsideDotPattern isReifyingUnquoted :: TCM Bool isReifyingUnquoted = asks envReifyUnquoted nowReifyingUnquoted :: TCM a -> TCM a nowReifyingUnquoted = local $ \e -> e { envReifyUnquoted = True } Agda-2.4.2.5/src/full/Agda/TypeChecking/Monad/Options.hs-boot0000644000000000000000000000155512635075266021656 0ustar0000000000000000module Agda.TypeChecking.Monad.Options where import Control.Applicative import Control.Monad.Trans import Agda.Interaction.Options import Agda.TypeChecking.Monad.Base import Agda.Utils.FileName import Agda.Utils.Pretty getIncludeDirs :: TCM [AbsolutePath] type VerboseKey = String class (Functor m, Applicative m, Monad m) => HasOptions m where -- | Returns the pragma options which are currently in effect. pragmaOptions :: m PragmaOptions -- | Returns the command line options which are currently in effect. commandLineOptions :: m CommandLineOptions instance MonadIO m => HasOptions (TCMT m) hasVerbosity :: HasOptions m => VerboseKey -> Int -> m Bool verboseS :: MonadTCM tcm => VerboseKey -> Int -> tcm () -> tcm () reportSLn :: MonadTCM tcm => VerboseKey -> Int -> String -> tcm () reportSDoc :: MonadTCM tcm => VerboseKey -> Int -> TCM Doc -> tcm () Agda-2.4.2.5/src/full/Agda/TypeChecking/Monad/Closure.hs0000644000000000000000000000045212635075266020671 0ustar0000000000000000module Agda.TypeChecking.Monad.Closure where import Agda.TypeChecking.Monad.Base import Agda.TypeChecking.Monad.Env import Agda.TypeChecking.Monad.State enterClosure :: Closure a -> (a -> TCM b) -> TCM b enterClosure (Closure sig env scope x) k = withScope_ scope $ withEnv env $ k x Agda-2.4.2.5/src/full/Agda/TypeChecking/Monad/Imports.hs0000644000000000000000000000545312635075266020720 0ustar0000000000000000module Agda.TypeChecking.Monad.Imports where import Control.Monad.State import Control.Monad.Reader import Data.Set (Set) import qualified Data.Map as Map import qualified Data.Set as Set import Agda.Syntax.Abstract.Name import qualified Agda.Syntax.Concrete.Name as C import Agda.TypeChecking.Monad.Base import Agda.Utils.Lens import Agda.Utils.Monad import Agda.Utils.Time import Agda.Utils.Hash addImport :: ModuleName -> TCM () addImport m = stImportedModules %= Set.insert m addImportCycleCheck :: C.TopLevelModuleName -> TCM a -> TCM a addImportCycleCheck m = local $ \e -> e { envImportPath = m : envImportPath e } getImports :: TCM (Set ModuleName) getImports = use stImportedModules isImported :: ModuleName -> TCM Bool isImported m = Set.member m <$> getImports getImportPath :: TCM [C.TopLevelModuleName] getImportPath = asks envImportPath visitModule :: ModuleInfo -> TCM () visitModule mi = stVisitedModules %= Map.insert (toTopLevelModuleName $ iModuleName $ miInterface mi) mi setVisitedModules :: VisitedModules -> TCM () setVisitedModules ms = stVisitedModules .= ms getVisitedModules :: TCM VisitedModules getVisitedModules = use stVisitedModules isVisited :: C.TopLevelModuleName -> TCM Bool isVisited x = Map.member x <$> use stVisitedModules getVisitedModule :: C.TopLevelModuleName -> TCM (Maybe ModuleInfo) getVisitedModule x = Map.lookup x <$> use stVisitedModules getDecodedModules :: TCM DecodedModules getDecodedModules = stDecodedModules . stPersistentState <$> get setDecodedModules :: DecodedModules -> TCM () setDecodedModules ms = modify $ \s -> s { stPersistentState = (stPersistentState s) { stDecodedModules = ms } } getDecodedModule :: C.TopLevelModuleName -> TCM (Maybe Interface) getDecodedModule x = Map.lookup x . stDecodedModules . stPersistentState <$> get storeDecodedModule :: Interface -> TCM () storeDecodedModule i = modify $ \s -> s { stPersistentState = (stPersistentState s) { stDecodedModules = Map.insert (toTopLevelModuleName $ iModuleName i) i $ (stDecodedModules $ stPersistentState s) } } dropDecodedModule :: C.TopLevelModuleName -> TCM () dropDecodedModule x = modify $ \s -> s { stPersistentState = (stPersistentState s) { stDecodedModules = Map.delete x $ stDecodedModules $ stPersistentState s } } withImportPath :: [C.TopLevelModuleName] -> TCM a -> TCM a withImportPath path = local $ \e -> e { envImportPath = path } -- | Assumes that the first module in the import path is the module we are -- worried about. checkForImportCycle :: TCM () checkForImportCycle = do m:ms <- getImportPath when (m `elem` ms) $ typeError $ CyclicModuleDependency $ dropWhile (/= m) $ reverse (m:ms) Agda-2.4.2.5/src/full/Agda/TypeChecking/Monad/Exception.hs0000644000000000000000000000607512635075266021222 0ustar0000000000000000{-# LANGUAGE FlexibleInstances #-} {-# LANGUAGE FunctionalDependencies #-} {-# LANGUAGE MultiParamTypeClasses #-} {-# LANGUAGE UndecidableInstances #-} -- | Basically a copy of the ErrorT monad transformer. It's handy to slap -- onto TCM and still be a MonadTCM (which isn't possible with ErrorT). -- Andreas, 2012-03-30: the following command seems to be STALE. -- Also, it does not require the silly Error instance for the err type. -- The silly Error instance is back. ;-) module Agda.TypeChecking.Monad.Exception where import Control.Applicative import Control.Monad.State import Control.Monad.Reader import Control.Monad.Writer import Agda.TypeChecking.Monad.Base import Agda.Utils.Except ( Error(strMsg), MonadError(catchError, throwError) ) newtype ExceptionT err m a = ExceptionT { runExceptionT :: m (Either err a) } class Error err => MonadException err m | m -> err where throwException :: err -> m a catchException :: m a -> (err -> m a) -> m a instance (Monad m, Error err) => Monad (ExceptionT err m) where return = ExceptionT . return . Right ExceptionT m >>= k = ExceptionT $ do r <- m case r of Left err -> return $ Left err Right x -> runExceptionT $ k x fail = ExceptionT . return . Left . strMsg instance (Monad m, Error err) => MonadException err (ExceptionT err m) where throwException = ExceptionT . return . Left catchException m h = ExceptionT $ do r <- runExceptionT m case r of Left err -> runExceptionT $ h err Right x -> return $ Right x instance (Monad m, MonadException err m) => MonadException err (ReaderT r m) where throwException = lift . throwException catchException m h = ReaderT $ \ r -> catchException (m `runReaderT` r) (\ err -> h err `runReaderT` r) instance (Monad m, MonadException err m, Monoid w) => MonadException err (WriterT w m) where throwException = lift . throwException catchException m h = WriterT $ catchException (runWriterT m) (\ err -> runWriterT $ h err) instance MonadTrans (ExceptionT err) where lift = ExceptionT . liftM Right instance Functor f => Functor (ExceptionT err f) where fmap f = ExceptionT . fmap (either Left (Right . f)) . runExceptionT instance (Error err, Applicative m, Monad m) => Applicative (ExceptionT err m) where pure = return (<*>) = ap instance (Error err, MonadState s m) => MonadState s (ExceptionT err m) where get = ExceptionT $ Right `liftM` get put x = ExceptionT $ Right `liftM` put x instance (Error err, MonadReader r m) => MonadReader r (ExceptionT err m) where ask = ExceptionT $ Right `liftM` ask local f = ExceptionT . local f . runExceptionT instance (Error err, MonadError err' m) => MonadError err' (ExceptionT err m) where throwError err = ExceptionT $ Right `liftM` throwError err catchError m h = ExceptionT $ runExceptionT m `catchError` (runExceptionT . h) instance (Error err, MonadIO m) => MonadIO (ExceptionT err m) where liftIO m = ExceptionT $ Right `liftM` liftIO m instance (Error err, MonadTCM tcm) => MonadTCM (ExceptionT err tcm) where liftTCM m = ExceptionT $ Right `liftM` liftTCM m Agda-2.4.2.5/src/full/Agda/TypeChecking/Monad/MetaVars.hs0000644000000000000000000003457512635075266021014 0ustar0000000000000000{-# LANGUAGE CPP #-} {-# LANGUAGE FlexibleInstances #-} {-# LANGUAGE TupleSections #-} module Agda.TypeChecking.Monad.MetaVars where import Control.Applicative import Control.Monad.State import Control.Monad.Reader import Control.Monad.Writer import qualified Data.Map as Map import qualified Data.Set as Set import qualified Data.Foldable as Fold import qualified Data.Traversable as Trav import Agda.Syntax.Common as Common import Agda.Syntax.Internal import Agda.Syntax.Position import Agda.Syntax.Scope.Base import Agda.TypeChecking.Monad.Base import Agda.TypeChecking.Monad.Trace import Agda.TypeChecking.Monad.Closure import Agda.TypeChecking.Monad.Options (reportSLn) import Agda.TypeChecking.Monad.Context import Agda.TypeChecking.Substitute import Agda.Utils.Functor ((<.>)) import Agda.Utils.Lens import Agda.Utils.Maybe import Agda.Utils.Monad import Agda.Utils.Permutation import Agda.Utils.Pretty (prettyShow) import Agda.Utils.Tuple import Agda.Utils.Size #include "undefined.h" import Agda.Utils.Impossible -- | Switch off assignment of metas. dontAssignMetas :: TCM a -> TCM a dontAssignMetas = local $ \ env -> env { envAssignMetas = False } -- | Get the meta store. getMetaStore :: TCM MetaStore getMetaStore = use stMetaStore modifyMetaStore :: (MetaStore -> MetaStore) -> TCM () modifyMetaStore f = stMetaStore %= f -- | Lookup a meta variable lookupMeta :: MetaId -> TCM MetaVariable lookupMeta m = fromMaybeM failure $ Map.lookup m <$> getMetaStore where failure = fail $ "no such meta variable " ++ prettyShow m updateMetaVar :: MetaId -> (MetaVariable -> MetaVariable) -> TCM () updateMetaVar m f = modifyMetaStore $ Map.adjust f m getMetaPriority :: MetaId -> TCM MetaPriority getMetaPriority = mvPriority <.> lookupMeta {- UNUSED getMetaRelevance :: MetaId -> TCM Relevance getMetaRelevance x = miRelevance . mvInfo <$> lookupMeta x -} isSortMeta :: MetaId -> TCM Bool isSortMeta m = isSortMeta_ <$> lookupMeta m isSortMeta_ :: MetaVariable -> Bool isSortMeta_ mv = case mvJudgement mv of HasType{} -> False IsSort{} -> True getMetaType :: MetaId -> TCM Type getMetaType m = do mv <- lookupMeta m return $ case mvJudgement mv of HasType{ jMetaType = t } -> t IsSort{} -> __IMPOSSIBLE__ -- | Given a meta, return the type applied to the current context. getMetaTypeInContext :: MetaId -> TCM Type getMetaTypeInContext m = do MetaVar{ mvJudgement = j, mvPermutation = p } <- lookupMeta m case j of HasType{ jMetaType = t } -> do vs <- getContextArgs return $ piApply t $ permute (takeP (size vs) p) vs IsSort{} -> __IMPOSSIBLE__ -- | Check whether all metas are instantiated. -- Precondition: argument is a meta (in some form) or a list of metas. class IsInstantiatedMeta a where isInstantiatedMeta :: a -> TCM Bool instance IsInstantiatedMeta MetaId where isInstantiatedMeta m = isJust <$> isInstantiatedMeta' m instance IsInstantiatedMeta Term where isInstantiatedMeta = loop where loop v = case ignoreSharing v of MetaV x _ -> isInstantiatedMeta x DontCare v -> loop v Level l -> isInstantiatedMeta l Lam _ b -> isInstantiatedMeta b Con _ vs -> isInstantiatedMeta vs _ -> __IMPOSSIBLE__ instance IsInstantiatedMeta Level where isInstantiatedMeta (Max ls) = isInstantiatedMeta ls instance IsInstantiatedMeta PlusLevel where isInstantiatedMeta (Plus n l) | n == 0 = isInstantiatedMeta l isInstantiatedMeta _ = __IMPOSSIBLE__ instance IsInstantiatedMeta LevelAtom where isInstantiatedMeta (MetaLevel x es) = isInstantiatedMeta x isInstantiatedMeta _ = __IMPOSSIBLE__ instance IsInstantiatedMeta a => IsInstantiatedMeta [a] where isInstantiatedMeta = andM . map isInstantiatedMeta instance IsInstantiatedMeta a => IsInstantiatedMeta (Maybe a) where isInstantiatedMeta = isInstantiatedMeta . maybeToList instance IsInstantiatedMeta a => IsInstantiatedMeta (Common.Arg c a) where isInstantiatedMeta = isInstantiatedMeta . unArg -- | Does not worry about raising. instance IsInstantiatedMeta a => IsInstantiatedMeta (Abs a) where isInstantiatedMeta = isInstantiatedMeta . unAbs isInstantiatedMeta' :: MetaId -> TCM (Maybe Term) isInstantiatedMeta' m = do mv <- lookupMeta m return $ case mvInstantiation mv of InstV tel v -> Just $ foldr mkLam v tel InstS v -> Just v _ -> Nothing -- | Create 'MetaInfo' in the current environment. createMetaInfo :: TCM MetaInfo createMetaInfo = createMetaInfo' RunMetaOccursCheck createMetaInfo' :: RunMetaOccursCheck -> TCM MetaInfo createMetaInfo' b = do r <- getCurrentRange cl <- buildClosure r return MetaInfo { miClosRange = cl , miMetaOccursCheck = b , miNameSuggestion = "" } setValueMetaName :: Term -> MetaNameSuggestion -> TCM () setValueMetaName v s = do case ignoreSharing v of MetaV mi _ -> setMetaNameSuggestion mi s u -> do reportSLn "tc.meta.name" 70 $ "cannot set meta name; newMeta returns " ++ show u return () getMetaNameSuggestion :: MetaId -> TCM MetaNameSuggestion getMetaNameSuggestion mi = miNameSuggestion . mvInfo <$> lookupMeta mi setMetaNameSuggestion :: MetaId -> MetaNameSuggestion -> TCM () setMetaNameSuggestion mi s = do reportSLn "tc.meta.name" 20 $ "setting name of meta " ++ prettyShow mi ++ " to " ++ s updateMetaVar mi $ \ mvar -> mvar { mvInfo = (mvInfo mvar) { miNameSuggestion = s }} updateMetaVarRange :: MetaId -> Range -> TCM () updateMetaVarRange mi r = updateMetaVar mi (setRange r) -- * Query and manipulate interaction points. modifyInteractionPoints :: (InteractionPoints -> InteractionPoints) -> TCM () modifyInteractionPoints f = stInteractionPoints %= f -- | Register an interaction point during scope checking. -- If there is no interaction id yet, create one. registerInteractionPoint :: Range -> Maybe Nat -> TCM InteractionId registerInteractionPoint r maybeId = do ii <- case maybeId of Just i -> return $ InteractionId i Nothing -> fresh m <- use stInteractionPoints let ip = InteractionPoint { ipRange = r, ipMeta = Nothing } case Map.insertLookupWithKey (\ key new old -> old) ii ip m of -- If the interaction point is already present, we keep the old ip. -- However, it needs to be at the same range as the new one. (Just ip0, _) | ipRange ip /= ipRange ip0 -> __IMPOSSIBLE__ | otherwise -> return ii (Nothing, m') -> do modifyInteractionPoints (const m') return ii -- | Hook up meta variable to interaction point. connectInteractionPoint :: InteractionId -> MetaId -> TCM () connectInteractionPoint ii mi = do m <- use stInteractionPoints let ip = InteractionPoint { ipRange = __IMPOSSIBLE__, ipMeta = Just mi } -- The interaction point needs to be present already, we just set the meta. case Map.insertLookupWithKey (\ key new old -> new { ipRange = ipRange old }) ii ip m of (Nothing, _) -> __IMPOSSIBLE__ (Just _, m') -> modifyInteractionPoints $ const m' -- | Move an interaction point from the current ones to the old ones. removeInteractionPoint :: InteractionId -> TCM () removeInteractionPoint ii = do scope <- getInteractionScope ii modifyInteractionPoints $ Map.delete ii -- | Get a list of interaction ids. getInteractionPoints :: TCM [InteractionId] getInteractionPoints = Map.keys <$> use stInteractionPoints -- | Get all metas that correspond to interaction ids. getInteractionMetas :: TCM [MetaId] getInteractionMetas = mapMaybe ipMeta . Map.elems <$> use stInteractionPoints -- | Get all metas that correspond to interaction ids. getInteractionIdsAndMetas :: TCM [(InteractionId,MetaId)] getInteractionIdsAndMetas = mapMaybe f . Map.toList <$> use stInteractionPoints where f (ii, ip) = (ii,) <$> ipMeta ip -- | Does the meta variable correspond to an interaction point? -- -- Time: @O(n)@ where @n@ is the number of interaction metas. isInteractionMeta :: MetaId -> TCM (Maybe InteractionId) isInteractionMeta x = lookup x . map swap <$> getInteractionIdsAndMetas -- | Get the information associated to an interaction point. lookupInteractionPoint :: InteractionId -> TCM InteractionPoint lookupInteractionPoint ii = fromMaybeM err $ Map.lookup ii <$> use stInteractionPoints where err = fail $ "no such interaction point: " ++ show ii -- | Get 'MetaId' for an interaction point. -- Precondition: interaction point is connected. lookupInteractionId :: InteractionId -> TCM MetaId lookupInteractionId ii = fromMaybeM err2 $ ipMeta <$> lookupInteractionPoint ii where err2 = typeError $ GenericError $ "No type nor action available for hole " ++ show ii -- | Generate new meta variable. newMeta :: MetaInfo -> MetaPriority -> Permutation -> Judgement a -> TCM MetaId newMeta = newMeta' Open -- | Generate a new meta variable with some instantiation given. -- For instance, the instantiation could be a 'PostponedTypeCheckingProblem'. newMeta' :: MetaInstantiation -> MetaInfo -> MetaPriority -> Permutation -> Judgement a -> TCM MetaId newMeta' inst mi p perm j = do x <- fresh let j' = j { jMetaId = x } -- fill the identifier part of the judgement mv = MetaVar mi p perm j' inst Set.empty Instantiable -- printing not available (import cycle) -- reportSDoc "tc.meta.new" 50 $ text "new meta" <+> prettyTCM j' stMetaStore %= Map.insert x mv return x -- | Get the 'Range' for an interaction point. getInteractionRange :: InteractionId -> TCM Range getInteractionRange = ipRange <.> lookupInteractionPoint -- | Get the 'Range' for a meta variable. getMetaRange :: MetaId -> TCM Range getMetaRange = getRange <.> lookupMeta getInteractionScope :: InteractionId -> TCM ScopeInfo getInteractionScope = getMetaScope <.> lookupMeta <=< lookupInteractionId withMetaInfo' :: MetaVariable -> TCM a -> TCM a withMetaInfo' mv = withMetaInfo (miClosRange $ mvInfo mv) withMetaInfo :: Closure Range -> TCM a -> TCM a withMetaInfo mI cont = enterClosure mI $ \ r -> setCurrentRange r cont getInstantiatedMetas :: TCM [MetaId] getInstantiatedMetas = do store <- getMetaStore return [ i | (i, MetaVar{ mvInstantiation = mi }) <- Map.assocs store, isInst mi ] where isInst Open = False isInst OpenIFS = False isInst BlockedConst{} = False isInst PostponedTypeCheckingProblem{} = False isInst InstV{} = True isInst InstS{} = True getOpenMetas :: TCM [MetaId] getOpenMetas = do store <- getMetaStore return [ i | (i, MetaVar{ mvInstantiation = mi }) <- Map.assocs store, isOpen mi ] where isOpen Open = True isOpen OpenIFS = True isOpen BlockedConst{} = True isOpen PostponedTypeCheckingProblem{} = True isOpen InstV{} = False isOpen InstS{} = False -- | @listenToMeta l m@: register @l@ as a listener to @m@. This is done -- when the type of l is blocked by @m@. listenToMeta :: Listener -> MetaId -> TCM () listenToMeta l m = updateMetaVar m $ \mv -> mv { mvListeners = Set.insert l $ mvListeners mv } -- | Unregister a listener. unlistenToMeta :: Listener -> MetaId -> TCM () unlistenToMeta l m = updateMetaVar m $ \mv -> mv { mvListeners = Set.delete l $ mvListeners mv } -- | Get the listeners to a meta. getMetaListeners :: MetaId -> TCM [Listener] getMetaListeners m = Set.toList . mvListeners <$> lookupMeta m clearMetaListeners :: MetaId -> TCM () clearMetaListeners m = updateMetaVar m $ \mv -> mv { mvListeners = Set.empty } --------------------------------------------------------------------------- -- * Freezing and unfreezing metas. --------------------------------------------------------------------------- -- | Freeze all so far unfrozen metas for the duration of the given computation. withFreezeMetas :: TCM a -> TCM a withFreezeMetas cont = do ms <- Set.fromList <$> freezeMetas x <- cont unfreezeMetas' (`Set.member` ms) return x -- | Freeze all meta variables and return the list of metas that got frozen. freezeMetas :: TCM [MetaId] freezeMetas = execWriterT $ stMetaStore %== Map.traverseWithKey freeze where freeze :: Monad m => MetaId -> MetaVariable -> WriterT [MetaId] m MetaVariable freeze m mvar | mvFrozen mvar == Frozen = return mvar | otherwise = do tell [m] return $ mvar { mvFrozen = Frozen } -- | Thaw all meta variables. unfreezeMetas :: TCM () unfreezeMetas = unfreezeMetas' $ const True -- | Thaw some metas, as indicated by the passed condition. unfreezeMetas' :: (MetaId -> Bool) -> TCM () unfreezeMetas' cond = modifyMetaStore $ Map.mapWithKey unfreeze where unfreeze :: MetaId -> MetaVariable -> MetaVariable unfreeze m mvar | cond m = mvar { mvFrozen = Instantiable } | otherwise = mvar isFrozen :: MetaId -> TCM Bool isFrozen x = do mvar <- lookupMeta x return $ mvFrozen mvar == Frozen -- | Unfreeze meta and its type if this is a meta again. -- Does not unfreeze deep occurrences of metas. class UnFreezeMeta a where unfreezeMeta :: a -> TCM () instance UnFreezeMeta MetaId where unfreezeMeta x = do updateMetaVar x $ \ mv -> mv { mvFrozen = Instantiable } unfreezeMeta =<< do jMetaType . mvJudgement <$> lookupMeta x instance UnFreezeMeta Type where unfreezeMeta (El s t) = unfreezeMeta s >> unfreezeMeta t instance UnFreezeMeta Term where unfreezeMeta (Shared p) = unfreezeMeta $ derefPtr p unfreezeMeta (MetaV x _) = unfreezeMeta x unfreezeMeta (Sort s) = unfreezeMeta s unfreezeMeta (Level l) = unfreezeMeta l unfreezeMeta (DontCare t) = unfreezeMeta t unfreezeMeta (Lam _ v) = unfreezeMeta v unfreezeMeta _ = return () instance UnFreezeMeta Sort where unfreezeMeta (Type l) = unfreezeMeta l unfreezeMeta _ = return () instance UnFreezeMeta Level where unfreezeMeta (Max ls) = unfreezeMeta ls instance UnFreezeMeta PlusLevel where unfreezeMeta (Plus _ a) = unfreezeMeta a unfreezeMeta ClosedLevel{} = return () instance UnFreezeMeta LevelAtom where unfreezeMeta (MetaLevel x _) = unfreezeMeta x unfreezeMeta (BlockedLevel _ t) = unfreezeMeta t unfreezeMeta (NeutralLevel _ t) = unfreezeMeta t unfreezeMeta (UnreducedLevel t) = unfreezeMeta t instance UnFreezeMeta a => UnFreezeMeta [a] where unfreezeMeta = mapM_ unfreezeMeta instance UnFreezeMeta a => UnFreezeMeta (Abs a) where unfreezeMeta = Fold.mapM_ unfreezeMeta Agda-2.4.2.5/src/full/Agda/TypeChecking/Monad/Constraints.hs0000644000000000000000000001335112635075266021566 0ustar0000000000000000{-# LANGUAGE CPP #-} module Agda.TypeChecking.Monad.Constraints where import Control.Arrow ((&&&)) import Control.Applicative import Control.Monad.State import Control.Monad.Reader import Data.List as List import Data.Maybe import Agda.TypeChecking.Monad.Base import Agda.TypeChecking.Monad.Closure import Agda.TypeChecking.Monad.Options import Agda.Utils.Lens import Agda.Utils.List import Agda.Utils.Monad #include "undefined.h" import Agda.Utils.Impossible -- | Get the current problem currentProblem :: TCM ProblemId currentProblem = headWithDefault __IMPOSSIBLE__ <$> asks envActiveProblems -- | Steal all constraints belonging to the given problem and add them to the current problem. stealConstraints :: ProblemId -> TCM () stealConstraints pid = do current <- currentProblem reportSLn "tc.constr.steal" 50 $ "problem " ++ show current ++ " is stealing problem " ++ show pid ++ "'s constraints!" -- Rename @pid@ to @current@ in all constraints. let rename pc@(PConstr pid' c) | pid' == pid = PConstr current c | otherwise = pc -- We should never steal from an active problem. whenM (elem pid <$> asks envActiveProblems) __IMPOSSIBLE__ modifyAwakeConstraints $ List.map rename modifySleepingConstraints $ List.map rename solvingProblem :: ProblemId -> TCM a -> TCM a solvingProblem pid m = verboseBracket "tc.constr.solve" 50 ("working on problem " ++ show pid) $ do x <- local (\e -> e { envActiveProblems = pid : envActiveProblems e }) m ifNotM (isProblemSolved pid) (reportSLn "tc.constr.solve" 50 $ "problem " ++ show pid ++ " was not solved.") $ {- else -} do reportSLn "tc.constr.solve" 50 $ "problem " ++ show pid ++ " was solved!" wakeConstraints (blockedOn pid . clValue . theConstraint) return x where blockedOn pid (Guarded _ pid') = pid == pid' blockedOn _ _ = False isProblemSolved :: ProblemId -> TCM Bool isProblemSolved pid = and2M (notElem pid <$> asks envActiveProblems) (all ((/= pid) . constraintProblem) <$> getAllConstraints) getConstraintsForProblem :: ProblemId -> TCM Constraints getConstraintsForProblem pid = List.filter ((== pid) . constraintProblem) <$> getAllConstraints -- | Get the awake constraints getAwakeConstraints :: TCM Constraints getAwakeConstraints = use stAwakeConstraints wakeConstraints :: (ProblemConstraint -> Bool) -> TCM () wakeConstraints wake = do (wakeup, sleepin) <- List.partition wake <$> use stSleepingConstraints reportSLn "tc.constr.wake" 50 $ "waking up " ++ show (List.map constraintProblem wakeup) ++ "\n" ++ " still sleeping: " ++ show (List.map constraintProblem sleepin) modifySleepingConstraints $ const sleepin modifyAwakeConstraints (++ wakeup) -- danger... dropConstraints :: (ProblemConstraint -> Bool) -> TCM () dropConstraints crit = do let filt = List.filter $ not . crit modifySleepingConstraints filt modifyAwakeConstraints filt putAllConstraintsToSleep :: TCM () putAllConstraintsToSleep = do awakeOnes <- use stAwakeConstraints modifySleepingConstraints $ (++ awakeOnes) modifyAwakeConstraints $ const [] takeAwakeConstraint :: TCM (Maybe ProblemConstraint) takeAwakeConstraint = do cs <- getAwakeConstraints case cs of [] -> return Nothing c : cs -> do modifyAwakeConstraints $ const cs return $ Just c getAllConstraints :: TCM Constraints getAllConstraints = gets $ \s -> s^.stAwakeConstraints ++ s^.stSleepingConstraints withConstraint :: (Constraint -> TCM a) -> ProblemConstraint -> TCM a withConstraint f (PConstr pid c) = do -- We should preserve the problem stack and the isSolvingConstraint flag (pids, isSolving) <- asks $ envActiveProblems &&& envSolvingConstraints enterClosure c $ \c -> local (\e -> e { envActiveProblems = pids, envSolvingConstraints = isSolving }) $ solvingProblem pid (f c) buildProblemConstraint :: ProblemId -> Constraint -> TCM ProblemConstraint buildProblemConstraint pid c = PConstr pid <$> buildClosure c buildConstraint :: Constraint -> TCM ProblemConstraint buildConstraint c = flip buildProblemConstraint c =<< currentProblem -- | Add new a constraint addConstraint' :: Constraint -> TCM () addConstraint' c = do pc <- build stDirty .= True stSleepingConstraints %= (pc :) where build | isBlocking c = buildConstraint c | otherwise = buildProblemConstraint 0 c isBlocking SortCmp{} = False isBlocking LevelCmp{} = False isBlocking ValueCmp{} = True isBlocking ElimCmp{} = True isBlocking TypeCmp{} = True isBlocking TelCmp{} = True isBlocking (Guarded c _) = isBlocking c isBlocking UnBlock{} = True isBlocking FindInScope{} = False isBlocking IsEmpty{} = True isBlocking CheckSizeLtSat{} = True -- | Add already awake constraints addAwakeConstraints :: Constraints -> TCM () addAwakeConstraints cs = modifyAwakeConstraints (cs ++) -- | Start solving constraints nowSolvingConstraints :: TCM a -> TCM a nowSolvingConstraints = local $ \e -> e { envSolvingConstraints = True } isSolvingConstraints :: TCM Bool isSolvingConstraints = asks envSolvingConstraints --------------------------------------------------------------------------- -- * Lenses --------------------------------------------------------------------------- mapAwakeConstraints :: (Constraints -> Constraints) -> TCState -> TCState mapAwakeConstraints = over stAwakeConstraints mapSleepingConstraints :: (Constraints -> Constraints) -> TCState -> TCState mapSleepingConstraints = over stSleepingConstraints modifyAwakeConstraints :: (Constraints -> Constraints) -> TCM () modifyAwakeConstraints = modify . mapAwakeConstraints modifySleepingConstraints :: (Constraints -> Constraints) -> TCM () modifySleepingConstraints = modify . mapSleepingConstraints Agda-2.4.2.5/src/full/Agda/TypeChecking/Monad/Sharing.hs0000644000000000000000000000337112635075266020653 0ustar0000000000000000{-# LANGUAGE CPP #-} module Agda.TypeChecking.Monad.Sharing where import Control.Monad.Reader import Data.List import Data.Function import Data.Traversable import Agda.Syntax.Internal import Agda.TypeChecking.Monad.Base import Agda.TypeChecking.Monad.Options import Agda.Utils.Monad #include "undefined.h" import Agda.Utils.Impossible updateSharedTerm :: MonadTCM tcm => (Term -> tcm Term) -> Term -> tcm Term updateSharedTerm f v = ifM (liftTCM $ asks envAllowDestructiveUpdate) (updateSharedM f v) (f $ ignoreSharing v) updateSharedTermF :: (MonadTCM tcm, Traversable f) => (Term -> tcm (f Term)) -> Term -> tcm (f Term) updateSharedTermF f v = ifM (liftTCM $ asks envAllowDestructiveUpdate) (updateSharedFM f v) (f $ ignoreSharing v) updateSharedTermT :: (MonadTCM tcm, MonadTrans t, Monad (t tcm)) => (Term -> t tcm Term) -> Term -> t tcm Term updateSharedTermT f v = ifM (lift $ asks envAllowDestructiveUpdate) (updateSharedM f v) (f $ ignoreSharing v) forceEqualTerms :: Term -> Term -> TCM () forceEqualTerms u v = whenM (asks envAllowDestructiveUpdate) $ when (null $ (intersect `on` pointerChain) u v) $ case (u, v) of (Shared p, Shared q) | p > q -> update u v (_, Shared{}) -> update v u (Shared{}, _) -> update u v _ -> return () where -- TODO: compress pointer chain update u@(Shared{}) v = do report u v setPtr v p `seq` compressPointerChain u `seq` return () where p = last $ pointerChain u update _ _ = __IMPOSSIBLE__ report x y = reportSLn "tc.ptr" 50 $ "setting " ++ show x ++ "\n to " ++ show y disableDestructiveUpdate :: TCM a -> TCM a disableDestructiveUpdate = local $ \e -> e { envAllowDestructiveUpdate = False } Agda-2.4.2.5/src/full/Agda/TypeChecking/Monad/Mutual.hs0000644000000000000000000000342612635075266020530 0ustar0000000000000000-- {-# LANGUAGE CPP #-} module Agda.TypeChecking.Monad.Mutual where import Control.Monad.Reader import Control.Monad.State import qualified Data.Map as Map import Data.Set (Set) import Data.Functor ((<$>)) import qualified Data.Set as Set import Agda.Syntax.Internal import Agda.TypeChecking.Monad.Base import Agda.TypeChecking.Monad.State import qualified Agda.Utils.HashMap as HMap import Agda.Utils.Lens noMutualBlock :: TCM a -> TCM a noMutualBlock = local $ \e -> e { envMutualBlock = Nothing } inMutualBlock :: TCM a -> TCM a inMutualBlock m = do mi <- asks envMutualBlock case mi of Nothing -> do i <- fresh flip local m $ \e -> e { envMutualBlock = Just i } -- Don't create a new mutual block if we're already inside one. Just _ -> m -- | Set the mutual block for a definition setMutualBlock :: MutualId -> QName -> TCM () setMutualBlock i x = do stMutualBlocks %= Map.insertWith Set.union i (Set.singleton x) stSignature %= updateDefinition x (\ defn -> defn { defMutual = i }) -- | Get all mutual blocks getMutualBlocks :: TCM [Set QName] getMutualBlocks = Map.elems <$> use stMutualBlocks -- | Get the current mutual block, if any, otherwise a fresh mutual -- block is returned. currentOrFreshMutualBlock :: TCM MutualId currentOrFreshMutualBlock = maybe fresh return =<< asks envMutualBlock lookupMutualBlock :: MutualId -> TCM (Set QName) lookupMutualBlock mi = do mb <- use stMutualBlocks case Map.lookup mi mb of Just qs -> return qs Nothing -> return Set.empty -- can end up here if we ask for the current mutual block and there is none findMutualBlock :: QName -> TCM (Set QName) findMutualBlock f = do bs <- getMutualBlocks case filter (Set.member f) bs of [] -> fail $ "No mutual block for " ++ show f b : _ -> return b Agda-2.4.2.5/src/full/Agda/TypeChecking/Monad/Open.hs0000644000000000000000000000252612635075266020162 0ustar0000000000000000-- {-# LANGUAGE CPP #-} module Agda.TypeChecking.Monad.Open ( makeOpen , makeClosed , getOpen , tryOpen ) where import Control.Applicative import Control.Monad import Data.List import Agda.TypeChecking.Substitute import Agda.TypeChecking.Monad.Base import {-# SOURCE #-} Agda.TypeChecking.Monad.Context import Agda.Utils.Except ( MonadError(catchError) ) -- | Create an open term in the current context. makeOpen :: a -> TCM (Open a) makeOpen x = do ctx <- getContextId return $ OpenThing ctx x -- | Create an open term which is closed. makeClosed :: a -> Open a makeClosed = OpenThing [] -- | Extract the value from an open term. Must be done in an extension of the -- context in which the term was created. getOpen :: Subst a => Open a -> TCM a getOpen (OpenThing [] x) = return x getOpen (OpenThing ctx x) = do ctx' <- getContextId unless (ctx `isSuffixOf` ctx') $ fail $ "thing out of context (" ++ show ctx ++ " is not a sub context of " ++ show ctx' ++ ")" return $ raise (genericLength ctx' - genericLength ctx) x -- | Try to use an 'Open' the current context. -- Returns 'Nothing' if current context is not an extension of the -- context in which the 'Open' was created. tryOpen :: Subst a => Open a -> TCM (Maybe a) tryOpen o = (Just <$> getOpen o) `catchError` \_ -> return Nothing Agda-2.4.2.5/src/full/Agda/TypeChecking/Monad/SizedTypes.hs0000644000000000000000000002244312635075266021364 0ustar0000000000000000{-# LANGUAGE CPP #-} {-# LANGUAGE DeriveFunctor #-} {-# LANGUAGE TupleSections #-} -- | Stuff for sized types that does not require modules -- "Agda.TypeChecking.Reduce" or "Agda.TypeChecking.Constraints" -- (which import "Agda.TypeChecking.Monad"). module Agda.TypeChecking.Monad.SizedTypes where import Control.Applicative import Agda.Interaction.Options import Agda.Syntax.Common import Agda.Syntax.Internal import Agda.TypeChecking.Monad.Base import Agda.TypeChecking.Monad.Options import Agda.TypeChecking.Monad.Builtin import Agda.TypeChecking.Monad.Signature import Agda.TypeChecking.Monad.State import Agda.TypeChecking.Positivity.Occurrence import Agda.TypeChecking.Substitute () import Agda.Utils.Except ( MonadError(catchError) ) import Agda.Utils.List import Agda.Utils.Monad #include "undefined.h" import Agda.Utils.Impossible ------------------------------------------------------------------------ -- * Testing for type 'Size' ------------------------------------------------------------------------ -- | Result of querying whether size variable @i@ is bounded by another -- size. data BoundedSize = BoundedLt Term -- ^ yes @i : Size< t@ | BoundedNo deriving (Eq, Show) -- | Check if a type is the 'primSize' type. The argument should be 'reduce'd. isSizeType :: Type -> TCM (Maybe BoundedSize) isSizeType v = isSizeTypeTest <*> pure v isSizeTypeTest :: TCM (Type -> Maybe BoundedSize) isSizeTypeTest = flip (ifM (optSizedTypes <$> pragmaOptions)) (return $ const Nothing) $ do (size, sizelt) <- getBuiltinSize let testType (Def d []) | Just d == size = Just BoundedNo testType (Def d [Apply v]) | Just d == sizelt = Just $ BoundedLt $ unArg v testType _ = Nothing return $ testType . ignoreSharing . unEl getBuiltinDefName :: String -> TCM (Maybe QName) getBuiltinDefName s = fromDef . fmap ignoreSharing <$> getBuiltin' s where fromDef (Just (Def d [])) = Just d fromDef _ = Nothing getBuiltinSize :: TCM (Maybe QName, Maybe QName) getBuiltinSize = do size <- getBuiltinDefName builtinSize sizelt <- getBuiltinDefName builtinSizeLt return (size, sizelt) isSizeNameTest :: TCM (QName -> Bool) isSizeNameTest = ifM (optSizedTypes <$> pragmaOptions) isSizeNameTestRaw (return $ const False) isSizeNameTestRaw :: TCM (QName -> Bool) isSizeNameTestRaw = do (size, sizelt) <- getBuiltinSize return $ (`elem` [size, sizelt]) . Just -- | Test whether OPTIONS --sized-types and whether -- the size built-ins are defined. haveSizedTypes :: TCM Bool haveSizedTypes = do Def _ [] <- ignoreSharing <$> primSize Def _ [] <- ignoreSharing <$> primSizeInf Def _ [] <- ignoreSharing <$> primSizeSuc optSizedTypes <$> pragmaOptions `catchError` \_ -> return False -- | Add polarity info to a SIZE builtin. builtinSizeHook :: String -> QName -> Type -> TCM () builtinSizeHook s q t = do when (s `elem` [builtinSizeLt, builtinSizeSuc]) $ do modifySignature $ updateDefinition q $ updateDefPolarity (const [Covariant]) . updateDefArgOccurrences (const [StrictPos]) when (s == builtinSizeMax) $ do modifySignature $ updateDefinition q $ updateDefPolarity (const [Covariant, Covariant]) . updateDefArgOccurrences (const [StrictPos, StrictPos]) {- . updateDefType (const tmax) where -- TODO: max : (i j : Size) -> Size< (suc (max i j)) tmax = -} ------------------------------------------------------------------------ -- * Constructors ------------------------------------------------------------------------ -- | The sort of built-in types @SIZE@ and @SIZELT@. sizeSort :: Sort sizeSort = mkType 0 -- | The type of built-in types @SIZE@ and @SIZELT@. sizeUniv :: Type sizeUniv = sort $ sizeSort -- | The built-in type @SIZE@ with user-given name. sizeType_ :: QName -> Type sizeType_ size = El sizeSort $ Def size [] -- | The built-in type @SIZE@. sizeType :: TCM Type sizeType = El sizeSort <$> primSize -- | The name of @SIZESUC@. sizeSucName :: TCM (Maybe QName) sizeSucName = liftTCM $ ifM (not . optSizedTypes <$> pragmaOptions) (return Nothing) $ do Def x [] <- ignoreSharing <$> primSizeSuc return $ Just x `catchError` \_ -> return Nothing sizeSuc :: Nat -> Term -> TCM Term sizeSuc n v | n < 0 = __IMPOSSIBLE__ | n == 0 = return v | otherwise = do Def suc [] <- ignoreSharing <$> primSizeSuc return $ case iterate (sizeSuc_ suc) v !!! n of Nothing -> __IMPOSSIBLE__ Just t -> t sizeSuc_ :: QName -> Term -> Term sizeSuc_ suc v = Def suc [Apply $ defaultArg v] -- | Transform list of terms into a term build from binary maximum. sizeMax :: [Term] -> TCM Term sizeMax vs = case vs of [] -> __IMPOSSIBLE__ -- we do not have a zero size [v] -> return v vs -> do Def max [] <- primSizeMax return $ foldr1 (\ u v -> Def max $ map (Apply . defaultArg) [u,v]) vs ------------------------------------------------------------------------ -- * Viewing and unviewing sizes ------------------------------------------------------------------------ -- | A useful view on sizes. data SizeView = SizeInf | SizeSuc Term | OtherSize Term sizeView :: Term -> TCM SizeView sizeView v = do Def inf [] <- ignoreSharing <$> primSizeInf Def suc [] <- ignoreSharing <$> primSizeSuc case ignoreSharing v of Def x [] | x == inf -> return SizeInf Def x [Apply u] | x == suc -> return $ SizeSuc (unArg u) _ -> return $ OtherSize v type Offset = Nat -- | A deep view on sizes. data DeepSizeView = DSizeInf | DSizeVar Nat Offset | DSizeMeta MetaId Elims Offset | DOtherSize Term deriving (Show) data SizeViewComparable a = NotComparable | YesAbove DeepSizeView a | YesBelow DeepSizeView a deriving (Functor) -- | @sizeViewComparable v w@ checks whether @v >= w@ (then @Left@) -- or @v <= w@ (then @Right@). If uncomparable, it returns @NotComparable@. sizeViewComparable :: DeepSizeView -> DeepSizeView -> SizeViewComparable () sizeViewComparable v w = case (v,w) of (DSizeInf, _) -> YesAbove w () (_, DSizeInf) -> YesBelow w () (DSizeVar x n, DSizeVar y m) | x == y -> if n >= m then YesAbove w () else YesBelow w () _ -> NotComparable sizeViewSuc_ :: QName -> DeepSizeView -> DeepSizeView sizeViewSuc_ suc v = case v of DSizeInf -> DSizeInf DSizeVar i n -> DSizeVar i (n + 1) DSizeMeta x vs n -> DSizeMeta x vs (n + 1) DOtherSize u -> DOtherSize $ sizeSuc_ suc u -- | @sizeViewPred k v@ decrements @v@ by @k@ (must be possible!). sizeViewPred :: Nat -> DeepSizeView -> DeepSizeView sizeViewPred 0 v = v sizeViewPred k v = case v of DSizeInf -> DSizeInf DSizeVar i n | n >= k -> DSizeVar i (n - k) DSizeMeta x vs n | n >= k -> DSizeMeta x vs (n - k) _ -> __IMPOSSIBLE__ -- | @sizeViewOffset v@ returns the number of successors or Nothing when infty. sizeViewOffset :: DeepSizeView -> Maybe Offset sizeViewOffset v = case v of DSizeInf -> Nothing DSizeVar i n -> Just n DSizeMeta x vs n -> Just n DOtherSize u -> Just 0 -- | Remove successors common to both sides. removeSucs :: (DeepSizeView, DeepSizeView) -> (DeepSizeView, DeepSizeView) removeSucs (v, w) = (sizeViewPred k v, sizeViewPred k w) where k = case (sizeViewOffset v, sizeViewOffset w) of (Just n, Just m) -> min n m (Just n, Nothing) -> n (Nothing, Just m) -> m (Nothing, Nothing) -> 0 -- | Turn a size view into a term. unSizeView :: SizeView -> TCM Term unSizeView SizeInf = primSizeInf unSizeView (SizeSuc v) = sizeSuc 1 v unSizeView (OtherSize v) = return v unDeepSizeView :: DeepSizeView -> TCM Term unDeepSizeView v = case v of DSizeInf -> primSizeInf DSizeVar i n -> sizeSuc n $ var i DSizeMeta x us n -> sizeSuc n $ MetaV x us DOtherSize u -> return u ------------------------------------------------------------------------ -- * View on sizes where maximum is pulled to the top ------------------------------------------------------------------------ type SizeMaxView = [DeepSizeView] maxViewMax :: SizeMaxView -> SizeMaxView -> SizeMaxView maxViewMax v w = case (v,w) of (DSizeInf : _, _) -> [DSizeInf] (_, DSizeInf : _) -> [DSizeInf] _ -> foldr maxViewCons w v -- | @maxViewCons v ws = max v ws@. It only adds @v@ to @ws@ if it is not -- subsumed by an element of @ws@. maxViewCons :: DeepSizeView -> SizeMaxView -> SizeMaxView maxViewCons _ [DSizeInf] = [DSizeInf] maxViewCons DSizeInf _ = [DSizeInf] maxViewCons v ws = case sizeViewComparableWithMax v ws of NotComparable -> v:ws YesAbove _ ws' -> v:ws' YesBelow{} -> ws -- | @sizeViewComparableWithMax v ws@ tries to find @w@ in @ws@ that compares with @v@ -- and singles this out. -- Precondition: @v /= DSizeInv@. sizeViewComparableWithMax :: DeepSizeView -> SizeMaxView -> SizeViewComparable SizeMaxView sizeViewComparableWithMax v ws = case ws of [] -> __IMPOSSIBLE__ [w] -> fmap (const []) $ sizeViewComparable v w (w:ws) -> case sizeViewComparable v w of NotComparable -> fmap (w:) $ sizeViewComparableWithMax v ws r -> fmap (const ws) r maxViewSuc_ :: QName -> SizeMaxView -> SizeMaxView maxViewSuc_ suc = map (sizeViewSuc_ suc) unMaxView :: SizeMaxView -> TCM Term unMaxView vs = sizeMax =<< mapM unDeepSizeView vs Agda-2.4.2.5/src/full/Agda/TypeChecking/Monad/State.hs0000644000000000000000000003202612635075266020337 0ustar0000000000000000{-# LANGUAGE CPP #-} -- | Lenses for 'TCState' and more. module Agda.TypeChecking.Monad.State where import Control.Arrow ((***), first, second) import Control.Applicative import qualified Control.Exception as E import Control.Monad.State import Data.Map as Map import Data.Monoid import Data.Set (Set) import qualified Data.Set as Set import Agda.Benchmarking -- import {-# SOURCE #-} Agda.Interaction.Response import Agda.Interaction.Response (InteractionOutputCallback, Response) import Agda.Syntax.Common import Agda.Syntax.Scope.Base import qualified Agda.Syntax.Concrete.Name as C import Agda.Syntax.Abstract (PatternSynDefn, PatternSynDefns) import Agda.Syntax.Abstract.Name import Agda.Syntax.Internal import Agda.TypeChecking.Monad.Base import {-# SOURCE #-} Agda.TypeChecking.Monad.Options import Agda.TypeChecking.Positivity.Occurrence import Agda.Utils.Hash import qualified Agda.Utils.HashMap as HMap import Agda.Utils.Lens import Agda.Utils.Monad (bracket_, modify') import Agda.Utils.Pretty import Agda.Utils.Tuple #include "undefined.h" import Agda.Utils.Impossible -- | Resets the non-persistent part of the type checking state. resetState :: TCM () resetState = do pers <- gets stPersistentState put $ initState { stPersistentState = pers } -- | Resets all of the type checking state. -- -- Keep only 'Benchmark' information. resetAllState :: TCM () resetAllState = do b <- getBenchmark put $ updatePersistentState (\ s -> s { stBenchmark = b }) initState -- resetAllState = put initState -- | Restore 'TCState' after performing subcomputation. -- -- In contrast to 'Agda.Utils.Monad.localState', the 'Benchmark' -- info from the subcomputation is saved. localTCState :: TCM a -> TCM a localTCState = bracket_ get $ \ s -> do b <- getBenchmark put s modifyBenchmark $ const b -- | Same as 'localTCState' but also returns the state in which we were just -- before reverting it. localTCStateSaving :: TCM a -> TCM (a, TCState) localTCStateSaving compute = do state <- get result <- compute newState <- get do b <- getBenchmark put state modifyBenchmark $ const b return (result, newState) --------------------------------------------------------------------------- -- * Lens for persistent states and its fields --------------------------------------------------------------------------- lensPersistentState :: Lens' PersistentTCState TCState lensPersistentState f s = f (stPersistentState s) <&> \ p -> s { stPersistentState = p } updatePersistentState :: (PersistentTCState -> PersistentTCState) -> (TCState -> TCState) updatePersistentState f s = s { stPersistentState = f (stPersistentState s) } modifyPersistentState :: (PersistentTCState -> PersistentTCState) -> TCM () modifyPersistentState = modify . updatePersistentState -- | Lens for 'stAccumStatistics'. lensAccumStatisticsP :: Lens' Statistics PersistentTCState lensAccumStatisticsP f s = f (stAccumStatistics s) <&> \ a -> s { stAccumStatistics = a } lensAccumStatistics :: Lens' Statistics TCState lensAccumStatistics = lensPersistentState . lensAccumStatisticsP --------------------------------------------------------------------------- -- * Scope --------------------------------------------------------------------------- -- | Get the current scope. getScope :: TCM ScopeInfo getScope = use stScope -- | Set the current scope. setScope :: ScopeInfo -> TCM () setScope scope = modifyScope (const scope) -- | Modify the current scope. modifyScope :: (ScopeInfo -> ScopeInfo) -> TCM () modifyScope f = stScope %= f -- | Run a computation in a local scope. withScope :: ScopeInfo -> TCM a -> TCM (a, ScopeInfo) withScope s m = do s' <- getScope setScope s x <- m s'' <- getScope setScope s' return (x, s'') -- | Same as 'withScope', but discard the scope from the computation. withScope_ :: ScopeInfo -> TCM a -> TCM a withScope_ s m = fst <$> withScope s m -- | Discard any changes to the scope by a computation. localScope :: TCM a -> TCM a localScope m = do scope <- getScope x <- m setScope scope return x -- | Scope error. notInScope :: C.QName -> TCM a notInScope x = do printScope "unbound" 5 "" typeError $ NotInScope [x] -- | Debug print the scope. printScope :: String -> Int -> String -> TCM () printScope tag v s = verboseS ("scope." ++ tag) v $ do scope <- getScope reportSDoc ("scope." ++ tag) v $ return $ vcat [ text s, text $ show scope ] --------------------------------------------------------------------------- -- * Signature --------------------------------------------------------------------------- -- ** Lens for 'stSignature' and 'stImports' modifySignature :: (Signature -> Signature) -> TCM () modifySignature f = stSignature %= f modifyImportedSignature :: (Signature -> Signature) -> TCM () modifyImportedSignature f = stImports %= f getSignature :: TCM Signature getSignature = use stSignature getImportedSignature :: TCM Signature getImportedSignature = use stImports setSignature :: Signature -> TCM () setSignature sig = modifySignature $ const sig setImportedSignature :: Signature -> TCM () setImportedSignature sig = stImports .= sig -- | Run some computation in a different signature, restore original signature. withSignature :: Signature -> TCM a -> TCM a withSignature sig m = do sig0 <- getSignature setSignature sig r <- m setSignature sig0 return r -- ** Modifiers for rewrite rules addRewriteRulesFor :: QName -> RewriteRules -> Signature -> Signature addRewriteRulesFor f rews = over sigRewriteRules $ HMap.insertWith mappend f rews -- ** Modifiers for parts of the signature lookupDefinition :: QName -> Signature -> Maybe Definition lookupDefinition q sig = HMap.lookup q $ sig ^. sigDefinitions updateDefinitions :: (Definitions -> Definitions) -> Signature -> Signature updateDefinitions = over sigDefinitions updateDefinition :: QName -> (Definition -> Definition) -> Signature -> Signature updateDefinition q f = updateDefinitions $ HMap.adjust f q updateTheDef :: (Defn -> Defn) -> (Definition -> Definition) updateTheDef f def = def { theDef = f (theDef def) } updateDefType :: (Type -> Type) -> (Definition -> Definition) updateDefType f def = def { defType = f (defType def) } updateDefArgOccurrences :: ([Occurrence] -> [Occurrence]) -> (Definition -> Definition) updateDefArgOccurrences f def = def { defArgOccurrences = f (defArgOccurrences def) } updateDefPolarity :: ([Polarity] -> [Polarity]) -> (Definition -> Definition) updateDefPolarity f def = def { defPolarity = f (defPolarity def) } updateDefCompiledRep :: (CompiledRepresentation -> CompiledRepresentation) -> (Definition -> Definition) updateDefCompiledRep f def = def { defCompiledRep = f (defCompiledRep def) } updateFunClauses :: ([Clause] -> [Clause]) -> (Defn -> Defn) updateFunClauses f def@Function{ funClauses = cs} = def { funClauses = f cs } updateFunClauses f _ = __IMPOSSIBLE__ --------------------------------------------------------------------------- -- * Top level module --------------------------------------------------------------------------- -- | Set the top-level module. This affects the global module id of freshly -- generated names. -- TODO: Is the hash-function collision-free? If not, then the -- implementation of 'setTopLevelModule' should be changed. setTopLevelModule :: C.QName -> TCM () setTopLevelModule x = stFreshNameId .= NameId 0 (hashString (show x)) -- | Use a different top-level module for a computation. Used when generating -- names for imported modules. withTopLevelModule :: C.QName -> TCM a -> TCM a withTopLevelModule x m = do next <- use stFreshNameId setTopLevelModule x y <- m stFreshNameId .= next return y --------------------------------------------------------------------------- -- * Haskell imports --------------------------------------------------------------------------- -- | Tell the compiler to import the given Haskell module. addHaskellImport :: String -> TCM () addHaskellImport i = stHaskellImports %= Set.insert i -- | Get the Haskell imports. getHaskellImports :: TCM (Set String) getHaskellImports = use stHaskellImports --------------------------------------------------------------------------- -- * Interaction output callback --------------------------------------------------------------------------- getInteractionOutputCallback :: TCM InteractionOutputCallback getInteractionOutputCallback = gets $ stInteractionOutputCallback . stPersistentState appInteractionOutputCallback :: Response -> TCM () appInteractionOutputCallback r = getInteractionOutputCallback >>= \ cb -> cb r setInteractionOutputCallback :: InteractionOutputCallback -> TCM () setInteractionOutputCallback cb = modifyPersistentState $ \ s -> s { stInteractionOutputCallback = cb } --------------------------------------------------------------------------- -- * Pattern synonyms --------------------------------------------------------------------------- getPatternSyns :: TCM PatternSynDefns getPatternSyns = use stPatternSyns setPatternSyns :: PatternSynDefns -> TCM () setPatternSyns m = modifyPatternSyns (const m) -- | Lens for 'stPatternSyns'. modifyPatternSyns :: (PatternSynDefns -> PatternSynDefns) -> TCM () modifyPatternSyns f = stPatternSyns %= f getPatternSynImports :: TCM PatternSynDefns getPatternSynImports = use stPatternSynImports lookupPatternSyn :: QName -> TCM PatternSynDefn lookupPatternSyn x = do s <- getPatternSyns case Map.lookup x s of Just d -> return d Nothing -> do si <- getPatternSynImports case Map.lookup x si of Just d -> return d Nothing -> notInScope $ qnameToConcrete x --------------------------------------------------------------------------- -- * Benchmark --------------------------------------------------------------------------- -- | Lens getter for 'Benchmark' from 'TCState'. theBenchmark :: TCState -> Benchmark theBenchmark = stBenchmark . stPersistentState -- | Lens map for 'Benchmark'. updateBenchmark :: (Benchmark -> Benchmark) -> TCState -> TCState updateBenchmark f = updatePersistentState $ \ s -> s { stBenchmark = f (stBenchmark s) } -- | Lens getter for 'Benchmark' from 'TCM'. getBenchmark :: TCM Benchmark getBenchmark = gets $ theBenchmark -- | Lens modify for 'Benchmark'. modifyBenchmark :: (Benchmark -> Benchmark) -> TCM () modifyBenchmark = modify' . updateBenchmark -- | Run a fresh instance of the TCM (with initial state). -- 'Benchmark' info is preserved. freshTCM :: TCM a -> TCM (Either TCErr a) freshTCM m = do -- Prepare an initial state with current benchmark info. b <- getBenchmark a <- use lensAccumStatistics let s = updateBenchmark (const b) . set lensAccumStatistics a $ initState -- Run subcomputation in initial state. -- If we encounter an exception, we lose the state and the -- benchmark info. -- We could retrieve i from a type error, which carries the state, -- but we do not care for benchmarking in the presence of errors. r <- liftIO $ (Right <$> runTCM initEnv s m) `E.catch` (return . Left) case r of Left err -> return $ Left err Right (a, s) -> do -- Keep only the benchmark info from the final state of the subcomp. modifyBenchmark $ const $ theBenchmark s lensAccumStatistics .= (s^.lensAccumStatistics) return $ Right a --------------------------------------------------------------------------- -- * Instance definitions --------------------------------------------------------------------------- -- | Look through the signature and reconstruct the instance table. addSignatureInstances :: Signature -> TCM () addSignatureInstances sig = do let itable = Map.fromListWith (++) [ (c, [i]) | (i, Defn{ defInstance = Just c }) <- HMap.toList $ sig ^. sigDefinitions ] modifyInstanceDefs $ first $ Map.unionWith (++) itable -- | Lens for 'stInstanceDefs'. updateInstanceDefs :: (TempInstanceTable -> TempInstanceTable) -> (TCState -> TCState) updateInstanceDefs = over stInstanceDefs modifyInstanceDefs :: (TempInstanceTable -> TempInstanceTable) -> TCM () modifyInstanceDefs = modify . updateInstanceDefs getAllInstanceDefs :: TCM TempInstanceTable getAllInstanceDefs = use stInstanceDefs getAnonInstanceDefs :: TCM [QName] getAnonInstanceDefs = snd <$> getAllInstanceDefs -- | Remove all instances whose type is still unresolved. clearAnonInstanceDefs :: TCM () clearAnonInstanceDefs = modifyInstanceDefs $ mapSnd $ const [] -- | Add an instance whose type is still unresolved. addUnknownInstance :: QName -> TCM () addUnknownInstance x = do reportSLn "tc.decl.instance" 10 $ "adding definition " ++ show x ++ " to the instance table (the type is not yet known)" modifyInstanceDefs $ mapSnd (x:) -- | Add instance to some ``class''. addNamedInstance :: QName -- ^ Name of the instance. -> QName -- ^ Name of the class. -> TCM () addNamedInstance x n = do reportSLn "tc.decl.instance" 10 $ ("adding definition " ++ show x ++ " to instance table for " ++ show n) -- Mark x as instance for n. modifySignature $ updateDefinition x $ \ d -> d { defInstance = Just n } -- Add x to n's instances. modifyInstanceDefs $ mapFst $ Map.insertWith (++) n [x] Agda-2.4.2.5/src/full/Agda/TypeChecking/Monad/Options.hs0000644000000000000000000003016212635075266020711 0ustar0000000000000000{-# LANGUAGE CPP #-} {-# LANGUAGE FlexibleContexts #-} module Agda.TypeChecking.Monad.Options where import Prelude hiding (mapM) import Control.Applicative import Control.Monad.Reader hiding (mapM) import Control.Monad.State hiding (mapM) import Data.Maybe import Data.Traversable import Text.PrettyPrint import System.Directory import System.FilePath import Agda.Syntax.Concrete import {-# SOURCE #-} Agda.TypeChecking.Errors import Agda.TypeChecking.Monad.Base import Agda.TypeChecking.Monad.State import Agda.TypeChecking.Monad.Benchmark import Agda.Interaction.FindFile import Agda.Interaction.Options import qualified Agda.Interaction.Options.Lenses as Lens import Agda.Interaction.Response import Agda.Utils.Except ( MonadError(catchError) ) import Agda.Utils.FileName import Agda.Utils.Maybe import Agda.Utils.Monad import Agda.Utils.Lens import Agda.Utils.List import Agda.Utils.Trie (Trie) import qualified Agda.Utils.Trie as Trie #include "undefined.h" import Agda.Utils.Impossible -- | Sets the pragma options. setPragmaOptions :: PragmaOptions -> TCM () setPragmaOptions opts = do clo <- commandLineOptions let unsafe = unsafePragmaOptions opts when (optSafe clo && not (null unsafe)) $ typeError (SafeFlagPragma unsafe) case checkOpts (clo { optPragmaOptions = opts }) of Left err -> __IMPOSSIBLE__ Right opts -> do stPragmaOptions .= optPragmaOptions opts updateBenchmarkingStatus -- | Sets the command line options (both persistent and pragma options -- are updated). -- -- Relative include directories are made absolute with respect to the -- current working directory. If the include directories have changed -- (thus, they are 'Left' now, and were previously @'Right' something@), -- then the state is reset (completely, see setIncludeDirs) . -- -- An empty list of relative include directories (@'Left' []@) is -- interpreted as @["."]@. setCommandLineOptions :: CommandLineOptions -> TCM () setCommandLineOptions opts = case checkOpts opts of Left err -> __IMPOSSIBLE__ Right opts -> do incs <- case optIncludeDirs opts of Right absolutePathes -> return absolutePathes Left relativePathes -> do -- setIncludeDirs makes pathes (relative to CurrentDir) absolute -- and possible adds the current directory (if no pathes given) setIncludeDirs relativePathes CurrentDir getIncludeDirs modify $ Lens.setCommandLineOptions opts{ optIncludeDirs = Right incs } . Lens.setPragmaOptions (optPragmaOptions opts) updateBenchmarkingStatus class (Functor m, Applicative m, Monad m) => HasOptions m where -- | Returns the pragma options which are currently in effect. pragmaOptions :: m PragmaOptions -- | Returns the command line options which are currently in effect. commandLineOptions :: m CommandLineOptions instance MonadIO m => HasOptions (TCMT m) where pragmaOptions = use stPragmaOptions commandLineOptions = do p <- use stPragmaOptions cl <- stPersistentOptions . stPersistentState <$> get return $ cl { optPragmaOptions = p } setOptionsFromPragma :: OptionsPragma -> TCM () setOptionsFromPragma ps = do opts <- commandLineOptions case parsePragmaOptions ps opts of Left err -> typeError $ GenericError err Right opts' -> setPragmaOptions opts' -- | Disable display forms. enableDisplayForms :: TCM a -> TCM a enableDisplayForms = local $ \e -> e { envDisplayFormsEnabled = True } -- | Disable display forms. disableDisplayForms :: TCM a -> TCM a disableDisplayForms = local $ \e -> e { envDisplayFormsEnabled = False } -- | Check if display forms are enabled. displayFormsEnabled :: TCM Bool displayFormsEnabled = asks envDisplayFormsEnabled -- | Don't eta contract implicit dontEtaContractImplicit :: TCM a -> TCM a dontEtaContractImplicit = local $ \e -> e { envEtaContractImplicit = False } -- | Do eta contract implicit {-# SPECIALIZE doEtaContractImplicit :: TCM a -> TCM a #-} doEtaContractImplicit :: MonadTCM tcm => tcm a -> tcm a doEtaContractImplicit = local $ \e -> e { envEtaContractImplicit = True } {-# SPECIALIZE shouldEtaContractImplicit :: TCM Bool #-} shouldEtaContractImplicit :: MonadReader TCEnv m => m Bool shouldEtaContractImplicit = asks envEtaContractImplicit -- | Don't reify interaction points dontReifyInteractionPoints :: TCM a -> TCM a dontReifyInteractionPoints = local $ \e -> e { envReifyInteractionPoints = False } shouldReifyInteractionPoints :: TCM Bool shouldReifyInteractionPoints = asks envReifyInteractionPoints -- | Gets the include directories. -- -- Precondition: 'optIncludeDirs' must be @'Right' something@. getIncludeDirs :: TCM [AbsolutePath] getIncludeDirs = do incs <- optIncludeDirs <$> commandLineOptions case incs of Left _ -> __IMPOSSIBLE__ Right incs -> return incs -- | Which directory should form the base of relative include paths? data RelativeTo = ProjectRoot AbsolutePath -- ^ The root directory of the \"project\" containing the given -- file. The file needs to be syntactically correct, with a module -- name matching the file name. | CurrentDir -- ^ The current working directory. -- | Makes the given directories absolute and stores them as include -- directories. -- -- If the include directories change (and they were previously -- @'Right' something@), then the state is reset (completely, except -- for the include directories and 'stInteractionOutputCallback'). -- -- An empty list is interpreted as @["."]@. setIncludeDirs :: [FilePath] -- ^ New include directories. -> RelativeTo -- ^ How should relative paths be interpreted? -> TCM () setIncludeDirs incs relativeTo = do -- save the previous include dirs oldIncs <- gets Lens.getIncludeDirs (root, check) <- case relativeTo of CurrentDir -> do root <- liftIO (absolute =<< getCurrentDirectory) return (root, return ()) ProjectRoot f -> do m <- moduleName' f return (projectRoot f m, checkModuleName m f) -- Add the current dir if no include path is given incs <- return $ if null incs then ["."] else incs -- Make pathes absolute incs <- return $ map (mkAbsolute . (filePath root )) incs -- Andreas, 2013-10-30 Add default include dir libdir <- liftIO $ defaultLibDir -- NB: This is an absolute file name, but -- Agda.Utils.FilePath wants to check absoluteness anyway. let primdir = mkAbsolute $ libdir "prim" -- We add the default dir at the end, since it is then -- printed last in error messages. -- Might also be useful to overwrite default imports... incs <- return $ incs ++ [primdir] Lens.putIncludeDirs $ Right $ incs -- Check whether the include dirs have changed. If yes, reset state. -- Andreas, 2013-10-30 comments: -- The logic, namely using the include-dirs variable as a driver -- for the interaction, qualifies for a code-obfuscation contest. -- I guess one Boolean more in the state cost 10.000 EUR at the time -- of this implementation... case oldIncs of Right incs' | incs' /= incs -> do ho <- getInteractionOutputCallback resetAllState setInteractionOutputCallback ho Lens.putIncludeDirs $ Right incs _ -> return () check setInputFile :: FilePath -> TCM () setInputFile file = do opts <- commandLineOptions setCommandLineOptions $ opts { optInputFile = Just file } -- | Should only be run if 'hasInputFile'. getInputFile :: TCM AbsolutePath getInputFile = fromMaybeM __IMPOSSIBLE__ $ getInputFile' -- | Return the 'optInputFile' as 'AbsolutePath', if any. getInputFile' :: TCM (Maybe AbsolutePath) getInputFile' = mapM (liftIO . absolute) =<< do optInputFile <$> commandLineOptions hasInputFile :: TCM Bool hasInputFile = isJust <$> optInputFile <$> commandLineOptions proofIrrelevance :: TCM Bool proofIrrelevance = optProofIrrelevance <$> pragmaOptions {-# SPECIALIZE hasUniversePolymorphism :: TCM Bool #-} hasUniversePolymorphism :: HasOptions m => m Bool hasUniversePolymorphism = optUniversePolymorphism <$> pragmaOptions showImplicitArguments :: TCM Bool showImplicitArguments = optShowImplicit <$> pragmaOptions showIrrelevantArguments :: TCM Bool showIrrelevantArguments = optShowIrrelevant <$> pragmaOptions -- | Switch on printing of implicit and irrelevant arguments. -- E.g. for reification in with-function generation. withShowAllArguments :: TCM a -> TCM a withShowAllArguments ret = do opts <- pragmaOptions let imp = optShowImplicit opts irr = optShowIrrelevant opts setPragmaOptions $ opts { optShowImplicit = True, optShowIrrelevant = True } x <- ret opts <- pragmaOptions setPragmaOptions $ opts { optShowImplicit = imp, optShowIrrelevant = irr } return x {- RETIRED, Andreas, 2012-04-30 setShowImplicitArguments :: Bool -> TCM a -> TCM a setShowImplicitArguments showImp ret = do opts <- pragmaOptions let imp = optShowImplicit opts setPragmaOptions $ opts { optShowImplicit = showImp } x <- ret opts <- pragmaOptions setPragmaOptions $ opts { optShowImplicit = imp } return x -} ignoreInterfaces :: TCM Bool ignoreInterfaces = optIgnoreInterfaces <$> commandLineOptions positivityCheckEnabled :: TCM Bool positivityCheckEnabled = not . optDisablePositivity <$> pragmaOptions typeInType :: TCM Bool typeInType = not . optUniverseCheck <$> pragmaOptions ------------------------------------------------------------------------ -- Verbosity -- Invariant (which we may or may not currently break): Debug -- printouts use one of the following functions: -- -- reportS -- reportSLn -- reportSDoc -- | Retrieve the current verbosity level. {-# SPECIALIZE getVerbosity :: TCM (Trie String Int) #-} getVerbosity :: HasOptions m => m (Trie String Int) getVerbosity = optVerbose <$> pragmaOptions type VerboseKey = String -- | Check whether a certain verbosity level is activated. -- -- Precondition: The level must be non-negative. {-# SPECIALIZE hasVerbosity :: VerboseKey -> Int -> TCM Bool #-} hasVerbosity :: HasOptions m => VerboseKey -> Int -> m Bool hasVerbosity k n | n < 0 = __IMPOSSIBLE__ | otherwise = do t <- getVerbosity let ks = wordsBy (`elem` ".:") k m = maximum $ 0 : Trie.lookupPath ks t return (n <= m) -- | Displays a debug message in a suitable way. {-# SPECIALIZE displayDebugMessage :: Int -> String -> TCM () #-} displayDebugMessage :: MonadTCM tcm => Int -- ^ The message's debug level. -> String -- ^ Message. -> tcm () displayDebugMessage n s = liftTCM $ appInteractionOutputCallback (Resp_RunningInfo n s) -- | Run a computation if a certain verbosity level is activated. -- -- Precondition: The level must be non-negative. {-# SPECIALIZE verboseS :: VerboseKey -> Int -> TCM () -> TCM () #-} verboseS :: MonadTCM tcm => VerboseKey -> Int -> tcm () -> tcm () verboseS k n action = whenM (liftTCM $ hasVerbosity k n) action -- | Conditionally print debug string. {-# SPECIALIZE reportS :: VerboseKey -> Int -> String -> TCM () #-} reportS :: MonadTCM tcm => VerboseKey -> Int -> String -> tcm () reportS k n s = liftTCM $ verboseS k n $ displayDebugMessage n s -- | Conditionally println debug string. {-# SPECIALIZE reportSLn :: VerboseKey -> Int -> String -> TCM () #-} reportSLn :: MonadTCM tcm => VerboseKey -> Int -> String -> tcm () reportSLn k n s = verboseS k n $ displayDebugMessage n (s ++ "\n") -- | Conditionally render debug 'Doc' and print it. {-# SPECIALIZE reportSDoc :: VerboseKey -> Int -> TCM Doc -> TCM () #-} reportSDoc :: MonadTCM tcm => VerboseKey -> Int -> TCM Doc -> tcm () reportSDoc k n d = liftTCM $ verboseS k n $ do displayDebugMessage n . (++ "\n") . show =<< do d `catchError` \ err -> (\ s -> (sep $ map text [ "Printing debug message" , k ++ ":" ++show n , "failed due to error:" ]) $$ (nest 2 $ text s)) <$> prettyError err -- | Print brackets around debug messages issued by a computation. {-# SPECIALIZE verboseBracket :: VerboseKey -> Int -> String -> TCM a -> TCM a #-} verboseBracket :: MonadTCM tcm => VerboseKey -> Int -> String -> TCM a -> tcm a verboseBracket k n s m = liftTCM $ ifNotM (hasVerbosity k n) m $ {- else -} do displayDebugMessage n $ "{ " ++ s ++ "\n" m `finally` displayDebugMessage n "}\n" Agda-2.4.2.5/src/full/Agda/TypeChecking/Monad/Builtin.hs0000644000000000000000000004316712635075266020675 0ustar0000000000000000{-# LANGUAGE CPP #-} module Agda.TypeChecking.Monad.Builtin where import Control.Applicative import Control.Monad.State import Data.Functor import qualified Data.Map as Map import Agda.Syntax.Common import Agda.Syntax.Position import Agda.Syntax.Literal import Agda.Syntax.Internal import Agda.TypeChecking.Monad.Base import Agda.TypeChecking.Substitute import Agda.Utils.Except ( Error, MonadError(catchError) ) import Agda.Utils.Lens import Agda.Utils.Monad (when_) import Agda.Utils.Maybe import Agda.Utils.Tuple #include "undefined.h" import Agda.Utils.Impossible class (Functor m, Applicative m, Monad m) => HasBuiltins m where getBuiltinThing :: String -> m (Maybe (Builtin PrimFun)) litType :: Literal -> TCM Type litType l = case l of LitInt _ n -> do _ <- primZero when_ (n > 0) $ primSuc el <$> primNat LitFloat _ _ -> el <$> primFloat LitChar _ _ -> el <$> primChar LitString _ _ -> el <$> primString LitQName _ _ -> el <$> primQName where el t = El (mkType 0) t instance MonadIO m => HasBuiltins (TCMT m) where getBuiltinThing b = liftM2 mplus (Map.lookup b <$> use stLocalBuiltins) (Map.lookup b <$> use stImportedBuiltins) setBuiltinThings :: BuiltinThings PrimFun -> TCM () setBuiltinThings b = stLocalBuiltins .= b bindBuiltinName :: String -> Term -> TCM () bindBuiltinName b x = do builtin <- getBuiltinThing b case builtin of Just (Builtin y) -> typeError $ DuplicateBuiltinBinding b y x Just (Prim _) -> typeError $ NoSuchBuiltinName b Nothing -> stLocalBuiltins %= Map.insert b (Builtin x) bindPrimitive :: String -> PrimFun -> TCM () bindPrimitive b pf = do builtin <- use stLocalBuiltins setBuiltinThings $ Map.insert b (Prim pf) builtin getBuiltin :: String -> TCM Term getBuiltin x = fromMaybeM (typeError $ NoBindingForBuiltin x) $ getBuiltin' x getBuiltin' :: HasBuiltins m => String -> m (Maybe Term) getBuiltin' x = do builtin <- getBuiltinThing x case builtin of Just (Builtin t) -> return $ Just (killRange t) _ -> return Nothing getPrimitive' :: HasBuiltins m => String -> m (Maybe PrimFun) getPrimitive' x = (getPrim =<<) <$> getBuiltinThing x where getPrim (Prim pf) = return pf getPrim _ = Nothing getPrimitive :: String -> TCM PrimFun getPrimitive x = fromMaybeM (typeError $ NoSuchPrimitiveFunction x) $ getPrimitive' x -- | Rewrite a literal to constructor form if possible. constructorForm :: Term -> TCM Term constructorForm v = constructorForm' primZero primSuc v constructorForm' :: Applicative m => m Term -> m Term -> Term -> m Term constructorForm' pZero pSuc v = case ignoreSharing v of Lit (LitInt r n) | n == 0 -> pZero | n > 0 -> (`apply` [defaultArg $ Lit $ LitInt r $ n - 1]) <$> pSuc | otherwise -> pure v _ -> pure v --------------------------------------------------------------------------- -- * The names of built-in things --------------------------------------------------------------------------- primInteger, primFloat, primChar, primString, primBool, primTrue, primFalse, primList, primNil, primCons, primIO, primNat, primSuc, primZero, primNatPlus, primNatMinus, primNatTimes, primNatDivSucAux, primNatModSucAux, primNatEquality, primNatLess, primSizeUniv, primSize, primSizeLt, primSizeSuc, primSizeInf, primSizeMax, primInf, primSharp, primFlat, primEquality, primRefl, primRewrite, -- Name of rewrite relation primLevel, primLevelZero, primLevelSuc, primLevelMax, primIrrAxiom, -- builtins for reflection: primQName, primArgInfo, primArgArgInfo, primArg, primArgArg, primAgdaTerm, primAgdaTermVar, primAgdaTermLam, primAgdaTermExtLam, primAgdaTermDef, primAgdaTermCon, primAgdaTermPi, primAgdaTermSort, primAgdaTermLit, primAgdaTermUnsupported, primAgdaType, primAgdaTypeEl, primHiding, primHidden, primInstance, primVisible, primRelevance, primRelevant, primIrrelevant, primAgdaLiteral, primAgdaLitNat, primAgdaLitFloat, primAgdaLitString, primAgdaLitChar, primAgdaLitQName, primAgdaSort, primAgdaSortSet, primAgdaSortLit, primAgdaSortUnsupported, primAgdaDefinition, primAgdaDefinitionFunDef, primAgdaDefinitionDataDef, primAgdaDefinitionRecordDef, primAgdaDefinitionPostulate, primAgdaDefinitionPrimitive, primAgdaDefinitionDataConstructor, primAgdaFunDef, primAgdaFunDefCon, primAgdaClause, primAgdaClauseClause, primAgdaClauseAbsurd, primAgdaPattern, primAgdaPatCon, primAgdaPatVar, primAgdaPatDot, primAgdaDataDef, primAgdaRecordDef, primAgdaPatLit, primAgdaPatProj, primAgdaPatAbsurd :: TCM Term primInteger = getBuiltin builtinInteger primFloat = getBuiltin builtinFloat primChar = getBuiltin builtinChar primString = getBuiltin builtinString primBool = getBuiltin builtinBool primTrue = getBuiltin builtinTrue primFalse = getBuiltin builtinFalse primList = getBuiltin builtinList primNil = getBuiltin builtinNil primCons = getBuiltin builtinCons primIO = getBuiltin builtinIO primNat = getBuiltin builtinNat primSuc = getBuiltin builtinSuc primZero = getBuiltin builtinZero primNatPlus = getBuiltin builtinNatPlus primNatMinus = getBuiltin builtinNatMinus primNatTimes = getBuiltin builtinNatTimes primNatDivSucAux = getBuiltin builtinNatDivSucAux primNatModSucAux = getBuiltin builtinNatModSucAux primNatEquality = getBuiltin builtinNatEquals primNatLess = getBuiltin builtinNatLess primSizeUniv = getBuiltin builtinSizeUniv primSize = getBuiltin builtinSize primSizeLt = getBuiltin builtinSizeLt primSizeSuc = getBuiltin builtinSizeSuc primSizeInf = getBuiltin builtinSizeInf primSizeMax = getBuiltin builtinSizeMax primInf = getBuiltin builtinInf primSharp = getBuiltin builtinSharp primFlat = getBuiltin builtinFlat primEquality = getBuiltin builtinEquality primRefl = getBuiltin builtinRefl primRewrite = getBuiltin builtinRewrite primLevel = getBuiltin builtinLevel primLevelZero = getBuiltin builtinLevelZero primLevelSuc = getBuiltin builtinLevelSuc primLevelMax = getBuiltin builtinLevelMax primIrrAxiom = getBuiltin builtinIrrAxiom primQName = getBuiltin builtinQName primArg = getBuiltin builtinArg primArgArg = getBuiltin builtinArgArg primAgdaSort = getBuiltin builtinAgdaSort primAgdaType = getBuiltin builtinAgdaType primAgdaTypeEl = getBuiltin builtinAgdaTypeEl primHiding = getBuiltin builtinHiding primHidden = getBuiltin builtinHidden primInstance = getBuiltin builtinInstance primVisible = getBuiltin builtinVisible primRelevance = getBuiltin builtinRelevance primRelevant = getBuiltin builtinRelevant primIrrelevant = getBuiltin builtinIrrelevant primArgInfo = getBuiltin builtinArgInfo primArgArgInfo = getBuiltin builtinArgArgInfo primAgdaSortSet = getBuiltin builtinAgdaSortSet primAgdaSortLit = getBuiltin builtinAgdaSortLit primAgdaSortUnsupported = getBuiltin builtinAgdaSortUnsupported primAgdaTerm = getBuiltin builtinAgdaTerm primAgdaTermVar = getBuiltin builtinAgdaTermVar primAgdaTermLam = getBuiltin builtinAgdaTermLam primAgdaTermExtLam = getBuiltin builtinAgdaTermExtLam primAgdaTermDef = getBuiltin builtinAgdaTermDef primAgdaTermCon = getBuiltin builtinAgdaTermCon primAgdaTermPi = getBuiltin builtinAgdaTermPi primAgdaTermSort = getBuiltin builtinAgdaTermSort primAgdaTermLit = getBuiltin builtinAgdaTermLit primAgdaTermUnsupported = getBuiltin builtinAgdaTermUnsupported primAgdaLiteral = getBuiltin builtinAgdaLiteral primAgdaLitNat = getBuiltin builtinAgdaLitNat primAgdaLitFloat = getBuiltin builtinAgdaLitFloat primAgdaLitChar = getBuiltin builtinAgdaLitChar primAgdaLitString = getBuiltin builtinAgdaLitString primAgdaLitQName = getBuiltin builtinAgdaLitQName primAgdaFunDef = getBuiltin builtinAgdaFunDef primAgdaFunDefCon = getBuiltin builtinAgdaFunDefCon primAgdaDataDef = getBuiltin builtinAgdaDataDef primAgdaRecordDef = getBuiltin builtinAgdaRecordDef primAgdaPattern = getBuiltin builtinAgdaPattern primAgdaPatCon = getBuiltin builtinAgdaPatCon primAgdaPatVar = getBuiltin builtinAgdaPatVar primAgdaPatDot = getBuiltin builtinAgdaPatDot primAgdaPatLit = getBuiltin builtinAgdaPatLit primAgdaPatProj = getBuiltin builtinAgdaPatProj primAgdaPatAbsurd = getBuiltin builtinAgdaPatAbsurd primAgdaClause = getBuiltin builtinAgdaClause primAgdaClauseClause = getBuiltin builtinAgdaClauseClause primAgdaClauseAbsurd = getBuiltin builtinAgdaClauseAbsurd primAgdaDefinitionFunDef = getBuiltin builtinAgdaDefinitionFunDef primAgdaDefinitionDataDef = getBuiltin builtinAgdaDefinitionDataDef primAgdaDefinitionRecordDef = getBuiltin builtinAgdaDefinitionRecordDef primAgdaDefinitionDataConstructor = getBuiltin builtinAgdaDefinitionDataConstructor primAgdaDefinitionPostulate = getBuiltin builtinAgdaDefinitionPostulate primAgdaDefinitionPrimitive = getBuiltin builtinAgdaDefinitionPrimitive primAgdaDefinition = getBuiltin builtinAgdaDefinition builtinNat, builtinSuc, builtinZero, builtinNatPlus, builtinNatMinus, builtinNatTimes, builtinNatDivSucAux, builtinNatModSucAux, builtinNatEquals, builtinNatLess, builtinInteger, builtinFloat, builtinChar, builtinString, builtinBool, builtinTrue, builtinFalse, builtinList, builtinNil, builtinCons, builtinIO, builtinSizeUniv, builtinSize, builtinSizeLt, builtinSizeSuc, builtinSizeInf, builtinSizeMax, builtinInf, builtinSharp, builtinFlat, builtinEquality, builtinRefl, builtinRewrite, builtinLevelMax, builtinLevel, builtinLevelZero, builtinLevelSuc, builtinIrrAxiom, builtinQName, builtinAgdaSort, builtinAgdaSortSet, builtinAgdaSortLit, builtinAgdaSortUnsupported, builtinAgdaType, builtinAgdaTypeEl, builtinHiding, builtinHidden, builtinInstance, builtinVisible, builtinRelevance, builtinRelevant, builtinIrrelevant, builtinArg, builtinArgInfo, builtinArgArgInfo, builtinArgArg, builtinAgdaTerm, builtinAgdaTermVar, builtinAgdaTermLam, builtinAgdaTermExtLam, builtinAgdaTermDef, builtinAgdaTermCon, builtinAgdaTermPi, builtinAgdaTermSort, builtinAgdaTermLit, builtinAgdaTermUnsupported, builtinAgdaLiteral, builtinAgdaLitNat, builtinAgdaLitFloat, builtinAgdaLitChar, builtinAgdaLitString, builtinAgdaLitQName, builtinAgdaFunDef, builtinAgdaFunDefCon, builtinAgdaClause, builtinAgdaClauseClause, builtinAgdaClauseAbsurd, builtinAgdaPattern, builtinAgdaPatVar, builtinAgdaPatCon, builtinAgdaPatDot, builtinAgdaPatLit, builtinAgdaPatProj, builtinAgdaPatAbsurd, builtinAgdaDataDef, builtinAgdaRecordDef, builtinAgdaDefinitionFunDef, builtinAgdaDefinitionDataDef, builtinAgdaDefinitionRecordDef, builtinAgdaDefinitionDataConstructor, builtinAgdaDefinitionPostulate, builtinAgdaDefinitionPrimitive, builtinAgdaDefinition :: String builtinNat = "NATURAL" builtinSuc = "SUC" builtinZero = "ZERO" builtinNatPlus = "NATPLUS" builtinNatMinus = "NATMINUS" builtinNatTimes = "NATTIMES" builtinNatDivSucAux = "NATDIVSUCAUX" builtinNatModSucAux = "NATMODSUCAUX" builtinNatEquals = "NATEQUALS" builtinNatLess = "NATLESS" builtinInteger = "INTEGER" builtinFloat = "FLOAT" builtinChar = "CHAR" builtinString = "STRING" builtinBool = "BOOL" builtinTrue = "TRUE" builtinFalse = "FALSE" builtinList = "LIST" builtinNil = "NIL" builtinCons = "CONS" builtinIO = "IO" builtinSizeUniv = "SIZEUNIV" builtinSize = "SIZE" builtinSizeLt = "SIZELT" builtinSizeSuc = "SIZESUC" builtinSizeInf = "SIZEINF" builtinSizeMax = "SIZEMAX" builtinInf = "INFINITY" builtinSharp = "SHARP" builtinFlat = "FLAT" builtinEquality = "EQUALITY" builtinRefl = "REFL" builtinRewrite = "REWRITE" builtinLevelMax = "LEVELMAX" builtinLevel = "LEVEL" builtinLevelZero = "LEVELZERO" builtinLevelSuc = "LEVELSUC" builtinIrrAxiom = "IRRAXIOM" builtinQName = "QNAME" builtinAgdaSort = "AGDASORT" builtinAgdaSortSet = "AGDASORTSET" builtinAgdaSortLit = "AGDASORTLIT" builtinAgdaSortUnsupported = "AGDASORTUNSUPPORTED" builtinAgdaType = "AGDATYPE" builtinAgdaTypeEl = "AGDATYPEEL" builtinHiding = "HIDING" builtinHidden = "HIDDEN" builtinInstance = "INSTANCE" builtinVisible = "VISIBLE" builtinRelevance = "RELEVANCE" builtinRelevant = "RELEVANT" builtinIrrelevant = "IRRELEVANT" builtinArg = "ARG" builtinArgInfo = "ARGINFO" builtinArgArgInfo = "ARGARGINFO" builtinArgArg = "ARGARG" builtinAgdaTerm = "AGDATERM" builtinAgdaTermVar = "AGDATERMVAR" builtinAgdaTermLam = "AGDATERMLAM" builtinAgdaTermExtLam = "AGDATERMEXTLAM" builtinAgdaTermDef = "AGDATERMDEF" builtinAgdaTermCon = "AGDATERMCON" builtinAgdaTermPi = "AGDATERMPI" builtinAgdaTermSort = "AGDATERMSORT" builtinAgdaTermLit = "AGDATERMLIT" builtinAgdaTermUnsupported = "AGDATERMUNSUPPORTED" builtinAgdaLiteral = "AGDALITERAL" builtinAgdaLitNat = "AGDALITNAT" builtinAgdaLitFloat = "AGDALITFLOAT" builtinAgdaLitChar = "AGDALITCHAR" builtinAgdaLitString = "AGDALITSTRING" builtinAgdaLitQName = "AGDALITQNAME" builtinAgdaFunDef = "AGDAFUNDEF" builtinAgdaFunDefCon = "AGDAFUNDEFCON" builtinAgdaClause = "AGDACLAUSE" builtinAgdaClauseClause = "AGDACLAUSECLAUSE" builtinAgdaClauseAbsurd = "AGDACLAUSEABSURD" builtinAgdaPattern = "AGDAPATTERN" builtinAgdaPatVar = "AGDAPATVAR" builtinAgdaPatCon = "AGDAPATCON" builtinAgdaPatDot = "AGDAPATDOT" builtinAgdaPatLit = "AGDAPATLIT" builtinAgdaPatProj = "AGDAPATPROJ" builtinAgdaPatAbsurd = "AGDAPATABSURD" builtinAgdaDataDef = "AGDADATADEF" builtinAgdaRecordDef = "AGDARECORDDEF" builtinAgdaDefinitionFunDef = "AGDADEFINITIONFUNDEF" builtinAgdaDefinitionDataDef = "AGDADEFINITIONDATADEF" builtinAgdaDefinitionRecordDef = "AGDADEFINITIONRECORDDEF" builtinAgdaDefinitionDataConstructor = "AGDADEFINITIONDATACONSTRUCTOR" builtinAgdaDefinitionPostulate = "AGDADEFINITIONPOSTULATE" builtinAgdaDefinitionPrimitive = "AGDADEFINITIONPRIMITIVE" builtinAgdaDefinition = "AGDADEFINITION" -- | Builtins that come without a definition in Agda syntax. -- These are giving names to Agda internal concepts which -- cannot be assigned an Agda type. -- -- An example would be a user-defined name for @Set@. -- -- {-# BUILTIN TYPE Type #-} -- -- The type of @Type@ would be @Type : Level → Setω@ -- which is not valid Agda. builtinsNoDef :: [String] builtinsNoDef = [ builtinSizeUniv , builtinSize , builtinSizeLt , builtinSizeSuc , builtinSizeInf , builtinSizeMax ] -- | The coinductive primitives. data CoinductionKit = CoinductionKit { nameOfInf :: QName , nameOfSharp :: QName , nameOfFlat :: QName } -- | Tries to build a 'CoinductionKit'. coinductionKit' :: TCM CoinductionKit coinductionKit' = do Def inf _ <- ignoreSharing <$> primInf Def sharp _ <- ignoreSharing <$> primSharp Def flat _ <- ignoreSharing <$> primFlat return $ CoinductionKit { nameOfInf = inf , nameOfSharp = sharp , nameOfFlat = flat } coinductionKit :: TCM (Maybe CoinductionKit) coinductionKit = (Just <$> coinductionKit') `catchError` \_ -> return Nothing ------------------------------------------------------------------------ -- * Builtin equality ------------------------------------------------------------------------ -- | Get the name of the equality type. primEqualityName :: TCM QName primEqualityName = do eq <- primEquality -- Andreas, 2014-05-17 moved this here from TC.Rules.Def -- Don't know why up to 2 hidden lambdas need to be stripped, -- but I left the code in place. -- Maybe it was intended that equality could be declared -- in three different ways: -- 1. universe and type polymorphic -- 2. type polymorphic only -- 3. monomorphic. let lamV (Lam i b) = mapFst (getHiding i :) $ lamV (unAbs b) lamV (Shared p) = lamV (derefPtr p) lamV v = ([], v) return $ case lamV eq of ([Hidden, Hidden], Def equality _) -> equality ([Hidden], Def equality _) -> equality ([], Def equality _) -> equality _ -> __IMPOSSIBLE__ Agda-2.4.2.5/src/full/Agda/TypeChecking/Monad/Context.hs0000644000000000000000000002405312635075266020704 0ustar0000000000000000{-# LANGUAGE CPP #-} {-# LANGUAGE FlexibleInstances #-} {-# LANGUAGE TupleSections #-} #if __GLASGOW_HASKELL__ <= 708 {-# LANGUAGE OverlappingInstances #-} #endif module Agda.TypeChecking.Monad.Context where import Control.Monad.Reader import Data.List hiding (sort) import qualified Data.Map as Map import Data.Monoid import Agda.Syntax.Abstract.Name import Agda.Syntax.Common hiding (Arg, Dom, NamedArg, ArgInfo) import qualified Agda.Syntax.Common as Common import Agda.Syntax.Internal import Agda.Syntax.Scope.Monad (getLocalVars, setLocalVars) import Agda.TypeChecking.Monad.Base import Agda.TypeChecking.Substitute import Agda.TypeChecking.Monad.Open import Agda.Utils.Functor import Agda.Utils.List ((!!!), downFrom) import Agda.Utils.Monad -- * Modifying the context -- | Modify the 'ctxEntry' field of a 'ContextEntry'. modifyContextEntry :: (Dom (Name, Type) -> Dom (Name, Type)) -> ContextEntry -> ContextEntry modifyContextEntry f ce = ce { ctxEntry = f (ctxEntry ce) } -- | Modify all 'ContextEntry's. modifyContextEntries :: (Dom (Name, Type) -> Dom (Name, Type)) -> Context -> Context modifyContextEntries f = map (modifyContextEntry f) -- | Modify a 'Context' in a computation. {-# SPECIALIZE modifyContext :: (Context -> Context) -> TCM a -> TCM a #-} modifyContext :: MonadTCM tcm => (Context -> Context) -> tcm a -> tcm a modifyContext f = local $ \e -> e { envContext = f $ envContext e } {-# SPECIALIZE mkContextEntry :: Dom (Name, Type) -> TCM ContextEntry #-} mkContextEntry :: MonadTCM tcm => Dom (Name, Type) -> tcm ContextEntry mkContextEntry x = do i <- fresh return $ Ctx i x -- | Change the context. {-# SPECIALIZE inContext :: [Dom (Name, Type)] -> TCM a -> TCM a #-} inContext :: MonadTCM tcm => [Dom (Name, Type)] -> tcm a -> tcm a inContext xs ret = do ctx <- mapM mkContextEntry xs modifyContext (const ctx) ret -- | Change to top (=empty) context. {-# SPECIALIZE inTopContext :: TCM a -> TCM a #-} inTopContext :: MonadTCM tcm => tcm a -> tcm a inTopContext cont = do locals <- liftTCM $ getLocalVars liftTCM $ setLocalVars [] a <- modifyContext (const []) cont liftTCM $ setLocalVars locals return a -- | Delete the last @n@ bindings from the context. {-# SPECIALIZE escapeContext :: Int -> TCM a -> TCM a #-} escapeContext :: MonadTCM tcm => Int -> tcm a -> tcm a escapeContext n = modifyContext $ drop n -- * Adding to the context -- | @addCtx x arg cont@ add a variable to the context. -- -- Chooses an unused 'Name'. {-# SPECIALIZE addCtx :: Name -> Dom Type -> TCM a -> TCM a #-} addCtx :: MonadTCM tcm => Name -> Dom Type -> tcm a -> tcm a addCtx x a ret = do ctx <- map (nameConcrete . fst . unDom) <$> getContext let x' = head $ filter (notTaken ctx) $ iterate nextName x ce <- mkContextEntry $ (x',) <$> a modifyContext (ce :) ret -- let-bindings keep track of own their context where notTaken xs x = isNoName x || nameConcrete x `notElem` xs -- | Various specializations of @addCtx@. {-# SPECIALIZE addContext :: b -> TCM a -> TCM a #-} class AddContext b where addContext :: MonadTCM tcm => b -> tcm a -> tcm a #if __GLASGOW_HASKELL__ >= 710 instance {-# OVERLAPPABLE #-} AddContext a => AddContext [a] where #else instance AddContext a => AddContext [a] where #endif addContext = flip (foldr addContext) instance AddContext (Name, Dom Type) where addContext = uncurry addCtx instance AddContext (Dom (Name, Type)) where addContext = addContext . distributeF -- addContext dom = addCtx (fst $ unDom dom) (snd <$> dom) instance AddContext ([Name], Dom Type) where addContext (xs, dom) = addContext (bindsToTel' id xs dom) instance AddContext ([WithHiding Name], Dom Type) where addContext ([] , dom) = id addContext (WithHiding h x : xs, dom) = addContext (x , mapHiding (mappend h) dom) . addContext (xs, raise 1 dom) instance AddContext (String, Dom Type) where addContext (s, dom) ret = do x <- freshName_ s addCtx x dom ret instance AddContext (Dom (String, Type)) where addContext = addContext . distributeF -- addContext dom = addContext (fst $ unDom dom, snd <$> dom) instance AddContext (Dom Type) where addContext dom = addContext ("_", dom) instance AddContext Name where addContext x = addContext (x, dummyDom) #if __GLASGOW_HASKELL__ >= 710 instance {-# OVERLAPPING #-} AddContext String where #else instance AddContext String where #endif addContext s = addContext (s, dummyDom) instance AddContext Telescope where addContext tel ret = loop tel where loop EmptyTel = ret loop (ExtendTel t tel) = underAbstraction t tel loop {- -- | N-ary variant of @addCtx@. {-# SPECIALIZE addContext :: [Dom (Name, Type)] -> TCM a -> TCM a #-} addContext :: MonadTCM tcm => [Dom (Name, Type)] -> tcm a -> tcm a addContext ctx m = foldr (\arg -> addCtx (fst $ unDom arg) (snd <$> arg)) m ctx -} -- | add a bunch of variables with the same type to the context {-# SPECIALIZE addCtxs :: [Name] -> Dom Type -> TCM a -> TCM a #-} addCtxs :: MonadTCM tcm => [Name] -> Dom Type -> tcm a -> tcm a addCtxs [] _ k = k addCtxs (x:xs) t k = addCtx x t $ addCtxs xs (raise 1 t) k -- | Turns the string into a name and adds it to the context. {-# SPECIALIZE addCtxString :: String -> Dom Type -> TCM a -> TCM a #-} addCtxString :: MonadTCM tcm => String -> Dom Type -> tcm a -> tcm a addCtxString s a m = do x <- freshName_ s addCtx x a m -- | Turns the string into a name and adds it to the context, with dummy type. {-# SPECIALIZE addCtxString_ :: String -> TCM a -> TCM a #-} addCtxString_ :: MonadTCM tcm => String -> tcm a -> tcm a addCtxString_ s = addCtxString s dummyDom {-# SPECIALIZE addCtxStrings_ :: [String] -> TCM a -> TCM a #-} addCtxStrings_ :: MonadTCM tcm => [String] -> tcm a -> tcm a addCtxStrings_ = flip (foldr addCtxString_) -- | Context entries without a type have this dummy type. dummyDom :: Dom Type dummyDom = defaultDom typeDontCare -- | Go under an abstraction. {-# SPECIALIZE underAbstraction :: Subst a => Dom Type -> Abs a -> (a -> TCM b) -> TCM b #-} underAbstraction :: (Subst a, MonadTCM tcm) => Dom Type -> Abs a -> (a -> tcm b) -> tcm b underAbstraction _ (NoAbs _ v) k = k v underAbstraction t a k = do x <- freshName_ $ realName $ absName a addCtx x t $ k $ absBody a where realName s = if isNoName s then "x" else argNameToString s -- | Go under an abstract without worrying about the type to add to the context. {-# SPECIALIZE underAbstraction_ :: Subst a => Abs a -> (a -> TCM b) -> TCM b #-} underAbstraction_ :: (Subst a, MonadTCM tcm) => Abs a -> (a -> tcm b) -> tcm b underAbstraction_ = underAbstraction dummyDom -- | Add a telescope to the context. {-# SPECIALIZE addCtxTel :: Telescope -> TCM a -> TCM a #-} addCtxTel :: MonadTCM tcm => Telescope -> tcm a -> tcm a addCtxTel tel ret = loop tel where loop EmptyTel = ret loop (ExtendTel t tel) = underAbstraction t tel loop -- | Add a let bound variable {-# SPECIALIZE addLetBinding :: ArgInfo -> Name -> Term -> Type -> TCM a -> TCM a #-} addLetBinding :: MonadTCM tcm => ArgInfo -> Name -> Term -> Type -> tcm a -> tcm a addLetBinding info x v t0 ret = do let t = Common.Dom (setHiding NotHidden info) t0 vt <- liftTCM $ makeOpen (v, t) flip local ret $ \e -> e { envLetBindings = Map.insert x vt $ envLetBindings e } -- * Querying the context -- | Get the current context. {-# SPECIALIZE getContext :: TCM [Dom (Name, Type)] #-} getContext :: MonadTCM tcm => tcm [Dom (Name, Type)] getContext = asks $ map ctxEntry . envContext -- | Get the size of the current context. {-# SPECIALIZE getContextSize :: TCM Nat #-} getContextSize :: MonadTCM tcm => tcm Nat getContextSize = genericLength <$> asks envContext -- | Generate @[var (n - 1), ..., var 0]@ for all declarations in the context. {-# SPECIALIZE getContextArgs :: TCM Args #-} getContextArgs :: MonadTCM tcm => tcm Args getContextArgs = reverse . zipWith mkArg [0..] <$> getContext where mkArg i (Common.Dom info _) = Common.Arg info $ var i -- | Generate @[var (n - 1), ..., var 0]@ for all declarations in the context. {-# SPECIALIZE getContextTerms :: TCM [Term] #-} getContextTerms :: MonadTCM tcm => tcm [Term] getContextTerms = map var . downFrom <$> getContextSize -- | Get the current context as a 'Telescope'. {-# SPECIALIZE getContextTelescope :: TCM Telescope #-} getContextTelescope :: MonadTCM tcm => tcm Telescope getContextTelescope = telFromList' nameToArgName . reverse <$> getContext -- | Check if we are in a compatible context, i.e. an extension of the given context. {-# SPECIALIZE getContextId :: TCM [CtxId] #-} getContextId :: MonadTCM tcm => tcm [CtxId] getContextId = asks $ map ctxId . envContext -- | get type of bound variable (i.e. deBruijn index) -- {-# SPECIALIZE lookupBV :: Nat -> TCM (Dom (Name, Type)) #-} lookupBV :: MonadTCM tcm => Nat -> tcm (Dom (Name, Type)) lookupBV n = do ctx <- getContext let failure = fail $ "deBruijn index out of scope: " ++ show n ++ " in context " ++ show (map (fst . unDom) ctx) maybe failure (return . fmap (raise $ n + 1)) $ ctx !!! n {-# SPECIALIZE typeOfBV' :: Nat -> TCM (Dom Type) #-} typeOfBV' :: MonadTCM tcm => Nat -> tcm (Dom Type) typeOfBV' n = fmap snd <$> lookupBV n {-# SPECIALIZE typeOfBV :: Nat -> TCM Type #-} typeOfBV :: MonadTCM tcm => Nat -> tcm Type typeOfBV i = unDom <$> typeOfBV' i {-# SPECIALIZE nameOfBV :: Nat -> TCM Name #-} nameOfBV :: MonadTCM tcm => Nat -> tcm Name nameOfBV n = fst . unDom <$> lookupBV n -- | Get the term corresponding to a named variable. If it is a lambda bound -- variable the deBruijn index is returned and if it is a let bound variable -- its definition is returned. {-# SPECIALIZE getVarInfo :: Name -> TCM (Term, Dom Type) #-} getVarInfo :: MonadTCM tcm => Name -> tcm (Term, Dom Type) getVarInfo x = do ctx <- getContext def <- asks envLetBindings case findIndex ((==x) . fst . unDom) ctx of Just n -> do t <- typeOfBV' n return (var n, t) _ -> case Map.lookup x def of Just vt -> liftTCM $ getOpen vt _ -> fail $ "unbound variable " ++ show (nameConcrete x) Agda-2.4.2.5/src/full/Agda/TypeChecking/Monad/Context.hs-boot0000644000000000000000000000032312635075266021637 0ustar0000000000000000 module Agda.TypeChecking.Monad.Context where import Agda.Syntax.Internal import Agda.TypeChecking.Monad.Base getContext :: MonadTCM tcm => tcm [Dom (Name, Type)] getContextId :: MonadTCM tcm => tcm [CtxId] Agda-2.4.2.5/src/full/Agda/TypeChecking/SizedTypes/0000755000000000000000000000000012635075266017765 5ustar0000000000000000Agda-2.4.2.5/src/full/Agda/TypeChecking/SizedTypes/Tests.hs0000644000000000000000000001212512635075266021424 0ustar0000000000000000{-# LANGUAGE TemplateHaskell #-} module Agda.TypeChecking.SizedTypes.Tests where import Control.Applicative import Test.QuickCheck import Test.QuickCheck.All import Agda.TypeChecking.SizedTypes.Syntax import Agda.TypeChecking.SizedTypes.WarshallSolver import Agda.TypeChecking.SizedTypes.Utils -- * Label interpretation type Relation a = a -> a -> Bool class AsWeightRelation b where eval :: b -> Relation Weight instance AsWeightRelation Cmp where eval Le = (<=) eval Lt = (<) instance AsWeightRelation Label where eval (Label cmp w) x y = eval cmp x (y `plus` w) eval LInf _ _ = True prop_MeetSound :: Label -> Label -> Weight -> Weight -> Property prop_MeetSound l l' x y = eval l x y && eval l' x y ==> eval (meet l l') x y prop_MeetComplete :: Label -> Label -> Weight -> Weight -> Property prop_MeetComplete l l' x y = eval (meet l l') x y ==> eval l x y && eval l' x y prop_ComposeSound :: Label -> Label -> Weight -> Weight -> Weight -> Property prop_ComposeSound l1 l2 x y z = eval l1 x y && eval l2 y z ==> eval (compose l1 l2) x z prop_ComposeComplete :: Label -> Label -> Offset -> Weight -> Property prop_ComposeComplete l1 l2 k z = let x = Offset k in eval (compose l1 l2) x z ==> let y = z + toWeight l2 in eval l1 x y -- && eval l2 y z -- does not hold for l2 = \infty -- Andreas, 2014-05-20, Issue 1134 -- If we replace the \infty with its unicode, issue 1134 is triggered: -- "... GHC 7.6.3 and quickcheck 2.6. -- It turns out that for some reason Gentoo eclass unsets locale -- to POSIX when building haskell packages. So the issue is easy -- to reproduce with `LANG=POSIX ./setup build`." -- -- Funnily, the offending unicode symbol is in a comment. -- Some issue for TemplateHaskell / QuickCheck. -- * Generic properties propCommutative :: Eq b => (a -> a -> b) -> a -> a -> Bool propCommutative o x y = x `o` y == y `o` x propAssociative :: Eq a => (a -> a -> a) -> a -> a -> a -> Bool propAssociative o x y z = x `o` (y `o` z) == (x `o` y) `o` z propIdempotent :: Eq a => (a -> a -> a) -> a -> Bool propIdempotent o x = (x `o` x) == x propUnit :: Eq a => (a -> a -> a) -> a -> a -> Bool propUnit o u x = u `o` x == x && x `o` u == x propZero :: Eq a => (a -> a -> a) -> a -> a -> Bool propZero o z x = z `o` x == z && x `o` z == z propDistL :: Eq b => (a -> b -> b) -> (b -> b -> b) -> a -> b -> b -> Bool propDistL o p x y z = x `o` (y `p` z) == (x `o` y) `p` (x `o` z) propDistR :: Eq a => (a -> b -> a) -> (a -> a -> a) -> a -> a -> b -> Bool propDistR o p x y z = (x `p` y) `o` z == (x `o` z) `p` (y `o` z) propDistributive :: Eq a => (a -> a -> a) -> (a -> a -> a) -> a -> a -> a -> Bool propDistributive o p x y z = propDistL o p x y z && propDistR o p x y z propSemiLattice :: Eq a => (a -> a -> a) -> a -> a -> a -> Bool propSemiLattice o x y z = propCommutative o x y && propAssociative o x y z && propIdempotent o x propBoundedSemiLattice :: Eq a => (a -> a -> a) -> a -> a -> a -> a -> Bool propBoundedSemiLattice o u x y z = propSemiLattice o x y z && propUnit o u x propMonoid :: Eq a => (a -> a -> a) -> a -> a -> a -> a -> Bool propMonoid o u x y z = propAssociative o x y z && propUnit o u x propDioid :: Eq a => (a -> a -> a) -> a -> (a -> a -> a) -> a -> a -> a -> a -> Bool propDioid p n o u x y z = propBoundedSemiLattice p n x y z && propMonoid o u x y z && propDistributive o p x y z && propZero o n x -- | Properties of 'Dioid' class. propDioid_Gen :: Dioid a => a -> a -> a -> Bool propDioid_Gen = propDioid meet top compose unitCompose -- | @Weight@ instance. prop_Dioid_Weight :: Weight -> Weight -> Weight -> Bool prop_Dioid_Weight x y z = propDioid_Gen x y z -- | @Label@ instance. prop_SemiLattice_Label :: Label -> Label -> Label -> Bool prop_SemiLattice_Label x y z = propSemiLattice meet x y z prop_Unit_Label :: Label -> Bool prop_Unit_Label x = propUnit meet top x prop_BoundedSemiLattice_Label :: Label -> Label -> Label -> Bool prop_BoundedSemiLattice_Label x y z = propBoundedSemiLattice meet top x y z prop_Monoid_Label :: Label -> Label -> Label -> Bool prop_Monoid_Label x y z = propMonoid compose unitCompose x y z prop_DistL_Label :: Label -> Label -> Label -> Bool prop_DistL_Label x y z = propDistL compose meet x y z prop_DistR_Label :: Label -> Label -> Label -> Bool prop_DistR_Label x y z = propDistR compose meet x y z prop_Dist_Label :: Label -> Label -> Label -> Bool prop_Dist_Label x y z = propDistributive compose meet x y z prop_Zero_Label :: Label -> Bool prop_Zero_Label x = propZero compose top x prop_Dioid_Label :: Label -> Label -> Label -> Bool prop_Dioid_Label x y z = propDioid_Gen x y z ------------------------------------------------------------------------ -- * All tests ------------------------------------------------------------------------ -- Template Haskell hack to make the following $quickCheckAll work -- under ghc-7.8. return [] -- KEEP! -- | Runs all tests starting with "prop_" in this file. tests :: IO Bool tests = do putStrLn "Agda.TypeChecking.SizedTypes.Tests" $quickCheckAll Agda-2.4.2.5/src/full/Agda/TypeChecking/SizedTypes/Solve.hs0000644000000000000000000004032612635075266021416 0ustar0000000000000000{-# LANGUAGE CPP #-} {-# LANGUAGE FlexibleInstances #-} {-# LANGUAGE MultiParamTypeClasses #-} {-# LANGUAGE PatternGuards #-} {-# LANGUAGE ScopedTypeVariables #-} {-# LANGUAGE TupleSections #-} -- | Solving size constraints under hypotheses. -- -- The size solver proceeds as follows: -- -- 1. Get size constraints, cluster into connected components. -- -- All size constraints that mention the same metas go into the same -- cluster. Each cluster can be solved by itself. -- -- Constraints that do not fit our format are ignored. -- We check whether our computed solution fulfills them as well -- in the last step. -- -- 2. Find a joint context for each cluster. -- -- Each constraint comes with its own typing context, which -- contains size hypotheses @j : Size< i@. We need to find a -- common super context in which all constraints of a cluster live, -- and raise all constraints to this context. -- -- This involves migrating from de Bruijn indices to de Bruijn levels. -- -- There might not be a common super context. Then we are screwed, -- since our solver is not ready to deal with such a situation. We -- will blatantly refuse to solve this cluster and blame it on the -- user. -- -- 3. Convert the joint context into a hypothesis graph. -- -- This is straightforward. Each de Bruijn level becomes a -- rigid variable, each typing assumption @j : Size< i@ becomes an -- arc. -- -- 4. Convert the constraints into a constraint graph. -- -- Here we need to convert @MetaV@s into flexible variables. -- -- 5. Run the solver -- -- 6. Convert the solution into meta instantiations. -- -- 7. Double-check whether the constraints are solved. -- Opportunities for optimization: -- -- - NamedRigids has some cost to retrieve variable names -- just for the sake of debug printing. module Agda.TypeChecking.SizedTypes.Solve where import Control.Monad (unless) import Data.Foldable (Foldable, foldMap, forM_) import Data.Function import Data.List import Data.Monoid (mappend) import qualified Data.Map as Map import qualified Data.Set as Set import Data.Traversable (Traversable, forM) import Agda.Interaction.Options import Agda.Syntax.Common import Agda.Syntax.Internal import Agda.TypeChecking.Monad as TCM hiding (Offset) import Agda.TypeChecking.Monad.Builtin import Agda.TypeChecking.Pretty import Agda.TypeChecking.Reduce import Agda.TypeChecking.MetaVars -- import {-# SOURCE #-} Agda.TypeChecking.MetaVars import Agda.TypeChecking.Substitute import Agda.TypeChecking.Telescope import Agda.TypeChecking.Conversion import Agda.TypeChecking.Constraints as C -- import {-# SOURCE #-} Agda.TypeChecking.Conversion -- import {-# SOURCE #-} Agda.TypeChecking.Constraints import qualified Agda.TypeChecking.SizedTypes as S import Agda.TypeChecking.SizedTypes.Syntax as Size import Agda.TypeChecking.SizedTypes.Utils import Agda.TypeChecking.SizedTypes.WarshallSolver as Size import Agda.Utils.Cluster import Agda.Utils.Except ( MonadError(catchError) ) import Agda.Utils.Function import Agda.Utils.Functor #if MIN_VERSION_base(4,8,0) import Agda.Utils.List hiding ( uncons ) #else import Agda.Utils.List #endif import Agda.Utils.Maybe import Agda.Utils.Monad import Agda.Utils.Size import Agda.Utils.Tuple #include "undefined.h" import Agda.Utils.Impossible -- | Solve size constraints involving hypotheses. solveSizeConstraints :: TCM () solveSizeConstraints = do -- Get the constraints. cs0 <- S.getSizeConstraints let -- Error for giving up cannotSolve = typeError . GenericDocError =<< vcat (text "Cannot solve size constraints" : map prettyTCM cs0) unless (null cs0) $ solveSizeConstraints_ cs0 -- Set the unconstrained size metas to ∞. ms <- S.getSizeMetas False -- do not get interaction metas unless (null ms) $ do inf <- primSizeInf forM_ ms $ \ (m, t, tel) -> do reportSDoc "tc.size.solve" 20 $ text "solution " <+> prettyTCM (MetaV m []) <+> text " := " <+> prettyTCM inf assignMeta 0 m t (downFrom $ size tel) inf -- Double check. unless (null cs0 && null ms) $ do flip catchError (const cannotSolve) $ noConstraints $ forM_ cs0 $ \ cl -> enterClosure cl solveConstraint solveSizeConstraints_ :: [Closure TCM.Constraint] -> TCM () solveSizeConstraints_ cs0 = do -- Pair constraints with their representation as size constraints. -- Discard constraints that do not have such a representation. ccs <- catMaybes <$> do forM cs0 $ \ c -> fmap (c,) <$> computeSizeConstraint c -- Simplify constraints and check for obvious inconsistencies. cs <- concat <$> do forM ccs $ \ (c, HypSizeConstraint cxt hids hs sc) -> do case simplify1 (\ c -> Just [c]) sc of Nothing -> typeError . GenericDocError =<< do text "Contradictory size constraint" <+> prettyTCM c Just cs -> return $ HypSizeConstraint cxt hids hs <$> cs -- Cluster constraints according to the meta variables they mention. -- @csNoM@ are the constraints that do not mention any meta. let (csNoM, csMs) = (`partitionMaybe` cs) $ \ c -> fmap (c,) $ uncons $ map (metaId . sizeMetaId) $ Set.toList $ flexs c -- @css@ are the clusters of constraints. css = cluster' csMs -- There should be no constraints that do not mention a meta? unless (null csNoM) __IMPOSSIBLE__ -- Now, process the clusters. forM_ css solveCluster solveCluster :: [HypSizeConstraint] -> TCM () solveCluster [] = __IMPOSSIBLE__ solveCluster cs = do let err reason = typeError . GenericDocError =<< do vcat $ [ text $ "Cannot solve size constraints" ] ++ map prettyTCM cs ++ [ text $ "Reason: " ++ reason ] reportSDoc "tc.size.solve" 20 $ vcat $ [ text "Solving constraint cluster" ] ++ map prettyTCM cs -- Find the super context of all contexts. {- -- We use the @'ctxId'@s. let cis@(ci:cis') = for cs $ \ c -> (c, reverse $ map ctxId $ sizeContext c) -- let cis@(ci:cis') = for cs $ \ c -> (c, reverse $ sizeHypIds c) max a@Left{} _ = a max a@(Right ci@(c,is)) ci'@(c',is') = case preOrSuffix is is' of -- No common context: IsNofix -> Left (ci, ci') IsPrefix{} -> Right ci' _ -> a res = foldl' max (Right ci) cis' noContext ((c,is),(c',is')) = typeError . GenericDocError =<< vcat [ text "Cannot solve size constraints; the following constraints have no common typing context:" , prettyTCM c , prettyTCM c' ] flip (either noContext) res $ \ (HypSizeConstraint gamma hids hs _, _) -> do -} -- We rely on the fact that contexts are only extended... -- Just take the longest context. let HypSizeConstraint gamma hids hs _ = maximumBy (compare `on` (length . sizeContext)) cs -- Length of longest context. let n = size gamma -- Now convert all size constraints to the largest context. csL = for cs $ \ (HypSizeConstraint cxt _ _ c) -> raise (n - size cxt) c -- Canonicalize the constraints. -- This is unsound in the presence of hypotheses. csC :: [SizeConstraint] csC = applyWhen (null hs) (mapMaybe canonicalizeSizeConstraint) csL reportSDoc "tc.size.solve" 30 $ vcat $ [ text "Canonicalized constraints" ] ++ map (prettyTCM . HypSizeConstraint gamma hids hs) csC -- Convert size metas to flexible vars. let metas :: [SizeMeta] metas = concat $ map (foldMap (:[])) csC csF :: [Size.Constraint' NamedRigid Int] csF = map (fmap (metaId . sizeMetaId)) csC -- Construct the hypotheses graph. let hyps = map (fmap (metaId . sizeMetaId)) hs -- There cannot be negative cycles in hypotheses graph due to scoping. let hg = fromMaybe __IMPOSSIBLE__ $ hypGraph (rigids csF) hyps -- Construct the constraint graph. -- g :: Size.Graph NamedRigid Int Label g <- maybe (err "Inconsistent constraints") return $ constraintGraph csF hg reportSDoc "tc.size.solve" 40 $ vcat $ [ text "Constraint graph" , text (show g) ] sol :: Solution NamedRigid Int <- either err return $ solveGraph Map.empty hg g either err return $ verifySolution hg csF sol -- Convert solution to meta instantiation. forM_ (Map.assocs sol) $ \ (m, a) -> do unless (validOffset a) __IMPOSSIBLE__ -- Solution does not contain metas u <- unSizeExpr $ fmap __IMPOSSIBLE__ a let x = MetaId m let SizeMeta _ xs = fromMaybe __IMPOSSIBLE__ $ find ((m==) . metaId . sizeMetaId) metas -- Check that solution is well-scoped let ys = rigidIndex <$> Set.toList (rigids a) ok = all (`elem` xs) ys -- TODO: more efficient -- unless ok $ err "ill-scoped solution for size meta variable" u <- if ok then return u else primSizeInf t <- getMetaType x reportSDoc "tc.size.solve" 20 $ inTopContext $ modifyContext (const gamma) $ do text "solution " <+> prettyTCM (MetaV x []) <+> text " := " <+> prettyTCM u assignMeta n x t xs u -- | Collect constraints from a typing context, looking for SIZELT hypotheses. getSizeHypotheses :: Context -> TCM [(CtxId, SizeConstraint)] getSizeHypotheses gamma = inTopContext $ modifyContext (const gamma) $ do (_, msizelt) <- getBuiltinSize caseMaybe msizelt (return []) $ \ sizelt -> do -- Traverse the context from newest to oldest de Bruijn Index catMaybes <$> do forM (zip [0..] gamma) $ \ (i, ce) -> do -- Get name and type of variable i. let xt = unDom $ ctxEntry ce x = show $ fst xt t <- reduce . raise (1 + i) . unEl . snd $ xt case ignoreSharing t of Def d [Apply u] | d == sizelt -> do caseMaybeM (sizeExpr $ unArg u) (return Nothing) $ \ a -> return $ Just $ (ctxId ce, Constraint (Rigid (NamedRigid x i) 0) Lt a) _ -> return Nothing -- | Convert size constraint into form where each meta is applied -- to indices @0,1,..,n-1@ where @n@ is the arity of that meta. -- -- @X[σ] <= t@ beomes @X[id] <= t[σ^-1]@ -- -- @X[σ] ≤ Y[τ]@ becomes @X[id] ≤ Y[τ[σ^-1]]@ or @X[σ[τ^1]] ≤ Y[id]@ -- whichever is defined. If none is defined, we give up. -- canonicalizeSizeConstraint :: SizeConstraint -> Maybe (SizeConstraint) canonicalizeSizeConstraint c@(Constraint a cmp b) = case (a,b) of -- Case flex-flex (Flex (SizeMeta m xs) n, Flex (SizeMeta l ys) n') -- try to invert xs on ys | Just ys' <- mapM (\ y -> findIndex (==y) xs) ys -> return $ Constraint (Flex (SizeMeta m [0..size xs-1]) n) cmp (Flex (SizeMeta l ys') n') -- try to invert ys on xs | Just xs' <- mapM (\ x -> findIndex (==x) ys) xs -> return $ Constraint (Flex (SizeMeta m xs') n) cmp (Flex (SizeMeta l [0..size ys-1]) n') -- give up | otherwise -> Nothing -- Case flex-rigid (Flex (SizeMeta m xs) n, Rigid (NamedRigid x i) n') -> do j <- findIndex (==i) xs return $ Constraint (Flex (SizeMeta m [0..size xs-1]) n) cmp (Rigid (NamedRigid x j) n') -- Case rigid-flex (Rigid (NamedRigid x i) n, Flex (SizeMeta m xs) n') -> do j <- findIndex (==i) xs return $ Constraint (Rigid (NamedRigid x j) n) cmp (Flex (SizeMeta m [0..size xs-1]) n') -- Case flex-const (Flex (SizeMeta m xs) n, _) -> return $ Constraint (Flex (SizeMeta m [0..size xs-1]) n) cmp b -- Case const-flex (_, Flex (SizeMeta m xs) n') -> do return $ Constraint a cmp (Flex (SizeMeta m [0..size xs-1]) n') -- Case no flex _ -> return c -- | Identifiers for rigid variables. data NamedRigid = NamedRigid { rigidName :: String -- ^ Name for printing in debug messages. , rigidIndex :: Int -- ^ De Bruijn index. } instance Eq NamedRigid where (==) = (==) `on` rigidIndex instance Ord NamedRigid where compare = compare `on` rigidIndex instance Show NamedRigid where show = rigidName instance Plus NamedRigid Int NamedRigid where plus (NamedRigid x i) j = NamedRigid x (i + j) -- | Size metas in size expressions. data SizeMeta = SizeMeta { sizeMetaId :: MetaId , sizeMetaArgs :: [Int] } -- | An equality which ignores the meta arguments. instance Eq SizeMeta where (==) = (==) `on` sizeMetaId -- | An order which ignores the meta arguments. instance Ord SizeMeta where compare = compare `on` sizeMetaId instance PrettyTCM SizeMeta where prettyTCM (SizeMeta x es) = prettyTCM (MetaV x $ map (Apply . defaultArg . var) es) instance Subst SizeMeta where applySubst sigma (SizeMeta x es) = SizeMeta x (map raise es) where raise i = case lookupS sigma i of Var j [] -> j _ -> __IMPOSSIBLE__ -- | Size expression with de Bruijn indices. type DBSizeExpr = SizeExpr' NamedRigid SizeMeta -- deriving instance Functor (SizeExpr' Int) -- deriving instance Foldable (SizeExpr' Int) -- deriving instance Traversable (SizeExpr' Int) -- | Only for 'raise'. instance Subst (SizeExpr' NamedRigid SizeMeta) where applySubst sigma a = case a of Infty -> a Const{} -> a Flex x n -> Flex (applySubst sigma x) n Rigid r n -> case lookupS sigma $ rigidIndex r of Var j [] -> Rigid r{ rigidIndex = j } n _ -> __IMPOSSIBLE__ type SizeConstraint = Constraint' NamedRigid SizeMeta instance Subst (SizeConstraint) where applySubst sigma (Constraint a cmp b) = Constraint (applySubst sigma a) cmp (applySubst sigma b) -- | Assumes we are in the right context. instance PrettyTCM (SizeConstraint) where prettyTCM (Constraint a cmp b) = do u <- unSizeExpr a v <- unSizeExpr b prettyTCM u <+> text (show cmp) <+> prettyTCM v -- | Size constraint with de Bruijn indices. data HypSizeConstraint = HypSizeConstraint { sizeContext :: Context , sizeHypIds :: [CtxId] , sizeHypotheses :: [SizeConstraint] , sizeConstraint :: SizeConstraint } instance Flexs SizeMeta HypSizeConstraint where flexs (HypSizeConstraint _ _ hs c) = flexs hs `mappend` flexs c instance PrettyTCM HypSizeConstraint where prettyTCM (HypSizeConstraint cxt _ hs c) = inTopContext $ modifyContext (const cxt) $ do applyUnless (null hs) (((hcat $ punctuate (text ", ") $ map prettyTCM hs) <+> text "|-") <+>) (prettyTCM c) -- | Turn a constraint over de Bruijn indices into a size constraint. computeSizeConstraint :: Closure TCM.Constraint -> TCM (Maybe HypSizeConstraint) computeSizeConstraint c = do let cxt = envContext $ clEnv c inTopContext $ modifyContext (const cxt) $ do case clValue c of ValueCmp CmpLeq _ u v -> do reportSDoc "tc.size.solve" 50 $ sep $ [ text "converting size constraint" , prettyTCM c ] ma <- sizeExpr u mb <- sizeExpr v (hids, hs) <- unzip <$> getSizeHypotheses cxt let mk a b = HypSizeConstraint cxt hids hs $ Size.Constraint a Le b -- We only create a size constraint if both terms can be -- parsed to our format of size expressions. return $ mk <$> ma <*> mb _ -> __IMPOSSIBLE__ -- | Turn a term into a size expression. -- -- Returns 'Nothing' if the term isn't a proper size expression. sizeExpr :: Term -> TCM (Maybe DBSizeExpr) sizeExpr u = do u <- reduce u -- Andreas, 2009-02-09. -- This is necessary to surface the solutions of metavariables. reportSDoc "tc.conv.size" 60 $ text "sizeExpr:" <+> prettyTCM u s <- sizeView u case s of SizeInf -> return $ Just Infty SizeSuc u -> fmap (`plus` (1 :: Offset)) <$> sizeExpr u OtherSize u -> case ignoreSharing u of Var i [] -> (\ x -> Just $ Rigid (NamedRigid x i) 0) . show <$> nameOfBV i -- MetaV m es -> return $ Just $ Flex (SizeMeta m es) 0 MetaV m es | Just xs <- mapM isVar es, fastDistinct xs -> return $ Just $ Flex (SizeMeta m xs) 0 _ -> return Nothing where isVar (Proj{}) = Nothing isVar (Apply v) = case ignoreSharing $ unArg v of Var i [] -> Just i _ -> Nothing -- | Turn a de size expression into a term. unSizeExpr :: DBSizeExpr -> TCM Term unSizeExpr a = case a of Infty -> primSizeInf Rigid r (O n) -> do unless (n >= 0) __IMPOSSIBLE__ sizeSuc n $ var $ rigidIndex r Flex (SizeMeta x es) (O n) -> do unless (n >= 0) __IMPOSSIBLE__ sizeSuc n $ MetaV x $ map (Apply . defaultArg . var) es Const{} -> __IMPOSSIBLE__ Agda-2.4.2.5/src/full/Agda/TypeChecking/SizedTypes/WarshallSolver.hs0000644000000000000000000010337712635075266023304 0ustar0000000000000000{-# LANGUAGE CPP #-} {-# LANGUAGE FlexibleInstances #-} {-# LANGUAGE MultiParamTypeClasses #-} {-# LANGUAGE NoMonomorphismRestriction #-} {-# LANGUAGE PatternGuards #-} {-# LANGUAGE ScopedTypeVariables #-} {-# LANGUAGE TupleSections #-} #if __GLASGOW_HASKELL__ >= 710 {-# LANGUAGE FlexibleContexts #-} #endif module Agda.TypeChecking.SizedTypes.WarshallSolver where import Prelude hiding (truncate) import Control.Applicative hiding (Const) import Control.Monad import Data.Function (on) import Data.Functor import Data.List as List import Data.Maybe import Data.Set (Set) import qualified Data.Set as Set import Data.Map (Map) import qualified Data.Map as Map import Data.Traversable (for) import Test.QuickCheck (Arbitrary(..), frequency, choose) import Agda.TypeChecking.SizedTypes.Syntax import Agda.TypeChecking.SizedTypes.Utils import Agda.Utils.Graph.AdjacencyMap.Unidirectional (Edge(..), Nodes(..), nodes, computeNodes) -- (Edge'(..), allNodes, emptyGraph, insertEdge, graphToList, graphFromList, nodes, lookupEdge, outgoing, incoming, diagonal, transClos) import qualified Agda.Utils.Graph.AdjacencyMap.Unidirectional as Graph #include "undefined.h" import Agda.Utils.Impossible type Graph r f a = Graph.Graph (Node r f) (Node r f) a type Edge' r f a = Graph.Edge (Node r f) (Node r f) a type Key r f = Edge' r f () type Nodes r f = Graph.Nodes (Node r f) type LabelledEdge r f = Edge' r f Label src :: Edge s t e -> s src = Graph.source dest :: Edge s t e -> t dest = Graph.target lookupEdge :: (Ord s, Ord t) => Graph.Graph s t e -> s -> t -> Maybe e lookupEdge g s t = Graph.lookup s t g graphToList :: (Ord s, Ord t) => Graph.Graph s t e -> [Edge s t e] graphToList = Graph.toList graphFromList :: (Ord s, Ord t) => [Edge s t e] -> Graph.Graph s t e graphFromList = Graph.fromList insertEdge :: (Ord s, Ord t, MeetSemiLattice e, Top e) => Edge s t e -> Graph.Graph s t e -> Graph.Graph s t e insertEdge e g | isTop (label e) = g | otherwise = Graph.insertEdgeWith meet e g -- | Compute list of edges that start in a given node. outgoing :: (Ord r, Ord f) => Graph r f a -> Node r f -> [Edge' r f a] outgoing g s = Graph.edgesFrom g [s] -- | Compute list of edges that target a given node. -- -- Note: expensive for unidirectional graph representations. incoming :: (Ord r, Ord f) => Graph r f a -> Node r f -> [Edge' r f a] incoming g t = Graph.edgesTo g [t] -- | @Set.foldl@ does not exist in legacy versions of the @containers@ package. setFoldl :: (b -> a -> b) -> b -> Set a -> b setFoldl step start = List.foldl' step start . Set.toAscList -- setFoldl = Set.foldl' -- | Floyd-Warshall algorithm. transClos :: forall n a . (Ord n, Dioid a) => Graph.Graph n n a -> Graph.Graph n n a transClos g = setFoldl step g $ allNodes ns where ns = computeNodes g srcs = Set.toAscList $ srcNodes ns dests = Set.toAscList $ tgtNodes ns -- @step g v@ adds all intermediate edges @u --> w@ via @v@ to @g@ -- step :: (Ord n, Dioid a) => Graph.Graph n n a -> n -> Graph.Graph n n a step g v = foldl (flip insertEdge) g $ [ Edge u w $ l1 `compose` l2 | u <- srcs , w <- dests , l1 <- maybeToList $ lookupEdge g u v , l2 <- maybeToList $ lookupEdge g v w ] -- * Edge weights data Weight = Offset Offset | Infinity deriving (Eq) instance Show Weight where show (Offset x) = show x show Infinity = "∞" instance Ord Weight where x <= Infinity = True Infinity <= y = False Offset x <= Offset y = x <= y instance MeetSemiLattice Weight where meet = min instance Top Weight where top = Infinity instance Enum Weight where succ (Offset x) = Offset (succ x) succ (Infinity) = Infinity pred (Offset x) = Offset (pred x) pred (Infinity) = Infinity toEnum = Offset . toEnum fromEnum (Offset x) = fromEnum x fromEnum (Infinity) = __IMPOSSIBLE__ -- | Partial implementation of @Num@. instance Num Weight where Infinity + y = Infinity x + Infinity = Infinity Offset x + Offset y = Offset $ x + y Infinity - Offset y = Infinity Offset x - Offset y = Offset $ x - y x - Infinity = __IMPOSSIBLE__ abs (Offset x) = Offset $ abs x abs Infinity = Infinity signum (Offset x) = Offset $ signum x signum Infinity = Offset $ 1 fromInteger x = Offset (fromInteger x) x * y = __IMPOSSIBLE__ instance Plus Weight Offset Weight where plus w k = w + (Offset k) instance Arbitrary Weight where arbitrary = frequency [ (1, return Infinity) , (5, Offset . O <$> choose (0, 200)) ] -- | Test for negativity, used to detect negative cycles. class Negative a where negative :: a -> Bool {- leads to Undecidable/OverlappingInstances: instance (Ord a, Num a) => Negative a where negative = (< 0) -} instance Negative Int where negative = (< 0) instance Negative Offset where negative (O x) = negative x instance Negative Weight where negative Infinity = False negative (Offset x) = negative x -- * Edge labels -- | Going from @Lt@ to @Le@ is @pred@, going from @Le@ to @Lt@ is @succ@. -- -- @X --(R,n)--> Y@ -- means @X (R) Y + n@. -- [ ... if @n@ positive -- and @X + (-n) (R) Y@ if @n@ negative. ] data Label = Label { lcmp :: Cmp, loffset :: Offset } | LInf -- ^ Nodes not connected. -- | Convert a label to a weight, decrementing in case of 'Lt'. toWeight :: Label -> Weight toWeight (Label Le w) = Offset w toWeight (Label Lt w) = Offset $ pred w toWeight LInf = Infinity instance Negative Label where negative = negative . toWeight instance Eq Label where Label cmp w == Label cmp' w' = cmp == cmp' && w == w' LInf == LInf = True _ == _ = False instance Ord Label where Label Lt w <= Label Lt w' = w <= w' Label Le w <= Label Le w' = w <= w' Label Lt w <= Label Le w' = pred w <= w' Label Le w <= Label Lt w' = succ w <= w' _ <= LInf = True LInf{} <= Label{} = False instance Show Label where show (Label cmp w) = show cmp ++ show w show LInf = "∞" instance MeetSemiLattice Label where -- one label is neutral LInf `meet` l = l l `meet` LInf = l -- other cases Label Lt w `meet` Label Lt w' = Label Lt $ w `meet` w' Label Le w `meet` Label Le w' = Label Le $ w `meet` w' Label Lt w `meet` Label Le w' = Label Lt $ w `meet` succ w' Label Le w `meet` Label Lt w' = Label Lt $ succ w `meet` w' instance Top Label where top = LInf isTop Label{} = False isTop LInf = True instance Arbitrary Label where arbitrary = frequency [ (1, return LInf) , (5, Label <$> arbitrary <*> arbitrary) ] -- * Semiring with idempotent '+' == dioid instance Dioid Weight where compose = (+) unitCompose = 0 instance Dioid Label where compose (Label Lt w) (Label Lt w') = Label Lt $ pred $ w + w' compose (Label cmp w) (Label cmp' w') = Label (compose cmp cmp') $ w + w' compose _ LInf = LInf compose LInf _ = LInf unitCompose = Label Le 0 -- * Graphs -- ** Nodes data Node rigid flex = NodeZero | NodeInfty | NodeRigid rigid | NodeFlex flex deriving (Eq, Ord) instance (Show rigid, Show flex) => Show (Node rigid flex) where show NodeZero = "0" show NodeInfty = "∞" show (NodeRigid x) = show x show (NodeFlex x) = show x isFlexNode :: Node rigid flex -> Maybe flex isFlexNode (NodeFlex x) = Just x isFlexNode _ = Nothing isZeroNode :: Node rigid flex -> Bool isZeroNode NodeZero{} = True isZeroNode _ = False isInftyNode :: Node rigid flex -> Bool isInftyNode NodeInfty{} = True isInftyNode _ = False nodeToSizeExpr :: Node rigid flex -> SizeExpr' rigid flex nodeToSizeExpr n = case n of NodeZero -> Const 0 NodeInfty -> Infty NodeRigid i -> Rigid i 0 NodeFlex x -> Flex x 0 -- ** Edges -- | An edge is negative if its label is. instance Negative a => Negative (Edge' r f a) where negative = negative . label -- instance Show a => Show (Edge' a) where -- show (Edge u v l) = show u ++ " -(" ++ show l ++ ")-> " ++ show v instance (Show r, Show f, Show a, Ord r, Ord f, MeetSemiLattice a) => MeetSemiLattice (Edge' r f a) where e@(Edge u v l) `meet` e'@(Edge u' v' l') | u == u' && v == v' = Edge u v $ l `meet` l' | otherwise = __IMPOSSIBLE__ -- error $ show e ++ " `meet` " ++ show e' instance (Ord r, Ord f, Top a) => Top (Edge' r f a) where top = __IMPOSSIBLE__ isTop e = isTop (label e) instance (Show r, Show f, Show a, Ord r, Ord f, Dioid a) => Dioid (Edge' r f a) where e@(Edge u v l) `compose` e'@(Edge v' w l') | v == v' = Edge u w $ l `compose` l' | otherwise = __IMPOSSIBLE__ -- error $ show e ++ " `compose` " ++ show e' unitCompose = __IMPOSSIBLE__ -- ** Graphs -- | A graph forest. type Graphs r f a = [Graph r f a] emptyGraphs :: Graphs r f a emptyGraphs = [] -- | Split a list of graphs @gs@ into those that mention node @n@ and those that do not. -- If @n@ is zero or infinity, we regard it as "not mentioned". mentions :: (Ord r, Ord f) => Node r f -> Graphs r f a -> (Graphs r f a, Graphs r f a) mentions NodeZero gs = ([], gs) mentions NodeInfty gs = ([], gs) mentions NodeRigid{} gs = ([], gs) mentions n gs = partition (Set.member n . nodes) gs -- | Add an edge to a graph forest. -- Graphs that share a node with the edge are joined. addEdge :: (Ord r, Ord f, MeetSemiLattice a, Top a) => Edge' r f a -> Graphs r f a -> Graphs r f a addEdge e@(Edge src dest l) gs = -- Note: If we started from an empty forest -- and only added edges via @addEdge@, then -- @gsSrc@ and @gsDest@ contain each at most one graph. let (gsSrc , gsNotSrc) = mentions src gs (gsDest, gsNotDest) = mentions dest gsNotSrc in insertEdge e (Graph.unionsWith meet $ gsSrc ++ gsDest) : gsNotDest -- | Reflexive closure. Add edges @0 -> n -> n -> oo@ for all nodes @n@. reflClos :: (Ord r, Ord f, Show a, Dioid a) => Set (Node r f) -> Graph r f a -> Graph r f a reflClos ns g = setFoldl step g ns' where -- have at least the nodes in @ns@ ns' = nodes g `Set.union` ns -- add the trivial edges for all nodes ns' step g n = foldl (flip insertEdge) g es where es = [ Edge NodeZero n unitCompose , Edge n n unitCompose , Edge n NodeInfty unitCompose ] -- UNUSED -- -- | Reflexive-transitive closure. -- complete :: (Show a, Dioid a) => Graph r f a -> Graph r f a -- complete = transClos . reflClos -- | A graph is 'negative' if it contains a negative loop (diagonal edge). -- Makes sense on transitive graphs. instance (Ord r, Ord f, Negative a) => Negative (Graph r f a) where negative = any negative . Graph.diagonal instance (Ord r, Ord f, Negative a) => Negative (Graphs r f a) where negative = any negative -- | @h `implies` g@ if any edge in @g@ between rigids and constants -- is implied by a corresponding edge in @h@, which means that -- the edge in @g@ carries at most the information of the one in @h@. -- -- Application: Constraint implication: Constraints are compatible -- with hypotheses. implies :: (Ord r, Ord f, Show r, Show f, Show a, Top a, Ord a, Negative a) => Graph r f a -> Graph r f a -> Bool -- iterate 'test' over all edges in g implies h g = and $ map test $ graphToList g -- NB: doing the @test k l@ before the recursive @b@ gives -- opportunity to short-cut the conjunction @&&@. where -- test :: Key -> a -> Bool test k@(Edge src dest l) | isZeroNode src, not (negative l) = True | isInftyNode dest = True | isJust $ isFlexNode src = True | isJust $ isFlexNode dest = True | isTop l = True | otherwise = case lookupEdge h src dest of Nothing -> False Just l' -> if l' <= l then True else trace ("edge " ++ show (l <$ k) ++ " not implied by " ++ show (l' <$ k)) $ False -- implies h g = Map.foldlWithKey (\ b k l -> test k l && b) True g -- -- NB: doing the @test k l@ before the recursive @b@ gives -- -- opportunity to short-cut the conjunction @&&@. -- where -- -- test :: Key -> a -> Bool -- test k@(Edge src dest ()) l -- | isZeroNode src, not (negative l) = True -- | isInftyNode dest = True -- | isJust $ isFlexNode src = True -- | isJust $ isFlexNode dest = True -- | isTop l = True -- | otherwise = case lookupEdge h src dest of -- Nothing -> False -- Just l' -> if l' <= l then True else -- trace ("edge " ++ show (l <$ k) ++ " not implied by " ++ show (l' <$ k)) $ -- False nodeFromSizeExpr :: SizeExpr' rigid flex -> (Node rigid flex, Offset) nodeFromSizeExpr e = case e of Const n -> (NodeZero , n) Rigid i n -> (NodeRigid i, n) Flex x n -> (NodeFlex x , n) Infty -> (NodeInfty , 0) edgeFromConstraint :: Constraint' rigid flex -> LabelledEdge rigid flex edgeFromConstraint (Constraint lexp cmp rexp) = let (leftNode , n) = nodeFromSizeExpr lexp (rightNode, m) = nodeFromSizeExpr rexp in Edge leftNode rightNode (Label cmp $ m - n) -- | Build a graph from list of simplified constraints. graphFromConstraints :: (Ord rigid, Ord flex) => [Constraint' rigid flex] -> Graph rigid flex Label graphFromConstraints cs = let -- convert to edges edges = map edgeFromConstraint cs -- build a graph from the edges g = foldl (flip insertEdge) Graph.empty edges in g -- | Build a graph from list of simplified constraints. graphsFromConstraints :: (Ord rigid, Ord flex) => [Constraint' rigid flex] -> Graphs rigid flex Label graphsFromConstraints cs = let -- convert to edges edges = map edgeFromConstraint cs -- get all the flexibles mentioned in constraints xs = Set.toList $ flexs cs -- for each flexible X, add edges 0 <= X and X <= oo fedges = concat $ for xs $ \ x -> [ Edge NodeZero (NodeFlex x) (Label Le 0) , Edge (NodeFlex x) NodeInfty (Label Le 0) ] -- build a graph from the edges gs = foldl (flip addEdge) emptyGraphs (fedges ++ edges) in gs -- Build hypotheses graph, complete it, check for negative loops. type Hyp = Constraint type Hyp' = Constraint' type HypGraph r f = Graph r f Label hypGraph :: (Ord rigid, Ord flex) => Set rigid -> [Hyp' rigid flex] -> Maybe (HypGraph rigid flex) hypGraph is hyps0 = do -- get a list of hypothesis from a list of constraints hyps <- concat <$> mapM (simplify1 $ \ c -> return [c]) hyps0 let g = transClos $ reflClos (Set.mapMonotonic NodeRigid is) $ graphFromConstraints hyps if negative g then Nothing else Just g hypConn :: (Ord r, Ord f) => HypGraph r f -> Node r f -> Node r f -> Label -- hypConn hg NodeZero n2 = Label Le 0 -- WRONG: not the best information -- hypConn hg n1 NodeInfty = Label Le 0 hypConn hg n1 n2 | n1 == n2 = Label Le 0 | Just l <- lookupEdge hg n1 n2 = l | otherwise = top simplifyWithHypotheses :: (Ord rigid, Ord flex) => HypGraph rigid flex -> [Constraint' rigid flex] -> Maybe [Constraint' rigid flex] simplifyWithHypotheses hg cons = concat <$> mapM (simplify1 test) cons where -- Test whether a constraint is compatible with the hypotheses: -- Succeeds, if constraint is implied by hypotheses, -- fails otherwise. test c = do let Edge n1 n2 l = edgeFromConstraint c l' = hypConn hg n1 n2 -- l' <- lookupEdge hg n1 n2 guard (l' <= l) return [c] -- if (l' <= l) then Just [c] else Nothing -- Build constraint graph, complete it, check for negative loops. -- Check that hypotheses graph implies constraint graphs (rigids). type ConGraph r f = Graph r f Label constraintGraph :: (Ord r, Ord f, Show r, Show f) => [Constraint' r f] -> HypGraph r f -> Maybe (ConGraph r f) constraintGraph cons0 hg = do -- Simplify constraints, ensure they are locally consistent with -- hypotheses. cons <- simplifyWithHypotheses hg cons0 -- Build a transitive graph from constraints. let g = transClos $ graphFromConstraints cons -- Ensure it has no negative loops. guard $ not $ negative g -- Ensure it does not constrain the hypotheses. guard $ hg `implies` g return g type ConGraphs r f = Graphs r f Label constraintGraphs :: (Ord r, Ord f, Show r, Show f) => [Constraint' r f] -> HypGraph r f -> Maybe ([f], ConGraphs r f) constraintGraphs cons0 hg = do traceM $ "original constraints cons0 = " ++ show cons0 -- Simplify constraints, ensure they are locally consistent with -- hypotheses. cons <- simplifyWithHypotheses hg cons0 traceM $ "simplified constraints cons = " ++ show cons -- Build a transitive graph forest from constraints. let gs0 = graphsFromConstraints cons traceM $ "constraint forest gs0 = " ++ show (map graphToList gs0) let gs1 = map transClos gs0 traceM $ "transitive forest gs1 = " ++ show (map graphToList gs1) -- Check for flexibles to be set to infinity let (xss,gs) = unzip $ map infinityFlexs gs1 xs = concat xss unless (null $ xs) $ do traceM $ "flexibles to set to oo = " ++ show xs traceM $ "forest after oo-subst = " ++ show (map graphToList gs) -- Ensure none has negative loops. guard $ not $ negative gs traceM $ "we are free of negative loops" -- Ensure it does not constrain the hypotheses. forM_ gs $ do \ g -> guard $ hg `implies` g traceM $ "any constraint between rigids is implied by the hypotheses" return (xs, gs) -- | If we have an edge @X + n <= X@ (with n >= 0), we must set @X = oo@. infinityFlexs :: (Ord r, Ord f) => ConGraph r f -> ([f], ConGraph r f) infinityFlexs g = (infFlexs, setToInfty infFlexs g) where -- get the flexibles that need to be set to infinity infFlexs = mapMaybe flexNeg $ Graph.diagonal g flexNeg e = do guard $ negative e isFlexNode (src e) class SetToInfty f a where setToInfty :: [f] -> a -> a instance (Eq f) => SetToInfty f (Node r f) where setToInfty xs (NodeFlex x) | x `elem` xs = NodeInfty setToInfty xs n = n instance (Eq f) => SetToInfty f (Edge' r f a) where setToInfty xs (Edge n1 n2 l) = Edge (setToInfty xs n1) (setToInfty xs n2) l instance (Ord r, Ord f) => SetToInfty f (ConGraph r f) where setToInfty xs = graphFromList . filter h . map (setToInfty xs) . graphToList where -- filter out edges @oo + k <= oo@ h (Edge NodeInfty NodeInfty (Label Le _)) = False h _ = True -- * Compute solution from constraint graph. instance Plus Offset Weight Weight where plus e Infinity = Infinity plus e (Offset x) = Offset $ plus e x instance Plus (SizeExpr' r f) Weight (SizeExpr' r f) where plus e Infinity = Infty plus e (Offset x) = plus e x instance Plus (SizeExpr' r f) Label (SizeExpr' r f) where plus e l = plus e (toWeight l) -- | Lower or upper bound for a flexible variable type Bound r f = Map f (Set (SizeExpr' r f)) emptyBound :: Bound r f emptyBound = Map.empty data Bounds r f = Bounds { lowerBounds :: Bound r f , upperBounds :: Bound r f , mustBeFinite :: Set f } -- | Compute a lower bound for a flexible from an edge. edgeToLowerBound :: (Ord r, Ord f) => LabelledEdge r f -> Maybe (f, SizeExpr' r f) edgeToLowerBound e = case e of (Edge n1 n2 LInf) -> __IMPOSSIBLE__ (Edge NodeZero (NodeFlex x) (Label Le o)) | o >= 0 -> Just (x, Const 0) (Edge NodeZero (NodeFlex x) (Label Lt o)) | o >= 1 -> Just (x, Const 0) (Edge n1 (NodeFlex x) l) -> Just (x, nodeToSizeExpr n1 `plus` (- (toWeight l))) _ -> Nothing -- | Compute an upper bound for a flexible from an edge. edgeToUpperBound :: (Ord r, Ord f) => LabelledEdge r f -> Maybe (f, Cmp, SizeExpr' r f) edgeToUpperBound e = case e of (Edge n1 n2 LInf) -> __IMPOSSIBLE__ (Edge n1 NodeInfty (Label Le _)) -> Nothing (Edge (NodeFlex x) NodeInfty (Label Lt _)) -> Just (x, Lt, Infty) (Edge (NodeFlex x) n2 l ) -> Just (x, Le, nodeToSizeExpr n2 `plus` (toWeight l)) _ -> Nothing -- | Compute the lower bounds for all flexibles in a graph. graphToLowerBounds :: (Ord r, Ord f) => [LabelledEdge r f] -> Bound r f graphToLowerBounds = flip foldl emptyBound $ \ bs e -> case edgeToLowerBound e of Nothing -> bs Just (x, Flex{}) -> bs -- ignore flexible bounds Just (x, a) -> Map.insertWith Set.union x (Set.singleton a) bs -- | Compute the upper bounds for all flexibles in a graph. graphToUpperBounds :: (Ord r, Ord f) => [LabelledEdge r f] -> (Bound r f, Set f) graphToUpperBounds = flip foldl (emptyBound, Set.empty) $ \ (bs, fs) e -> case edgeToUpperBound e of Nothing -> (bs, fs) Just (x, _, Flex{}) -> (bs, fs) -- ignore flexible bounds Just (x, Lt, Infty) -> (bs, Set.insert x fs) Just (x, Le, a) -> (Map.insertWith Set.union x (Set.singleton a) bs, fs) _ -> __IMPOSSIBLE__ -- | Compute the bounds for all flexibles in a graph. bounds :: (Ord r, Ord f) => ConGraph r f -> Bounds r f bounds g = Bounds lbs ubs fs where edges = graphToList g lbs = graphToLowerBounds edges (ubs, fs) = graphToUpperBounds edges -- | Compute the relative minima in a set of nodes (those that do not have -- a predecessor in the set). smallest ::(Ord r, Ord f) => HypGraph r f -> [Node r f] -> [Node r f] smallest hg ns | NodeZero `elem` ns = [NodeZero] | otherwise = filter hasNoPred ns where hasNoPred NodeInfty = False hasNoPred n = null $ mapMaybe strictEdge ns where -- is there an edge n -l-> n' with l <= 0 strictEdge n' = do guard (n /= n') -- exclude loops l <- lookupEdge hg n' n guard (toWeight l <= 0) return () -- | Compute the relative maxima in a set of nodes (those that do not have -- a successor in the set). largest ::(Ord r, Ord f) => HypGraph r f -> [Node r f] -> [Node r f] largest hg ns | NodeInfty `elem` ns = [NodeInfty] | otherwise = filter hasNoSucc ns where hasNoSucc NodeZero = False hasNoSucc n = null $ mapMaybe strictEdge ns where -- is there an edge n -l-> n' with l <= 0 strictEdge n' = do guard (n /= n') -- exclude loops l <- lookupEdge hg n n' guard (toWeight l <= 0) return () {-| Given source nodes n1,n2,... find all target nodes m1,m2, such that for all j, there are edges n_i --l_ij--> m_j for all i. Return these edges as a map from target notes to a list of edges. We assume the graph is reflexive-transitive. -} commonSuccs :: (Ord r, Ord f, Dioid a) => Graph r f a -> [Node r f] -> Map (Node r f) [Edge' r f a] commonSuccs hg srcs = intersectAll $ map (buildmap . outgoing hg) srcs where buildmap = Map.fromList . map (\ e -> (dest e, [e])) intersectAll [] = Map.empty intersectAll (m:ms) = foldl (Map.intersectionWith (++)) m ms {-| Given target nodes m1,m2,... find all source nodes n1,n2, such that for all j, there are edges n_i --l_ij--> m_j for all i. Return these edges as a map from target notes to a list of edges. We assume the graph is reflexive-transitive. -} commonPreds :: (Ord r, Ord f, Dioid a) => Graph r f a -> [Node r f] -> Map (Node r f) [Edge' r f a] commonPreds hg tgts = intersectAll $ map (buildmap . incoming hg) tgts where buildmap = Map.fromList . map (\ e -> (src e, [e])) intersectAll [] = Map.empty intersectAll (m:ms) = foldl (Map.intersectionWith (++)) m ms -- | Compute the sup of two different rigids or a rigid and a constant. lub' :: forall r f . (Ord r, Ord f, Show r, Show f) => HypGraph r f -> (Node r f, Offset) -> (Node r f, Offset) -> Maybe (SizeExpr' r f) lub' hg (node1, n) (node2, m) = do let sucs = commonSuccs hg [node1, node2] sucNodes = smallest hg $ Map.keys sucs traceM ("lub': sucs = " ++ show sucs) case sucNodes of -- there is a unique smallest common successor n0 of node1 and node2 [n0] -> -- then there are exactly two edges node1 --l1--> n0 and node2 --l2--> n0 -- with non-positive weigths l1, l2 case Map.lookup n0 sucs of Just [ Edge node1' n1 l1 , Edge node2' n2 l2 ] | node1 == node1', node2 == node2' , n0 == n1, n0 == n2 , toWeight l1 <= 0 , toWeight l2 <= 0 -> do let o :: Weight o = max (n `plus` toWeight l1) (m `plus` toWeight l2) return $ nodeToSizeExpr n0 `plus` o _ -> __IMPOSSIBLE__ -- otherwise, we cannot compute the sup _ -> do let a1 :: SizeExpr' r f = nodeToSizeExpr node1 `plus` n let a2 :: SizeExpr' r f = nodeToSizeExpr node2 `plus` m traceM ("cannot compute lub of " ++ show a1 ++ " and " ++ show a2 ++ " because sucNodes = " ++ show sucNodes) Nothing -- | Compute the inf of two different rigids or a rigid and a constant. glb' :: forall r f . (Ord r, Ord f, Show r, Show f) => HypGraph r f -> (Node r f, Offset) -> (Node r f, Offset) -> Maybe (SizeExpr' r f) glb' hg (node1, n) (node2, m) = do let preds = commonPreds hg [node1, node2] predNodes = largest hg $ Map.keys preds traceM ("glb': preds = " ++ show preds) case predNodes of -- there is a unique greatest common predecessor n0 of node1 and node2 [n0] -> -- then there are exactly two edges n0 --l1--> node1 and n0 --l2--> node2 -- with non-positive weigths l1, l2 case Map.lookup n0 preds of Just [ Edge n1 node1' l1 , Edge n2 node2' l2 ] | node1 == node1', node2 == node2' , n0 == n1, n0 == n2 , toWeight l1 <= 0 , toWeight l2 <= 0 -> do let o :: Weight o = max (n `plus` toWeight l1) (m `plus` toWeight l2) return $ nodeToSizeExpr n0 `plus` o _ -> __IMPOSSIBLE__ -- otherwise, we cannot compute the sup _ -> do let a1 :: SizeExpr' r f = nodeToSizeExpr node1 `plus` n let a2 :: SizeExpr' r f = nodeToSizeExpr node2 `plus` m traceM ("cannot compute glb of " ++ show a1 ++ " and " ++ show a2 ++ " because predNodes = " ++ show predNodes) Nothing -- | Compute the least upper bound (sup). lub :: (Ord r, Ord f, Show r, Show f) => HypGraph r f -> (SizeExpr' r f) -> (SizeExpr' r f) -> Maybe (SizeExpr' r f) lub hg a1 a2 = case (a1, a2) of (Flex{}, _) -> __IMPOSSIBLE__ (_, Flex{}) -> __IMPOSSIBLE__ (Infty, a2) -> Just Infty (a1, Infty) -> Just Infty (Const n , Const m ) -> Just $ Const $ max n m (Const n , Rigid j m) | m >= n -> Just a2 | otherwise -> lub' hg (NodeZero, n) (NodeRigid j, m) (Rigid i n, Const m ) | n >= m -> Just a1 | otherwise -> lub' hg (NodeRigid i, n) (NodeZero, m) (Rigid i n, Rigid j m) | i == j -> Just $ Rigid i $ max n m | otherwise -> lub' hg (NodeRigid i, n) (NodeRigid j, m) {- Finding the glb of two rigid size expressions in hypotheses graph a1 = Rigid i n a2 = Rigid j m Find the topological predecessors of (NodeRigid i) Find the topological predecessors of (NodeRigid j) -} -- | Compute the greatest lower bound (inf) of size expressions relative -- to a hypotheses graph. glb :: (Ord r, Ord f, Show r, Show f) => HypGraph r f -> (SizeExpr' r f) -> (SizeExpr' r f) -> Maybe (SizeExpr' r f) glb hg a1 a2 = case (a1, a2) of (Flex{}, _) -> __IMPOSSIBLE__ (_, Flex{}) -> __IMPOSSIBLE__ (Infty, a2) -> Just a2 (a1, Infty) -> Just a1 (Const n , Const m ) -> Just $ Const $ min n m (Const n , Rigid i m) | n <= m -> Just a1 | otherwise -> glb' hg (NodeZero, n) (NodeRigid i, m) (Rigid i n, Const m ) | m <= n -> Just a2 | otherwise -> glb' hg (NodeRigid i, n) (NodeZero, m) (Rigid i n, Rigid j m) | i == j -> Just $ Rigid i $ min n m | otherwise -> glb' hg (NodeRigid i, n) (NodeRigid j, m) {- (Rigid i n, Rigid j m) -> do let iLeqj = Map.lookup (Edge (NodeRigid i) (NodeRigid j) ()) hg jLeqi = Map.lookup (Edge (NodeRigid j) (NodeRigid i) ()) hg case (iLeqj, jLeqi) of (Nothing, Nothing) -> Nothing -- maximum as size expression (Just l, Nothing) | Offset k <- toWeight l -> if k + n <= m then Just a1 else Nothing -- no guaranteed infimum (Nothing, Just l) | Offset k <- toWeight l -> if k + m <= n then Just a2 else Nothing (Just{}, Just{}) -> Nothing {- let lbi = incoming hg (NodeRigid i) lbj = incoming hg (NodeRigid j) srci = Set.fromList $ map src lbi srcj = Set.fromList $ map src lbj srcs = Set.intersection srci srcj -} _ -> trace ("cannot compute glb of " ++ show a1 ++ " and " ++ show a2) $ Nothing -- TODO! -} findRigidBelow :: (Ord r, Ord f, Show r, Show f) => HypGraph r f -> (SizeExpr' r f) -> Maybe (SizeExpr' r f) findRigidBelow hg (Rigid i m) | m < 0 = do let v = NodeRigid i preds = incoming hg v filt e@(Edge n n' l) | n' == v = case toWeight l of Infinity -> Nothing Offset o -> if o <= m then Just (n, o) else Nothing | otherwise = __IMPOSSIBLE__ -- error $ "findRigidBelow: impossible: " ++ show e cands = mapMaybe filt preds (n, o) <- do case cands of [] -> Nothing [c] -> return c _ -> return $ maximumBy (compare `on` snd) $ filter ((NodeZero /=) . fst) cands let offset = m - o unless (offset >= 0) __IMPOSSIBLE__ return $ nodeToSizeExpr n `plus` offset findRigidBelow hg e = __IMPOSSIBLE__ -- error $ "findRigidBelow: impossible: " ++ show e solveGraph :: (Ord r, Ord f, Show r, Show f) => Polarities f -> HypGraph r f -> ConGraph r f -> Either String (Solution r f) solveGraph pols hg g = do let (Bounds lbs ubs fs) = bounds g -- flexibles to solve for xs = Set.toAscList $ Set.unions [ Map.keysSet lbs, Map.keysSet ubs, fs ] -- iterate over all flexible variables xas <- catMaybes <$> do forM xs $ \ x -> do -- get lower and upper bounds for flexible x let lx = Set.toList $ Map.findWithDefault Set.empty x lbs ux = Set.toList $ Map.findWithDefault Set.empty x ubs traceM ("lower bounds for " ++ show x ++ ": " ++ show lx) traceM ("upper bounds for " ++ show x ++ ": " ++ show ux) -- compute maximum of lower bounds lb <- do case lx of [] -> return $ Nothing (a:as) -> do case foldM (lub hg) a as of Nothing -> Left $ "inconsistent lower bound for " ++ show x Just l -> return $ Just $ truncateOffset l -- compute minimum of upper bounds ub <- do case ux of [] -> return $ Nothing (a:as) -> do case foldM (glb hg) a as of Nothing -> Left $ "inconsistent upper bound for " ++ show x Just l | validOffset l -> return $ Just l | otherwise -> return $ findRigidBelow hg l case (lb, ub) of (Just l, Nothing) -> return $ Just (x, l) -- solve x = lower bound (Nothing, Just u) -> return $ Just (x, u) -- solve x = upper bound (Just l, Just u) -> do traceM ("lower bound for " ++ show x ++ ": " ++ show l) traceM ("upper bound for " ++ show x ++ ": " ++ show u) case getPolarity pols x of Least -> return $ Just (x, l) Greatest -> return $ Just (x, u) _ -> return Nothing return $ Map.fromList xas -- | Solve a forest of constraint graphs relative to a hypotheses graph. -- Concatenate individual solutions. solveGraphs :: (Ord r, Ord f, Show r, Show f) => Polarities f -> HypGraph r f -> ConGraphs r f -> Either String (Solution r f) solveGraphs pols hg gs = Map.unions <$> mapM (solveGraph pols hg) gs -- * Verify solution -- | Check that after substitution of the solution, -- constraints are implied by hypotheses. verifySolution :: (Ord r, Ord f, Show r, Show f) => HypGraph r f -> [Constraint' r f] -> Solution r f -> Either String () verifySolution hg cs sol = do cs <- return $ subst sol cs traceM $ "substituted constraints " ++ show cs cs <- maybe (Left "solution produces inconsistency") Right $ concat <$> mapM (simplify1 $ \ c -> return [c]) cs traceM $ "simplified substituted constraints " ++ show cs -- cs <- maybe (Left "solution produces inconsistency") Right $ -- simplifyWithHypotheses hg cs let g = graphFromConstraints cs unless (hg `implies` g) $ Left "solution not implied by hypotheses" {- case simplifyWithHypotheses hg $ subst sol cs of Nothing -> Left "solution produces inconsistency" Just [] -> Right () Just cs -> Left $ "solution leaves constraints " ++ show cs -} -- * Tests testSuccs :: Ord f => Map (Node [Char] f) [Edge' [Char] f Label] testSuccs = commonSuccs hg [n1,n2] where n1 = NodeRigid "i" n2 = NodeRigid "j" n3 = NodeRigid "k" n4 = NodeRigid "l" n5 = NodeRigid "m" hg = Graph.fromList [ Graph.Edge n1 n3 $ Label Le 1 , Graph.Edge n1 n4 $ Label Le 2 , Graph.Edge n1 n5 $ Label Le 3 , Graph.Edge n2 n3 $ Label Le 4 , Graph.Edge n2 n4 $ Label Le 5 , Graph.Edge n2 n5 $ Label Le 6 ] -- testLub = smallest hg $ Map.keys $ commonSuccs hg [n1,n2] -- testLub :: (Show f, Ord f) => Maybe (SizeExpr' [Char] f) testLub = lub hg (Rigid "i" 0) (Rigid "j" 2) where n1 = NodeRigid "i" n2 = NodeRigid "j" n3 = NodeRigid "k" n4 = NodeRigid "l" n5 = NodeRigid "m" hg = Graph.fromList [ Graph.Edge n1 n3 $ Label Le 0 , Graph.Edge n1 n4 $ Label Le 2 , Graph.Edge n1 n5 $ Label Le 4 , Graph.Edge n2 n3 $ Label Le 1 , Graph.Edge n2 n4 $ Label Le 3 , Graph.Edge n2 n5 $ Label Le 5 , Graph.Edge n3 n4 $ Label Le 0 , Graph.Edge n3 n5 $ Label Lt 0 ] Agda-2.4.2.5/src/full/Agda/TypeChecking/SizedTypes/Syntax.hs0000644000000000000000000002225112635075266021611 0ustar0000000000000000{-# LANGUAGE DeriveFoldable #-} {-# LANGUAGE DeriveFunctor #-} {-# LANGUAGE DeriveTraversable #-} {-# LANGUAGE FlexibleInstances #-} {-# LANGUAGE FunctionalDependencies #-} {-# LANGUAGE GeneralizedNewtypeDeriving #-} {-# LANGUAGE MultiParamTypeClasses #-} {-# LANGUAGE NoMonomorphismRestriction #-} {-# LANGUAGE UndecidableInstances #-} -- | Syntax of size expressions and constraints. module Agda.TypeChecking.SizedTypes.Syntax where import Data.Foldable (Foldable) import Data.Map (Map) import qualified Data.Map as Map import Data.Set (Set) import qualified Data.Set as Set import Data.Traversable (Traversable) import Test.QuickCheck import Agda.TypeChecking.SizedTypes.Utils -- * Syntax -- | Constant finite sizes @n >= 0@. newtype Offset = O Int deriving (Eq, Ord, Num, Show, Enum) instance MeetSemiLattice Offset where meet = min instance Plus Offset Offset Offset where plus (O x) (O y) = O (plus x y) instance Arbitrary Offset where arbitrary = do NonNegative x <- arbitrary return x shrink (O x) = map O $ filter (>= 0) (shrink x) -- | Fixed size variables @i@. newtype Rigid = RigidId { rigidId :: String } deriving (Eq, Ord) instance Show Rigid where show = rigidId -- | Size meta variables @X@ to solve for. newtype Flex = FlexId { flexId :: String } deriving (Eq, Ord) instance Show Flex where show = flexId -- | Size expressions appearing in constraints. data SizeExpr' rigid flex = Const { offset :: Offset } -- ^ Constant number @n@. | Rigid { rigid :: rigid, offset :: Offset } -- ^ Variable plus offset @i + n@. | Infty -- ^ Infinity @∞@. | Flex { flex :: flex, offset :: Offset } -- ^ Meta variable @X + n@. deriving (Eq, Ord, Functor, Foldable, Traversable) type SizeExpr = SizeExpr' Rigid Flex -- | Comparison operator, e.g. for size expression. data Cmp = Lt -- ^ @<@. | Le -- ^ @≤@. deriving (Eq, Bounded, Enum) instance Dioid Cmp where compose = min unitCompose = Le -- | Comparison operator is ordered @'Lt' < 'Le'@. instance Ord Cmp where Lt <= x = True Le <= Lt = False Le <= Le = True instance MeetSemiLattice Cmp where meet = min instance Top Cmp where top = Le instance Arbitrary Cmp where arbitrary = arbitraryBoundedEnum -- | Constraint: an inequation between size expressions, -- e.g. @X < ∞@ or @i + 3 ≤ j@. data Constraint' rigid flex = Constraint { leftExpr :: SizeExpr' rigid flex , cmp :: Cmp , rightExpr :: SizeExpr' rigid flex } deriving (Functor, Foldable, Traversable) type Constraint = Constraint' Rigid Flex -- * Polarities to specify solutions. ------------------------------------------------------------------------ -- | What type of solution are we looking for? data Polarity = Least | Greatest deriving (Eq, Ord) -- | Assigning a polarity to a flexible variable. data PolarityAssignment flex = PolarityAssignment Polarity flex -- | Type of solution wanted for each flexible. type Polarities flex = Map flex Polarity emptyPolarities :: Polarities flex emptyPolarities = Map.empty polaritiesFromAssignments :: Ord flex => [PolarityAssignment flex] -> Polarities flex polaritiesFromAssignments = Map.fromList . map (\ (PolarityAssignment p x) -> (x,p)) -- | Default polarity is 'Least'. getPolarity :: Ord flex => Polarities flex -> flex -> Polarity getPolarity pols x = Map.findWithDefault Least x pols -- * Solutions. ------------------------------------------------------------------------ -- | Partial substitution from flexible variables to size expression. type Solution rigid flex = Map flex (SizeExpr' rigid flex) -- emptySolution = Map.empty -- | Executing a substitution. class Substitute r f a where subst :: Solution r f -> a -> a instance Ord f => Substitute r f (SizeExpr' r f) where subst sol e = case e of Flex x n -> Map.findWithDefault e x sol `plus` n _ -> e instance Ord f => Substitute r f (Constraint' r f) where subst sol (Constraint e cmp e') = Constraint (subst sol e) cmp (subst sol e') instance Substitute r f a => Substitute r f [a] where subst = map . subst -- | Add offset to size expression. instance Plus (SizeExpr' r f) Offset (SizeExpr' r f) where plus e m = case e of Const n -> Const $ n + m Rigid i n -> Rigid i $ n + m Flex x n -> Flex x $ n + m Infty -> Infty -- * Constraint simplification type CTrans r f = Constraint' r f -> Maybe [Constraint' r f] -- | Returns 'Nothing' if we have a contradictory constraint. simplify1 :: Eq r => CTrans r f-> CTrans r f simplify1 test c = case c of -- rhs is Infty Constraint a Le Infty -> Just [] Constraint Const{} Lt Infty -> Just [] Constraint Infty Lt Infty -> Nothing Constraint (Rigid i n) Lt Infty -> test $ Constraint (Rigid i 0) Lt Infty Constraint a@Flex{} Lt Infty -> Just [c { leftExpr = a { offset = 0 }}] -- rhs is Const Constraint (Const n) cmp (Const m) -> if compareOffset n cmp m then Just [] else Nothing Constraint Infty cmp Const{} -> Nothing Constraint (Rigid i n) cmp (Const m) -> if compareOffset n cmp m then test (Constraint (Rigid i 0) Le (Const (m - n - ifLe cmp 0 1))) else Nothing Constraint (Flex x n) cmp (Const m) -> if compareOffset n cmp m then Just [Constraint (Flex x 0) Le (Const (m - n - ifLe cmp 0 1))] else Nothing -- rhs is Rigid Constraint Infty cmp Rigid{} -> Nothing Constraint (Const m) cmp (Rigid i n) -> if compareOffset m cmp n then Just [] else test (Constraint (Const $ m - n) cmp (Rigid i 0)) Constraint (Rigid j m) cmp (Rigid i n) | i == j -> if compareOffset m cmp n then Just [] else Nothing Constraint (Rigid j m) cmp (Rigid i n) -> test c Constraint (Flex x m) cmp (Rigid i n) -> if compareOffset m cmp n then Just [Constraint (Flex x 0) Le (Rigid i (n - m - ifLe cmp 0 1))] else Just [Constraint (Flex x $ m - n + ifLe cmp 0 1) Le (Rigid i 0)] -- rhs is Flex Constraint Infty Le (Flex x n) -> Just [Constraint Infty Le (Flex x 0)] Constraint Infty Lt (Flex x n) -> Nothing Constraint (Const m) cmp (Flex x n) -> if compareOffset m cmp n then Just [] else Just [Constraint (Const $ m - n + ifLe cmp 0 1) Le (Flex x 0)] Constraint (Rigid i m) cmp (Flex x n) -> if compareOffset m cmp n then Just [Constraint (Rigid i 0) cmp (Flex x $ n - m)] else Just [Constraint (Rigid i $ m - n) cmp (Flex x 0)] Constraint (Flex y m) cmp (Flex x n) -> if compareOffset m cmp n then Just [Constraint (Flex y 0) cmp (Flex x $ n - m)] else Just [Constraint (Flex y $ m - n) cmp (Flex x 0)] -- | 'Le' acts as 'True', 'Lt' as 'False'. ifLe :: Cmp -> a -> a -> a ifLe Le a b = a ifLe Lt a b = b -- | Interpret 'Cmp' as relation on 'Offset'. compareOffset :: Offset -> Cmp -> Offset -> Bool compareOffset n Le m = n <= m compareOffset n Lt m = n < m -- * Printing instance (Show r, Show f) => Show (SizeExpr' r f) where show (Const n) = show n show (Infty) = "∞" show (Rigid i 0) = show i show (Rigid i n) = show i ++ "+" ++ show n show (Flex x 0) = show x show (Flex x n) = show x ++ "+" ++ show n instance Show Polarity where show Least = "-" show Greatest = "+" instance Show flex => Show (PolarityAssignment flex) where show (PolarityAssignment pol flex) = show pol ++ show flex instance Show Cmp where show Le = "≤" show Lt = "<" instance (Show r, Show f) => Show (Constraint' r f) where show (Constraint a cmp b) = show a ++ show cmp ++ show b -- * Wellformedness -- | Offsets @+ n@ must be non-negative class ValidOffset a where validOffset :: a -> Bool instance ValidOffset Offset where validOffset = (>= 0) instance ValidOffset (SizeExpr' r f) where validOffset e = case e of Infty -> True _ -> validOffset (offset e) -- | Make offsets non-negative by rounding up. class TruncateOffset a where truncateOffset :: a -> a instance TruncateOffset Offset where truncateOffset n | n >= 0 = n | otherwise = 0 instance TruncateOffset (SizeExpr' r f) where truncateOffset e = case e of Infty -> e Const n -> Const $ truncateOffset n Rigid i n -> Rigid i $ truncateOffset n Flex x n -> Flex x $ truncateOffset n -- * Computing variable sets -- | The rigid variables contained in a pice of syntax. class Rigids r a where rigids :: a -> Set r instance (Ord r, Rigids r a) => Rigids r [a] where rigids as = Set.unions (map rigids as) instance Rigids r (SizeExpr' r f) where rigids (Rigid x _) = Set.singleton x rigids _ = Set.empty instance Ord r => Rigids r (Constraint' r f) where rigids (Constraint l _ r) = Set.union (rigids l) (rigids r) -- | The flexibe variables contained in a pice of syntax. class Flexs flex a | a -> flex where flexs :: a -> Set flex instance (Ord flex, Flexs flex a) => Flexs flex [a] where flexs as = Set.unions (map flexs as) instance (Ord flex) => Flexs flex (SizeExpr' rigid flex) where flexs (Flex x _) = Set.singleton x flexs _ = Set.empty instance (Ord flex) => Flexs flex (Constraint' rigid flex) where flexs (Constraint l _ r) = Set.union (flexs l) (flexs r) Agda-2.4.2.5/src/full/Agda/TypeChecking/SizedTypes/Utils.hs0000644000000000000000000000144712635075266021427 0ustar0000000000000000{-# LANGUAGE MultiParamTypeClasses #-} module Agda.TypeChecking.SizedTypes.Utils where import Control.Applicative import Data.Functor import qualified Debug.Trace as Debug import Agda.Utils.Function debug :: Bool debug = False trace :: String -> a -> a trace s = applyWhen debug $ Debug.trace s traceM :: Applicative f => String -> f () traceM s = trace s $ pure () class Eq a => Top a where top :: a isTop :: a -> Bool isTop = (==top) class Plus a b c where plus :: a -> b -> c instance Plus Int Int Int where plus = (+) class MeetSemiLattice a where meet :: a -> a -> a -- | Semiring with idempotent '+' == dioid class (MeetSemiLattice a, Top a) => Dioid a where compose :: a -> a -> a -- ^ E.g. + unitCompose :: a -- ^ neutral element of @compose@, e.g. zero Agda-2.4.2.5/src/full/Agda/TypeChecking/Serialise/0000755000000000000000000000000012635075266017602 5ustar0000000000000000Agda-2.4.2.5/src/full/Agda/TypeChecking/Serialise/Instances.hs0000644000000000000000000000137012635075266022066 0ustar0000000000000000{-# OPTIONS_GHC -fno-warn-orphans #-} -- Only instances exported module Agda.TypeChecking.Serialise.Instances () where import Agda.TypeChecking.Monad.Base import Agda.TypeChecking.Serialise.Base import Agda.TypeChecking.Serialise.Instances.Abstract () import Agda.TypeChecking.Serialise.Instances.Common () import Agda.TypeChecking.Serialise.Instances.Compilers () import Agda.TypeChecking.Serialise.Instances.Highlighting () import Agda.TypeChecking.Serialise.Instances.Internal () instance EmbPrj Interface where icod_ (Interface a b c d e f g h i j k) = icode11' a b c d e f g h i j k value = vcase valu where valu [a, b, c, d, e, f, g, h, i, j, k] = valu11 Interface a b c d e f g h i j k valu _ = malformed Agda-2.4.2.5/src/full/Agda/TypeChecking/Serialise/Base.hs0000644000000000000000000006027112635075266021016 0ustar0000000000000000{-# LANGUAGE CPP #-} {-# LANGUAGE ExistentialQuantification #-} {-# LANGUAGE ScopedTypeVariables #-} module Agda.TypeChecking.Serialise.Base where import Control.Applicative import Control.Monad import Control.Monad.Reader import Control.Monad.State.Strict (StateT, gets) import Data.Array.IArray import qualified Data.ByteString.Lazy as L import Data.Hashable import qualified Data.HashTable.IO as H import Data.Int (Int32) import Data.Maybe import qualified Data.Binary as B import qualified Data.Binary.Get as B import Data.Typeable ( cast, Typeable, typeOf, TypeRep ) import Agda.Syntax.Common (NameId) import Agda.Syntax.Internal (Term, QName(..), ModuleName(..), nameId) import Agda.TypeChecking.Monad.Base (TypeError(GenericError), ModuleToSource) import Agda.Utils.FileName import Agda.Utils.IORef import Agda.Utils.Lens import Agda.Utils.Monad import Agda.Utils.Pointer import Agda.Utils.Except (ExceptT, throwError) -- | Constructor tag (maybe omitted) and argument indices. type Node = [Int32] -- | The type of hashtables used in this module. -- -- A very limited amount of testing indicates that 'H.CuckooHashTable' -- is somewhat slower than 'H.BasicHashTable', and that -- 'H.LinearHashTable' and the hashtables from "Data.Hashtable" are -- much slower. #if defined(mingw32_HOST_OS) && defined(x86_64_HOST_ARCH) type HashTable k v = H.CuckooHashTable k v #else type HashTable k v = H.BasicHashTable k v #endif -- | Structure providing fresh identifiers for hash map -- and counting hash map hits (i.e. when no fresh identifier required). data FreshAndReuse = FreshAndReuse { farFresh :: !Int32 -- ^ Number of hash map misses. , farReuse :: !Int32 -- ^ Number of hash map hits. } farEmpty :: FreshAndReuse farEmpty = FreshAndReuse 0 0 lensFresh :: Lens' Int32 FreshAndReuse lensFresh f r = f (farFresh r) <&> \ i -> r { farFresh = i } lensReuse :: Lens' Int32 FreshAndReuse lensReuse f r = f (farReuse r) <&> \ i -> r { farReuse = i } -- | Two 'A.QName's are equal if their @QNameId@ is equal. type QNameId = [NameId] -- | Computing a qualified names composed ID. qnameId :: QName -> QNameId qnameId (QName (MName ns) n) = map nameId $ n:ns -- | State of the the encoder. data Dict = Dict -- Dictionaries which are serialized: { nodeD :: !(HashTable Node Int32) -- ^ Written to interface file. , stringD :: !(HashTable String Int32) -- ^ Written to interface file. , integerD :: !(HashTable Integer Int32) -- ^ Written to interface file. , doubleD :: !(HashTable Double Int32) -- ^ Written to interface file. -- Dicitionaries which are not serialized, but provide -- short cuts to speed up serialization: , termD :: !(HashTable (Ptr Term) Int32) -- ^ Not written to interface file. -- Andreas, Makoto, AIM XXI -- Memoizing A.Name does not buy us much if we already memoize A.QName. , nameD :: !(HashTable NameId Int32) -- ^ Not written to interface file. , qnameD :: !(HashTable QNameId Int32) -- ^ Not written to interface file. -- Fresh UIDs and reuse statistics: , nodeC :: !(IORef FreshAndReuse) -- counters for fresh indexes , stringC :: !(IORef FreshAndReuse) , integerC :: !(IORef FreshAndReuse) , doubleC :: !(IORef FreshAndReuse) , termC :: !(IORef FreshAndReuse) , nameC :: !(IORef FreshAndReuse) , qnameC :: !(IORef FreshAndReuse) , stats :: !(HashTable String Int) , collectStats :: Bool -- ^ If @True@ collect in @stats@ the quantities of -- calls to @icode@ for each @Typeable a@. , absPathD :: !(HashTable AbsolutePath Int32) -- ^ Not written to interface file. } -- | Creates an empty dictionary. emptyDict :: Bool -- ^ Collect statistics for @icode@ calls? -> IO Dict emptyDict collectStats = Dict <$> H.new <*> H.new <*> H.new <*> H.new <*> H.new <*> H.new <*> H.new <*> newIORef farEmpty <*> newIORef farEmpty <*> newIORef farEmpty <*> newIORef farEmpty <*> newIORef farEmpty <*> newIORef farEmpty <*> newIORef farEmpty <*> H.new <*> pure collectStats <*> H.new -- | Universal type, wraps everything. data U = forall a . Typeable a => U !a -- | Univeral memo structure, to introduce sharing during decoding type Memo = HashTable (Int32, TypeRep) U -- (node index, type rep) -- | State of the decoder. data St = St { nodeE :: !(Array Int32 Node) -- ^ Obtained from interface file. , stringE :: !(Array Int32 String) -- ^ Obtained from interface file. , integerE :: !(Array Int32 Integer) -- ^ Obtained from interface file. , doubleE :: !(Array Int32 Double) -- ^ Obtained from interface file. , nodeMemo :: !Memo -- ^ Created and modified by decoder. -- Used to introduce sharing while deserializing objects. , modFile :: !ModuleToSource -- ^ Maps module names to file names. Constructed by the decoder. , includes :: [AbsolutePath] -- ^ The include directories. } -- | Monad used by the encoder. type S a = ReaderT Dict IO a -- | Monad used by the decoder. -- -- 'TCM' is not used because the associated overheads would make -- decoding slower. type R a = ExceptT TypeError (StateT St IO) a -- | Throws an error which is suitable when the data stream is -- malformed. malformed :: R a malformed = throwError $ GenericError "Malformed input." class Typeable a => EmbPrj a where icode :: a -> S Int32 -- ^ Serialization (wrapper). icod_ :: a -> S Int32 -- ^ Serialization (worker). value :: Int32 -> R a -- ^ Deserialization. icode a = do tickICode a icod_ a -- | Increase entry for @a@ in 'stats'. tickICode :: forall a. Typeable a => a -> S () tickICode _ = whenM (asks collectStats) $ do let key = "icode " ++ show (typeOf (undefined :: a)) hmap <- asks stats liftIO $ do n <- fromMaybe 0 <$> H.lookup hmap key H.insert hmap key $! n + 1 -- | Data.Binary.runGetState is deprecated in favour of runGetIncremental. -- Reimplementing it in terms of the new function. The new Decoder type contains -- strict byte strings so we need to be careful not to feed the entire lazy byte -- string to the decoder at once. runGetState :: B.Get a -> L.ByteString -> B.ByteOffset -> (a, L.ByteString, B.ByteOffset) runGetState g s n = feed (B.runGetIncremental g) (L.toChunks s) where feed (B.Done s n' x) ss = (x, L.fromChunks (s : ss), n + n') feed (B.Fail _ _ err) _ = error err feed (B.Partial f) (s : ss) = feed (f $ Just s) ss feed (B.Partial f) [] = feed (f Nothing) [] -- Specializing icodeX leads to Warning like -- src/full/Agda/TypeChecking/Serialise.hs:1297:1: Warning: -- RULE left-hand side too complicated to desugar -- case cobox_aQY5 of _ [Occ=Dead] { ghc-prim:GHC.Types.Eq# cobox -> -- icodeX @ String $dEq_aQY3 $dHashable_aQY4 -- } -- -- type ICodeX k -- = (Dict -> HashTable k Int32) -- -> (Dict -> IORef Int32) -- -> k -> S Int32 -- {-# SPECIALIZE icodeX :: ICodeX String #-} -- {-# SPECIALIZE icodeX :: ICodeX Integer #-} -- {-# SPECIALIZE icodeX :: ICodeX Double #-} -- {-# SPECIALIZE icodeX :: ICodeX Node #-} -- Andreas, 2014-10-16 AIM XX: -- Inlining this increases Serialization time by 10% -- Makoto's theory: code size increase might lead to -- instruction cache misses. -- {-# INLINE icodeX #-} icodeX :: (Eq k, Hashable k) => (Dict -> HashTable k Int32) -> (Dict -> IORef FreshAndReuse) -> k -> S Int32 icodeX dict counter key = do d <- asks dict c <- asks counter liftIO $ do mi <- H.lookup d key case mi of Just i -> do modifyIORef' c $ over lensReuse (+1) return i Nothing -> do fresh <- (^.lensFresh) <$> do readModifyIORef' c $ over lensFresh (+1) H.insert d key fresh return fresh -- Instead of inlining icodeX, we manually specialize it to -- its four uses: Integer, String, Double, Node. -- Not a great gain (hardly noticeable), but not harmful. icodeInteger :: Integer -> S Int32 icodeInteger key = do d <- asks integerD c <- asks integerC liftIO $ do mi <- H.lookup d key case mi of Just i -> do modifyIORef' c $ over lensReuse (+1) return i Nothing -> do fresh <- (^.lensFresh) <$> do readModifyIORef' c $ over lensFresh (+1) H.insert d key fresh return fresh icodeDouble :: Double -> S Int32 icodeDouble key = do d <- asks doubleD c <- asks doubleC liftIO $ do mi <- H.lookup d key case mi of Just i -> do modifyIORef' c $ over lensReuse (+1) return i Nothing -> do fresh <- (^.lensFresh) <$> do readModifyIORef' c $ over lensFresh (+1) H.insert d key fresh return fresh icodeString :: String -> S Int32 icodeString key = do d <- asks stringD c <- asks stringC liftIO $ do mi <- H.lookup d key case mi of Just i -> do modifyIORef' c $ over lensReuse (+1) return i Nothing -> do fresh <- (^.lensFresh) <$> do readModifyIORef' c $ over lensFresh (+1) H.insert d key fresh return fresh icodeN :: Node -> S Int32 icodeN key = do d <- asks nodeD c <- asks nodeC liftIO $ do mi <- H.lookup d key case mi of Just i -> do modifyIORef' c $ over lensReuse (+1) return i Nothing -> do fresh <- (^.lensFresh) <$> do readModifyIORef' c $ over lensFresh (+1) H.insert d key fresh return fresh -- icodeN :: [Int32] -> S Int32 -- icodeN = icodeX nodeD nodeC -- | @icode@ only if thing has not seen before. icodeMemo :: (Eq a, Ord a, Hashable a) => (Dict -> HashTable a Int32) -- ^ Memo structure for thing of key @a@. -> (Dict -> IORef FreshAndReuse) -- ^ Statistics. -> a -- ^ Key to the thing. -> S Int32 -- ^ Fallback computation to encode the thing. -> S Int32 -- ^ Encoded thing. icodeMemo getDict getCounter a icodeP = do h <- asks getDict mi <- liftIO $ H.lookup h a st <- asks getCounter case mi of Just i -> liftIO $ do modifyIORef' st $ over lensReuse (+ 1) return i Nothing -> do liftIO $ modifyIORef' st $ over lensFresh (+1) i <- icodeP liftIO $ H.insert h a i return i {-# INLINE vcase #-} -- | @vcase value ix@ decodes thing represented by @ix :: Int32@ -- via the @valu@ function and stores it in 'nodeMemo'. -- If @ix@ is present in 'nodeMemo', @valu@ is not used, but -- the thing is read from 'nodeMemo' instead. vcase :: forall a . EmbPrj a => (Node -> R a) -> Int32 -> R a vcase valu = \ix -> do memo <- gets nodeMemo -- compute run-time representation of type a let aTyp = typeOf (undefined :: a) -- to introduce sharing, see if we have seen a thing -- represented by ix before maybeU <- liftIO $ H.lookup memo (ix, aTyp) case maybeU of -- yes, we have seen it before, use the version from memo Just (U u) -> maybe malformed return (cast u) -- no, it's new, so generate it via valu and insert it into memo Nothing -> do v <- valu . (! ix) =<< gets nodeE liftIO $ H.insert memo (ix, aTyp) (U v) return v -- Andreas, Makoto, AIM XX (2014-10-15): -- No performance gain for INLINE here (neutral / slighly negative). -- -- {-# INLINE icode0 #-} -- {-# INLINE icode1 #-} -- {-# INLINE icode2 #-} -- {-# INLINE icode3 #-} -- {-# INLINE icode4 #-} -- {-# INLINE icode5 #-} -- {-# INLINE icode6 #-} -- {-# INLINE icode7 #-} -- {-# INLINE icode8 #-} -- {-# INLINE icode9 #-} -- {-# INLINE icode10 #-} -- {-# INLINE icode11 #-} -- {-# INLINE icode12 #-} -- {-# INLINE icode13 #-} -- {-# INLINE icode14 #-} icode0 :: Int32 -> S Int32 icode1 :: EmbPrj a => Int32 -> a -> S Int32 icode2 :: (EmbPrj a, EmbPrj b) => Int32 -> a -> b -> S Int32 icode3 :: (EmbPrj a, EmbPrj b, EmbPrj c) => Int32 -> a -> b -> c -> S Int32 icode4 :: (EmbPrj a, EmbPrj b, EmbPrj c, EmbPrj d) => Int32 -> a -> b -> c -> d -> S Int32 icode5 :: (EmbPrj a, EmbPrj b, EmbPrj c, EmbPrj d, EmbPrj e) => Int32 -> a -> b -> c -> d -> e -> S Int32 icode6 :: (EmbPrj a, EmbPrj b, EmbPrj c, EmbPrj d, EmbPrj e, EmbPrj f) => Int32 -> a -> b -> c -> d -> e -> f -> S Int32 icode7 :: ( EmbPrj a, EmbPrj b, EmbPrj c, EmbPrj d, EmbPrj e, EmbPrj f , EmbPrj g ) => Int32 -> a -> b -> c -> d -> e -> f -> g -> S Int32 icode8 :: ( EmbPrj a, EmbPrj b, EmbPrj c, EmbPrj d, EmbPrj e, EmbPrj f , EmbPrj g, EmbPrj h ) => Int32 -> a -> b -> c -> d -> e -> f -> g -> h -> S Int32 icode9 :: ( EmbPrj a, EmbPrj b, EmbPrj c, EmbPrj d, EmbPrj e, EmbPrj f , EmbPrj g, EmbPrj h, EmbPrj i ) => Int32 -> a -> b -> c -> d -> e -> f -> g -> h -> i -> S Int32 icode10 :: ( EmbPrj a, EmbPrj b, EmbPrj c, EmbPrj d, EmbPrj e, EmbPrj f , EmbPrj g, EmbPrj h, EmbPrj i, EmbPrj j ) => Int32 -> a -> b -> c -> d -> e -> f -> g -> h -> i -> j -> S Int32 icode11 :: ( EmbPrj a, EmbPrj b, EmbPrj c, EmbPrj d, EmbPrj e, EmbPrj f , EmbPrj g, EmbPrj h, EmbPrj i, EmbPrj j, EmbPrj k ) => Int32 -> a -> b -> c -> d -> e -> f -> g -> h -> i -> j -> k -> S Int32 icode12 :: ( EmbPrj a, EmbPrj b, EmbPrj c, EmbPrj d, EmbPrj e, EmbPrj f , EmbPrj g, EmbPrj h, EmbPrj i, EmbPrj j, EmbPrj k, EmbPrj l ) => Int32 -> a -> b -> c -> d -> e -> f -> g -> h -> i -> j -> k -> l -> S Int32 icode13 :: ( EmbPrj a, EmbPrj b, EmbPrj c, EmbPrj d, EmbPrj e, EmbPrj f , EmbPrj g, EmbPrj h, EmbPrj i, EmbPrj j, EmbPrj k, EmbPrj l , EmbPrj m ) => Int32 -> a -> b -> c -> d -> e -> f -> g -> h -> i -> j -> k -> l -> m -> S Int32 icode14 :: ( EmbPrj a, EmbPrj b, EmbPrj c, EmbPrj d, EmbPrj e, EmbPrj f , EmbPrj g, EmbPrj h, EmbPrj i, EmbPrj j, EmbPrj k, EmbPrj l , EmbPrj m, EmbPrj n ) => Int32 -> a -> b -> c -> d -> e -> f -> g -> h -> i -> j -> k -> l -> m -> n -> S Int32 icode0 tag = icodeN [tag] icode1 tag a = icodeN . (tag :) =<< sequence [icode a] icode2 tag a b = icodeN . (tag :) =<< sequence [icode a, icode b] icode3 tag a b c = icodeN . (tag :) =<< sequence [icode a, icode b, icode c] icode4 tag a b c d = icodeN . (tag :) =<< sequence [icode a, icode b, icode c, icode d] icode5 tag a b c d e = icodeN . (tag :) =<< sequence [icode a, icode b, icode c, icode d, icode e] icode6 tag a b c d e f = icodeN . (tag :) =<< sequence [icode a, icode b, icode c, icode d, icode e, icode f] icode7 tag a b c d e f g = icodeN . (tag :) =<< sequence [icode a, icode b, icode c, icode d, icode e, icode f, icode g] icode8 tag a b c d e f g h = icodeN . (tag :) =<< sequence [icode a, icode b, icode c, icode d, icode e, icode f, icode g, icode h] icode9 tag a b c d e f g h i = icodeN . (tag :) =<< sequence [icode a, icode b, icode c, icode d, icode e, icode f, icode g, icode h, icode i] icode10 tag a b c d e f g h i j = icodeN . (tag :) =<< sequence [icode a, icode b, icode c, icode d, icode e, icode f, icode g, icode h, icode i, icode j] icode11 tag a b c d e f g h i j k = icodeN . (tag :) =<< sequence [icode a, icode b, icode c, icode d, icode e, icode f, icode g, icode h, icode i, icode j, icode k] icode12 tag a b c d e f g h i j k l = icodeN . (tag :) =<< sequence [icode a, icode b, icode c, icode d, icode e, icode f, icode g, icode h, icode i, icode j, icode k, icode l] icode13 tag a b c d e f g h i j k l m = icodeN . (tag :) =<< sequence [icode a, icode b, icode c, icode d, icode e, icode f, icode g, icode h, icode i, icode j, icode k, icode l, icode m] icode14 tag a b c d e f g h i j k l m n = icodeN . (tag :) =<< sequence [icode a, icode b, icode c, icode d, icode e, icode f, icode g, icode h, icode i, icode j, icode k, icode l, icode m, icode n] -- Andreas, Makoto, AIM XX (2014-10-15): -- No performance gain for INLINE here (neutral / slighly negative). -- -- {-# INLINE icode0' #-} -- {-# INLINE icode1' #-} -- {-# INLINE icode2' #-} -- {-# INLINE icode3' #-} -- {-# INLINE icode4' #-} -- {-# INLINE icode5' #-} -- {-# INLINE icode6' #-} -- {-# INLINE icode7' #-} -- {-# INLINE icode8' #-} -- {-# INLINE icode9' #-} -- {-# INLINE icode10' #-} -- {-# INLINE icode11' #-} -- {-# INLINE icode12' #-} -- {-# INLINE icode13' #-} -- {-# INLINE icode14' #-} icode0' :: S Int32 icode1' :: EmbPrj a => a -> S Int32 icode2' :: (EmbPrj a, EmbPrj b) => a -> b -> S Int32 icode3' :: (EmbPrj a, EmbPrj b, EmbPrj c) => a -> b -> c -> S Int32 icode4' :: (EmbPrj a, EmbPrj b, EmbPrj c, EmbPrj d) => a -> b -> c -> d -> S Int32 icode5' :: (EmbPrj a, EmbPrj b, EmbPrj c, EmbPrj d, EmbPrj e) => a -> b -> c -> d -> e -> S Int32 icode6' :: (EmbPrj a, EmbPrj b, EmbPrj c, EmbPrj d, EmbPrj e, EmbPrj f) => a -> b -> c -> d -> e -> f -> S Int32 icode7' :: ( EmbPrj a, EmbPrj b, EmbPrj c, EmbPrj d, EmbPrj e, EmbPrj f , EmbPrj g ) => a -> b -> c -> d -> e -> f -> g -> S Int32 icode8' :: ( EmbPrj a, EmbPrj b, EmbPrj c, EmbPrj d, EmbPrj e, EmbPrj f , EmbPrj g, EmbPrj h ) => a -> b -> c -> d -> e -> f -> g -> h -> S Int32 icode9' :: ( EmbPrj a, EmbPrj b, EmbPrj c, EmbPrj d, EmbPrj e, EmbPrj f , EmbPrj g, EmbPrj h, EmbPrj i ) => a -> b -> c -> d -> e -> f -> g -> h -> i -> S Int32 icode10' :: ( EmbPrj a, EmbPrj b, EmbPrj c, EmbPrj d, EmbPrj e, EmbPrj f , EmbPrj g, EmbPrj h, EmbPrj i, EmbPrj j ) => a -> b -> c -> d -> e -> f -> g -> h -> i -> j -> S Int32 icode11' :: ( EmbPrj a, EmbPrj b, EmbPrj c, EmbPrj d, EmbPrj e, EmbPrj f , EmbPrj g, EmbPrj h, EmbPrj i, EmbPrj j, EmbPrj k ) => a -> b -> c -> d -> e -> f -> g -> h -> i -> j -> k -> S Int32 icode12' :: ( EmbPrj a, EmbPrj b, EmbPrj c, EmbPrj d, EmbPrj e, EmbPrj f , EmbPrj g, EmbPrj h, EmbPrj i, EmbPrj j, EmbPrj k, EmbPrj l ) => a -> b -> c -> d -> e -> f -> g -> h -> i -> j -> k -> l -> S Int32 icode13' :: ( EmbPrj a, EmbPrj b, EmbPrj c, EmbPrj d, EmbPrj e, EmbPrj f , EmbPrj g, EmbPrj h, EmbPrj i, EmbPrj j, EmbPrj k, EmbPrj l , EmbPrj m ) => a -> b -> c -> d -> e -> f -> g -> h -> i -> j -> k -> l -> m -> S Int32 icode14' :: ( EmbPrj a, EmbPrj b, EmbPrj c, EmbPrj d, EmbPrj e, EmbPrj f , EmbPrj g, EmbPrj h, EmbPrj i, EmbPrj j, EmbPrj k, EmbPrj l , EmbPrj m, EmbPrj n ) => a -> b -> c -> d -> e -> f -> g -> h -> i -> j -> k -> l -> m -> n -> S Int32 icode0' = icodeN [] icode1' a = icodeN =<< sequence [icode a] icode2' a b = icodeN =<< sequence [icode a, icode b] icode3' a b c = icodeN =<< sequence [icode a, icode b, icode c] icode4' a b c d = icodeN =<< sequence [icode a, icode b, icode c, icode d] icode5' a b c d e = icodeN =<< sequence [icode a, icode b, icode c, icode d, icode e] icode6' a b c d e f = icodeN =<< sequence [icode a, icode b, icode c, icode d, icode e, icode f] icode7' a b c d e f g = icodeN =<< sequence [icode a, icode b, icode c, icode d, icode e, icode f, icode g] icode8' a b c d e f g h = icodeN =<< sequence [icode a, icode b, icode c, icode d, icode e, icode f, icode g, icode h] icode9' a b c d e f g h i = icodeN =<< sequence [icode a, icode b, icode c, icode d, icode e, icode f, icode g, icode h, icode i] icode10' a b c d e f g h i j = icodeN =<< sequence [icode a, icode b, icode c, icode d, icode e, icode f, icode g, icode h, icode i, icode j] icode11' a b c d e f g h i j k = icodeN =<< sequence [icode a, icode b, icode c, icode d, icode e, icode f, icode g, icode h, icode i, icode j, icode k] icode12' a b c d e f g h i j k l = icodeN =<< sequence [icode a, icode b, icode c, icode d, icode e, icode f, icode g, icode h, icode i, icode j, icode k, icode l] icode13' a b c d e f g h i j k l m = icodeN =<< sequence [icode a, icode b, icode c, icode d, icode e, icode f, icode g, icode h, icode i, icode j, icode k, icode l, icode m] icode14' a b c d e f g h i j k l m n = icodeN =<< sequence [icode a, icode b, icode c, icode d, icode e, icode f, icode g, icode h, icode i, icode j, icode k, icode l, icode m, icode n] valu0 :: a -> R a valu1 :: EmbPrj a => (a -> b) -> Int32 -> R b valu2 :: (EmbPrj a, EmbPrj b) => (a -> b -> c) -> Int32 -> Int32 -> R c valu3 :: (EmbPrj a, EmbPrj b, EmbPrj c) => (a -> b -> c -> d) -> Int32 -> Int32 -> Int32 -> R d valu4 :: (EmbPrj a, EmbPrj b, EmbPrj c, EmbPrj d) => (a -> b -> c -> d -> e) -> Int32 -> Int32 -> Int32 -> Int32 -> R e valu5 :: (EmbPrj a, EmbPrj b, EmbPrj c, EmbPrj d, EmbPrj e) => (a -> b -> c -> d -> e -> f) -> Int32 -> Int32 -> Int32 -> Int32 -> Int32 -> R f valu6 :: (EmbPrj a, EmbPrj b, EmbPrj c, EmbPrj d, EmbPrj e, EmbPrj f) => (a -> b -> c -> d -> e -> f -> g) -> Int32 -> Int32 -> Int32 -> Int32 -> Int32 -> Int32 -> R g valu7 :: ( EmbPrj a, EmbPrj b, EmbPrj c, EmbPrj d, EmbPrj e, EmbPrj f , EmbPrj g ) => (a -> b -> c -> d -> e -> f -> g -> h) -> Int32 -> Int32 -> Int32 -> Int32 -> Int32 -> Int32 -> Int32 -> R h valu8 :: ( EmbPrj a, EmbPrj b, EmbPrj c, EmbPrj d, EmbPrj e, EmbPrj f , EmbPrj g, EmbPrj h ) => (a -> b -> c -> d -> e -> f -> g -> h -> i) -> Int32 -> Int32 -> Int32 -> Int32 -> Int32 -> Int32 -> Int32 -> Int32 -> R i valu9 :: ( EmbPrj a, EmbPrj b, EmbPrj c, EmbPrj d, EmbPrj e, EmbPrj f , EmbPrj g, EmbPrj h, EmbPrj i ) => (a -> b -> c -> d -> e -> f -> g -> h -> i -> j) -> Int32 -> Int32 -> Int32 -> Int32 -> Int32 -> Int32 -> Int32 -> Int32 -> Int32 -> R j valu10 :: ( EmbPrj a, EmbPrj b, EmbPrj c, EmbPrj d, EmbPrj e, EmbPrj f , EmbPrj g, EmbPrj h, EmbPrj i, EmbPrj j ) => (a -> b -> c -> d -> e -> f -> g -> h -> i -> j -> k) -> Int32 -> Int32 -> Int32 -> Int32 -> Int32 -> Int32 -> Int32 -> Int32 -> Int32 -> Int32 -> R k valu11 :: ( EmbPrj a, EmbPrj b, EmbPrj c, EmbPrj d, EmbPrj e, EmbPrj f , EmbPrj g, EmbPrj h, EmbPrj i, EmbPrj j, EmbPrj k ) => (a -> b -> c -> d -> e -> f -> g -> h -> i -> j -> k -> l) -> Int32 -> Int32 -> Int32 -> Int32 -> Int32 -> Int32 -> Int32 -> Int32 -> Int32 -> Int32 -> Int32 -> R l valu12 :: ( EmbPrj a, EmbPrj b, EmbPrj c, EmbPrj d, EmbPrj e, EmbPrj f , EmbPrj g, EmbPrj h, EmbPrj i, EmbPrj j, EmbPrj k, EmbPrj l ) => (a -> b -> c -> d -> e -> f -> g -> h -> i -> j -> k -> l -> m) -> Int32 -> Int32 -> Int32 -> Int32 -> Int32 -> Int32 -> Int32 -> Int32 -> Int32 -> Int32 -> Int32 -> Int32 -> R m valu13 :: ( EmbPrj a, EmbPrj b, EmbPrj c, EmbPrj d, EmbPrj e, EmbPrj f , EmbPrj g, EmbPrj h, EmbPrj i, EmbPrj j, EmbPrj k, EmbPrj l , EmbPrj m ) => (a -> b -> c -> d -> e -> f -> g -> h -> i -> j -> k -> l -> m -> n) -> Int32 -> Int32 -> Int32 -> Int32 -> Int32 -> Int32 -> Int32 -> Int32 -> Int32 -> Int32 -> Int32 -> Int32 -> Int32 -> R n valu14 :: ( EmbPrj a, EmbPrj b, EmbPrj c, EmbPrj d, EmbPrj e, EmbPrj f , EmbPrj g, EmbPrj h, EmbPrj i, EmbPrj j, EmbPrj k, EmbPrj l , EmbPrj m, EmbPrj n ) => (a -> b -> c -> d -> e -> f -> g -> h -> i -> j -> k -> l -> m -> n -> o) -> Int32 -> Int32 -> Int32 -> Int32 -> Int32 -> Int32 -> Int32 -> Int32 -> Int32 -> Int32 -> Int32 -> Int32 -> Int32 -> Int32 -> R o valu0 z = return z valu1 z a = valu0 z `ap` value a valu2 z a b = valu1 z a `ap` value b valu3 z a b c = valu2 z a b `ap` value c valu4 z a b c d = valu3 z a b c `ap` value d valu5 z a b c d e = valu4 z a b c d `ap` value e valu6 z a b c d e f = valu5 z a b c d e `ap` value f valu7 z a b c d e f g = valu6 z a b c d e f `ap` value g valu8 z a b c d e f g h = valu7 z a b c d e f g `ap` value h valu9 z a b c d e f g h i = valu8 z a b c d e f g h `ap` value i valu10 z a b c d e f g h i j = valu9 z a b c d e f g h i `ap` value j valu11 z a b c d e f g h i j k = valu10 z a b c d e f g h i j `ap` value k valu12 z a b c d e f g h i j k l = valu11 z a b c d e f g h i j k `ap` value l valu13 z a b c d e f g h i j k l m = valu12 z a b c d e f g h i j k l `ap` value m valu14 z a b c d e f g h i j k l m n = valu13 z a b c d e f g h i j k l m `ap` value n Agda-2.4.2.5/src/full/Agda/TypeChecking/Serialise/Instances/0000755000000000000000000000000012635075266021531 5ustar0000000000000000Agda-2.4.2.5/src/full/Agda/TypeChecking/Serialise/Instances/Highlighting.hs0000644000000000000000000000562512635075266024502 0ustar0000000000000000{-# OPTIONS_GHC -fno-warn-orphans #-} module Agda.TypeChecking.Serialise.Instances.Highlighting where import qualified Agda.Interaction.Highlighting.Range as HR import qualified Agda.Interaction.Highlighting.Precise as HP import Agda.TypeChecking.Serialise.Base import Agda.TypeChecking.Serialise.Instances.Common () instance EmbPrj HR.Range where icod_ (HR.Range a b) = icode2' a b value = vcase valu where valu [a, b] = valu2 HR.Range a b valu _ = malformed instance EmbPrj HP.NameKind where icod_ HP.Bound = icode0' icod_ (HP.Constructor a) = icode1 1 a icod_ HP.Datatype = icode0 2 icod_ HP.Field = icode0 3 icod_ HP.Function = icode0 4 icod_ HP.Module = icode0 5 icod_ HP.Postulate = icode0 6 icod_ HP.Primitive = icode0 7 icod_ HP.Record = icode0 8 icod_ HP.Argument = icode0 9 value = vcase valu where valu [] = valu0 HP.Bound valu [1 , a] = valu1 HP.Constructor a valu [2] = valu0 HP.Datatype valu [3] = valu0 HP.Field valu [4] = valu0 HP.Function valu [5] = valu0 HP.Module valu [6] = valu0 HP.Postulate valu [7] = valu0 HP.Primitive valu [8] = valu0 HP.Record valu [9] = valu0 HP.Argument valu _ = malformed instance EmbPrj HP.Aspect where icod_ HP.Comment = icode0 0 icod_ HP.Keyword = icode0 1 icod_ HP.String = icode0 2 icod_ HP.Number = icode0 3 icod_ HP.Symbol = icode0' icod_ HP.PrimitiveType = icode0 5 icod_ (HP.Name mk b) = icode2 6 mk b value = vcase valu where valu [0] = valu0 HP.Comment valu [1] = valu0 HP.Keyword valu [2] = valu0 HP.String valu [3] = valu0 HP.Number valu [] = valu0 HP.Symbol valu [5] = valu0 HP.PrimitiveType valu [6, mk, b] = valu2 HP.Name mk b valu _ = malformed instance EmbPrj HP.OtherAspect where icod_ HP.Error = icode0 0 icod_ HP.DottedPattern = icode0' icod_ HP.UnsolvedMeta = icode0 2 icod_ HP.TerminationProblem = icode0 3 icod_ HP.IncompletePattern = icode0 4 icod_ HP.TypeChecks = icode0 5 icod_ HP.UnsolvedConstraint = icode0 6 value = vcase valu where valu [0] = valu0 HP.Error valu [] = valu0 HP.DottedPattern valu [2] = valu0 HP.UnsolvedMeta valu [3] = valu0 HP.TerminationProblem valu [4] = valu0 HP.IncompletePattern valu [5] = valu0 HP.TypeChecks valu [6] = valu0 HP.UnsolvedConstraint valu _ = malformed instance EmbPrj HP.Aspects where icod_ (HP.Aspects a b c d) = icode4' a b c d value = vcase valu where valu [a, b, c, d] = valu4 HP.Aspects a b c d valu _ = malformed instance EmbPrj HP.CompressedFile where icod_ (HP.CompressedFile f) = icode1' f value = vcase valu where valu [f] = valu1 HP.CompressedFile f valu _ = malformed Agda-2.4.2.5/src/full/Agda/TypeChecking/Serialise/Instances/Abstract.hs0000644000000000000000000002154412635075266023636 0ustar0000000000000000{-# LANGUAGE CPP #-} {-# LANGUAGE FlexibleInstances #-} #if __GLASGOW_HASKELL__ >= 710 {-# LANGUAGE FlexibleContexts #-} #endif {-# OPTIONS_GHC -fno-warn-orphans #-} module Agda.TypeChecking.Serialise.Instances.Abstract where import Control.Applicative import Agda.Syntax.Common import qualified Agda.Syntax.Abstract as A import Agda.Syntax.Info import Agda.Syntax.Scope.Base import Agda.Syntax.Position as P import Agda.Syntax.Fixity import Agda.TypeChecking.Serialise.Base import Agda.TypeChecking.Serialise.Instances.Common () import Agda.TypeChecking.Monad import Agda.Utils.Except #include "undefined.h" import Agda.Utils.Impossible instance EmbPrj Scope where icod_ (Scope a b c d e) = icode5' a b c d e value = vcase valu where valu [a, b, c, d, e] = valu5 Scope a b c d e valu _ = malformed instance EmbPrj NameSpaceId where icod_ PublicNS = icode0' icod_ PrivateNS = icode0 1 icod_ ImportedNS = icode0 2 icod_ OnlyQualifiedNS = icode0 3 value = vcase valu where valu [] = valu0 PublicNS valu [1] = valu0 PrivateNS valu [2] = valu0 ImportedNS valu [3] = valu0 OnlyQualifiedNS valu _ = malformed instance EmbPrj Access where icod_ PrivateAccess = icode0 0 icod_ PublicAccess = icode0' icod_ OnlyQualified = icode0 2 value = vcase valu where valu [0] = valu0 PrivateAccess valu [] = valu0 PublicAccess valu [2] = valu0 OnlyQualified valu _ = malformed instance EmbPrj NameSpace where icod_ (NameSpace a b) = icode2' a b value = vcase valu where valu [a, b] = valu2 NameSpace a b valu _ = malformed instance EmbPrj WhyInScope where icod_ Defined = icode0' icod_ (Opened a b) = icode2 0 a b icod_ (Applied a b) = icode2 1 a b value = vcase valu where valu [] = valu0 Defined valu [0, a, b] = valu2 Opened a b valu [1, a, b] = valu2 Applied a b valu _ = malformed instance EmbPrj AbstractName where icod_ (AbsName a b c) = icode3' a b c value = vcase valu where valu [a, b, c] = valu3 AbsName a b c valu _ = malformed instance EmbPrj AbstractModule where icod_ (AbsModule a b) = icode2' a b value = vcase valu where valu [a, b] = valu2 AbsModule a b valu _ = malformed instance EmbPrj KindOfName where icod_ DefName = icode0' icod_ ConName = icode0 1 icod_ FldName = icode0 2 icod_ PatternSynName = icode0 3 icod_ QuotableName = icode0 4 value = vcase valu where valu [] = valu0 DefName valu [1] = valu0 ConName valu [2] = valu0 FldName valu [3] = valu0 PatternSynName valu [4] = valu0 QuotableName valu _ = malformed instance EmbPrj LocalVar where icod_ (LocalVar a) = icode1' a icod_ (ShadowedVar a b) = icode2' a b value = vcase valu where valu [a] = valu1 LocalVar a valu [a, b] = valu2 ShadowedVar a b valu _ = malformed -- Only used for pattern synonyms instance EmbPrj A.Expr where icod_ (A.Var n) = icode1 0 n icod_ (A.Def n) = icode1 1 n icod_ (A.Con ns) = icode1 2 ns icod_ (A.Lit l) = icode1 3 l icod_ (A.QuestionMark{}) = icode0 4 icod_ (A.Underscore _) = icode0 5 icod_ (A.App _ a b) = icode2 6 a b icod_ (A.WithApp _ a b) = icode2 7 a b icod_ (A.Lam _ a b) = icode2 8 a b icod_ (A.AbsurdLam _ a) = icode1 9 a icod_ (A.ExtendedLam _ _ _ _) = __IMPOSSIBLE__ icod_ (A.Pi _ a b) = icode2 11 a b icod_ (A.Fun _ a b) = icode2 12 a b icod_ (A.Set _ a) = icode1 13 a icod_ (A.Prop _) = icode0 14 icod_ (A.Let _ _ _) = __IMPOSSIBLE__ icod_ (A.ETel{}) = __IMPOSSIBLE__ icod_ (A.Rec _ a) = icode1 17 a icod_ (A.RecUpdate _ a b) = icode2 18 a b -- Andreas, 2015-07-15, drop scopes embedded in expressions. -- As expressions are not @unScope@d before serialization, -- this case is not __IMPOSSIBLE__. icod_ (A.ScopedExpr a b) = icod_ b -- WAS: icode2 19 a b icod_ (A.QuoteGoal _ a b) = icode2 20 a b icod_ (A.QuoteContext _ a b) = icode2 21 a b icod_ (A.Quote _) = icode0 22 icod_ (A.QuoteTerm _) = icode0 23 icod_ (A.Unquote _) = icode0 24 icod_ (A.DontCare a) = icode1 25 a icod_ (A.PatternSyn a) = icode1 26 a icod_ (A.Proj a) = icode1 27 a value = vcase valu where valu [0, a] = valu1 A.Var a valu [1, a] = valu1 A.Def a valu [2, a] = valu1 A.Con a valu [3, a] = valu1 A.Lit a valu [4] = valu0 (A.QuestionMark emptyMetaInfo 0) valu [5] = valu0 (A.Underscore emptyMetaInfo) valu [6, a, b] = valu2 (A.App i) a b valu [7, a, b] = valu2 (A.WithApp i) a b valu [8, a, b] = valu2 (A.Lam i) a b valu [9, a] = valu1 (A.AbsurdLam i) a valu [11, a, b] = valu2 (A.Pi i) a b valu [12, a, b] = valu2 (A.Fun i) a b valu [13, a] = valu1 (A.Set i) a valu [14] = valu0 (A.Prop i) valu [17, a] = valu1 (A.Rec i) a valu [18, a, b] = valu2 (A.RecUpdate i) a b -- valu [19, a, b] = valu2 A.ScopedExpr a b valu [20, a, b] = valu2 (A.QuoteGoal i) a b valu [21, a, b] = valu2 (A.QuoteContext i) a b valu [22] = valu0 (A.Quote i) valu [23] = valu0 (A.QuoteTerm i) valu [24] = valu0 (A.Unquote i) valu [25, a] = valu1 A.DontCare a valu [26, a] = valu1 A.PatternSyn a valu [27, a] = valu1 A.Proj a valu _ = malformed i = ExprRange noRange instance EmbPrj ConPatInfo where icod_ (ConPatInfo a _) = icod_ a value a = flip ConPatInfo patNoRange <$> value a instance EmbPrj A.Pattern where icod_ (A.VarP a) = icode1 0 a icod_ (A.ConP a b c) = icode3 1 a b c icod_ (A.DefP _ a b) = icode2 2 a b icod_ (A.WildP _) = icode0 3 icod_ (A.AsP _ a b) = icode2 4 a b icod_ (A.DotP _ a) = icode1 5 a icod_ (A.AbsurdP _) = icode0 6 icod_ (A.LitP a) = icode1 7 a icod_ (A.PatternSynP _ a b) = icode2 9 a b value = vcase valu where valu [0, a] = valu1 A.VarP a valu [1, a, b, c] = valu3 A.ConP a b c valu [2, a, b] = valu2 (A.DefP i) a b valu [3] = valu0 (A.WildP i) valu [4, a, b] = valu2 (A.AsP i) a b valu [5, a] = valu1 (A.DotP i) a valu [6] = valu0 (A.AbsurdP i) valu [7, a] = valu1 (A.LitP) a valu [9, a, b] = valu2 (A.PatternSynP i) a b valu _ = malformed i = patNoRange instance EmbPrj A.LamBinding where icod_ (A.DomainFree i e) = icode2 0 i e icod_ (A.DomainFull a) = icode1 1 a value = vcase valu where valu [0, i, e] = valu2 A.DomainFree i e valu [1, a] = valu1 A.DomainFull a valu _ = malformed instance EmbPrj A.LetBinding where icod_ (A.LetBind _ a b c d) = icode4 0 a b c d icod_ (A.LetPatBind _ a b ) = icode2 1 a b icod_ (A.LetApply _ _ _ _ _) = icode0 2 icod_ (A.LetOpen _ _) = icode0 2 value = vcase valu where valu [0, a, b, c, d] = valu4 (A.LetBind (LetRange noRange)) a b c d valu [1, a, b] = valu2 (A.LetPatBind (LetRange noRange)) a b valu [2] = throwError $ NotSupported "importing pattern synonym containing let module" valu _ = malformed instance EmbPrj A.TypedBindings where icod_ (A.TypedBindings a b) = icode2' a b value = vcase valu where valu [a, b] = valu2 A.TypedBindings a b valu _ = malformed instance EmbPrj A.TypedBinding where icod_ (A.TBind a b c) = icode3 0 a b c icod_ (A.TLet a b) = icode2 1 a b value = vcase valu where valu [0, a, b, c] = valu3 A.TBind a b c valu [1, a, b] = valu2 A.TLet a b valu _ = malformed instance EmbPrj Precedence where icod_ TopCtx = icode0' icod_ FunctionSpaceDomainCtx = icode0 1 icod_ (LeftOperandCtx a) = icode1 2 a icod_ (RightOperandCtx a) = icode1 3 a icod_ FunctionCtx = icode0 4 icod_ ArgumentCtx = icode0 5 icod_ InsideOperandCtx = icode0 6 icod_ WithFunCtx = icode0 7 icod_ WithArgCtx = icode0 8 icod_ DotPatternCtx = icode0 9 value = vcase valu where valu [] = valu0 TopCtx valu [1] = valu0 FunctionSpaceDomainCtx valu [2, a] = valu1 LeftOperandCtx a valu [3, a] = valu1 RightOperandCtx a valu [4] = valu0 FunctionCtx valu [5] = valu0 ArgumentCtx valu [6] = valu0 InsideOperandCtx valu [7] = valu0 WithFunCtx valu [8] = valu0 WithArgCtx valu [9] = valu0 DotPatternCtx valu _ = malformed instance EmbPrj ScopeInfo where icod_ (ScopeInfo a b c d) = icode4' a b c d value = vcase valu where valu [a, b, c, d] = valu4 ScopeInfo a b c d valu _ = malformed Agda-2.4.2.5/src/full/Agda/TypeChecking/Serialise/Instances/Internal.hs0000644000000000000000000003003512635075266023642 0ustar0000000000000000{-# LANGUAGE CPP #-} {-# OPTIONS_GHC -fno-warn-orphans #-} module Agda.TypeChecking.Serialise.Instances.Internal where import Control.Applicative import Control.Monad.State.Strict import Agda.Syntax.Internal as I import Agda.Syntax.Position as P import Agda.TypeChecking.Serialise.Base import Agda.TypeChecking.Serialise.Instances.Common () import Agda.TypeChecking.Serialise.Instances.Compilers () import Agda.TypeChecking.Monad import Agda.TypeChecking.CompiledClause import Agda.TypeChecking.Positivity.Occurrence import Agda.Utils.Permutation #include "undefined.h" import Agda.Utils.Impossible instance EmbPrj Signature where icod_ (Sig a b c) = icode3' a b c value = vcase valu where valu [a, b, c] = valu3 Sig a b c valu _ = malformed instance EmbPrj Section where icod_ (Section a) = icode1' a value = vcase valu where valu [a] = valu1 Section a valu _ = malformed instance EmbPrj a => EmbPrj (Tele a) where icod_ EmptyTel = icode0' icod_ (ExtendTel a b) = icode2' a b value = vcase valu where valu [] = valu0 EmptyTel valu [a, b] = valu2 ExtendTel a b valu _ = malformed instance EmbPrj Permutation where icod_ (Perm a b) = icode2' a b value = vcase valu where valu [a, b] = valu2 Perm a b valu _ = malformed instance EmbPrj a => EmbPrj (Drop a) where icod_ (Drop a b) = icode2' a b value = vcase valu where valu [a, b] = valu2 Drop a b valu _ = malformed instance EmbPrj a => EmbPrj (Elim' a) where icod_ (Apply a) = icode1' a icod_ (Proj a) = icode1 0 a value = vcase valu where valu [a] = valu1 Apply a valu [0, a] = valu1 Proj a valu _ = malformed instance EmbPrj I.ConHead where icod_ (ConHead a b c) = icode3' a b c value = vcase valu where valu [a, b, c] = valu3 ConHead a b c valu _ = malformed instance (EmbPrj a) => EmbPrj (I.Type' a) where icod_ (El a b) = icode2' a b value = vcase valu where valu [a, b] = valu2 El a b valu _ = malformed instance (EmbPrj a) => EmbPrj (I.Abs a) where icod_ (NoAbs a b) = icode2 0 a b icod_ (Abs a b) = icode2' a b value = vcase valu where valu [a, b] = valu2 Abs a b valu [0, a, b] = valu2 NoAbs a b valu _ = malformed instance EmbPrj I.Term where icod_ (Var a []) = icode1' a icod_ (Var a b) = icode2 0 a b icod_ (Lam a b) = icode2 1 a b icod_ (Lit a ) = icode1 2 a icod_ (Def a b) = icode2 3 a b icod_ (Con a b) = icode2 4 a b icod_ (Pi a b) = icode2 5 a b icod_ (Sort a ) = icode1 7 a icod_ (MetaV a b) = __IMPOSSIBLE__ icod_ ExtLam{} = __IMPOSSIBLE__ icod_ (DontCare a ) = icode1 8 a icod_ (Level a ) = icode1 9 a icod_ (Shared p) = icodeMemo termD termC p $ icode (derefPtr p) value r = vcase valu' r where valu' xs = shared <$> valu xs valu [a] = valu1 var a valu [0, a, b] = valu2 Var a b valu [1, a, b] = valu2 Lam a b valu [2, a] = valu1 Lit a valu [3, a, b] = valu2 Def a b valu [4, a, b] = valu2 Con a b valu [5, a, b] = valu2 Pi a b valu [7, a] = valu1 Sort a valu [8, a] = valu1 DontCare a valu [9, a] = valu1 Level a valu _ = malformed instance EmbPrj Level where icod_ (Max a) = icode1' a value = vcase valu where valu [a] = valu1 Max a valu _ = malformed instance EmbPrj PlusLevel where icod_ (ClosedLevel a) = icode1' a icod_ (Plus a b) = icode2' a b value = vcase valu where valu [a] = valu1 ClosedLevel a valu [a, b] = valu2 Plus a b valu _ = malformed instance EmbPrj LevelAtom where icod_ (NeutralLevel _ a) = icode1' a icod_ (UnreducedLevel a) = icode1 1 a icod_ MetaLevel{} = __IMPOSSIBLE__ icod_ BlockedLevel{} = __IMPOSSIBLE__ value = vcase valu where valu [a] = valu1 UnreducedLevel a -- we forget that we are a NeutralLevel, -- since we do not want do (de)serialize -- the reason for neutrality valu [1, a] = valu1 UnreducedLevel a valu _ = malformed instance EmbPrj I.Sort where icod_ (Type a ) = icode1' a icod_ Prop = icode1 1 () icod_ SizeUniv = icode1 3 () icod_ Inf = icode1 4 () icod_ (DLub a b) = __IMPOSSIBLE__ value = vcase valu where valu [a] = valu1 Type a valu [1, _] = valu0 Prop valu [3, _] = valu0 SizeUniv valu [4, _] = valu0 Inf valu _ = malformed instance EmbPrj DisplayForm where icod_ (Display a b c) = icode3' a b c value = vcase valu where valu [a, b, c] = valu3 Display a b c valu _ = malformed instance EmbPrj a => EmbPrj (Open a) where icod_ (OpenThing a b) = icode2' a b value = vcase valu where valu [a, b] = valu2 OpenThing a b valu _ = malformed instance EmbPrj CtxId where icod_ (CtxId a) = icode a value n = CtxId `fmap` value n instance EmbPrj DisplayTerm where icod_ (DTerm a ) = icode1' a icod_ (DDot a ) = icode1 1 a icod_ (DCon a b) = icode2 2 a b icod_ (DDef a b) = icode2 3 a b icod_ (DWithApp a b c) = icode3 4 a b c value = vcase valu where valu [a] = valu1 DTerm a valu [1, a] = valu1 DDot a valu [2, a, b] = valu2 DCon a b valu [3, a, b] = valu2 DDef a b valu [4, a, b, c] = valu3 DWithApp a b c valu _ = malformed instance EmbPrj MutualId where icod_ (MutId a) = icode a value n = MutId `fmap` value n instance EmbPrj Definition where icod_ (Defn rel a b c d e f g h i) = icode10' rel a (P.killRange b) c d e f g h i value = vcase valu where valu [rel, a, b, c, d, e, f, g, h, i] = valu10 Defn rel a b c d e f g h i valu _ = malformed instance EmbPrj NLPat where icod_ (PVar a) = icode1 0 a icod_ (PWild) = icode0 1 icod_ (PDef a b) = icode2 2 a b icod_ (PLam a b) = icode2 3 a b icod_ (PPi a b) = icode2 4 a b icod_ (PBoundVar a b) = icode2 5 a b icod_ (PTerm a) = icode1 6 a value = vcase valu where valu [0, a] = valu1 PVar a valu [1] = valu0 PWild valu [2, a, b] = valu2 PDef a b valu [3, a, b] = valu2 PLam a b valu [4, a, b] = valu2 PPi a b valu [5, a, b] = valu2 PBoundVar a b valu [6, a] = valu1 PTerm a valu _ = malformed instance EmbPrj RewriteRule where icod_ (RewriteRule a b c d e) = icode5' a b c d e value = vcase valu where valu [a, b, c, d, e] = valu5 RewriteRule a b c d e valu _ = malformed instance EmbPrj Projection where icod_ (Projection a b c d e) = icode5' a b c d e value = vcase valu where valu [a, b, c, d, e] = valu5 Projection a b c d e valu _ = malformed instance EmbPrj ExtLamInfo where icod_ (ExtLamInfo a b) = icode2' a b value = vcase valu where valu [a, b] = valu2 ExtLamInfo a b valu _ = malformed instance EmbPrj Polarity where icod_ Covariant = return 0 icod_ Contravariant = return 1 icod_ Invariant = return 2 icod_ Nonvariant = return 3 value 0 = return Covariant value 1 = return Contravariant value 2 = return Invariant value 3 = return Nonvariant value _ = malformed -- instance EmbPrj Polarity where -- icod_ Covariant = icode0' -- icod_ Contravariant = icode0 1 -- icod_ Invariant = icode0 2 -- icod_ Nonvariant = icode0 3 -- value = vcase valu where -- valu [] = valu0 Covariant -- valu [1] = valu0 Contravariant -- valu [2] = valu0 Invariant -- valu [3] = valu0 Nonvariant -- valu _ = malformed instance EmbPrj Occurrence where icod_ StrictPos = return 0 icod_ Mixed = return 1 icod_ Unused = return 2 icod_ GuardPos = return 3 icod_ JustPos = return 4 icod_ JustNeg = return 5 value 0 = return StrictPos value 1 = return Mixed value 2 = return Unused value 3 = return GuardPos value 4 = return JustPos value 5 = return JustNeg value _ = malformed -- instance EmbPrj Occurrence where -- icod_ StrictPos = icode0' -- icod_ Mixed = icode0 1 -- icod_ Unused = icode0 2 -- icod_ GuardPos = icode0 3 -- icod_ JustPos = icode0 4 -- icod_ JustNeg = icode0 5 -- value = vcase valu where -- valu [] = valu0 StrictPos -- valu [1] = valu0 Mixed -- valu [2] = valu0 Unused -- valu [3] = valu0 GuardPos -- valu [4] = valu0 JustPos -- valu [5] = valu0 JustNeg -- valu _ = malformed instance EmbPrj Defn where icod_ Axiom = icode0 0 icod_ (Function a b c d e f g h i j k l m) = icode13 1 a b c d e f g h i j k l m icod_ (Datatype a b c d e f g h i j) = icode10 2 a b c d e f g h i j icod_ (Record a b c d e f g h i j k l) = icode12 3 a b c d e f g h i j k l icod_ (Constructor a b c d e) = icode5 4 a b c d e icod_ (Primitive a b c d) = icode4 5 a b c d value = vcase valu where valu [0] = valu0 Axiom valu [1, a, b, c, d, e, f, g, h, i, j, k, l, m] = valu13 Function a b c d e f g h i j k l m valu [2, a, b, c, d, e, f, g, h, i, j] = valu10 Datatype a b c d e f g h i j valu [3, a, b, c, d, e, f, g, h, i, j, k, l] = valu12 Record a b c d e f g h i j k l valu [4, a, b, c, d, e] = valu5 Constructor a b c d e valu [5, a, b, c, d] = valu4 Primitive a b c d valu _ = malformed instance EmbPrj a => EmbPrj (WithArity a) where icod_ (WithArity a b) = icode2' a b value = vcase valu where valu [a, b] = valu2 WithArity a b valu _ = malformed instance EmbPrj a => EmbPrj (Case a) where icod_ (Branches a b c d) = icode4' a b c d value = vcase valu where valu [a, b, c, d] = valu4 Branches a b c d valu _ = malformed instance EmbPrj CompiledClauses where icod_ Fail = icode0' icod_ (Done a b) = icode2' a (P.killRange b) icod_ (Case a b) = icode2 2 a b value = vcase valu where valu [] = valu0 Fail valu [a, b] = valu2 Done a b valu [2, a, b] = valu2 Case a b valu _ = malformed instance EmbPrj a => EmbPrj (FunctionInverse' a) where icod_ NotInjective = icode0' icod_ (Inverse a) = icode1' a value = vcase valu where valu [] = valu0 NotInjective valu [a] = valu1 Inverse a valu _ = malformed instance EmbPrj TermHead where icod_ SortHead = icode0' icod_ PiHead = icode0 1 icod_ (ConsHead a) = icode1 2 a value = vcase valu where valu [] = valu0 SortHead valu [1] = valu0 PiHead valu [2, a] = valu1 ConsHead a valu _ = malformed instance EmbPrj I.Clause where icod_ (Clause a b c d e f) = icode6' a b c d e f value = vcase valu where valu [a, b, c, d, e, f] = valu6 Clause a b c d e f valu _ = malformed instance EmbPrj a => EmbPrj (I.ClauseBodyF a) where icod_ (Body a) = icode1 0 a icod_ (Bind a) = icode1' a icod_ NoBody = icode0' value = vcase valu where valu [0, a] = valu1 Body a valu [a] = valu1 Bind a valu [] = valu0 NoBody valu _ = malformed instance EmbPrj I.ConPatternInfo where icod_ (ConPatternInfo a b) = icode2' a b value = vcase valu where valu [a, b] = valu2 ConPatternInfo a b valu _ = malformed instance EmbPrj a => EmbPrj (I.Pattern' a) where icod_ (VarP a ) = icode1' a icod_ (ConP a b c) = icode3' a b c icod_ (LitP a ) = icode1 2 a icod_ (DotP a ) = icode1 3 a icod_ (ProjP a ) = icode1 4 a value = vcase valu where valu [a] = valu1 VarP a valu [a, b, c] = valu3 ConP a b c valu [2, a] = valu1 LitP a valu [3, a] = valu1 DotP a valu [4, a] = valu1 ProjP a valu _ = malformed instance EmbPrj a => EmbPrj (Builtin a) where icod_ (Prim a) = icode1' a icod_ (Builtin a) = icode1 1 a value = vcase valu where valu [a] = valu1 Prim a valu [1, a] = valu1 Builtin a valu _ = malformed Agda-2.4.2.5/src/full/Agda/TypeChecking/Serialise/Instances/Compilers.hs0000644000000000000000000000753612635075266024035 0ustar0000000000000000{-# OPTIONS_GHC -fno-warn-orphans #-} {-# OPTIONS_GHC -fwarn-unused-imports #-} module Agda.TypeChecking.Serialise.Instances.Compilers where import qualified Agda.Compiler.Epic.Interface as Epic import qualified Agda.Compiler.JS.Syntax as JS import Agda.TypeChecking.Serialise.Base import Agda.TypeChecking.Serialise.Instances.Common () import Agda.TypeChecking.Monad instance EmbPrj HaskellExport where icod_ (HsExport a b) = icode2' a b value = vcase valu where valu [a,b] = valu2 HsExport a b valu _ = malformed instance EmbPrj HaskellRepresentation where icod_ (HsType a) = icode1' a icod_ (HsDefn a b) = icode2' a b value = vcase valu where valu [a] = valu1 HsType a valu [a, b] = valu2 HsDefn a b valu _ = malformed instance EmbPrj CompiledRepresentation where icod_ (CompiledRep a b c d) = icode4' a b c d value = vcase valu where valu [a, b, c, d] = valu4 CompiledRep a b c d valu _ = malformed instance EmbPrj JS.Exp where icod_ (JS.Self) = icode0 0 icod_ (JS.Local i) = icode1 1 i icod_ (JS.Global i) = icode1 2 i icod_ (JS.Undefined) = icode0 3 icod_ (JS.String s) = icode1 4 s icod_ (JS.Char c) = icode1 5 c icod_ (JS.Integer n) = icode1 6 n icod_ (JS.Double d) = icode1 7 d icod_ (JS.Lambda n e) = icode2 8 n e icod_ (JS.Object o) = icode1 9 o icod_ (JS.Apply e es) = icode2 10 e es icod_ (JS.Lookup e l) = icode2 11 e l icod_ (JS.If e f g) = icode3 12 e f g icod_ (JS.BinOp e op f) = icode3 13 e op f icod_ (JS.PreOp op e) = icode2 14 op e icod_ (JS.Const i) = icode1 15 i value = vcase valu where valu [0] = valu0 JS.Self valu [1, a] = valu1 JS.Local a valu [2, a] = valu1 JS.Global a valu [3] = valu0 JS.Undefined valu [4, a] = valu1 JS.String a valu [5, a] = valu1 JS.Char a valu [6, a] = valu1 JS.Integer a valu [7, a] = valu1 JS.Double a valu [8, a, b] = valu2 JS.Lambda a b valu [9, a] = valu1 JS.Object a valu [10, a, b] = valu2 JS.Apply a b valu [11, a, b] = valu2 JS.Lookup a b valu [12, a, b, c] = valu3 JS.If a b c valu [13, a, b, c] = valu3 JS.BinOp a b c valu [14, a, b] = valu2 JS.PreOp a b valu [15, a] = valu1 JS.Const a valu _ = malformed instance EmbPrj JS.LocalId where icod_ (JS.LocalId l) = icode l value n = JS.LocalId `fmap` value n instance EmbPrj JS.GlobalId where icod_ (JS.GlobalId l) = icode l value n = JS.GlobalId `fmap` value n instance EmbPrj JS.MemberId where icod_ (JS.MemberId l) = icode l value n = JS.MemberId `fmap` value n -- This is used for the Epic compiler backend. instance EmbPrj Epic.EInterface where icod_ (Epic.EInterface a b c d e f g h) = icode8' a b c d e f g h value = vcase valu where valu [a, b, c, d, e, f, g, h] = valu8 Epic.EInterface a b c d e f g h valu _ = malformed instance EmbPrj Epic.InjectiveFun where icod_ (Epic.InjectiveFun a b) = icode2' a b value = vcase valu where valu [a,b] = valu2 Epic.InjectiveFun a b valu _ = malformed instance EmbPrj Epic.Relevance where icod_ Epic.Irr = icode0 0 icod_ Epic.Rel = icode0 1 value = vcase valu where valu [0] = valu0 Epic.Irr valu [1] = valu0 Epic.Rel valu _ = malformed instance EmbPrj Epic.Forced where icod_ Epic.Forced = icode0 0 icod_ Epic.NotForced = icode0 1 value = vcase valu where valu [0] = valu0 Epic.Forced valu [1] = valu0 Epic.NotForced valu _ = malformed instance EmbPrj Epic.Tag where icod_ (Epic.Tag a) = icode1 0 a icod_ (Epic.PrimTag a) = icode1 1 a value = vcase valu where valu [0, a] = valu1 Epic.Tag a valu [1, a] = valu1 Epic.PrimTag a valu _ = malformed Agda-2.4.2.5/src/full/Agda/TypeChecking/Serialise/Instances/Common.hs0000644000000000000000000002711712635075266023325 0ustar0000000000000000{-# LANGUAGE CPP #-} {-# LANGUAGE ExistentialQuantification #-} {-# LANGUAGE FlexibleInstances #-} {-# LANGUAGE ScopedTypeVariables #-} #if __GLASGOW_HASKELL__ >= 710 {-# LANGUAGE FlexibleContexts #-} #endif #if __GLASGOW_HASKELL__ <= 708 {-# LANGUAGE OverlappingInstances #-} #endif {-# OPTIONS_GHC -fno-warn-orphans #-} module Agda.TypeChecking.Serialise.Instances.Common where import Control.Applicative import Control.Monad.Reader import Control.Monad.State.Strict (gets, modify) import Data.Array.IArray import Data.Word import qualified Data.ByteString.Lazy as L import qualified Data.Foldable as Fold import Data.Hashable import qualified Data.HashTable.IO as H import Data.Int (Int32) import Data.Maybe import Data.Map (Map) import qualified Data.Map as Map import Data.Set (Set) import qualified Data.Set as Set import Data.Sequence (Seq) import qualified Data.Sequence as Seq import Data.Void import Agda.Syntax.Common as Common import Agda.Syntax.Concrete.Name as C import qualified Agda.Syntax.Concrete as C import qualified Agda.Syntax.Abstract as A import Agda.Syntax.Position as P import Agda.Syntax.Fixity import Agda.Syntax.Notation import Agda.Syntax.Literal import Agda.Interaction.FindFile import Agda.TypeChecking.Serialise.Base import Agda.Utils.BiMap (BiMap) import qualified Agda.Utils.BiMap as BiMap import Agda.Utils.HashMap (HashMap) import qualified Agda.Utils.HashMap as HMap import Agda.Utils.FileName import qualified Agda.Utils.Maybe.Strict as Strict import Agda.Utils.Except #include "undefined.h" import Agda.Utils.Impossible #if __GLASGOW_HASKELL__ >= 710 instance {-# OVERLAPPING #-} EmbPrj String where #else instance EmbPrj String where #endif icod_ = icodeString value i = (! i) `fmap` gets stringE instance EmbPrj Integer where icod_ = icodeInteger value i = (! i) `fmap` gets integerE instance EmbPrj Word64 where icod_ i = icode2' (int32 q) (int32 r) where (q, r) = quotRem i (2^32) int32 :: Word64 -> Int32 int32 = fromIntegral value = vcase valu where valu [a, b] = return $ n * mod (fromIntegral a) n + mod (fromIntegral b) n valu _ = malformed n = 2^32 instance EmbPrj Int32 where icod_ i = return i value i = return i instance EmbPrj Int where icod_ i = return (fromIntegral i) value i = return (fromIntegral i) instance EmbPrj Char where icod_ c = return (fromIntegral $ fromEnum c) value i = return (toEnum $ fromInteger $ toInteger i) instance EmbPrj Double where icod_ = icodeDouble value i = (! i) `fmap` gets doubleE instance EmbPrj () where icod_ () = icode0' value = vcase valu where valu [] = valu0 () valu _ = malformed instance (EmbPrj a, EmbPrj b) => EmbPrj (a, b) where icod_ (a, b) = icode2' a b value = vcase valu where valu [a, b] = valu2 (,) a b valu _ = malformed instance (EmbPrj a, EmbPrj b, EmbPrj c) => EmbPrj (a, b, c) where icod_ (a, b, c) = icode3' a b c value = vcase valu where valu [a, b, c] = valu3 (,,) a b c valu _ = malformed instance EmbPrj a => EmbPrj (Maybe a) where icod_ Nothing = icode0' icod_ (Just x) = icode1' x value = vcase valu where valu [] = valu0 Nothing valu [x] = valu1 Just x valu _ = malformed instance EmbPrj Bool where icod_ True = icode0' icod_ False = icode0 0 value = vcase valu where valu [] = valu0 True valu [0] = valu0 False valu _ = malformed instance EmbPrj AbsolutePath where icod_ file = do d <- asks absPathD liftIO $ fromMaybe __IMPOSSIBLE__ <$> H.lookup d file value m = do m :: TopLevelModuleName <- value m mf <- gets modFile incs <- gets includes (r, mf) <- liftIO $ findFile'' incs m mf modify $ \s -> s { modFile = mf } case r of Left err -> throwError $ findErrorToTypeError m err Right f -> return f instance EmbPrj Position where icod_ (P.Pn file pos line col) = icode4' file pos line col value = vcase valu where valu [f, p, l, c] = valu4 P.Pn f p l c valu _ = malformed instance EmbPrj TopLevelModuleName where icod_ (TopLevelModuleName a) = icode1' a value = vcase valu where valu [a] = valu1 TopLevelModuleName a valu _ = malformed #if __GLASGOW_HASKELL__ >= 710 instance {-# OVERLAPPABLE #-} EmbPrj a => EmbPrj [a] where #else instance EmbPrj a => EmbPrj [a] where #endif icod_ xs = icodeN =<< mapM icode xs value = vcase (mapM value) -- icode [] = icode0' -- icode (x : xs) = icode2' x xs -- value = vcase valu where valu [] = valu0 [] -- valu [x, xs] = valu2 (:) x xs -- valu _ = malformed instance (Ord a, Ord b, EmbPrj a, EmbPrj b) => EmbPrj (BiMap a b) where icod_ m = icode (BiMap.toList m) value m = BiMap.fromList <$> value m instance (Ord a, EmbPrj a, EmbPrj b) => EmbPrj (Map a b) where icod_ m = icode (Map.toList m) value m = Map.fromList `fmap` value m instance (Ord a, EmbPrj a) => EmbPrj (Set a) where icod_ s = icode (Set.toList s) value s = Set.fromList `fmap` value s instance EmbPrj P.Interval where icod_ (P.Interval p q) = icode2' p q value = vcase valu where valu [p, q] = valu2 P.Interval p q valu _ = malformed instance EmbPrj Range where icod_ (P.Range is) = icode1' is value = vcase valu where valu [is] = valu1 P.Range is valu _ = malformed instance EmbPrj C.Name where icod_ (C.NoName a b) = icode2 0 a b icod_ (C.Name r xs) = icode2' r xs value = vcase valu where valu [0, a, b] = valu2 C.NoName a b valu [r, xs] = valu2 C.Name r xs valu _ = malformed instance EmbPrj NamePart where icod_ Hole = icode0' icod_ (Id a) = icode1' a value = vcase valu where valu [] = valu0 Hole valu [a] = valu1 Id a valu _ = malformed instance EmbPrj C.QName where icod_ (Qual a b) = icode2' a b icod_ (C.QName a ) = icode1' a value = vcase valu where valu [a, b] = valu2 Qual a b valu [a] = valu1 C.QName a valu _ = malformed instance EmbPrj Agda.Syntax.Fixity.Associativity where icod_ LeftAssoc = icode0' icod_ RightAssoc = icode0 1 icod_ NonAssoc = icode0 2 value = vcase valu where valu [] = valu0 LeftAssoc valu [1] = valu0 RightAssoc valu [2] = valu0 NonAssoc valu _ = malformed instance EmbPrj Agda.Syntax.Fixity.Fixity where icod_ (Fixity a b c) = icode3' a b c value = vcase valu where valu [a, b, c] = valu3 Fixity a b c valu _ = malformed instance EmbPrj Agda.Syntax.Fixity.Fixity' where icod_ (Fixity' a b) = icode2' a b value = vcase valu where valu [a,b] = valu2 Fixity' a b valu _ = malformed instance EmbPrj GenPart where icod_ (BindHole a) = icode1 0 a icod_ (NormalHole a) = icode1 1 a icod_ (IdPart a) = icode1' a value = vcase valu where valu [0, a] = valu1 BindHole a valu [1, a] = valu1 NormalHole a valu [a] = valu1 IdPart a valu _ = malformed instance EmbPrj A.QName where icod_ n@(A.QName a b) = icodeMemo qnameD qnameC (qnameId n) $ icode2' a b value = vcase valu where valu [a, b] = valu2 A.QName a b valu _ = malformed instance EmbPrj A.AmbiguousQName where icod_ (A.AmbQ a) = icode a value n = A.AmbQ `fmap` value n instance EmbPrj A.ModuleName where icod_ (A.MName a) = icode a value n = A.MName `fmap` value n instance EmbPrj A.Name where icod_ (A.Name a b c d) = icodeMemo nameD nameC a $ icode4' a b c d value = vcase valu where valu [a, b, c, d] = valu4 A.Name a b c d valu _ = malformed instance (EmbPrj s, EmbPrj t) => EmbPrj (Named s t) where icod_ (Named a b) = icode2' a b value = vcase valu where valu [a, b] = valu2 Named a b valu _ = malformed instance EmbPrj a => EmbPrj (Ranged a) where icod_ (Ranged r x) = icode2' r x value = vcase valu where valu [r, x] = valu2 Ranged r x valu _ = malformed instance EmbPrj c => EmbPrj (Common.ArgInfo c) where icod_ (ArgInfo h r cs) = icode3' h r cs value = vcase valu where valu [h, r, cs] = valu3 ArgInfo h r cs valu _ = malformed instance EmbPrj NameId where icod_ (NameId a b) = icode2' a b value = vcase valu where valu [a, b] = valu2 NameId a b valu _ = malformed instance (Eq k, Hashable k, EmbPrj k, EmbPrj v) => EmbPrj (HashMap k v) where icod_ m = icode (HMap.toList m) value m = HMap.fromList `fmap` value m instance EmbPrj a => EmbPrj (WithHiding a) where icod_ (WithHiding a b) = icode2' a b value = vcase valu where valu [a, b] = valu2 WithHiding a b valu _ = malformed instance (EmbPrj a, EmbPrj c) => EmbPrj (Common.Arg c a) where icod_ (Arg i e) = icode2' i e value = vcase valu where valu [i, e] = valu2 Arg i e valu _ = malformed instance (EmbPrj a, EmbPrj c) => EmbPrj (Common.Dom c a) where icod_ (Dom i e) = icode2' i e value = vcase valu where valu [i, e] = valu2 Dom i e valu _ = malformed instance EmbPrj Common.Induction where icod_ Inductive = icode0' icod_ CoInductive = icode0 1 value = vcase valu where valu [] = valu0 Inductive valu [1] = valu0 CoInductive valu _ = malformed instance EmbPrj Common.Hiding where icod_ Hidden = return 0 icod_ NotHidden = return 1 icod_ Instance = return 2 value 0 = return Hidden value 1 = return NotHidden value 2 = return Instance value _ = malformed instance EmbPrj Common.Relevance where icod_ Relevant = return 0 icod_ Irrelevant = return 1 icod_ (Forced Small) = return 2 icod_ (Forced Big) = return 3 icod_ NonStrict = return 4 icod_ UnusedArg = return 5 value 0 = return Relevant value 1 = return Irrelevant value 2 = return (Forced Small) value 3 = return (Forced Big) value 4 = return NonStrict value 5 = return UnusedArg value _ = malformed -- instance EmbPrj Common.Relevance where -- icod_ Relevant = icode0' -- icod_ Irrelevant = icode0 1 -- icod_ (Forced Small) = icode0 2 -- icod_ (Forced Big) = icode0 5 -- icod_ NonStrict = icode0 3 -- icod_ UnusedArg = icode0 4 -- value = vcase valu where valu [] = valu0 Relevant -- valu [1] = valu0 Irrelevant -- valu [2] = valu0 (Forced Small) -- valu [5] = valu0 (Forced Big) -- valu [3] = valu0 NonStrict -- valu [4] = valu0 UnusedArg -- valu _ = malformed instance EmbPrj ConPOrigin where icod_ ConPImplicit = return 0 icod_ ConPCon = return 1 icod_ ConPRec = return 2 value 0 = return ConPImplicit value 1 = return ConPCon value 2 = return ConPRec value _ = malformed instance EmbPrj Agda.Syntax.Literal.Literal where icod_ (LitInt a b) = icode2' a b icod_ (LitFloat a b) = icode2 1 a b icod_ (LitString a b) = icode2 2 a b icod_ (LitChar a b) = icode2 3 a b icod_ (LitQName a b) = icode2 5 a b value = vcase valu where valu [a, b] = valu2 LitInt a b valu [1, a, b] = valu2 LitFloat a b valu [2, a, b] = valu2 LitString a b valu [3, a, b] = valu2 LitChar a b valu [5, a, b] = valu2 LitQName a b valu _ = malformed instance EmbPrj Common.IsAbstract where icod_ AbstractDef = icode0 0 icod_ ConcreteDef = icode0' value = vcase valu where valu [0] = valu0 AbstractDef valu [] = valu0 ConcreteDef valu _ = malformed instance EmbPrj Delayed where icod_ Delayed = icode0 0 icod_ NotDelayed = icode0' value = vcase valu where valu [0] = valu0 Delayed valu [] = valu0 NotDelayed valu _ = malformed Agda-2.4.2.5/src/full/Agda/Syntax/0000755000000000000000000000000012635075266014573 5ustar0000000000000000Agda-2.4.2.5/src/full/Agda/Syntax/Abstract.hs0000644000000000000000000011422512635075266016677 0ustar0000000000000000{-# LANGUAGE CPP #-} {-# LANGUAGE DeriveDataTypeable #-} {-# LANGUAGE DeriveFoldable #-} {-# LANGUAGE DeriveFunctor #-} {-# LANGUAGE DeriveTraversable #-} {-# LANGUAGE FlexibleInstances #-} {-# LANGUAGE MultiParamTypeClasses #-} {-# LANGUAGE TemplateHaskell #-} {-| The abstract syntax. This is what you get after desugaring and scope analysis of the concrete syntax. The type checker works on abstract syntax, producing internal syntax ("Agda.Syntax.Internal"). -} module Agda.Syntax.Abstract ( module Agda.Syntax.Abstract , module Agda.Syntax.Abstract.Name ) where import Prelude hiding (foldl, foldr) import Control.Arrow ((***), first, second) import Control.Applicative import Data.Foldable as Fold import Data.Map (Map) import Data.Maybe import Data.Sequence (Seq, (<|), (><)) import qualified Data.Sequence as Seq import Data.Traversable import Data.Typeable (Typeable) import qualified Agda.Syntax.Concrete as C import Agda.Syntax.Concrete.Pretty () import Agda.Syntax.Info import Agda.Syntax.Common hiding (Arg, Dom, NamedArg, ArgInfo) import qualified Agda.Syntax.Common as Common import Agda.Syntax.Fixity import Agda.Syntax.Position import Agda.Syntax.Abstract.Name import Agda.Syntax.Abstract.Name as A (QNamed) import Agda.Syntax.Literal import Agda.Syntax.Scope.Base import Agda.Utils.Geniplate import Agda.Utils.Tuple #include "undefined.h" import Agda.Utils.Impossible type Color = Expr type Arg a = Common.Arg Color a type Dom a = Common.Dom Color a type NamedArg a = Common.NamedArg Color a type ArgInfo = Common.ArgInfo Color type Args = [NamedArg Expr] instance Eq Color where Var x == Var y = x == y Def x == Def y = x == y -- TODO guilhem: _ == _ = __IMPOSSIBLE__ instance Ord Color where Var x <= Var y = x <= y Def x <= Def y = x <= y -- TODO guilhem: _ <= _ = __IMPOSSIBLE__ -- | Expressions after scope checking (operators parsed, names resolved). data Expr = Var Name -- ^ Bound variable. | Def QName -- ^ Constant: axiom, function, data or record type. | Proj QName -- ^ Projection. | Con AmbiguousQName -- ^ Constructor. | PatternSyn QName -- ^ Pattern synonym. | Lit Literal -- ^ Literal. | QuestionMark MetaInfo InteractionId -- ^ Meta variable for interaction. -- The 'InteractionId' is usually identical with the -- 'metaNumber' of 'MetaInfo'. -- However, if you want to print an interaction meta as -- just @?@ instead of @?n@, you should set the -- 'metaNumber' to 'Nothing' while keeping the 'InteractionId'. | Underscore MetaInfo -- ^ Meta variable for hidden argument (must be inferred locally). | App ExprInfo Expr (NamedArg Expr) -- ^ Ordinary (binary) application. | WithApp ExprInfo Expr [Expr] -- ^ With application. | Lam ExprInfo LamBinding Expr -- ^ @λ bs → e@. | AbsurdLam ExprInfo Hiding -- ^ @λ()@ or @λ{}@. | ExtendedLam ExprInfo DefInfo QName [Clause] | Pi ExprInfo Telescope Expr -- ^ Dependent function space @Γ → A@. | Fun ExprInfo (Arg Expr) Expr -- ^ Non-dependent function space. | Set ExprInfo Integer -- ^ @Set@, @Set1@, @Set2@, ... | Prop ExprInfo -- ^ @Prop@ (no longer supported, used as dummy type). | Let ExprInfo [LetBinding] Expr -- ^ @let bs in e@. | ETel Telescope -- ^ Only used when printing telescopes. | Rec ExprInfo Assigns -- ^ Record construction. | RecUpdate ExprInfo Expr Assigns -- ^ Record update. | ScopedExpr ScopeInfo Expr -- ^ Scope annotation. | QuoteGoal ExprInfo Name Expr -- ^ Binds @Name@ to current type in @Expr@. | QuoteContext ExprInfo Name Expr -- ^ Binds @Name@ to current context in @Expr@. | Quote ExprInfo -- ^ Quote an identifier 'QName'. | QuoteTerm ExprInfo -- ^ Quote a term. | Unquote ExprInfo -- ^ The splicing construct: unquote ... | DontCare Expr -- ^ For printing @DontCare@ from @Syntax.Internal@. deriving (Typeable, Show) -- | Record field assignment @f = e@. type Assign = (C.Name, Expr) type Assigns = [Assign] -- | Is a type signature a `postulate' or a function signature? data Axiom = FunSig -- ^ A function signature. | NoFunSig -- ^ Not a function signature, i.e., a postulate (in user input) -- or another (e.g. data/record) type signature (internally). deriving (Typeable, Eq, Ord, Show) -- | Renaming (generic). type Ren a = [(a, a)] data Declaration = Axiom Axiom DefInfo ArgInfo QName Expr -- ^ type signature (can be irrelevant and colored, but not hidden) | Field DefInfo QName (Arg Expr) -- ^ record field | Primitive DefInfo QName Expr -- ^ primitive function | Mutual MutualInfo [Declaration] -- ^ a bunch of mutually recursive definitions | Section ModuleInfo ModuleName [TypedBindings] [Declaration] | Apply ModuleInfo ModuleName ModuleApplication (Ren QName) (Ren ModuleName) | Import ModuleInfo ModuleName | Pragma Range Pragma | Open ModuleInfo ModuleName -- ^ only retained for highlighting purposes | FunDef DefInfo QName Delayed [Clause] -- ^ sequence of function clauses | DataSig DefInfo QName Telescope Expr -- ^ lone data signature -- ^ the 'LamBinding's are 'DomainFree' and binds the parameters of the datatype. | DataDef DefInfo QName [LamBinding] [Constructor] -- ^ the 'LamBinding's are 'DomainFree' and binds the parameters of the datatype. | RecSig DefInfo QName Telescope Expr -- ^ lone record signature | RecDef DefInfo QName (Maybe (Ranged Induction)) (Maybe QName) [LamBinding] Expr [Declaration] -- ^ The 'Expr' gives the constructor type telescope, @(x1 : A1)..(xn : An) -> Prop@, -- and the optional name is the constructor's name. | PatternSynDef QName [Arg Name] Pattern -- ^ Only for highlighting purposes | UnquoteDecl MutualInfo DefInfo QName Expr | ScopedDecl ScopeInfo [Declaration] -- ^ scope annotation deriving (Typeable, Show) class GetDefInfo a where getDefInfo :: a -> Maybe DefInfo instance GetDefInfo Declaration where getDefInfo (Axiom _ i _ _ _) = Just i getDefInfo (Field i _ _) = Just i getDefInfo (Primitive i _ _) = Just i getDefInfo (ScopedDecl _ (d:_)) = getDefInfo d getDefInfo (FunDef i _ _ _) = Just i getDefInfo (DataSig i _ _ _) = Just i getDefInfo (DataDef i _ _ _) = Just i getDefInfo (RecSig i _ _ _) = Just i getDefInfo (RecDef i _ _ _ _ _ _) = Just i getDefInfo _ = Nothing data ModuleApplication = SectionApp Telescope ModuleName [NamedArg Expr] -- ^ @tel. M args@: applies @M@ to @args@ and abstracts @tel@. | RecordModuleIFS ModuleName -- ^ @M {{...}}@ deriving (Typeable, Show) data Pragma = OptionsPragma [String] | BuiltinPragma String Expr | BuiltinNoDefPragma String QName -- ^ Builtins that do not come with a definition, -- but declare a name for an Agda concept. | RewritePragma QName | CompiledPragma QName String | CompiledExportPragma QName String | CompiledTypePragma QName String | CompiledDataPragma QName String [String] | CompiledEpicPragma QName String | CompiledJSPragma QName String | StaticPragma QName | EtaPragma QName deriving (Typeable, Show) -- | Bindings that are valid in a @let@. data LetBinding = LetBind LetInfo ArgInfo Name Expr Expr -- ^ @LetBind info rel name type defn@ | LetPatBind LetInfo Pattern Expr -- ^ Irrefutable pattern binding. | LetApply ModuleInfo ModuleName ModuleApplication (Ren QName) (Ren ModuleName) -- ^ @LetApply mi newM (oldM args) renaming moduleRenaming@. | LetOpen ModuleInfo ModuleName -- ^ only for highlighting and abstractToConcrete deriving (Typeable, Show) -- | Only 'Axiom's. type TypeSignature = Declaration type Constructor = TypeSignature type Field = TypeSignature -- | A lambda binding is either domain free or typed. data LamBinding = DomainFree ArgInfo Name -- ^ . @x@ or @{x}@ or @.x@ or @.{x}@ | DomainFull TypedBindings -- ^ . @(xs:e)@ or @{xs:e}@ or @(let Ds)@ deriving (Typeable, Show) -- | Typed bindings with hiding information. data TypedBindings = TypedBindings Range (Arg TypedBinding) -- ^ . @(xs : e)@ or @{xs : e}@ deriving (Typeable, Show) -- | A typed binding. Appears in dependent function spaces, typed lambdas, and -- telescopes. It might be tempting to simplify this to only bind a single -- name at a time, and translate, say, @(x y : A)@ to @(x : A)(y : A)@ -- before type-checking. However, this would be slightly problematic: -- -- 1. We would have to typecheck the type @A@ several times. -- -- 2. If @A@ contains a meta variable or hole, it would be duplicated -- by such a translation. -- -- While 1. is only slightly inefficient, 2. would be an outright bug. -- Duplicating @A@ could not be done naively, we would have to make sure -- that the metas of the copy are aliases of the metas of the original. data TypedBinding = TBind Range [WithHiding Name] Expr -- ^ As in telescope @(x y z : A)@ or type @(x y z : A) -> B@. | TLet Range [LetBinding] -- ^ E.g. @(let x = e)@ or @(let open M)@. deriving (Typeable, Show) type Telescope = [TypedBindings] -- | We could throw away @where@ clauses at this point and translate them to -- @let@. It's not obvious how to remember that the @let@ was really a -- @where@ clause though, so for the time being we keep it here. data Clause' lhs = Clause { clauseLHS :: lhs , clauseRHS :: RHS , clauseWhereDecls :: [Declaration] } deriving (Typeable, Show, Functor, Foldable, Traversable) type Clause = Clause' LHS type SpineClause = Clause' SpineLHS data RHS = RHS Expr | AbsurdRHS | WithRHS QName [Expr] [Clause] -- ^ The 'QName' is the name of the with function. | RewriteRHS [(QName, Expr)] RHS [Declaration] -- ^ The 'QName's are the names of the generated with functions. -- One for each 'Expr'. -- The RHS shouldn't be another @RewriteRHS@. deriving (Typeable, Show) -- | The lhs of a clause in spine view (inside-out). -- Projection patterns are contained in @spLhsPats@, -- represented as @DefP d []@. data SpineLHS = SpineLHS { spLhsInfo :: LHSInfo -- ^ Range. , spLhsDefName :: QName -- ^ Name of function we are defining. , spLhsPats :: [NamedArg Pattern] -- ^ Function parameters (patterns). , spLhsWithPats :: [Pattern] -- ^ @with@ patterns (after @|@). } deriving (Typeable, Show) -- | The lhs of a clause in focused (projection-application) view (outside-in). -- Projection patters are represented as 'LHSProj's. data LHS = LHS { lhsInfo :: LHSInfo -- ^ Range. , lhsCore :: LHSCore -- ^ Copatterns. , lhsWithPats :: [Pattern] -- ^ @with@ patterns (after @|@). } deriving (Typeable, Show) -- | The lhs minus @with@-patterns in projection-application view. -- Parameterised over the type @e@ of dot patterns. data LHSCore' e -- | The head applied to ordinary patterns. = LHSHead { lhsDefName :: QName -- ^ Head @f@. , lhsPats :: [NamedArg (Pattern' e)] -- ^ Applied to patterns @ps@. } -- | Projection | LHSProj { lhsDestructor :: QName -- ^ Record projection identifier. , lhsPatsLeft :: [NamedArg (Pattern' e)] -- ^ Indices of the projection. -- Currently none @[]@, since we do not have indexed records. , lhsFocus :: NamedArg (LHSCore' e) -- ^ Main branch. , lhsPatsRight :: [NamedArg (Pattern' e)] -- ^ Further applied to patterns. } deriving (Eq, Typeable, Show, Functor, Foldable, Traversable) type LHSCore = LHSCore' Expr -- | Convert a focused lhs to spine view and back. class LHSToSpine a b where lhsToSpine :: a -> b spineToLhs :: b -> a -- | Clause instance. instance LHSToSpine Clause SpineClause where lhsToSpine = fmap lhsToSpine spineToLhs = fmap spineToLhs -- | List instance (for clauses). instance LHSToSpine a b => LHSToSpine [a] [b] where lhsToSpine = map lhsToSpine spineToLhs = map spineToLhs -- | LHS instance. instance LHSToSpine LHS SpineLHS where lhsToSpine (LHS i core wps) = SpineLHS i f ps wps where QNamed f ps = lhsCoreToSpine core spineToLhs (SpineLHS i f ps wps) = LHS i (spineToLhsCore $ QNamed f ps) wps lhsCoreToSpine :: LHSCore' e -> A.QNamed [NamedArg (Pattern' e)] lhsCoreToSpine (LHSHead f ps) = QNamed f ps lhsCoreToSpine (LHSProj d ps1 h ps2) = (++ (p : ps2)) <$> lhsCoreToSpine (namedArg h) where p = updateNamedArg (const $ DefP patNoRange d ps1) h spineToLhsCore :: QNamed [NamedArg (Pattern' e)] -> LHSCore' e spineToLhsCore (QNamed f ps) = lhsCoreAddSpine (LHSHead f []) ps -- | Add applicative patterns (non-projection patterns) to the right. lhsCoreApp :: LHSCore' e -> [NamedArg (Pattern' e)] -> LHSCore' e lhsCoreApp (LHSHead f ps) ps' = LHSHead f $ ps ++ ps' lhsCoreApp (LHSProj d ps1 h ps2) ps' = LHSProj d ps1 h $ ps2 ++ ps' -- | Add projection and applicative patterns to the right. lhsCoreAddSpine :: LHSCore' e -> [NamedArg (Pattern' e)] -> LHSCore' e lhsCoreAddSpine core ps = case ps2 of (Common.Arg info (Named n (DefP i d ps0)) : ps2') -> LHSProj d ps0 (Common.Arg info $ Named n $ lhsCoreApp core ps1) [] `lhsCoreAddSpine` ps2' [] -> lhsCoreApp core ps _ -> __IMPOSSIBLE__ where (ps1, ps2) = break (isDefP . namedArg) ps isDefP DefP{} = True isDefP _ = False -- | Used for checking pattern linearity. lhsCoreAllPatterns :: LHSCore' e -> [Pattern' e] lhsCoreAllPatterns = map namedArg . qnamed . lhsCoreToSpine -- | Used in AbstractToConcrete. lhsCoreToPattern :: LHSCore -> Pattern lhsCoreToPattern lc = case lc of LHSHead f aps -> DefP noInfo f aps LHSProj d aps1 lhscore aps2 -> DefP noInfo d $ aps1 ++ fmap (fmap lhsCoreToPattern) lhscore : aps2 where noInfo = patNoRange -- TODO, preserve range! mapLHSHead :: (QName -> [NamedArg Pattern] -> LHSCore) -> LHSCore -> LHSCore mapLHSHead f (LHSHead x ps) = f x ps mapLHSHead f (LHSProj d ps1 l ps2) = LHSProj d ps1 (fmap (fmap (mapLHSHead f)) l) ps2 --------------------------------------------------------------------------- -- * Patterns --------------------------------------------------------------------------- -- | Parameterised over the type of dot patterns. data Pattern' e = VarP Name | ConP ConPatInfo AmbiguousQName [NamedArg (Pattern' e)] | DefP PatInfo QName [NamedArg (Pattern' e)] -- ^ Defined pattern: function definition @f ps@ or destructor pattern @d p ps@. | WildP PatInfo -- ^ Underscore pattern entered by user. -- Or generated at type checking for implicit arguments. | AsP PatInfo Name (Pattern' e) | DotP PatInfo e | AbsurdP PatInfo | LitP Literal | PatternSynP PatInfo QName [NamedArg (Pattern' e)] deriving (Typeable, Show, Functor, Foldable, Traversable) type Pattern = Pattern' Expr type Patterns = [NamedArg Pattern] -- | Check whether we are a projection pattern. class IsProjP a where isProjP :: a -> Maybe QName instance IsProjP (Pattern' e) where isProjP (DefP _ d []) = Just d isProjP _ = Nothing instance IsProjP a => IsProjP (Common.Arg c a) where isProjP = isProjP . unArg instance IsProjP a => IsProjP (Named n a) where isProjP = isProjP . namedThing {-------------------------------------------------------------------------- Instances --------------------------------------------------------------------------} -- | Literal equality of patterns, ignoring dot patterns instance Eq (Pattern' e) where p == p' = case (p,p') of ((VarP x) , (VarP x') ) -> x === x' ((ConP _ x ps) , (ConP _ x' ps') ) -> x == x' && ps == ps' ((DefP _ x ps) , (DefP _ x' ps') ) -> x == x' && ps == ps' ((WildP _) , (WildP _) ) -> True ((AsP _ x p) , (AsP _ x' p') ) -> x === x' && p == p' ((DotP _ _) , (DotP _ _) ) -> True (AbsurdP{} , AbsurdP{} ) -> True ((LitP l) , (LitP l') ) -> l == l' ((PatternSynP _ x ps) , (PatternSynP _ x' ps')) -> x == x' && ps == ps' (_ , _ ) -> False where (Name _ (C.Name _ x) _ _) === (Name _ (C.Name _ x') _ _) = True (Name _ C.NoName{} _ _) === (Name _ C.NoName{} _ _) = True _ === _ = False instance Eq LHS where (LHS _ core wps) == (LHS _ core' wps') = core == core' && wps == wps' instance Underscore Expr where underscore = Underscore emptyMetaInfo isUnderscore = __IMPOSSIBLE__ instance LensHiding TypedBindings where getHiding (TypedBindings _ a) = getHiding a mapHiding f (TypedBindings r a) = TypedBindings r $ mapHiding f a instance LensHiding LamBinding where getHiding (DomainFree ai _) = getHiding ai getHiding (DomainFull tb) = getHiding tb mapHiding f (DomainFree ai x) = mapHiding f ai `DomainFree` x mapHiding f (DomainFull tb) = DomainFull $ mapHiding f tb instance HasRange LamBinding where getRange (DomainFree _ x) = getRange x getRange (DomainFull b) = getRange b instance HasRange TypedBindings where getRange (TypedBindings r _) = r instance HasRange TypedBinding where getRange (TBind r _ _) = r getRange (TLet r _) = r instance HasRange Expr where getRange (Var x) = getRange x getRange (Def x) = getRange x getRange (Proj x) = getRange x getRange (Con x) = getRange x getRange (Lit l) = getRange l getRange (QuestionMark i _) = getRange i getRange (Underscore i) = getRange i getRange (App i _ _) = getRange i getRange (WithApp i _ _) = getRange i getRange (Lam i _ _) = getRange i getRange (AbsurdLam i _) = getRange i getRange (ExtendedLam i _ _ _) = getRange i getRange (Pi i _ _) = getRange i getRange (Fun i _ _) = getRange i getRange (Set i _) = getRange i getRange (Prop i) = getRange i getRange (Let i _ _) = getRange i getRange (Rec i _) = getRange i getRange (RecUpdate i _ _) = getRange i getRange (ETel tel) = getRange tel getRange (ScopedExpr _ e) = getRange e getRange (QuoteGoal _ _ e) = getRange e getRange (QuoteContext _ _ e) = getRange e getRange (Quote i) = getRange i getRange (QuoteTerm i) = getRange i getRange (Unquote i) = getRange i getRange (DontCare{}) = noRange getRange (PatternSyn x) = getRange x instance HasRange Declaration where getRange (Axiom _ i _ _ _ ) = getRange i getRange (Field i _ _ ) = getRange i getRange (Mutual i _ ) = getRange i getRange (Section i _ _ _ ) = getRange i getRange (Apply i _ _ _ _ ) = getRange i getRange (Import i _ ) = getRange i getRange (Primitive i _ _ ) = getRange i getRange (Pragma i _ ) = getRange i getRange (Open i _ ) = getRange i getRange (ScopedDecl _ d ) = getRange d getRange (FunDef i _ _ _ ) = getRange i getRange (DataSig i _ _ _ ) = getRange i getRange (DataDef i _ _ _ ) = getRange i getRange (RecSig i _ _ _ ) = getRange i getRange (RecDef i _ _ _ _ _ _) = getRange i getRange (PatternSynDef x _ _ ) = getRange x getRange (UnquoteDecl _ i _ _) = getRange i instance HasRange (Pattern' e) where getRange (VarP x) = getRange x getRange (ConP i _ _) = getRange i getRange (DefP i _ _) = getRange i getRange (WildP i) = getRange i getRange (AsP i _ _) = getRange i getRange (DotP i _) = getRange i getRange (AbsurdP i) = getRange i getRange (LitP l) = getRange l getRange (PatternSynP i _ _) = getRange i instance HasRange SpineLHS where getRange (SpineLHS i _ _ _) = getRange i instance HasRange LHS where getRange (LHS i _ _) = getRange i instance HasRange (LHSCore' e) where getRange (LHSHead f ps) = fuseRange f ps getRange (LHSProj d ps1 lhscore ps2) = d `fuseRange` ps1 `fuseRange` lhscore `fuseRange` ps2 instance HasRange a => HasRange (Clause' a) where getRange (Clause lhs rhs ds) = getRange (lhs,rhs,ds) instance HasRange RHS where getRange AbsurdRHS = noRange getRange (RHS e) = getRange e getRange (WithRHS _ e cs) = fuseRange e cs getRange (RewriteRHS xes rhs wh) = getRange (map snd xes, rhs, wh) instance HasRange LetBinding where getRange (LetBind i _ _ _ _ ) = getRange i getRange (LetPatBind i _ _ ) = getRange i getRange (LetApply i _ _ _ _ ) = getRange i getRange (LetOpen i _ ) = getRange i -- setRange for patterns applies the range to the outermost pattern constructor instance SetRange (Pattern' a) where setRange r (VarP x) = VarP (setRange r x) setRange r (ConP i ns as) = ConP (setRange r i) ns as setRange r (DefP _ n as) = DefP (PatRange r) (setRange r n) as setRange r (WildP _) = WildP (PatRange r) setRange r (AsP _ n p) = AsP (PatRange r) (setRange r n) p setRange r (DotP _ e) = DotP (PatRange r) e setRange r (AbsurdP _) = AbsurdP (PatRange r) setRange r (LitP l) = LitP (setRange r l) setRange r (PatternSynP _ n as) = PatternSynP (PatRange r) (setRange r n) as instance KillRange LamBinding where killRange (DomainFree info x) = killRange1 (DomainFree info) x killRange (DomainFull b) = killRange1 DomainFull b instance KillRange TypedBindings where killRange (TypedBindings r b) = TypedBindings (killRange r) (killRange b) instance KillRange TypedBinding where killRange (TBind r xs e) = killRange3 TBind r xs e killRange (TLet r lbs) = killRange2 TLet r lbs instance KillRange Expr where killRange (Var x) = killRange1 Var x killRange (Def x) = killRange1 Def x killRange (Proj x) = killRange1 Proj x killRange (Con x) = killRange1 Con x killRange (Lit l) = killRange1 Lit l killRange (QuestionMark i ii) = killRange2 QuestionMark i ii killRange (Underscore i) = killRange1 Underscore i killRange (App i e1 e2) = killRange3 App i e1 e2 killRange (WithApp i e es) = killRange3 WithApp i e es killRange (Lam i b e) = killRange3 Lam i b e killRange (AbsurdLam i h) = killRange2 AbsurdLam i h killRange (ExtendedLam i n d ps) = killRange4 ExtendedLam i n d ps killRange (Pi i a b) = killRange3 Pi i a b killRange (Fun i a b) = killRange3 Fun i a b killRange (Set i n) = killRange2 Set i n killRange (Prop i) = killRange1 Prop i killRange (Let i ds e) = killRange3 Let i ds e killRange (Rec i fs) = killRange2 Rec i fs killRange (RecUpdate i e fs) = killRange3 RecUpdate i e fs killRange (ETel tel) = killRange1 ETel tel killRange (ScopedExpr s e) = killRange1 (ScopedExpr s) e killRange (QuoteGoal i x e) = killRange3 QuoteGoal i x e killRange (QuoteContext i x e) = killRange3 QuoteContext i x e killRange (Quote i) = killRange1 Quote i killRange (QuoteTerm i) = killRange1 QuoteTerm i killRange (Unquote i) = killRange1 Unquote i killRange (DontCare e) = killRange1 DontCare e killRange (PatternSyn x) = killRange1 PatternSyn x instance KillRange Declaration where killRange (Axiom p i rel a b ) = killRange4 (Axiom p) i rel a b killRange (Field i a b ) = killRange3 Field i a b killRange (Mutual i a ) = killRange2 Mutual i a killRange (Section i a b c ) = killRange4 Section i a b c killRange (Apply i a b c d ) = killRange3 Apply i a b c d -- the last two arguments of Apply are name maps, so nothing to kill killRange (Import i a ) = killRange2 Import i a killRange (Primitive i a b ) = killRange3 Primitive i a b killRange (Pragma i a ) = Pragma (killRange i) a killRange (Open i x ) = killRange2 Open i x killRange (ScopedDecl a d ) = killRange1 (ScopedDecl a) d killRange (FunDef i a b c ) = killRange4 FunDef i a b c killRange (DataSig i a b c ) = killRange4 DataSig i a b c killRange (DataDef i a b c ) = killRange4 DataDef i a b c killRange (RecSig i a b c ) = killRange4 RecSig i a b c killRange (RecDef i a b c d e f ) = killRange7 RecDef i a b c d e f killRange (PatternSynDef x xs p ) = killRange3 PatternSynDef x xs p killRange (UnquoteDecl mi i x e ) = killRange4 UnquoteDecl mi i x e instance KillRange ModuleApplication where killRange (SectionApp a b c ) = killRange3 SectionApp a b c killRange (RecordModuleIFS a ) = killRange1 RecordModuleIFS a instance KillRange e => KillRange (Pattern' e) where killRange (VarP x) = killRange1 VarP x killRange (ConP i a b) = killRange3 ConP i a b killRange (DefP i a b) = killRange3 DefP i a b killRange (WildP i) = killRange1 WildP i killRange (AsP i a b) = killRange3 AsP i a b killRange (DotP i a) = killRange2 DotP i a killRange (AbsurdP i) = killRange1 AbsurdP i killRange (LitP l) = killRange1 LitP l killRange (PatternSynP i a p) = killRange3 PatternSynP i a p instance KillRange SpineLHS where killRange (SpineLHS i a b c) = killRange4 SpineLHS i a b c instance KillRange LHS where killRange (LHS i a b) = killRange3 LHS i a b instance KillRange e => KillRange (LHSCore' e) where killRange (LHSHead a b) = killRange2 LHSHead a b killRange (LHSProj a b c d) = killRange4 LHSProj a b c d instance KillRange a => KillRange (Clause' a) where killRange (Clause lhs rhs ds) = killRange3 Clause lhs rhs ds instance KillRange RHS where killRange AbsurdRHS = AbsurdRHS killRange (RHS e) = killRange1 RHS e killRange (WithRHS q e cs) = killRange3 WithRHS q e cs killRange (RewriteRHS xes rhs wh) = killRange3 RewriteRHS xes rhs wh instance KillRange LetBinding where killRange (LetBind i info a b c) = killRange5 LetBind i info a b c killRange (LetPatBind i a b ) = killRange3 LetPatBind i a b killRange (LetApply i a b c d ) = killRange3 LetApply i a b c d killRange (LetOpen i x ) = killRange2 LetOpen i x instanceUniverseBiT' [] [t| (Declaration, QName) |] instanceUniverseBiT' [] [t| (Declaration, AmbiguousQName) |] instanceUniverseBiT' [] [t| (Declaration, Expr) |] instanceUniverseBiT' [] [t| (Declaration, LetBinding) |] instanceUniverseBiT' [] [t| (Declaration, LamBinding) |] instanceUniverseBiT' [] [t| (Declaration, TypedBinding) |] instanceUniverseBiT' [] [t| (Declaration, Pattern) |] instanceUniverseBiT' [] [t| (Declaration, Declaration) |] instanceUniverseBiT' [] [t| (Declaration, ModuleName) |] instanceUniverseBiT' [] [t| (Declaration, ModuleInfo) |] instanceUniverseBiT' [] [t| (Declaration, RString) |] -- RString is not quite what you want but we put names on lots of things... ------------------------------------------------------------------------ -- Queries ------------------------------------------------------------------------ -- | Extracts all the names which are declared in a 'Declaration'. -- This does not include open public or let expressions, but it does -- include local modules, where clauses and the names of extended -- lambdas. class AllNames a where allNames :: a -> Seq QName instance AllNames a => AllNames [a] where allNames = Fold.foldMap allNames instance AllNames a => AllNames (Maybe a) where allNames = Fold.foldMap allNames instance AllNames a => AllNames (Arg a) where allNames = Fold.foldMap allNames instance AllNames a => AllNames (Named name a) where allNames = Fold.foldMap allNames instance (AllNames a, AllNames b) => AllNames (a,b) where allNames (a,b) = allNames a >< allNames b instance AllNames QName where allNames q = Seq.singleton q instance AllNames Declaration where allNames (Axiom _ _ _ q _) = Seq.singleton q allNames (Field _ q _) = Seq.singleton q allNames (Primitive _ q _) = Seq.singleton q allNames (Mutual _ defs) = allNames defs allNames (DataSig _ q _ _) = Seq.singleton q allNames (DataDef _ q _ decls) = q <| allNames decls allNames (RecSig _ q _ _) = Seq.singleton q allNames (RecDef _ q _ c _ _ decls) = q <| allNames c >< allNames decls allNames (PatternSynDef q _ _) = Seq.singleton q allNames (UnquoteDecl _ _ q _) = Seq.singleton q allNames (FunDef _ q _ cls) = q <| allNames cls allNames (Section _ _ _ decls) = allNames decls allNames Apply{} = Seq.empty allNames Import{} = Seq.empty allNames Pragma{} = Seq.empty allNames Open{} = Seq.empty allNames (ScopedDecl _ decls) = allNames decls instance AllNames Clause where allNames (Clause _ rhs decls) = allNames rhs >< allNames decls instance AllNames RHS where allNames (RHS e) = allNames e allNames AbsurdRHS{} = Seq.empty allNames (WithRHS q _ cls) = q <| allNames cls allNames (RewriteRHS qes rhs cls) = Seq.fromList (map fst qes) >< allNames rhs >< allNames cls instance AllNames Expr where allNames Var{} = Seq.empty allNames Def{} = Seq.empty allNames Proj{} = Seq.empty allNames Con{} = Seq.empty allNames Lit{} = Seq.empty allNames QuestionMark{} = Seq.empty allNames Underscore{} = Seq.empty allNames (App _ e1 e2) = allNames e1 >< allNames e2 allNames (WithApp _ e es) = allNames e >< allNames es allNames (Lam _ b e) = allNames b >< allNames e allNames AbsurdLam{} = Seq.empty allNames (ExtendedLam _ _ q cls) = q <| allNames cls allNames (Pi _ tel e) = allNames tel >< allNames e allNames (Fun _ e1 e2) = allNames e1 >< allNames e2 allNames Set{} = Seq.empty allNames Prop{} = Seq.empty allNames (Let _ lbs e) = allNames lbs >< allNames e allNames ETel{} = __IMPOSSIBLE__ allNames (Rec _ fields) = allNames $ map snd fields allNames (RecUpdate _ e fs) = allNames e >< allNames (map snd fs) allNames (ScopedExpr _ e) = allNames e allNames (QuoteGoal _ _ e) = allNames e allNames (QuoteContext _ _ e) = allNames e allNames Quote{} = Seq.empty allNames QuoteTerm{} = Seq.empty allNames Unquote{} = Seq.empty allNames DontCare{} = Seq.empty allNames (PatternSyn x) = Seq.empty instance AllNames LamBinding where allNames DomainFree{} = Seq.empty allNames (DomainFull binds) = allNames binds instance AllNames TypedBindings where allNames (TypedBindings _ bs) = allNames bs instance AllNames TypedBinding where allNames (TBind _ _ e) = allNames e allNames (TLet _ lbs) = allNames lbs instance AllNames LetBinding where allNames (LetBind _ _ _ e1 e2) = allNames e1 >< allNames e2 allNames (LetPatBind _ _ e) = allNames e allNames (LetApply _ _ app _ _) = allNames app allNames LetOpen{} = Seq.empty instance AllNames ModuleApplication where allNames (SectionApp bindss _ es) = allNames bindss >< allNames es allNames RecordModuleIFS{} = Seq.empty -- | The name defined by the given axiom. -- -- Precondition: The declaration has to be a (scoped) 'Axiom'. axiomName :: Declaration -> QName axiomName (Axiom _ _ _ q _) = q axiomName (ScopedDecl _ (d:_)) = axiomName d axiomName _ = __IMPOSSIBLE__ -- | Are we in an abstract block? -- -- In that case some definition is abstract. class AnyAbstract a where anyAbstract :: a -> Bool instance AnyAbstract a => AnyAbstract [a] where anyAbstract = Fold.any anyAbstract instance AnyAbstract Declaration where anyAbstract (Axiom _ i _ _ _) = defAbstract i == AbstractDef anyAbstract (Field i _ _) = defAbstract i == AbstractDef anyAbstract (Mutual _ ds) = anyAbstract ds anyAbstract (ScopedDecl _ ds) = anyAbstract ds anyAbstract (Section _ _ _ ds) = anyAbstract ds anyAbstract (FunDef i _ _ _) = defAbstract i == AbstractDef anyAbstract (DataDef i _ _ _) = defAbstract i == AbstractDef anyAbstract (RecDef i _ _ _ _ _ _) = defAbstract i == AbstractDef anyAbstract (DataSig i _ _ _) = defAbstract i == AbstractDef anyAbstract (RecSig i _ _ _) = defAbstract i == AbstractDef anyAbstract _ = __IMPOSSIBLE__ app :: Expr -> [NamedArg Expr] -> Expr app = foldl (App (ExprRange noRange)) patternToExpr :: Pattern -> Expr patternToExpr (VarP x) = Var x patternToExpr (ConP _ c ps) = Con c `app` map (fmap (fmap patternToExpr)) ps patternToExpr (DefP _ f ps) = Def f `app` map (fmap (fmap patternToExpr)) ps patternToExpr (WildP _) = Underscore emptyMetaInfo patternToExpr (AsP _ _ p) = patternToExpr p patternToExpr (DotP _ e) = e patternToExpr (AbsurdP _) = Underscore emptyMetaInfo -- TODO: could this happen? patternToExpr (LitP l) = Lit l patternToExpr (PatternSynP _ _ _) = __IMPOSSIBLE__ type PatternSynDefn = ([Arg Name], Pattern) type PatternSynDefns = Map QName PatternSynDefn lambdaLiftExpr :: [Name] -> Expr -> Expr lambdaLiftExpr [] e = e lambdaLiftExpr (n:ns) e = Lam (ExprRange noRange) (DomainFree defaultArgInfo n) $ lambdaLiftExpr ns e substPattern :: [(Name, Pattern)] -> Pattern -> Pattern substPattern s p = case p of VarP z -> fromMaybe p (lookup z s) ConP i q ps -> ConP i q (fmap (fmap (fmap (substPattern s))) ps) WildP i -> p DotP i e -> DotP i (substExpr (map (fmap patternToExpr) s) e) AbsurdP i -> p LitP l -> p _ -> __IMPOSSIBLE__ -- pattern synonyms (already gone) and -- @-patterns (not supported anyways). class SubstExpr a where substExpr :: [(Name, Expr)] -> a -> a instance SubstExpr a => SubstExpr [a] where substExpr = fmap . substExpr instance SubstExpr a => SubstExpr (Arg a) where substExpr = fmap . substExpr instance SubstExpr a => SubstExpr (Common.Named name a) where substExpr = fmap . substExpr instance (SubstExpr a, SubstExpr b) => SubstExpr (a, b) where substExpr s (x, y) = (substExpr s x, substExpr s y) instance SubstExpr C.Name where substExpr _ = id instance SubstExpr Expr where substExpr s e = case e of Var n -> fromMaybe e (lookup n s) Def _ -> e Proj{} -> e Con _ -> e Lit _ -> e QuestionMark{} -> e Underscore _ -> e App i e e' -> App i (substExpr s e) (substExpr s e') WithApp i e es -> WithApp i (substExpr s e) (substExpr s es) Lam i lb e -> Lam i lb (substExpr s e) AbsurdLam i h -> e ExtendedLam i di n cs -> __IMPOSSIBLE__ -- Maybe later... Pi i t e -> Pi i (substExpr s t) (substExpr s e) Fun i ae e -> Fun i (substExpr s ae) (substExpr s e) Set i n -> e Prop i -> e Let i ls e -> Let i (substExpr s ls) (substExpr s e) ETel t -> e Rec i nes -> Rec i (substExpr s nes) RecUpdate i e nes -> RecUpdate i (substExpr s e) (substExpr s nes) -- XXX: Do we need to do more with ScopedExprs? ScopedExpr si e -> ScopedExpr si (substExpr s e) QuoteGoal i n e -> QuoteGoal i n (substExpr s e) QuoteContext i n e -> QuoteContext i n (substExpr s e) Quote i -> e QuoteTerm i -> e Unquote i -> e DontCare e -> DontCare (substExpr s e) PatternSyn x -> e instance SubstExpr LetBinding where substExpr s lb = case lb of LetBind i r n e e' -> LetBind i r n (substExpr s e) (substExpr s e') LetPatBind i p e -> LetPatBind i p (substExpr s e) -- Andreas, 2012-06-04: what about the pattern p _ -> lb -- Nicolas, 2013-11-11: what about "LetApply" there is experessions in there instance SubstExpr TypedBindings where substExpr s (TypedBindings r atb) = TypedBindings r (substExpr s atb) instance SubstExpr TypedBinding where substExpr s tb = case tb of TBind r ns e -> TBind r ns $ substExpr s e TLet r lbs -> TLet r $ substExpr s lbs -- TODO: more informative failure insertImplicitPatSynArgs :: HasRange a => (Range -> a) -> Range -> [Arg Name] -> [NamedArg a] -> Maybe ([(Name, a)], [Arg Name]) insertImplicitPatSynArgs wild r ns as = matchArgs r ns as where matchNextArg r n as@(~(a : as')) | matchNext n as = return (namedArg a, as') | getHiding n == NotHidden = Nothing | otherwise = return (wild r, as) matchNext _ [] = False matchNext n (a:as) = getHiding n == getHiding a && matchName where x = unranged $ C.nameToRawName $ nameConcrete $ unArg n matchName = maybe True (== x) (nameOf $ unArg a) matchArgs r [] [] = return ([], []) matchArgs r [] as = Nothing matchArgs r (n:ns) [] | getHiding n == NotHidden = return ([], n : ns) -- under-applied matchArgs r (n:ns) as = do (p, as) <- matchNextArg r n as first ((unArg n, p) :) <$> matchArgs (getRange p) ns as Agda-2.4.2.5/src/full/Agda/Syntax/Internal.hs0000644000000000000000000011734512635075266016716 0ustar0000000000000000{-# LANGUAGE BangPatterns #-} {-# LANGUAGE CPP #-} {-# LANGUAGE DeriveDataTypeable #-} {-# LANGUAGE DeriveFoldable #-} {-# LANGUAGE DeriveFunctor #-} {-# LANGUAGE DeriveTraversable #-} {-# LANGUAGE FlexibleInstances #-} {-# LANGUAGE GeneralizedNewtypeDeriving #-} {-# LANGUAGE MultiParamTypeClasses #-} {-# LANGUAGE StandaloneDeriving #-} {-# LANGUAGE TemplateHaskell #-} module Agda.Syntax.Internal ( module Agda.Syntax.Internal , module Agda.Syntax.Abstract.Name , module Agda.Utils.Pointer , MetaId(..) ) where import Prelude hiding (foldr, mapM, null) import Control.Arrow ((***)) import Control.Applicative hiding (empty) import Control.Monad.Identity hiding (mapM) import Control.Monad.State hiding (mapM) import Control.Parallel import Data.Foldable ( Foldable, foldMap ) import Data.Function import qualified Data.List as List import Data.Maybe import Data.Monoid -- base-4.7 defines the Num instance for Sum #if !(MIN_VERSION_base(4,7,0)) import Data.Orphans () #endif import Data.Traversable import Data.Typeable (Typeable) import Agda.Syntax.Position import Agda.Syntax.Common hiding (Arg, Dom, NamedArg, ArgInfo) import qualified Agda.Syntax.Common as Common import Agda.Syntax.Literal import Agda.Syntax.Abstract (IsProjP(..)) import Agda.Syntax.Abstract.Name import Agda.Utils.Empty -- See Issue 1593. #if !MIN_VERSION_transformers(0,4,1) import Agda.Utils.Except ( Error(noMsg) ) #endif import Agda.Utils.Functor import Agda.Utils.Geniplate import Agda.Utils.Lens import Agda.Utils.List import Agda.Utils.Maybe import Agda.Utils.Null import Agda.Utils.Permutation import Agda.Utils.Pointer import Agda.Utils.Size import Agda.Utils.Pretty as P #include "undefined.h" import Agda.Utils.Impossible type Color = Term type ArgInfo = Common.ArgInfo Color type Arg a = Common.Arg Color a type Dom a = Common.Dom Color a type NamedArg a = Common.NamedArg Color a -- | Type of argument lists. -- type Args = [Arg Term] type NamedArgs = [NamedArg Term] -- | Store the names of the record fields in the constructor. -- This allows reduction of projection redexes outside of TCM. -- For instance, during substitution and application. data ConHead = ConHead { conName :: QName -- ^ The name of the constructor. , conInductive :: Induction -- ^ Record constructors can be coinductive. , conFields :: [QName] -- ^ The name of the record fields. -- Empty list for data constructors. -- 'Arg' is not needed here since it -- is stored in the constructor args. } deriving (Typeable) instance Eq ConHead where (==) = (==) `on` conName instance Ord ConHead where (<=) = (<=) `on` conName instance Show ConHead where show (ConHead c i fs) = show c ++ "(" ++ show i ++ ")" ++ show fs instance HasRange ConHead where getRange = getRange . conName instance SetRange ConHead where setRange r = mapConName (setRange r) class LensConName a where getConName :: a -> QName setConName :: QName -> a -> a setConName = mapConName . const mapConName :: (QName -> QName) -> a -> a mapConName f a = setConName (f (getConName a)) a instance LensConName ConHead where getConName = conName setConName c con = con { conName = c } -- | Raw values. -- -- @Def@ is used for both defined and undefined constants. -- Assume there is a type declaration and a definition for -- every constant, even if the definition is an empty -- list of clauses. -- data Term = Var {-# UNPACK #-} !Int Elims -- ^ @x es@ neutral | Lam ArgInfo (Abs Term) -- ^ Terms are beta normal. Relevance is ignored | ExtLam [Clause] Args -- ^ Only used by unquote --> reify. Should never appear elsewhere. | Lit Literal | Def QName Elims -- ^ @f es@, possibly a delta/iota-redex | Con ConHead Args -- ^ @c vs@ | Pi (Dom Type) (Abs Type) -- ^ dependent or non-dependent function space | Sort Sort | Level Level | MetaV {-# UNPACK #-} !MetaId Elims | DontCare Term -- ^ Irrelevant stuff in relevant position, but created -- in an irrelevant context. Basically, an internal -- version of the irrelevance axiom @.irrAx : .A -> A@. | Shared !(Ptr Term) -- ^ Explicit sharing deriving (Typeable, Show) -- | Eliminations, subsuming applications and projections. -- data Elim' a = Apply (Arg a) | Proj QName -- ^ name of a record projection deriving (Typeable, Show, Functor, Foldable, Traversable) type Elim = Elim' Term type Elims = [Elim] -- ^ eliminations ordered left-to-right. -- | Names in binders and arguments. type ArgName = String argNameToString :: ArgName -> String argNameToString = id stringToArgName :: String -> ArgName stringToArgName = id appendArgNames :: ArgName -> ArgName -> ArgName appendArgNames = (++) nameToArgName :: Name -> ArgName nameToArgName = stringToArgName . prettyShow -- | Binder. -- 'Abs': The bound variable might appear in the body. -- 'NoAbs' is pseudo-binder, it does not introduce a fresh variable, -- similar to the @const@ of Haskell. data Abs a = Abs { absName :: ArgName, unAbs :: a } -- ^ The body has (at least) one free variable. -- Danger: 'unAbs' doesn't shift variables properly | NoAbs { absName :: ArgName, unAbs :: a } deriving (Typeable, Functor, Foldable, Traversable) instance Decoration Abs where traverseF f (Abs x a) = Abs x <$> f a traverseF f (NoAbs x a) = NoAbs x <$> f a -- | Types are terms with a sort annotation. -- data Type' a = El { _getSort :: Sort, unEl :: a } deriving (Typeable, Show, Functor, Foldable, Traversable) type Type = Type' Term instance Decoration Type' where traverseF f (El s a) = El s <$> f a class LensSort a where lensSort :: Lens' Sort a getSort :: a -> Sort getSort a = a ^. lensSort instance LensSort (Type' a) where lensSort f (El s a) = f s <&> \ s' -> El s' a -- General instance leads to overlapping instances. -- instance (Decoration f, LensSort a) => LensSort (f a) where instance LensSort a => LensSort (Common.Dom c a) where lensSort = traverseF . lensSort instance LensSort a => LensSort (Abs a) where lensSort = traverseF . lensSort -- | Sequence of types. An argument of the first type is bound in later types -- and so on. data Tele a = EmptyTel | ExtendTel a (Abs (Tele a)) -- ^ 'Abs' is never 'NoAbs'. deriving (Typeable, Show, Functor, Foldable, Traversable) type Telescope = Tele (Dom Type) -- | A traversal for the names in a telescope. mapAbsNamesM :: Applicative m => (ArgName -> m ArgName) -> Tele a -> m (Tele a) mapAbsNamesM f EmptyTel = pure EmptyTel mapAbsNamesM f (ExtendTel a ( Abs x b)) = ExtendTel a <$> ( Abs <$> f x <*> mapAbsNamesM f b) mapAbsNamesM f (ExtendTel a (NoAbs x b)) = ExtendTel a <$> (NoAbs <$> f x <*> mapAbsNamesM f b) -- Ulf, 2013-11-06: Last case is really impossible but I'd rather find out we -- violated that invariant somewhere other than here. mapAbsNames :: (ArgName -> ArgName) -> Tele a -> Tele a mapAbsNames f = runIdentity . mapAbsNamesM (Identity . f) -- Ulf, 2013-11-06 -- The record parameter is named "" inside the record module so we can avoid -- printing it (issue 208), but we don't want that to show up in the type of -- the functions in the module (issue 892). This function is used on the record -- module telescope before adding it to a type in -- TypeChecking.Monad.Signature.addConstant (to handle functions defined in -- record modules) and TypeChecking.Rules.Record.checkProjection (to handle -- record projections). replaceEmptyName :: ArgName -> Tele a -> Tele a replaceEmptyName x = mapAbsNames $ \ y -> if null y then x else y -- | Sorts. -- data Sort = Type Level -- ^ @Set ℓ@. | Prop -- ^ Dummy sort. | Inf -- ^ @Setω@. | SizeUniv -- ^ @SizeUniv@, a sort inhabited by type @Size@. | DLub Sort (Abs Sort) -- ^ Dependent least upper bound. -- If the free variable occurs in the second sort, -- the whole thing should reduce to Inf, -- otherwise it's the normal lub. deriving (Typeable, Show) -- | A level is a maximum expression of 0..n 'PlusLevel' expressions -- each of which is a number or an atom plus a number. -- -- The empty maximum is the canonical representation for level 0. newtype Level = Max [PlusLevel] deriving (Show, Typeable) data PlusLevel = ClosedLevel Integer -- ^ @n@, to represent @Setₙ@. | Plus Integer LevelAtom -- ^ @n + ℓ@. deriving (Show, Typeable) -- | An atomic term of type @Level@. data LevelAtom = MetaLevel MetaId Elims -- ^ A meta variable targeting @Level@ under some eliminations. | BlockedLevel MetaId Term -- ^ A term of type @Level@ whose reduction is blocked by a meta. | NeutralLevel NotBlocked Term -- ^ A neutral term of type @Level@. | UnreducedLevel Term -- ^ Introduced by 'instantiate', removed by 'reduce'. deriving (Show, Typeable) -- | Even if we are not stuck on a meta during reduction -- we can fail to reduce a definition by pattern matching -- for another reason. data NotBlocked = StuckOn Elim -- ^ The 'Elim' is neutral and blocks a pattern match. | Underapplied -- ^ Not enough arguments were supplied to complete the matching. | AbsurdMatch -- ^ We matched an absurd clause, results in a neutral 'Def'. | MissingClauses -- ^ We ran out of clauses, all considered clauses -- produced an actual mismatch. -- This can happen when try to reduce a function application -- but we are still missing some function clauses. -- See "Agda.TypeChecking.Patterns.Match". | ReallyNotBlocked -- ^ Reduction was not blocked, we reached a whnf -- which can be anything but a stuck @'Def'@. deriving (Show, Typeable) -- | 'ReallyNotBlocked' is the unit. -- 'MissingClauses' is dominant. -- @'StuckOn'{}@ should be propagated, if tied, we take the left. instance Monoid NotBlocked where -- ReallyNotBlocked is neutral mempty = ReallyNotBlocked ReallyNotBlocked `mappend` b = b -- MissingClauses is dominant (absorptive) b@MissingClauses `mappend` _ = b _ `mappend` b@MissingClauses = b -- StuckOn is second strongest b@StuckOn{} `mappend` _ = b _ `mappend` b@StuckOn{} = b b `mappend` _ = b -- | Something where a meta variable may block reduction. data Blocked t = Blocked { theBlockingMeta :: MetaId , ignoreBlocking :: t } | NotBlocked { blockingStatus :: NotBlocked, ignoreBlocking :: t } deriving (Typeable, Show, Functor, Foldable, Traversable) -- deriving (Typeable, Eq, Ord, Functor, Foldable, Traversable) -- | Blocking by a meta is dominant. instance Applicative Blocked where pure = notBlocked f <*> e = ((f $> ()) `mappend` (e $> ())) $> ignoreBlocking f (ignoreBlocking e) -- -- | Blocking by a meta is dominant. -- instance Applicative Blocked where -- pure = notBlocked -- Blocked x f <*> e = Blocked x $ f (ignoreBlocking e) -- NotBlocked nb f <*> Blocked x e = Blocked x $ f e -- NotBlocked nb f <*> NotBlocked nb' e = NotBlocked (nb `mappend` nb') $ f e -- | @'Blocked' t@ without the @t@. type Blocked_ = Blocked () instance Monoid Blocked_ where mempty = notBlocked () b@Blocked{} `mappend` _ = b _ `mappend` b@Blocked{} = b NotBlocked x _ `mappend` NotBlocked y _ = NotBlocked (x `mappend` y) () -- See Issue 1573. #if !MIN_VERSION_transformers(0,4,1) instance Error Blocked_ where noMsg = __IMPOSSIBLE__ #endif -- | When trying to reduce @f es@, on match failed on one -- elimination @e ∈ es@ that came with info @r :: NotBlocked@. -- @stuckOn e r@ produces the new @NotBlocked@ info. -- -- 'MissingClauses' must be propagated, as this is blockage -- that can be lifted in the future (as more clauses are added). -- -- @'StuckOn' e0@ is also propagated, since it provides more -- precise information as @StuckOn e@ (as @e0@ is the original -- reason why reduction got stuck and usually a subterm of @e@). -- An information like @StuckOn (Apply (Arg info (Var i [])))@ -- (stuck on a variable) could be used by the lhs/coverage checker -- to trigger a split on that (pattern) variable. -- -- In the remaining cases for @r@, we are terminally stuck -- due to @StuckOn e@. Propagating @'AbsurdMatch'@ does not -- seem useful. -- -- 'Underapplied' must not be propagated, as this would mean -- that @f es@ is underapplied, which is not the case (it is stuck). -- Note that 'Underapplied' can only arise when projection patterns were -- missing to complete the original match (in @e@). -- (Missing ordinary pattern would mean the @e@ is of function type, -- but we cannot match against something of function type.) stuckOn :: Elim -> NotBlocked -> NotBlocked stuckOn e r = case r of MissingClauses -> r StuckOn{} -> r Underapplied -> r' AbsurdMatch -> r' ReallyNotBlocked -> r' where r' = StuckOn e --------------------------------------------------------------------------- -- * Definitions --------------------------------------------------------------------------- -- | A clause is a list of patterns and the clause body should @Bind@. -- -- The telescope contains the types of the pattern variables and the -- permutation is how to get from the order the variables occur in -- the patterns to the order they occur in the telescope. The body -- binds the variables in the order they appear in the patterns. -- -- @clauseTel ~ permute clausePerm (patternVars namedClausePats)@ -- -- Terms in dot patterns are valid in the clause telescope. -- -- For the purpose of the permutation and the body dot patterns count -- as variables. TODO: Change this! data Clause = Clause { clauseRange :: Range , clauseTel :: Telescope -- ^ @Δ@: The types of the pattern variables. , clausePerm :: Permutation -- ^ @π@ with @Γ ⊢ renamingR π : Δ@, which means @Δ ⊢ renaming π : Γ@. , namedClausePats :: [NamedArg Pattern] -- ^ @let Γ = patternVars namedClausePats@ , clauseBody :: ClauseBody -- ^ @λΓ.v@ , clauseType :: Maybe (Arg Type) -- ^ @Δ ⊢ t@. The type of the rhs under @clauseTel@. -- Used, e.g., by @TermCheck@. -- Can be 'Irrelevant' if we encountered an irrelevant projection -- pattern on the lhs. } deriving (Typeable, Show) clausePats :: Clause -> [Arg Pattern] clausePats = map (fmap namedThing) . namedClausePats data ClauseBodyF a = Body a | Bind (Abs (ClauseBodyF a)) | NoBody -- ^ for absurd clauses. deriving (Typeable, Show, Functor, Foldable, Traversable) type ClauseBody = ClauseBodyF Term imapClauseBody :: (Nat -> a -> b) -> ClauseBodyF a -> ClauseBodyF b imapClauseBody f b = go 0 b where go i (Body x) = Body (f i x) go _ NoBody = NoBody go !i (Bind b) = Bind $ go (i + 1) <$> b instance HasRange Clause where getRange = clauseRange -- | Pattern variables. type PatVarName = ArgName patVarNameToString :: PatVarName -> String patVarNameToString = argNameToString nameToPatVarName :: Name -> PatVarName nameToPatVarName = nameToArgName -- | Patterns are variables, constructors, or wildcards. -- @QName@ is used in @ConP@ rather than @Name@ since -- a constructor might come from a particular namespace. -- This also meshes well with the fact that values (i.e. -- the arguments we are matching with) use @QName@. -- data Pattern' x = VarP x -- ^ @x@ | DotP Term -- ^ @.t@ | ConP ConHead ConPatternInfo [NamedArg (Pattern' x)] -- ^ @c ps@ -- The subpatterns do not contain any projection copatterns. | LitP Literal -- ^ E.g. @5@, @"hello"@. | ProjP QName -- ^ Projection copattern. Can only appear by itself. deriving (Typeable, Show, Functor, Foldable, Traversable) type Pattern = Pattern' PatVarName -- ^ The @PatVarName@ is a name suggestion. -- | Type used when numbering pattern variables. type DeBruijnPattern = Pattern' (Int, PatVarName) namedVarP :: PatVarName -> Named (Ranged PatVarName) Pattern namedVarP x = Named named $ VarP x where named = if isUnderscore x then Nothing else Just $ unranged x -- | The @ConPatternInfo@ states whether the constructor belongs to -- a record type (@Just@) or data type (@Nothing@). -- In the former case, the @Bool@ says whether the record pattern -- orginates from the expansion of an implicit pattern. -- The @Type@ is the type of the whole record pattern. -- The scope used for the type is given by any outer scope -- plus the clause's telescope ('clauseTel'). data ConPatternInfo = ConPatternInfo { conPRecord :: Maybe ConPOrigin -- ^ @Nothing@ if data constructor. -- @Just@ if record constructor. , conPType :: Maybe (Arg Type) -- ^ The type of the whole constructor pattern. -- Should be present (@Just@) if constructor pattern is -- is generated ordinarily by type-checking. -- Could be absent (@Nothing@) if pattern comes from some -- plugin (like Agsy). -- Needed e.g. for with-clause stripping. } deriving (Typeable, Show) noConPatternInfo :: ConPatternInfo noConPatternInfo = ConPatternInfo Nothing Nothing -- | Extract pattern variables in left-to-right order. -- A 'DotP' is also treated as variable (see docu for 'Clause'). patternVars :: Arg Pattern -> [Arg (Either PatVarName Term)] patternVars (Common.Arg i (VarP x) ) = [Common.Arg i $ Left x] patternVars (Common.Arg i (DotP t) ) = [Common.Arg i $ Right t] patternVars (Common.Arg i (ConP _ _ ps)) = List.concat $ map (patternVars . fmap namedThing) ps patternVars (Common.Arg i (LitP l) ) = [] patternVars (Common.Arg i ProjP{} ) = [] -- | Does the pattern perform a match that could fail? properlyMatching :: Pattern -> Bool properlyMatching VarP{} = False properlyMatching DotP{} = False properlyMatching LitP{} = True properlyMatching (ConP _ ci ps) = isNothing (conPRecord ci) || -- not a record cons List.any (properlyMatching . namedArg) ps -- or one of subpatterns is a proper m properlyMatching ProjP{} = True instance IsProjP Pattern where isProjP (ProjP d) = Just d isProjP _ = Nothing ----------------------------------------------------------------------------- -- * Explicit substitutions ----------------------------------------------------------------------------- -- | Substitutions. data Substitution = IdS -- ^ Identity substitution. -- @Γ ⊢ IdS : Γ@ | EmptyS -- ^ Empty substitution, lifts from the empty context. -- Apply this to closed terms you want to use in a non-empty context. -- @Γ ⊢ EmptyS : ()@ | Term :# Substitution -- ^ Substitution extension, ``cons''. -- @ -- Γ ⊢ u : Aρ Γ ⊢ ρ : Δ -- ---------------------- -- Γ ⊢ u :# ρ : Δ, A -- @ | Strengthen Empty Substitution -- ^ Strengthening substitution. First argument is @__IMPOSSIBLE__@. -- Apply this to a term which does not contain variable 0 -- to lower all de Bruijn indices by one. -- @ -- Γ ⊢ ρ : Δ -- --------------------------- -- Γ ⊢ Strengthen ρ : Δ, A -- @ | Wk !Int Substitution -- ^ Weakning substitution, lifts to an extended context. -- @ -- Γ ⊢ ρ : Δ -- ------------------- -- Γ, Ψ ⊢ Wk |Ψ| ρ : Δ -- @ | Lift !Int Substitution -- ^ Lifting substitution. Use this to go under a binder. -- @Lift 1 ρ == var 0 :# Wk 1 ρ@. -- @ -- Γ ⊢ ρ : Δ -- ------------------------- -- Γ, Ψρ ⊢ Lift |Ψ| ρ : Δ, Ψ -- @ deriving (Show) infixr 4 :# --------------------------------------------------------------------------- -- * Absurd Lambda --------------------------------------------------------------------------- -- | Absurd lambdas are internally represented as identity -- with variable name "()". absurdBody :: Abs Term absurdBody = Abs absurdPatternName $ Var 0 [] isAbsurdBody :: Abs Term -> Bool isAbsurdBody (Abs x (Var 0 [])) = isAbsurdPatternName x isAbsurdBody _ = False absurdPatternName :: PatVarName absurdPatternName = "()" isAbsurdPatternName :: PatVarName -> Bool isAbsurdPatternName x = x == absurdPatternName --------------------------------------------------------------------------- -- * Pointers and Sharing --------------------------------------------------------------------------- ignoreSharing :: Term -> Term -- ignoreSharing (Shared p) = ignoreSharing $ derefPtr p ignoreSharing v = v ignoreSharingType :: Type -> Type -- ignoreSharingType (El s v) = El s (ignoreSharing v) ignoreSharingType v = v -- | Introduce sharing. shared :: Term -> Term -- shared v@Shared{} = v -- shared v@(Var _ []) = v -- shared v = Shared (newPtr v) shared v = v sharedType :: Type -> Type -- sharedType (El s v) = El s (shared v) sharedType v = v -- | Typically m would be TCM and f would be Blocked. updateSharedFM :: (Monad m, Applicative m, Traversable f) => (Term -> m (f Term)) -> Term -> m (f Term) updateSharedFM f v0@(Shared p) = do fv <- f (derefPtr p) flip traverse fv $ \v -> case derefPtr (setPtr v p) of Var _ [] -> return v _ -> compressPointerChain v0 `pseq` return v0 updateSharedFM f v = f v updateSharedM :: Monad m => (Term -> m Term) -> Term -> m Term updateSharedM f v0@(Shared p) = do v <- f (derefPtr p) case derefPtr (setPtr v p) of Var _ [] -> return v _ -> compressPointerChain v0 `pseq` return v0 updateSharedM f v = f v updateShared :: (Term -> Term) -> Term -> Term updateShared f v0@(Shared p) = case derefPtr (setPtr (f $ derefPtr p) p) of v@(Var _ []) -> v _ -> compressPointerChain v0 `pseq` v0 updateShared f v = f v pointerChain :: Term -> [Ptr Term] pointerChain (Shared p) = p : pointerChain (derefPtr p) pointerChain _ = [] -- Redirect all top-level pointers to point to the last pointer. So, after -- compression there are at most two top-level indirections. compressPointerChain :: Term -> Term compressPointerChain v = case reverse $ pointerChain v of p:_:ps@(_:_) -> setPointers (Shared p) ps _ -> v where setPointers _ [] = v setPointers u (p : ps) = setPtr u p `seq` setPointers u ps --------------------------------------------------------------------------- -- * Smart constructors --------------------------------------------------------------------------- -- | An unapplied variable. var :: Nat -> Term var i | i >= 0 = Var i [] | otherwise = __IMPOSSIBLE__ -- | Add 'DontCare' is it is not already a @DontCare@. dontCare :: Term -> Term dontCare v = case ignoreSharing v of DontCare{} -> v _ -> DontCare v -- | A dummy type. typeDontCare :: Type typeDontCare = El Prop (Sort Prop) -- | Top sort (Set\omega). topSort :: Type topSort = El Inf (Sort Inf) sort :: Sort -> Type sort s = El (sSuc s) $ Sort s varSort :: Int -> Sort varSort n = Type $ Max [Plus 0 $ NeutralLevel mempty $ var n] -- | Get the next higher sort. sSuc :: Sort -> Sort sSuc Prop = mkType 1 sSuc Inf = Inf sSuc SizeUniv = SizeUniv sSuc (DLub a b) = DLub (sSuc a) (fmap sSuc b) sSuc (Type l) = Type $ levelSuc l levelSuc :: Level -> Level levelSuc (Max []) = Max [ClosedLevel 1] levelSuc (Max as) = Max $ map inc as where inc (ClosedLevel n) = ClosedLevel (n + 1) inc (Plus n l) = Plus (n + 1) l mkType :: Integer -> Sort mkType n = Type $ Max [ClosedLevel n | n > 0] impossibleTerm :: String -> Int -> Term impossibleTerm file line = Lit $ LitString noRange $ unlines [ "An internal error has occurred. Please report this as a bug." , "Location of the error: " ++ file ++ ":" ++ show line ] -- | Constructing a singleton telescope. class SgTel a where sgTel :: a -> Telescope instance SgTel (ArgName, Dom Type) where sgTel (x, dom) = ExtendTel dom $ Abs x EmptyTel instance SgTel (Dom (ArgName, Type)) where sgTel (Common.Dom ai (x, t)) = ExtendTel (Common.Dom ai t) $ Abs x EmptyTel instance SgTel (Dom Type) where sgTel dom = sgTel (stringToArgName "_", dom) hackReifyToMeta :: Term hackReifyToMeta = DontCare $ Lit $ LitInt noRange (-42) isHackReifyToMeta :: Term -> Bool isHackReifyToMeta (DontCare (Lit (LitInt r (-42)))) = r == noRange isHackReifyToMeta _ = False --------------------------------------------------------------------------- -- * Handling blocked terms. --------------------------------------------------------------------------- blockingMeta :: Blocked t -> Maybe MetaId blockingMeta (Blocked m _) = Just m blockingMeta NotBlocked{} = Nothing blocked :: MetaId -> a -> Blocked a blocked x = Blocked x notBlocked :: a -> Blocked a notBlocked = NotBlocked ReallyNotBlocked --------------------------------------------------------------------------- -- * Simple operations on terms and types. --------------------------------------------------------------------------- -- | Removing a topmost 'DontCare' constructor. stripDontCare :: Term -> Term stripDontCare v = case ignoreSharing v of DontCare v -> v _ -> v -- | Doesn't do any reduction. arity :: Type -> Nat arity t = case ignoreSharing $ unEl t of Pi _ b -> 1 + arity (unAbs b) _ -> 0 -- | Make a name that is not in scope. notInScopeName :: ArgName -> ArgName notInScopeName = stringToArgName . ("." ++) . argNameToString -- | Pick the better name suggestion, i.e., the one that is not just underscore. class Suggest a b where suggest :: a -> b -> String instance Suggest String String where suggest "_" y = y suggest x _ = x instance Suggest (Abs a) (Abs b) where suggest b1 b2 = suggest (absName b1) (absName b2) instance Suggest String (Abs b) where suggest x b = suggest x (absName b) instance Suggest Name (Abs b) where suggest n b = suggest (nameToArgName n) (absName b) --------------------------------------------------------------------------- -- * Eliminations. --------------------------------------------------------------------------- -- | Convert top-level postfix projections into prefix projections. unSpine :: Term -> Term unSpine v = case hasElims v of Just (h, es) -> unSpine' h [] es Nothing -> v where unSpine' :: (Elims -> Term) -> Elims -> Elims -> Term unSpine' h res es = case es of [] -> v e@(Apply a) : es' -> unSpine' h (e : res) es' Proj f : es' -> unSpine' (Def f) [Apply (defaultArg v)] es' where v = h $ reverse res -- | A view distinguishing the neutrals @Var@, @Def@, and @MetaV@ which -- can be projected. hasElims :: Term -> Maybe (Elims -> Term, Elims) hasElims v = case ignoreSharing v of Var i es -> Just (Var i, es) Def f es -> Just (Def f, es) MetaV x es -> Just (MetaV x, es) Con{} -> Nothing Lit{} -> Nothing Lam{} -> Nothing Pi{} -> Nothing Sort{} -> Nothing Level{} -> Nothing DontCare{} -> Nothing ExtLam{} -> Nothing Shared{} -> __IMPOSSIBLE__ {- PROBABLY USELESS getElims :: Term -> (Elims -> Term, Elims) getElims v = maybe default id $ hasElims v where default = (\ [] -> v, []) -} -- | Drop 'Apply' constructor. (Unsafe!) argFromElim :: Elim -> Arg Term argFromElim (Apply u) = u argFromElim Proj{} = __IMPOSSIBLE__ -- | Drop 'Apply' constructor. (Safe) isApplyElim :: Elim -> Maybe (Arg Term) isApplyElim (Apply u) = Just u isApplyElim Proj{} = Nothing -- | Drop 'Apply' constructors. (Safe) allApplyElims :: Elims -> Maybe Args allApplyElims = mapM isApplyElim -- | Split at first non-'Apply' splitApplyElims :: Elims -> (Args, Elims) splitApplyElims (Apply u : es) = (u :) *** id $ splitApplyElims es splitApplyElims es = ([], es) class IsProjElim e where isProjElim :: e -> Maybe QName instance IsProjElim Elim where isProjElim (Proj d) = Just d isProjElim Apply{} = Nothing -- | Discard @Proj f@ entries. dropProjElims :: IsProjElim e => [e] -> [e] dropProjElims = filter (isNothing . isProjElim) -- | Discards @Proj f@ entries. argsFromElims :: Elims -> Args argsFromElims = map argFromElim . dropProjElims {- NOTE: Elim' already contains Arg. -- | Commute functors 'Arg' and 'Elim\''. swapArgElim :: Common.Arg c (Elim' a) -> Elim' (Common.Arg c a) swapArgElim (Common.Arg ai (Apply a)) = Apply (Common.Arg ai a) swapArgElim (Common.Arg ai (Proj d)) = Proj d -- IMPOSSIBLE TO DEFINE swapElimArg :: Elim' (Common.Arg c a) -> Common.Arg c (Elim' a) swapElimArg (Apply (Common.Arg ai a)) = Common.Arg ai (Apply a) swapElimArg (Proj d) = defaultArg (Proj d) -} --------------------------------------------------------------------------- -- * Null instances. --------------------------------------------------------------------------- instance Null (Tele a) where empty = EmptyTel null EmptyTel = True null ExtendTel{} = False instance Null ClauseBody where empty = NoBody null NoBody = True null _ = False -- | A 'null' clause is one with no patterns and no rhs. -- Should not exist in practice. instance Null Clause where empty = Clause empty empty empty empty empty empty null (Clause r tel perm pats body t) = null tel && null pats && null body --------------------------------------------------------------------------- -- * Show instances. --------------------------------------------------------------------------- instance Show a => Show (Abs a) where showsPrec p (Abs x a) = showParen (p > 0) $ showString "Abs " . shows x . showString " " . showsPrec 10 a showsPrec p (NoAbs x a) = showParen (p > 0) $ showString "NoAbs " . shows x . showString " " . showsPrec 10 a -- instance Show t => Show (Blocked t) where -- showsPrec p (Blocked m x) = showParen (p > 0) $ -- showString "Blocked " . shows m . showString " " . showsPrec 10 x -- showsPrec p (NotBlocked x) = showsPrec p x --------------------------------------------------------------------------- -- * Sized instances and TermSize. --------------------------------------------------------------------------- -- | The size of a telescope is its length (as a list). instance Sized (Tele a) where size EmptyTel = 0 size (ExtendTel _ tel) = 1 + size tel instance Sized a => Sized (Abs a) where size = size . unAbs -- | The size of a term is roughly the number of nodes in its -- syntax tree. This number need not be precise for logical -- correctness of Agda, it is only used for reporting -- (and maybe decisions regarding performance). -- -- Not counting towards the term size are: -- -- * sort and color annotations, -- * projections. -- class TermSize a where termSize :: a -> Int termSize = getSum . tsize tsize :: a -> Sum Int instance (Foldable t, TermSize a) => TermSize (t a) where tsize = foldMap tsize instance TermSize Term where tsize v = case v of Var _ vs -> 1 + tsize vs Def _ vs -> 1 + tsize vs Con _ vs -> 1 + tsize vs MetaV _ vs -> 1 + tsize vs Level l -> tsize l Lam _ f -> 1 + tsize f Lit _ -> 1 Pi a b -> 1 + tsize a + tsize b Sort s -> tsize s DontCare mv -> tsize mv Shared p -> tsize (derefPtr p) ExtLam{} -> __IMPOSSIBLE__ instance TermSize Sort where tsize s = case s of Type l -> 1 + tsize l Prop -> 1 Inf -> 1 SizeUniv -> 1 DLub s s' -> 1 + tsize s + tsize s' instance TermSize Level where tsize (Max as) = 1 + tsize as instance TermSize PlusLevel where tsize (ClosedLevel _) = 1 tsize (Plus _ a) = tsize a instance TermSize LevelAtom where tsize (MetaLevel _ vs) = 1 + tsize vs tsize (BlockedLevel _ v) = tsize v tsize (NeutralLevel _ v) = tsize v tsize (UnreducedLevel v) = tsize v instance TermSize Substitution where tsize IdS = 1 tsize EmptyS = 1 tsize (Wk _ rho) = 1 + tsize rho tsize (t :# rho) = 1 + tsize t + tsize rho tsize (Strengthen _ rho) = 1 + tsize rho tsize (Lift _ rho) = 1 + tsize rho --------------------------------------------------------------------------- -- * KillRange instances. --------------------------------------------------------------------------- instance KillRange ConHead where killRange (ConHead c i fs) = killRange3 ConHead c i fs instance KillRange Term where killRange v = case v of Var i vs -> killRange1 (Var i) vs Def c vs -> killRange2 Def c vs Con c vs -> killRange2 Con c vs MetaV m vs -> killRange1 (MetaV m) vs Lam i f -> killRange2 Lam i f Lit l -> killRange1 Lit l Level l -> killRange1 Level l Pi a b -> killRange2 Pi a b Sort s -> killRange1 Sort s DontCare mv -> killRange1 DontCare mv Shared p -> Shared $ updatePtr killRange p ExtLam c vs -> killRange2 ExtLam c vs instance KillRange Level where killRange (Max as) = killRange1 Max as instance KillRange PlusLevel where killRange l@ClosedLevel{} = l killRange (Plus n l) = killRange1 (Plus n) l instance KillRange LevelAtom where killRange (MetaLevel n as) = killRange1 (MetaLevel n) as killRange (BlockedLevel m v) = killRange1 (BlockedLevel m) v killRange (NeutralLevel r v) = killRange1 (NeutralLevel r) v killRange (UnreducedLevel v) = killRange1 UnreducedLevel v instance (KillRange a) => KillRange (Type' a) where killRange (El s v) = killRange2 El s v instance KillRange Sort where killRange s = case s of Prop -> Prop Inf -> Inf SizeUniv -> SizeUniv Type a -> killRange1 Type a DLub s1 s2 -> killRange2 DLub s1 s2 instance KillRange Substitution where killRange IdS = IdS killRange EmptyS = EmptyS killRange (Wk n rho) = killRange1 (Wk n) rho killRange (t :# rho) = killRange2 (:#) t rho killRange (Strengthen err rho) = killRange1 (Strengthen err) rho killRange (Lift n rho) = killRange1 (Lift n) rho instance KillRange ConPatternInfo where killRange (ConPatternInfo mr mt) = killRange1 (ConPatternInfo mr) mt instance KillRange Pattern where killRange p = case p of VarP{} -> p DotP v -> killRange1 DotP v ConP con info ps -> killRange3 ConP con info ps LitP l -> killRange1 LitP l ProjP q -> killRange1 ProjP q instance KillRange Clause where killRange (Clause r tel perm ps body t) = killRange6 Clause r tel perm ps body t instance KillRange a => KillRange (ClauseBodyF a) where killRange = fmap killRange instance KillRange a => KillRange (Tele a) where killRange = fmap killRange instance KillRange a => KillRange (Blocked a) where killRange = fmap killRange instance KillRange a => KillRange (Abs a) where killRange = fmap killRange instance KillRange a => KillRange (Elim' a) where killRange = fmap killRange --------------------------------------------------------------------------- -- * UniverseBi instances. --------------------------------------------------------------------------- instanceUniverseBiT' [] [t| (([Type], [Clause]), Pattern) |] instanceUniverseBiT' [] [t| (Args, Pattern) |] instanceUniverseBiT' [] [t| (Elims, Pattern) |] -- ? instanceUniverseBiT' [] [t| (([Type], [Clause]), Term) |] instanceUniverseBiT' [] [t| (Args, Term) |] instanceUniverseBiT' [] [t| (Elims, Term) |] -- ? instanceUniverseBiT' [] [t| ([Term], Term) |] ----------------------------------------------------------------------------- -- * Simple pretty printing ----------------------------------------------------------------------------- instance Pretty Substitution where prettyPrec p rho = brackets $ pr rho where pr rho = case rho of IdS -> text "idS" EmptyS -> text "ε" t :# rho -> prettyPrec 1 t <+> text ":#" <+> pr rho Strengthen _ rho -> text "↓" <+> pr rho Wk n rho -> text ("↑" ++ show n) <+> pr rho Lift n rho -> text ("⇑" ++ show n) <+> pr rho instance Pretty Term where prettyPrec p v = case ignoreSharing v of Var x els -> text ("@" ++ show x) `pApp` els Lam _ b -> mparens (p > 0) $ sep [ text ("λ " ++ show (absName b) ++ " ->") , nest 2 $ pretty (unAbs b) ] Lit l -> pretty l Def q els -> text (show q) `pApp` els Con c vs -> text (show $ conName c) `pApp` map Apply vs Pi a (NoAbs _ b) -> mparens (p > 0) $ sep [ prettyPrec 1 (unDom a) <+> text "->" , nest 2 $ pretty b ] Pi a b -> mparens (p > 0) $ sep [ pDom (domInfo a) (text (absName b) <+> text ":" <+> pretty (unDom a)) <+> text "->" , nest 2 $ pretty (unAbs b) ] Sort s -> pretty s Level l -> pretty l MetaV x els -> pretty x `pApp` els DontCare v -> pretty v Shared{} -> __IMPOSSIBLE__ ExtLam{} -> __IMPOSSIBLE__ where pApp d els = mparens (not (null els) && p > 9) $ d <+> fsep (map (prettyPrec 10) els) pDom i = case getHiding i of NotHidden -> parens Hidden -> braces Instance -> braces . braces instance Pretty Level where prettyPrec p (Max as) = case as of [] -> prettyPrec p (ClosedLevel 0) [a] -> prettyPrec p a _ -> mparens (p > 9) $ List.foldr1 (\a b -> text "lub" <+> a <+> b) $ map (prettyPrec 10) as instance Pretty PlusLevel where prettyPrec p l = case l of ClosedLevel n -> sucs p n $ \_ -> text "lzero" Plus n a -> sucs p n $ \p -> prettyPrec p a where sucs p 0 d = d p sucs p n d = mparens (p > 9) $ text "lsuc" <+> sucs 10 (n - 1) d instance Pretty LevelAtom where prettyPrec p a = case a of MetaLevel x els -> prettyPrec p (MetaV x els) BlockedLevel _ v -> prettyPrec p v NeutralLevel _ v -> prettyPrec p v UnreducedLevel v -> prettyPrec p v instance Pretty Sort where prettyPrec p s = case s of Type (Max []) -> text "Set" Type (Max [ClosedLevel n]) -> text $ "Set" ++ show n Type l -> mparens (p > 9) $ text "Set" <+> prettyPrec 10 l Prop -> text "Prop" Inf -> text "Setω" SizeUniv -> text "SizeUniv" DLub s b -> mparens (p > 9) $ text "dlub" <+> prettyPrec 10 s <+> parens (sep [ text ("λ " ++ show (absName b) ++ " ->") , nest 2 $ pretty (unAbs b) ]) instance Pretty Type where prettyPrec p (El _ a) = prettyPrec p a instance Pretty Elim where prettyPrec p (Apply v) = prettyPrec p v prettyPrec _ (Proj x) = text ("." ++ show x) instance Pretty a => Pretty (Arg a) where prettyPrec p a = ($ unArg a) $ case getHiding a of NotHidden -> prettyPrec p Hidden -> braces . pretty Instance -> braces . braces . pretty instance Pretty a => Pretty (Pattern' a) where prettyPrec n (VarP x) = prettyPrec n x prettyPrec _ (DotP t) = text "." P.<> prettyPrec 10 t prettyPrec n (ConP c i ps) = mparens (n > 0) $ text (show $ conName c) <+> fsep (map (pretty . namedArg) ps) -- -- Version with printing record type: -- prettyPrec _ (ConP c i ps) = (if b then braces else parens) $ prTy $ -- text (show $ conName c) <+> fsep (map (pretty . namedArg) ps) -- where -- b = maybe False (== ConPImplicit) $ conPRecord i -- prTy d = caseMaybe (conPType i) d $ \ t -> d <+> text ":" <+> pretty t prettyPrec _ (LitP l) = text (show l) prettyPrec _ (ProjP q) = text (show q) instance Pretty a => Pretty (ClauseBodyF a) where pretty b = case b of Bind (NoAbs _ b) -> pretty b Bind (Abs x b) -> text (show x ++ ".") <+> pretty b Body t -> pretty t NoBody -> text "()" Agda-2.4.2.5/src/full/Agda/Syntax/Position.hs0000644000000000000000000006771212635075266016750 0ustar0000000000000000{-# LANGUAGE CPP #-} {-# LANGUAGE DeriveDataTypeable #-} {-# LANGUAGE DeriveFoldable #-} {-# LANGUAGE DeriveFunctor #-} {-# LANGUAGE DeriveTraversable #-} {-# LANGUAGE FlexibleInstances #-} {-# LANGUAGE GeneralizedNewtypeDeriving #-} {-# LANGUAGE NoMonomorphismRestriction #-} {-# LANGUAGE ScopedTypeVariables #-} {-# LANGUAGE TemplateHaskell #-} #if __GLASGOW_HASKELL__ <= 708 {-# LANGUAGE OverlappingInstances #-} #endif {-| Position information for syntax. Crucial for giving good error messages. -} module Agda.Syntax.Position ( -- * Positions Position , Position'(..) , positionInvariant , startPos , movePos , movePosByString , backupPos -- * Intervals , Interval , Interval'(..) , intervalInvariant , takeI , dropI -- * Ranges , Range , Range'(..) , rangeInvariant , rightMargin , noRange , posToRange , rStart , rEnd , rangeToInterval , continuous , continuousPerLine , PrintRange(..) , HasRange(..) , SetRange(..) , KillRange(..) , KillRangeT , killRangeMap , killRange1, killRange2, killRange3, killRange4, killRange5, killRange6, killRange7 , killRange8, killRange9, killRange10, killRange11, killRange12, killRange13, killRange14 , killRange15, killRange16, killRange17, killRange18, killRange19 , withRangeOf , fuseRange , fuseRanges , beginningOf , beginningOfFile -- * Tests , tests ) where import Prelude hiding (null) import Control.Applicative hiding (empty) import Control.Monad import Data.Foldable (Foldable) import Data.Function import Data.Int import Data.List hiding (null) import Data.Map (Map) import qualified Data.Map as Map import Data.Set (Set) import qualified Data.Set as Set import Data.Traversable (Traversable) import Data.Typeable (Typeable) import Test.QuickCheck.All import Agda.Utils.FileName hiding (tests) import Agda.Utils.List hiding (tests) import Agda.Utils.Maybe import Agda.Utils.Null import Agda.Utils.Pretty import Agda.Utils.TestHelpers import Agda.Utils.QuickCheck #include "undefined.h" import Agda.Utils.Impossible {-------------------------------------------------------------------------- Types and classes --------------------------------------------------------------------------} -- | Represents a point in the input. -- -- If two positions have the same 'srcFile' and 'posPos' components, -- then the final two components should be the same as well, but since -- this can be hard to enforce the program should not rely too much on -- the last two components; they are mainly there to improve error -- messages for the user. -- -- Note the invariant which positions have to satisfy: 'positionInvariant'. data Position' a = Pn { srcFile :: a -- ^ File. , posPos :: !Int32 -- ^ Position, counting from 1. , posLine :: !Int32 -- ^ Line number, counting from 1. , posCol :: !Int32 -- ^ Column number, counting from 1. } deriving (Typeable, Functor, Foldable, Traversable) positionInvariant :: Position' a -> Bool positionInvariant p = posPos p > 0 && posLine p > 0 && posCol p > 0 importantPart :: Position' a -> (a, Int32) importantPart p = (srcFile p, posPos p) instance Eq a => Eq (Position' a) where (==) = (==) `on` importantPart instance Ord a => Ord (Position' a) where compare = compare `on` importantPart type SrcFile = Maybe AbsolutePath type Position = Position' SrcFile -- | An interval. The @iEnd@ position is not included in the interval. -- -- Note the invariant which intervals have to satisfy: 'intervalInvariant'. data Interval' a = Interval { iStart, iEnd :: !(Position' a) } deriving (Typeable, Eq, Ord, Functor, Foldable, Traversable) type Interval = Interval' SrcFile intervalInvariant :: Ord a => Interval' a -> Bool intervalInvariant i = all positionInvariant [iStart i, iEnd i] && iStart i <= iEnd i -- | The length of an interval, assuming that the start and end -- positions are in the same file. iLength :: Interval' a -> Int32 iLength i = posPos (iEnd i) - posPos (iStart i) -- | A range is a list of intervals. The intervals should be -- consecutive and separated. -- -- Note the invariant which ranges have to satisfy: 'rangeInvariant'. newtype Range' a = Range [Interval' a] deriving (Typeable, Eq, Ord, Functor, Foldable, Traversable, Null) type Range = Range' SrcFile rangeInvariant :: Range -> Bool rangeInvariant (Range []) = True rangeInvariant (Range is) = all intervalInvariant is && and (zipWith (<) (map iEnd $ init is) (map iStart $ tail is)) -- | Conflate a range to its right margin. rightMargin :: Range -> Range rightMargin r@(Range is) = if null is then r else let i = last is in Range [ i { iStart = iEnd i } ] -- | Wrapper to indicate that range should be printed. newtype PrintRange a = PrintRange a deriving (Eq, Ord, HasRange, SetRange, KillRange) -- | Things that have a range are instances of this class. class HasRange t where getRange :: t -> Range instance HasRange Interval where getRange i = Range [i] instance HasRange Range where getRange = id instance HasRange a => HasRange [a] where getRange = foldr fuseRange noRange instance (HasRange a, HasRange b) => HasRange (a,b) where getRange = uncurry fuseRange instance (HasRange a, HasRange b, HasRange c) => HasRange (a,b,c) where getRange (x,y,z) = getRange (x,(y,z)) instance (HasRange a, HasRange b, HasRange c, HasRange d) => HasRange (a,b,c,d) where getRange (x,y,z,w) = getRange (x,(y,(z,w))) instance (HasRange a, HasRange b, HasRange c, HasRange d, HasRange e) => HasRange (a,b,c,d,e) where getRange (x,y,z,w,v) = getRange (x,(y,(z,(w,v)))) instance (HasRange a, HasRange b, HasRange c, HasRange d, HasRange e, HasRange f) => HasRange (a,b,c,d,e,f) where getRange (x,y,z,w,v,u) = getRange (x,(y,(z,(w,(v,u))))) instance (HasRange a, HasRange b, HasRange c, HasRange d, HasRange e, HasRange f, HasRange g) => HasRange (a,b,c,d,e,f,g) where getRange (x,y,z,w,v,u,t) = getRange (x,(y,(z,(w,(v,(u,t)))))) instance HasRange a => HasRange (Maybe a) where getRange Nothing = noRange getRange (Just a) = getRange a -- | If it is also possible to set the range, this is the class. -- -- Instances should satisfy @'getRange' ('setRange' r x) == r@. class HasRange t => SetRange t where setRange :: Range -> t -> t instance SetRange Range where setRange = const instance SetRange a => SetRange [a] where setRange r = fmap $ setRange r -- | Killing the range of an object sets all range information to 'noRange'. class KillRange a where killRange :: KillRangeT a type KillRangeT a = a -> a -- | Remove ranges in keys and values of a map. killRangeMap :: (KillRange k, KillRange v) => KillRangeT (Map k v) killRangeMap = Map.mapKeysMonotonic killRange . Map.map killRange killRange1 :: KillRange a => (a -> b) -> a -> b killRange2 :: (KillRange a, KillRange b) => (a -> b -> c) -> a -> b -> c killRange3 :: (KillRange a, KillRange b, KillRange c) => (a -> b -> c -> d) -> a -> b -> c -> d killRange4 :: (KillRange a, KillRange b, KillRange c, KillRange d) => (a -> b -> c -> d -> e) -> a -> b -> c -> d -> e killRange5 :: ( KillRange a, KillRange b, KillRange c, KillRange d , KillRange e ) => (a -> b -> c -> d -> e -> f) -> a -> b -> c -> d -> e -> f killRange6 :: ( KillRange a, KillRange b, KillRange c, KillRange d , KillRange e, KillRange f ) => (a -> b -> c -> d -> e -> f -> g) -> a -> b -> c -> d -> e -> f -> g killRange7 :: ( KillRange a, KillRange b, KillRange c, KillRange d , KillRange e, KillRange f, KillRange g ) => (a -> b -> c -> d -> e -> f -> g -> h) -> a -> b -> c -> d -> e -> f -> g -> h killRange8 :: ( KillRange a, KillRange b, KillRange c, KillRange d , KillRange e, KillRange f, KillRange g, KillRange h ) => (a -> b -> c -> d -> e -> f -> g -> h -> i) -> a -> b -> c -> d -> e -> f -> g -> h -> i killRange9 :: ( KillRange a, KillRange b, KillRange c, KillRange d , KillRange e, KillRange f, KillRange g, KillRange h , KillRange i ) => (a -> b -> c -> d -> e -> f -> g -> h -> i -> j) -> a -> b -> c -> d -> e -> f -> g -> h -> i -> j killRange10 :: ( KillRange a, KillRange b, KillRange c, KillRange d , KillRange e, KillRange f, KillRange g, KillRange h , KillRange i, KillRange j ) => (a -> b -> c -> d -> e -> f -> g -> h -> i -> j -> k) -> a -> b -> c -> d -> e -> f -> g -> h -> i -> j -> k killRange11 :: ( KillRange a, KillRange b, KillRange c, KillRange d , KillRange e, KillRange f, KillRange g, KillRange h , KillRange i, KillRange j, KillRange k ) => (a -> b -> c -> d -> e -> f -> g -> h -> i -> j -> k -> l) -> a -> b -> c -> d -> e -> f -> g -> h -> i -> j -> k -> l killRange12 :: ( KillRange a, KillRange b, KillRange c, KillRange d , KillRange e, KillRange f, KillRange g, KillRange h , KillRange i, KillRange j, KillRange k, KillRange l ) => (a -> b -> c -> d -> e -> f -> g -> h -> i -> j -> k -> l -> m) -> a -> b -> c -> d -> e -> f -> g -> h -> i -> j -> k -> l -> m killRange13 :: ( KillRange a, KillRange b, KillRange c, KillRange d , KillRange e, KillRange f, KillRange g, KillRange h , KillRange i, KillRange j, KillRange k, KillRange l , KillRange m ) => (a -> b -> c -> d -> e -> f -> g -> h -> i -> j -> k -> l -> m -> n) -> a -> b -> c -> d -> e -> f -> g -> h -> i -> j -> k -> l -> m -> n killRange14 :: ( KillRange a, KillRange b, KillRange c, KillRange d , KillRange e, KillRange f, KillRange g, KillRange h , KillRange i, KillRange j, KillRange k, KillRange l , KillRange m, KillRange n ) => (a -> b -> c -> d -> e -> f -> g -> h -> i -> j -> k -> l -> m -> n -> o) -> a -> b -> c -> d -> e -> f -> g -> h -> i -> j -> k -> l -> m -> n -> o killRange15 :: ( KillRange a, KillRange b, KillRange c, KillRange d , KillRange e, KillRange f, KillRange g, KillRange h , KillRange i, KillRange j, KillRange k, KillRange l , KillRange m, KillRange n, KillRange o ) => (a -> b -> c -> d -> e -> f -> g -> h -> i -> j -> k -> l -> m -> n -> o -> p) -> a -> b -> c -> d -> e -> f -> g -> h -> i -> j -> k -> l -> m -> n -> o -> p killRange16 :: ( KillRange a, KillRange b, KillRange c, KillRange d , KillRange e, KillRange f, KillRange g, KillRange h , KillRange i, KillRange j, KillRange k, KillRange l , KillRange m, KillRange n, KillRange o, KillRange p ) => (a -> b -> c -> d -> e -> f -> g -> h -> i -> j -> k -> l -> m -> n -> o -> p -> q) -> a -> b -> c -> d -> e -> f -> g -> h -> i -> j -> k -> l -> m -> n -> o -> p -> q killRange17 :: ( KillRange a, KillRange b, KillRange c, KillRange d , KillRange e, KillRange f, KillRange g, KillRange h , KillRange i, KillRange j, KillRange k, KillRange l , KillRange m, KillRange n, KillRange o, KillRange p , KillRange q ) => (a -> b -> c -> d -> e -> f -> g -> h -> i -> j -> k -> l -> m -> n -> o -> p -> q -> r) -> a -> b -> c -> d -> e -> f -> g -> h -> i -> j -> k -> l -> m -> n -> o -> p -> q -> r killRange18 :: ( KillRange a, KillRange b, KillRange c, KillRange d , KillRange e, KillRange f, KillRange g, KillRange h , KillRange i, KillRange j, KillRange k, KillRange l , KillRange m, KillRange n, KillRange o, KillRange p , KillRange q, KillRange r ) => (a -> b -> c -> d -> e -> f -> g -> h -> i -> j -> k -> l -> m -> n -> o -> p -> q -> r -> s) -> a -> b -> c -> d -> e -> f -> g -> h -> i -> j -> k -> l -> m -> n -> o -> p -> q -> r -> s killRange19 :: ( KillRange a, KillRange b, KillRange c, KillRange d , KillRange e, KillRange f, KillRange g, KillRange h , KillRange i, KillRange j, KillRange k, KillRange l , KillRange m, KillRange n, KillRange o, KillRange p , KillRange q, KillRange r, KillRange s ) => (a -> b -> c -> d -> e -> f -> g -> h -> i -> j -> k -> l -> m -> n -> o -> p -> q -> r -> s -> t) -> a -> b -> c -> d -> e -> f -> g -> h -> i -> j -> k -> l -> m -> n -> o -> p -> q -> r -> s -> t killRange1 f a = f (killRange a) killRange2 f a = killRange1 (f $ killRange a) killRange3 f a = killRange2 (f $ killRange a) killRange4 f a = killRange3 (f $ killRange a) killRange5 f a = killRange4 (f $ killRange a) killRange6 f a = killRange5 (f $ killRange a) killRange7 f a = killRange6 (f $ killRange a) killRange8 f a = killRange7 (f $ killRange a) killRange9 f a = killRange8 (f $ killRange a) killRange10 f a = killRange9 (f $ killRange a) killRange11 f a = killRange10 (f $ killRange a) killRange12 f a = killRange11 (f $ killRange a) killRange13 f a = killRange12 (f $ killRange a) killRange14 f a = killRange13 (f $ killRange a) killRange15 f a = killRange14 (f $ killRange a) killRange16 f a = killRange15 (f $ killRange a) killRange17 f a = killRange16 (f $ killRange a) killRange18 f a = killRange17 (f $ killRange a) killRange19 f a = killRange18 (f $ killRange a) instance KillRange Range where killRange _ = noRange instance KillRange () where killRange = id instance KillRange Bool where killRange = id instance KillRange Int where killRange = id instance KillRange Integer where killRange = id #if __GLASGOW_HASKELL__ >= 710 instance {-# OVERLAPPABLE #-} KillRange a => KillRange [a] where #else instance KillRange a => KillRange [a] where #endif killRange = map killRange -- | Overlaps with @KillRange [a]@. #if __GLASGOW_HASKELL__ >= 710 instance {-# OVERLAPPING #-} KillRange String where #else instance KillRange String where #endif killRange = id #if __GLASGOW_HASKELL__ >= 710 instance {-# OVERLAPPABLE #-} KillRange a => KillRange (Map k a) where #else instance KillRange a => KillRange (Map k a) where #endif killRange = fmap killRange #if __GLASGOW_HASKELL__ >= 710 instance {-# OVERLAPPABLE #-} (Ord a, KillRange a) => KillRange (Set a) where #else instance (Ord a, KillRange a) => KillRange (Set a) where #endif killRange = Set.map killRange instance (KillRange a, KillRange b) => KillRange (a, b) where killRange (x, y) = (killRange x, killRange y) instance (KillRange a, KillRange b, KillRange c) => KillRange (a, b, c) where killRange (x, y, z) = killRange3 (,,) x y z instance (KillRange a, KillRange b, KillRange c, KillRange d) => KillRange (a, b, c, d) where killRange (x, y, z, u) = killRange4 (,,,) x y z u instance KillRange a => KillRange (Maybe a) where killRange = fmap killRange instance (KillRange a, KillRange b) => KillRange (Either a b) where killRange (Left x) = Left $ killRange x killRange (Right x) = Right $ killRange x ------------------------------------------------------------------------ -- Showing ------------------------------------------------------------------------ -- TODO: 'Show' should output Haskell-parseable representations. -- The following instances are deprecated, and Pretty should be used -- instead. Later, simply derive Show for these types. -- ASR (02 December 2014). This instance is not used anymore (module -- the test suite) when reporting errors. See Issue 1293. instance Show a => Show (Position' (Maybe a)) where show (Pn Nothing _ l c) = show l ++ "," ++ show c show (Pn (Just f) _ l c) = show f ++ ":" ++ show l ++ "," ++ show c instance Show a => Show (Interval' (Maybe a)) where show (Interval s e) = file ++ start ++ "-" ++ end where f = srcFile s sl = posLine s el = posLine e sc = posCol s ec = posCol e file :: String file = case f of Nothing -> "" Just f -> show f ++ ":" start :: String start = show sl ++ "," ++ show sc end :: String end | sl == el = show ec | otherwise = show el ++ "," ++ show ec instance Show a => Show (Range' (Maybe a)) where show r = case rangeToInterval r of Nothing -> "" Just i -> show i ------------------------------------------------------------------------ -- Printing ------------------------------------------------------------------------ instance Pretty a => Pretty (Position' (Maybe a)) where pretty (Pn Nothing _ l c) = pretty l <> pretty "," <> pretty c pretty (Pn (Just f) _ l c) = pretty f <> pretty ":" <> pretty l <> pretty "," <> pretty c instance Pretty a => Pretty (Interval' (Maybe a)) where pretty (Interval s e) = file <> start <> pretty "-" <> end where f = srcFile s sl = posLine s el = posLine e sc = posCol s ec = posCol e file :: Doc file = case f of Nothing -> empty Just f -> pretty f <> colon start :: Doc start = pretty sl <> comma <> pretty sc end :: Doc | sl == el = pretty ec | otherwise = pretty el <> comma <> pretty ec instance Pretty a => Pretty (Range' (Maybe a)) where pretty r = case rangeToInterval r of Nothing -> empty Just i -> pretty i instance (Pretty a, HasRange a) => Pretty (PrintRange a) where pretty (PrintRange a) = pretty a <+> parens (text "at" <+> pretty (getRange a)) {-------------------------------------------------------------------------- Functions on postitions and ranges --------------------------------------------------------------------------} -- | The first position in a file: position 1, line 1, column 1. startPos :: Maybe AbsolutePath -> Position startPos f = Pn { srcFile = f, posPos = 1, posLine = 1, posCol = 1 } -- | Ranges between two unknown positions noRange :: Range' a noRange = Range [] -- | Advance the position by one character. -- A newline character (@'\n'@) moves the position to the first -- character in the next line. Any other character moves the -- position to the next column. movePos :: Position' a -> Char -> Position' a movePos (Pn f p l c) '\n' = Pn f (p + 1) (l + 1) 1 movePos (Pn f p l c) _ = Pn f (p + 1) l (c + 1) -- | Advance the position by a string. -- -- > movePosByString = foldl' movePos movePosByString :: Position' a -> String -> Position' a movePosByString = foldl' movePos -- | Backup the position by one character. -- -- Precondition: The character must not be @'\n'@. backupPos :: Position' a -> Position' a backupPos (Pn f p l c) = Pn f (p - 1) l (c - 1) -- | Extracts the interval corresponding to the given string, assuming -- that the string starts at the beginning of the given interval. -- -- Precondition: The string must not be too long for the interval. takeI :: String -> Interval' a -> Interval' a takeI s i | genericLength s > iLength i = __IMPOSSIBLE__ | otherwise = i { iEnd = movePosByString (iStart i) s } -- | Removes the interval corresponding to the given string from the -- given interval, assuming that the string starts at the beginning of -- the interval. -- -- Precondition: The string must not be too long for the interval. dropI :: String -> Interval' a -> Interval' a dropI s i | genericLength s > iLength i = __IMPOSSIBLE__ | otherwise = i { iStart = movePosByString (iStart i) s } -- | Converts two positions to a range. posToRange :: Ord a => Position' a -> Position' a -> Range' a posToRange p1 p2 | p1 < p2 = Range [Interval p1 p2] | otherwise = Range [Interval p2 p1] -- | Converts a range to an interval, if possible. rangeToInterval :: Range' a -> Maybe (Interval' a) rangeToInterval (Range []) = Nothing rangeToInterval (Range is) = Just $ Interval { iStart = iStart (head is) , iEnd = iEnd (last is) } -- | Returns the shortest continuous range containing the given one. continuous :: Range' a -> Range' a continuous r = case rangeToInterval r of Nothing -> Range [] Just i -> Range [i] -- | Removes gaps between intervals on the same line. continuousPerLine :: Ord a => Range' a -> Range' a continuousPerLine (Range []) = Range [] continuousPerLine (Range (i:is)) = Range $ fuse i is where fuse i [] = [i] fuse i (j:is) | sameLine i j = fuse (fuseIntervals i j) is | otherwise = i : fuse j is sameLine i j = posLine (iEnd i) == posLine (iStart j) -- | The initial position in the range, if any. rStart :: Range' a -> Maybe (Position' a) rStart r = iStart <$> rangeToInterval r -- | The position after the final position in the range, if any. rEnd :: Range' a -> Maybe (Position' a) rEnd r = iEnd <$> rangeToInterval r -- | Finds the least interval which covers the arguments. fuseIntervals :: Ord a => Interval' a -> Interval' a -> Interval' a fuseIntervals x y = Interval { iStart = head ps, iEnd = last ps } where ps = sort [iStart x, iStart y, iEnd x, iEnd y] -- | @fuseRanges r r'@ unions the ranges @r@ and @r'@. -- -- Meaning it finds the least range @r0@ that covers @r@ and @r'@. fuseRanges :: (Ord a) => Range' a -> Range' a -> Range' a fuseRanges (Range is) (Range js) = Range (helper is js) where helper [] js = js helper is [] = is helper (i:is) (j:js) | iEnd i < iStart j = i : helper is (j:js) | iEnd j < iStart i = j : helper (i:is) js | iEnd i < iEnd j = helper is (fuseIntervals i j : js) | otherwise = helper (fuseIntervals i j : is) js fuseRange :: (HasRange u, HasRange t) => u -> t -> Range fuseRange x y = fuseRanges (getRange x) (getRange y) -- | @beginningOf r@ is an empty range (a single, empty interval) -- positioned at the beginning of @r@. If @r@ does not have a -- beginning, then 'noRange' is returned. beginningOf :: Range -> Range beginningOf r = case rStart r of Nothing -> noRange Just pos -> posToRange pos pos -- | @beginningOfFile r@ is an empty range (a single, empty interval) -- at the beginning of @r@'s starting position's file. If there is no -- such position, then an empty range is returned. beginningOfFile :: Range -> Range beginningOfFile r = case rStart r of Nothing -> noRange Just (Pn { srcFile = f }) -> posToRange p p where p = startPos f -- | @x \`withRangeOf\` y@ sets the range of @x@ to the range of @y@. withRangeOf :: (SetRange t, HasRange u) => t -> u -> t x `withRangeOf` y = setRange (getRange y) x ------------------------------------------------------------------------ -- Test suite -- | The positions corresponding to the interval, /including/ the -- end-point. This function assumes that the two end points belong to -- the same file. Note that the 'Arbitrary' instance for 'Position's -- uses a single, hard-wired file name. iPositions :: Interval' a -> Set Int32 iPositions i = Set.fromList [posPos (iStart i) .. posPos (iEnd i)] -- | The positions corresponding to the range, including the -- end-points. All ranges are assumed to belong to a single file. rPositions :: Range' a -> Set Int32 rPositions (Range is) = Set.unions (map iPositions is) -- | Constructs the least interval containing all the elements in the -- set. makeInterval :: Set Int32 -> Set Int32 makeInterval s | Set.null s = Set.empty | otherwise = Set.fromList [Set.findMin s .. Set.findMax s] prop_iLength :: Interval' Integer -> Bool prop_iLength i = iLength i >= 0 prop_startPos :: Maybe AbsolutePath -> Bool prop_startPos = positionInvariant . startPos prop_noRange :: Bool prop_noRange = rangeInvariant noRange prop_takeI_dropI :: Interval' Integer -> Property prop_takeI_dropI i = forAll (choose (0, toInteger $ iLength i)) $ \n -> let s = genericReplicate n ' ' t = takeI s i d = dropI s i in intervalInvariant t && intervalInvariant d && fuseIntervals t d == i prop_rangeToInterval :: Range' Integer -> Bool prop_rangeToInterval (Range []) = True prop_rangeToInterval r = intervalInvariant i && iPositions i == makeInterval (rPositions r) where Just i = rangeToInterval r prop_continuous :: Range -> Bool prop_continuous r = rangeInvariant cr && rPositions cr == makeInterval (rPositions r) where cr = continuous r prop_continuousPerLine :: Range -> Bool prop_continuousPerLine r = rangeInvariant r' && distinct lineNumbers where r'@(Range is') = continuousPerLine r lineNumbers = concatMap lines is' where lines i | s == e = [s] | otherwise = [s, e] where s = posLine (iStart i) e = posLine (iEnd i) prop_fuseIntervals :: Interval' Integer -> Property prop_fuseIntervals i1 = forAll (intervalInSameFileAs i1) $ \i2 -> let i = fuseIntervals i1 i2 in intervalInvariant i && iPositions i == makeInterval (Set.union (iPositions i1) (iPositions i2)) prop_fuseRanges :: Range -> Range -> Bool prop_fuseRanges r1 r2 = rangeInvariant r && rPositions r == Set.union (rPositions r1) (rPositions r2) where r = fuseRanges r1 r2 prop_beginningOf :: Range -> Bool prop_beginningOf r = rangeInvariant (beginningOf r) prop_beginningOfFile :: Range -> Bool prop_beginningOfFile r = rangeInvariant (beginningOfFile r) instance Arbitrary a => Arbitrary (Position' a) where arbitrary = do srcFile <- arbitrary Positive pos' <- arbitrary let pos = fromInteger pos' line = pred pos `div` 10 + 1 col = pred pos `mod` 10 + 1 return (Pn {srcFile = srcFile, posPos = pos, posLine = line, posCol = col }) -- | Sets the 'srcFile' components of the interval. setFile :: a -> Interval' a -> Interval' a setFile f (Interval p1 p2) = Interval (p1 { srcFile = f }) (p2 { srcFile = f }) -- | Generates an interval located in the same file as the given -- interval. intervalInSameFileAs :: Interval' Integer -> Gen (Interval' Integer) intervalInSameFileAs i = setFile (srcFile $ iStart i) <$> arbitrary prop_intervalInSameFileAs :: Interval' Integer -> Property prop_intervalInSameFileAs i = forAll (intervalInSameFileAs i) $ \i' -> intervalInvariant i' && srcFile (iStart i) == srcFile (iStart i') instance (Arbitrary a, Ord a) => Arbitrary (Interval' a) where arbitrary = do (p1, p2 :: Position' a) <- liftM2 (,) arbitrary arbitrary let [p1', p2'] = sort [p1, p2 { srcFile = srcFile p1 }] return (Interval p1' p2') instance (Ord a, Arbitrary a) => Arbitrary (Range' a) where arbitrary = Range . fuse . sort . fixFiles <$> arbitrary where fixFiles [] = [] fixFiles (i : is) = i : map (setFile $ srcFile $ iStart i) is fuse (i1 : i2 : is) | iEnd i1 >= iStart i2 = fuse (fuseIntervals i1 i2 : is) | otherwise = i1 : fuse (i2 : is) fuse is = is prop_positionInvariant :: Position' Integer -> Bool prop_positionInvariant = positionInvariant prop_intervalInvariant :: Interval' Integer -> Bool prop_intervalInvariant = intervalInvariant prop_rangeInvariant :: Range -> Bool prop_rangeInvariant = rangeInvariant instance Show (Position' Integer) where show = show . fmap Just instance Show (Interval' Integer) where show = show . fmap Just instance Show (Range' Integer) where show = show . fmap Just ------------------------------------------------------------------------ -- * All tests ------------------------------------------------------------------------ -- Template Haskell hack to make the following $quickCheckAll work -- under ghc-7.8. return [] -- KEEP! -- | Test suite. tests :: IO Bool tests = do putStrLn "Agda.Syntax.Position" $quickCheckAll -- tests = runTests "Agda.Syntax.Position" -- [ quickCheck' (positionInvariant :: Position -> Bool) -- , quickCheck' intervalInvariant -- , quickCheck' rangeInvariant -- , quickCheck' prop_iLength -- , quickCheck' prop_startPos -- , quickCheck' prop_noRange -- , quickCheck' prop_takeI_dropI -- , quickCheck' prop_rangeToInterval -- , quickCheck' prop_continuous -- , quickCheck' prop_fuseIntervals -- , quickCheck' prop_fuseRanges -- , quickCheck' prop_beginningOf -- , quickCheck' prop_beginningOfFile -- , quickCheck' prop_intervalInSameFileAs -- ] Agda-2.4.2.5/src/full/Agda/Syntax/Literal.hs0000644000000000000000000000562412635075266016532 0ustar0000000000000000{-# LANGUAGE DeriveDataTypeable #-} module Agda.Syntax.Literal where import Data.Char import Data.Typeable (Typeable) import Agda.Syntax.Position import Agda.Syntax.Abstract.Name import Agda.Utils.Pretty data Literal = LitInt Range Integer | LitFloat Range Double | LitString Range String | LitChar Range Char | LitQName Range QName deriving (Typeable) instance Show Literal where showsPrec p l = showParen (p > 9) $ case l of LitInt _ n -> sh "LitInt" n LitFloat _ x -> sh "LitFloat" x LitString _ s -> sh "LitString" s LitChar _ c -> sh "LitChar" c LitQName _ q -> sh "LitQName" q where sh :: Show a => String -> a -> ShowS sh c x = showString (c ++ " ") . shows x instance Pretty Literal where pretty (LitInt _ n) = text $ show n pretty (LitFloat _ x) = text $ show x pretty (LitString _ s) = text $ showString' s "" pretty (LitChar _ c) = text $ "'" ++ showChar' c "" ++ "'" pretty (LitQName _ x) = text $ show x showString' :: String -> ShowS showString' s = foldr (.) id $ [ showString "\"" ] ++ map showChar' s ++ [ showString "\"" ] showChar' :: Char -> ShowS showChar' '"' = showString "\\\"" showChar' c | escapeMe c = showLitChar c | otherwise = showString [c] where escapeMe c = not (isPrint c) || c == '\\' instance Eq Literal where LitInt _ n == LitInt _ m = n == m LitFloat _ x == LitFloat _ y = x == y LitString _ s == LitString _ t = s == t LitChar _ c == LitChar _ d = c == d LitQName _ x == LitQName _ y = x == y _ == _ = False instance Ord Literal where LitInt _ n `compare` LitInt _ m = n `compare` m LitFloat _ x `compare` LitFloat _ y = x `compare` y LitString _ s `compare` LitString _ t = s `compare` t LitChar _ c `compare` LitChar _ d = c `compare` d LitQName _ x `compare` LitQName _ y = x `compare` y compare LitInt{} _ = LT compare _ LitInt{} = GT compare LitFloat{} _ = LT compare _ LitFloat{} = GT compare LitString{} _ = LT compare _ LitString{} = GT compare LitQName{} _ = LT compare _ LitQName{} = GT instance HasRange Literal where getRange (LitInt r _) = r getRange (LitFloat r _) = r getRange (LitString r _) = r getRange (LitChar r _) = r getRange (LitQName r _) = r instance SetRange Literal where setRange r (LitInt _ x) = LitInt r x setRange r (LitFloat _ x) = LitFloat r x setRange r (LitString _ x) = LitString r x setRange r (LitChar _ x) = LitChar r x setRange r (LitQName _ x) = LitQName r x instance KillRange Literal where killRange (LitInt r x) = LitInt (killRange r) x killRange (LitFloat r x) = LitFloat (killRange r) x killRange (LitString r x) = LitString (killRange r) x killRange (LitChar r x) = LitChar (killRange r) x killRange (LitQName r x) = killRange2 LitQName r x Agda-2.4.2.5/src/full/Agda/Syntax/Common.hs0000644000000000000000000006005412635075266016364 0ustar0000000000000000{-# LANGUAGE CPP #-} {-# LANGUAGE DeriveDataTypeable #-} {-# LANGUAGE DeriveFoldable #-} {-# LANGUAGE DeriveFunctor #-} {-# LANGUAGE DeriveGeneric #-} {-# LANGUAGE DeriveTraversable #-} {-# LANGUAGE FlexibleInstances #-} {-# LANGUAGE GeneralizedNewtypeDeriving #-} {-| Some common syntactic entities are defined in this module. -} module Agda.Syntax.Common where import Control.Applicative import Data.ByteString.Char8 (ByteString) import qualified Data.ByteString.Char8 as ByteString import Data.Foldable import Data.Hashable import Data.Monoid import Data.Traversable import Data.Typeable (Typeable) import GHC.Generics (Generic) import Test.QuickCheck hiding (Small) import Agda.Syntax.Position import Agda.Utils.Functor import Agda.Utils.Pretty #include "undefined.h" import Agda.Utils.Impossible --------------------------------------------------------------------------- -- * Delayed --------------------------------------------------------------------------- -- | Used to specify whether something should be delayed. data Delayed = Delayed | NotDelayed deriving (Typeable, Show, Eq, Ord) instance KillRange Delayed where killRange = id --------------------------------------------------------------------------- -- * Induction --------------------------------------------------------------------------- data Induction = Inductive | CoInductive deriving (Typeable, Eq, Ord) instance Show Induction where show Inductive = "inductive" show CoInductive = "coinductive" instance HasRange Induction where getRange _ = noRange instance KillRange Induction where killRange = id instance Arbitrary Induction where arbitrary = elements [Inductive, CoInductive] instance CoArbitrary Induction where coarbitrary Inductive = variant 0 coarbitrary CoInductive = variant 1 --------------------------------------------------------------------------- -- * Hiding --------------------------------------------------------------------------- data Hiding = Hidden | Instance | NotHidden deriving (Typeable, Show, Eq, Ord) -- | 'Hiding' is an idempotent partial monoid, with unit 'NotHidden'. -- 'Instance' and 'NotHidden' are incompatible. instance Monoid Hiding where mempty = NotHidden mappend NotHidden h = h mappend h NotHidden = h mappend Hidden Hidden = Hidden mappend Instance Instance = Instance mappend _ _ = __IMPOSSIBLE__ instance KillRange Hiding where killRange = id -- | Decorating something with 'Hiding' information. data WithHiding a = WithHiding Hiding a deriving (Typeable, Eq, Ord, Show, Functor, Foldable, Traversable) instance Decoration WithHiding where traverseF f (WithHiding h a) = WithHiding h <$> f a instance Applicative WithHiding where pure = WithHiding mempty WithHiding h f <*> WithHiding h' a = WithHiding (mappend h h') (f a) instance HasRange a => HasRange (WithHiding a) where getRange = getRange . dget instance SetRange a => SetRange (WithHiding a) where setRange = fmap . setRange instance KillRange a => KillRange (WithHiding a) where killRange = fmap killRange -- | A lens to access the 'Hiding' attribute in data structures. -- Minimal implementation: @getHiding@ and one of @setHiding@ or @mapHiding@. class LensHiding a where getHiding :: a -> Hiding setHiding :: Hiding -> a -> a setHiding h = mapHiding (const h) mapHiding :: (Hiding -> Hiding) -> a -> a mapHiding f a = setHiding (f $ getHiding a) a instance LensHiding Hiding where getHiding = id setHiding = const mapHiding = id instance LensHiding (WithHiding a) where getHiding (WithHiding h _) = h setHiding h (WithHiding _ a) = WithHiding h a mapHiding f (WithHiding h a) = WithHiding (f h) a -- | Monoidal composition of 'Hiding' information in some data. mergeHiding :: LensHiding a => WithHiding a -> a mergeHiding (WithHiding h a) = mapHiding (mappend h) a -- | @isHidden@ does not apply to 'Instance', only to 'Hidden'. isHidden :: LensHiding a => a -> Bool isHidden a = getHiding a == Hidden -- | Visible ('NotHidden') arguments are @notHidden@. (DEPRECATED, use 'visible'.) notHidden :: LensHiding a => a -> Bool notHidden a = getHiding a == NotHidden -- | 'NotHidden' arguments are @visible@. visible :: LensHiding a => a -> Bool visible a = getHiding a == NotHidden -- | 'Instance' and 'Hidden' arguments are @notVisible@. notVisible :: LensHiding a => a -> Bool notVisible a = getHiding a /= NotHidden hide :: LensHiding a => a -> a hide = setHiding Hidden makeInstance :: LensHiding a => a -> a makeInstance = setHiding Instance --------------------------------------------------------------------------- -- * Relevance --------------------------------------------------------------------------- -- | An constructor argument is big if the sort of its type is bigger than -- the sort of the data type. Only parameters (and maybe forced arguments) -- are allowed to be big. -- @ -- List : Set -> Set -- nil : (A : Set) -> List A -- @ -- @A@ is big in constructor @nil@ as the sort @Set1@ of its type @Set@ -- is bigger than the sort @Set@ of the data type @List@. data Big = Big | Small deriving (Typeable, Show, Eq, Enum, Bounded) instance Ord Big where Big <= Small = False _ <= _ = True -- | A function argument can be relevant or irrelevant. -- See "Agda.TypeChecking.Irrelevance". data Relevance = Relevant -- ^ The argument is (possibly) relevant at compile-time. | NonStrict -- ^ The argument may never flow into evaluation position. -- Therefore, it is irrelevant at run-time. -- It is treated relevantly during equality checking. | Irrelevant -- ^ The argument is irrelevant at compile- and runtime. | Forced Big -- ^ The argument can be skipped during equality checking -- because its value is already determined by the type. -- If a constructor argument is big, it has to be regarded -- absent, otherwise we get into paradoxes. | UnusedArg -- ^ The polarity checker has determined that this argument -- is unused in the definition. It can be skipped during -- equality checking but should be mined for solutions -- of meta-variables with relevance 'UnusedArg' deriving (Typeable, Show, Eq) allRelevances :: [Relevance] allRelevances = [ Relevant , NonStrict , Irrelevant , Forced Small , Forced Big , UnusedArg ] instance KillRange Relevance where killRange rel = rel -- no range to kill instance Arbitrary Relevance where arbitrary = elements allRelevances instance Ord Relevance where (<=) = moreRelevant -- | A lens to access the 'Relevance' attribute in data structures. -- Minimal implementation: @getRelevance@ and one of @setRelevance@ or @mapRelevance@. class LensRelevance a where getRelevance :: a -> Relevance setRelevance :: Relevance -> a -> a setRelevance h = mapRelevance (const h) mapRelevance :: (Relevance -> Relevance) -> a -> a mapRelevance f a = setRelevance (f $ getRelevance a) a instance LensRelevance Relevance where getRelevance = id setRelevance = const mapRelevance = id isRelevant :: LensRelevance a => a -> Bool isRelevant a = getRelevance a == Relevant isIrrelevant :: LensRelevance a => a -> Bool isIrrelevant a = getRelevance a == Irrelevant -- | Information ordering. -- @Relevant \`moreRelevant\` -- UnusedArg \`moreRelevant\` -- Forced \`moreRelevant\` -- NonStrict \`moreRelevant\` -- Irrelevant@ moreRelevant :: Relevance -> Relevance -> Bool moreRelevant r r' = case (r, r') of -- top (_, Irrelevant) -> True (Irrelevant, _) -> False -- bottom (Relevant, _) -> True (_, Relevant) -> False -- second bottom (UnusedArg, _) -> True (_, UnusedArg) -> False -- third bottom (Forced{}, _) -> True (_, Forced{}) -> False -- remaining case (NonStrict,NonStrict) -> True irrelevantOrUnused :: Relevance -> Bool irrelevantOrUnused r = case r of Irrelevant -> True UnusedArg -> True NonStrict -> False Relevant -> False Forced{} -> False -- | @unusableRelevance rel == True@ iff we cannot use a variable of @rel@. unusableRelevance :: Relevance -> Bool unusableRelevance rel = NonStrict `moreRelevant` rel -- | 'Relevance' composition. -- 'Irrelevant' is dominant, 'Relevant' is neutral. composeRelevance :: Relevance -> Relevance -> Relevance composeRelevance r r' = case (r, r') of (Irrelevant, _) -> Irrelevant (_, Irrelevant) -> Irrelevant (NonStrict, _) -> NonStrict (_, NonStrict) -> NonStrict (Forced b, Forced b') -> Forced (max b b') -- prefer Big over Small (Forced b, _) -> Forced b (_, Forced b) -> Forced b (UnusedArg, _) -> UnusedArg (_, UnusedArg) -> UnusedArg (Relevant, Relevant) -> Relevant -- | @inverseComposeRelevance r x@ returns the most irrelevant @y@ -- such that forall @x@, @y@ we have -- @x \`moreRelevant\` (r \`composeRelevance\` y)@ -- iff -- @(r \`inverseComposeRelevance\` x) \`moreRelevant\` y@ (Galois connection). inverseComposeRelevance :: Relevance -> Relevance -> Relevance inverseComposeRelevance r x = case (r, x) of (Relevant, x) -> x -- going to relevant arg.: nothing changes _ | r == x -> Relevant -- because Relevant is comp.-neutral (Forced{}, Forced{}) -> Relevant -- same, but (==) does not ignore Big (UnusedArg, x) -> x (Forced{}, UnusedArg) -> Relevant (Forced{}, x) -> x (Irrelevant, x) -> Relevant -- going irrelevant: every thing usable (_, Irrelevant) -> Irrelevant -- otherwise: irrelevant things remain unusable (NonStrict, _) -> Relevant -- but @NonStrict@s become usable -- | For comparing @Relevance@ ignoring @Forced@ and @UnusedArg@. ignoreForced :: Relevance -> Relevance ignoreForced Forced{} = Relevant ignoreForced UnusedArg = Relevant ignoreForced Relevant = Relevant ignoreForced NonStrict = NonStrict ignoreForced Irrelevant = Irrelevant -- | Irrelevant function arguments may appear non-strictly in the codomain type. irrToNonStrict :: Relevance -> Relevance irrToNonStrict Irrelevant = NonStrict -- irrToNonStrict NonStrict = Relevant -- TODO: is that what we want (OR: NonStrict) -- better be more conservative irrToNonStrict rel = rel nonStrictToIrr :: Relevance -> Relevance nonStrictToIrr NonStrict = Irrelevant nonStrictToIrr rel = rel --------------------------------------------------------------------------- -- * Argument decoration --------------------------------------------------------------------------- -- | A function argument can be hidden and/or irrelevant. data ArgInfo c = ArgInfo { argInfoHiding :: Hiding , argInfoRelevance :: Relevance , argInfoColors :: [c] } deriving (Typeable, Eq, Ord, Functor, Foldable, Traversable, Show) instance KillRange c => KillRange (ArgInfo c) where killRange (ArgInfo h r cs) = killRange3 ArgInfo h r cs {- FAILED to define a lens for ArgInfo, since it is parametrized by c can't instantiate the following to f c = Arg c e since Haskell does not have lambda abstraction class LensArgInfo f where getArgInfo :: f c -> ArgInfo c setArgInfo :: ArgInfo c' -> f c -> f c' setArgInfo ai = mapArgInfo (const ai) mapArgInfo :: (ArgInfo c -> ArgInfo c') -> f c -> f c' mapArgInfo f a = setArgInfo (f $ getArgInfo a) a instance LensArgInfo ArgInfo where getArgInfo = id setArgInfo = const mapArgInfo = id -} {- FAILS because map is too restricted class LensArgInfo c a where getArgInfo :: a -> ArgInfo c setArgInfo :: ArgInfo c -> a -> a setArgInfo ai = mapArgInfo (const ai) mapArgInfo :: (ArgInfo c -> ArgInfo c) -> a -> a mapArgInfo f a = setArgInfo (f $ getArgInfo a) a instance LensArgInfo c (ArgInfo c) where getArgInfo = id setArgInfo = const mapArgInfo = id -} instance LensHiding (ArgInfo c) where getHiding = argInfoHiding setHiding h ai = ai { argInfoHiding = h } mapHiding f ai = ai { argInfoHiding = f (argInfoHiding ai) } instance LensRelevance (ArgInfo c) where getRelevance = argInfoRelevance setRelevance h ai = ai { argInfoRelevance = h } mapRelevance f ai = ai { argInfoRelevance = f (argInfoRelevance ai) } mapArgInfoColors :: ([c] -> [c']) -> ArgInfo c -> ArgInfo c' mapArgInfoColors f info = info { argInfoColors = f $ argInfoColors info } defaultArgInfo :: ArgInfo c defaultArgInfo = ArgInfo { argInfoHiding = NotHidden , argInfoRelevance = Relevant , argInfoColors = [] } --------------------------------------------------------------------------- -- * Arguments --------------------------------------------------------------------------- data Arg c e = Arg { argInfo :: ArgInfo c , unArg :: e } deriving (Typeable, Ord, Functor, Foldable, Traversable) instance Decoration (Arg c) where traverseF f (Arg ai a) = Arg ai <$> f a instance HasRange a => HasRange (Arg c a) where getRange = getRange . unArg instance SetRange a => SetRange (Arg c a) where setRange r = fmap $ setRange r instance (KillRange c, KillRange a) => KillRange (Arg c a) where killRange (Arg info a) = killRange2 Arg info a instance (Eq a, Eq c) => Eq (Arg c a) where Arg (ArgInfo h1 _ cs1) x1 == Arg (ArgInfo h2 _ cs2) x2 = (h1, cs1, x1) == (h2, cs2, x2) instance (Show a, Show c) => Show (Arg c a) where show (Arg (ArgInfo h r cs) x) = showC cs $ showR r $ showH h $ show x where showH Hidden s = "{" ++ s ++ "}" showH NotHidden s = "(" ++ s ++ ")" showH Instance s = "{{" ++ s ++ "}}" showR r s = case r of Irrelevant -> "." ++ s NonStrict -> "?" ++ s Forced Big -> "!b" ++ s Forced Small -> "!" ++ s UnusedArg -> "k" ++ s -- constant Relevant -> "r" ++ s -- Andreas: I want to see it explicitly showC cs s = show cs ++ s instance LensHiding (Arg c e) where getHiding = getHiding . argInfo mapHiding = mapArgInfo . mapHiding instance LensRelevance (Arg c e) where getRelevance = getRelevance . argInfo mapRelevance = mapArgInfo . mapRelevance {- RETIRED hide :: Arg c a -> Arg c a hide = setArgHiding Hidden makeInstance :: Arg c a -> Arg c a makeInstance = setHiding Instance isHiddenArg :: Arg c a -> Bool isHiddenArg arg = argHiding arg /= NotHidden -} mapArgInfo :: (ArgInfo c -> ArgInfo c') -> Arg c a -> Arg c' a mapArgInfo f arg = arg { argInfo = f $ argInfo arg } argColors :: Arg c a -> [c] argColors = argInfoColors . argInfo mapArgColors :: ([c] -> [c']) -> Arg c a -> Arg c' a mapArgColors = mapArgInfo . mapArgInfoColors setArgColors :: [c] -> Arg c' a -> Arg c a setArgColors = mapArgColors . const defaultArg :: a -> Arg c a defaultArg = Arg defaultArgInfo defaultColoredArg :: ([c],a) -> Arg c a defaultColoredArg (cs,a) = setArgColors cs $ defaultArg a noColorArg :: Hiding -> Relevance -> a -> Arg c a noColorArg h r = Arg ArgInfo { argInfoHiding = h , argInfoRelevance = r , argInfoColors = [] } -- | @xs \`withArgsFrom\` args@ translates @xs@ into a list of 'Arg's, -- using the elements in @args@ to fill in the non-'unArg' fields. -- -- Precondition: The two lists should have equal length. withArgsFrom :: [a] -> [Arg c b] -> [Arg c a] xs `withArgsFrom` args = zipWith (\x arg -> fmap (const x) arg) xs args withNamedArgsFrom :: [a] -> [NamedArg c b] -> [NamedArg c a] xs `withNamedArgsFrom` args = zipWith (\x -> fmap (x <$)) xs args --------------------------------------------------------------------------- -- * Names --------------------------------------------------------------------------- class Eq a => Underscore a where underscore :: a isUnderscore :: a -> Bool isUnderscore = (== underscore) instance Underscore String where underscore = "_" instance Underscore ByteString where underscore = ByteString.pack underscore instance Underscore Doc where underscore = text underscore --------------------------------------------------------------------------- -- * Function type domain --------------------------------------------------------------------------- -- | Similar to 'Arg', but we need to distinguish -- an irrelevance annotation in a function domain -- (the domain itself is not irrelevant!) -- from an irrelevant argument. -- -- @Dom@ is used in 'Pi' of internal syntax, in 'Context' and 'Telescope'. -- 'Arg' is used for actual arguments ('Var', 'Con', 'Def' etc.) -- and in 'Abstract' syntax and other situations. data Dom c e = Dom { domInfo :: ArgInfo c , unDom :: e } deriving (Typeable, Eq, Ord, Functor, Foldable, Traversable) instance Decoration (Dom c) where traverseF f (Dom ai a) = Dom ai <$> f a instance HasRange a => HasRange (Dom c a) where getRange = getRange . unDom instance (KillRange c, KillRange a) => KillRange (Dom c a) where killRange (Dom info a) = killRange2 Dom info a instance (Show a, Show c) => Show (Dom c a) where show = show . argFromDom instance LensHiding (Dom c e) where getHiding = getHiding . domInfo mapHiding = mapDomInfo . mapHiding instance LensRelevance (Dom c e) where getRelevance = getRelevance . domInfo mapRelevance = mapDomInfo . mapRelevance mapDomInfo :: (ArgInfo c -> ArgInfo c') -> Dom c a -> Dom c' a mapDomInfo f arg = arg { domInfo = f $ domInfo arg } domColors :: Dom c a -> [c] domColors = argInfoColors . domInfo argFromDom :: Dom c a -> Arg c a argFromDom (Dom i a) = Arg i a domFromArg :: Arg c a -> Dom c a domFromArg (Arg i a) = Dom i a defaultDom :: a -> Dom c a defaultDom = Dom defaultArgInfo --------------------------------------------------------------------------- -- * Named arguments --------------------------------------------------------------------------- -- | Something potentially carrying a name. data Named name a = Named { nameOf :: Maybe name , namedThing :: a } deriving (Eq, Ord, Typeable, Functor, Foldable, Traversable) -- | Standard naming. type Named_ = Named RString unnamed :: a -> Named name a unnamed = Named Nothing named :: name -> a -> Named name a named = Named . Just instance Decoration (Named name) where traverseF f (Named n a) = Named n <$> f a instance HasRange a => HasRange (Named name a) where getRange = getRange . namedThing instance SetRange a => SetRange (Named name a) where setRange r = fmap $ setRange r instance (KillRange name, KillRange a) => KillRange (Named name a) where killRange (Named n a) = Named (killRange n) (killRange a) instance Show a => Show (Named_ a) where show (Named Nothing x) = show x show (Named (Just n) x) = rawNameToString (rangedThing n) ++ " = " ++ show x -- | Only 'Hidden' arguments can have names. type NamedArg c a = Arg c (Named_ a) -- | Get the content of a 'NamedArg'. namedArg :: NamedArg c a -> a namedArg = namedThing . unArg defaultNamedArg :: a -> NamedArg c a defaultNamedArg = defaultArg . unnamed -- | The functor instance for 'NamedArg' would be ambiguous, -- so we give it another name here. updateNamedArg :: (a -> b) -> NamedArg c a -> NamedArg c b updateNamedArg = fmap . fmap --------------------------------------------------------------------------- -- * Range decoration. --------------------------------------------------------------------------- -- | Thing with range info. data Ranged a = Ranged { rangeOf :: Range , rangedThing :: a } deriving (Typeable, Functor, Foldable, Traversable) -- | Thing with no range info. unranged :: a -> Ranged a unranged = Ranged noRange instance Show a => Show (Ranged a) where show = show . rangedThing instance Eq a => Eq (Ranged a) where Ranged _ x == Ranged _ y = x == y instance Ord a => Ord (Ranged a) where compare (Ranged _ x) (Ranged _ y) = compare x y instance HasRange (Ranged a) where getRange = rangeOf instance KillRange (Ranged a) where killRange (Ranged _ x) = Ranged noRange x instance Decoration Ranged where traverseF f (Ranged r x) = Ranged r <$> f x --------------------------------------------------------------------------- -- * Raw names (before parsing into name parts). --------------------------------------------------------------------------- -- | A @RawName@ is some sort of string. type RawName = String rawNameToString :: RawName -> String rawNameToString = id stringToRawName :: String -> RawName stringToRawName = id -- | String with range info. type RString = Ranged RawName --------------------------------------------------------------------------- -- * Constructor pattern info --------------------------------------------------------------------------- -- | Where does the 'ConP' of come from? data ConPOrigin = ConPImplicit -- ^ Expanded from an implicit pattern. | ConPCon -- ^ User wrote a constructor pattern. | ConPRec -- ^ User wrote a record pattern. deriving (Typeable, Show, Eq, Ord, Enum, Bounded) --------------------------------------------------------------------------- -- * Infixity, access, abstract, etc. --------------------------------------------------------------------------- -- | Functions can be defined in both infix and prefix style. See -- 'Agda.Syntax.Concrete.LHS'. data IsInfix = InfixDef | PrefixDef deriving (Typeable, Show, Eq, Ord) -- | Access modifier. data Access = PrivateAccess | PublicAccess | OnlyQualified -- ^ Visible from outside, but not exported when opening the module -- Used for qualified constructors. deriving (Typeable, Show, Eq, Ord) -- | Abstract or concrete data IsAbstract = AbstractDef | ConcreteDef deriving (Typeable, Show, Eq, Ord) instance KillRange IsAbstract where killRange = id -- | Is this definition eligible for instance search? data IsInstance = InstanceDef | NotInstanceDef deriving (Typeable, Show, Eq, Ord) type Nat = Int type Arity = Nat -- | The unique identifier of a name. Second argument is the top-level module -- identifier. data NameId = NameId Integer Integer deriving (Eq, Ord, Typeable, Generic) instance KillRange NameId where killRange = id instance Show NameId where show (NameId x i) = show x ++ "@" ++ show i instance Enum NameId where succ (NameId n m) = NameId (n + 1) m pred (NameId n m) = NameId (n - 1) m toEnum n = __IMPOSSIBLE__ -- should not be used fromEnum (NameId n _) = fromIntegral n instance Hashable NameId where {-# INLINE hashWithSalt #-} hashWithSalt salt (NameId n m) = hashWithSalt salt (n, m) instance Arbitrary NameId where arbitrary = elements [ NameId x y | x <- [-1, 1], y <- [-1, 1] ] instance CoArbitrary NameId -- | A meta variable identifier is just a natural number. -- newtype MetaId = MetaId { metaId :: Nat } deriving (Eq, Ord, Num, Real, Enum, Integral, Typeable) instance Pretty MetaId where pretty (MetaId n) = text $ "_" ++ show n -- | Show non-record version of this newtype. instance Show MetaId where showsPrec p (MetaId n) = showParen (p > 0) $ showString "MetaId " . shows n newtype Constr a = Constr a --------------------------------------------------------------------------- -- * Interaction meta variables --------------------------------------------------------------------------- newtype InteractionId = InteractionId { interactionId :: Nat } deriving (Eq,Ord,Num,Integral,Real,Enum) instance Show InteractionId where show (InteractionId x) = "?" ++ show x instance KillRange InteractionId where killRange = id ----------------------------------------------------------------------------- -- * Termination ----------------------------------------------------------------------------- -- | Termination check? (Default = True). data TerminationCheck m = TerminationCheck -- ^ Run the termination checker. | NoTerminationCheck -- ^ Skip termination checking (unsafe). | NonTerminating -- ^ Treat as non-terminating. | Terminating -- ^ Treat as terminating (unsafe). Same effect as 'NoTerminationCheck'. | TerminationMeasure !Range m -- ^ Skip termination checking but use measure instead. deriving (Typeable, Show, Eq, Functor) instance KillRange m => KillRange (TerminationCheck m) where killRange (TerminationMeasure _ m) = TerminationMeasure noRange (killRange m) killRange t = t Agda-2.4.2.5/src/full/Agda/Syntax/Info.hs0000644000000000000000000001515712635075266016033 0ustar0000000000000000{-# LANGUAGE DeriveDataTypeable #-} {-# LANGUAGE FlexibleContexts #-} {-# LANGUAGE GeneralizedNewtypeDeriving #-} {-# LANGUAGE StandaloneDeriving #-} {-# LANGUAGE UndecidableInstances #-} {-| An info object contains additional information about a piece of abstract syntax that isn't part of the actual syntax. For instance, it might contain the source code position of an expression or the concrete syntax that an internal expression originates from. -} module Agda.Syntax.Info where import Prelude hiding (null) import Data.Typeable (Typeable) import qualified Agda.Syntax.Concrete.Name as C import Agda.Syntax.Common import Agda.Syntax.Position import Agda.Syntax.Concrete import Agda.Syntax.Fixity import Agda.Syntax.Scope.Base (ScopeInfo, emptyScopeInfo) import Agda.Utils.Function import Agda.Utils.Null {-------------------------------------------------------------------------- Meta information --------------------------------------------------------------------------} data MetaInfo = MetaInfo { metaRange :: Range , metaScope :: ScopeInfo , metaNumber :: Maybe MetaId , metaNameSuggestion :: String } deriving (Typeable, Show) emptyMetaInfo :: MetaInfo emptyMetaInfo = MetaInfo { metaRange = noRange , metaScope = emptyScopeInfo , metaNumber = Nothing , metaNameSuggestion = "" } instance HasRange MetaInfo where getRange = metaRange instance KillRange MetaInfo where killRange m = m { metaRange = noRange } {-------------------------------------------------------------------------- General expression information --------------------------------------------------------------------------} newtype ExprInfo = ExprRange Range deriving (Typeable, Show, Null) exprNoRange :: ExprInfo exprNoRange = ExprRange noRange instance HasRange ExprInfo where getRange (ExprRange r) = r instance KillRange ExprInfo where killRange (ExprRange r) = exprNoRange {-------------------------------------------------------------------------- Module information --------------------------------------------------------------------------} data ModuleInfo = ModuleInfo { minfoRange :: Range , minfoAsTo :: Range -- ^ The range of the \"as\" and \"to\" keywords, -- if any. Retained for highlighting purposes. , minfoAsName :: Maybe C.Name -- ^ The \"as\" module name, if any. Retained for highlighting purposes. , minfoOpenShort :: Maybe OpenShortHand , minfoDirective :: Maybe ImportDirective -- ^ Retained for @abstractToConcrete@ of 'ModuleMacro'. } deriving (Typeable) deriving instance (Show OpenShortHand, Show ImportDirective) => Show ModuleInfo instance HasRange ModuleInfo where getRange = minfoRange instance SetRange ModuleInfo where setRange r i = i { minfoRange = r } instance KillRange ModuleInfo where killRange m = m { minfoRange = noRange } --------------------------------------------------------------------------- -- Let info --------------------------------------------------------------------------- newtype LetInfo = LetRange Range deriving (Typeable, Show, Null) instance HasRange LetInfo where getRange (LetRange r) = r instance KillRange LetInfo where killRange (LetRange r) = LetRange noRange {-------------------------------------------------------------------------- Definition information (declarations that actually define something) --------------------------------------------------------------------------} data DefInfo = DefInfo { defFixity :: Fixity' , defAccess :: Access , defAbstract :: IsAbstract , defInstance :: IsInstance , defInfo :: DeclInfo } deriving (Typeable, Show) mkDefInfo :: Name -> Fixity' -> Access -> IsAbstract -> Range -> DefInfo mkDefInfo x f a ab r = DefInfo f a ab NotInstanceDef (DeclInfo x r) -- | Same as @mkDefInfo@ but where we can also give the @IsInstance@ mkDefInfoInstance :: Name -> Fixity' -> Access -> IsAbstract -> IsInstance -> Range -> DefInfo mkDefInfoInstance x f a ab i r = DefInfo f a ab i (DeclInfo x r) instance HasRange DefInfo where getRange = getRange . defInfo instance SetRange DefInfo where setRange r i = i { defInfo = setRange r (defInfo i) } instance KillRange DefInfo where killRange i = i { defInfo = killRange $ defInfo i } {-------------------------------------------------------------------------- General declaration information --------------------------------------------------------------------------} data DeclInfo = DeclInfo { declName :: Name , declRange :: Range } deriving (Typeable, Show) instance HasRange DeclInfo where getRange = declRange instance SetRange DeclInfo where setRange r i = i { declRange = r } instance KillRange DeclInfo where killRange i = i { declRange = noRange } {-------------------------------------------------------------------------- Mutual block information --------------------------------------------------------------------------} data MutualInfo = MutualInfo { mutualTermCheck :: TerminationCheck Name , mutualRange :: Range } deriving (Typeable, Show) instance HasRange MutualInfo where getRange = mutualRange instance KillRange MutualInfo where killRange i = i { mutualRange = noRange } {-------------------------------------------------------------------------- Left hand side information --------------------------------------------------------------------------} newtype LHSInfo = LHSRange Range deriving (Typeable, Show, Null) instance HasRange LHSInfo where getRange (LHSRange r) = r instance KillRange LHSInfo where killRange (LHSRange r) = LHSRange noRange {-------------------------------------------------------------------------- Pattern information --------------------------------------------------------------------------} -- | For a general pattern we remember the source code position. newtype PatInfo = PatRange Range deriving (Typeable, Eq, Null, Show, HasRange, KillRange) -- | Empty range for patterns. patNoRange :: PatInfo patNoRange = PatRange noRange -- | Constructor pattern info. data ConPatInfo = ConPatInfo { patOrigin :: ConPOrigin -- ^ Does this pattern come form the eta-expansion of an implicit pattern? --- Or from a user written constructor or record pattern? , patInfo :: PatInfo } deriving (Typeable) instance Show ConPatInfo where show (ConPatInfo po i) = applyWhen (po == ConPImplicit) ("implicit " ++) $ show i instance HasRange ConPatInfo where getRange = getRange . patInfo instance KillRange ConPatInfo where killRange (ConPatInfo b i) = ConPatInfo b $ killRange i instance SetRange ConPatInfo where setRange r (ConPatInfo b i) = ConPatInfo b $ PatRange r Agda-2.4.2.5/src/full/Agda/Syntax/Parser.hs0000644000000000000000000000630012635075266016362 0ustar0000000000000000 module Agda.Syntax.Parser ( -- * Types Parser -- * Parse functions , Agda.Syntax.Parser.parse , Agda.Syntax.Parser.parseLiterate , Agda.Syntax.Parser.parsePosString , parseFile' -- * Parsers , moduleParser , moduleNameParser , exprParser , tokensParser -- * Parse errors , ParseError(..) ) where import Control.Exception import Data.List import Agda.Syntax.Position import Agda.Syntax.Parser.Monad as M hiding (Parser, parseFlags) import qualified Agda.Syntax.Parser.Monad as M import qualified Agda.Syntax.Parser.Parser as P import Agda.Syntax.Parser.Lexer import Agda.Syntax.Concrete import Agda.Syntax.Parser.Tokens import Agda.Utils.FileName ------------------------------------------------------------------------ -- Wrapping parse results wrap :: ParseResult a -> a wrap (ParseOk _ x) = x wrap (ParseFailed err) = throw err wrapM:: Monad m => m (ParseResult a) -> m a wrapM m = do r <- m case r of ParseOk _ x -> return x ParseFailed err -> throw err ------------------------------------------------------------------------ -- Parse functions -- | Wrapped Parser type. data Parser a = Parser { parser :: M.Parser a , parseFlags :: ParseFlags } parse :: Parser a -> String -> IO a parse p = wrapM . return . M.parse (parseFlags p) [normal] (parser p) parseFile :: Parser a -> AbsolutePath -> IO a parseFile p = wrapM . M.parseFile (parseFlags p) [layout, normal] (parser p) parseLiterate :: Parser a -> String -> IO a parseLiterate p = wrapM . return . M.parse (parseFlags p) [literate, layout, code] (parser p) parseLiterateFile :: Parser a -> AbsolutePath -> IO a parseLiterateFile p = wrapM . M.parseFile (parseFlags p) [literate, layout, code] (parser p) parsePosString :: Parser a -> Position -> String -> IO a parsePosString p pos = wrapM . return . M.parsePosString pos (parseFlags p) [normal] (parser p) parseFile' :: Parser a -> AbsolutePath -> IO a parseFile' p file = if "lagda" `isSuffixOf` filePath file then Agda.Syntax.Parser.parseLiterateFile p file else Agda.Syntax.Parser.parseFile p file ------------------------------------------------------------------------ -- Specific parsers -- | Parses a module. moduleParser :: Parser Module moduleParser = Parser { parser = P.moduleParser , parseFlags = withoutComments } -- | Parses a module name. moduleNameParser :: Parser QName moduleNameParser = Parser { parser = P.moduleNameParser , parseFlags = withoutComments } -- | Parses an expression. exprParser :: Parser Expr exprParser = Parser { parser = P.exprParser , parseFlags = withoutComments } -- | Gives the parsed token stream (including comments). tokensParser :: Parser [Token] tokensParser = Parser { parser = P.tokensParser , parseFlags = withComments } -- | Keep comments in the token stream generated by the lexer. withComments :: ParseFlags withComments = defaultParseFlags { parseKeepComments = True } -- | Do not keep comments in the token stream generated by the lexer. withoutComments :: ParseFlags withoutComments = defaultParseFlags { parseKeepComments = False } Agda-2.4.2.5/src/full/Agda/Syntax/Notation.hs0000644000000000000000000001215112635075266016722 0ustar0000000000000000{-# LANGUAGE CPP #-} {-# LANGUAGE DeriveDataTypeable #-} {-# LANGUAGE ScopedTypeVariables #-} {-| As a concrete name, a notation is a non-empty list of alternating 'IdPart's and holes. In contrast to concrete names, holes can be binders. Example: @ syntax fmap (λ x → e) xs = for x ∈ xs return e @ The declared notation for @fmap@ is @for_∈_return_@ where the first hole is a binder. -} module Agda.Syntax.Notation where import Control.Applicative import Control.Monad import Data.List import Data.Maybe import Data.Typeable (Typeable) import Agda.Syntax.Common import Agda.Syntax.Position import Agda.Utils.Except ( MonadError(throwError) ) import Agda.Utils.List import Agda.Utils.Impossible #include "undefined.h" -- | Data type constructed in the Happy parser; converted to 'GenPart' -- before it leaves the Happy code. data HoleName = LambdaHole { _bindHoleName :: RawName , holeName :: RawName } -- ^ @\ x -> y@; 1st argument is the bound name (unused for now). | ExprHole { holeName :: RawName } -- ^ Simple named hole with hiding. -- | Is the hole a binder? isLambdaHole :: HoleName -> Bool isLambdaHole (LambdaHole _ _) = True isLambdaHole _ = False -- | Notation as provided by the @syntax@ declaration. type Notation = [GenPart] -- | Part of a Notation data GenPart = BindHole Int -- ^ Argument is the position of the hole (with binding) where the binding should occur. | NormalHole (NamedArg () Int) -- ^ Argument is where the expression should go. | IdPart RawName deriving (Typeable, Show, Eq, Ord) instance KillRange GenPart where killRange p = case p of IdPart x -> IdPart x BindHole i -> BindHole i NormalHole x -> NormalHole $ killRange x -- | Get a flat list of identifier parts of a notation. stringParts :: Notation -> [RawName] stringParts gs = [ x | IdPart x <- gs ] -- | Target argument position of a part (Nothing if it is not a hole). holeTarget :: GenPart -> Maybe Int holeTarget (BindHole n) = Just n holeTarget (NormalHole n) = Just $ namedArg n holeTarget IdPart{} = Nothing -- | Is the part a hole? isAHole :: GenPart -> Bool isAHole = isJust . holeTarget -- | Is the part a binder? isBindingHole :: GenPart -> Bool isBindingHole (BindHole _) = True isBindingHole _ = False -- | Classification of notations. data NotationKind = InfixNotation -- ^ Ex: @_bla_blub_@. | PrefixNotation -- ^ Ex: @_bla_blub@. | PostfixNotation -- ^ Ex: @bla_blub_@. | NonfixNotation -- ^ Ex: @bla_blub@. | NoNotation deriving (Eq, Show) -- | Classify a notation by presence of leading and/or trailing hole. notationKind :: Notation -> NotationKind notationKind [] = NoNotation notationKind syn = case (isAHole $ head syn, isAHole $ last syn) of (True , True ) -> InfixNotation (True , False) -> PostfixNotation (False, True ) -> PrefixNotation (False, False) -> NonfixNotation -- | From notation with names to notation with indices. -- -- Example: -- @ -- ids = ["for", "x", "∈", "xs", "return", "e"] -- holes = [ LambdaHole "x" "e", ExprHole "xs" ] -- @ -- creates the notation -- @ -- [ IdPart "for" , BindHole 0 -- , IdPart "∈" , NormalHole 1 -- , IdPart "return" , NormalHole 0 -- ] -- @ mkNotation :: [NamedArg c HoleName] -> [RawName] -> Either String Notation mkNotation _ [] = throwError "empty notation is disallowed" mkNotation holes ids = do unless uniqueHoleNames $ throwError "syntax must use unique argument names" let xs :: Notation = map mkPart ids unless (isAlternating xs) $ throwError "syntax must alternate holes and non-holes" unless (isExprLinear xs) $ throwError "syntax must use holes exactly once" unless (isLambdaLinear xs) $ throwError "syntax must use binding holes exactly once" return xs where mkPart ident = fromMaybe (IdPart ident) $ lookup ident holeMap holeNumbers = [0 .. length holes - 1] numberedHoles = zip holeNumbers holes -- Create a map (association list) from hole names to holes. -- A @LambdaHole@ contributes two entries: -- both names are mapped to the same number, -- but distinguished by BindHole vs. NormalHole. holeMap = do (i, h) <- numberedHoles let normalHole = NormalHole $ setArgColors [] $ fmap (i <$) h case namedArg h of ExprHole y -> [(y, normalHole)] LambdaHole x y -> [(x, BindHole i), (y, normalHole)] -- Check whether all hole names are distinct. -- The hole names are the keys of the @holeMap@. uniqueHoleNames = distinct $ map fst holeMap isExprLinear xs = sort [ namedArg x | NormalHole x <- xs] == holeNumbers isLambdaLinear xs = sort [ x | BindHole x <- xs] == [ i | (i, h) <- numberedHoles, isLambdaHole (namedArg h) ] isAlternating :: [GenPart] -> Bool isAlternating [] = __IMPOSSIBLE__ isAlternating [x] = True isAlternating (x:y:xs) = isAHole x /= isAHole y && isAlternating (y:xs) -- | No notation by default. defaultNotation, noNotation :: Notation defaultNotation = [] noNotation = [] Agda-2.4.2.5/src/full/Agda/Syntax/Fixity.hs-boot0000644000000000000000000000026112635075266017343 0ustar0000000000000000module Agda.Syntax.Fixity where import Agda.Syntax.Position ( KillRange ) data Fixity' instance KillRange Fixity' instance Show Fixity' noFixity', defaultFixity' :: Fixity' Agda-2.4.2.5/src/full/Agda/Syntax/Concrete.hs0000644000000000000000000007747012635075266016710 0ustar0000000000000000{-# LANGUAGE CPP #-} {-# LANGUAGE DeriveDataTypeable #-} {-# LANGUAGE DeriveFoldable #-} {-# LANGUAGE DeriveFunctor #-} {-# LANGUAGE DeriveTraversable #-} {-# LANGUAGE FlexibleInstances #-} {-| The concrete syntax is a raw representation of the program text without any desugaring at all. This is what the parser produces. The idea is that if we figure out how to keep the concrete syntax around, it can be printed exactly as the user wrote it. -} module Agda.Syntax.Concrete ( -- * Expressions Expr(..) , OpApp(..), fromOrdinary , module Agda.Syntax.Concrete.Name , appView, AppView(..) -- * Bindings , LamBinding , LamBinding'(..) , TypedBindings , TypedBindings'(..) , TypedBinding , TypedBinding'(..) , ColoredTypedBinding(..) , BoundName(..), mkBoundName_, mkBoundName , Telescope -- (..) , countTelVars -- * Declarations , Declaration(..) , ModuleApplication(..) , TypeSignature , TypeSignatureOrInstanceBlock , Constructor , ImportDirective(..), UsingOrHiding(..), ImportedName(..) , Renaming(..), AsName(..) , defaultImportDir , OpenShortHand(..), RewriteEqn, WithExpr , LHS(..), Pattern(..), LHSCore(..) , RHS, RHS'(..), WhereClause, WhereClause'(..) , Pragma(..) , Module , ThingWithFixity(..) , topLevelModuleName -- * Pattern tools , patternNames, patternQNames -- * Lenses , mapLhsOriginalPattern -- * Concrete instances , Color , Arg -- , Dom , NamedArg , ArgInfo ) where import Control.DeepSeq import Data.Typeable (Typeable) import Data.Foldable (Foldable) import Data.Traversable (Traversable) import Data.List import Data.Set (Set) import Agda.Syntax.Position import Agda.Syntax.Common hiding (Arg, Dom, NamedArg, ArgInfo) import qualified Agda.Syntax.Common as Common import Agda.Syntax.Fixity import Agda.Syntax.Notation import Agda.Syntax.Literal import Agda.Syntax.Concrete.Name import qualified Agda.Syntax.Abstract.Name as A import Agda.Utils.Lens #include "undefined.h" import Agda.Utils.Impossible type Color = Expr type Arg a = Common.Arg Color a -- type Dom a = Common.Dom Color a type NamedArg a = Common.NamedArg Color a type ArgInfo = Common.ArgInfo Color data OpApp e = SyntaxBindingLambda !Range [LamBinding] e -- ^ An abstraction inside a special syntax declaration -- (see Issue 358 why we introduce this). | Ordinary e deriving (Typeable, Functor, Foldable, Traversable) fromOrdinary :: e -> OpApp e -> e fromOrdinary d (Ordinary e) = e fromOrdinary d _ = d -- | Concrete expressions. Should represent exactly what the user wrote. data Expr = Ident QName -- ^ ex: @x@ | Lit Literal -- ^ ex: @1@ or @\"foo\"@ | QuestionMark !Range (Maybe Nat) -- ^ ex: @?@ or @{! ... !}@ | Underscore !Range (Maybe String) -- ^ ex: @_@ or @_A_5@ | RawApp !Range [Expr] -- ^ before parsing operators | App !Range Expr (NamedArg Expr) -- ^ ex: @e e@, @e {e}@, or @e {x = e}@ | OpApp !Range QName (Set A.Name) [NamedArg (OpApp Expr)] -- ^ ex: @e + e@ -- The 'QName' is -- possibly ambiguous, -- but it must -- correspond to one of -- the names in the -- set. | WithApp !Range Expr [Expr] -- ^ ex: @e | e1 | .. | en@ | HiddenArg !Range (Named_ Expr) -- ^ ex: @{e}@ or @{x=e}@ | InstanceArg !Range (Named_ Expr) -- ^ ex: @{{e}}@ or @{{x=e}}@ | Lam !Range [LamBinding] Expr -- ^ ex: @\\x {y} -> e@ or @\\(x:A){y:B} -> e@ | AbsurdLam !Range Hiding -- ^ ex: @\\ ()@ | ExtendedLam !Range [(LHS,RHS,WhereClause)] -- ^ ex: @\\ { p11 .. p1a -> e1 ; .. ; pn1 .. pnz -> en }@ | Fun !Range Expr Expr -- ^ ex: @e -> e@ or @.e -> e@ (NYI: @{e} -> e@) | Pi Telescope Expr -- ^ ex: @(xs:e) -> e@ or @{xs:e} -> e@ | Set !Range -- ^ ex: @Set@ | Prop !Range -- ^ ex: @Prop@ | SetN !Range Integer -- ^ ex: @Set0, Set1, ..@ | Rec !Range [(Name, Expr)] -- ^ ex: @record {x = a; y = b}@ | RecUpdate !Range Expr [(Name, Expr)] -- ^ ex: @record e {x = a; y = b}@ | Let !Range [Declaration] Expr -- ^ ex: @let Ds in e@ | Paren !Range Expr -- ^ ex: @(e)@ | Absurd !Range -- ^ ex: @()@ or @{}@, only in patterns | As !Range Name Expr -- ^ ex: @x\@p@, only in patterns | Dot !Range Expr -- ^ ex: @.p@, only in patterns | ETel Telescope -- ^ only used for printing telescopes | QuoteGoal !Range Name Expr -- ^ ex: @quoteGoal x in e@ | QuoteContext !Range Name Expr -- ^ ex: @quoteContext ctx in e@ | Quote !Range -- ^ ex: @quote@, should be applied to a name | QuoteTerm !Range -- ^ ex: @quoteTerm@, should be applied to a term | Tactic !Range Expr [Expr] -- ^ @tactic solve | subgoal1 | .. | subgoalN@ | Unquote !Range -- ^ ex: @unquote@, should be applied to a term of type @Term@ | DontCare Expr -- ^ to print irrelevant things | Equal !Range Expr Expr -- ^ ex: @a = b@, used internally in the parser deriving (Typeable) instance NFData Expr where rnf x = seq x () -- | Concrete patterns. No literals in patterns at the moment. data Pattern = IdentP QName -- ^ @c@ or @x@ | QuoteP !Range -- ^ @quote@ | AppP Pattern (NamedArg Pattern) -- ^ @p p'@ or @p {x = p'}@ | RawAppP !Range [Pattern] -- ^ @p1..pn@ before parsing operators | OpAppP !Range QName (Set A.Name) [NamedArg Pattern] -- ^ eg: @p => p'@ for operator @_=>_@ -- The 'QName' is possibly -- ambiguous, but it must -- correspond to one of -- the names in the set. | HiddenP !Range (Named_ Pattern) -- ^ @{p}@ or @{x = p}@ | InstanceP !Range (Named_ Pattern) -- ^ @{{p}}@ or @{{x = p}}@ | ParenP !Range Pattern -- ^ @(p)@ | WildP !Range -- ^ @_@ | AbsurdP !Range -- ^ @()@ | AsP !Range Name Pattern -- ^ @x\@p@ unused | DotP !Range Expr -- ^ @.e@ | LitP Literal -- ^ @0@, @1@, etc. deriving (Typeable) instance NFData Pattern where rnf x = seq x () -- | A lambda binding is either domain free or typed. type LamBinding = LamBinding' TypedBindings data LamBinding' a = DomainFree ArgInfo BoundName -- ^ . @x@ or @{x}@ or @.x@ or @.{x}@ or @{.x}@ | DomainFull a -- ^ . @(xs : e)@ or @{xs : e}@ deriving (Typeable, Functor, Foldable, Traversable) -- | A sequence of typed bindings with hiding information. Appears in dependent -- function spaces, typed lambdas, and telescopes. -- -- If the individual binding contains hiding information as well, the -- 'Hiding' in @TypedBindings@ must be the unit 'NotHidden'. type TypedBindings = TypedBindings' TypedBinding data TypedBindings' a = TypedBindings !Range (Arg a) -- ^ . @(xs : e)@ or @{xs : e}@ or something like @(x {y} _ : e)@. deriving (Typeable, Functor, Foldable, Traversable) data BoundName = BName { boundName :: Name , boundLabel :: Name -- ^ for implicit function types the label matters and can't be alpha-renamed , bnameFixity :: Fixity' } deriving (Typeable) mkBoundName_ :: Name -> BoundName mkBoundName_ x = mkBoundName x defaultFixity' mkBoundName :: Name -> Fixity' -> BoundName mkBoundName x f = BName x x f -- | A typed binding. type TypedBinding = TypedBinding' Expr data TypedBinding' e = TBind !Range [WithHiding BoundName] e -- ^ Binding @(x1 ... xn : A)@. | TLet !Range [Declaration] -- ^ Let binding @(let Ds)@ or @(open M args)@. deriving (Typeable, Functor, Foldable, Traversable) -- | Color a TypeBinding. Used by Pretty. data ColoredTypedBinding = WithColors [Color] TypedBinding -- | A telescope is a sequence of typed bindings. Bound variables are in scope -- in later types. type Telescope = [TypedBindings] countTelVars :: Telescope -> Nat countTelVars tel = sum [ case unArg b of TBind _ xs _ -> genericLength xs TLet{} -> 0 | TypedBindings _ b <- tel ] {-| Left hand sides can be written in infix style. For example: > n + suc m = suc (n + m) > (f ∘ g) x = f (g x) We use fixity information to see which name is actually defined. -} data LHS = LHS { lhsOriginalPattern :: Pattern -- ^ @f ps@ , lhsWithPattern :: [Pattern] -- ^ @| p@ (many) , lhsRewriteEqn :: [RewriteEqn] -- ^ @rewrite e@ (many) , lhsWithExpr :: [WithExpr] -- ^ @with e@ (many) } -- ^ original pattern, with-patterns, rewrite equations and with-expressions | Ellipsis Range [Pattern] [RewriteEqn] [WithExpr] -- ^ new with-patterns, rewrite equations and with-expressions deriving (Typeable) type RewriteEqn = Expr type WithExpr = Expr -- | Processed (scope-checked) intermediate form of the core @f ps@ of 'LHS'. -- Corresponds to 'lhsOriginalPattern'. data LHSCore = LHSHead { lhsDefName :: Name -- ^ @f@ , lhsPats :: [NamedArg Pattern] -- ^ @ps@ } | LHSProj { lhsDestructor :: QName -- ^ record projection identifier , lhsPatsLeft :: [NamedArg Pattern] -- ^ side patterns , lhsFocus :: NamedArg LHSCore -- ^ main branch , lhsPatsRight :: [NamedArg Pattern] -- ^ side patterns } deriving (Typeable) instance NFData LHSCore where rnf x = seq x () type RHS = RHS' Expr data RHS' e = AbsurdRHS -- ^ No right hand side because of absurd match. | RHS e deriving (Typeable, Functor, Foldable, Traversable) type WhereClause = WhereClause' [Declaration] data WhereClause' decls = NoWhere -- ^ No @where@ clauses. | AnyWhere decls -- ^ Ordinary @where@. | SomeWhere Name decls -- ^ Named where: @module M where@. deriving (Typeable, Functor, Foldable, Traversable) -- | The things you are allowed to say when you shuffle names between name -- spaces (i.e. in @import@, @namespace@, or @open@ declarations). data ImportDirective = ImportDirective { importDirRange :: !Range , usingOrHiding :: UsingOrHiding , renaming :: [Renaming] , publicOpen :: Bool -- ^ Only for @open@. Exports the opened names from the current module. } deriving (Typeable) -- | Default is directive is @private@ (use everything, but do not export). defaultImportDir :: ImportDirective defaultImportDir = ImportDirective noRange (Hiding []) [] False data UsingOrHiding = Hiding [ImportedName] | Using [ImportedName] deriving (Typeable) -- | An imported name can be a module or a defined name data ImportedName = ImportedModule { importedName :: Name } | ImportedName { importedName :: Name } deriving (Typeable, Eq, Ord) instance Show ImportedName where show (ImportedModule x) = "module " ++ show x show (ImportedName x) = show x data Renaming = Renaming { renFrom :: ImportedName -- ^ Rename from this name. , renTo :: Name -- ^ To this one. , renToRange :: Range -- ^ The range of the \"to\" keyword. Retained for highlighting purposes. } deriving (Typeable) data AsName = AsName { asName :: Name -- ^ The \"as\" name. , asRange :: Range -- ^ The range of the \"as\" keyword. Retained for highlighting purposes. } deriving (Typeable, Show) {-------------------------------------------------------------------------- Declarations --------------------------------------------------------------------------} -- | Just type signatures. type TypeSignature = Declaration -- | Just type signatures or instance blocks. type TypeSignatureOrInstanceBlock = Declaration -- | A data constructor declaration is just a type signature. type Constructor = TypeSignature {-| The representation type of a declaration. The comments indicate which type in the intended family the constructor targets. -} data Declaration = TypeSig ArgInfo Name Expr -- ^ Axioms and functions can be irrelevant. (Hiding should be NotHidden) | Field Name (Arg Expr) -- ^ Record field, can be hidden and/or irrelevant. | FunClause LHS RHS WhereClause | DataSig !Range Induction Name [LamBinding] Expr -- ^ lone data signature in mutual block | Data !Range Induction Name [LamBinding] (Maybe Expr) [Constructor] | RecordSig !Range Name [LamBinding] Expr -- ^ lone record signature in mutual block | Record !Range Name (Maybe (Ranged Induction)) (Maybe Name) [LamBinding] (Maybe Expr) [Declaration] -- ^ The optional name is a name for the record constructor. | Infix Fixity [Name] | Syntax Name Notation -- ^ notation declaration for a name | PatternSyn !Range Name [Arg Name] Pattern | Mutual !Range [Declaration] | Abstract !Range [Declaration] | Private !Range [Declaration] | InstanceB !Range [Declaration] | Postulate !Range [TypeSignatureOrInstanceBlock] | Primitive !Range [TypeSignature] | Open !Range QName ImportDirective | Import !Range QName (Maybe AsName) OpenShortHand ImportDirective | ModuleMacro !Range Name ModuleApplication OpenShortHand ImportDirective | Module !Range QName [TypedBindings] [Declaration] | UnquoteDecl !Range Name Expr | Pragma Pragma deriving (Typeable) data ModuleApplication = SectionApp Range [TypedBindings] Expr -- ^ @tel. M args@ | RecordModuleIFS Range QName -- ^ @M {{...}}@ deriving (Typeable) data OpenShortHand = DoOpen | DontOpen deriving (Typeable, Eq, Show) -- Pragmas ---------------------------------------------------------------- data Pragma = OptionsPragma !Range [String] | BuiltinPragma !Range String Expr | RewritePragma !Range QName | CompiledDataPragma !Range QName String [String] | CompiledTypePragma !Range QName String | CompiledPragma !Range QName String | CompiledExportPragma !Range QName String | CompiledEpicPragma !Range QName String | CompiledJSPragma !Range QName String | StaticPragma !Range QName | ImportPragma !Range String -- ^ Invariant: The string must be a valid Haskell module name. | ImpossiblePragma !Range | EtaPragma !Range QName | TerminationCheckPragma !Range (TerminationCheck Name) deriving (Typeable) --------------------------------------------------------------------------- -- | Modules: Top-level pragmas plus other top-level declarations. type Module = ([Pragma], [Declaration]) -- | Computes the top-level module name. -- -- Precondition: The 'Module' has to be well-formed. topLevelModuleName :: Module -> TopLevelModuleName topLevelModuleName (_, []) = __IMPOSSIBLE__ topLevelModuleName (_, ds) = case last ds of Module _ n _ _ -> toTopLevelModuleName n _ -> __IMPOSSIBLE__ {-------------------------------------------------------------------------- Lenses --------------------------------------------------------------------------} mapLhsOriginalPattern :: (Pattern -> Pattern) -> LHS -> LHS mapLhsOriginalPattern f lhs@Ellipsis{} = lhs mapLhsOriginalPattern f lhs@LHS{ lhsOriginalPattern = p } = lhs { lhsOriginalPattern = f p } {-------------------------------------------------------------------------- Views --------------------------------------------------------------------------} -- | The 'Expr' is not an application. data AppView = AppView Expr [NamedArg Expr] appView :: Expr -> AppView appView (App r e1 e2) = vApp (appView e1) e2 where vApp (AppView e es) arg = AppView e (es ++ [arg]) appView (RawApp _ (e:es)) = AppView e $ map arg es where arg (HiddenArg _ e) = noColorArg Hidden Relevant e arg (InstanceArg _ e) = noColorArg Instance Relevant e arg e = noColorArg NotHidden Relevant (unnamed e) appView e = AppView e [] {-------------------------------------------------------------------------- Patterns --------------------------------------------------------------------------} -- | Get all the identifiers in a pattern in left-to-right order. patternQNames :: Pattern -> [QName] patternQNames p = case p of IdentP x -> [x] AppP p p' -> concatMap patternQNames [p, namedArg p'] RawAppP _ ps -> concatMap patternQNames ps OpAppP _ x _ ps -> x : concatMap (patternQNames . namedArg) ps HiddenP _ (namedPat) -> patternQNames (namedThing namedPat) ParenP _ p -> patternQNames p WildP _ -> [] AbsurdP _ -> [] AsP _ x p -> patternQNames p DotP{} -> [] LitP _ -> [] QuoteP _ -> [] InstanceP _ (namedPat) -> patternQNames (namedThing namedPat) -- | Get all the identifiers in a pattern in left-to-right order. patternNames :: Pattern -> [Name] patternNames = map unqualify . patternQNames {-------------------------------------------------------------------------- Instances --------------------------------------------------------------------------} -- Lenses ------------------------------------------------------------------------ instance LensRelevance TypedBindings where getRelevance (TypedBindings _ b) = getRelevance b mapRelevance f (TypedBindings r b) = TypedBindings r $ mapRelevance f b instance LensHiding TypedBindings where getHiding (TypedBindings _ b) = getHiding b mapHiding f (TypedBindings r b) = TypedBindings r $ mapHiding f b instance LensHiding LamBinding where getHiding (DomainFree ai _) = getHiding ai getHiding (DomainFull a) = getHiding a mapHiding f (DomainFree ai x) = DomainFree (mapHiding f ai) x mapHiding f (DomainFull a) = DomainFull $ mapHiding f a -- HasRange instances ------------------------------------------------------------------------ instance HasRange e => HasRange (OpApp e) where getRange e = case e of Ordinary e -> getRange e SyntaxBindingLambda r _ _ -> r instance HasRange Expr where getRange e = case e of Ident x -> getRange x Lit x -> getRange x QuestionMark r _ -> r Underscore r _ -> r App r _ _ -> r RawApp r _ -> r OpApp r _ _ _ -> r WithApp r _ _ -> r Lam r _ _ -> r AbsurdLam r _ -> r ExtendedLam r _ -> r Fun r _ _ -> r Pi b e -> fuseRange b e Set r -> r Prop r -> r SetN r _ -> r Let r _ _ -> r Paren r _ -> r As r _ _ -> r Dot r _ -> r Absurd r -> r HiddenArg r _ -> r InstanceArg r _ -> r Rec r _ -> r RecUpdate r _ _ -> r ETel tel -> getRange tel QuoteGoal r _ _ -> r QuoteContext r _ _ -> r Quote r -> r QuoteTerm r -> r Unquote r -> r Tactic r _ _ -> r DontCare{} -> noRange Equal r _ _ -> r -- instance HasRange Telescope where -- getRange (TeleBind bs) = getRange bs -- getRange (TeleFun x y) = fuseRange x y instance HasRange TypedBindings where getRange (TypedBindings r _) = r instance HasRange TypedBinding where getRange (TBind r _ _) = r getRange (TLet r _) = r instance HasRange LamBinding where getRange (DomainFree _ x) = getRange x getRange (DomainFull b) = getRange b instance HasRange BoundName where getRange = getRange . boundName instance HasRange WhereClause where getRange NoWhere = noRange getRange (AnyWhere ds) = getRange ds getRange (SomeWhere _ ds) = getRange ds instance HasRange ModuleApplication where getRange (SectionApp r _ _) = r getRange (RecordModuleIFS r _) = r instance HasRange Declaration where getRange (TypeSig _ x t) = fuseRange x t getRange (Field x t) = fuseRange x t getRange (FunClause lhs rhs wh) = fuseRange lhs rhs `fuseRange` wh getRange (DataSig r _ _ _ _) = r getRange (Data r _ _ _ _ _) = r getRange (RecordSig r _ _ _) = r getRange (Record r _ _ _ _ _ _) = r getRange (Mutual r _) = r getRange (Abstract r _) = r getRange (Open r _ _) = r getRange (ModuleMacro r _ _ _ _) = r getRange (Import r _ _ _ _) = r getRange (InstanceB r _) = r getRange (Private r _) = r getRange (Postulate r _) = r getRange (Primitive r _) = r getRange (Module r _ _ _) = r getRange (Infix f _) = getRange f getRange (Syntax n _) = getRange n getRange (PatternSyn r _ _ _) = r getRange (UnquoteDecl r _ _) = r getRange (Pragma p) = getRange p instance HasRange LHS where getRange (LHS p ps eqns ws) = fuseRange p (fuseRange ps (eqns ++ ws)) getRange (Ellipsis r _ _ _) = r instance HasRange LHSCore where getRange (LHSHead f ps) = fuseRange f ps getRange (LHSProj d ps1 lhscore ps2) = d `fuseRange` ps1 `fuseRange` lhscore `fuseRange` ps2 instance HasRange RHS where getRange AbsurdRHS = noRange getRange (RHS e) = getRange e instance HasRange Pragma where getRange (OptionsPragma r _) = r getRange (BuiltinPragma r _ _) = r getRange (RewritePragma r _) = r getRange (CompiledDataPragma r _ _ _) = r getRange (CompiledTypePragma r _ _) = r getRange (CompiledPragma r _ _) = r getRange (CompiledExportPragma r _ _) = r getRange (CompiledEpicPragma r _ _) = r getRange (CompiledJSPragma r _ _) = r getRange (StaticPragma r _) = r getRange (ImportPragma r _) = r getRange (ImpossiblePragma r) = r getRange (EtaPragma r _) = r getRange (TerminationCheckPragma r _) = r instance HasRange UsingOrHiding where getRange (Using xs) = getRange xs getRange (Hiding xs) = getRange xs instance HasRange ImportDirective where getRange = importDirRange instance HasRange ImportedName where getRange (ImportedName x) = getRange x getRange (ImportedModule x) = getRange x instance HasRange Renaming where getRange r = getRange (renFrom r, renTo r) instance HasRange AsName where getRange a = getRange (asRange a, asName a) instance HasRange Pattern where getRange (IdentP x) = getRange x getRange (AppP p q) = fuseRange p q getRange (OpAppP r _ _ _) = r getRange (RawAppP r _) = r getRange (ParenP r _) = r getRange (WildP r) = r getRange (AsP r _ _) = r getRange (AbsurdP r) = r getRange (LitP l) = getRange l getRange (QuoteP r) = r getRange (HiddenP r _) = r getRange (InstanceP r _) = r getRange (DotP r _) = r -- SetRange instances ------------------------------------------------------------------------ instance SetRange TypedBindings where setRange r (TypedBindings _ b) = TypedBindings r b instance SetRange Pattern where setRange r (IdentP x) = IdentP (setRange r x) setRange r (AppP p q) = AppP (setRange r p) (setRange r q) setRange r (OpAppP _ x ns ps) = OpAppP r x ns ps setRange r (RawAppP _ ps) = RawAppP r ps setRange r (ParenP _ p) = ParenP r p setRange r (WildP _) = WildP r setRange r (AsP _ x p) = AsP r (setRange r x) p setRange r (AbsurdP _) = AbsurdP r setRange r (LitP l) = LitP (setRange r l) setRange r (QuoteP _) = QuoteP r setRange r (HiddenP _ p) = HiddenP r p setRange r (InstanceP _ p) = InstanceP r p setRange r (DotP _ e) = DotP r e -- KillRange instances ------------------------------------------------------------------------ instance KillRange AsName where killRange (AsName n _) = killRange1 (flip AsName noRange) n instance KillRange BoundName where killRange (BName n l f) = killRange3 BName n l f instance KillRange Declaration where killRange (TypeSig i n e) = killRange2 (TypeSig i) n e killRange (Field n a) = killRange2 Field n a killRange (FunClause l r w) = killRange3 FunClause l r w killRange (DataSig _ i n l e) = killRange4 (DataSig noRange) i n l e killRange (Data _ i n l e c) = killRange4 (Data noRange i) n l e c killRange (RecordSig _ n l e) = killRange3 (RecordSig noRange) n l e killRange (Record _ n mi mn k e d)= killRange6 (Record noRange) n mi mn k e d killRange (Infix f n) = killRange2 Infix f n killRange (Syntax n no) = killRange1 (\n -> Syntax n no) n killRange (PatternSyn _ n ns p) = killRange3 (PatternSyn noRange) n ns p killRange (Mutual _ d) = killRange1 (Mutual noRange) d killRange (Abstract _ d) = killRange1 (Abstract noRange) d killRange (Private _ d) = killRange1 (Private noRange) d killRange (InstanceB _ d) = killRange1 (InstanceB noRange) d killRange (Postulate _ t) = killRange1 (Postulate noRange) t killRange (Primitive _ t) = killRange1 (Primitive noRange) t killRange (Open _ q i) = killRange2 (Open noRange) q i killRange (Import _ q a o i) = killRange3 (\q a -> Import noRange q a o) q a i killRange (ModuleMacro _ n m o i) = killRange3 (\n m -> ModuleMacro noRange n m o) n m i killRange (Module _ q t d) = killRange3 (Module noRange) q t d killRange (UnquoteDecl _ x t) = killRange2 (UnquoteDecl noRange) x t killRange (Pragma p) = killRange1 Pragma p instance KillRange Expr where killRange (Ident q) = killRange1 Ident q killRange (Lit l) = killRange1 Lit l killRange (QuestionMark _ n) = QuestionMark noRange n killRange (Underscore _ n) = Underscore noRange n killRange (RawApp _ e) = killRange1 (RawApp noRange) e killRange (App _ e a) = killRange2 (App noRange) e a killRange (OpApp _ n ns o) = killRange3 (OpApp noRange) n ns o killRange (WithApp _ e es) = killRange2 (WithApp noRange) e es killRange (HiddenArg _ n) = killRange1 (HiddenArg noRange) n killRange (InstanceArg _ n) = killRange1 (InstanceArg noRange) n killRange (Lam _ l e) = killRange2 (Lam noRange) l e killRange (AbsurdLam _ h) = killRange1 (AbsurdLam noRange) h killRange (ExtendedLam _ lrw) = killRange1 (ExtendedLam noRange) lrw killRange (Fun _ e1 e2) = killRange2 (Fun noRange) e1 e2 killRange (Pi t e) = killRange2 Pi t e killRange (Set _) = Set noRange killRange (Prop _) = Prop noRange killRange (SetN _ n) = SetN noRange n killRange (Rec _ ne) = killRange1 (Rec noRange) ne killRange (RecUpdate _ e ne) = killRange2 (RecUpdate noRange) e ne killRange (Let _ d e) = killRange2 (Let noRange) d e killRange (Paren _ e) = killRange1 (Paren noRange) e killRange (Absurd _) = Absurd noRange killRange (As _ n e) = killRange2 (As noRange) n e killRange (Dot _ e) = killRange1 (Dot noRange) e killRange (ETel t) = killRange1 ETel t killRange (QuoteGoal _ n e) = killRange2 (QuoteGoal noRange) n e killRange (QuoteContext _ n e) = killRange2 (QuoteContext noRange) n e killRange (Quote _) = Quote noRange killRange (QuoteTerm _) = QuoteTerm noRange killRange (Unquote _) = Unquote noRange killRange (Tactic _ t es) = killRange2 (Tactic noRange) t es killRange (DontCare e) = killRange1 DontCare e killRange (Equal _ x y) = Equal noRange x y instance KillRange ImportDirective where killRange (ImportDirective _ u r p) = killRange2 (\u r -> ImportDirective noRange u r p) u r instance KillRange ImportedName where killRange (ImportedModule n) = killRange1 ImportedModule n killRange (ImportedName n) = killRange1 ImportedName n instance KillRange LamBinding where killRange (DomainFree i b) = killRange2 DomainFree i b killRange (DomainFull t) = killRange1 DomainFull t instance KillRange LHS where killRange (LHS p ps r w) = killRange4 LHS p ps r w killRange (Ellipsis _ p r w) = killRange3 (Ellipsis noRange) p r w instance KillRange ModuleApplication where killRange (SectionApp _ t e) = killRange2 (SectionApp noRange) t e killRange (RecordModuleIFS _ q) = killRange1 (RecordModuleIFS noRange) q instance KillRange e => KillRange (OpApp e) where killRange (SyntaxBindingLambda _ l e) = killRange2 (SyntaxBindingLambda noRange) l e killRange (Ordinary e) = killRange1 Ordinary e instance KillRange Pattern where killRange (IdentP q) = killRange1 IdentP q killRange (AppP p n) = killRange2 AppP p n killRange (RawAppP _ p) = killRange1 (RawAppP noRange) p killRange (OpAppP _ n ns p) = killRange3 (OpAppP noRange) n ns p killRange (HiddenP _ n) = killRange1 (HiddenP noRange) n killRange (InstanceP _ n) = killRange1 (InstanceP noRange) n killRange (ParenP _ p) = killRange1 (ParenP noRange) p killRange (WildP _) = WildP noRange killRange (AbsurdP _) = AbsurdP noRange killRange (AsP _ n p) = killRange2 (AsP noRange) n p killRange (DotP _ e) = killRange1 (DotP noRange) e killRange (LitP l) = killRange1 LitP l killRange (QuoteP _) = QuoteP noRange instance KillRange Pragma where killRange (OptionsPragma _ s) = OptionsPragma noRange s killRange (BuiltinPragma _ s e) = killRange1 (BuiltinPragma noRange s) e killRange (RewritePragma _ q) = killRange1 (RewritePragma noRange) q killRange (CompiledDataPragma _ q s ss) = killRange1 (\q -> CompiledDataPragma noRange q s ss) q killRange (CompiledTypePragma _ q s) = killRange1 (\q -> CompiledTypePragma noRange q s) q killRange (CompiledPragma _ q s) = killRange1 (\q -> CompiledPragma noRange q s) q killRange (CompiledExportPragma _ q s) = killRange1 (\q -> CompiledExportPragma noRange q s) q killRange (CompiledEpicPragma _ q s) = killRange1 (\q -> CompiledEpicPragma noRange q s) q killRange (CompiledJSPragma _ q s) = killRange1 (\q -> CompiledJSPragma noRange q s) q killRange (StaticPragma _ q) = killRange1 (StaticPragma noRange) q killRange (ImportPragma _ s) = ImportPragma noRange s killRange (ImpossiblePragma _) = ImpossiblePragma noRange killRange (EtaPragma _ q) = killRange1 (EtaPragma noRange) q killRange (TerminationCheckPragma _ t) = TerminationCheckPragma noRange (killRange t) instance KillRange Renaming where killRange (Renaming i n _) = killRange2 (\i n -> Renaming i n noRange) i n instance KillRange RHS where killRange AbsurdRHS = AbsurdRHS killRange (RHS e) = killRange1 RHS e instance KillRange TypedBinding where killRange (TBind _ b e) = killRange2 (TBind noRange) b e killRange (TLet r ds) = killRange2 TLet r ds instance KillRange TypedBindings where killRange (TypedBindings _ t) = killRange1 (TypedBindings noRange) t instance KillRange UsingOrHiding where killRange (Hiding i) = killRange1 Hiding i killRange (Using i) = killRange1 Using i instance KillRange WhereClause where killRange NoWhere = NoWhere killRange (AnyWhere d) = killRange1 AnyWhere d killRange (SomeWhere n d) = killRange2 SomeWhere n d Agda-2.4.2.5/src/full/Agda/Syntax/Fixity.hs0000644000000000000000000002014112635075266016401 0ustar0000000000000000{-# LANGUAGE CPP #-} {-# LANGUAGE DeriveDataTypeable #-} {-# LANGUAGE DeriveFoldable #-} {-# LANGUAGE DeriveFunctor #-} {-# LANGUAGE DeriveTraversable #-} {-| Definitions for fixity, precedence levels, and declared syntax. -} module Agda.Syntax.Fixity where import Data.Foldable import Data.Function import Data.List as List import Data.Set (Set) import qualified Data.Set as Set import Data.Traversable import Data.Typeable (Typeable) import Agda.Syntax.Position import Agda.Syntax.Common import qualified Agda.Syntax.Abstract.Name as A import Agda.Syntax.Concrete.Name import Agda.Syntax.Notation import Agda.Utils.List #include "undefined.h" import Agda.Utils.Impossible -- * Notation coupled with 'Fixity' -- | The notation is handled as the fixity in the renamer. -- Hence, they are grouped together in this type. data Fixity' = Fixity' { theFixity :: Fixity , theNotation :: Notation } deriving (Typeable, Show, Eq) -- | Decorating something with @Fixity'@. data ThingWithFixity x = ThingWithFixity x Fixity' deriving (Functor, Foldable, Traversable, Typeable, Show) -- | All the notation information related to a name. data NewNotation = NewNotation { notaName :: QName , notaNames :: Set A.Name -- ^ The names the syntax and/or fixity belong to. -- -- Invariant: The set is non-empty. Every name in the list matches -- 'notaName'. , notaFixity :: Fixity -- ^ Associativity and precedence (fixity) of the names. , notation :: Notation -- ^ Syntax associated with the names. } deriving (Typeable, Show) -- | If an operator has no specific notation, then it is computed from -- its name. namesToNotation :: QName -> A.Name -> NewNotation namesToNotation q n = NewNotation { notaName = q , notaNames = Set.singleton n , notaFixity = f , notation = if null syn then syntaxOf $ unqualify q else syn } where Fixity' f syn = A.nameFixity n -- | Return the 'IdPart's of a notation, the first part qualified, -- the other parts unqualified. -- This allows for qualified use of operators, e.g., -- @M.for x ∈ xs return e@, or @x ℕ.+ y@. notationNames :: NewNotation -> [QName] notationNames (NewNotation q _ _ parts) = zipWith ($) (reQualify : repeat QName) [Name noRange [Id x] | IdPart x <- parts ] where -- The qualification of @q@. modules = init (qnameParts q) -- Putting the qualification onto @x@. reQualify x = List.foldr Qual (QName x) modules -- | Create a 'Notation' (without binders) from a concrete 'Name'. -- Does the obvious thing: -- 'Hole's become 'NormalHole's, 'Id's become 'IdParts'. -- If 'Name' has no 'Hole's, it returns 'noNotation'. syntaxOf :: Name -> Notation syntaxOf (NoName _ _) = noNotation syntaxOf (Name _ [_]) = noNotation syntaxOf (Name _ xs) = mkSyn 0 xs where -- Turn a concrete name into a Notation, -- numbering the holes from left to right. -- Result will have no 'BindingHole's. mkSyn :: Int -> [NamePart] -> Notation mkSyn n [] = [] mkSyn n (Hole : xs) = NormalHole (defaultNamedArg n) : mkSyn (1 + n) xs mkSyn n (Id x : xs) = IdPart x : mkSyn n xs defaultFixity' :: Fixity' defaultFixity' = Fixity' defaultFixity defaultNotation noFixity' :: Fixity' noFixity' = Fixity' noFixity noNotation -- | Merges all 'NewNotation's that have the same notation. -- -- If all 'NewNotation's with a given notation have the same fixity, -- then this fixity is preserved, and otherwise it is replaced by -- 'defaultFixity'. -- -- Precondition: No 'A.Name' may occur in more than one list element. -- Every 'NewNotation' must have the same 'notaName'. -- -- Postcondition: No 'A.Name' occurs in more than one list element. mergeNotations :: [NewNotation] -> [NewNotation] mergeNotations = map (merge . fixFixities) . groupOn notation where fixFixities ns | allEqual (map notaFixity ns) = ns | otherwise = map (\n -> n { notaFixity = defaultFixity }) ns merge :: [NewNotation] -> NewNotation merge [] = __IMPOSSIBLE__ merge ns@(n : _) = n { notaNames = Set.unions $ map notaNames ns } -- * Fixity -- | Associativity. data Associativity = NonAssoc | LeftAssoc | RightAssoc deriving (Eq, Ord, Show, Typeable) -- | Fixity of operators. data Fixity = Fixity { fixityRange :: Range , fixityLevel :: Integer , fixityAssoc :: Associativity } deriving (Typeable, Show) instance Eq Fixity where f1 == f2 = compare f1 f2 == EQ instance Ord Fixity where compare = compare `on` (\f -> (fixityLevel f, fixityAssoc f)) -- For @instance Pretty Fixity@, see Agda.Syntax.Concrete.Pretty -- | The default fixity. Currently defined to be @'NonAssoc' 20@. defaultFixity :: Fixity defaultFixity = Fixity noRange 20 NonAssoc -- | Hack used for @syntax@ facility. noFixity :: Fixity noFixity = Fixity noRange (negate 666) NonAssoc -- Ts,ts,ts, why the number of the beast? Revelation 13, 18 -- -- It's not the number of the beast, it's the negation of the -- number of the beast, which must be a divine number, right? -- -- The divine is not the negation of evil. -- Evil is only the absense of the good and divine. -- * Precendence -- | Precedence is associated with a context. data Precedence = TopCtx | FunctionSpaceDomainCtx | LeftOperandCtx Fixity | RightOperandCtx Fixity | FunctionCtx | ArgumentCtx | InsideOperandCtx | WithFunCtx | WithArgCtx | DotPatternCtx deriving (Show,Typeable) -- | The precedence corresponding to a possibly hidden argument. hiddenArgumentCtx :: Hiding -> Precedence hiddenArgumentCtx NotHidden = ArgumentCtx hiddenArgumentCtx Hidden = TopCtx hiddenArgumentCtx Instance = TopCtx -- | Do we need to bracket an operator application of the given fixity -- in a context with the given precedence. opBrackets :: Fixity -> Precedence -> Bool opBrackets (Fixity _ n1 LeftAssoc) (LeftOperandCtx (Fixity _ n2 LeftAssoc)) | n1 >= n2 = False opBrackets (Fixity _ n1 RightAssoc) (RightOperandCtx (Fixity _ n2 RightAssoc)) | n1 >= n2 = False opBrackets f1 (LeftOperandCtx f2) | fixityLevel f1 > fixityLevel f2 = False opBrackets f1 (RightOperandCtx f2) | fixityLevel f1 > fixityLevel f2 = False opBrackets _ TopCtx = False opBrackets _ FunctionSpaceDomainCtx = False opBrackets _ InsideOperandCtx = False opBrackets _ WithArgCtx = False opBrackets _ WithFunCtx = False opBrackets _ _ = True -- | Does a lambda-like thing (lambda, let or pi) need brackets in the -- given context? A peculiar thing with lambdas is that they don't -- need brackets in certain right operand contexts. However, we insert -- brackets anyway, for the following reasons: -- -- * Clarity. -- -- * Sometimes brackets are needed. Example: @m₁ >>= (λ x → x) >>= m₂@ -- (here @_>>=_@ is left associative). lamBrackets :: Precedence -> Bool lamBrackets TopCtx = False lamBrackets _ = True -- | Does a function application need brackets? appBrackets :: Precedence -> Bool appBrackets ArgumentCtx = True appBrackets DotPatternCtx = True appBrackets _ = False -- | Does a with application need brackets? withAppBrackets :: Precedence -> Bool withAppBrackets TopCtx = False withAppBrackets FunctionSpaceDomainCtx = False withAppBrackets WithFunCtx = False withAppBrackets _ = True -- | Does a function space need brackets? piBrackets :: Precedence -> Bool piBrackets TopCtx = False piBrackets _ = True roundFixBrackets :: Precedence -> Bool roundFixBrackets DotPatternCtx = True roundFixBrackets _ = False instance HasRange Fixity where getRange = fixityRange instance KillRange Fixity where killRange f = f { fixityRange = noRange } instance KillRange Fixity' where killRange (Fixity' f n) = killRange2 Fixity' f n instance KillRange x => KillRange (ThingWithFixity x) where killRange (ThingWithFixity c f) = ThingWithFixity (killRange c) f ------------------------------------------------------------------------ -- * Printing ------------------------------------------------------------------------ -- deriving instance Show Fixity' Agda-2.4.2.5/src/full/Agda/Syntax/Scope/0000755000000000000000000000000012635075266015644 5ustar0000000000000000Agda-2.4.2.5/src/full/Agda/Syntax/Scope/Base.hs0000644000000000000000000007504012635075266017060 0ustar0000000000000000{-# LANGUAGE CPP #-} {-# LANGUAGE DeriveDataTypeable #-} {-# LANGUAGE GADTs #-} {-# LANGUAGE ScopedTypeVariables #-} {-# LANGUAGE RankNTypes #-} {-# LANGUAGE TupleSections #-} {-| This module defines the notion of a scope and operations on scopes. -} module Agda.Syntax.Scope.Base where import Control.Arrow ((***), first, second) import Control.Applicative import Control.DeepSeq import Data.Function import Data.List as List import Data.Map (Map) import qualified Data.Map as Map import Data.Maybe import Data.Typeable (Typeable) -- import Debug.Trace (trace) import Agda.Benchmarking import Agda.Syntax.Position import Agda.Syntax.Common import Agda.Syntax.Fixity import Agda.Syntax.Abstract.Name as A import Agda.Syntax.Concrete.Name as C import Agda.Syntax.Concrete (ImportDirective(..), UsingOrHiding(..), ImportedName(..), Renaming(..)) import Agda.Utils.AssocList (AssocList) import qualified Agda.Utils.AssocList as AssocList import Agda.Utils.Functor import Agda.Utils.Lens import Agda.Utils.List import qualified Agda.Utils.Map as Map #include "undefined.h" import Agda.Utils.Impossible -- * Scope representation -- | A scope is a named collection of names partitioned into public and private -- names. data Scope = Scope { scopeName :: A.ModuleName , scopeParents :: [A.ModuleName] , scopeNameSpaces :: ScopeNameSpaces , scopeImports :: Map C.QName A.ModuleName , scopeDatatypeModule :: Bool } deriving (Typeable) -- | See 'Agda.Syntax.Common.Access'. data NameSpaceId = PrivateNS -- ^ Things not exported by this module. | PublicNS -- ^ Things defined and exported by this module. | ImportedNS -- ^ Things from open public, exported by this module. | OnlyQualifiedNS -- ^ Visible (as qualified) from outside, -- but not exported when opening the module. -- Used for qualified constructors. deriving (Typeable, Eq, Bounded, Enum) type ScopeNameSpaces = [(NameSpaceId, NameSpace)] localNameSpace :: Access -> NameSpaceId localNameSpace PublicAccess = PublicNS localNameSpace PrivateAccess = PrivateNS localNameSpace OnlyQualified = OnlyQualifiedNS nameSpaceAccess :: NameSpaceId -> Access nameSpaceAccess PrivateNS = PrivateAccess nameSpaceAccess _ = PublicAccess -- | Get a 'NameSpace' from 'Scope'. scopeNameSpace :: NameSpaceId -> Scope -> NameSpace scopeNameSpace ns = fromMaybe __IMPOSSIBLE__ . lookup ns . scopeNameSpaces -- | A lens for 'scopeNameSpaces' updateScopeNameSpaces :: (ScopeNameSpaces -> ScopeNameSpaces) -> Scope -> Scope updateScopeNameSpaces f s = s { scopeNameSpaces = f (scopeNameSpaces s) } -- | ``Monadic'' lens (Functor sufficient). updateScopeNameSpacesM :: (Functor m) => (ScopeNameSpaces -> m ScopeNameSpaces) -> Scope -> m Scope updateScopeNameSpacesM f s = for (f $ scopeNameSpaces s) $ \ x -> s { scopeNameSpaces = x } -- | The complete information about the scope at a particular program point -- includes the scope stack, the local variables, and the context precedence. data ScopeInfo = ScopeInfo { scopeCurrent :: A.ModuleName , scopeModules :: Map A.ModuleName Scope , scopeLocals :: LocalVars , scopePrecedence :: Precedence } deriving (Typeable) -- | Local variables. type LocalVars = AssocList C.Name LocalVar -- | A local variable can be shadowed by an import. -- In case of reference to a shadowed variable, we want to report -- a scope error. data LocalVar = LocalVar { localVar :: A.Name } -- ^ Unique ID of local variable. | ShadowedVar { localVar :: A.Name, localShadowedBy :: [AbstractName] } -- ^ This local variable is shadowed by one or more imports. -- (List not empty). deriving (Typeable) instance NFData LocalVar where rnf x = seq x () instance Eq LocalVar where (==) = (==) `on` localVar instance Ord LocalVar where compare = compare `on` localVar -- | We show shadowed variables as prefixed by a ".", as not in scope. instance Show LocalVar where show (LocalVar x) = show x show (ShadowedVar x xs) = "." ++ show x -- | Shadow a local name by a non-empty list of imports. shadowLocal :: [AbstractName] -> LocalVar -> LocalVar shadowLocal [] _ = __IMPOSSIBLE__ shadowLocal ys (LocalVar x ) = ShadowedVar x ys shadowLocal ys (ShadowedVar x zs) = ShadowedVar x (ys ++ zs) -- | Project name of unshadowed local variable. notShadowedLocal :: LocalVar -> Maybe A.Name notShadowedLocal (LocalVar x) = Just x notShadowedLocal ShadowedVar{} = Nothing -- | Get all locals that are not shadowed. notShadowedLocals :: LocalVars -> AssocList C.Name A.Name notShadowedLocals = mapMaybe $ \ (c,x) -> (c,) <$> notShadowedLocal x -- | Lens for 'scopeLocals'. updateScopeLocals :: (LocalVars -> LocalVars) -> ScopeInfo -> ScopeInfo updateScopeLocals f sc = sc { scopeLocals = f (scopeLocals sc) } setScopeLocals :: LocalVars -> ScopeInfo -> ScopeInfo setScopeLocals vars = updateScopeLocals (const vars) ------------------------------------------------------------------------ -- * Name spaces -- -- Map concrete names to lists of abstract names. ------------------------------------------------------------------------ -- | A @NameSpace@ contains the mappings from concrete names that the user can -- write to the abstract fully qualified names that the type checker wants to -- read. data NameSpace = NameSpace { nsNames :: NamesInScope -- ^ Maps concrete names to a list of abstract names. , nsModules :: ModulesInScope -- ^ Maps concrete module names to a list of abstract module names. } deriving (Typeable) type ThingsInScope a = Map C.Name [a] type NamesInScope = ThingsInScope AbstractName type ModulesInScope = ThingsInScope AbstractModule -- | Set of types consisting of exactly 'AbstractName' and 'AbstractModule'. -- -- A GADT just for some dependent-types trickery. data InScopeTag a where NameTag :: InScopeTag AbstractName ModuleTag :: InScopeTag AbstractModule -- | Type class for some dependent-types trickery. class Eq a => InScope a where inScopeTag :: InScopeTag a instance InScope AbstractName where inScopeTag = NameTag instance InScope AbstractModule where inScopeTag = ModuleTag -- | @inNameSpace@ selects either the name map or the module name map from -- a 'NameSpace'. What is selected is determined by result type -- (using the dependent-type trickery). inNameSpace :: forall a. InScope a => NameSpace -> ThingsInScope a inNameSpace = case inScopeTag :: InScopeTag a of NameTag -> nsNames ModuleTag -> nsModules ------------------------------------------------------------------------ -- * Decorated names -- -- - What kind of name? (defined, constructor...) -- - Where does the name come from? (to explain to user) ------------------------------------------------------------------------ -- | For the sake of parsing left-hand sides, we distinguish -- constructor and record field names from defined names. data KindOfName = ConName -- ^ Constructor name. | FldName -- ^ Record field name. | DefName -- ^ Ordinary defined name. | PatternSynName -- ^ Name of a pattern synonym. | QuotableName -- ^ A name that can only quoted. deriving (Eq, Show, Typeable, Enum, Bounded) -- | A list containing all name kinds. allKindsOfNames :: [KindOfName] allKindsOfNames = [minBound..maxBound] -- | Where does a name come from? -- -- This information is solely for reporting to the user, -- see 'Agda.Interaction.InteractionTop.whyInScope'. data WhyInScope = Defined -- ^ Defined in this module. | Opened C.QName WhyInScope -- ^ Imported from another module. | Applied C.QName WhyInScope -- ^ Imported by a module application. deriving (Typeable) -- | A decoration of 'Agda.Syntax.Abstract.Name.QName'. data AbstractName = AbsName { anameName :: A.QName -- ^ The resolved qualified name. , anameKind :: KindOfName -- ^ The kind (definition, constructor, record field etc.). , anameLineage :: WhyInScope -- ^ Explanation where this name came from. } deriving (Typeable) -- | A decoration of abstract syntax module names. data AbstractModule = AbsModule { amodName :: A.ModuleName -- ^ The resolved module name. , amodLineage :: WhyInScope -- ^ Explanation where this name came from. } deriving (Typeable) instance Eq AbstractName where (==) = (==) `on` anameName instance Ord AbstractName where compare = compare `on` anameName -- | Van Laarhoven lens on 'anameName'. lensAnameName :: Functor m => (A.QName -> m A.QName) -> AbstractName -> m AbstractName lensAnameName f am = f (anameName am) <&> \ m -> am { anameName = m } instance Eq AbstractModule where (==) = (==) `on` amodName instance Ord AbstractModule where compare = compare `on` amodName -- | Van Laarhoven lens on 'amodName'. lensAmodName :: Functor m => (A.ModuleName -> m A.ModuleName) -> AbstractModule -> m AbstractModule lensAmodName f am = f (amodName am) <&> \ m -> am { amodName = m } -- * Operations on name and module maps. mergeNames :: Eq a => ThingsInScope a -> ThingsInScope a -> ThingsInScope a mergeNames = Map.unionWith union ------------------------------------------------------------------------ -- * Operations on name spaces ------------------------------------------------------------------------ -- | The empty name space. emptyNameSpace :: NameSpace emptyNameSpace = NameSpace Map.empty Map.empty -- | Map functions over the names and modules in a name space. mapNameSpace :: (NamesInScope -> NamesInScope ) -> (ModulesInScope -> ModulesInScope) -> NameSpace -> NameSpace mapNameSpace fd fm ns = ns { nsNames = fd $ nsNames ns , nsModules = fm $ nsModules ns } -- | Zip together two name spaces. zipNameSpace :: (NamesInScope -> NamesInScope -> NamesInScope ) -> (ModulesInScope -> ModulesInScope -> ModulesInScope) -> NameSpace -> NameSpace -> NameSpace zipNameSpace fd fm ns1 ns2 = ns1 { nsNames = nsNames ns1 `fd` nsNames ns2 , nsModules = nsModules ns1 `fm` nsModules ns2 } -- | Map monadic function over a namespace. mapNameSpaceM :: Applicative m => (NamesInScope -> m NamesInScope ) -> (ModulesInScope -> m ModulesInScope) -> NameSpace -> m NameSpace mapNameSpaceM fd fm ns = update ns <$> fd (nsNames ns) <*> fm (nsModules ns) where update ns ds ms = ns { nsNames = ds, nsModules = ms } ------------------------------------------------------------------------ -- * General operations on scopes ------------------------------------------------------------------------ -- | The empty scope. emptyScope :: Scope emptyScope = Scope { scopeName = noModuleName , scopeParents = [] , scopeNameSpaces = [ (nsid, emptyNameSpace) | nsid <- [minBound..maxBound] ] , scopeImports = Map.empty , scopeDatatypeModule = False } -- | The empty scope info. emptyScopeInfo :: ScopeInfo emptyScopeInfo = ScopeInfo { scopeCurrent = noModuleName , scopeModules = Map.singleton noModuleName emptyScope , scopeLocals = [] , scopePrecedence = TopCtx } -- | Map functions over the names and modules in a scope. mapScope :: (NameSpaceId -> NamesInScope -> NamesInScope ) -> (NameSpaceId -> ModulesInScope -> ModulesInScope) -> Scope -> Scope mapScope fd fm = updateScopeNameSpaces $ AssocList.mapWithKey mapNS where mapNS acc = mapNameSpace (fd acc) (fm acc) -- | Same as 'mapScope' but applies the same function to all name spaces. mapScope_ :: (NamesInScope -> NamesInScope ) -> (ModulesInScope -> ModulesInScope) -> Scope -> Scope mapScope_ fd fm = mapScope (const fd) (const fm) -- | Map monadic functions over the names and modules in a scope. mapScopeM :: (Functor m, Applicative m) => (NameSpaceId -> NamesInScope -> m NamesInScope ) -> (NameSpaceId -> ModulesInScope -> m ModulesInScope) -> Scope -> m Scope mapScopeM fd fm = updateScopeNameSpacesM $ AssocList.mapWithKeyM mapNS where mapNS acc = mapNameSpaceM (fd acc) (fm acc) -- | Same as 'mapScopeM' but applies the same function to both the public and -- private name spaces. mapScopeM_ :: (Functor m, Applicative m) => (NamesInScope -> m NamesInScope ) -> (ModulesInScope -> m ModulesInScope) -> Scope -> m Scope mapScopeM_ fd fm = mapScopeM (const fd) (const fm) -- | Zip together two scopes. The resulting scope has the same name as the -- first scope. zipScope :: (NameSpaceId -> NamesInScope -> NamesInScope -> NamesInScope ) -> (NameSpaceId -> ModulesInScope -> ModulesInScope -> ModulesInScope) -> Scope -> Scope -> Scope zipScope fd fm s1 s2 = s1 { scopeNameSpaces = [ (nsid, zipNS nsid ns1 ns2) | ((nsid, ns1), (nsid', ns2)) <- zipWith' (,) (scopeNameSpaces s1) (scopeNameSpaces s2) , assert (nsid == nsid') ] , scopeImports = Map.union (scopeImports s1) (scopeImports s2) } where assert True = True assert False = __IMPOSSIBLE__ zipNS acc = zipNameSpace (fd acc) (fm acc) -- | Same as 'zipScope' but applies the same function to both the public and -- private name spaces. zipScope_ :: (NamesInScope -> NamesInScope -> NamesInScope ) -> (ModulesInScope -> ModulesInScope -> ModulesInScope) -> Scope -> Scope -> Scope zipScope_ fd fm = zipScope (const fd) (const fm) -- | Filter a scope keeping only concrete names matching the predicates. -- The first predicate is applied to the names and the second to the modules. filterScope :: (C.Name -> Bool) -> (C.Name -> Bool) -> Scope -> Scope filterScope pd pm = mapScope_ (Map.filterKeys pd) (Map.filterKeys pm) -- | Return all names in a scope. allNamesInScope :: InScope a => Scope -> ThingsInScope a allNamesInScope = namesInScope [minBound..maxBound] allNamesInScope' :: InScope a => Scope -> ThingsInScope (a, Access) allNamesInScope' s = foldr1 mergeNames [ map (, nameSpaceAccess ns) <$> namesInScope [ns] s | ns <- [minBound..maxBound] ] -- | Returns the scope's non-private names. exportedNamesInScope :: InScope a => Scope -> ThingsInScope a exportedNamesInScope = namesInScope [PublicNS, ImportedNS, OnlyQualifiedNS] namesInScope :: InScope a => [NameSpaceId] -> Scope -> ThingsInScope a namesInScope ids s = foldr1 mergeNames [ inNameSpace (scopeNameSpace nsid s) | nsid <- ids ] allThingsInScope :: Scope -> NameSpace allThingsInScope = thingsInScope [minBound..maxBound] thingsInScope :: [NameSpaceId] -> Scope -> NameSpace thingsInScope fs s = NameSpace { nsNames = namesInScope fs s , nsModules = namesInScope fs s } -- | Merge two scopes. The result has the name of the first scope. mergeScope :: Scope -> Scope -> Scope mergeScope = zipScope_ mergeNames mergeNames -- | Merge a non-empty list of scopes. The result has the name of the first -- scope in the list. mergeScopes :: [Scope] -> Scope mergeScopes [] = __IMPOSSIBLE__ mergeScopes ss = foldr1 mergeScope ss -- * Specific operations on scopes -- | Move all names in a scope to the given name space (except never move from -- Imported to Public). setScopeAccess :: NameSpaceId -> Scope -> Scope setScopeAccess a s = (`updateScopeNameSpaces` s) $ AssocList.mapWithKey $ const . ns where zero = emptyNameSpace one = allThingsInScope s imp = thingsInScope [ImportedNS] s noimp = thingsInScope [PublicNS, PrivateNS, OnlyQualifiedNS] s ns b = case (a, b) of (PublicNS, PublicNS) -> noimp (PublicNS, ImportedNS) -> imp _ | a == b -> one | otherwise -> zero -- | Update a particular name space. setNameSpace :: NameSpaceId -> NameSpace -> Scope -> Scope setNameSpace nsid ns = modifyNameSpace nsid $ const ns -- | Modify a particular name space. modifyNameSpace :: NameSpaceId -> (NameSpace -> NameSpace) -> Scope -> Scope modifyNameSpace nsid f = updateScopeNameSpaces $ AssocList.updateAt nsid f -- | Add names to a scope. addNamesToScope :: NameSpaceId -> C.Name -> [AbstractName] -> Scope -> Scope addNamesToScope acc x ys s = mergeScope s s1 where s1 = setScopeAccess acc $ setNameSpace PublicNS ns emptyScope ns = emptyNameSpace { nsNames = Map.singleton x ys } -- | Add a name to a scope. addNameToScope :: NameSpaceId -> C.Name -> AbstractName -> Scope -> Scope addNameToScope acc x y s = addNamesToScope acc x [y] s -- | Remove a name from a scope. removeNameFromScope :: NameSpaceId -> C.Name -> Scope -> Scope removeNameFromScope ns x s = mapScope remove (const id) s where remove ns' | ns' /= ns = id | otherwise = Map.delete x -- | Add a module to a scope. addModuleToScope :: NameSpaceId -> C.Name -> AbstractModule -> Scope -> Scope addModuleToScope acc x m s = mergeScope s s1 where s1 = setScopeAccess acc $ setNameSpace PublicNS ns emptyScope ns = emptyNameSpace { nsModules = Map.singleton x [m] } -- | Apply an 'ImportDirective' to a scope. applyImportDirective :: ImportDirective -> Scope -> Scope applyImportDirective dir s = mergeScope usedOrHidden renamed where usedOrHidden = useOrHide (hideLHS (renaming dir) $ usingOrHiding dir) s renamed = rename (renaming dir) $ useOrHide useRenamedThings s useRenamedThings = Using $ map renFrom $ renaming dir hideLHS :: [Renaming] -> UsingOrHiding -> UsingOrHiding hideLHS _ i@(Using _) = i hideLHS ren (Hiding xs) = Hiding $ xs ++ map renFrom ren useOrHide :: UsingOrHiding -> Scope -> Scope useOrHide (Hiding xs) s = filterNames notElem notElem xs s useOrHide (Using xs) s = filterNames elem elem xs s filterNames :: (C.Name -> [C.Name] -> Bool) -> (C.Name -> [C.Name] -> Bool) -> [ImportedName] -> Scope -> Scope filterNames pd pm xs = filterScope' (flip pd ds) (flip pm ms) where ds = [ x | ImportedName x <- xs ] ms = [ m | ImportedModule m <- xs ] filterScope' pd pm = filterScope pd pm -- Renaming rename :: [Renaming] -> Scope -> Scope rename rho = mapScope_ (Map.mapKeys $ ren drho) (Map.mapKeys $ ren mrho) where mrho = [ (x, y) | Renaming { renFrom = ImportedModule x, renTo = y } <- rho ] drho = [ (x, y) | Renaming { renFrom = ImportedName x, renTo = y } <- rho ] ren r x = fromMaybe x $ lookup x r -- | Rename the abstract names in a scope. renameCanonicalNames :: Map A.QName A.QName -> Map A.ModuleName A.ModuleName -> Scope -> Scope renameCanonicalNames renD renM = mapScope_ renameD renameM where renameD = Map.map $ map $ over lensAnameName $ \ x -> Map.findWithDefault x x renD renameM = Map.map $ map $ over lensAmodName $ \ x -> Map.findWithDefault x x renM -- | Remove private name space of a scope. -- -- Should be a right identity for 'exportedNamesInScope'. -- @exportedNamesInScope . restrictPrivate == exportedNamesInScope@. restrictPrivate :: Scope -> Scope restrictPrivate s = setNameSpace PrivateNS emptyNameSpace $ s { scopeImports = Map.empty } -- | Remove names that can only be used qualified (when opening a scope) removeOnlyQualified :: Scope -> Scope removeOnlyQualified s = setNameSpace OnlyQualifiedNS emptyNameSpace s -- | Add an explanation to why things are in scope. inScopeBecause :: (WhyInScope -> WhyInScope) -> Scope -> Scope inScopeBecause f = mapScope_ mapName mapMod where mapName = fmap . map $ \a -> a { anameLineage = f $ anameLineage a } mapMod = fmap . map $ \a -> a { amodLineage = f $ amodLineage a } -- | Get the public parts of the public modules of a scope publicModules :: ScopeInfo -> Map A.ModuleName Scope publicModules scope = Map.filterWithKey (\ m _ -> reachable m) allMods where -- Get all modules in the ScopeInfo. allMods = Map.map restrictPrivate $ scopeModules scope root = scopeCurrent scope modules s = map amodName $ concat $ Map.elems $ allNamesInScope s chase m = m : concatMap chase ms where ms = maybe __IMPOSSIBLE__ modules $ Map.lookup m allMods reachable = (`elem` chase root) everythingInScope :: ScopeInfo -> NameSpace everythingInScope scope = allThingsInScope $ mergeScopes $ (s0 :) $ map look $ scopeParents s0 where look m = fromMaybe __IMPOSSIBLE__ $ Map.lookup m $ scopeModules scope s0 = look $ scopeCurrent scope -- | Compute a flattened scope. Only include unqualified names or names -- qualified by modules in the first argument. flattenScope :: [[C.Name]] -> ScopeInfo -> Map C.QName [AbstractName] flattenScope ms scope = Map.unionWith (++) (build ms allNamesInScope root) imported where current = moduleScope $ scopeCurrent scope root = mergeScopes $ current : map moduleScope (scopeParents current) imported = Map.unionsWith (++) [ qual c (build ms' exportedNamesInScope $ moduleScope a) | (c, a) <- Map.toList $ scopeImports root , let -- get the suffixes of c in ms ms' = mapMaybe (maybePrefixMatch $ C.qnameParts c) ms , not $ null ms' ] qual c = Map.mapKeys (q c) where q (C.QName x) = C.Qual x q (C.Qual m x) = C.Qual m . q x build :: [[C.Name]] -> (forall a. InScope a => Scope -> ThingsInScope a) -> Scope -> Map C.QName [AbstractName] build ms getNames s = Map.unionsWith (++) $ (Map.mapKeysMonotonic C.QName $ getNames s) : [ Map.mapKeysMonotonic (\ y -> C.Qual x y) $ build ms' exportedNamesInScope $ moduleScope m | (x, mods) <- Map.toList (getNames s) , let ms' = [ tl | hd:tl <- ms, hd == x ] , not $ null ms' , AbsModule m _ <- mods ] moduleScope :: A.ModuleName -> Scope moduleScope m = fromMaybe __IMPOSSIBLE__ $ Map.lookup m $ scopeModules scope -- | Look up a name in the scope scopeLookup :: InScope a => C.QName -> ScopeInfo -> [a] scopeLookup q scope = map fst $ scopeLookup' q scope scopeLookup' :: forall a. InScope a => C.QName -> ScopeInfo -> [(a, Access)] scopeLookup' q scope = nubBy ((==) `on` fst) $ findName q root ++ maybeToList topImports ++ imports where -- 1. Finding a name in the current scope and its parents. moduleScope :: A.ModuleName -> Scope moduleScope m = fromMaybe __IMPOSSIBLE__ $ Map.lookup m $ scopeModules scope current :: Scope current = moduleScope $ scopeCurrent scope root :: Scope root = mergeScopes $ current : map moduleScope (scopeParents current) -- | Find a concrete, possibly qualified name in scope @s@. findName :: forall a. InScope a => C.QName -> Scope -> [(a, Access)] findName q0 s = case q0 of C.QName x -> lookupName x s C.Qual x q -> do let -- | Get the modules named @x@ in scope @s@. mods :: [A.ModuleName] mods = amodName . fst <$> lookupName x s -- | Get the definitions named @x@ in scope @s@ and interpret them as modules. -- Andreas, 2013-05-01: Issue 836 debates this feature: -- Qualified constructors are qualified by their datatype rather than a module defs :: [A.ModuleName] defs = mnameFromList . qnameToList . anameName . fst <$> lookupName x s -- Andreas, 2013-05-01: Issue 836 complains about the feature -- that constructors can also be qualified by their datatype -- and projections by their record type. This feature is off -- if we just consider the modules: -- m <- mods -- The feature is on if we consider also the data and record types: -- trace ("mods ++ defs = " ++ show (mods ++ defs)) $ do m <- nub $ mods ++ defs -- record types will appear both as a mod and a def -- Get the scope of module m, if any, and remove its private definitions. let ss = Map.lookup m $ scopeModules scope ss' = restrictPrivate <$> ss -- trace ("ss = " ++ show ss ) $ do -- trace ("ss' = " ++ show ss') $ do s' <- maybeToList ss' findName q s' where lookupName :: forall a. InScope a => C.Name -> Scope -> [(a, Access)] lookupName x s = fromMaybe [] $ Map.lookup x $ allNamesInScope' s -- 2. Finding a name in the top imports. topImports :: Maybe (a, Access) topImports = case (inScopeTag :: InScopeTag a) of NameTag -> Nothing ModuleTag -> first (`AbsModule` Defined) <$> imported q imported :: C.QName -> Maybe (A.ModuleName, Access) imported q = fmap (,PublicAccess) $ Map.lookup q $ scopeImports root -- 3. Finding a name in the imports belonging to an initial part of the qualifier. imports :: [(a, Access)] imports = do (m, x) <- splitName q m <- maybeToList $ fst <$> imported m findName x $ restrictPrivate $ moduleScope m -- return all possible splittings, e.g. -- splitName X.Y.Z = [(X, Y.Z), (X.Y, Z)] splitName :: C.QName -> [(C.QName, C.QName)] splitName (C.QName x) = [] splitName (C.Qual x q) = (C.QName x, q) : [ (C.Qual x m, r) | (m, r) <- splitName q ] -- * Inverse look-up data AllowAmbiguousConstructors = AllowAmbiguousConstructors | NoAmbiguousConstructors deriving (Eq) -- | Find the concrete names that map (uniquely) to a given abstract name. -- Sort by length, shortest first. inverseScopeLookup :: Either A.ModuleName A.QName -> ScopeInfo -> [C.QName] inverseScopeLookup = inverseScopeLookup' AllowAmbiguousConstructors inverseScopeLookup' :: AllowAmbiguousConstructors -> Either A.ModuleName A.QName -> ScopeInfo -> [C.QName] inverseScopeLookup' ambCon name scope = billToPure [ Scoping , InverseScopeLookup ] $ -- trace ("importMap = " ++ show importMap) $ -- trace ("moduleMap = " ++ show moduleMap) $ case name of Left m -> best $ filter unambiguousModule $ findModule m Right q -> best $ filter unambiguousName $ findName nameMap q where this = scopeCurrent scope current = this : scopeParents (moduleScope this) scopes = [ (m, restrict m s) | (m, s) <- Map.toList (scopeModules scope) ] moduleScope :: A.ModuleName -> Scope moduleScope m = fromMaybe __IMPOSSIBLE__ $ Map.lookup m $ scopeModules scope restrict m s | m `elem` current = s | otherwise = restrictPrivate s len :: C.QName -> Int len (C.QName _) = 1 len (C.Qual _ x) = 1 + len x best :: [C.QName] -> [C.QName] best = sortBy (compare `on` len) . filter (not . internalName) internalName :: C.QName -> Bool internalName C.QName{} = False internalName (C.Qual m n) = intern m || internalName n where -- Recognize fresh names created Parser.y intern (C.Name _ [ C.Id ('.' : '#' : _) ]) = True intern _ = False unique :: forall a . [a] -> Bool unique [] = __IMPOSSIBLE__ unique [_] = True unique (_:_:_) = False unambiguousModule q = unique (scopeLookup q scope :: [AbstractModule]) unambiguousName q = unique xs || AllowAmbiguousConstructors == ambCon && all ((ConName ==) . anameKind) xs where xs = scopeLookup q scope findName :: Ord a => Map a [(A.ModuleName, C.Name)] -> a -> [C.QName] findName table q = do (m, x) <- fromMaybe [] $ Map.lookup q table if m `elem` current then return (C.QName x) else do y <- findModule m return $ C.qualify y x findModule :: A.ModuleName -> [C.QName] findModule q = findName moduleMap q ++ fromMaybe [] (Map.lookup q importMap) importMap = Map.fromListWith (++) $ do (m, s) <- scopes (x, y) <- Map.toList $ scopeImports s return (y, [x]) moduleMap = Map.fromListWith (++) $ do (m, s) <- scopes (x, ms) <- Map.toList (allNamesInScope s) q <- amodName <$> ms return (q, [(m, x)]) nameMap = Map.fromListWith (++) $ do (m, s) <- scopes (x, ms) <- Map.toList (allNamesInScope s) q <- anameName <$> ms return (q, [(m, x)]) -- | Find the concrete names that map (uniquely) to a given abstract qualified name. -- Sort by length, shortest first. inverseScopeLookupName :: A.QName -> ScopeInfo -> [C.QName] inverseScopeLookupName x = inverseScopeLookup (Right x) inverseScopeLookupName' :: AllowAmbiguousConstructors -> A.QName -> ScopeInfo -> [C.QName] inverseScopeLookupName' ambCon x = inverseScopeLookup' ambCon (Right x) -- | Find the concrete names that map (uniquely) to a given abstract module name. -- Sort by length, shortest first. inverseScopeLookupModule :: A.ModuleName -> ScopeInfo -> [C.QName] inverseScopeLookupModule x = inverseScopeLookup (Left x) ------------------------------------------------------------------------ -- * (Debug) printing ------------------------------------------------------------------------ instance Show AbstractName where show = show . anameName instance Show AbstractModule where show = show . amodName instance Show NameSpaceId where show nsid = case nsid of PublicNS -> "public" PrivateNS -> "private" ImportedNS -> "imported" OnlyQualifiedNS -> "only-qualified" instance Show NameSpace where show (NameSpace names mods) = unlines $ blockOfLines "names" (map pr $ Map.toList names) ++ blockOfLines "modules" (map pr $ Map.toList mods) where pr :: (Show a, Show b) => (a,b) -> String pr (x, y) = show x ++ " --> " ++ show y instance Show Scope where show (scope@Scope{ scopeName = name, scopeParents = parents, scopeImports = imps }) = unlines $ [ "scope " ++ show name ] ++ ind ( concat [ blockOfLines (show nsid) (lines $ show $ scopeNameSpace nsid scope) | nsid <- [minBound..maxBound] ] ++ blockOfLines "imports" (case Map.keys imps of [] -> [] ks -> [ show ks ] ) ) where ind = map (" " ++) -- | Add first string only if list is non-empty. blockOfLines :: String -> [String] -> [String] blockOfLines _ [] = [] blockOfLines hd ss = hd : map (" " ++) ss instance Show ScopeInfo where show (ScopeInfo this mods locals ctx) = unlines $ [ "ScopeInfo" , " current = " ++ show this ] ++ (if null locals then [] else [ " locals = " ++ show locals ]) ++ [ " context = " ++ show ctx , " modules" ] ++ map (" "++) (relines . map show $ Map.elems mods) where relines = filter (not . null) . lines . unlines ------------------------------------------------------------------------ -- * Boring instances ------------------------------------------------------------------------ instance KillRange ScopeInfo where killRange m = m instance HasRange AbstractName where getRange = getRange . anameName instance SetRange AbstractName where setRange r x = x { anameName = setRange r $ anameName x } Agda-2.4.2.5/src/full/Agda/Syntax/Scope/Monad.hs0000644000000000000000000005032512635075266017243 0ustar0000000000000000{-# LANGUAGE CPP #-} {-# LANGUAGE NondecreasingIndentation #-} #if __GLASGOW_HASKELL__ >= 710 {-# LANGUAGE FlexibleContexts #-} #endif {-| The scope monad with operations. -} module Agda.Syntax.Scope.Monad where import Prelude hiding (mapM) import Control.Arrow ((***), first, second) import Control.Applicative import Control.Monad hiding (mapM) import Control.Monad.Writer hiding (mapM) import Control.Monad.State hiding (mapM) import Data.List as List import Data.Map (Map) import qualified Data.Map as Map import Data.Maybe import Data.Set (Set) import qualified Data.Set as Set import Data.Traversable import Agda.Syntax.Common import Agda.Syntax.Position import Agda.Syntax.Fixity import Agda.Syntax.Abstract.Name as A import qualified Agda.Syntax.Abstract as A import Agda.Syntax.Concrete as C import Agda.Syntax.Scope.Base import Agda.TypeChecking.Monad.Base import Agda.TypeChecking.Monad.State import Agda.TypeChecking.Monad.Options import qualified Agda.Utils.AssocList as AssocList import Agda.Utils.Function import Agda.Utils.List import Agda.Utils.Maybe import Agda.Utils.Null (unlessNull) import Agda.Utils.Size import Agda.Utils.Pretty import Agda.Utils.Tuple #include "undefined.h" import Agda.Utils.Impossible -- * The scope checking monad -- | To simplify interaction between scope checking and type checking (in -- particular when chasing imports), we use the same monad. type ScopeM = TCM -- * Errors isDatatypeModule :: A.ModuleName -> ScopeM Bool isDatatypeModule m = do sc <- getScope return $ maybe __IMPOSSIBLE__ scopeDatatypeModule (Map.lookup m (scopeModules sc)) -- * General operations getCurrentModule :: ScopeM A.ModuleName getCurrentModule = setRange noRange . scopeCurrent <$> getScope setCurrentModule :: A.ModuleName -> ScopeM () setCurrentModule m = modifyScopeInfo $ \s -> s { scopeCurrent = m } withCurrentModule :: A.ModuleName -> ScopeM a -> ScopeM a withCurrentModule new action = do old <- getCurrentModule setCurrentModule new x <- action setCurrentModule old return x withCurrentModule' :: (MonadTrans t, Monad (t ScopeM)) => A.ModuleName -> t ScopeM a -> t ScopeM a withCurrentModule' new action = do old <- lift getCurrentModule lift $ setCurrentModule new x <- action lift $ setCurrentModule old return x getNamedScope :: A.ModuleName -> ScopeM Scope getNamedScope m = do scope <- getScope case Map.lookup m (scopeModules scope) of Just s -> return s Nothing -> do reportSLn "" 0 $ "ERROR: In scope\n" ++ show scope ++ "\nNO SUCH SCOPE " ++ show m __IMPOSSIBLE__ getCurrentScope :: ScopeM Scope getCurrentScope = getNamedScope =<< getCurrentModule -- | Create a new module with an empty scope (Bool is True if it is a datatype module) createModule :: Bool -> A.ModuleName -> ScopeM () createModule b m = do reportSLn "scope.createModule" 10 $ "createModule " ++ prettyShow m s <- getCurrentScope let parents = scopeName s : scopeParents s sm = emptyScope { scopeName = m , scopeParents = parents , scopeDatatypeModule = b } -- Andreas, 2015-07-02: internall error if module is not new. modifyScopes $ Map.insertWith __IMPOSSIBLE__ m sm -- | Apply a function to the scope info. modifyScopeInfo :: (ScopeInfo -> ScopeInfo) -> ScopeM () modifyScopeInfo = modifyScope -- | Apply a function to the scope map. modifyScopes :: (Map A.ModuleName Scope -> Map A.ModuleName Scope) -> ScopeM () modifyScopes f = modifyScopeInfo $ \s -> s { scopeModules = f $ scopeModules s } -- | Apply a function to the given scope. modifyNamedScope :: A.ModuleName -> (Scope -> Scope) -> ScopeM () modifyNamedScope m f = modifyScopes $ Map.adjust f m setNamedScope :: A.ModuleName -> Scope -> ScopeM () setNamedScope m s = modifyNamedScope m $ const s -- | Apply a monadic function to the top scope. modifyNamedScopeM :: A.ModuleName -> (Scope -> ScopeM Scope) -> ScopeM () modifyNamedScopeM m f = setNamedScope m =<< f =<< getNamedScope m -- | Apply a function to the current scope. modifyCurrentScope :: (Scope -> Scope) -> ScopeM () modifyCurrentScope f = getCurrentModule >>= (`modifyNamedScope` f) modifyCurrentScopeM :: (Scope -> ScopeM Scope) -> ScopeM () modifyCurrentScopeM f = getCurrentModule >>= (`modifyNamedScopeM` f) -- | Apply a function to the public or private name space. modifyCurrentNameSpace :: NameSpaceId -> (NameSpace -> NameSpace) -> ScopeM () modifyCurrentNameSpace acc f = modifyCurrentScope $ updateScopeNameSpaces $ AssocList.updateAt acc f setContextPrecedence :: Precedence -> ScopeM () setContextPrecedence p = modifyScopeInfo $ \s -> s { scopePrecedence = p } getContextPrecedence :: ScopeM Precedence getContextPrecedence = scopePrecedence <$> getScope withContextPrecedence :: Precedence -> ScopeM a -> ScopeM a withContextPrecedence p m = do p' <- getContextPrecedence setContextPrecedence p x <- m setContextPrecedence p' return x getLocalVars :: ScopeM LocalVars getLocalVars = scopeLocals <$> getScope modifyLocalVars :: (LocalVars -> LocalVars) -> ScopeM () modifyLocalVars = modifyScope . updateScopeLocals setLocalVars :: LocalVars -> ScopeM () setLocalVars vars = modifyLocalVars $ const vars -- | Run a computation without changing the local variables. withLocalVars :: ScopeM a -> ScopeM a withLocalVars m = do vars <- getLocalVars x <- m setLocalVars vars return x -- * Names -- | Create a fresh abstract name from a concrete name. -- -- This function is used when we translate a concrete name -- in a binder. The 'Range' of the concrete name is -- saved as the 'nameBindingSite' of the abstract name. freshAbstractName :: Fixity' -> C.Name -> ScopeM A.Name freshAbstractName fx x = do i <- fresh return $ A.Name { nameId = i , nameConcrete = x , nameBindingSite = getRange x , nameFixity = fx } -- | @freshAbstractName_ = freshAbstractName defaultFixity@ freshAbstractName_ :: C.Name -> ScopeM A.Name freshAbstractName_ = freshAbstractName defaultFixity' -- | Create a fresh abstract qualified name. freshAbstractQName :: Fixity' -> C.Name -> ScopeM A.QName freshAbstractQName fx x = do y <- freshAbstractName fx x m <- getCurrentModule return $ A.qualify m y -- * Resolving names data ResolvedName = VarName A.Name | DefinedName Access AbstractName | FieldName AbstractName -- ^ record fields names need to be distinguished to parse copatterns | ConstructorName [AbstractName] | PatternSynResName AbstractName | UnknownName deriving (Show, Eq) -- | Look up the abstract name referred to by a given concrete name. resolveName :: C.QName -> ScopeM ResolvedName resolveName = resolveName' allKindsOfNames Nothing -- | Look up the abstract name corresponding to a concrete name of -- a certain kind and/or from a given set of names. -- Sometimes we know already that we are dealing with a constructor -- or pattern synonym (e.g. when we have parsed a pattern). -- Then, we can ignore conflicting definitions of that name -- of a different kind. (See issue 822.) resolveName' :: [KindOfName] -> Maybe (Set A.Name) -> C.QName -> ScopeM ResolvedName resolveName' kinds names x = do scope <- getScope let vars = AssocList.mapKeysMonotonic C.QName $ scopeLocals scope retVar y = return $ VarName $ y { nameConcrete = unqualify x } aName = A.qnameName . anameName case lookup x vars of -- Case: we have a local variable x. Just (LocalVar y) -> retVar y -- Case: ... but is (perhaps) shadowed by some imports. Just (ShadowedVar y ys) -> case names of Nothing -> shadowed ys Just ns -> case filter (\y -> aName y `Set.member` ns) ys of [] -> retVar y ys -> shadowed ys where shadowed ys = typeError $ AmbiguousName x $ A.qualify_ y : map anameName ys -- Case: we do not have a local variable x. Nothing -> do -- Consider only names of one of the given kinds let filtKind = filter $ \ y -> anameKind (fst y) `elem` kinds -- Consider only names in the given set of names filtName = filter $ \ y -> maybe True (Set.member (aName (fst y))) names case filtKind $ filtName $ scopeLookup' x scope of [] -> return UnknownName ds | all ((==ConName) . anameKind . fst) ds -> return $ ConstructorName $ map (upd . fst) ds [(d, a)] | anameKind d == FldName -> return $ FieldName $ upd d [(d, a)] | anameKind d == PatternSynName -> return $ PatternSynResName $ upd d [(d, a)] -> return $ DefinedName a $ upd d ds -> typeError $ AmbiguousName x (map (anameName . fst) ds) where upd d = updateConcreteName d $ unqualify x updateConcreteName :: AbstractName -> C.Name -> AbstractName updateConcreteName d@(AbsName { anameName = A.QName qm qn }) x = d { anameName = A.QName (setRange (getRange x) qm) (qn { nameConcrete = x }) } -- | Look up a module in the scope. resolveModule :: C.QName -> ScopeM AbstractModule resolveModule x = do ms <- scopeLookup x <$> getScope case ms of [AbsModule m why] -> return $ AbsModule (m `withRangesOfQ` x) why [] -> typeError $ NoSuchModule x ms -> typeError $ AmbiguousModule x (map amodName ms) -- | Get the notation of a name. The name is assumed to be in scope. getNotation :: C.QName -> Set A.Name -- ^ The name must correspond to one of the names in this set. -> ScopeM NewNotation getNotation x ns = do r <- resolveName' allKindsOfNames (Just ns) x case r of VarName y -> return $ namesToNotation x y DefinedName _ d -> return $ notation d FieldName d -> return $ notation d ConstructorName ds -> case mergeNotations $ map notation ds of [n] -> return n _ -> __IMPOSSIBLE__ PatternSynResName n -> return $ notation n UnknownName -> __IMPOSSIBLE__ where notation = namesToNotation x . qnameName . anameName -- * Binding names -- | Bind a variable. The abstract name is supplied as the second argument. bindVariable :: C.Name -> A.Name -> ScopeM () bindVariable x y = modifyScope $ updateScopeLocals $ AssocList.insert x $ LocalVar y -- | Bind a defined name. Must not shadow anything. bindName :: Access -> KindOfName -> C.Name -> A.QName -> ScopeM () bindName acc kind x y = do r <- resolveName (C.QName x) ys <- case r of FieldName d -> typeError $ ClashingDefinition (C.QName x) $ anameName d DefinedName _ d -> typeError $ ClashingDefinition (C.QName x) $ anameName d VarName z -> typeError $ ClashingDefinition (C.QName x) $ A.qualify (mnameFromList []) z ConstructorName [] -> __IMPOSSIBLE__ ConstructorName ds | kind == ConName && all ((==ConName) . anameKind) ds -> return [ AbsName y kind Defined ] | otherwise -> typeError $ ClashingDefinition (C.QName x) $ anameName (headWithDefault __IMPOSSIBLE__ ds) PatternSynResName n -> typeError $ ClashingDefinition (C.QName x) $ anameName n UnknownName -> return [AbsName y kind Defined] modifyCurrentScope $ addNamesToScope (localNameSpace acc) x ys -- | Rebind a name. Use with care! -- Ulf, 2014-06-29: Currently used to rebind the name defined by an -- unquoteDecl, which is a 'QuotableName' in the body, but a 'DefinedName' -- later on. rebindName :: Access -> KindOfName -> C.Name -> A.QName -> ScopeM () rebindName acc kind x y = do modifyCurrentScope $ removeNameFromScope (localNameSpace acc) x bindName acc kind x y -- | Bind a module name. bindModule :: Access -> C.Name -> A.ModuleName -> ScopeM () bindModule acc x m = modifyCurrentScope $ addModuleToScope (localNameSpace acc) x (AbsModule m Defined) -- | Bind a qualified module name. Adds it to the imports field of the scope. bindQModule :: Access -> C.QName -> A.ModuleName -> ScopeM () bindQModule acc q m = modifyCurrentScope $ \s -> s { scopeImports = Map.insert q m (scopeImports s) } -- * Module manipulation operations -- | Clear the scope of any no names. stripNoNames :: ScopeM () stripNoNames = modifyScopes $ Map.map $ mapScope_ stripN stripN where stripN = Map.filterWithKey $ const . not . isNoName type Out = (A.Ren A.ModuleName, A.Ren A.QName) type WSM = StateT Out ScopeM -- | Create a new scope with the given name from an old scope. Renames -- public names in the old scope to match the new name and returns the -- renamings. -- -- Data and record types share a common abstract name with their module. -- This invariant needs to be preserved by @copyScope@, since constructors -- (fields) can be qualified by their data (record) type name (as an -- alternative to qualification by their module). -- (See Issue 836). copyScope :: C.QName -> A.ModuleName -> Scope -> ScopeM (Scope, (A.Ren A.ModuleName, A.Ren A.QName)) copyScope oldc new s = first (inScopeBecause $ Applied oldc) <$> runStateT (copy new s) ([], []) where -- | A memoizing algorithm, the renamings serving as memo structure. copy :: A.ModuleName -> Scope -> StateT (A.Ren A.ModuleName, A.Ren A.QName) ScopeM Scope copy new s = do lift $ reportSLn "scope.copy" 20 $ "Copying scope " ++ show old ++ " to " ++ show new lift $ reportSLn "scope.copy" 50 $ show s s0 <- lift $ getNamedScope new -- Delete private names, then copy names and modules. s' <- mapScopeM_ copyD copyM $ setNameSpace PrivateNS emptyNameSpace s -- Fix name and parent. return $ s' { scopeName = scopeName s0 , scopeParents = scopeParents s0 } where rnew = getRange new new' = killRange new newL = A.mnameToList new' old = scopeName s copyD :: NamesInScope -> WSM NamesInScope copyD = traverse $ mapM $ onName renName copyM :: ModulesInScope -> WSM ModulesInScope copyM = traverse $ mapM $ lensAmodName renMod onName :: (A.QName -> WSM A.QName) -> AbstractName -> WSM AbstractName onName f d = case anameKind d of PatternSynName -> return d -- Pattern synonyms are simply aliased, not renamed _ -> lensAnameName f d -- Adding to memo structure. addName x y = modify $ second $ ((x, y):) addMod x y = modify $ first $ ((x, y):) -- Querying the memo structure. findName x = lookup x <$> gets snd findMod x = lookup x <$> gets fst -- Change a binding M.x -> old.M'.y to M.x -> new.M'.y renName :: A.QName -> WSM A.QName renName x = do -- Check whether we have already seen a module of the same name. -- If yes, use its copy as @y@. y <- ifJustM (findMod $ qnameToMName x) (return . mnameToQName) $ {- else -} do -- First time, generate a fresh name for it. i <- lift fresh return $ A.qualify new' $ (qnameName x) { nameId = i } lift $ reportSLn "scope.copy" 50 $ " Copying " ++ show x ++ " to " ++ show y -- Andreas, 2015-08-11 Issue 1619: -- Names copied by a module macro should get the module macro's -- range as declaration range -- (maybe rather the one of the open statement). -- For now, we just set their range -- to the new module name's one, which fixes issue 1619. y <- return $ setRange rnew y addName x y return y -- Change a binding M.x -> old.M'.y to M.x -> new.M'.y renMod :: A.ModuleName -> WSM A.ModuleName renMod x = do -- Andreas, issue 1607: -- If we have already copied this module, return the copy. ifJustM (findMod x) return $ {- else -} do -- Check whether we have seen it already, yet as name. -- If yes, use its copy as @y@. y <- ifJustM (findName $ mnameToQName x) (return . qnameToMName) $ {- else -} do -- Andreas, Jesper, 2015-07-02: Issue 1597 -- Don't blindly drop a prefix of length of the old qualifier. -- If things are imported by open public they do not have the old qualifier -- as prefix. Those need just to be linked, not copied. -- return $ A.mnameFromList $ (newL ++) $ drop (size old) $ A.mnameToList x caseMaybe (maybePrefixMatch (A.mnameToList old) (A.mnameToList x)) (return x) $ \ suffix -> do return $ A.mnameFromList $ newL ++ suffix -- Andreas, Jesper, 2015-07-02: Issue 1597 -- Don't copy a module over itself, it will just be emptied of its contents. if (x == y) then return x else do addMod x y -- We need to copy the contents of included modules recursively lift $ createModule False y s0 <- lift $ getNamedScope x s <- withCurrentModule' y $ copy y s0 lift $ modifyNamedScope y (const s) return y -- | Apply an import directive and check that all the names mentioned actually -- exist. applyImportDirectiveM :: C.QName -> ImportDirective -> Scope -> ScopeM Scope applyImportDirectiveM m dir scope = do let xs = filter doesntExist names reportSLn "scope.import.apply" 20 $ "non existing names: " ++ show xs unless (null xs) $ typeError $ ModuleDoesntExport m xs let dup = targetNames \\ nub targetNames unless (null dup) $ typeError $ DuplicateImports m dup return $ applyImportDirective dir scope where names :: [ImportedName] names = map renFrom (renaming dir) ++ case usingOrHiding dir of Using xs -> xs Hiding xs -> xs targetNames :: [ImportedName] targetNames = map renName (renaming dir) ++ case usingOrHiding dir of Using xs -> xs Hiding{} -> [] where renName r = (renFrom r) { importedName = renTo r } doesntExist (ImportedName x) = isNothing $ Map.lookup x (allNamesInScope scope :: ThingsInScope AbstractName) doesntExist (ImportedModule x) = isNothing $ Map.lookup x (allNamesInScope scope :: ThingsInScope AbstractModule) -- | Open a module. openModule_ :: C.QName -> ImportDirective -> ScopeM () openModule_ cm dir = do current <- getCurrentModule m <- amodName <$> resolveModule cm let acc | not (publicOpen dir) = PrivateNS | m `isSubModuleOf` current = PublicNS | otherwise = ImportedNS -- Get the scope exported by module to be opened. s <- setScopeAccess acc <$> (applyImportDirectiveM cm dir . inScopeBecause (Opened cm) . removeOnlyQualified . restrictPrivate =<< getNamedScope m) let ns = scopeNameSpace acc s checkForClashes ns modifyCurrentScope (`mergeScope` s) verboseS "scope.locals" 10 $ do locals <- mapMaybe (\ (c,x) -> c <$ notShadowedLocal x) <$> getLocalVars let newdefs = Map.keys $ nsNames ns shadowed = List.intersect locals newdefs reportSLn "scope.locals" 10 $ "opening module shadows the following locals vars: " ++ show shadowed -- Andreas, 2014-09-03, issue 1266: shadow local variables by imported defs. modifyLocalVars $ AssocList.mapWithKey $ \ c x -> case Map.lookup c $ nsNames ns of Nothing -> x Just ys -> shadowLocal ys x where -- Only checks for clashes that would lead to the same -- name being exported twice from the module. checkForClashes new = when (publicOpen dir) $ do old <- allThingsInScope . restrictPrivate <$> (getNamedScope =<< getCurrentModule) let defClashes = Map.toList $ Map.intersectionWith (,) (nsNames new) (nsNames old) modClashes = Map.toList $ Map.intersectionWith (,) (nsModules new) (nsModules old) -- No ambiguity if concrete identifier is mapped to -- single, identical abstract identifiers. realClash (_, ([x],[y])) = x /= y realClash _ = True -- No ambiguity if concrete identifier is only mapped to -- constructor names. defClash (_, (qs0, qs1)) = any ((/= ConName) . anameKind) (qs0 ++ qs1) -- We report the first clashing exported identifier. unlessNull (filter (\ x -> realClash x && defClash x) defClashes) $ \ ((x, (_, q:_)) : _) -> typeError $ ClashingDefinition (C.QName x) (anameName q) unlessNull (filter realClash modClashes) $ \ ((_, (m0:_, m1:_)) : _) -> typeError $ ClashingModule (amodName m0) (amodName m1) Agda-2.4.2.5/src/full/Agda/Syntax/Translation/0000755000000000000000000000000012635075266017071 5ustar0000000000000000Agda-2.4.2.5/src/full/Agda/Syntax/Translation/ConcreteToAbstract.hs0000644000000000000000000022311612635075266023163 0ustar0000000000000000{-# LANGUAGE CPP #-} {-# LANGUAGE DoAndIfThenElse #-} {-# LANGUAGE FlexibleInstances #-} {-# LANGUAGE FunctionalDependencies #-} {-# LANGUAGE MultiParamTypeClasses #-} {-# LANGUAGE PatternGuards #-} {-# LANGUAGE ScopedTypeVariables #-} {-# LANGUAGE TupleSections #-} {-# LANGUAGE UndecidableInstances #-} #if __GLASGOW_HASKELL__ <= 708 {-# LANGUAGE OverlappingInstances #-} #endif {-| Translation from "Agda.Syntax.Concrete" to "Agda.Syntax.Abstract". Involves scope analysis, figuring out infix operator precedences and tidying up definitions. -} module Agda.Syntax.Translation.ConcreteToAbstract ( ToAbstract(..), localToAbstract , concreteToAbstract_ , concreteToAbstract , NewModuleQName(..) , OldName(..) , TopLevel(..) , TopLevelInfo(..) , topLevelModuleName , AbstractRHS , NewModuleName, OldModuleName , NewName, OldQName , LeftHandSide, RightHandSide , PatName, APatName, LetDef, LetDefs ) where import Prelude hiding (mapM, null) import Control.Applicative import Control.Monad.Reader hiding (mapM) import Data.Foldable (Foldable, traverse_) import Data.Traversable (mapM, traverse) import Data.List ((\\), nub, foldl') import Data.Set (Set) import qualified Data.Set as Set import qualified Data.Map as Map import Data.Maybe import Agda.Syntax.Concrete as C hiding (topLevelModuleName) import Agda.Syntax.Concrete.Generic import Agda.Syntax.Concrete.Operators import Agda.Syntax.Abstract as A import Agda.Syntax.Abstract.Pretty import Agda.Syntax.Position import Agda.Syntax.Literal import Agda.Syntax.Common hiding (Arg, Dom, NamedArg, ArgInfo) import qualified Agda.Syntax.Common as Common import Agda.Syntax.Info import Agda.Syntax.Concrete.Definitions as C import Agda.Syntax.Fixity import Agda.Syntax.Notation import Agda.Syntax.Scope.Base import Agda.Syntax.Scope.Monad import Agda.Syntax.Translation.AbstractToConcrete (ToConcrete) import Agda.TypeChecking.Monad.Base ( TypeError(..) , Call(..) , typeError , genericError , TCErr(..) , fresh , freshName , freshName_ , freshNoName , extendedLambdaName , envAbstractMode , AbstractMode(..) ) import qualified Agda.TypeChecking.Monad.Benchmark as Bench import Agda.TypeChecking.Monad.Builtin import Agda.TypeChecking.Monad.Trace (traceCall, setCurrentRange) import Agda.TypeChecking.Monad.State import Agda.TypeChecking.Monad.MetaVars (registerInteractionPoint) import Agda.TypeChecking.Monad.Options import Agda.TypeChecking.Monad.Env (insideDotPattern, isInsideDotPattern) import Agda.TypeChecking.Pretty hiding (pretty, prettyA) import Agda.Interaction.FindFile (checkModuleName) -- import Agda.Interaction.Imports -- for type-checking in ghci import {-# SOURCE #-} Agda.Interaction.Imports (scopeCheckImport) import Agda.Interaction.Options import Agda.Utils.Except ( MonadError(catchError, throwError) ) import Agda.Utils.FileName import Agda.Utils.Functor import Agda.Utils.List import Agda.Utils.Maybe import Agda.Utils.Monad import Agda.Utils.Null import qualified Agda.Utils.Pretty as P import Agda.Utils.Pretty (render, Pretty, pretty, prettyShow) #include "undefined.h" import Agda.Utils.Impossible import Agda.ImpossibleTest (impossibleTest) {-------------------------------------------------------------------------- Exceptions --------------------------------------------------------------------------} -- notAModuleExpr e = typeError $ NotAModuleExpr e notAnExpression :: C.Expr -> ScopeM A.Expr notAnExpression e = typeError $ NotAnExpression e nothingAppliedToHiddenArg :: C.Expr -> ScopeM A.Expr nothingAppliedToHiddenArg e = typeError $ NothingAppliedToHiddenArg e nothingAppliedToInstanceArg :: C.Expr -> ScopeM A.Expr nothingAppliedToInstanceArg e = typeError $ NothingAppliedToInstanceArg e notAValidLetBinding :: NiceDeclaration -> ScopeM a notAValidLetBinding d = typeError $ NotAValidLetBinding d -- Debugging printLocals :: Int -> String -> ScopeM () printLocals v s = verboseS "scope.top" v $ do locals <- getLocalVars reportSLn "scope.top" v $ s ++ " " ++ show locals {-------------------------------------------------------------------------- Helpers --------------------------------------------------------------------------} annotateDecl :: ScopeM A.Declaration -> ScopeM A.Declaration annotateDecl m = annotateDecls $ (:[]) <$> m annotateDecls :: ScopeM [A.Declaration] -> ScopeM A.Declaration annotateDecls m = do ds <- m s <- getScope return $ ScopedDecl s ds annotateExpr :: ScopeM A.Expr -> ScopeM A.Expr annotateExpr m = do e <- m s <- getScope return $ ScopedExpr s e -- | Make sure that each variable occurs only once. checkPatternLinearity :: [A.Pattern' e] -> ScopeM () checkPatternLinearity ps = unlessNull (duplicates xs) $ \ ys -> do typeError $ RepeatedVariablesInPattern ys where xs = concatMap vars ps vars :: A.Pattern' e -> [C.Name] vars p = case p of A.VarP x -> [nameConcrete x] A.ConP _ _ args -> concatMap (vars . namedArg) args A.WildP _ -> [] A.AsP _ x p -> nameConcrete x : vars p A.DotP _ _ -> [] A.AbsurdP _ -> [] A.LitP _ -> [] A.DefP _ _ args -> concatMap (vars . namedArg) args -- Projection pattern, @args@ should be empty unless we have -- indexed records. A.PatternSynP _ _ args -> concatMap (vars . namedArg) args -- | Compute the type of the record constructor (with bogus target type) recordConstructorType :: [NiceDeclaration] -> C.Expr recordConstructorType fields = build fs where -- drop all declarations after the last field declaration fs = reverse $ dropWhile notField $ reverse fields notField NiceField{} = False notField _ = True -- Andreas, 2013-11-08 -- Turn @open public@ into just @open@, since we cannot have an -- @open public@ in a @let@. Fixes issue 532. build (NiceOpen r m dir@ImportDirective{ publicOpen = True } : fs) = build (NiceOpen r m dir{ publicOpen = False } : fs) build (NiceModuleMacro r p x modapp open dir@ImportDirective{ publicOpen = True } : fs) = build (NiceModuleMacro r p x modapp open dir{ publicOpen = False } : fs) build (NiceField r f _ _ x (Common.Arg info e) : fs) = C.Pi [C.TypedBindings r $ Common.Arg info (C.TBind r [pure $ mkBoundName x f] e)] $ build fs where r = getRange x build (d : fs) = C.Let (getRange d) [notSoNiceDeclaration d] $ build fs build [] = C.SetN noRange 0 -- todo: nicer -- | @checkModuleApplication modapp m0 x dir = return (modapp', renD, renM)@ -- -- @m0@ is the new (abstract) module name and -- @x@ its concrete form (used for error messages). checkModuleApplication :: C.ModuleApplication -> ModuleName -> C.Name -> ImportDirective -> ScopeM (A.ModuleApplication, Ren A.QName, Ren ModuleName) checkModuleApplication (C.SectionApp _ tel e) m0 x dir' = do reportSDoc "scope.decl" 70 $ vcat $ [ text $ "scope checking ModuleApplication " ++ prettyShow x ] -- For the following, set the current module to be m0. withCurrentModule m0 $ do -- Check that expression @e@ is of the form @m args@. (m, args) <- parseModuleApplication e -- Scope check the telescope (introduces bindings!). tel' <- toAbstract tel -- Scope check the old module name and the module args. (m1, args') <- toAbstract (OldModuleName m, args) -- Drop constructors (OnlyQualified) if there are arguments. The record constructor -- isn't properly in the record module, so copying it will lead to badness. let noRecConstr | null args = id | otherwise = removeOnlyQualified -- Copy the scope associated with m and take the parts actually imported. (s', (renM, renD)) <- copyScope m m0 . noRecConstr =<< getNamedScope m1 s' <- applyImportDirectiveM (C.QName x) dir' s' -- Set the current scope to @s'@ modifyCurrentScope $ const s' printScope "mod.inst" 20 "copied source module" reportSLn "scope.mod.inst" 30 $ "renamings:\n " ++ show renD ++ "\n " ++ show renM let amodapp = A.SectionApp tel' m1 args' reportSDoc "scope.decl" 70 $ vcat $ [ text $ "scope checked ModuleApplication " ++ prettyShow x ] reportSDoc "scope.decl" 70 $ vcat $ [ nest 2 $ prettyA amodapp ] return (amodapp, renD, renM) checkModuleApplication (C.RecordModuleIFS _ recN) m0 x dir' = withCurrentModule m0 $ do m1 <- toAbstract $ OldModuleName recN s <- getNamedScope m1 (s', (renM, renD)) <- copyScope recN m0 s s' <- applyImportDirectiveM recN dir' s' modifyCurrentScope $ const s' printScope "mod.inst" 20 "copied record module" return ((A.RecordModuleIFS m1), renD, renM) -- | @checkModuleMacro mkApply range access concreteName modapp open dir@ -- -- Preserves local variables. checkModuleMacro :: (Pretty c, ToConcrete a c) => (ModuleInfo -> ModuleName -> A.ModuleApplication -> Ren A.QName -> Ren ModuleName -> a) -> Range -> Access -> C.Name -> C.ModuleApplication -> OpenShortHand -> ImportDirective -> ScopeM [a] checkModuleMacro apply r p x modapp open dir = do reportSDoc "scope.decl" 70 $ vcat $ [ text $ "scope checking ModuleMacro " ++ prettyShow x ] notPublicWithoutOpen open dir m0 <- toAbstract (NewModuleName x) reportSDoc "scope.decl" 90 $ text "NewModuleName: m0 =" <+> prettyA m0 printScope "mod.inst" 20 "module macro" -- If we're opening, the import directive is applied to the open, -- otherwise to the module itself. let dir' = case open of DontOpen -> dir DoOpen -> defaultImportDir -- Restore the locals after module application has been checked. (modapp', renD, renM) <- withLocalVars $ checkModuleApplication modapp m0 x dir' printScope "mod.inst.app" 20 "checkModuleMacro, after checkModuleApplication" reportSDoc "scope.decl" 90 $ text "after mod app: trying to print m0 ..." reportSDoc "scope.decl" 90 $ text "after mod app: m0 =" <+> prettyA m0 bindModule p x m0 reportSDoc "scope.decl" 90 $ text "after bindMod: m0 =" <+> prettyA m0 printScope "mod.inst.copy.after" 20 "after copying" -- Andreas, 2014-09-02 openModule_ might shadow some locals! when (open == DoOpen) $ openModule_ (C.QName x) dir printScope "mod.inst" 20 $ show open reportSDoc "scope.decl" 90 $ text "after open : m0 =" <+> prettyA m0 stripNoNames printScope "mod.inst" 10 $ "after stripping" reportSDoc "scope.decl" 90 $ text "after stripNo: m0 =" <+> prettyA m0 let m = m0 `withRangesOf` [x] adecls = [ apply info m modapp' renD renM ] reportSDoc "scope.decl" 70 $ vcat $ [ text $ "scope checked ModuleMacro " ++ prettyShow x ] reportSLn "scope.decl" 90 $ "info = " ++ show info reportSLn "scope.decl" 90 $ "m = " ++ show m reportSLn "scope.decl" 90 $ "modapp' = " ++ show modapp' reportSLn "scope.decl" 90 $ "renD = " ++ show renD reportSLn "scope.decl" 90 $ "renM = " ++ show renM reportSDoc "scope.decl" 70 $ vcat $ map (nest 2 . prettyA) adecls return adecls where info = ModuleInfo { minfoRange = r , minfoAsName = Nothing , minfoAsTo = renamingRange dir , minfoOpenShort = Just open , minfoDirective = Just dir } -- | The @public@ keyword must only be used together with @open@. notPublicWithoutOpen :: OpenShortHand -> ImportDirective -> ScopeM () notPublicWithoutOpen DoOpen dir = return () notPublicWithoutOpen DontOpen dir = when (publicOpen dir) $ typeError $ GenericError "The public keyword must only be used together with the open keyword" -- | Computes the range of all the \"to\" keywords used in a renaming -- directive. renamingRange :: ImportDirective -> Range renamingRange = getRange . map renToRange . renaming {-------------------------------------------------------------------------- Translation --------------------------------------------------------------------------} concreteToAbstract_ :: ToAbstract c a => c -> ScopeM a concreteToAbstract_ x = toAbstract x concreteToAbstract :: ToAbstract c a => ScopeInfo -> c -> ScopeM a concreteToAbstract scope x = withScope_ scope (toAbstract x) -- | Things that can be translated to abstract syntax are instances of this -- class. class ToAbstract concrete abstract | concrete -> abstract where toAbstract :: concrete -> ScopeM abstract -- | This function should be used instead of 'toAbstract' for things that need -- to keep track of precedences to make sure that we don't forget about it. toAbstractCtx :: ToAbstract concrete abstract => Precedence -> concrete -> ScopeM abstract toAbstractCtx ctx c = withContextPrecedence ctx $ toAbstract c toAbstractTopCtx :: ToAbstract c a => c -> ScopeM a toAbstractTopCtx = toAbstractCtx TopCtx toAbstractHiding :: (LensHiding h, ToAbstract c a) => h -> c -> ScopeM a toAbstractHiding h = toAbstractCtx $ hiddenArgumentCtx $ getHiding h setContextCPS :: Precedence -> (a -> ScopeM b) -> ((a -> ScopeM b) -> ScopeM b) -> ScopeM b setContextCPS p ret f = do p' <- getContextPrecedence withContextPrecedence p $ f $ withContextPrecedence p' . ret localToAbstractCtx :: ToAbstract concrete abstract => Precedence -> concrete -> (abstract -> ScopeM a) -> ScopeM a localToAbstractCtx ctx c ret = setContextCPS ctx ret (localToAbstract c) -- | This operation does not affect the scope, i.e. the original scope -- is restored upon completion. localToAbstract :: ToAbstract c a => c -> (a -> ScopeM b) -> ScopeM b localToAbstract x ret = fst <$> localToAbstract' x ret -- | Like 'localToAbstract' but returns the scope after the completion of the -- second argument. localToAbstract' :: ToAbstract c a => c -> (a -> ScopeM b) -> ScopeM (b, ScopeInfo) localToAbstract' x ret = do scope <- getScope withScope scope $ ret =<< toAbstract x instance (ToAbstract c1 a1, ToAbstract c2 a2) => ToAbstract (c1,c2) (a1,a2) where toAbstract (x,y) = (,) <$> toAbstract x <*> toAbstract y instance (ToAbstract c1 a1, ToAbstract c2 a2, ToAbstract c3 a3) => ToAbstract (c1,c2,c3) (a1,a2,a3) where toAbstract (x,y,z) = flatten <$> toAbstract (x,(y,z)) where flatten (x,(y,z)) = (x,y,z) #if __GLASGOW_HASKELL__ >= 710 instance {-# OVERLAPPABLE #-} ToAbstract c a => ToAbstract [c] [a] where #else instance ToAbstract c a => ToAbstract [c] [a] where #endif toAbstract = mapM toAbstract instance ToAbstract c a => ToAbstract (Maybe c) (Maybe a) where toAbstract = traverse toAbstract -- Names ------------------------------------------------------------------ newtype NewName a = NewName a data OldQName = OldQName C.QName (Maybe (Set A.Name)) -- ^ If a set is given, then the first name must correspond to one -- of the names in the set. newtype OldName = OldName C.Name data PatName = PatName C.QName (Maybe (Set A.Name)) -- ^ If a set is given, then the first name must correspond to one -- of the names in the set. instance ToAbstract (NewName C.Name) A.Name where toAbstract (NewName x) = do y <- freshAbstractName_ x bindVariable x y return y instance ToAbstract (NewName C.BoundName) A.Name where toAbstract (NewName BName{ boundName = x, bnameFixity = fx }) = do y <- freshAbstractName fx x bindVariable x y return y nameExpr :: AbstractName -> A.Expr nameExpr d = mk (anameKind d) $ anameName d where mk DefName x = A.Def x mk FldName x = A.Proj x mk ConName x = A.Con $ AmbQ [x] mk PatternSynName x = A.PatternSyn x mk QuotableName x = A.App i (A.Quote i) (defaultNamedArg $ A.Def x) where i = ExprRange (getRange x) instance ToAbstract OldQName A.Expr where toAbstract (OldQName x ns) = do qx <- resolveName' allKindsOfNames ns x reportSLn "scope.name" 10 $ "resolved " ++ show x ++ ": " ++ show qx case qx of VarName x' -> return $ A.Var x' DefinedName _ d -> return $ nameExpr d FieldName d -> return $ nameExpr d ConstructorName ds -> return $ A.Con $ AmbQ (map anameName ds) UnknownName -> notInScope x PatternSynResName d -> return $ nameExpr d data APatName = VarPatName A.Name | ConPatName [AbstractName] | PatternSynPatName AbstractName instance ToAbstract PatName APatName where toAbstract (PatName x ns) = do reportSLn "scope.pat" 10 $ "checking pattern name: " ++ show x rx <- resolveName' [ConName, PatternSynName] ns x -- Andreas, 2013-03-21 ignore conflicting names which cannot -- be meant since we are in a pattern z <- case (rx, x) of -- TODO: warn about shadowing (VarName y, C.QName x) -> return $ Left x -- typeError $ RepeatedVariableInPattern y x (FieldName d, C.QName x) -> return $ Left x (DefinedName _ d, C.QName x) | DefName == anameKind d -> return $ Left x (UnknownName, C.QName x) -> return $ Left x (ConstructorName ds, _) -> return $ Right (Left ds) (PatternSynResName d, _) -> return $ Right (Right d) _ -> genericError $ "Cannot pattern match on non-constructor " ++ prettyShow x case z of Left x -> do reportSLn "scope.pat" 10 $ "it was a var: " ++ show x p <- VarPatName <$> toAbstract (NewName x) printLocals 10 "bound it:" return p Right (Left ds) -> do reportSLn "scope.pat" 10 $ "it was a con: " ++ show (map anameName ds) return $ ConPatName ds Right (Right d) -> do reportSLn "scope.pat" 10 $ "it was a pat syn: " ++ show (anameName d) return $ PatternSynPatName d -- Should be a defined name. instance ToAbstract OldName A.QName where toAbstract (OldName x) = do rx <- resolveName (C.QName x) case rx of DefinedName _ d -> return $ anameName d _ -> __IMPOSSIBLE__ -- error $ show x ++ " - " ++ show rx newtype NewModuleName = NewModuleName C.Name newtype NewModuleQName = NewModuleQName C.QName newtype OldModuleName = OldModuleName C.QName freshQModule :: A.ModuleName -> C.Name -> ScopeM A.ModuleName freshQModule m x = A.qualifyM m . mnameFromList . (:[]) <$> freshAbstractName_ x checkForModuleClash :: C.Name -> ScopeM () checkForModuleClash x = do ms <- scopeLookup (C.QName x) <$> getScope unless (null ms) $ do reportSLn "scope.clash" 20 $ "clashing modules ms = " ++ show ms setCurrentRange x $ typeError $ ShadowedModule x $ map ((`withRangeOf` x) . amodName) ms instance ToAbstract NewModuleName A.ModuleName where toAbstract (NewModuleName x) = do checkForModuleClash x m <- getCurrentModule y <- freshQModule m x createModule False y return y instance ToAbstract NewModuleQName A.ModuleName where toAbstract (NewModuleQName m) = toAbs noModuleName m where toAbs m (C.QName x) = do y <- freshQModule m x createModule False y return y toAbs m (C.Qual x q) = do m' <- freshQModule m x toAbs m' q instance ToAbstract OldModuleName A.ModuleName where toAbstract (OldModuleName q) = setCurrentRange q $ do amodName <$> resolveModule q -- Expressions ------------------------------------------------------------ -- | Peel off 'C.HiddenArg' and represent it as an 'NamedArg'. mkNamedArg :: C.Expr -> C.NamedArg C.Expr mkNamedArg (C.HiddenArg _ e) = Common.Arg (setHiding Hidden defaultArgInfo) e mkNamedArg (C.InstanceArg _ e) = Common.Arg (setHiding Instance defaultArgInfo) e mkNamedArg e = Common.Arg defaultArgInfo $ unnamed e -- | Peel off 'C.HiddenArg' and represent it as an 'Arg', throwing away any name. mkArg' :: C.ArgInfo -> C.Expr -> C.Arg C.Expr mkArg' info (C.HiddenArg _ e) = Common.Arg (setHiding Hidden info) $ namedThing e mkArg' info (C.InstanceArg _ e) = Common.Arg (setHiding Instance info) $ namedThing e mkArg' info e = Common.Arg (setHiding NotHidden info) e -- | By default, arguments are @Relevant@. mkArg :: C.Expr -> C.Arg C.Expr mkArg e = mkArg' defaultArgInfo e -- | Parse a possibly dotted C.Expr as A.Expr. Bool = True if dotted. toAbstractDot :: Precedence -> C.Expr -> ScopeM (A.Expr, Bool) toAbstractDot prec e = do reportSLn "scope.irrelevance" 100 $ "toAbstractDot: " ++ (render $ pretty e) traceCall (ScopeCheckExpr e) $ case e of C.Dot _ e -> do e <- toAbstractCtx prec e return (e, True) C.RawApp r es -> do e <- parseApplication es toAbstractDot prec e C.Paren _ e -> toAbstractDot TopCtx e e -> do e <- toAbstractCtx prec e return (e, False) -- | An argument @OpApp C.Expr@ to an operator can have binders, -- in case the operator is some @syntax@-notation. -- For these binders, we have to create lambda-abstractions. toAbstractOpArg :: Precedence -> OpApp C.Expr -> ScopeM A.Expr toAbstractOpArg ctx (Ordinary e) = toAbstractCtx ctx e toAbstractOpArg ctx (SyntaxBindingLambda r bs e) = toAbstractLam r bs e ctx -- | Translate concrete expression under at least one binder into nested -- lambda abstraction in abstract syntax. toAbstractLam :: Range -> [C.LamBinding] -> C.Expr -> Precedence -> ScopeM A.Expr toAbstractLam r bs e ctx = do -- Translate the binders localToAbstract (map (C.DomainFull . makeDomainFull) bs) $ \ bs -> do -- Translate the body e <- toAbstractCtx ctx e -- We have at least one binder. Get first @b@ and rest @bs@. caseList bs __IMPOSSIBLE__ $ \ b bs -> do return $ A.Lam (ExprRange r) b $ foldr mkLam e bs where mkLam b e = A.Lam (ExprRange $ fuseRange b e) b e -- | Scope check extended lambda expression. scopeCheckExtendedLam :: Range -> [(C.LHS, C.RHS, WhereClause)] -> ScopeM A.Expr scopeCheckExtendedLam r cs = do whenM isInsideDotPattern $ genericError "Extended lambdas are not allowed in dot patterns" -- Find an unused name for the extended lambda definition. cname <- nextlamname r 0 extendedLambdaName name <- freshAbstractName_ cname reportSLn "scope.extendedLambda" 10 $ "new extended lambda name: " ++ show name qname <- qualifyName_ name bindName PrivateAccess DefName cname qname -- Compose a function definition an scope check it. a <- aModeToDef <$> asks envAbstractMode let insertApp (C.RawAppP r es) = C.RawAppP r $ IdentP (C.QName cname) : es insertApp (C.IdentP q ) = C.RawAppP r $ IdentP (C.QName cname) : [C.IdentP q] where r = getRange q insertApp _ = __IMPOSSIBLE__ d = C.FunDef r [] defaultFixity' {-'-} a __IMPOSSIBLE__ cname $ for cs $ \ (lhs, rhs, wh) -> -- wh == NoWhere, see parser for more info C.Clause cname (mapLhsOriginalPattern insertApp lhs) rhs wh [] scdef <- toAbstract d -- Create the abstract syntax for the extended lambda. case scdef of A.ScopedDecl si [A.FunDef di qname' NotDelayed cs] -> do setScope si -- This turns into an A.ScopedExpr si $ A.ExtendedLam... return $ A.ExtendedLam (ExprRange r) di qname' cs _ -> __IMPOSSIBLE__ where -- Get a concrete name that is not yet in scope. nextlamname :: Range -> Int -> String -> ScopeM C.Name nextlamname r i s = do let cname = C.Name r [Id $ stringToRawName $ s ++ show i] rn <- resolveName $ C.QName cname case rn of UnknownName -> return cname _ -> nextlamname r (i+1) s instance ToAbstract C.Expr A.Expr where toAbstract e = traceCall (ScopeCheckExpr e) $ annotateExpr $ case e of -- Names Ident x -> toAbstract (OldQName x Nothing) -- Literals C.Lit l -> return $ A.Lit l -- Meta variables C.QuestionMark r n -> do scope <- getScope -- Andreas, 2014-04-06 create interaction point. ii <- registerInteractionPoint r n let info = MetaInfo { metaRange = r , metaScope = scope , metaNumber = Nothing , metaNameSuggestion = "" } return $ A.QuestionMark info ii C.Underscore r n -> do scope <- getScope return $ A.Underscore $ MetaInfo { metaRange = r , metaScope = scope , metaNumber = maybe Nothing __IMPOSSIBLE__ n , metaNameSuggestion = fromMaybe "" n } -- Raw application C.RawApp r es -> do e <- parseApplication es toAbstract e -- Application C.App r e1 e2 -> do e1 <- toAbstractCtx FunctionCtx e1 e2 <- toAbstractCtx ArgumentCtx e2 return $ A.App (ExprRange r) e1 e2 -- Operator application C.OpApp r op ns es -> toAbstractOpApp op ns es -- With application C.WithApp r e es -> do e <- toAbstractCtx WithFunCtx e es <- mapM (toAbstractCtx WithArgCtx) es return $ A.WithApp (ExprRange r) e es -- Misplaced hidden argument C.HiddenArg _ _ -> nothingAppliedToHiddenArg e C.InstanceArg _ _ -> nothingAppliedToInstanceArg e -- Lambda C.AbsurdLam r h -> return $ A.AbsurdLam (ExprRange r) h C.Lam r bs e -> toAbstractLam r bs e TopCtx -- Extended Lambda C.ExtendedLam r cs -> scopeCheckExtendedLam r cs -- Relevant and irrelevant non-dependent function type C.Fun r e1 e2 -> do Common.Arg info (e0, dotted) <- traverse (toAbstractDot FunctionSpaceDomainCtx) $ mkArg e1 info <- toAbstract info let e1 = Common.Arg ((if dotted then setRelevance Irrelevant else id) info) e0 e2 <- toAbstractCtx TopCtx e2 return $ A.Fun (ExprRange r) e1 e2 -- Dependent function type e0@(C.Pi tel e) -> localToAbstract tel $ \tel -> do e <- toAbstractCtx TopCtx e let info = ExprRange (getRange e0) return $ A.Pi info tel e -- Sorts C.Set _ -> return $ A.Set (ExprRange $ getRange e) 0 C.SetN _ n -> return $ A.Set (ExprRange $ getRange e) n C.Prop _ -> return $ A.Prop $ ExprRange $ getRange e -- Let e0@(C.Let _ ds e) -> ifM isInsideDotPattern (genericError $ "Let-expressions are not allowed in dot patterns") $ localToAbstract (LetDefs ds) $ \ds' -> do e <- toAbstractCtx TopCtx e let info = ExprRange (getRange e0) return $ A.Let info ds' e -- Record construction C.Rec r fs -> do let (xs, es) = unzip fs es <- toAbstractCtx TopCtx es return $ A.Rec (ExprRange r) $ zip xs es -- Record update C.RecUpdate r e fs -> do let (xs, es) = unzip fs e <- toAbstract e es <- toAbstractCtx TopCtx es return $ A.RecUpdate (ExprRange r) e $ zip xs es -- Parenthesis C.Paren _ e -> toAbstractCtx TopCtx e -- Pattern things C.Dot _ _ -> notAnExpression e C.As _ _ _ -> notAnExpression e C.Absurd _ -> notAnExpression e -- Impossible things C.ETel _ -> __IMPOSSIBLE__ C.Equal{} -> genericError "Parse error: unexpected '='" -- Quoting C.QuoteGoal _ x e -> do x' <- toAbstract (NewName x) e' <- toAbstract e return $ A.QuoteGoal (ExprRange $ getRange e) x' e' C.QuoteContext _ x e -> do x' <- toAbstract (NewName x) e' <- toAbstract e return $ A.QuoteContext (ExprRange $ getRange e) x' e' C.Quote r -> return $ A.Quote (ExprRange r) C.QuoteTerm r -> return $ A.QuoteTerm (ExprRange r) C.Unquote r -> return $ A.Unquote (ExprRange r) C.Tactic r e es -> do g <- freshName r "g" let re = ExprRange (getRange e) e : es <- toAbstract (e : es) let tac = A.App re e (defaultNamedArg $ A.Var g) return $ A.QuoteGoal (ExprRange r) g $ foldl (A.App re) (A.Unquote re) (map defaultNamedArg $ tac : es) -- DontCare C.DontCare e -> A.DontCare <$> toAbstract e instance ToAbstract C.LamBinding A.LamBinding where toAbstract (C.DomainFree info x) = A.DomainFree <$> toAbstract info <*> toAbstract (NewName x) toAbstract (C.DomainFull tb) = A.DomainFull <$> toAbstract tb makeDomainFull :: C.LamBinding -> C.TypedBindings makeDomainFull (C.DomainFull b) = b makeDomainFull (C.DomainFree info x) = C.TypedBindings r $ Common.Arg info $ C.TBind r [pure x] $ C.Underscore r Nothing where r = getRange x instance ToAbstract C.TypedBindings A.TypedBindings where toAbstract (C.TypedBindings r bs) = A.TypedBindings r <$> toAbstract bs instance ToAbstract C.TypedBinding A.TypedBinding where toAbstract (C.TBind r xs t) = do t' <- toAbstractCtx TopCtx t xs' <- toAbstract $ map (fmap NewName) xs return $ A.TBind r xs' t' toAbstract (C.TLet r ds) = A.TLet r <$> toAbstract (LetDefs ds) -- | Scope check a module (top level function). -- scopeCheckNiceModule :: Range -> Access -> C.Name -> C.Telescope -> ScopeM [A.Declaration] -> ScopeM [A.Declaration] scopeCheckNiceModule r p name tel checkDs | telHasOpenStmsOrModuleMacros tel = do -- Andreas, 2013-12-10: -- If the module telescope contains open statements -- or module macros (Issue 1299), -- add an extra anonymous module around the current one. -- Otherwise, the open statements would create -- identifiers in the parent scope of the current module. -- But open statements in the module telescope should -- only affect the current module! scopeCheckNiceModule noRange p noName_ [] $ scopeCheckNiceModule_ | otherwise = do scopeCheckNiceModule_ where -- The actual workhorse: scopeCheckNiceModule_ = do -- Check whether we are dealing with an anonymous module. -- This corresponds to a Coq/LEGO section. (name, p, open) <- do if isNoName name then do (i :: NameId) <- fresh return (C.NoName (getRange name) i, PrivateAccess, True) else return (name, p, False) -- Check and bind the module, using the supplied check for its contents. aname <- toAbstract (NewModuleName name) ds <- snd <$> do scopeCheckModule r (C.QName name) aname tel checkDs bindModule p name aname -- If the module was anonymous open it public. when open $ openModule_ (C.QName name) $ defaultImportDir { publicOpen = True } return ds -- | Check whether a telescope has open declarations or module macros. telHasOpenStmsOrModuleMacros :: C.Telescope -> Bool telHasOpenStmsOrModuleMacros = any yesBinds where yesBinds (C.TypedBindings _ tb) = yesBind $ unArg tb yesBind C.TBind{} = False yesBind (C.TLet _ ds) = any yes ds yes C.ModuleMacro{} = True yes C.Open{} = True yes C.Import{} = True -- not __IMPOSSIBLE__, see Issue #1718 -- However, it does not matter what we return here, as this will -- become an error later: "Not a valid let-declaration". -- (Andreas, 2015-11-17) yes (C.Mutual _ ds) = any yes ds yes (C.Abstract _ ds) = any yes ds yes (C.Private _ ds) = any yes ds yes _ = False {- UNUSED telHasLetStms :: C.Telescope -> Bool telHasLetStms = any isLetBinds where isLetBinds (C.TypedBindings _ tb) = isLetBind $ unArg tb isLetBind C.TBind{} = False isLetBind C.TLet{} = True -} -- | We for now disallow let-bindings in @data@ and @record@ telescopes. -- This due "nested datatypes"; there is no easy interpretation of -- @ -- data D (A : Set) (open M A) (b : B) : Set where -- c : D (A × A) b → D A b -- @ -- where @B@ is brought in scope by @open M A@. class EnsureNoLetStms a where ensureNoLetStms :: a -> ScopeM () {- From ghc 7.2, there is LANGUAGE DefaultSignatures default ensureNoLetStms :: Foldable t => t a -> ScopeM () ensureNoLetStms = traverse_ ensureNoLetStms -} instance EnsureNoLetStms C.TypedBinding where ensureNoLetStms tb = case tb of C.TLet{} -> typeError $ IllegalLetInTelescope tb C.TBind{} -> return () instance EnsureNoLetStms a => EnsureNoLetStms (LamBinding' a) where ensureNoLetStms = traverse_ ensureNoLetStms instance EnsureNoLetStms a => EnsureNoLetStms (TypedBindings' a) where ensureNoLetStms = traverse_ ensureNoLetStms instance EnsureNoLetStms a => EnsureNoLetStms [a] where ensureNoLetStms = traverse_ ensureNoLetStms -- | Returns the scope inside the checked module. scopeCheckModule :: Range -> C.QName -- ^ The concrete name of the module. -> A.ModuleName -- ^ The abstract name of the module. -> C.Telescope -- ^ The module telescope. -> ScopeM [A.Declaration] -- ^ The code for checking the module contents. -> ScopeM (ScopeInfo, [A.Declaration]) scopeCheckModule r x qm tel checkDs = do printScope "module" 20 $ "checking module " ++ show x -- Andreas, 2013-12-10: Telescope does not live in the new module -- but its parent, so check it before entering the new module. -- This is important for Nicolas Pouillard's open parametrized modules -- statements inside telescopes. res <- withLocalVars $ do tel <- toAbstract tel withCurrentModule qm $ do -- pushScope m -- qm <- getCurrentModule printScope "module" 20 $ "inside module " ++ show x ds <- checkDs scope <- getScope return (scope, [ A.Section info (qm `withRangesOfQ` x) tel ds ]) -- Binding is done by the caller printScope "module" 20 $ "after module " ++ show x return res where info = ModuleInfo r noRange Nothing Nothing Nothing -- | Temporary data type to scope check a file. data TopLevel a = TopLevel { topLevelPath :: AbsolutePath -- ^ The file path from which we loaded this module. , topLevelTheThing :: a -- ^ The file content. } data TopLevelInfo = TopLevelInfo { topLevelDecls :: [A.Declaration] , outsideScope :: ScopeInfo , insideScope :: ScopeInfo } -- | The top-level module name. topLevelModuleName :: TopLevelInfo -> A.ModuleName topLevelModuleName topLevel = scopeCurrent (insideScope topLevel) -- | Top-level declarations are always -- @ -- (import|open)* -- a bunch of possibly opened imports -- module ThisModule ... -- the top-level module of this file -- @ instance ToAbstract (TopLevel [C.Declaration]) TopLevelInfo where toAbstract (TopLevel file ds) = -- A file is a bunch of preliminary decls (imports etc.) -- plus a single module decl. caseMaybe (initLast ds) __IMPOSSIBLE__ $ \ (outsideDecls, C.Module r m0 tel insideDecls) -> do -- If the module name is _ compute the name from the file path m <- if isNoName m0 then return $ C.QName $ C.Name noRange [Id $ stringToRawName $ rootName file] else do -- Andreas, 2014-03-28 Issue 1078 -- We need to check the module name against the file name here. -- Otherwise one could sneak in a lie and confuse the scope -- checker. checkModuleName (C.toTopLevelModuleName m0) file return m0 setTopLevelModule m am <- toAbstract (NewModuleQName m) -- Scope check the declarations outside outsideDecls <- toAbstract outsideDecls (insideScope, insideDecls) <- scopeCheckModule r m am tel $ toAbstract insideDecls outsideScope <- getScope return $ TopLevelInfo (outsideDecls ++ insideDecls) outsideScope insideScope -- | runs Syntax.Concrete.Definitions.niceDeclarations on main module niceDecls :: [C.Declaration] -> ScopeM [NiceDeclaration] niceDecls ds = case runNice $ niceDeclarations ds of Left e -> throwError $ Exception (getRange e) $ pretty e Right ds -> return ds #if __GLASGOW_HASKELL__ >= 710 instance {-# OVERLAPPING #-} ToAbstract [C.Declaration] [A.Declaration] where #else instance ToAbstract [C.Declaration] [A.Declaration] where #endif toAbstract ds = do -- don't allow to switch off termination checker in --safe mode ds <- ifM (optSafe <$> commandLineOptions) (mapM noNoTermCheck ds) (return ds) toAbstract =<< niceDecls ds where noNoTermCheck (C.Pragma (C.TerminationCheckPragma r NoTerminationCheck)) = typeError $ SafeFlagNoTerminationCheck noNoTermCheck (C.Pragma (C.TerminationCheckPragma r NonTerminating)) = typeError $ SafeFlagNonTerminating noNoTermCheck (C.Pragma (C.TerminationCheckPragma r Terminating)) = typeError $ SafeFlagTerminating noNoTermCheck d = return d newtype LetDefs = LetDefs [C.Declaration] newtype LetDef = LetDef NiceDeclaration instance ToAbstract LetDefs [A.LetBinding] where toAbstract (LetDefs ds) = concat <$> (toAbstract =<< map LetDef <$> niceDecls ds) instance ToAbstract LetDef [A.LetBinding] where toAbstract (LetDef d) = case d of NiceMutual _ _ d@[C.FunSig _ fx _ instanc info _ x t, C.FunDef _ _ _ abstract _ _ [cl]] -> do when (abstract == AbstractDef) $ do genericError $ "abstract not allowed in let expressions" when (instanc == InstanceDef) $ do genericError $ "Using instance is useless here, let expressions are always eligible for instance search." (x', e) <- letToAbstract cl t <- toAbstract t -- Andreas, 2015-08-27 keeping both the range of x and x' solves Issue 1618. -- The situation is -- @ -- let y : t -- y = e -- @ -- and we need to store the ranges of both occurences of y in order -- for the highlighter to do the right thing. x <- setRange (fuseRange x x') <$> toAbstract (NewName $ mkBoundName x fx) info <- toAbstract info return [ A.LetBind (LetRange $ getRange d) info x t e ] -- irrefutable let binding, like (x , y) = rhs NiceFunClause r PublicAccess ConcreteDef termCheck d@(C.FunClause lhs@(C.LHS p [] [] []) (C.RHS rhs) NoWhere) -> do mp <- setCurrentRange p $ (Right <$> parsePattern p) `catchError` (return . Left) case mp of Right p -> do rhs <- toAbstract rhs p <- toAbstract p checkPatternLinearity [p] p <- toAbstract p return [ A.LetPatBind (LetRange r) p rhs ] -- It's not a record pattern, so it should be a prefix left-hand side Left err -> case definedName p of Nothing -> throwError err Just x -> toAbstract $ LetDef $ NiceMutual r termCheck [ C.FunSig r defaultFixity' PublicAccess NotInstanceDef defaultArgInfo termCheck x (C.Underscore (getRange x) Nothing) , C.FunDef r __IMPOSSIBLE__ __IMPOSSIBLE__ ConcreteDef __IMPOSSIBLE__ __IMPOSSIBLE__ [C.Clause x lhs (C.RHS rhs) NoWhere []] ] where definedName (C.IdentP (C.QName x)) = Just x definedName C.IdentP{} = Nothing definedName (C.RawAppP _ (p : _)) = definedName p definedName (C.ParenP _ p) = definedName p definedName C.WildP{} = Nothing -- for instance let _ + x = x in ... (not allowed) definedName C.AbsurdP{} = Nothing definedName C.AsP{} = Nothing definedName C.DotP{} = Nothing definedName C.LitP{} = Nothing definedName C.QuoteP{} = Nothing definedName C.HiddenP{} = __IMPOSSIBLE__ definedName C.InstanceP{} = __IMPOSSIBLE__ definedName C.RawAppP{} = __IMPOSSIBLE__ definedName C.AppP{} = __IMPOSSIBLE__ definedName C.OpAppP{} = __IMPOSSIBLE__ -- You can't open public in a let NiceOpen r x dirs | not (C.publicOpen dirs) -> do m <- toAbstract (OldModuleName x) openModule_ x dirs let minfo = ModuleInfo { minfoRange = r , minfoAsName = Nothing , minfoAsTo = renamingRange dirs , minfoOpenShort = Nothing , minfoDirective = Just dirs } return [A.LetOpen minfo m] NiceModuleMacro r p x modapp open dir | not (C.publicOpen dir) -> -- Andreas, 2014-10-09, Issue 1299: module macros in lets need -- to be private checkModuleMacro LetApply r PrivateAccess x modapp open dir _ -> notAValidLetBinding d where letToAbstract (C.Clause top clhs@(C.LHS p [] [] []) (C.RHS rhs) NoWhere []) = do {- p <- parseLHS top p localToAbstract (snd $ lhsArgs p) $ \args -> -} (x, args) <- do res <- setCurrentRange p $ parseLHS top p case res of C.LHSHead x args -> return (x, args) C.LHSProj{} -> genericError $ "copatterns not allowed in let bindings" e <- localToAbstract args $ \args -> do rhs <- toAbstract rhs foldM lambda rhs (reverse args) -- just reverse because these DomainFree return (x, e) letToAbstract _ = notAValidLetBinding d -- Named patterns not allowed in let definitions lambda e (Common.Arg info (Named Nothing (A.VarP x))) = return $ A.Lam i (A.DomainFree info x) e where i = ExprRange (fuseRange x e) lambda e (Common.Arg info (Named Nothing (A.WildP i))) = do x <- freshNoName (getRange i) return $ A.Lam i' (A.DomainFree info x) e where i' = ExprRange (fuseRange i e) lambda _ _ = notAValidLetBinding d newtype Blind a = Blind { unBlind :: a } instance ToAbstract (Blind a) (Blind a) where toAbstract = return aDefToMode :: IsAbstract -> AbstractMode aDefToMode AbstractDef = AbstractMode aDefToMode ConcreteDef = ConcreteMode aModeToDef :: AbstractMode -> IsAbstract aModeToDef AbstractMode = AbstractDef aModeToDef ConcreteMode = ConcreteDef aModeToDef _ = __IMPOSSIBLE__ -- The only reason why we return a list is that open declarations disappears. -- For every other declaration we get a singleton list. instance ToAbstract NiceDeclaration A.Declaration where toAbstract d = annotateDecls $ traceCall (ScopeCheckDeclaration d) $ -- Andreas, 2015-10-05, Issue 1677: -- We record in the environment whether we are scope checking an -- abstract definition. This way, we can propagate this attribute -- the extended lambdas. caseMaybe (niceHasAbstract d) id (\ a -> local $ \ e -> e { envAbstractMode = aDefToMode a }) $ case d of -- Axiom (actual postulate) C.Axiom r f p i rel x t -> do -- check that we do not postulate in --safe mode clo <- commandLineOptions when (optSafe clo) (typeError (SafeFlagPostulate x)) -- check the postulate toAbstractNiceAxiom A.NoFunSig d -- Fields C.NiceField r f p a x t -> do unless (p == PublicAccess) $ genericError "Record fields can not be private" -- Interaction points for record fields have already been introduced -- when checking the type of the record constructor. -- To avoid introducing interaction points (IP) twice, we turn -- all question marks to underscores. (See issue 1138.) let maskIP (C.QuestionMark r _) = C.Underscore r Nothing maskIP e = e t' <- toAbstractCtx TopCtx $ mapExpr maskIP t y <- freshAbstractQName f x irrProj <- optIrrelevantProjections <$> pragmaOptions unless (isIrrelevant t && not irrProj) $ -- Andreas, 2010-09-24: irrelevant fields are not in scope -- this ensures that projections out of irrelevant fields cannot occur -- Ulf: unless you turn on --irrelevant-projections bindName p FldName x y return [ A.Field (mkDefInfo x f p a r) y t' ] -- Primitive function PrimitiveFunction r f p a x t -> do t' <- toAbstractCtx TopCtx t y <- freshAbstractQName f x bindName p DefName x y return [ A.Primitive (mkDefInfo x f p a r) y t' ] -- Definitions (possibly mutual) NiceMutual r termCheck ds -> do ds' <- toAbstract ds -- We only termination check blocks that do not have a measure. return [ A.Mutual (MutualInfo termCheck r) ds' ] C.NiceRecSig r f a x ls t -> do ensureNoLetStms ls withLocalVars $ do ls' <- toAbstract (map makeDomainFull ls) x' <- freshAbstractQName f x bindName a DefName x x' t' <- toAbstract t return [ A.RecSig (mkDefInfo x f a ConcreteDef r) x' ls' t' ] C.NiceDataSig r f a x ls t -> withLocalVars $ do printScope "scope.data.sig" 20 ("checking DataSig for " ++ show x) ensureNoLetStms ls ls' <- toAbstract (map makeDomainFull ls) x' <- freshAbstractQName f x {- -- Andreas, 2012-01-16: remember number of parameters bindName a (DataName (length ls)) x x' -} bindName a DefName x x' t' <- toAbstract t return [ A.DataSig (mkDefInfo x f a ConcreteDef r) x' ls' t' ] -- Type signatures C.FunSig r f p i rel tc x t -> toAbstractNiceAxiom A.FunSig (C.Axiom r f p i rel x t) -- Function definitions C.FunDef r ds f a tc x cs -> do printLocals 10 $ "checking def " ++ show x (x',cs) <- toAbstract (OldName x,cs) let delayed = NotDelayed -- (delayed, cs) <- translateCopatternClauses cs -- TODO return [ A.FunDef (mkDefInfo x f PublicAccess a r) x' delayed cs ] -- Uncategorized function clauses C.NiceFunClause r acc abs termCheck (C.FunClause lhs rhs wcls) -> genericError $ "Missing type signature for left hand side " ++ show lhs C.NiceFunClause{} -> __IMPOSSIBLE__ -- Data definitions C.DataDef r f a x pars cons -> withLocalVars $ do printScope "scope.data.def" 20 ("checking DataDef for " ++ show x) ensureNoLetStms pars -- Check for duplicate constructors do let cs = map conName cons dups = nub $ cs \\ nub cs bad = filter (`elem` dups) cs unless (distinct cs) $ setCurrentRange bad $ typeError $ DuplicateConstructors dups pars <- toAbstract pars DefinedName p ax <- resolveName (C.QName x) let x' = anameName ax -- Create the module for the qualified constructors checkForModuleClash x -- disallow shadowing previously defined modules let m = mnameFromList $ qnameToList x' createModule True m bindModule p x m -- make it a proper module cons <- toAbstract (map (ConstrDecl NoRec m a p) cons) -- Open the module -- openModule_ (C.QName x) defaultImportDir{ publicOpen = True } printScope "data" 20 $ "Checked data " ++ show x return [ A.DataDef (mkDefInfo x f PublicAccess a r) x' pars cons ] where conName (C.Axiom _ _ _ _ _ c _) = c conName _ = __IMPOSSIBLE__ -- Record definitions (mucho interesting) C.RecDef r f a x ind cm pars fields -> do ensureNoLetStms pars withLocalVars $ do -- Check that the generated module doesn't clash with a previously -- defined module checkForModuleClash x pars <- toAbstract pars DefinedName p ax <- resolveName (C.QName x) let x' = anameName ax -- We scope check the fields a first time when putting together -- the type of the constructor. contel <- toAbstract $ recordConstructorType fields m0 <- getCurrentModule let m = A.qualifyM m0 $ mnameFromList $ (:[]) $ last $ qnameToList x' printScope "rec" 15 "before record" createModule False m -- We scope check the fields a second time, as actual fields. afields <- withCurrentModule m $ do afields <- toAbstract fields printScope "rec" 15 "checked fields" return afields bindModule p x m cm' <- mapM (\(ThingWithFixity c f) -> bindConstructorName m c f a p YesRec) cm printScope "rec" 15 "record complete" return [ A.RecDef (mkDefInfo x f PublicAccess a r) x' ind cm' pars contel afields ] NiceModule r p a x@(C.QName name) tel ds -> do reportSDoc "scope.decl" 70 $ vcat $ [ text $ "scope checking NiceModule " ++ prettyShow x ] adecls <- traceCall (ScopeCheckDeclaration $ NiceModule r p a x tel []) $ do scopeCheckNiceModule r p name tel $ toAbstract ds reportSDoc "scope.decl" 70 $ vcat $ [ text $ "scope checked NiceModule " ++ prettyShow x ] ++ map (nest 2 . prettyA) adecls return adecls NiceModule _ _ _ m@C.Qual{} _ _ -> genericError $ "Local modules cannot have qualified names" NiceModuleMacro r p x modapp open dir -> do reportSDoc "scope.decl" 70 $ vcat $ [ text $ "scope checking NiceModuleMacro " ++ prettyShow x ] adecls <- checkModuleMacro Apply r p x modapp open dir reportSDoc "scope.decl" 70 $ vcat $ [ text $ "scope checked NiceModuleMacro " ++ prettyShow x ] ++ map (nest 2 . prettyA) adecls return adecls NiceOpen r x dir -> do reportSDoc "scope.decl" 70 $ vcat $ [ text $ "scope checking NiceOpen " ++ prettyShow x ] m <- toAbstract (OldModuleName x) printScope "open" 20 $ "opening " ++ show x openModule_ x dir printScope "open" 20 $ "result:" let minfo = ModuleInfo { minfoRange = r , minfoAsName = Nothing , minfoAsTo = renamingRange dir , minfoOpenShort = Nothing , minfoDirective = Just dir } let adecls = [A.Open minfo m] reportSDoc "scope.decl" 70 $ vcat $ [ text $ "scope checked NiceOpen " ++ prettyShow x ] ++ map (nest 2 . prettyA) adecls return adecls NicePragma r p -> do ps <- toAbstract p return $ map (A.Pragma r) ps NiceImport r x as open dir -> setCurrentRange r $ do notPublicWithoutOpen open dir -- First scope check the imported module and return its name and -- interface. This is done with that module as the top-level module. -- This is quite subtle. We rely on the fact that when setting the -- top-level module and generating a fresh module name the generated -- name will be exactly the same as the name generated when checking -- the imported module. (m, i) <- withCurrentModule noModuleName $ withTopLevelModule x $ do m <- toAbstract $ NewModuleQName x printScope "import" 10 "before import:" (m, i) <- scopeCheckImport m printScope "import" 10 $ "scope checked import: " ++ show i -- We don't want the top scope of the imported module (things happening -- before the module declaration) return (m, Map.delete noModuleName i) -- Merge the imported scopes with the current scopes modifyScopes $ \ ms -> Map.unionWith mergeScope (Map.delete m ms) i -- Bind the desired module name to the right abstract name. case as of Nothing -> bindQModule PrivateAccess x m Just y -> bindModule PrivateAccess (asName y) m printScope "import" 10 "merged imported sig:" -- Open if specified, otherwise apply import directives let (name, theAsSymbol, theAsName) = case as of Nothing -> (x, noRange, Nothing) Just a -> (C.QName (asName a), asRange a, Just (asName a)) case open of DoOpen -> void $ toAbstract [ C.Open r name dir ] -- If not opening, import directives are applied to the original scope. DontOpen -> modifyNamedScopeM m $ applyImportDirectiveM x dir let minfo = ModuleInfo { minfoRange = r , minfoAsName = theAsName , minfoAsTo = getRange (theAsSymbol, renamingRange dir) , minfoOpenShort = Just open , minfoDirective = Just dir } return [ A.Import minfo m ] NiceUnquoteDecl r fx p i a tc x e -> do y <- freshAbstractQName fx x bindName p QuotableName x y e <- toAbstract e rebindName p DefName x y let mi = MutualInfo tc r return [A.UnquoteDecl mi (mkDefInfoInstance x fx p a i r) y e] NicePatternSyn r fx n as p -> do reportSLn "scope.pat" 10 $ "found nice pattern syn: " ++ show r y <- freshAbstractQName fx n bindName PublicAccess PatternSynName n y defn@(as, p) <- withLocalVars $ do p <- toAbstract =<< toAbstract =<< parsePatternSyn p checkPatternLinearity [p] as <- (traverse . mapM) (unVarName <=< resolveName . C.QName) as as <- (map . fmap) unBlind <$> toAbstract ((map . fmap) Blind as) return (as, p) modifyPatternSyns (Map.insert y defn) return [A.PatternSynDef y as p] -- only for highlighting where unVarName (VarName a) = return a unVarName _ = typeError $ UnusedVariableInPatternSynonym where -- checking postulate or type sig. without checking safe flag toAbstractNiceAxiom funSig (C.Axiom r f p i info x t) = do t' <- toAbstractCtx TopCtx t y <- freshAbstractQName f x info <- toAbstract info bindName p DefName x y return [ A.Axiom funSig (mkDefInfoInstance x f p ConcreteDef i r) info y t' ] toAbstractNiceAxiom _ _ = __IMPOSSIBLE__ data IsRecordCon = YesRec | NoRec data ConstrDecl = ConstrDecl IsRecordCon A.ModuleName IsAbstract Access C.NiceDeclaration bindConstructorName :: ModuleName -> C.Name -> Fixity'-> IsAbstract -> Access -> IsRecordCon -> ScopeM A.QName bindConstructorName m x f a p record = do -- The abstract name is the qualified one y <- withCurrentModule m $ freshAbstractQName f x -- Bind it twice, once unqualified and once qualified bindName p' ConName x y withCurrentModule m $ bindName p'' ConName x y return y where -- An abstract constructor is private (abstract constructor means -- abstract datatype, so the constructor should not be exported). p' = case a of AbstractDef -> PrivateAccess _ -> p p'' = case (a, record) of (AbstractDef, _) -> PrivateAccess (_, YesRec) -> OnlyQualified -- record constructors aren't really in the record module _ -> PublicAccess instance ToAbstract ConstrDecl A.Declaration where toAbstract (ConstrDecl record m a p d) = do case d of C.Axiom r f _ i info x t -> do -- rel==Relevant t' <- toAbstractCtx TopCtx t -- The abstract name is the qualified one -- Bind it twice, once unqualified and once qualified y <- bindConstructorName m x f a p record info <- toAbstract info printScope "con" 15 "bound constructor" return $ A.Axiom NoFunSig (mkDefInfoInstance x f p ConcreteDef i r) info y t' _ -> typeError . GenericDocError $ P.text "Illegal declaration in data type definition " P.$$ P.nest 2 (pretty (notSoNiceDeclaration d)) instance ToAbstract C.Pragma [A.Pragma] where toAbstract (C.ImpossiblePragma _) = impossibleTest toAbstract (C.OptionsPragma _ opts) = return [ A.OptionsPragma opts ] toAbstract (C.RewritePragma _ x) = do e <- toAbstract $ OldQName x Nothing case e of A.Def x -> return [ A.RewritePragma x ] A.Proj x -> return [ A.RewritePragma x ] A.Con (AmbQ [x]) -> return [ A.RewritePragma x ] A.Con x -> genericError $ "REWRITE used on ambiguous name " ++ show x A.Var x -> genericError $ "REWRITE used on parameter " ++ show x ++ " instead of on a defined symbol" _ -> __IMPOSSIBLE__ toAbstract (C.CompiledTypePragma _ x hs) = do e <- toAbstract $ OldQName x Nothing case e of A.Def x -> return [ A.CompiledTypePragma x hs ] _ -> genericError $ "Bad compiled type: " ++ prettyShow x -- TODO: error message toAbstract (C.CompiledDataPragma _ x hs hcs) = do e <- toAbstract $ OldQName x Nothing case e of A.Def x -> return [ A.CompiledDataPragma x hs hcs ] _ -> genericError $ "Not a datatype: " ++ prettyShow x -- TODO: error message toAbstract (C.CompiledPragma _ x hs) = do e <- toAbstract $ OldQName x Nothing y <- case e of A.Def x -> return x A.Proj x -> return x -- TODO: do we need to do s.th. special for projections? (Andreas, 2014-10-12) A.Con _ -> genericError "Use COMPILED_DATA for constructors" -- TODO _ -> __IMPOSSIBLE__ return [ A.CompiledPragma y hs ] toAbstract (C.CompiledExportPragma _ x hs) = do e <- toAbstract $ OldQName x Nothing y <- case e of A.Def x -> return x _ -> __IMPOSSIBLE__ return [ A.CompiledExportPragma y hs ] toAbstract (C.CompiledEpicPragma _ x ep) = do e <- toAbstract $ OldQName x Nothing y <- case e of A.Def x -> return x _ -> __IMPOSSIBLE__ return [ A.CompiledEpicPragma y ep ] toAbstract (C.CompiledJSPragma _ x ep) = do e <- toAbstract $ OldQName x Nothing y <- case e of A.Def x -> return x A.Proj x -> return x A.Con (AmbQ [x]) -> return x A.Con x -> genericError $ "COMPILED_JS used on ambiguous name " ++ prettyShow x _ -> __IMPOSSIBLE__ return [ A.CompiledJSPragma y ep ] toAbstract (C.StaticPragma _ x) = do e <- toAbstract $ OldQName x Nothing y <- case e of A.Def x -> return x _ -> __IMPOSSIBLE__ return [ A.StaticPragma y ] toAbstract (C.BuiltinPragma _ b e) = do -- Andreas, 2015-02-14 -- Some builtins cannot be given a valid Agda type, -- thus, they do not come with accompanying postulate or definition. if b `elem` builtinsNoDef then do case e of C.Ident q@(C.QName x) -> do unlessM ((UnknownName ==) <$> resolveName q) $ genericError $ "BUILTIN " ++ b ++ " declares an identifier " ++ "(no longer expects an already defined identifier)" y <- freshAbstractQName defaultFixity' x bindName PublicAccess DefName x y return [ A.BuiltinNoDefPragma b y ] _ -> genericError $ "Pragma BUILTIN " ++ b ++ ": expected unqualified identifier, " ++ "but found expression " ++ prettyShow e else do e <- toAbstract e return [ A.BuiltinPragma b e ] toAbstract (C.ImportPragma _ i) = do addHaskellImport i return [] toAbstract (C.EtaPragma _ x) = do e <- toAbstract $ OldQName x Nothing case e of A.Def x -> return [ A.EtaPragma x ] _ -> do e <- showA e genericError $ "Pragma ETA: expected identifier, " ++ "but found expression " ++ e -- Termination checking pragmes are handled by the nicifier toAbstract C.TerminationCheckPragma{} = __IMPOSSIBLE__ instance ToAbstract C.Clause A.Clause where toAbstract (C.Clause top C.Ellipsis{} _ _ _) = genericError "bad '...'" -- TODO: error message toAbstract (C.Clause top lhs@(C.LHS p wps eqs with) rhs wh wcs) = withLocalVars $ do -- Andreas, 2012-02-14: need to reset local vars before checking subclauses vars <- getLocalVars let wcs' = for wcs $ \ c -> setLocalVars vars $> c lhs' <- toAbstract $ LeftHandSide top p wps printLocals 10 "after lhs:" let (whname, whds) = case wh of NoWhere -> (Nothing, []) AnyWhere ds -> (Nothing, ds) SomeWhere m ds -> (Just m, ds) let isTerminationPragma :: C.Declaration -> Bool isTerminationPragma (C.Pragma (TerminationCheckPragma _ _)) = True isTerminationPragma _ = False if not (null eqs) then do rhs <- toAbstract =<< toAbstractCtx TopCtx (RightHandSide eqs with wcs' rhs whds) return $ A.Clause lhs' rhs [] else do -- ASR (16 November 2015) Issue 1137: We ban termination -- pragmas inside `where` clause. when (any isTerminationPragma whds) $ genericError "Termination pragmas are not allowed inside where clauses" -- the right hand side is checked inside the module of the local definitions (rhs, ds) <- whereToAbstract (getRange wh) whname whds $ toAbstractCtx TopCtx (RightHandSide eqs with wcs' rhs []) rhs <- toAbstract rhs return $ A.Clause lhs' rhs ds whereToAbstract :: Range -> Maybe C.Name -> [C.Declaration] -> ScopeM a -> ScopeM (a, [A.Declaration]) whereToAbstract _ _ [] inner = (,[]) <$> inner whereToAbstract r whname whds inner = do -- Create a fresh concrete name if there isn't (a proper) one. m <- case whname of Just m | not (isNoName m) -> return m _ -> C.NoName (getRange whname) <$> fresh let acc = maybe PrivateAccess (const PublicAccess) whname -- unnamed where's are private let tel = [] old <- getCurrentModule am <- toAbstract (NewModuleName m) (scope, ds) <- scopeCheckModule r (C.QName m) am tel $ toAbstract whds setScope scope x <- inner setCurrentModule old bindModule acc m am -- Issue 848: if the module was anonymous (module _ where) open it public let anonymous = maybe False isNoName whname when anonymous $ openModule_ (C.QName m) $ defaultImportDir { publicOpen = True } return (x, ds) data RightHandSide = RightHandSide { rhsRewriteEqn :: [C.RewriteEqn] -- ^ @rewrite e@ (many) , rhsWithExpr :: [C.WithExpr] -- ^ @with e@ (many) , rhsSubclauses :: [ScopeM C.Clause] -- ^ the subclauses spawned by a with (monadic because we need to reset the local vars before checking these clauses) , rhs :: C.RHS , rhsWhereDecls :: [C.Declaration] } data AbstractRHS = AbsurdRHS' | WithRHS' [A.Expr] [ScopeM C.Clause] -- ^ The with clauses haven't been translated yet | RHS' A.Expr | RewriteRHS' [A.Expr] AbstractRHS [A.Declaration] qualifyName_ :: A.Name -> ScopeM A.QName qualifyName_ x = do m <- getCurrentModule return $ A.qualify m x withFunctionName :: String -> ScopeM A.QName withFunctionName s = do NameId i _ <- fresh qualifyName_ =<< freshName_ (s ++ show i) instance ToAbstract AbstractRHS A.RHS where toAbstract AbsurdRHS' = return A.AbsurdRHS toAbstract (RHS' e) = return $ A.RHS e toAbstract (RewriteRHS' eqs rhs wh) = do auxs <- replicateM (length eqs) $ withFunctionName "rewrite-" rhs <- toAbstract rhs return $ RewriteRHS (zip auxs eqs) rhs wh toAbstract (WithRHS' es cs) = do aux <- withFunctionName "with-" A.WithRHS aux es <$> do toAbstract =<< sequence cs instance ToAbstract RightHandSide AbstractRHS where toAbstract (RightHandSide eqs@(_:_) es cs rhs wh) = do eqs <- toAbstractCtx TopCtx eqs -- TODO: remember named where (rhs, ds) <- whereToAbstract (getRange wh) Nothing wh $ toAbstract (RightHandSide [] es cs rhs []) return $ RewriteRHS' eqs rhs ds toAbstract (RightHandSide [] [] (_ : _) _ _) = __IMPOSSIBLE__ toAbstract (RightHandSide [] (_ : _) _ (C.RHS _) _) = typeError $ BothWithAndRHS toAbstract (RightHandSide [] [] [] rhs []) = toAbstract rhs toAbstract (RightHandSide [] es cs C.AbsurdRHS []) = do es <- toAbstractCtx TopCtx es return $ WithRHS' es cs -- TODO: some of these might be possible toAbstract (RightHandSide [] (_ : _) _ C.AbsurdRHS (_ : _)) = __IMPOSSIBLE__ toAbstract (RightHandSide [] [] [] (C.RHS _) (_ : _)) = __IMPOSSIBLE__ toAbstract (RightHandSide [] [] [] C.AbsurdRHS (_ : _)) = __IMPOSSIBLE__ instance ToAbstract C.RHS AbstractRHS where toAbstract C.AbsurdRHS = return $ AbsurdRHS' toAbstract (C.RHS e) = RHS' <$> toAbstract e data LeftHandSide = LeftHandSide C.Name C.Pattern [C.Pattern] instance ToAbstract LeftHandSide A.LHS where toAbstract (LeftHandSide top lhs wps) = traceCall (ScopeCheckLHS top lhs) $ do lhscore <- parseLHS top lhs reportSLn "scope.lhs" 5 $ "parsed lhs: " ++ show lhscore printLocals 10 "before lhs:" -- error if copattern parsed but --no-copatterns option unlessM (optCopatterns <$> pragmaOptions) $ case lhscore of C.LHSProj{} -> typeError $ NeedOptionCopatterns C.LHSHead{} -> return () -- scope check patterns except for dot patterns lhscore <- toAbstract lhscore reportSLn "scope.lhs" 5 $ "parsed lhs patterns: " ++ show lhscore wps <- toAbstract =<< mapM parsePattern wps checkPatternLinearity $ lhsCoreAllPatterns lhscore ++ wps printLocals 10 "checked pattern:" -- scope check dot patterns lhscore <- toAbstract lhscore reportSLn "scope.lhs" 5 $ "parsed lhs dot patterns: " ++ show lhscore wps <- toAbstract wps printLocals 10 "checked dots:" return $ A.LHS (LHSRange $ getRange (lhs, wps)) lhscore wps -- does not check pattern linearity instance ToAbstract C.LHSCore (A.LHSCore' C.Expr) where toAbstract (C.LHSHead x ps) = do x <- withLocalVars $ setLocalVars [] >> toAbstract (OldName x) args <- toAbstract ps return $ A.LHSHead x args toAbstract (C.LHSProj d ps1 l ps2) = do qx <- resolveName d d <- case qx of FieldName d -> return $ anameName d UnknownName -> notInScope d _ -> genericError $ "head of copattern needs to be a field identifier, but " ++ show d ++ " isn't one" args1 <- toAbstract ps1 l <- toAbstract l args2 <- toAbstract ps2 return $ A.LHSProj d args1 l args2 instance ToAbstract c a => ToAbstract (WithHiding c) (WithHiding a) where toAbstract (WithHiding h a) = WithHiding h <$> toAbstractHiding h a instance ToAbstract c a => ToAbstract (C.Arg c) (A.Arg a) where toAbstract (Common.Arg info e) = Common.Arg <$> toAbstract info <*> toAbstractHiding info e instance ToAbstract c a => ToAbstract (Named name c) (Named name a) where toAbstract (Named n e) = Named n <$> toAbstract e {- DOES NOT WORK ANYMORE with pattern synonyms instance ToAbstract c a => ToAbstract (A.LHSCore' c) (A.LHSCore' a) where toAbstract = mapM toAbstract -} instance ToAbstract (A.LHSCore' C.Expr) (A.LHSCore' A.Expr) where toAbstract (A.LHSHead f ps) = A.LHSHead f <$> mapM toAbstract ps toAbstract (A.LHSProj d ps lhscore ps') = A.LHSProj d <$> mapM toAbstract ps <*> mapM toAbstract lhscore <*> mapM toAbstract ps' instance ToAbstract c a => ToAbstract (A.NamedArg c) (A.NamedArg a) where toAbstract (Common.Arg info c) = liftM2 Common.Arg (return info) (toAbstract c) instance ToAbstract C.ArgInfo A.ArgInfo where toAbstract info = do cs <- mapM toAbstract $ argInfoColors info return $ info { argInfoColors = cs } -- Patterns are done in two phases. First everything but the dot patterns, and -- then the dot patterns. This is because dot patterns can refer to variables -- bound anywhere in the pattern. instance ToAbstract (A.Pattern' C.Expr) (A.Pattern' A.Expr) where toAbstract (A.VarP x) = return $ A.VarP x toAbstract (A.ConP i ds as) = A.ConP i ds <$> mapM toAbstract as toAbstract (A.DefP i x as) = A.DefP i x <$> mapM toAbstract as toAbstract (A.WildP i) = return $ A.WildP i toAbstract (A.AsP i x p) = A.AsP i x <$> toAbstract p toAbstract (A.DotP i e) = A.DotP i <$> insideDotPattern (toAbstract e) toAbstract (A.AbsurdP i) = return $ A.AbsurdP i toAbstract (A.LitP l) = return $ A.LitP l toAbstract (A.PatternSynP i x as) = A.PatternSynP i x <$> mapM toAbstract as resolvePatternIdentifier :: Range -> C.QName -> Maybe (Set A.Name) -> ScopeM (A.Pattern' C.Expr) resolvePatternIdentifier r x ns = do px <- toAbstract (PatName x ns) case px of VarPatName y -> return $ VarP y ConPatName ds -> return $ ConP (ConPatInfo ConPCon $ PatRange r) (AmbQ $ map anameName ds) [] PatternSynPatName d -> return $ PatternSynP (PatRange r) (anameName d) [] instance ToAbstract C.Pattern (A.Pattern' C.Expr) where toAbstract (C.IdentP x) = resolvePatternIdentifier (getRange x) x Nothing toAbstract (AppP (QuoteP _) p) | IdentP x <- namedArg p, getHiding p == NotHidden = do e <- toAbstract (OldQName x Nothing) let quoted (A.Def x) = return x quoted (A.Proj x) = return x quoted (A.Con (AmbQ [x])) = return x quoted (A.Con (AmbQ xs)) = genericError $ "quote: Ambigous name: " ++ show xs quoted (A.ScopedExpr _ e) = quoted e quoted _ = genericError $ "quote: not a defined name" A.LitP . LitQName (getRange x) <$> quoted e toAbstract (QuoteP r) = genericError "quote must be applied to an identifier" toAbstract p0@(AppP p q) = do (p', q') <- toAbstract (p,q) case p' of ConP i x as -> return $ ConP (i {patInfo = info}) x (as ++ [q']) DefP _ x as -> return $ DefP info x (as ++ [q']) PatternSynP _ x as -> return $ PatternSynP info x (as ++ [q']) _ -> typeError $ InvalidPattern p0 where r = getRange p0 info = PatRange r toAbstract p0@(OpAppP r op ns ps) = do p <- resolvePatternIdentifier (getRange op) op (Just ns) ps <- toAbstract ps case p of ConP i x as -> return $ ConP (i {patInfo = info}) x (as ++ ps) DefP _ x as -> return $ DefP info x (as ++ ps) PatternSynP _ x as -> return $ PatternSynP info x (as ++ ps) _ -> __IMPOSSIBLE__ where info = PatRange r -- Removed when parsing toAbstract (HiddenP _ _) = __IMPOSSIBLE__ toAbstract (InstanceP _ _) = __IMPOSSIBLE__ toAbstract (RawAppP _ _) = __IMPOSSIBLE__ toAbstract p@(C.WildP r) = return $ A.WildP (PatRange r) -- Andreas, 2015-05-28 futile attempt to fix issue 819: repeated variable on lhs "_" -- toAbstract p@(C.WildP r) = A.VarP <$> freshName r "_" toAbstract (C.ParenP _ p) = toAbstract p toAbstract (C.LitP l) = return $ A.LitP l toAbstract p0@(C.AsP r x p) = typeError $ NotSupported "@-patterns" {- do x <- toAbstract (NewName x) p <- toAbstract p return $ A.AsP info x p where info = PatRange r -} -- we have to do dot patterns at the end toAbstract p0@(C.DotP r e) = return $ A.DotP info e where info = PatRange r toAbstract p0@(C.AbsurdP r) = return $ A.AbsurdP info where info = PatRange r -- | Turn an operator application into abstract syntax. Make sure to record the -- right precedences for the various arguments. toAbstractOpApp :: C.QName -> Set A.Name -> [C.NamedArg (OpApp C.Expr)] -> ScopeM A.Expr toAbstractOpApp op ns es = do -- Get the notation for the operator. nota <- getNotation op ns let parts = notation nota -- We can throw away the @BindingHoles@, since binders -- have been preprocessed into @OpApp C.Expr@. let nonBindingParts = filter (not . isBindingHole) parts -- We should be left with as many holes as we have been given args @es@. -- If not, crash. unless (length (filter isAHole nonBindingParts) == length es) __IMPOSSIBLE__ -- Translate operator and its arguments (each in the right context). op <- toAbstract (OldQName op (Just ns)) foldl' app op <$> left (notaFixity nota) nonBindingParts es where -- Build an application in the abstract syntax, with correct Range. app e arg = A.App (ExprRange (fuseRange e arg)) e (setArgColors [] arg) -- Translate an argument (inside @C.NamedArg . OpApp@). toAbsOpArg cxt = traverse $ traverse $ toAbstractOpArg cxt -- The hole left to the first @IdPart@ is filled with an expression in @LeftOperandCtx@. left f (IdPart _ : xs) es = inside f xs es left f (_ : xs) (e : es) = do e <- toAbsOpArg (LeftOperandCtx f) e es <- inside f xs es return (e : es) left f (_ : _) [] = __IMPOSSIBLE__ left f [] _ = __IMPOSSIBLE__ -- The holes in between the @IdPart@s is filled with an expression in @InsideOperandCtx@. inside f [x] es = right f x es inside f (IdPart _ : xs) es = inside f xs es inside f (_ : xs) (e : es) = do e <- toAbsOpArg InsideOperandCtx e es <- inside f xs es return (e : es) inside _ (_ : _) [] = __IMPOSSIBLE__ inside _ [] _ = __IMPOSSIBLE__ -- The hole right of the last @IdPart@ is filled with an expression in @RightOperandCtx@. right _ (IdPart _) [] = return [] right f _ [e] = do e <- toAbsOpArg (RightOperandCtx f) e return [e] right _ _ _ = __IMPOSSIBLE__ Agda-2.4.2.5/src/full/Agda/Syntax/Translation/AbstractToConcrete.hs0000644000000000000000000011332112635075266023157 0ustar0000000000000000{-# LANGUAGE CPP #-} {-# LANGUAGE FlexibleInstances #-} {-# LANGUAGE FunctionalDependencies #-} {-# LANGUAGE MultiParamTypeClasses #-} {-# LANGUAGE PatternGuards #-} {-# LANGUAGE TupleSections #-} {-# LANGUAGE UndecidableInstances #-} -- {-# OPTIONS -fwarn-unused-binds #-} {-| The translation of abstract syntax to concrete syntax has two purposes. First it allows us to pretty print abstract syntax values without having to write a dedicated pretty printer, and second it serves as a sanity check for the concrete to abstract translation: translating from concrete to abstract and then back again should be (more or less) the identity. -} module Agda.Syntax.Translation.AbstractToConcrete ( ToConcrete(..) , toConcreteCtx , abstractToConcrete_ , abstractToConcreteEnv , runAbsToCon , RangeAndPragma(..) , abstractToConcreteCtx , withScope , makeEnv , AbsToCon, DontTouchMe, Env , noTakenNames ) where import Prelude hiding (null) import Control.Applicative hiding (empty) import Control.Monad.Reader import Data.List as List hiding (null) import qualified Data.Map as Map import Data.Maybe import Data.Monoid import Data.Set (Set) import qualified Data.Set as Set import Data.Traversable (traverse) import Agda.Syntax.Common hiding (Arg, Dom, NamedArg) import qualified Agda.Syntax.Common as Common import Agda.Syntax.Position import Agda.Syntax.Literal import Agda.Syntax.Info import Agda.Syntax.Internal (MetaId(..)) import Agda.Syntax.Fixity import Agda.Syntax.Concrete as C import Agda.Syntax.Abstract as A import Agda.Syntax.Abstract.Views as AV import Agda.Syntax.Scope.Base import Agda.TypeChecking.Monad.State (getScope) import Agda.TypeChecking.Monad.Base (TCM, NamedMeta(..)) import Agda.TypeChecking.Monad.Options import qualified Agda.Utils.AssocList as AssocList import Agda.Utils.Functor import Agda.Utils.Monad import Agda.Utils.Null import Agda.Utils.Tuple import Agda.Utils.Pretty (prettyShow) #include "undefined.h" import Agda.Utils.Impossible -- Environment ------------------------------------------------------------ data Env = Env { takenNames :: Set C.Name , currentScope :: ScopeInfo } defaultEnv :: Env defaultEnv = Env { takenNames = Set.empty , currentScope = emptyScopeInfo } makeEnv :: ScopeInfo -> Env makeEnv scope = Env { takenNames = Set.union vars defs , currentScope = scope } where vars = Set.fromList $ map fst $ scopeLocals scope defs = Map.keysSet $ nsNames $ everythingInScope scope currentPrecedence :: AbsToCon Precedence currentPrecedence = asks $ scopePrecedence . currentScope withPrecedence :: Precedence -> AbsToCon a -> AbsToCon a withPrecedence p = local $ \e -> e { currentScope = (currentScope e) { scopePrecedence = p } } withScope :: ScopeInfo -> AbsToCon a -> AbsToCon a withScope scope = local $ \e -> e { currentScope = scope } noTakenNames :: AbsToCon a -> AbsToCon a noTakenNames = local $ \e -> e { takenNames = Set.empty } -- The Monad -------------------------------------------------------------- -- | We put the translation into TCM in order to print debug messages. type AbsToCon = ReaderT Env TCM runAbsToCon :: AbsToCon c -> TCM c runAbsToCon m = do scope <- getScope runReaderT m (makeEnv scope) abstractToConcreteEnv :: ToConcrete a c => Env -> a -> TCM c abstractToConcreteEnv flags a = runReaderT (toConcrete a) flags abstractToConcreteCtx :: ToConcrete a c => Precedence -> a -> TCM c abstractToConcreteCtx ctx x = do scope <- getScope let scope' = scope { scopePrecedence = ctx } abstractToConcreteEnv (makeEnv scope') x abstractToConcrete_ :: ToConcrete a c => a -> TCM c abstractToConcrete_ = runAbsToCon . toConcrete -- Dealing with names ----------------------------------------------------- -- | Names in abstract syntax are fully qualified, but the concrete syntax -- requires non-qualified names in places. In theory (if all scopes are -- correct), we should get a non-qualified name when translating back to a -- concrete name, but I suspect the scope isn't always perfect. In these -- cases we just throw away the qualified part. It's just for pretty printing -- anyway... unsafeQNameToName :: C.QName -> C.Name unsafeQNameToName = C.unqualify lookupName :: A.Name -> AbsToCon C.Name lookupName x = do names <- asks $ scopeLocals . currentScope case lookup x $ mapMaybe (\ (c,x) -> (,c) <$> notShadowedLocal x) names of Just y -> return y Nothing -> return $ nameConcrete x lookupQName :: AllowAmbiguousConstructors -> A.QName -> AbsToCon C.QName lookupQName ambCon x = do ys <- inverseScopeLookupName' ambCon x <$> asks currentScope lift $ reportSLn "scope.inverse" 100 $ "inverse looking up abstract name " ++ show x ++ " yields " ++ show ys case ys of (y : _) -> return y [] -> do let y = qnameToConcrete x if isUnderscore y then return y else return $ C.Qual (C.Name noRange [Id empty]) y -- this is what happens for names that are not in scope (private names) lookupModule :: A.ModuleName -> AbsToCon C.QName lookupModule x = do scope <- asks currentScope case inverseScopeLookupModule x scope of (y : _) -> return y [] -> return $ mnameToConcrete x -- this is what happens for names that are not in scope (private names) bindName :: A.Name -> (C.Name -> AbsToCon a) -> AbsToCon a bindName x ret = do names <- asks takenNames let y = nameConcrete x case (Set.member y names) of _ | isNoName y -> ret y True -> bindName (nextName x) ret False -> local (\e -> e { takenNames = Set.insert y $ takenNames e , currentScope = (`updateScopeLocals` currentScope e) $ AssocList.insert y (LocalVar x) } ) $ ret y -- Dealing with precedences ----------------------------------------------- -- | General bracketing function. bracket' :: (e -> e) -- ^ the bracketing function -> (Precedence -> Bool) -- ^ Should we bracket things -- which have the given -- precedence? -> e -> AbsToCon e bracket' paren needParen e = do p <- currentPrecedence return $ if needParen p then paren e else e -- | Expression bracketing bracket :: (Precedence -> Bool) -> AbsToCon C.Expr -> AbsToCon C.Expr bracket par m = do e <- m bracket' (Paren (getRange e)) par e -- | Pattern bracketing bracketP_ :: (Precedence -> Bool) -> AbsToCon C.Pattern -> AbsToCon C.Pattern bracketP_ par m = do e <- m bracket' (ParenP (getRange e)) par e {- UNUSED -- | Pattern bracketing bracketP :: (Precedence -> Bool) -> (C.Pattern -> AbsToCon a) -> ((C.Pattern -> AbsToCon a) -> AbsToCon a) -> AbsToCon a bracketP par ret m = m $ \p -> do p <- bracket' (ParenP $ getRange p) par p ret p -} -- Dealing with infix declarations ---------------------------------------- -- | If a name is defined with a fixity that differs from the default, we have -- to generate a fixity declaration for that name. withInfixDecl :: DefInfo -> C.Name -> AbsToCon [C.Declaration] -> AbsToCon [C.Declaration] withInfixDecl i x m = do ds <- m return $ fixDecl ++ synDecl ++ ds where fixDecl = [C.Infix (theFixity $ defFixity i) [x] | theFixity (defFixity i) /= defaultFixity] synDecl = [C.Syntax x (theNotation (defFixity i))] {- UNUSED withInfixDecls :: [(DefInfo, C.Name)] -> AbsToCon [C.Declaration] -> AbsToCon [C.Declaration] withInfixDecls = foldr (.) id . map (uncurry withInfixDecl) -} -- Dealing with private definitions --------------------------------------- withAbstractPrivate :: DefInfo -> AbsToCon [C.Declaration] -> AbsToCon [C.Declaration] withAbstractPrivate i m = case (defAccess i, defAbstract i) of (PublicAccess, ConcreteDef) -> m (p,a) -> do ds <- m return $ abst a $ priv p $ ds where priv PrivateAccess ds = [ C.Private (getRange ds) ds ] priv _ ds = ds abst AbstractDef ds = [ C.Abstract (getRange ds) ds ] abst _ ds = ds -- The To Concrete Class -------------------------------------------------- class ToConcrete a c | a -> c where toConcrete :: a -> AbsToCon c bindToConcrete :: a -> (c -> AbsToCon b) -> AbsToCon b toConcrete x = bindToConcrete x return bindToConcrete x ret = ret =<< toConcrete x -- | Translate something in a context of the given precedence. toConcreteCtx :: ToConcrete a c => Precedence -> a -> AbsToCon c toConcreteCtx p x = withPrecedence p $ toConcrete x -- | Translate something in a context of the given precedence. bindToConcreteCtx :: ToConcrete a c => Precedence -> a -> (c -> AbsToCon b) -> AbsToCon b bindToConcreteCtx p x ret = withPrecedence p $ bindToConcrete x ret -- | Translate something in the top context. toConcreteTop :: ToConcrete a c => a -> AbsToCon c toConcreteTop = toConcreteCtx TopCtx -- | Translate something in the top context. bindToConcreteTop :: ToConcrete a c => a -> (c -> AbsToCon b) -> AbsToCon b bindToConcreteTop = bindToConcreteCtx TopCtx -- | Translate something in a context indicated by 'Hiding' info. toConcreteHiding :: (LensHiding h, ToConcrete a c) => h -> a -> AbsToCon c toConcreteHiding h = case getHiding h of NotHidden -> toConcrete Hidden -> toConcreteTop Instance -> toConcreteTop -- | Translate something in a context indicated by 'Hiding' info. bindToConcreteHiding :: (LensHiding h, ToConcrete a c) => h -> a -> (c -> AbsToCon b) -> AbsToCon b bindToConcreteHiding h = case getHiding h of NotHidden -> bindToConcrete Hidden -> bindToConcreteTop Instance -> bindToConcreteTop -- General instances ------------------------------------------------------ instance ToConcrete a c => ToConcrete [a] [c] where toConcrete = mapM toConcrete bindToConcrete = thread bindToConcrete instance (ToConcrete a1 c1, ToConcrete a2 c2) => ToConcrete (a1,a2) (c1,c2) where toConcrete (x,y) = liftM2 (,) (toConcrete x) (toConcrete y) bindToConcrete (x,y) ret = bindToConcrete x $ \x -> bindToConcrete y $ \y -> ret (x,y) instance (ToConcrete a1 c1, ToConcrete a2 c2, ToConcrete a3 c3) => ToConcrete (a1,a2,a3) (c1,c2,c3) where toConcrete (x,y,z) = reorder <$> toConcrete (x,(y,z)) where reorder (x,(y,z)) = (x,y,z) bindToConcrete (x,y,z) ret = bindToConcrete (x,(y,z)) $ ret . reorder where reorder (x,(y,z)) = (x,y,z) instance ToConcrete (Common.ArgInfo ac) C.ArgInfo where toConcrete info = -- do cs <- mapM toConcrete $ argInfoColors info return $ info { argInfoColors = [] } -- TODO: zapping ignoring colours instance ToConcrete a c => ToConcrete (Common.Arg ac a) (C.Arg c) where toConcrete (Common.Arg info x) = Common.Arg <$> toConcrete info <*> toConcreteHiding info x bindToConcrete (Common.Arg info x) ret = do info <- toConcrete info bindToConcreteCtx (hiddenArgumentCtx $ getHiding info) x $ ret . Common.Arg info instance ToConcrete a c => ToConcrete (WithHiding a) (WithHiding c) where toConcrete (WithHiding h a) = WithHiding h <$> toConcreteHiding h a bindToConcrete (WithHiding h a) ret = bindToConcreteHiding h a $ \ a -> ret $ WithHiding h a instance ToConcrete a c => ToConcrete (Named name a) (Named name c) where toConcrete (Named n x) = Named n <$> toConcrete x bindToConcrete (Named n x) ret = bindToConcrete x $ ret . Named n newtype DontTouchMe a = DontTouchMe a instance ToConcrete (DontTouchMe a) a where toConcrete (DontTouchMe x) = return x -- Names ------------------------------------------------------------------ instance ToConcrete A.Name C.Name where toConcrete = lookupName bindToConcrete x = bindName x instance ToConcrete A.QName C.QName where toConcrete = lookupQName AllowAmbiguousConstructors instance ToConcrete A.ModuleName C.QName where toConcrete = lookupModule -- Expression instance ---------------------------------------------------- instance ToConcrete A.Expr C.Expr where toConcrete (Var x) = Ident . C.QName <$> toConcrete x toConcrete (Def x) = Ident <$> toConcrete x toConcrete (Proj x) = Ident <$> toConcrete x toConcrete (Con (AmbQ (x:_))) = Ident <$> toConcrete x toConcrete (Con (AmbQ [])) = __IMPOSSIBLE__ -- for names we have to use the name from the info, since the abstract -- name has been resolved to a fully qualified name (except for -- variables) toConcrete (A.Lit (LitQName r x)) = do x <- lookupQName NoAmbiguousConstructors x bracket appBrackets $ return $ C.App r (C.Quote r) (defaultNamedArg $ C.Ident x) toConcrete (A.Lit l) = return $ C.Lit l -- Andreas, 2014-05-17 We print question marks with their -- interaction id, in case @metaNumber /= Nothing@ toConcrete (A.QuestionMark i ii)= return $ C.QuestionMark (getRange i) $ interactionId ii <$ metaNumber i toConcrete (A.Underscore i) = return $ C.Underscore (getRange i) $ prettyShow . NamedMeta (metaNameSuggestion i) . MetaId . metaId <$> metaNumber i toConcrete e@(A.App i e1 e2) = tryToRecoverOpApp e -- or fallback to App $ bracket appBrackets $ do e1' <- toConcreteCtx FunctionCtx e1 e2' <- toConcreteCtx ArgumentCtx e2 return $ C.App (getRange i) e1' e2' toConcrete (A.WithApp i e es) = bracket withAppBrackets $ do e <- toConcreteCtx WithFunCtx e es <- mapM (toConcreteCtx WithArgCtx) es return $ C.WithApp (getRange i) e es toConcrete (A.AbsurdLam i h) = bracket lamBrackets $ return $ C.AbsurdLam (getRange i) h toConcrete e@(A.Lam i _ _) = bracket lamBrackets $ case lamView e of (bs, e) -> bindToConcrete (map makeDomainFree bs) $ \bs -> do e <- toConcreteTop e return $ C.Lam (getRange i) (concat bs) e where lamView (A.Lam _ b@(A.DomainFree _ _) e) = case lamView e of ([], e) -> ([b], e) (bs@(A.DomainFree _ _ : _), e) -> (b:bs, e) _ -> ([b], e) lamView (A.Lam _ b@(A.DomainFull _) e) = case lamView e of ([], e) -> ([b], e) (bs@(A.DomainFull _ : _), e) -> (b:bs, e) _ -> ([b], e) lamView e = ([], e) toConcrete (A.ExtendedLam i di qname cs) = bracket lamBrackets $ do decls <- concat <$> toConcrete cs let namedPat np = case getHiding np of NotHidden -> namedArg np Hidden -> C.HiddenP noRange (unArg np) Instance -> C.InstanceP noRange (unArg np) -- we know all lhs are of the form `.extlam p1 p2 ... pn`, -- with the name .extlam leftmost. It is our mission to remove it. let removeApp (C.RawAppP r (_:es)) = return $ C.RawAppP r es removeApp (C.AppP (C.IdentP _) np) = return $ namedPat np removeApp (C.AppP p np) = do p <- removeApp p return $ C.AppP p np removeApp p = do lift $ reportSLn "extendedlambda" 50 $ "abstractToConcrete removeApp p = " ++ show p return p -- __IMPOSSIBLE__ -- Andreas, this is actually not impossible, my strictification exposed this sleeping bug let decl2clause (C.FunClause lhs rhs wh) = do let p = lhsOriginalPattern lhs lift $ reportSLn "extendedlambda" 50 $ "abstractToConcrete extended lambda pattern p = " ++ show p p' <- removeApp p lift $ reportSLn "extendedlambda" 50 $ "abstractToConcrete extended lambda pattern p' = " ++ show p' return (lhs{ lhsOriginalPattern = p' }, rhs, wh) decl2clause _ = __IMPOSSIBLE__ C.ExtendedLam (getRange i) <$> mapM decl2clause decls toConcrete (A.Pi _ [] e) = toConcrete e toConcrete t@(A.Pi i _ _) = case piTel t of (tel, e) -> bracket piBrackets $ bindToConcrete tel $ \b' -> do e' <- toConcreteTop e return $ C.Pi (concat b') e' where piTel (A.Pi _ tel e) = (tel ++) -*- id $ piTel e piTel e = ([], e) toConcrete (A.Fun i a b) = bracket piBrackets $ do a' <- toConcreteCtx (if irr then DotPatternCtx else FunctionSpaceDomainCtx) a b' <- toConcreteTop b return $ C.Fun (getRange i) (addRel a' $ mkArg a') b' where irr = getRelevance a `elem` [Irrelevant, NonStrict] addRel a e = case getRelevance a of Irrelevant -> addDot a e NonStrict -> addDot a (addDot a e) _ -> e addDot a e = Dot (getRange a) e mkArg (Common.Arg info e) = case getHiding info of Hidden -> HiddenArg (getRange e) (unnamed e) Instance -> InstanceArg (getRange e) (unnamed e) NotHidden -> e toConcrete (A.Set i 0) = return $ C.Set (getRange i) toConcrete (A.Set i n) = return $ C.SetN (getRange i) n toConcrete (A.Prop i) = return $ C.Prop (getRange i) toConcrete (A.Let i ds e) = bracket lamBrackets $ bindToConcrete ds $ \ds' -> do e' <- toConcreteTop e return $ C.Let (getRange i) (concat ds') e' toConcrete (A.Rec i fs) = bracket appBrackets $ do let (xs, es) = unzip fs es <- toConcreteTop es return $ C.Rec (getRange i) $ zip xs es toConcrete (A.RecUpdate i e fs) = bracket appBrackets $ do let (xs, es) = unzip fs e <- toConcrete e es <- toConcreteTop es return $ C.RecUpdate (getRange i) e $ zip xs es toConcrete (A.ETel tel) = do tel <- concat <$> toConcrete tel return $ C.ETel tel toConcrete (A.ScopedExpr _ e) = toConcrete e toConcrete (A.QuoteGoal i x e) = bracket lamBrackets $ bindToConcrete x $ \ x' -> do e' <- toConcrete e return $ C.QuoteGoal (getRange i) x' e' toConcrete (A.QuoteContext i x e) = bracket lamBrackets $ bindToConcrete x $ \ x' -> do e' <- toConcrete e return $ C.QuoteContext (getRange i) x' e' toConcrete (A.Quote i) = return $ C.Quote (getRange i) toConcrete (A.QuoteTerm i) = return $ C.QuoteTerm (getRange i) toConcrete (A.Unquote i) = return $ C.Unquote (getRange i) -- Andreas, 2012-04-02: TODO! print DontCare as irrAxiom -- Andreas, 2010-10-05 print irrelevant things as ordinary things toConcrete (A.DontCare e) = C.Dot r . C.Paren r <$> toConcrete e where r = getRange e -- toConcrete (A.DontCare e) = C.DontCare <$> toConcreteTop e {- -- Andreas, 2010-09-21 abuse C.Underscore to print irrelevant things toConcrete (A.DontCare) = return $ C.Underscore noRange Nothing -} toConcrete (A.PatternSyn n) = C.Ident <$> toConcrete n makeDomainFree :: A.LamBinding -> A.LamBinding makeDomainFree b@(A.DomainFull (A.TypedBindings r (Common.Arg info (A.TBind _ [WithHiding h x] t)))) = case unScope t of A.Underscore MetaInfo{metaNumber = Nothing} -> A.DomainFree (mapHiding (mappend h) info) x _ -> b makeDomainFree b = b -- Binder instances ------------------------------------------------------- instance ToConcrete A.LamBinding [C.LamBinding] where bindToConcrete (A.DomainFree info x) ret = do info <- toConcrete info bindToConcrete x $ ret . (:[]) . C.DomainFree info . mkBoundName_ bindToConcrete (A.DomainFull b) ret = bindToConcrete b $ ret . map C.DomainFull instance ToConcrete A.TypedBindings [C.TypedBindings] where bindToConcrete (A.TypedBindings r bs) ret = bindToConcrete bs $ \cbs -> ret (map (C.TypedBindings r) $ recoverLabels bs cbs) where recoverLabels :: A.Arg A.TypedBinding -> C.Arg C.TypedBinding -> [C.Arg C.TypedBinding] recoverLabels b cb | getHiding b == NotHidden = [cb] -- We don't care about labels for explicit args | otherwise = traverse (recover (unArg b)) cb recover (A.TBind _ xs _) (C.TBind r ys e) = tbind r e (zipWith label xs ys) recover A.TLet{} c@C.TLet{} = [c] recover _ _ = __IMPOSSIBLE__ tbinds r e [] = [] tbinds r e xs = [ C.TBind r xs e ] tbind r e xs = case span ((\ x -> boundLabel x == boundName x) . dget) xs of (xs, x:ys) -> tbinds r e xs ++ [ C.TBind r [x] e ] ++ tbind r e ys (xs, []) -> tbinds r e xs label x = fmap $ \ y -> y { boundLabel = nameConcrete $ dget x } instance ToConcrete A.TypedBinding C.TypedBinding where bindToConcrete (A.TBind r xs e) ret = bindToConcrete xs $ \ xs -> do e <- toConcreteTop e ret $ C.TBind r (map (fmap mkBoundName_) xs) e bindToConcrete (A.TLet r lbs) ret = bindToConcrete lbs $ \ ds -> do ret $ C.TLet r $ concat ds instance ToConcrete LetBinding [C.Declaration] where bindToConcrete (LetBind i info x t e) ret = bindToConcrete x $ \x -> do (t,(e, [], [], [])) <- toConcrete (t, A.RHS e) info <- toConcrete info ret [ C.TypeSig info x t , C.FunClause (C.LHS (C.IdentP $ C.QName x) [] [] []) e C.NoWhere ] -- TODO: bind variables bindToConcrete (LetPatBind i p e) ret = do p <- toConcrete p e <- toConcrete e ret [ C.FunClause (C.LHS p [] [] []) (C.RHS e) NoWhere ] bindToConcrete (LetApply i x modapp _ _) ret = do x' <- unqualify <$> toConcrete x modapp <- toConcrete modapp let r = getRange modapp open = maybe DontOpen id $ minfoOpenShort i dir = maybe defaultImportDir{ importDirRange = r } id $ minfoDirective i -- This is no use since toAbstract LetDefs is in localToAbstract. local (openModule' x dir id) $ ret [ C.ModuleMacro (getRange i) x' modapp open dir ] bindToConcrete (LetOpen i x) ret = do x' <- toConcrete x let dir = maybe defaultImportDir id $ minfoDirective i local (openModule' x dir restrictPrivate) $ ret [ C.Open (getRange i) x' dir ] data AsWhereDecls = AsWhereDecls [A.Declaration] instance ToConcrete AsWhereDecls WhereClause where bindToConcrete (AsWhereDecls []) ret = ret C.NoWhere bindToConcrete (AsWhereDecls ds@[Section _ am _ _]) ret = do ds' <- declsToConcrete ds cm <- unqualify <$> lookupModule am let wh' = (if isNoName cm then AnyWhere else SomeWhere cm) $ ds' local (openModule' am defaultImportDir id) $ ret wh' bindToConcrete (AsWhereDecls ds) ret = ret . AnyWhere =<< declsToConcrete ds mergeSigAndDef :: [C.Declaration] -> [C.Declaration] mergeSigAndDef (C.RecordSig _ x bs e : C.Record r y ind c _ Nothing fs : ds) | x == y = C.Record r y ind c bs (Just e) fs : mergeSigAndDef ds mergeSigAndDef (C.DataSig _ _ x bs e : C.Data r i y _ Nothing cs : ds) | x == y = C.Data r i y bs (Just e) cs : mergeSigAndDef ds mergeSigAndDef (d : ds) = d : mergeSigAndDef ds mergeSigAndDef [] = [] openModule' :: A.ModuleName -> ImportDirective -> (Scope -> Scope) -> Env -> Env openModule' x dir restrict env = env{currentScope = sInfo{scopeModules = mods'}} where sInfo = currentScope env amod = scopeCurrent sInfo mods = scopeModules sInfo news = setScopeAccess PrivateNS $ applyImportDirective dir $ maybe emptyScope restrict $ Map.lookup x mods mods' = Map.update (Just . (`mergeScope` news)) amod mods -- Declaration instances -------------------------------------------------- declsToConcrete :: [A.Declaration] -> AbsToCon [C.Declaration] declsToConcrete ds = mergeSigAndDef . concat <$> toConcrete ds instance ToConcrete A.RHS (C.RHS, [C.Expr], [C.Expr], [C.Declaration]) where toConcrete (A.RHS e) = do e <- toConcrete e return (C.RHS e, [], [], []) toConcrete A.AbsurdRHS = return (C.AbsurdRHS, [], [], []) toConcrete (A.WithRHS _ es cs) = do es <- toConcrete es cs <- concat <$> toConcrete cs return (C.AbsurdRHS, [], es, cs) toConcrete (A.RewriteRHS xeqs rhs wh) = do wh <- declsToConcrete wh (rhs, eqs', es, whs) <- toConcrete rhs unless (null eqs') __IMPOSSIBLE__ eqs <- toConcrete $ map snd xeqs return (rhs, eqs, es, wh ++ whs) instance ToConcrete (Maybe A.QName) (Maybe C.Name) where toConcrete Nothing = return Nothing toConcrete (Just x) = do x' <- toConcrete (qnameName x) return $ Just x' {- UNUSED -- | Helper function used in instance @ToConcrete Definition@. telToTypedBindingss :: [C.LamBinding] -> [C.TypedBindings] telToTypedBindingss = map lamBindingToTypedBindings where lamBindingToTypedBindings :: C.LamBinding -> C.TypedBindings lamBindingToTypedBindings b = case b of C.DomainFull t -> t C.DomainFree info n -> C.TypedBindings noRange $ Common.Arg info $ C.TBind noRange [n] $ C.Underscore noRange Nothing -} instance ToConcrete (Constr A.Constructor) C.Declaration where toConcrete (Constr (A.ScopedDecl scope [d])) = withScope scope $ toConcrete (Constr d) toConcrete (Constr (A.Axiom _ i info x t)) = do x' <- unsafeQNameToName <$> toConcrete x t' <- toConcreteTop t info <- toConcrete info return $ C.TypeSig info x' t' toConcrete (Constr d) = head <$> toConcrete d instance ToConcrete a C.LHS => ToConcrete (A.Clause' a) [C.Declaration] where toConcrete (A.Clause lhs rhs wh) = bindToConcrete lhs $ \lhs -> case lhs of C.LHS p wps _ _ -> do bindToConcrete (AsWhereDecls wh) $ \wh' -> do (rhs', eqs, with, wcs) <- toConcreteTop rhs return $ FunClause (C.LHS p wps eqs with) rhs' wh' : wcs C.Ellipsis {} -> __IMPOSSIBLE__ -- TODO: Is the case above impossible? Previously there was -- no code for it, but GHC 7's completeness checker spotted -- that the case was not covered. instance ToConcrete A.ModuleApplication C.ModuleApplication where toConcrete (A.SectionApp tel y es) = do y <- toConcreteCtx FunctionCtx y bindToConcrete tel $ \tel -> do es <- toConcreteCtx ArgumentCtx es let r = fuseRange y es return $ C.SectionApp r (concat tel) (foldl (C.App r) (C.Ident y) es) toConcrete (A.RecordModuleIFS recm) = do recm <- toConcrete recm return $ C.RecordModuleIFS (getRange recm) recm instance ToConcrete A.Declaration [C.Declaration] where toConcrete (ScopedDecl scope ds) = withScope scope (declsToConcrete ds) toConcrete (Axiom _ i info x t) = do x' <- unsafeQNameToName <$> toConcrete x withAbstractPrivate i $ withInfixDecl i x' $ do t' <- toConcreteTop t info <- toConcrete info return [C.Postulate (getRange i) [C.TypeSig info x' t']] toConcrete (A.Field i x t) = do x' <- unsafeQNameToName <$> toConcrete x withAbstractPrivate i $ withInfixDecl i x' $ do t' <- toConcreteTop t return [C.Field x' t'] toConcrete (A.Primitive i x t) = do x' <- unsafeQNameToName <$> toConcrete x withAbstractPrivate i $ withInfixDecl i x' $ do t' <- toConcreteTop t return [C.Primitive (getRange i) [C.TypeSig defaultArgInfo x' t']] -- Primitives are always relevant. toConcrete (A.FunDef i _ _ cs) = withAbstractPrivate i $ concat <$> toConcrete cs toConcrete (A.DataSig i x bs t) = withAbstractPrivate i $ bindToConcrete bs $ \tel' -> do x' <- unsafeQNameToName <$> toConcrete x t' <- toConcreteTop t return [ C.DataSig (getRange i) Inductive x' (map C.DomainFull $ concat tel') t' ] toConcrete (A.DataDef i x bs cs) = withAbstractPrivate i $ bindToConcrete (map makeDomainFree bs) $ \tel' -> do (x',cs') <- (unsafeQNameToName -*- id) <$> toConcrete (x, map Constr cs) return [ C.Data (getRange i) Inductive x' (concat tel') Nothing cs' ] toConcrete (A.RecSig i x bs t) = withAbstractPrivate i $ bindToConcrete bs $ \tel' -> do x' <- unsafeQNameToName <$> toConcrete x t' <- toConcreteTop t return [ C.RecordSig (getRange i) x' (map C.DomainFull $ concat tel') t' ] toConcrete (A.RecDef i x ind c bs t cs) = withAbstractPrivate i $ bindToConcrete (map makeDomainFree bs) $ \tel' -> do (x',cs') <- (unsafeQNameToName -*- id) <$> toConcrete (x, map Constr cs) return [ C.Record (getRange i) x' ind Nothing (concat tel') Nothing cs' ] toConcrete (A.Mutual i ds) = declsToConcrete ds toConcrete (A.Section i x tel ds) = do x <- toConcrete x bindToConcrete tel $ \tel -> do ds <- declsToConcrete ds return [ C.Module (getRange i) x (concat tel) ds ] toConcrete (A.Apply i x modapp _ _) = do x <- unsafeQNameToName <$> toConcrete x modapp <- toConcrete modapp let r = getRange modapp open = fromMaybe DontOpen $ minfoOpenShort i dir = fromMaybe defaultImportDir{ importDirRange = r } $ minfoDirective i return [ C.ModuleMacro (getRange i) x modapp open dir ] toConcrete (A.Import i x) = do x <- toConcrete x let open = maybe DontOpen id $ minfoOpenShort i dir = maybe defaultImportDir id $ minfoDirective i return [ C.Import (getRange i) x Nothing open dir] toConcrete (A.Pragma i p) = do p <- toConcrete $ RangeAndPragma (getRange i) p return [C.Pragma p] toConcrete (A.Open i x) = do x <- toConcrete x return [C.Open (getRange i) x defaultImportDir] toConcrete (A.PatternSynDef x xs p) = do C.QName x <- toConcrete x bindToConcrete xs $ \xs -> (:[]) . C.PatternSyn (getRange x) x xs <$> toConcrete p toConcrete (A.UnquoteDecl _ i x e) = do C.QName x <- toConcrete x (:[]) . C.UnquoteDecl (getRange i) x <$> toConcrete e data RangeAndPragma = RangeAndPragma Range A.Pragma instance ToConcrete RangeAndPragma C.Pragma where toConcrete (RangeAndPragma r p) = case p of A.OptionsPragma xs -> return $ C.OptionsPragma r xs A.BuiltinPragma b e -> C.BuiltinPragma r b <$> toConcrete e A.BuiltinNoDefPragma b x -> C.BuiltinPragma r b . C.Ident <$> toConcrete x A.RewritePragma x -> C.RewritePragma r <$> toConcrete x A.CompiledTypePragma x hs -> do x <- toConcrete x return $ C.CompiledTypePragma r x hs A.CompiledDataPragma x hs hcs -> do x <- toConcrete x return $ C.CompiledDataPragma r x hs hcs A.CompiledPragma x hs -> do x <- toConcrete x return $ C.CompiledPragma r x hs A.CompiledExportPragma x hs -> do x <- toConcrete x return $ C.CompiledExportPragma r x hs A.CompiledEpicPragma x e -> do x <- toConcrete x return $ C.CompiledEpicPragma r x e A.CompiledJSPragma x e -> do x <- toConcrete x return $ C.CompiledJSPragma r x e A.StaticPragma x -> C.StaticPragma r <$> toConcrete x A.EtaPragma x -> C.EtaPragma r <$> toConcrete x -- Left hand sides -------------------------------------------------------- noImplicitArgs :: A.Patterns -> A.Patterns noImplicitArgs = filter (noImplicit . namedArg) noImplicitPats :: [A.Pattern] -> [A.Pattern] noImplicitPats = filter noImplicit noImplicit :: A.Pattern -> Bool noImplicit (A.WildP _) = False noImplicit _ = True instance ToConcrete A.SpineLHS C.LHS where bindToConcrete lhs = bindToConcrete (A.spineToLhs lhs :: A.LHS) instance ToConcrete A.LHS C.LHS where bindToConcrete (A.LHS i lhscore wps) ret = do bindToConcreteCtx TopCtx lhscore $ \lhs -> bindToConcreteCtx TopCtx (noImplicitPats wps) $ \wps -> ret $ C.LHS lhs wps [] [] instance ToConcrete A.LHSCore C.Pattern where bindToConcrete = bindToConcrete . lhsCoreToPattern appBrackets' :: [arg] -> Precedence -> Bool appBrackets' [] _ = False appBrackets' (_:_) ctx = appBrackets ctx -- TODO: bind variables properly instance ToConcrete A.Pattern C.Pattern where toConcrete (VarP x) = toConcrete x >>= return . IdentP . C.QName toConcrete (A.WildP i) = return $ C.WildP (getRange i) toConcrete (ConP i (AmbQ []) args) = __IMPOSSIBLE__ toConcrete p@(ConP i (AmbQ (x:_)) args) = tryToRecoverOpAppP p $ bracketP_ (appBrackets' args) $ do x <- toConcrete x args <- toConcreteCtx ArgumentCtx (noImplicitArgs args) return $ foldl AppP (C.IdentP x) args toConcrete p@(DefP i x args) = tryToRecoverOpAppP p $ bracketP_ (appBrackets' args) $ do x <- toConcrete x args <- toConcreteCtx ArgumentCtx (noImplicitArgs args) return $ foldl AppP (C.IdentP x) args toConcrete (A.AsP i x p) = do (x, p) <- toConcreteCtx ArgumentCtx (x,p) return $ C.AsP (getRange i) x p toConcrete (A.AbsurdP i) = return $ C.AbsurdP (getRange i) toConcrete (A.LitP (LitQName r x)) = do x <- lookupQName NoAmbiguousConstructors x bracketP_ appBrackets $ return $ AppP (C.QuoteP r) (defaultNamedArg (C.IdentP x)) toConcrete (A.LitP l) = return $ C.LitP l toConcrete (A.DotP i e) = do e <- toConcreteCtx DotPatternCtx e return $ C.DotP (getRange i) e toConcrete (A.PatternSynP i n _) = IdentP <$> toConcrete n -- Helpers for recovering C.OpApp ------------------------------------------ data Hd = HdVar A.Name | HdCon A.QName | HdDef A.QName cOpApp :: Range -> C.QName -> A.Name -> [C.Expr] -> C.Expr cOpApp r x n es = C.OpApp r x (Set.singleton n) (map (defaultNamedArg . Ordinary) es) tryToRecoverOpApp :: A.Expr -> AbsToCon C.Expr -> AbsToCon C.Expr tryToRecoverOpApp e def = recoverOpApp bracket cOpApp view e def where view e = do let Application hd args = AV.appView e case hd of Var x -> Just (HdVar x, args) Def f -> Just (HdDef f, args) Con (AmbQ (c:_)) -> Just (HdCon c, args) Con (AmbQ []) -> __IMPOSSIBLE__ _ -> Nothing tryToRecoverOpAppP :: A.Pattern -> AbsToCon C.Pattern -> AbsToCon C.Pattern tryToRecoverOpAppP p def = recoverOpApp bracketP_ opApp view p def where opApp r x n ps = C.OpAppP r x (Set.singleton n) (map defaultNamedArg ps) view p = case p of ConP _ (AmbQ (c:_)) ps -> Just (HdCon c, ps) DefP _ f ps -> Just (HdDef f, ps) _ -> Nothing recoverOpApp :: (ToConcrete a c, HasRange c) => ((Precedence -> Bool) -> AbsToCon c -> AbsToCon c) -> (Range -> C.QName -> A.Name -> [c] -> c) -> (a -> Maybe (Hd, [A.NamedArg a])) -> a -> AbsToCon c -> AbsToCon c recoverOpApp bracket opApp view e mDefault = case view e of Nothing -> mDefault Just (hd, args) | all notHidden args -> do let args' = map namedArg args case hd of HdVar n | isNoName n -> mDefault | otherwise -> doQNameHelper id C.QName n args' HdDef qn -> doQNameHelper qnameName id qn args' HdCon qn -> doQNameHelper qnameName id qn args' | otherwise -> mDefault where doQNameHelper fixityHelper conHelper n as = do x <- toConcrete n doQName (theFixity $ nameFixity n') (conHelper x) n' as where n' = fixityHelper n -- fall-back (wrong number of arguments or no holes) doQName _ x _ es | length xs == 1 = mDefault | length es /= numHoles = mDefault | null es = mDefault where xs = C.nameParts $ C.unqualify x numHoles = length (filter (== Hole) xs) -- binary case doQName fixity x n as | Hole <- head xs , Hole <- last xs = do let a1 = head as an = last as as' = case as of as@(_ : _ : _) -> init $ tail as _ -> __IMPOSSIBLE__ e1 <- toConcreteCtx (LeftOperandCtx fixity) a1 es <- mapM (toConcreteCtx InsideOperandCtx) as' en <- toConcreteCtx (RightOperandCtx fixity) an bracket (opBrackets fixity) $ return $ opApp (getRange (e1, en)) x n ([e1] ++ es ++ [en]) where xs = C.nameParts $ C.unqualify x -- prefix doQName fixity x n as | Hole <- last xs = do let an = last as as' = case as of as@(_ : _) -> init as _ -> __IMPOSSIBLE__ es <- mapM (toConcreteCtx InsideOperandCtx) as' en <- toConcreteCtx (RightOperandCtx fixity) an bracket (opBrackets fixity) $ return $ opApp (getRange (n, en)) x n (es ++ [en]) where xs = C.nameParts $ C.unqualify x -- postfix doQName fixity x n as | Hole <- head xs = do let a1 = head as as' = tail as e1 <- toConcreteCtx (LeftOperandCtx fixity) a1 es <- mapM (toConcreteCtx InsideOperandCtx) as' bracket (opBrackets fixity) $ return $ opApp (getRange (e1, n)) x n ([e1] ++ es) where xs = C.nameParts $ C.unqualify x -- roundfix doQName _ x n as = do es <- mapM (toConcreteCtx InsideOperandCtx) as bracket roundFixBrackets $ return $ opApp (getRange x) x n es -- Some instances that are related to interaction with users ----------- instance ToConcrete InteractionId C.Expr where toConcrete (InteractionId i) = return $ C.QuestionMark noRange (Just i) instance ToConcrete NamedMeta C.Expr where toConcrete i = do return $ C.Underscore noRange (Just $ prettyShow i) Agda-2.4.2.5/src/full/Agda/Syntax/Translation/InternalToAbstract.hs0000644000000000000000000011565312635075266023203 0ustar0000000000000000{-# LANGUAGE CPP #-} {-# LANGUAGE FlexibleContexts #-} {-# LANGUAGE FlexibleInstances #-} {-# LANGUAGE FunctionalDependencies #-} {-# LANGUAGE MultiParamTypeClasses #-} {-# LANGUAGE ScopedTypeVariables #-} {-# LANGUAGE TupleSections #-} {-# LANGUAGE UndecidableInstances #-} {-| Translating from internal syntax to abstract syntax. Enables nice pretty printing of internal syntax. TODO - numbers on metas - fake dependent functions to independent functions - meta parameters - shadowing -} module Agda.Syntax.Translation.InternalToAbstract ( Reify(..) , NamedClause , reifyPatterns ) where import Prelude hiding (mapM_, mapM) import Control.Applicative import Control.Arrow import Control.Monad.State hiding (mapM_, mapM) import Control.Monad.Reader hiding (mapM_, mapM) import Data.Foldable (foldMap) import Data.List hiding (sort) import qualified Data.Map as Map import Data.Maybe import Data.Monoid import Data.Set (Set) import qualified Data.Set as Set import Data.Traversable as Trav import Agda.Syntax.Literal import Agda.Syntax.Position import Agda.Syntax.Common hiding (Arg, Dom, NamedArg, ArgInfo) import Agda.Syntax.Fixity import qualified Agda.Syntax.Common as Common import Agda.Syntax.Info as Info import Agda.Syntax.Abstract as A import Agda.Syntax.Internal as I import Agda.TypeChecking.Monad as M hiding (MetaInfo) import Agda.TypeChecking.Monad.Builtin import Agda.TypeChecking.Reduce import {-# SOURCE #-} Agda.TypeChecking.Records import Agda.TypeChecking.CompiledClause (CompiledClauses(Fail)) import Agda.TypeChecking.DisplayForm import Agda.TypeChecking.Level import {-# SOURCE #-} Agda.TypeChecking.Datatypes import Agda.TypeChecking.Free import Agda.TypeChecking.Substitute import Agda.TypeChecking.Telescope import Agda.TypeChecking.DropArgs import Agda.Utils.Except ( MonadError(catchError) ) import Agda.Utils.List import Agda.Utils.Maybe import Agda.Utils.Monad import Agda.Utils.Permutation import Agda.Utils.Size import Agda.Utils.Tuple #include "undefined.h" import Agda.Utils.Impossible -- Composition of reified applications ------------------------------------ napps :: Expr -> [I.NamedArg Expr] -> TCM Expr napps e args = do dontShowImp <- not <$> showImplicitArguments let apply1 e arg | notVisible arg && dontShowImp = e | otherwise = App exprInfo e arg foldl' apply1 e <$> reify args apps :: Expr -> [I.Arg Expr] -> TCM Expr apps e args = napps e $ map (fmap unnamed) args reifyApp :: Expr -> [I.Arg Term] -> TCM Expr reifyApp e vs = apps e =<< reifyIArgs vs reifyIArg :: Reify i a => I.Arg i -> TCM (I.Arg a) reifyIArg i = Common.Arg (argInfo i) <$> reify (unArg i) reifyIArgs :: Reify i a => [I.Arg i] -> TCM [I.Arg a] reifyIArgs = mapM reifyIArg reifyIArg' :: I.Arg e -> TCM (A.Arg e) reifyIArg' e = flip Common.Arg (unArg e) <$> reify (argInfo e) reifyIArgs' :: [I.Arg e] -> TCM [A.Arg e] reifyIArgs' = mapM reifyIArg' -- Composition of reified eliminations ------------------------------------ elims :: Expr -> [I.Elim' Expr] -> TCM Expr elims e [] = return e elims e (I.Apply arg : es) = do arg <- reifyIArg' arg elims (A.App exprInfo e $ fmap unnamed arg) es elims e (I.Proj d : es) = elims (A.App exprInfo (A.Proj d) $ defaultNamedArg e) es reifyIElim :: Reify i a => I.Elim' i -> TCM (I.Elim' a) reifyIElim (I.Apply i) = I.Apply <$> traverse reify i reifyIElim (I.Proj d) = return $ I.Proj d reifyIElims :: Reify i a => [I.Elim' i] -> TCM [I.Elim' a] reifyIElims = mapM reifyIElim -- Omitting information --------------------------------------------------- exprInfo :: ExprInfo exprInfo = ExprRange noRange -- Conditional reification to omit terms that are not shown -------------- reifyWhenE :: Reify i Expr => Bool -> i -> TCM Expr reifyWhenE True i = reify i reifyWhenE False t = return underscore -- Reification ------------------------------------------------------------ class Reify i a | i -> a where reify :: i -> TCM a -- @reifyWhen False@ should produce an 'underscore'. -- This function serves to reify hidden/irrelevant things. reifyWhen :: Bool -> i -> TCM a reifyWhen _ = reify instance Reify Name Name where reify = return instance Reify Expr Expr where reifyWhen = reifyWhenE reify = return instance Reify MetaId Expr where reifyWhen = reifyWhenE reify x@(MetaId n) = liftTCM $ do mi <- mvInfo <$> lookupMeta x let mi' = Info.MetaInfo { metaRange = getRange $ miClosRange mi , metaScope = M.clScope $ miClosRange mi , metaNumber = Just x , metaNameSuggestion = miNameSuggestion mi } underscore = return $ A.Underscore mi' ifNotM shouldReifyInteractionPoints underscore $ {- else -} caseMaybeM (isInteractionMeta x) underscore $ \ ii@InteractionId{} -> return $ A.QuestionMark mi' ii -- Does not print with-applications correctly: -- instance Reify DisplayTerm Expr where -- reifyWhen = reifyWhenE -- reify d = reifyTerm False $ dtermToTerm d instance Reify DisplayTerm Expr where reifyWhen = reifyWhenE reify d = case d of DTerm v -> reifyTerm False v DDot v -> reify v DCon c vs -> apps (A.Con (AmbQ [conName c])) =<< reifyIArgs vs DDef f es -> elims (A.Def f) =<< reifyIElims es DWithApp u us vs -> do (e, es) <- reify (u, us) reifyApp (if null es then e else A.WithApp exprInfo e es) vs -- | @reifyDisplayForm f vs fallback@ -- tries to rewrite @f vs@ with a display form for @f@. -- If successful, reifies the resulting display term, -- otherwise, does @fallback@. reifyDisplayForm :: QName -> I.Args -> TCM A.Expr -> TCM A.Expr reifyDisplayForm f vs fallback = do ifNotM displayFormsEnabled fallback $ {- else -} do caseMaybeM (liftTCM $ displayForm f vs) fallback reify -- | @reifyDisplayFormP@ tries to recursively -- rewrite a lhs with a display form. -- -- Note: we are not necessarily in the empty context upon entry! reifyDisplayFormP :: A.SpineLHS -> TCM A.SpineLHS reifyDisplayFormP lhs@(A.SpineLHS i f ps wps) = ifNotM displayFormsEnabled (return lhs) $ {- else -} do let vs = [ setHiding h $ defaultArg $ I.var i | (i, h) <- zip [0..] $ map getHiding ps ] -- Try to rewrite @f 0 1 2 ... |ps|-1@ to a dt. -- Andreas, 2014-06-11 Issue 1177: -- I thought we need to add the placeholders for ps to the context, -- because otherwise displayForm will not raise the display term -- and we will have variable clashes. -- But apparently, it has no influence... -- Ulf, can you add an explanation? md <- liftTCM $ -- addContext (replicate (length ps) "x") $ displayForm f vs `catchError` \_ -> return Nothing -- unquoted extended lambdas use fake names, so catch errors here reportSLn "reify.display" 20 $ "display form of " ++ show f ++ " " ++ show ps ++ " " ++ show wps ++ ":\n " ++ show md case md of Just d | okDisplayForm d -> -- In the display term @d@, @var i@ should be a placeholder -- for the @i@th pattern of @ps@. -- Andreas, 2014-06-11: -- Are we sure that @d@ did not use @var i@ otherwise? reifyDisplayFormP =<< displayLHS (map namedArg ps) wps d _ -> return lhs where -- Andreas, 2015-05-03: Ulf, please comment on what -- is the idea behind okDisplayForm. okDisplayForm (DWithApp d ds []) = okDisplayForm d && all okDisplayTerm ds okDisplayForm (DTerm (I.Def f vs)) = all okElim vs okDisplayForm (DDef f es) = all okDElim es okDisplayForm DDot{} = False okDisplayForm DCon{} = False okDisplayForm DTerm{} = True -- False? okDisplayForm DWithApp{} = True -- False? okDisplayTerm (DTerm v) = okTerm v okDisplayTerm DDot{} = True okDisplayTerm DCon{} = True okDisplayTerm DDef{} = False okDisplayTerm _ = False okDElim (I.Apply v) = okDisplayTerm $ unArg v okDElim I.Proj{} = True -- True, man, or False? No clue what I am implementing here --Andreas, 2015-05-03 okArg = okTerm . unArg okElim (I.Apply a) = okArg a okElim (I.Proj{}) = False okTerm (I.Var _ []) = True okTerm (I.Con c vs) = all okArg vs okTerm (I.Def x []) = isNoName $ qnameToConcrete x -- Handling wildcards in display forms okTerm _ = True -- False -- Flatten a dt into (parentName, parentElims, withArgs). flattenWith :: DisplayTerm -> (QName, [I.Elim' DisplayTerm], [DisplayTerm]) flattenWith (DWithApp d ds1 ds2) = case flattenWith d of (f, es, ds0) -> (f, es, ds0 ++ ds1 ++ map (DTerm . unArg) ds2) flattenWith (DDef f es) = (f, es, []) -- .^ hacky, but we should only hit this when printing debug info flattenWith (DTerm (I.Def f es)) = (f, map (fmap DTerm) es, []) flattenWith _ = __IMPOSSIBLE__ displayLHS :: [A.Pattern] -> [A.Pattern] -> DisplayTerm -> TCM A.SpineLHS displayLHS ps wps d = case flattenWith d of (f, vs, ds) -> do ds <- mapM termToPat ds vs <- mapM elimToPat vs vs <- reifyIArgs' vs return $ SpineLHS i f vs (ds ++ wps) where ci = ConPatInfo ConPCon patNoRange argToPat arg = fmap unnamed <$> traverse termToPat arg elimToPat (I.Apply arg) = argToPat arg elimToPat (I.Proj d) = return $ defaultNamedArg $ A.DefP patNoRange d [] termToPat :: DisplayTerm -> TCM A.Pattern termToPat (DTerm (I.Var n [])) = return $ case ps !!! n of Nothing -> __IMPOSSIBLE__ Just p -> p termToPat (DCon c vs) = A.ConP ci (AmbQ [conName c]) <$> do mapM argToPat =<< reifyIArgs' vs termToPat (DTerm (I.Con c vs)) = A.ConP ci (AmbQ [conName c]) <$> do mapM (argToPat . fmap DTerm) =<< reifyIArgs' vs termToPat (DTerm (I.Def _ [])) = return $ A.WildP patNoRange termToPat (DDef _ []) = return $ A.WildP patNoRange termToPat (DDot v) = A.DotP patNoRange <$> termToExpr v termToPat v = A.DotP patNoRange <$> reify v -- __IMPOSSIBLE__ len = genericLength ps argsToExpr = mapM (traverse termToExpr) -- TODO: restructure this to avoid having to repeat the code for reify termToExpr :: Term -> TCM A.Expr termToExpr v = do reportSLn "reify.display" 60 $ "termToExpr " ++ show v -- After unSpine, a Proj elimination is __IMPOSSIBLE__! case unSpine v of I.Con c vs -> apps (A.Con (AmbQ [conName c])) =<< argsToExpr vs I.Def f es -> do let vs = fromMaybe __IMPOSSIBLE__ $ mapM isApplyElim es apps (A.Def f) =<< argsToExpr vs I.Var n es -> do let vs = fromMaybe __IMPOSSIBLE__ $ mapM isApplyElim es -- Andreas, 2014-06-11 Issue 1177 -- due to β-normalization in substitution, -- even the pattern variables @n < len@ can be -- applied to some args @vs@. e <- if n < len then return $ A.patternToExpr $ ps !! n else reify (I.var (n - len)) apps e =<< argsToExpr vs _ -> return underscore instance Reify Literal Expr where reifyWhen = reifyWhenE reify l@(LitInt {}) = return (A.Lit l) reify l@(LitFloat {}) = return (A.Lit l) reify l@(LitString {}) = return (A.Lit l) reify l@(LitChar {}) = return (A.Lit l) reify l@(LitQName {}) = return (A.Lit l) instance Reify Term Expr where reifyWhen = reifyWhenE reify v = reifyTerm True v reifyTerm :: Bool -> Term -> TCM Expr reifyTerm expandAnonDefs0 v = do -- Ulf 2014-07-10: Don't expand anonymous when display forms are disabled -- (i.e. when we don't care about nice printing) expandAnonDefs <- return expandAnonDefs0 `and2M` displayFormsEnabled v <- unSpine <$> instantiate v case v of _ | isHackReifyToMeta v -> return $ A.Underscore emptyMetaInfo I.Var n es -> do let vs = fromMaybe __IMPOSSIBLE__ $ allApplyElims es x <- liftTCM $ nameOfBV n `catchError` \_ -> freshName_ ("@" ++ show n) reifyApp (A.Var x) vs I.Def x es -> do let vs = fromMaybe __IMPOSSIBLE__ $ allApplyElims es reifyDisplayForm x vs $ reifyDef expandAnonDefs x vs I.Con c vs -> do let x = conName c isR <- isGeneratedRecordConstructor x case isR of True -> do showImp <- showImplicitArguments let keep (a, v) = showImp || notHidden a r <- getConstructorData x xs <- getRecordFieldNames r vs <- map unArg <$> reifyIArgs vs return $ A.Rec exprInfo $ map (unArg *** id) $ filter keep $ zip xs vs False -> reifyDisplayForm x vs $ do ci <- getConstInfo x let Constructor{conPars = np} = theDef ci -- if we are the the module that defines constructor x -- then we have to drop at least the n module parameters n <- getDefFreeVars x -- the number of parameters is greater (if the data decl has -- extra parameters) or equal (if not) to n when (n > np) __IMPOSSIBLE__ let h = A.Con (AmbQ [x]) if null vs then return h else do es <- reifyIArgs vs -- Andreas, 2012-04-20: do not reify parameter arguments of constructor -- if the first regular constructor argument is hidden -- we turn it into a named argument, in order to avoid confusion -- with the parameter arguments which can be supplied in abstract syntax -- -- Andreas, 2012-09-17: this does not remove all sources of confusion, -- since parameters could have the same name as regular arguments -- (see for example the parameter {i} to Data.Star.Star, which is also -- the first argument to the cons). -- @data Star {i}{I : Set i} ... where cons : {i : I} ...@ -- Ulf, 2014-07-19: Don't do any of this if we're reifying an -- unquoted term (issue 1237). unquote <- isReifyingUnquoted if np == 0 || unquote then apps h es else do -- Get name of first argument from type of constructor. -- Here, we need the reducing version of @telView@ -- because target of constructor could be a definition -- expanding into a function type. See test/succeed/NameFirstIfHidden.agda. TelV tel _ <- telView (defType ci) case genericDrop np $ telToList tel of -- Andreas, 2012-09-18 -- If the first regular constructor argument is hidden, -- we keep the parameters to avoid confusion. (Common.Dom info _ : _) | isHidden info -> do let us = genericReplicate (np - n) $ setRelevance Relevant $ Common.Arg info underscore apps h $ us ++ es -- otherwise, we drop all parameters _ -> apps h es {- CODE FROM 2012-04-xx let doms = genericDrop np $ telToList tel reportSLn "syntax.reify.con" 30 $ unlines [ "calling nameFirstIfHidden" , "doms = " ++ show doms , "es = " ++ show es , "n = " ++ show n , "np = " ++ show np ] napps h $ genericDrop (n - np) $ nameFirstIfHidden doms es -} -- I.Lam info b | isAbsurdBody b -> return $ A.AbsurdLam exprInfo $ getHiding info I.Lam info b -> do (x,e) <- reify b info <- reify info return $ A.Lam exprInfo (DomainFree info x) e -- Andreas, 2011-04-07 we do not need relevance information at internal Lambda I.Lit l -> reify l I.Level l -> reify l I.Pi a b -> case b of NoAbs _ b' | notHidden a -> uncurry (A.Fun $ exprInfo) <$> reify (a, b') -- Andreas, 2013-11-11 Hidden/Instance I.Pi must be A.Pi -- since (a) the syntax {A} -> B or {{A}} -> B is not legal -- and (b) the name of the binder might matter. -- See issue 951 (a) and 952 (b). | otherwise -> mkPi b =<< reify a b -> mkPi b =<< do ifM (domainFree a (absBody b)) {- then -} (Common.Arg <$> reify (domInfo a) <*> pure underscore) {- else -} (reify a) where mkPi b (Common.Arg info a) = do (x, b) <- reify b return $ A.Pi exprInfo [TypedBindings noRange $ Common.Arg info (TBind noRange [pure x] a)] b -- We can omit the domain type if it doesn't have any free variables -- and it's mentioned in the target type. domainFree a b = do df <- asks envPrintDomainFreePi return $ and [df, freeIn 0 b, closed a] I.Sort s -> reify s I.MetaV x es -> do let vs = fromMaybe __IMPOSSIBLE__ $ allApplyElims es x' <- reify x apps x' =<< reifyIArgs vs I.DontCare v -> A.DontCare <$> reifyTerm expandAnonDefs v I.Shared p -> reifyTerm expandAnonDefs $ derefPtr p I.ExtLam cls args -> do x <- freshName_ "extlam" reifyExtLam (qnameFromList [x]) 0 cls (map (fmap unnamed) args) where -- Andreas, 2012-10-20 expand a copy in an anonymous module -- to improve error messages. -- Don't do this if we have just expanded into a display form, -- otherwise we loop! reifyDef :: Bool -> QName -> I.Args -> TCM Expr reifyDef True x@(QName m name) vs | A.isAnonymousModuleName m = do r <- reduceDefCopy x vs case r of YesReduction _ v -> do reportSLn "reify.anon" 60 $ unlines [ "reduction on defined ident. in anonymous module" , "x = " ++ show x , "v = " ++ show v ] reify v NoReduction () -> do reportSLn "reify.anon" 60 $ unlines [ "no reduction on defined ident. in anonymous module" , "x = " ++ show x , "vs = " ++ show vs ] reifyDef' x vs reifyDef _ x vs = reifyDef' x vs reifyDef' :: QName -> I.Args -> TCM Expr reifyDef' x@(QName _ name) vs = do -- We should drop this many arguments from the local context. n <- getDefFreeVars x mdefn <- liftTCM $ (Just <$> getConstInfo x) `catchError` \_ -> return Nothing -- check if we have an absurd lambda let reifyAbsurdLambda cont = case theDef <$> mdefn of Just Function{ funCompiled = Just Fail, funClauses = [cl] } | isAbsurdLambdaName x -> do -- get hiding info from last pattern, which should be () let h = getHiding $ last (clausePats cl) apps (A.AbsurdLam exprInfo h) =<< reifyIArgs vs _ -> cont reifyAbsurdLambda $ do (pad, vs :: [I.NamedArg Term]) <- do case mdefn of Nothing -> return ([], map (fmap unnamed) $ genericDrop n vs) Just defn -> do let def = theDef defn -- This is tricky: -- * getDefFreeVars x tells us how many arguments -- are part of the local context -- * some of those arguments might have been dropped -- due to projection likeness -- * when showImplicits is on we'd like to see the dropped -- projection arguments -- These are the dropped projection arguments (np, pad, dom) <- case def of Function{ funProjection = Just Projection{ projIndex = np } } | np > 0 -> do TelV tel _ <- telView (defType defn) scope <- getScope let (as, dom:_) = splitAt (np - 1) $ telToList tel whocares = A.Underscore $ Info.emptyMetaInfo { metaScope = scope } return (np, map (argFromDom . (fmap $ const whocares)) as, dom) _ -> return (0, [], __IMPOSSIBLE__) -- Now pad' ++ vs' = drop n (pad ++ vs) pad' <- reifyIArgs' $ genericDrop n pad let vs' :: [I.Arg Term] vs' = genericDrop (max 0 (n - size pad)) vs -- Andreas, 2012-04-21: get rid of hidden underscores {_} -- Keep non-hidden arguments of the padding showImp <- showImplicitArguments return (filter visible pad', if not (null pad) && showImp && notVisible (last pad) then nameFirstIfHidden [dom] vs' else map (fmap unnamed) vs') df <- displayFormsEnabled let extLam = case mdefn of Nothing -> Nothing Just defn -> case theDef defn of Function{ funExtLam = Just (ExtLamInfo h nh) } -> Just (h + nh) _ -> Nothing case extLam of Just pars | df -> do info <- getConstInfo x reifyExtLam x pars (defClauses info) vs _ -> do let apps = foldl' (\e a -> A.App exprInfo e (fmap unnamed a)) napps (A.Def x `apps` pad) =<< reifyIArgs vs reifyExtLam :: QName -> Int -> [I.Clause] -> [I.NamedArg Term] -> TCM Expr reifyExtLam x n cls vs = do reportSLn "reify.def" 10 $ "reifying extended lambda with definition: x = " ++ show x -- drop lambda lifted arguments cls <- mapM (reify . QNamed x . dropArgs n) $ cls let cx = nameConcrete $ qnameName x dInfo = mkDefInfo cx defaultFixity' PublicAccess ConcreteDef (getRange x) napps (A.ExtendedLam exprInfo dInfo x cls) =<< reifyIArgs vs -- | @nameFirstIfHidden n (a1->...an->{x:a}->b) ({e} es) = {x = e} es@ nameFirstIfHidden :: [I.Dom (ArgName, t)] -> [I.Arg a] -> [I.NamedArg a] nameFirstIfHidden _ [] = [] nameFirstIfHidden [] (_ : _) = __IMPOSSIBLE__ nameFirstIfHidden (dom : _) (Common.Arg info e : es) | isHidden info = Common.Arg info (Named (Just $ unranged $ fst $ unDom dom) e) : map (fmap unnamed) es nameFirstIfHidden _ es = map (fmap unnamed) es instance Reify i a => Reify (Named n i) (Named n a) where reify = traverse reify reifyWhen b = traverse (reifyWhen b) -- | Skip reification of implicit and irrelevant args if option is off. instance (Reify i a) => Reify (I.Arg i) (A.Arg a) where reify (Common.Arg info i) = liftM2 Common.Arg (reify info) (flip reifyWhen i =<< condition) where condition = (return (argInfoHiding info /= Hidden) `or2M` showImplicitArguments) `and2M` (return (argInfoRelevance info /= Irrelevant) `or2M` showIrrelevantArguments) reifyWhen b i = do info <- reify $ argInfo i traverse (reifyWhen b) $ i { argInfo = info } instance Reify Elim Expr where reifyWhen = reifyWhenE reify e = case e of I.Apply v -> appl "apply" <$> reify v I.Proj f -> appl "proj" <$> reify ((defaultArg $ I.Def f []) :: I.Arg Term) where appl :: String -> A.Arg Expr -> Expr appl s v = A.App exprInfo (A.Lit (LitString noRange s)) $ fmap unnamed v type NamedClause = QNamed I.Clause -- data NamedClause = NamedClause QName I.Clause instance Reify ClauseBody RHS where reify NoBody = return AbsurdRHS reify (Body v) = RHS <$> reify v reify (Bind b) = reify $ absBody b -- the variables should already be bound -- Local data types to shuffleDots data DotBind = BindFirstExplicit | BindFirstImplicit | AlreadyBound deriving (Show) data DoBind = YesBind | NoBind | DontTouch deriving (Eq, Show) -- The Monoid instance for Data.Map doesn't require that the values are a -- monoid. newtype MonoidMap k v = MonoidMap { unMonoidMap :: Map.Map k v } instance (Ord k, Monoid v) => Monoid (MonoidMap k v) where mempty = MonoidMap Map.empty mappend (MonoidMap m1) (MonoidMap m2) = MonoidMap (Map.unionWith mappend m1 m2) -- | Move dots on variables so that each variable is bound at its first -- non-hidden occurrence (if any). If all occurrences are hidden it's bound -- at the first occurrence. shuffleDots :: ([A.NamedArg A.Pattern], [A.Pattern]) -> TCM ([A.NamedArg A.Pattern], [A.Pattern]) shuffleDots (ps, wps) = do return $ (`evalState` xs) $ (`runReaderT` NotHidden) $ (,) <$> redotArgs ps <*> redotPats wps where -- An argument is explicit if _all_ Arg's on the way are explicit. In the -- map we store if _any_ of the variable occurrences were explicit. implicit = All False explicit = All True -- compute binding strategy xs = Map.map (\(_, h) -> if getAny h then BindFirstExplicit else BindFirstImplicit) $ Map.filter (getAny . fst) -- remove vars that don't appear dotted $ unMonoidMap $ argsVars explicit ps `mappend` foldMap (patVars explicit) wps -- Compute a map from pattern vars to (AppearsDotted, AppearsInANonHiddenPosition) argsVars h = foldMap (argVars h) argVars h a = (foldMap $ foldMap $ patVars (h `mappend` h')) a where h' = if getHiding a == NotHidden then explicit else implicit patVars h p = case p of A.VarP x -> MonoidMap $ Map.singleton x (Any False, Any $ getAll h) A.DotP _ (A.Var x) -> MonoidMap $ Map.singleton x (Any True, Any $ getAll h) A.DotP{} -> mempty A.ConP _ _ ps -> argsVars h ps A.DefP _ _ ps -> argsVars h ps A.PatternSynP _ _ ps -> argsVars h ps A.WildP{} -> mempty A.AbsurdP{} -> mempty A.LitP{} -> mempty A.AsP{} -> __IMPOSSIBLE__ shouldBind x = do xs <- get h <- ask let b = case Map.lookup x xs of Nothing -> DontTouch Just s -> case s of BindFirstExplicit | h == NotHidden -> YesBind | otherwise -> NoBind BindFirstImplicit -> YesBind -- in this case we know h isn't NotHidden AlreadyBound -> NoBind when (b == YesBind) $ put $ Map.adjust (const AlreadyBound) x xs return b redotArgs = traverse redotArg redotArg a = hide $ traverse (traverse redotPat) a where hide | getHiding a /= NotHidden = local (const Hidden) | otherwise = id redotPats = traverse redotPat redotPat p = case p of A.VarP x -> redotVar p x A.DotP _ (A.Var x) -> redotVar p x A.DotP{} -> pure p A.ConP i c ps -> A.ConP i c <$> redotArgs ps A.DefP i f ps -> A.DefP i f <$> redotArgs ps A.PatternSynP i x ps -> A.PatternSynP i x <$> redotArgs ps A.WildP{} -> pure p A.AbsurdP{} -> pure p A.LitP{} -> pure p A.AsP{} -> __IMPOSSIBLE__ redotVar p x = do b <- shouldBind x return $ case b of DontTouch -> p YesBind -> A.VarP x NoBind -> A.DotP (Info.PatRange $ getRange p) (A.Var x) -- | Removes implicit arguments that are not needed, that is, that don't bind -- any variables that are actually used and doesn't do pattern matching. stripImplicits :: ([A.NamedArg A.Pattern], [A.Pattern]) -> TCM ([A.NamedArg A.Pattern], [A.Pattern]) stripImplicits (ps, wps) = do -- v if show-implicit we don't need the names ifM showImplicitArguments (return (map (unnamed . namedThing <$>) ps, wps)) $ do let vars = dotVars (ps, wps) reportSLn "reify.implicit" 30 $ unlines [ "stripping implicits" , " ps = " ++ show ps , " wps = " ++ show wps , " vars = " ++ show vars ] let allps = ps ++ map defaultNamedArg wps sps = blankDots $ foldl (.) (strip Set.empty) (map rearrangeBinding $ Set.toList vars) $ allps (ps', wps') = splitAt (length sps - length wps) sps reportSLn "reify.implicit" 30 $ unlines [ " ps' = " ++ show ps' , " wps' = " ++ show (map namedArg wps') ] return (ps', map namedArg wps') where argsVars = Set.unions . map argVars argVars = patVars . namedArg patVars p = case p of A.VarP x -> Set.singleton x A.ConP _ _ ps -> argsVars ps A.DefP _ _ ps -> Set.empty A.DotP _ e -> Set.empty A.WildP _ -> Set.empty A.AbsurdP _ -> Set.empty A.LitP _ -> Set.empty A.AsP _ _ p -> patVars p A.PatternSynP _ _ _ -> __IMPOSSIBLE__ -- Set.empty -- Replace dot variables by ._ if they use implicitly bound variables. This -- is slightly nicer than making the implicts explicit. blankDots ps = (map . fmap . fmap . fmap) blank ps where bound = argsVars ps blank e | Set.null (Set.difference (dotVars e) bound) = e | otherwise = A.Underscore emptyMetaInfo -- Pick the "best" place to bind the variable. Best in this case -- is the left-most explicit binding site. But, of course we can't -- do this since binding site might be forced by a parent clause. -- Why? Because the binding site we pick might not exist in the -- generated with function if it corresponds to a dot pattern. rearrangeBinding x ps = ps strip dvs ps = stripArgs True ps where stripArgs _ [] = [] stripArgs fixedPos (a : as) = case getHiding a of Hidden | canStrip a as -> stripArgs False as Instance | canStrip a as -> stripArgs False as _ -> stripName fixedPos (stripArg a) : stripArgs True as stripName True = fmap (unnamed . namedThing) stripName False = id canStrip a as = and [ varOrDot p , noInterestingBindings p , all (flip canStrip []) $ takeWhile isUnnamedHidden as ] where p = namedArg a isUnnamedHidden x = notVisible x && nameOf (unArg x) == Nothing stripArg a = fmap (fmap stripPat) a stripPat p = case p of A.VarP _ -> p A.ConP i c ps -> A.ConP i c $ stripArgs True ps A.DefP _ _ _ -> p A.DotP _ e -> p A.WildP _ -> p A.AbsurdP _ -> p A.LitP _ -> p A.AsP i x p -> A.AsP i x $ stripPat p A.PatternSynP _ _ _ -> __IMPOSSIBLE__ -- p noInterestingBindings p = Set.null $ dvs `Set.intersection` patVars p varOrDot A.VarP{} = True varOrDot A.WildP{} = True varOrDot A.DotP{} = True varOrDot _ = False -- | @dotVars ps@ gives all the variables inside of dot patterns of @ps@ -- It is only invoked for patternish things. (Ulf O-tone!) -- Use it for printing l.h.sides: which of the implicit arguments -- have to be made explicit. class DotVars a where dotVars :: a -> Set Name isConPat :: a -> Bool isConPat _ = False instance DotVars a => DotVars (A.Arg a) where dotVars a = if notVisible a && not (isConPat a) -- Hidden constructor patterns are visible! then Set.empty else dotVars (unArg a) isConPat = isConPat . unArg instance DotVars a => DotVars (Named s a) where dotVars = dotVars . namedThing isConPat = isConPat . namedThing instance DotVars a => DotVars [a] where dotVars = Set.unions . map dotVars instance (DotVars a, DotVars b) => DotVars (a, b) where dotVars (x, y) = Set.union (dotVars x) (dotVars y) instance DotVars A.Clause where dotVars (A.Clause _ rhs []) = dotVars rhs dotVars (A.Clause _ rhs (_:_)) = __IMPOSSIBLE__ -- cannot contain where clauses? instance DotVars A.Pattern where dotVars p = case p of A.VarP _ -> Set.empty -- do not add pattern vars A.ConP _ _ ps -> dotVars ps A.DefP _ _ ps -> dotVars ps A.DotP _ e -> dotVars e A.WildP _ -> Set.empty A.AbsurdP _ -> Set.empty A.LitP _ -> Set.empty A.AsP _ _ p -> dotVars p A.PatternSynP _ _ _ -> __IMPOSSIBLE__ -- Set.empty isConPat A.ConP{} = True isConPat A.LitP{} = True isConPat _ = False -- | Getting all(!) variables of an expression. -- It should only get free ones, but it does not matter to include -- the bound ones. instance DotVars A.Expr where dotVars e = case e of A.ScopedExpr _ e -> dotVars e A.Var x -> Set.singleton x -- add any expression variable A.Def _ -> Set.empty A.Proj _ -> Set.empty A.Con _ -> Set.empty A.Lit _ -> Set.empty A.QuestionMark{} -> Set.empty A.Underscore _ -> Set.empty A.App _ e1 e2 -> dotVars (e1, e2) A.WithApp _ e es -> dotVars (e, es) A.Lam _ _ e -> dotVars e A.AbsurdLam _ _ -> Set.empty A.ExtendedLam _ _ _ cs -> dotVars cs A.Pi _ tel e -> dotVars (tel, e) A.Fun _ a b -> dotVars (a, b) A.Set _ _ -> Set.empty A.Prop _ -> Set.empty A.Let _ _ _ -> __IMPOSSIBLE__ A.Rec _ es -> dotVars $ map snd es A.RecUpdate _ e es -> dotVars (e, map snd es) A.ETel _ -> __IMPOSSIBLE__ A.QuoteGoal {} -> __IMPOSSIBLE__ A.QuoteContext {} -> __IMPOSSIBLE__ A.Quote {} -> __IMPOSSIBLE__ A.QuoteTerm {} -> __IMPOSSIBLE__ A.Unquote {} -> __IMPOSSIBLE__ A.DontCare v -> dotVars v A.PatternSyn n -> Set.empty instance DotVars RHS where dotVars (RHS e) = dotVars e dotVars AbsurdRHS = Set.empty dotVars (WithRHS _ es clauses) = __IMPOSSIBLE__ -- NZ dotVars (RewriteRHS xes rhs _) = __IMPOSSIBLE__ -- NZ instance DotVars TypedBindings where dotVars (TypedBindings _ bs) = dotVars bs instance DotVars TypedBinding where dotVars (TBind _ _ e) = dotVars e dotVars (TLet _ _) = __IMPOSSIBLE__ -- Since the internal syntax has no let bindings left -- TODO: implement reifyPatterns on de Bruijn patterns ( numberPatVars ) reifyPatterns :: I.Telescope -> Permutation -> [I.NamedArg I.Pattern] -> TCM [A.NamedArg A.Pattern] reifyPatterns tel perm ps = evalStateT (reifyArgs ps) 0 where reifyArgs :: [I.NamedArg I.Pattern] -> StateT Nat TCM [A.NamedArg A.Pattern] reifyArgs is = mapM reifyArg is reifyArg :: I.NamedArg I.Pattern -> StateT Nat TCM (A.NamedArg A.Pattern) reifyArg i = stripNameFromExplicit <$> traverse (traverse reifyPat) (setArgColors [] i) -- TODO guilhem stripNameFromExplicit a | getHiding a == NotHidden = fmap (unnamed . namedThing) a | otherwise = a tick = do i <- get; put (i + 1); return i translate n = fromMaybe __IMPOSSIBLE__ $ vars !!! n where vars = permPicks $ invertP __IMPOSSIBLE__ perm reifyPat :: I.Pattern -> StateT Nat TCM A.Pattern reifyPat p = case p of I.VarP "()" -> A.AbsurdP patNoRange <$ tick -- HACK I.VarP s -> do i <- tick let j = translate i lift $ A.VarP <$> nameOfBV (size tel - 1 - j) I.DotP v -> do t <- lift $ reify v _ <- tick let vars = Set.map show (dotVars t) t' = if Set.member "()" vars then underscore else t return $ A.DotP patNoRange t' I.LitP l -> return $ A.LitP l I.ProjP d -> return $ A.DefP patNoRange d [] I.ConP c cpi ps -> A.ConP ci (AmbQ [conName c]) <$> reifyArgs ps where ci = flip ConPatInfo patNoRange $ fromMaybe ConPCon $ I.conPRecord cpi instance Reify NamedClause A.Clause where reify (QNamed f (I.Clause _ tel perm ps body _)) = addCtxTel tel $ do ps <- reifyPatterns tel perm ps lhs <- liftTCM $ reifyDisplayFormP $ SpineLHS info f ps [] -- LHS info (LHSHead f ps) [] nfv <- getDefFreeVars f `catchError` \_ -> return 0 lhs <- stripImps $ dropParams nfv lhs reportSLn "reify.clause" 60 $ "reifying NamedClause, lhs = " ++ show lhs rhs <- reify $ renameP (reverseP perm) <$> body reportSLn "reify.clause" 60 $ "reifying NamedClause, rhs = " ++ show rhs let result = A.Clause (spineToLhs lhs) rhs [] reportSLn "reify.clause" 60 $ "reified NamedClause, result = " ++ show result return result where info = LHSRange noRange dropParams n (SpineLHS i f ps wps) = SpineLHS i f (genericDrop n ps) wps stripImps (SpineLHS i f ps wps) = do (ps, wps) <- stripImplicits =<< shuffleDots (ps, wps) return $ SpineLHS i f ps wps instance Reify Type Expr where reifyWhen = reifyWhenE reify (I.El _ t) = reify t instance Reify Sort Expr where reifyWhen = reifyWhenE reify s = do s <- instantiateFull s case s of I.Type (I.Max []) -> return $ A.Set exprInfo 0 I.Type (I.Max [I.ClosedLevel n]) -> return $ A.Set exprInfo n I.Type a -> do a <- reify a return $ A.App exprInfo (A.Set exprInfo 0) (defaultNamedArg a) I.Prop -> return $ A.Prop exprInfo I.Inf -> A.Var <$> freshName_ ("Setω" :: String) I.SizeUniv -> do I.Def sizeU [] <- primSizeUniv return $ A.Def sizeU I.DLub s1 s2 -> do lub <- freshName_ ("dLub" :: String) -- TODO: hack (e1,e2) <- reify (s1, I.Lam defaultArgInfo $ fmap Sort s2) let app x y = A.App exprInfo x (defaultNamedArg y) return $ A.Var lub `app` e1 `app` e2 instance Reify Level Expr where reifyWhen = reifyWhenE reify l = reify =<< reallyUnLevelView l instance (Free i, Reify i a) => Reify (Abs i) (Name, a) where reify (NoAbs x v) = (,) <$> freshName_ x <*> reify v reify (Abs s v) = do -- If the bound variable is free in the body, then the name "_" is -- replaced by "z". s <- return $ if isUnderscore s && 0 `freeIn` v then "z" else s x <- freshName_ s e <- addContext x -- type doesn't matter $ reify v return (x,e) instance Reify I.Telescope A.Telescope where reify EmptyTel = return [] reify (ExtendTel arg tel) = do Common.Arg info e <- reify arg (x,bs) <- reify tel let r = getRange e return $ TypedBindings r (Common.Arg info (TBind r [pure x] e)) : bs instance Reify I.ArgInfo A.ArgInfo where reify i = flip (mapArgInfoColors.const) i <$> reify (argInfoColors i) instance Reify i a => Reify (I.Dom i) (A.Arg a) where reify (Common.Dom info i) = liftM2 Common.Arg (reify info) (reify i) instance Reify i a => Reify [i] [a] where reify = traverse reify instance (Reify i1 a1, Reify i2 a2) => Reify (i1,i2) (a1,a2) where reify (x,y) = (,) <$> reify x <*> reify y instance (Reify i1 a1, Reify i2 a2, Reify i3 a3) => Reify (i1,i2,i3) (a1,a2,a3) where reify (x,y,z) = (,,) <$> reify x <*> reify y <*> reify z instance (Reify i1 a1, Reify i2 a2, Reify i3 a3, Reify i4 a4) => Reify (i1,i2,i3,i4) (a1,a2,a3,a4) where reify (x,y,z,w) = (,,,) <$> reify x <*> reify y <*> reify z <*> reify w Agda-2.4.2.5/src/full/Agda/Syntax/Abstract/0000755000000000000000000000000012635075266016336 5ustar0000000000000000Agda-2.4.2.5/src/full/Agda/Syntax/Abstract/Pretty.hs0000644000000000000000000000167012635075266020165 0ustar0000000000000000{-# LANGUAGE FlexibleContexts #-} module Agda.Syntax.Abstract.Pretty where import Control.Applicative import Agda.Syntax.Concrete.Pretty () import Agda.Syntax.Fixity import Agda.Syntax.Translation.AbstractToConcrete import Agda.TypeChecking.Monad import Agda.Utils.Pretty showA :: (Show c, ToConcrete a c) => a -> TCM String showA x = show <$> abstractToConcrete_ x prettyA :: (Pretty c, ToConcrete a c) => a -> TCM Doc prettyA x = pretty <$> abstractToConcrete_ x prettyAs :: (Pretty c, ToConcrete a [c]) => a -> TCM Doc prettyAs x = fsep . map pretty <$> abstractToConcrete_ x -- | Variant of 'showA' which does not insert outermost parentheses. showATop :: (Show c, ToConcrete a c) => a -> TCM String showATop x = show <$> abstractToConcreteCtx TopCtx x -- | Variant of 'prettyA' which does not insert outermost parentheses. prettyATop :: (Pretty c, ToConcrete a c) => a -> TCM Doc prettyATop x = pretty <$> abstractToConcreteCtx TopCtx x Agda-2.4.2.5/src/full/Agda/Syntax/Abstract/Views.hs0000644000000000000000000002461012635075266017772 0ustar0000000000000000{-# LANGUAGE DefaultSignatures #-} {-# LANGUAGE NoMonomorphismRestriction #-} {-# LANGUAGE PatternGuards #-} {-# LANGUAGE TupleSections #-} module Agda.Syntax.Abstract.Views where import Control.Applicative import Control.Arrow (first) import Control.Monad.Identity import Data.Foldable (foldMap) import Data.Monoid import Data.Traversable import Agda.Syntax.Position import qualified Agda.Syntax.Common as Common import Agda.Syntax.Common hiding (Arg, Dom, NamedArg) import Agda.Syntax.Abstract as A import Agda.Syntax.Info data AppView = Application Expr [NamedArg Expr] -- | Gather applications to expose head and spine. -- -- Note: everything is an application, possibly of itself to 0 arguments appView :: Expr -> AppView appView e = case e of App i e1 arg | Application hd es <- appView e1 -> Application hd $ es ++ [arg] ScopedExpr _ e -> appView e _ -> Application e [] unAppView :: AppView -> Expr unAppView (Application h es) = foldl (App (ExprRange noRange)) h es -- | Gather top-level 'AsP'atterns to expose underlying pattern. asView :: A.Pattern -> ([Name], A.Pattern) asView (A.AsP _ x p) = first (x :) $ asView p asView p = ([], p) -- | Check whether we are dealing with a universe. isSet :: Expr -> Bool isSet (ScopedExpr _ e) = isSet e isSet (App _ e _) = isSet e isSet (Set{}) = True isSet _ = False -- | Remove top 'ScopedExpr' wrappers. unScope :: Expr -> Expr unScope (ScopedExpr scope e) = unScope e unScope e = e -- | Remove 'ScopedExpr' wrappers everywhere. deepUnScope :: Expr -> Expr deepUnScope = mapExpr unScope -- * Traversal -- | Apply an expression rewriting to every subexpression, inside-out. -- See "Agda.Syntax.Internal.Generic". class ExprLike a where -- | The first expression is pre-traversal, the second one post-traversal. recurseExpr :: (Applicative m) => (Expr -> m Expr -> m Expr) -> a -> m a default recurseExpr :: (ExprLike a, Traversable f, Applicative m) => (Expr -> m Expr -> m Expr) -> f a -> m (f a) recurseExpr = traverse . recurseExpr foldExpr :: Monoid m => (Expr -> m) -> a -> m foldExpr f = getConst . recurseExpr (\ pre post -> Const $ f pre) traverseExpr :: (Monad m, Applicative m) => (Expr -> m Expr) -> a -> m a traverseExpr f = recurseExpr (\ pre post -> f =<< post) mapExpr :: (Expr -> Expr) -> (a -> a) mapExpr f e = runIdentity $ traverseExpr (Identity . f) e instance ExprLike Expr where recurseExpr f e0 = f e0 $ do let recurse e = recurseExpr f e case e0 of Var{} -> pure e0 Def{} -> pure e0 Proj{} -> pure e0 Con{} -> pure e0 Lit{} -> pure e0 QuestionMark{} -> pure e0 Underscore{} -> pure e0 App ei e arg -> App ei <$> recurse e <*> recurse arg WithApp ei e es -> WithApp ei <$> recurse e <*> recurse es Lam ei b e -> Lam ei <$> recurse b <*> recurse e AbsurdLam{} -> pure e0 ExtendedLam ei di x cls -> ExtendedLam ei di x <$> recurse cls Pi ei tel e -> Pi ei <$> recurse tel <*> recurse e Fun ei arg e -> Fun ei <$> recurse arg <*> recurse e Set{} -> pure e0 Prop{} -> pure e0 Let ei bs e -> Let ei <$> recurse bs <*> recurse e ETel tel -> ETel <$> recurse tel Rec ei bs -> Rec ei <$> recurse bs RecUpdate ei e bs -> RecUpdate ei <$> recurse e <*> recurse bs ScopedExpr sc e -> ScopedExpr sc <$> recurse e QuoteGoal ei n e -> QuoteGoal ei n <$> recurse e QuoteContext ei n e -> QuoteContext ei n <$> recurse e Quote{} -> pure e0 QuoteTerm{} -> pure e0 Unquote{} -> pure e0 DontCare e -> DontCare <$> recurse e PatternSyn{} -> pure e0 foldExpr f e = case e of Var{} -> m Def{} -> m Proj{} -> m Con{} -> m PatternSyn{} -> m Lit{} -> m QuestionMark{} -> m Underscore{} -> m App _ e e' -> m `mappend` fold e `mappend` fold e' WithApp _ e es -> m `mappend` fold e `mappend` fold es Lam _ b e -> m `mappend` fold b `mappend` fold e AbsurdLam{} -> m ExtendedLam _ _ _ cs -> m `mappend` fold cs Pi _ tel e -> m `mappend` fold tel `mappend` fold e Fun _ e e' -> m `mappend` fold e `mappend` fold e' Set{} -> m Prop{} -> m Let _ bs e -> m `mappend` fold bs `mappend` fold e ETel tel -> m `mappend` fold tel Rec _ as -> m `mappend` fold as RecUpdate _ e as -> m `mappend` fold e `mappend` fold as ScopedExpr _ e -> m `mappend` fold e QuoteGoal _ _ e -> m `mappend` fold e QuoteContext _ _ e -> m `mappend` fold e Quote{} -> m QuoteTerm{} -> m Unquote{} -> m DontCare e -> m `mappend` fold e where m = f e fold = foldExpr f traverseExpr f e = do let trav e = traverseExpr f e case e of Var{} -> f e Def{} -> f e Proj{} -> f e Con{} -> f e Lit{} -> f e QuestionMark{} -> f e Underscore{} -> f e App ei e arg -> f =<< App ei <$> trav e <*> trav arg WithApp ei e es -> f =<< WithApp ei <$> trav e <*> trav es Lam ei b e -> f =<< Lam ei <$> trav b <*> trav e AbsurdLam{} -> f e ExtendedLam ei di x cls -> f =<< ExtendedLam ei di x <$> trav cls Pi ei tel e -> f =<< Pi ei <$> trav tel <*> trav e Fun ei arg e -> f =<< Fun ei <$> trav arg <*> trav e Set{} -> f e Prop{} -> f e Let ei bs e -> f =<< Let ei <$> trav bs <*> trav e ETel tel -> f =<< ETel <$> trav tel Rec ei bs -> f =<< Rec ei <$> trav bs RecUpdate ei e bs -> f =<< RecUpdate ei <$> trav e <*> trav bs ScopedExpr sc e -> f =<< ScopedExpr sc <$> trav e QuoteGoal ei n e -> f =<< QuoteGoal ei n <$> trav e QuoteContext ei n e -> f =<< QuoteContext ei n <$> trav e Quote{} -> f e QuoteTerm{} -> f e Unquote{} -> f e DontCare e -> f =<< DontCare <$> trav e PatternSyn{} -> f e -- | TODO: currently does not go into colors. instance ExprLike a => ExprLike (Common.Arg c a) where foldExpr = foldMap . foldExpr traverseExpr = traverse . traverseExpr instance ExprLike a => ExprLike (Named x a) where foldExpr = foldMap . foldExpr traverseExpr = traverse . traverseExpr instance ExprLike a => ExprLike [a] where foldExpr = foldMap . foldExpr traverseExpr = traverse . traverseExpr instance ExprLike a => ExprLike (x, a) where foldExpr f (x, e) = foldExpr f e traverseExpr f (x, e) = (x,) <$> traverseExpr f e instance ExprLike LamBinding where recurseExpr f e = case e of DomainFree{} -> pure e DomainFull bs -> DomainFull <$> recurseExpr f bs foldExpr f e = case e of DomainFree{} -> mempty DomainFull bs -> foldExpr f bs traverseExpr f e = case e of DomainFree{} -> pure e DomainFull bs -> DomainFull <$> traverseExpr f bs instance ExprLike TypedBindings where recurseExpr f (TypedBindings r b) = TypedBindings r <$> recurseExpr f b foldExpr f (TypedBindings r b) = foldExpr f b traverseExpr f (TypedBindings r b) = TypedBindings r <$> traverseExpr f b instance ExprLike TypedBinding where recurseExpr f e = case e of TBind r xs e -> TBind r xs <$> recurseExpr f e TLet r ds -> TLet r <$> recurseExpr f ds foldExpr f e = case e of TBind _ _ e -> foldExpr f e TLet _ ds -> foldExpr f ds traverseExpr f e = case e of TBind r xs e -> TBind r xs <$> traverseExpr f e TLet r ds -> TLet r <$> traverseExpr f ds instance ExprLike LetBinding where recurseExpr f e = do let recurse e = recurseExpr f e case e of LetBind li ai x e e' -> LetBind li ai x <$> recurse e <*> recurse e' LetPatBind li p e -> LetPatBind li <$> recurse p <*> recurse e LetApply{} -> pure e LetOpen{} -> pure e foldExpr f e = case e of LetBind _ _ _ e e' -> fold e `mappend` fold e' LetPatBind _ p e -> fold p `mappend` fold e LetApply{} -> mempty LetOpen{} -> mempty where fold e = foldExpr f e traverseExpr f e = do let trav e = traverseExpr f e case e of LetBind li ai x e e' -> LetBind li ai x <$> trav e <*> trav e' LetPatBind li p e -> LetPatBind li <$> trav p <*> trav e LetApply{} -> pure e LetOpen{} -> pure e instance ExprLike a => ExprLike (Pattern' a) where -- | TODO: currently does not go into clauses. instance ExprLike (Clause' a) where recurseExpr f e = pure e foldExpr f _ = mempty traverseExpr f e = pure e {- TODO: finish instance ExprLike (Clause' a) where foldExpr f (Clause _ rhs ds) = fold rhs `mappend` fold ds where fold e = foldExpr f e traverseExpr f (Clause lhs rhs ds) = Clause lhs <$> trav rhs <*> trav ds where trav e = traverseExpr f e instance ExprLike RHS where foldExpr f rhs = case rhs of RHS e -> fold e AbsurdRHS{} -> mempty WithRHS _ es cs -> fold es `mappend` fold cs RewriteRHS xes rhs ds -> fold xes `mappend` fold rhs `mappend` fold ds where fold e = foldExpr f e traverseExpr f rhs = case rhs of RHS e -> RHS <$> trav e AbsurdRHS{} -> pure rhs WithRHS x es cs -> WithRHS x <$> trav es <*> trav cs RewriteRHS xes rhs ds -> RewriteRHS <$> trav xes <*> trav rhs <*> trav ds where trav e = traverseExpr f e instance ExprLike Declaration where foldExpr f d = case d of -} Agda-2.4.2.5/src/full/Agda/Syntax/Abstract/Name.hs0000644000000000000000000003145312635075266017560 0ustar0000000000000000{-# LANGUAGE CPP #-} {-# LANGUAGE DeriveDataTypeable #-} {-# LANGUAGE DeriveFoldable #-} {-# LANGUAGE DeriveFunctor #-} {-# LANGUAGE DeriveTraversable #-} {-# LANGUAGE FlexibleContexts #-} {-# LANGUAGE FlexibleInstances #-} {-# LANGUAGE GeneralizedNewtypeDeriving #-} {-# LANGUAGE StandaloneDeriving #-} {-| Abstract names carry unique identifiers and stuff. -} module Agda.Syntax.Abstract.Name ( module Agda.Syntax.Abstract.Name , IsNoName(..) ) where import Control.Monad.State import Data.Foldable (Foldable) import Data.Traversable (Traversable) import Data.Typeable (Typeable) import Data.List import Data.Function import Data.Hashable import Test.QuickCheck import Agda.Syntax.Position import Agda.Syntax.Common import {-# SOURCE #-} Agda.Syntax.Fixity import Agda.Syntax.Concrete.Name (IsNoName(..)) import qualified Agda.Syntax.Concrete.Name as C import Agda.Utils.List import Agda.Utils.Monad import Agda.Utils.Pretty import Agda.Utils.Size import Agda.Utils.Suffix #include "undefined.h" import Agda.Utils.Impossible -- | A name is a unique identifier and a suggestion for a concrete name. The -- concrete name contains the source location (if any) of the name. The -- source location of the binding site is also recorded. data Name = Name { nameId :: NameId , nameConcrete :: C.Name , nameBindingSite :: Range , nameFixity :: Fixity' } deriving (Typeable) -- | Qualified names are non-empty lists of names. Equality on qualified names -- are just equality on the last name, i.e. the module part is just -- for show. -- -- The 'SetRange' instance for qualified names sets all individual -- ranges (including those of the module prefix) to the given one. data QName = QName { qnameModule :: ModuleName , qnameName :: Name } deriving (Typeable) -- | Something preceeded by a qualified name. data QNamed a = QNamed { qname :: QName , qnamed :: a } deriving (Typeable, Functor, Foldable, Traversable) -- | A module name is just a qualified name. -- -- The 'SetRange' instance for module names sets all individual ranges -- to the given one. newtype ModuleName = MName { mnameToList :: [Name] } deriving (Eq, Ord, Typeable) -- | Ambiguous qualified names. Used for overloaded constructors. -- -- Invariant: All the names in the list must have the same concrete, -- unqualified name. (This implies that they all have the same 'Range'). newtype AmbiguousQName = AmbQ { unAmbQ :: [QName] } deriving (Eq, Typeable) -- | A module is anonymous if the qualification path ends in an underscore. isAnonymousModuleName :: ModuleName -> Bool isAnonymousModuleName (MName []) = False isAnonymousModuleName (MName ms) = isNoName $ last ms -- | Sets the ranges of the individual names in the module name to -- match those of the corresponding concrete names. If the concrete -- names are fewer than the number of module name name parts, then the -- initial name parts get the range 'noRange'. -- -- @C.D.E \`withRangesOf\` [A, B]@ returns @C.D.E@ but with ranges set -- as follows: -- -- * @C@: 'noRange'. -- -- * @D@: the range of @A@. -- -- * @E@: the range of @B@. -- -- Precondition: The number of module name name parts has to be at -- least as large as the length of the list. withRangesOf :: ModuleName -> [C.Name] -> ModuleName MName ms `withRangesOf` ns = if m < n then __IMPOSSIBLE__ else MName $ zipWith setRange (replicate (m - n) noRange ++ map getRange ns) ms where m = length ms n = length ns -- | Like 'withRangesOf', but uses the name parts (qualifier + name) -- of the qualified name as the list of concrete names. withRangesOfQ :: ModuleName -> C.QName -> ModuleName m `withRangesOfQ` q = m `withRangesOf` C.qnameParts q mnameFromList :: [Name] -> ModuleName mnameFromList = MName noModuleName :: ModuleName noModuleName = mnameFromList [] commonParentModule :: ModuleName -> ModuleName -> ModuleName commonParentModule m1 m2 = mnameFromList $ commonPrefix (mnameToList m1) (mnameToList m2) -- | Make a 'Name' from some kind of string. class MkName a where -- | The 'Range' sets the /definition site/ of the name, not the use site. mkName :: Range -> NameId -> a -> Name mkName_ :: NameId -> a -> Name mkName_ = mkName noRange instance MkName String where mkName r i s = Name i (C.Name noRange (C.stringNameParts s)) r defaultFixity' qnameToList :: QName -> [Name] qnameToList (QName m x) = mnameToList m ++ [x] qnameFromList :: [Name] -> QName qnameFromList [] = __IMPOSSIBLE__ qnameFromList xs = QName (mnameFromList $ init xs) (last xs) qnameToMName :: QName -> ModuleName qnameToMName = mnameFromList . qnameToList mnameToQName :: ModuleName -> QName mnameToQName = qnameFromList . mnameToList showQNameId :: QName -> String showQNameId q = show ns ++ "@" ++ show m where is = map nameId $ mnameToList (qnameModule q) ++ [qnameName q] ns = [ n | NameId n _ <- is ] m = head [ m | NameId _ m <- is ] -- | Turn a qualified name into a concrete name. This should only be used as a -- fallback when looking up the right concrete name in the scope fails. qnameToConcrete :: QName -> C.QName qnameToConcrete (QName m x) = foldr C.Qual (C.QName $ nameConcrete x) $ map nameConcrete $ mnameToList m mnameToConcrete :: ModuleName -> C.QName mnameToConcrete (MName []) = __IMPOSSIBLE__ -- C.QName C.noName_ -- should never happen? mnameToConcrete (MName xs) = foldr C.Qual (C.QName $ last cs) $ init cs where cs = map nameConcrete xs -- | Computes the 'TopLevelModuleName' corresponding to the given -- module name, which is assumed to represent a top-level module name. -- -- Precondition: The module name must be well-formed. toTopLevelModuleName :: ModuleName -> C.TopLevelModuleName toTopLevelModuleName (MName []) = __IMPOSSIBLE__ toTopLevelModuleName (MName ms) = C.TopLevelModuleName $ map (C.nameToRawName . nameConcrete) ms qualifyM :: ModuleName -> ModuleName -> ModuleName qualifyM m1 m2 = mnameFromList $ mnameToList m1 ++ mnameToList m2 qualifyQ :: ModuleName -> QName -> QName qualifyQ m x = qnameFromList $ mnameToList m ++ qnameToList x qualify :: ModuleName -> Name -> QName qualify = QName -- | Convert a 'Name' to a 'QName' (add no module name). qualify_ :: Name -> QName qualify_ = qualify noModuleName -- | Is the name an operator? isOperator :: QName -> Bool isOperator q = C.isOperator (nameConcrete (qnameName q)) isSubModuleOf :: ModuleName -> ModuleName -> Bool isSubModuleOf x y = xs /= ys && isPrefixOf ys xs where xs = mnameToList x ys = mnameToList y isInModule :: QName -> ModuleName -> Bool isInModule q m = mnameToList m `isPrefixOf` qnameToList q -- | Get the next version of the concrete name. For instance, @nextName "x" = "x₁"@. -- The name must not be a 'NoName'. nextName :: Name -> Name nextName x = x { nameConcrete = C.Name noRange $ nextSuf ps } where C.Name _ ps = nameConcrete x -- NoName cannot appear here nextSuf [C.Id s] = [C.Id $ nextStr s] nextSuf [C.Id s, C.Hole] = [C.Id $ nextStr s, C.Hole] nextSuf (p : ps) = p : nextSuf ps nextSuf [] = __IMPOSSIBLE__ nextStr s = case suffixView s of (s0, suf) -> addSuffix s0 (nextSuffix suf) ------------------------------------------------------------------------ -- * Important instances: Eq, Ord, Hashable -- -- For the identity and comparing of names, only the 'NameId' matters! ------------------------------------------------------------------------ instance Eq Name where (==) = (==) `on` nameId instance Ord Name where compare = compare `on` nameId instance Hashable Name where {-# INLINE hashWithSalt #-} hashWithSalt salt = hashWithSalt salt . nameId instance Eq QName where (==) = (==) `on` qnameName instance Ord QName where compare = compare `on` qnameName instance Hashable QName where {-# INLINE hashWithSalt #-} hashWithSalt salt = hashWithSalt salt . qnameName ------------------------------------------------------------------------ -- * IsNoName instances (checking for "_") ------------------------------------------------------------------------ -- | An abstract name is empty if its concrete name is empty. instance IsNoName Name where isNoName = isNoName . nameConcrete ------------------------------------------------------------------------ -- * Show instances ------------------------------------------------------------------------ -- deriving instance Show Name -- deriving instance Show ModuleName -- deriving instance Show QName deriving instance Show a => Show (QNamed a) deriving instance Show AmbiguousQName -- | Only use this @show@ function in debugging! To convert an -- abstract 'Name' into a string use @prettyShow@. instance Show Name where -- Andreas, 2014-10-02: Reverted to nice printing. -- Reason: I do not have time just now to properly fix the -- use of Show Name for pretty printing everywhere, e.g. in -- the Epic backend. But I want to push the fix for Issue 836 now. show = prettyShow -- | Only use this @show@ function in debugging! To convert an -- abstract 'ModuleName' into a string use @prettyShow@. instance Show ModuleName where show = prettyShow -- | Only use this @show@ function in debugging! To convert an -- abstract 'QName' into a string use @prettyShow@. instance Show QName where show = prettyShow ------------------------------------------------------------------------ -- * Pretty instances ------------------------------------------------------------------------ instance Pretty Name where pretty = pretty . nameConcrete instance Pretty ModuleName where pretty = hcat . punctuate (text ".") . map pretty . mnameToList instance Pretty QName where pretty = hcat . punctuate (text ".") . map pretty . qnameToList instance Pretty AmbiguousQName where pretty (AmbQ qs) = hcat $ punctuate (text " | ") $ map pretty qs instance Pretty a => Pretty (QNamed a) where pretty (QNamed a b) = pretty a <> text "." <> pretty b ------------------------------------------------------------------------ -- * Range instances ------------------------------------------------------------------------ -- ** HasRange instance HasRange Name where getRange = getRange . nameConcrete instance HasRange ModuleName where getRange (MName []) = noRange getRange (MName xs) = getRange xs instance HasRange QName where getRange q = getRange (qnameModule q, qnameName q) -- | The range of an @AmbiguousQName@ is the range of any of its -- disambiguations (they are the same concrete name). instance HasRange AmbiguousQName where getRange (AmbQ []) = noRange getRange (AmbQ (c:_)) = getRange c -- ** SetRange instance SetRange Name where setRange r x = x { nameConcrete = setRange r $ nameConcrete x } instance SetRange QName where setRange r q = q { qnameModule = setRange r $ qnameModule q , qnameName = setRange r $ qnameName q } instance SetRange ModuleName where setRange r (MName ns) = MName (map (setRange r) ns) -- ** KillRange instance KillRange Name where killRange (Name a b c d) = killRange4 Name a b c d -- killRange x = x { nameConcrete = killRange $ nameConcrete x -- -- Andreas, 2014-03-30 -- -- An experiment: what happens if we preserve -- -- the range of the binding site, but kill all -- -- other ranges before serialization? -- -- Andreas, Makoto, 2014-10-18 AIM XX -- -- Kill all ranges in signature, including nameBindingSite. -- , nameBindingSite = noRange -- } instance KillRange ModuleName where killRange (MName xs) = MName $ killRange xs instance KillRange QName where killRange (QName a b) = killRange2 QName a b -- killRange q = q { qnameModule = killRange $ qnameModule q -- , qnameName = killRange $ qnameName q -- } instance KillRange AmbiguousQName where killRange (AmbQ xs) = AmbQ $ killRange xs ------------------------------------------------------------------------ -- * Sized instances ------------------------------------------------------------------------ instance Sized QName where size = size . qnameToList instance Sized ModuleName where size = size . mnameToList ------------------------------------------------------------------------ -- * Arbitrary instances ------------------------------------------------------------------------ -- | The generated names all have the same 'Fixity'': 'noFixity''. instance Arbitrary Name where arbitrary = Name <$> arbitrary <*> arbitrary <*> arbitrary <*> return noFixity' instance CoArbitrary Name where coarbitrary = coarbitrary . nameId instance Arbitrary QName where arbitrary = do ms <- arbitrary n <- arbitrary return (QName (MName ms) n) instance CoArbitrary QName where coarbitrary = coarbitrary . qnameName Agda-2.4.2.5/src/full/Agda/Syntax/Abstract/Copatterns.hs0000644000000000000000000003310412635075266021015 0ustar0000000000000000{-# LANGUAGE CPP #-} {-# LANGUAGE DeriveFunctor #-} {-# LANGUAGE FlexibleContexts #-} {-# LANGUAGE FlexibleInstances #-} {-# LANGUAGE PatternGuards #-} {-# LANGUAGE ScopedTypeVariables #-} {-# LANGUAGE StandaloneDeriving #-} {-# LANGUAGE TupleSections #-} module Agda.Syntax.Abstract.Copatterns (translateCopatternClauses) where import Prelude hiding (mapM) import Control.Applicative import Control.Monad hiding (mapM) import Control.Monad.Writer hiding (mapM) import Data.Function import Data.List import Data.Traversable as T import Agda.Syntax.Abstract import Agda.Syntax.Abstract.Name as A import Agda.Syntax.Common hiding (Arg, Dom, NamedArg) import qualified Agda.Syntax.Common as Common import qualified Agda.Syntax.Concrete.Name as C import Agda.Syntax.Info import Agda.Syntax.Position import Agda.Syntax.Scope.Monad import Agda.TypeChecking.Monad.Base (TypeError(..), typeError) import Agda.Utils.Tuple #include "undefined.h" import Agda.Utils.Impossible {- Andreas 2012-04-07, 2012-05-08 Translating copatterns into record expressions This is a preliminary solution until we have proper copattern type checking and evaluation. Example 1: record Stream (A : Set) : Set where field head : A tail : Stream A open Stream alternate : Stream Nat ( head alternate ) = zero (head (tail alternate)) = suc zero (tail (tail alternate)) = alternate with pathes Path [head] zero Path [tail,head] (suc zero) Path [tail,tail] alternate is translated into alternate = record { head = zero ; tail = record { head = suc zero ; tail = alternate } } Example 2: record State (S A : Set) : Set where constructor state field runState : S → A × S open State record Monad (M : Set → Set) : Set1 where constructor monad field return : {A : Set} → A → M A _>>=_ : {A B : Set} → M A → (A → M B) → M B open Monad stateMonad : {S : Set} → Monad (State S) runState (return stateMonad a ) s = a , s runState (_>>=_ stateMonad m k) s₀ = let as₁ = runState m s₀ in runState (k (proj₁ as₁)) (proj₂ as₁) with pathes Path [(return,[a] ), (runstate,[s ])] (a,s) Path [(_>>=_, [m,k]), (runstate,[s₀])] (let...) is translated to stateMonad = record { return = λ a → record { runState = λ s → a , s } ; _>>=_ = λ m k → record { runState = λ s₀ → let as₁ = runState m s₀ in runState (k (proj₁ as₁)) (proj₂ as₁) } Example 3: swap3 : {A B C X : Set} → (X → A) × ((X → B) × C) → (X → C) × (X → (B × A)) fst (swap3 t) x = snd (snd t) fst (snd (swap3 t) y) = fst (snd t) y snd (snd (swap3 t) z) = fst t z with pathes Path [(fst,[x])] (snd (snd t)) Path [(snd,[y]), (fst,[])] (fst (snd t) y) Path [(snd,[z]), (snd,[])] (fst t z) ist translated to swap3 t = record { fst = λ x → snd (snd t) ; snd = λ y → record { fst = fst (snd t) y ; snd = (fst t z){z := y} } } How to translate: - group clauses into those with same LHSCore and same withpatterns -} translateCopatternClauses :: [Clause] -> ScopeM (Delayed, [Clause]) translateCopatternClauses cs = if all noCopats cs then return (NotDelayed, cs) else (Delayed,) <$> do pcs :: [ProjPath Clause] <- mapM clauseToPath cs let cps :: [(Clause, [ProjPath Expr])] cps = groupClauses pcs {- cps = map ((theContent . head) /\ map (fmap (rhsExpr . clauseRHS))) $ groupBy ((==) `on` clauseLHS . theContent) pcs -} ces <- mapM (mapSndM pathToRecord) $ map (mapSnd $ sortBy (compare `on` thePath)) cps return $ map (\ (c, e) -> c { clauseRHS = RHS e }) ces where noCopats Clause{ clauseLHS = LHS _ LHSHead{} _ } = True noCopats _ = False rhsExpr (RHS e) = e rhsExpr _ = __IMPOSSIBLE__ -- | A sequence of decisions @b@ leading to a head @a@. data Path a b = Path { thePath :: [a] -- ^ the list of choices , theContent :: b } deriving (Functor) -- NB: this means @Path a@ is a functor for any @a@ mapContent :: (b -> c) -> Path a b -> Path a c mapContent f (Path p c) = Path p (f c) data ProjEntry = ProjEntry { projPE :: QName , patsPE :: [NamedArg Name] -- ^ currently we only support variable patterns } deriving (Eq, Ord) type ProjPath = Path ProjEntry instance HasRange ProjEntry where getRange (ProjEntry p ps) = getRange (p,ps) -- | This is a n^2 grouping algorithm which uses only alpha-equality groupClauses :: [ProjPath Clause] -> [(Clause, [ProjPath Expr])] groupClauses [] = [] groupClauses (pc@(Path p c) : pcs) = (c, Path p (rhs c) : grp) : groupClauses rest where (grp, rest) = collect pcs -- Collect l splits l into pc's group and the remainder -- If the lhs of the next clause is alpha-equivalent to the current lhs -- then add the next clause to this group, performing the alpha-conversion collect (Path p' c' : pcs) | Just rho <- alpha (clauseLHS c') (clauseLHS c) = mapFst (Path p' (rename' rho (rhs c')) :) $ collect pcs -- we go through all the clauses, since they could be in random order... collect (pc : pcs) = mapSnd (pc :) $ collect pcs collect [] = ([], []) rhs = rhsExpr . clauseRHS rhsExpr (RHS e) = e rhsExpr _ = __IMPOSSIBLE__ clauseToPath :: Clause -> ScopeM (ProjPath Clause) clauseToPath (Clause (LHS i lhs wps) (RHS e) []) = fmap (\ lhs -> Clause (LHS i lhs wps) (RHS e) []) <$> lhsToPath [] lhs clauseToPath (Clause lhs (RHS e) (_:_)) = typeError $ NotImplemented $ "copattern clauses with where declarations" clauseToPath (Clause lhs _ wheredecls) = typeError $ NotImplemented $ "copattern clauses with absurd, with or rewrite right hand side" lhsToPath :: [ProjEntry] -> LHSCore -> ScopeM (ProjPath LHSCore) lhsToPath acc lhs@LHSHead{} = return $ Path acc lhs lhsToPath acc (LHSProj f [] lhs ps) | Just xs <- mapM (T.mapM (T.mapM fromVarP)) ps = lhsToPath (ProjEntry f xs : acc) $ namedArg lhs where fromVarP :: Pattern -> Maybe Name fromVarP (VarP n) = Just n fromVarP _ = Nothing lhsToPath acc (LHSProj f _ lhs _) = typeError $ NotImplemented $ "copatterns with patterns before the principal argument" -- | Expects a sorted list. pathToRecord :: [ProjPath Expr] -> ScopeM Expr pathToRecord [] = __IMPOSSIBLE__ pathToRecord [Path [] e] = return e pathToRecord pps = case pathHeads pps of Nothing -> typeError $ GenericError $ "overlapping copattern clauses" Just pps -> do pes <- mapM (mapSndM pathToRecord) $ groupPathes pps let ei = ExprRange $ getRange $ map fst pes Rec ei <$> mapM abstractions pes where abstractions :: (ProjEntry, Expr) -> ScopeM (C.Name, Expr) abstractions (ProjEntry p xs, e) = (C.unqualify $ qnameToConcrete p,) <$> foldr abstract (return e) xs abstract :: NamedArg Name -> ScopeM Expr -> ScopeM Expr abstract (Common.Arg info (Named Nothing x)) me = Lam (ExprRange noRange) (DomainFree info x) <$> me abstract (Common.Arg _ (Named Just{} _)) me = typeError $ NotImplemented $ "named arguments in projection patterns" -- | Similar to 'groupClauses'. groupPathes :: [(ProjEntry, ProjPath Expr)] -> [(ProjEntry, [ProjPath Expr])] groupPathes [] = [] groupPathes ((pe@(ProjEntry p xs), path) : pps) = (pe, path : grp) : groupPathes rest -- Now group all following pps that have the same projection p -- We expect that they have alpha-equivalent xs where (grp, rest) = collect pps collect l@((ProjEntry p' xs', path) : pps) | p == p', Just rho <- alpha xs' xs = -- add the alpha-converted path to the group -- NOTE: because the path contains only projections and pattern vars -- we only alpha-convert the content (rhs Expr) -- When the path will contain dot patterns, we have to rename in them mapFst (mapContent (rename' rho) path :) $ collect pps collect l = ([], l) -- null or different projection: close group pathHeads :: [Path a b] -> Maybe [(a, Path a b)] pathHeads = mapM pathSplit pathSplit :: Path a b -> Maybe (a, Path a b) pathSplit (Path [] b) = Nothing pathSplit (Path (a:as) b) = Just (a, Path as b) -- * Alpha conversion type NameMap = [(Name,Name)] class Rename e where rename :: (Name -> Maybe Name) -> e -> e rename' :: NameMap -> e -> e rename' rho = rename (flip lookup rho) -- | 'QName's are not renamed. instance Rename QName where rename _ q = q instance Rename Expr where rename rho e = case e of Var x -> Var $ maybe x id (rho x) Def f -> e Proj f -> e Con c -> e Lit l -> e QuestionMark{} -> e Underscore i -> e App i e es -> App i (rename rho e) (rename rho es) WithApp i e es -> WithApp i (rename rho e) (rename rho es) Lam i lb e -> Lam i (rename rho lb) (rename rho e) AbsurdLam{} -> e ExtendedLam i i' n cs -> ExtendedLam i i' n (rename rho cs) Pi i tel e -> Pi i (rename rho tel) (rename rho e) Fun i a e -> Fun i (rename rho a) (rename rho e) Set{} -> e Prop{} -> e Let i bs e -> Let i (rename rho bs) (rename rho e) ETel tel -> ETel (rename rho tel) Rec i fes -> Rec i $ map (id -*- rename rho) fes RecUpdate i e fes -> RecUpdate i (rename rho e) $ map (id -*- rename rho) fes ScopedExpr i e -> ScopedExpr i (rename rho e) QuoteGoal i n e -> QuoteGoal i n (rename rho e) QuoteContext i n e -> QuoteContext i n (rename rho e) Quote i -> e QuoteTerm i -> e Unquote i -> e DontCare e -> DontCare (rename rho e) PatternSyn n -> e instance Rename LetBinding where rename rho e = case e of LetBind i r n e e' -> LetBind i r n (rename rho e) (rename rho e') LetPatBind i p e -> LetPatBind i (rename rho p) (rename rho e) LetApply{} -> e LetOpen{} -> e instance Rename LamBinding where rename rho e = case e of DomainFree{} -> e DomainFull tb -> DomainFull (rename rho tb) instance Rename TypedBindings where rename rho (TypedBindings r tb) = TypedBindings r (rename rho tb) instance Rename TypedBinding where rename rho (TBind r ns e) = TBind r ns (rename rho e) rename rho (TLet r lbs) = TLet r (rename rho lbs) instance Rename Clause where rename rho (Clause lhs rhs wheredecls) = Clause (rename rho lhs) (rename rho rhs) (rename rho wheredecls) instance Rename RHS where rename rho e = case e of RHS e -> RHS (rename rho e) AbsurdRHS -> e WithRHS n es cs -> WithRHS n (rename rho es) (rename rho cs) RewriteRHS nes r ds -> RewriteRHS (rename rho nes) (rename rho r) (rename rho ds) instance Rename LHS where rename rho (LHS i core ps) = LHS i (rename rho core) (rename rho ps) instance Rename LHSCore where rename rho = fmap (rename rho) -- only rename in dot patterns instance Rename Pattern where rename rho = fmap (rename rho) -- only rename in dot patterns instance Rename Declaration where rename rho d = __IMPOSSIBLE__ instance Rename a => Rename (Arg a) where rename rho = fmap (rename rho) instance Rename a => Rename (Named n a) where rename rho = fmap (rename rho) instance Rename a => Rename [a] where rename rho = map (rename rho) instance (Rename a, Rename b) => Rename (a, b) where rename rho (a,b) = (rename rho a, rename rho b) -- | Alpha-Equivalence of patterns, ignoring dot patterns class Alpha t where alpha :: t -> t -> Maybe NameMap alpha t t' = fmap snd $ runWriterT $ alpha' t t' alpha' :: t -> t -> WriterT NameMap Maybe () alpha' t t' = WriterT $ fmap ((),) $ alpha t t' instance Alpha Name where alpha' x x' = tell1 (x, x') instance Alpha (Pattern' e) where alpha' p p' = case (p,p') of ((VarP x) , (VarP x') ) -> tell1 (x, x') ((ConP _ x ps) , (ConP _ x' ps') ) -> guard (x == x') >> alpha' ps ps' ((DefP _ x ps) , (DefP _ x' ps') ) -> guard (x == x') >> alpha' ps ps' ((WildP _) , (WildP _) ) -> return () ((AsP _ x p) , (AsP _ x' p') ) -> tell1 (x, x') >> alpha' p p' ((DotP _ _) , (DotP _ _) ) -> return () (AbsurdP{} , AbsurdP{} ) -> return () ((LitP l) , (LitP l') ) -> guard (l == l') ((PatternSynP _ x ps) , (PatternSynP _ x' ps')) -> guard (x == x') >> alpha' ps ps' (_ , _ ) -> fail "not alpha equivalent" tell1 :: (MonadWriter [a] m) => a -> m () tell1 a = tell [a] instance Alpha (LHSCore' e) where alpha' (LHSHead f ps) (LHSHead f' ps') = guard (f == f') >> alpha' ps ps' alpha' (LHSProj d ps1 lhs ps2) (LHSProj d' ps1' lhs' ps2') = guard (d == d') >> alpha' ps1 ps1' >> alpha' lhs lhs' >> alpha' ps2 ps2' alpha' _ _ = fail "not alpha equivalent" instance Alpha LHS where alpha' (LHS _ core wps) (LHS _ core' wps') = alpha' core core' >> alpha' wps wps' instance Alpha a => Alpha (Arg a) where alpha' a a' = alpha' (unArg a) (unArg a') instance (Eq n, Alpha a) => Alpha (Named n a) where alpha' a a' = guard (nameOf a == nameOf a') >> alpha' (namedThing a) (namedThing a') instance Alpha a => Alpha [a] where alpha' l l' = guard (length l == length l') >> zipWithM_ alpha' l l' Agda-2.4.2.5/src/full/Agda/Syntax/Internal/0000755000000000000000000000000012635075266016347 5ustar0000000000000000Agda-2.4.2.5/src/full/Agda/Syntax/Internal/Generic.hs0000644000000000000000000001452012635075266020261 0ustar0000000000000000{-# LANGUAGE CPP #-} {-# LANGUAGE FlexibleInstances #-} module Agda.Syntax.Internal.Generic where import Control.Applicative import Data.Traversable import Data.Monoid import Data.Foldable import Agda.Syntax.Internal import Agda.Utils.Impossible #include "undefined.h" class TermLike a where traverseTerm :: (Term -> Term) -> a -> a traverseTermM :: (Monad m, Applicative m) => (Term -> m Term) -> a -> m a foldTerm :: Monoid m => (Term -> m) -> a -> m -- * Constants instance TermLike Bool where traverseTerm _ = id traverseTermM _ = pure foldTerm _ = mempty instance TermLike Int where traverseTerm _ = id traverseTermM _ = pure foldTerm _ = mempty instance TermLike Integer where traverseTerm _ = id traverseTermM _ = pure foldTerm _ = mempty instance TermLike Char where traverseTerm _ = id traverseTermM _ = pure foldTerm _ = mempty instance TermLike QName where traverseTerm _ = id traverseTermM _ = pure foldTerm _ = mempty -- * Functors instance TermLike a => TermLike (Elim' a) where traverseTerm f = fmap (traverseTerm f) traverseTermM f = traverse (traverseTermM f) foldTerm f = foldMap (foldTerm f) instance TermLike a => TermLike (Arg a) where traverseTerm f = fmap (traverseTerm f) traverseTermM f = traverse (traverseTermM f) foldTerm f = foldMap (foldTerm f) instance TermLike a => TermLike (Dom a) where traverseTerm f = fmap (traverseTerm f) traverseTermM f = traverse (traverseTermM f) foldTerm f = foldMap (foldTerm f) instance TermLike a => TermLike [a] where traverseTerm f = fmap (traverseTerm f) traverseTermM f = traverse (traverseTermM f) foldTerm f = foldMap (foldTerm f) instance TermLike a => TermLike (Maybe a) where traverseTerm f = fmap (traverseTerm f) traverseTermM f = traverse (traverseTermM f) foldTerm f = foldMap (foldTerm f) instance (TermLike a, TermLike b) => TermLike (a, b) where traverseTerm f (x, y) = (traverseTerm f x, traverseTerm f y) traverseTermM f (x, y) = (,) <$> traverseTermM f x <*> traverseTermM f y foldTerm f (x, y) = foldTerm f x `mappend` foldTerm f y instance (TermLike a, TermLike b, TermLike c) => TermLike (a, b, c) where traverseTerm f (x, y, z) = (traverseTerm f x, traverseTerm f y, traverseTerm f z) traverseTermM f (x, y, z) = (,,) <$> traverseTermM f x <*> traverseTermM f y <*> traverseTermM f z foldTerm f (x, y, z) = mconcat [foldTerm f x, foldTerm f y, foldTerm f z] instance (TermLike a, TermLike b, TermLike c, TermLike d) => TermLike (a, b, c, d) where traverseTerm f (x, y, z, u) = (traverseTerm f x, traverseTerm f y, traverseTerm f z, traverseTerm f u) traverseTermM f (x, y, z, u) = (,,,) <$> traverseTermM f x <*> traverseTermM f y <*> traverseTermM f z <*> traverseTermM f u foldTerm f (x, y, z, u) = mconcat [foldTerm f x, foldTerm f y, foldTerm f z, foldTerm f u] instance TermLike a => TermLike (Abs a) where traverseTerm f = fmap (traverseTerm f) traverseTermM f = traverse (traverseTermM f) foldTerm f = foldMap (foldTerm f) instance TermLike a => TermLike (Ptr a) where traverseTerm f = fmap (traverseTerm f) traverseTermM f = traverse (traverseTermM f) foldTerm f = foldMap (foldTerm f) -- * Real terms instance TermLike Term where traverseTerm f t = case t of Var i xs -> f $ Var i $ traverseTerm f xs Def c xs -> f $ Def c $ traverseTerm f xs Con c xs -> f $ Con c $ traverseTerm f xs Lam h b -> f $ Lam h $ traverseTerm f b Pi a b -> f $ uncurry Pi $ traverseTerm f (a, b) MetaV m xs -> f $ MetaV m $ traverseTerm f xs Level l -> f $ Level $ traverseTerm f l Lit _ -> f t Sort _ -> f t DontCare mv -> f $ DontCare $ traverseTerm f mv Shared p -> f $ Shared $ traverseTerm f p ExtLam{} -> __IMPOSSIBLE__ traverseTermM f t = case t of Var i xs -> f =<< Var i <$> traverseTermM f xs Def c xs -> f =<< Def c <$> traverseTermM f xs Con c xs -> f =<< Con c <$> traverseTermM f xs Lam h b -> f =<< Lam h <$> traverseTermM f b Pi a b -> f =<< uncurry Pi <$> traverseTermM f (a, b) MetaV m xs -> f =<< MetaV m <$> traverseTermM f xs Level l -> f =<< Level <$> traverseTermM f l Lit _ -> f t Sort _ -> f t DontCare mv -> f =<< DontCare <$> traverseTermM f mv Shared p -> f =<< Shared <$> traverseTermM f p ExtLam{} -> __IMPOSSIBLE__ foldTerm f t = f t `mappend` case t of Var i xs -> foldTerm f xs Def c xs -> foldTerm f xs Con c xs -> foldTerm f xs Lam h b -> foldTerm f b Pi a b -> foldTerm f (a, b) MetaV m xs -> foldTerm f xs Level l -> foldTerm f l Lit _ -> mempty Sort _ -> mempty DontCare mv -> foldTerm f mv Shared p -> foldTerm f p ExtLam{} -> __IMPOSSIBLE__ instance TermLike Level where traverseTerm f (Max as) = Max $ traverseTerm f as traverseTermM f (Max as) = Max <$> traverseTermM f as foldTerm f (Max as) = foldTerm f as instance TermLike PlusLevel where traverseTerm f l = case l of ClosedLevel{} -> l Plus n l -> Plus n $ traverseTerm f l traverseTermM f l = case l of ClosedLevel{} -> return l Plus n l -> Plus n <$> traverseTermM f l foldTerm f ClosedLevel{} = mempty foldTerm f (Plus _ l) = foldTerm f l instance TermLike LevelAtom where traverseTerm f l = case l of MetaLevel m vs -> MetaLevel m $ traverseTerm f vs NeutralLevel r v -> NeutralLevel r $ traverseTerm f v BlockedLevel m v -> BlockedLevel m $ traverseTerm f v UnreducedLevel v -> UnreducedLevel $ traverseTerm f v traverseTermM f l = case l of MetaLevel m vs -> MetaLevel m <$> traverseTermM f vs NeutralLevel r v -> NeutralLevel r <$> traverseTermM f v BlockedLevel m v -> BlockedLevel m <$> traverseTermM f v UnreducedLevel v -> UnreducedLevel <$> traverseTermM f v foldTerm f l = case l of MetaLevel m vs -> foldTerm f vs NeutralLevel _ v -> foldTerm f v BlockedLevel _ v -> foldTerm f v UnreducedLevel v -> foldTerm f v instance TermLike Type where traverseTerm f (El s t) = El s $ traverseTerm f t traverseTermM f (El s t) = El s <$> traverseTermM f t foldTerm f (El s t) = foldTerm f t -- | Put it in a monad to make it possible to do strictly. copyTerm :: (TermLike a, Applicative m, Monad m) => a -> m a copyTerm = traverseTermM return Agda-2.4.2.5/src/full/Agda/Syntax/Internal/Pattern.hs0000644000000000000000000001647412635075266020334 0ustar0000000000000000{-# LANGUAGE CPP #-} {-# LANGUAGE FlexibleContexts #-} {-# LANGUAGE FlexibleInstances #-} {-# LANGUAGE FunctionalDependencies #-} {-# LANGUAGE MultiParamTypeClasses #-} {-# LANGUAGE TupleSections #-} {-# LANGUAGE UndecidableInstances #-} -- because of func. deps. #if __GLASGOW_HASKELL__ <= 708 {-# LANGUAGE OverlappingInstances #-} #endif module Agda.Syntax.Internal.Pattern where import Control.Applicative import Control.Monad.State import Data.Maybe import Data.Traversable (traverse) import Agda.Syntax.Common as Common hiding (NamedArg) import Agda.Syntax.Abstract (IsProjP(..)) import Agda.Syntax.Internal hiding (Arg) import qualified Agda.Syntax.Internal as I import Agda.Utils.List import Agda.Utils.Functor ((<.>)) import Agda.Utils.Permutation import Agda.Utils.Size (size) import Agda.Utils.Tuple #include "undefined.h" import Agda.Utils.Impossible -- * Tools for clauses -- | Translate the clause patterns to terms with free variables bound by the -- clause telescope. -- -- Precondition: no projection patterns. clauseArgs :: Clause -> Args clauseArgs cl = fromMaybe __IMPOSSIBLE__ $ allApplyElims $ clauseElims cl -- | Translate the clause patterns to an elimination spine -- with free variables bound by the clause telescope. clauseElims :: Clause -> Elims clauseElims cl = patternsToElims (clausePerm cl) (namedClausePats cl) -- | Arity of a function, computed from clauses. class FunArity a where funArity :: a -> Int -- | Get the number of initial 'Apply' patterns. #if __GLASGOW_HASKELL__ >= 710 instance {-# OVERLAPPABLE #-} IsProjP p => FunArity [p] where #else instance IsProjP p => FunArity [p] where #endif funArity = length . takeWhile (isNothing . isProjP) -- | Get the number of initial 'Apply' patterns in a clause. instance FunArity Clause where funArity = funArity . clausePats -- | Get the number of common initial 'Apply' patterns in a list of clauses. #if __GLASGOW_HASKELL__ >= 710 instance {-# OVERLAPPING #-} FunArity [Clause] where #else instance FunArity [Clause] where #endif funArity [] = 0 funArity cls = minimum $ map funArity cls -- * Tools for patterns -- | Label the pattern variables from left to right -- using one label for each variable pattern and one for each dot pattern. class LabelPatVars a b i | b -> i where labelPatVars :: a -> State [i] b -- ^ Intended, but unpractical due to the absence of type-level lambda, is: -- @labelPatVars :: f (Pattern' x) -> State [i] (f (Pattern' (i,x)))@ instance LabelPatVars a b i => LabelPatVars (Arg c a) (Arg c b) i where labelPatVars = traverse labelPatVars instance LabelPatVars a b i => LabelPatVars (Named x a) (Named x b) i where labelPatVars = traverse labelPatVars instance LabelPatVars a b i => LabelPatVars [a] [b] i where labelPatVars = traverse labelPatVars instance LabelPatVars (Pattern' x) (Pattern' (i,x)) i where labelPatVars p = case p of VarP x -> VarP . (,x) <$> next DotP t -> DotP t <$ next ConP c mt ps -> ConP c mt <$> labelPatVars ps LitP l -> return $ LitP l ProjP q -> return $ ProjP q where next = do (x:xs) <- get; put xs; return x -- | Augment pattern variables with their de Bruijn index. {-# SPECIALIZE numberPatVars :: Permutation -> [NamedArg (Pattern' x)] -> [NamedArg (Pattern' (Int, x))] #-} {-# SPECIALIZE numberPatVars :: Permutation -> [NamedArg Pattern] -> [NamedArg DeBruijnPattern] #-} -- -- Example: -- @ -- f : (A : Set) (n : Nat) (v : Vec A n) -> ... -- f A .(suc n) (cons n x xs) -- -- clauseTel = (A : Set) (n : Nat) (x : A) (xs : Vec A n) -- perm = Perm 5 [0,2,3,4] -- invertP __IMPOSSIBLE__ perm = Perm 4 [0,__IMPOSSIBLE__,1,2,3] -- flipP ... = Perm 4 [3,__IMPOSSIBLE__,2,1,0] -- pats = A .(suc 2) (cons n x xs) -- dBpats = 3 .(suc 2) (cons 2 1 0 ) -- @ -- numberPatVars :: LabelPatVars a b Int => Permutation -> a -> b numberPatVars perm ps = evalState (labelPatVars ps) $ permPicks $ flipP $ invertP __IMPOSSIBLE__ perm patternsToElims :: Permutation -> [I.NamedArg Pattern] -> [Elim] patternsToElims perm ps = map build' $ numberPatVars perm ps where build' :: NamedArg (Pattern' (Int, PatVarName)) -> Elim build' = build . fmap namedThing build :: I.Arg (Pattern' (Int, PatVarName)) -> Elim build (Arg ai (VarP (i, _))) = Apply $ Arg ai $ var i build (Arg ai (ConP c _ ps)) = Apply $ Arg ai $ Con c $ map (argFromElim . build') ps build (Arg ai (DotP t) ) = Apply $ Arg ai t build (Arg ai (LitP l) ) = Apply $ Arg ai $ Lit l build (Arg ai (ProjP dest) ) = Proj $ dest -- patternsToElims :: Permutation -> [I.NamedArg Pattern] -> [Elim] -- patternsToElims perm ps = evalState (mapM build' ps) xs -- where -- xs = permute (invertP __IMPOSSIBLE__ perm) $ downFrom (size perm) -- tick :: State [Int] Int -- tick = do x : xs <- get; put xs; return x -- build' :: NamedArg Pattern -> State [Int] Elim -- build' = build . fmap namedThing -- build :: I.Arg Pattern -> State [Int] Elim -- build (Arg ai (VarP _) ) = Apply . Arg ai . var <$> tick -- build (Arg ai (ConP c _ ps)) = -- Apply . Arg ai . Con c <$> mapM (argFromElim <.> build') ps -- build (Arg ai (DotP t) ) = Apply (Arg ai t) <$ tick -- build (Arg ai (LitP l) ) = return $ Apply $ Arg ai $ Lit l -- build (Arg ai (ProjP dest) ) = return $ Proj $ dest -- * One hole patterns -- | A @OneholePattern@ is a linear pattern context @P@ such that for -- any non-projection pattern @p@, inserting @p@ into the single hole @P[p]@, -- yields again a non-projection pattern. data OneHolePatterns = OHPats [NamedArg Pattern] (NamedArg OneHolePattern) [NamedArg Pattern] deriving (Show) data OneHolePattern = Hole | OHCon ConHead ConPatternInfo OneHolePatterns -- ^ The type in 'ConPatternInfo' serves the same role as in 'ConP'. -- -- TODO: If a hole is plugged this type may -- have to be updated in some way. deriving (Show) plugHole :: Pattern -> OneHolePatterns -> [NamedArg Pattern] plugHole p (OHPats ps hole qs) = ps ++ [fmap (plug p <$>) hole] ++ qs where plug p Hole = p plug p (OHCon c mt h) = ConP c mt $ plugHole p h -- | @allHoles ps@ returns for each pattern variable @x@ in @ps@ a -- context @P@ such @P[x]@ is one of the patterns of @ps@. -- The @Ps@ are returned in the left-to-right order of the -- pattern variables in @ps@. allHoles :: [NamedArg Pattern] -> [OneHolePatterns] allHoles = map snd . allHolesWithContents allHolesWithContents :: [NamedArg Pattern] -> [(Pattern, OneHolePatterns)] allHolesWithContents [] = [] allHolesWithContents (p : ps) = map left phs ++ map (right p) (allHolesWithContents ps) where phs :: [(Pattern, NamedArg OneHolePattern)] phs = map (id -*- \h -> fmap (h <$) p) (holes $ namedArg p) holes :: Pattern -> [(Pattern, OneHolePattern)] holes p@(VarP _) = [(p, Hole)] holes p@(DotP _) = [(p, Hole)] holes (ConP c mt qs) = map (id -*- OHCon c mt) $ allHolesWithContents qs holes LitP{} = [] holes ProjP{} = [] left (p, ph) = (p, OHPats [] ph ps) right q (p, OHPats ps h qs) = (p, OHPats (q : ps) h qs) Agda-2.4.2.5/src/full/Agda/Syntax/Internal/Defs.hs0000644000000000000000000000703612635075266017572 0ustar0000000000000000{-# LANGUAGE CPP #-} {-# LANGUAGE FlexibleInstances #-} -- | Extract used definitions from terms. module Agda.Syntax.Internal.Defs where import Control.Monad.Reader import Control.Monad.Writer import qualified Data.Foldable as Fold import Agda.Syntax.Common import Agda.Syntax.Internal hiding (ArgInfo, Arg, Dom) import Agda.Utils.Impossible #include "undefined.h" -- | @getDefs' lookup emb a@ extracts all used definitions -- (functions, data/record types) from @a@, embedded into a monoid via @emb@. -- Instantiations of meta variables are obtained via @lookup@. -- -- Typical monoid instances would be @[QName]@ or @Set QName@. -- Note that @emb@ can also choose to discard a used definition -- by mapping to the unit of the monoid. getDefs' :: (GetDefs a, Monoid b) => (MetaId -> Maybe Term) -> (QName -> b) -> a -> b getDefs' lookup emb = execWriter . (`runReaderT` GetDefsEnv lookup emb) . getDefs -- | Inputs to and outputs of @getDefs'@ are organized as a monad. type GetDefsM b = ReaderT (GetDefsEnv b) (Writer b) data GetDefsEnv b = GetDefsEnv { lookupMeta :: MetaId -> Maybe Term , embDef :: QName -> b } -- | What it takes to get the used definitions. class Monad m => MonadGetDefs m where doDef :: QName -> m () doMeta :: MetaId -> m () instance Monoid b => MonadGetDefs (GetDefsM b) where doDef d = tell . ($ d) =<< asks embDef doMeta x = getDefs . ($ x) =<< asks lookupMeta -- | Getting the used definitions. class GetDefs a where getDefs :: MonadGetDefs m => a -> m () instance GetDefs Clause where getDefs = getDefs . clauseBody instance GetDefs ClauseBody where getDefs b = case b of Body v -> getDefs v Bind b -> getDefs b NoBody -> return () instance GetDefs Term where getDefs v = case v of Def d vs -> doDef d >> getDefs vs Con c vs -> getDefs vs Lit l -> return () Var i vs -> getDefs vs Lam _ v -> getDefs v Pi a b -> getDefs a >> getDefs b Sort s -> getDefs s Level l -> getDefs l MetaV x vs -> getDefs x >> getDefs vs DontCare v -> getDefs v Shared p -> getDefs $ derefPtr p -- TODO: exploit sharing! ExtLam _ _ -> __IMPOSSIBLE__ instance GetDefs MetaId where getDefs x = doMeta x instance GetDefs Type where getDefs (El s t) = getDefs s >> getDefs t instance GetDefs Sort where getDefs s = case s of Type l -> getDefs l Prop -> return () Inf -> return () SizeUniv -> return () DLub s s' -> getDefs s >> getDefs s' instance GetDefs Level where getDefs (Max ls) = getDefs ls instance GetDefs PlusLevel where getDefs ClosedLevel{} = return () getDefs (Plus _ l) = getDefs l instance GetDefs LevelAtom where getDefs a = case a of MetaLevel x vs -> getDefs x >> getDefs vs BlockedLevel _ v -> getDefs v NeutralLevel _ v -> getDefs v UnreducedLevel v -> getDefs v -- collection instances instance GetDefs a => GetDefs (Maybe a) where getDefs = Fold.mapM_ getDefs instance GetDefs a => GetDefs [a] where getDefs = Fold.mapM_ getDefs instance GetDefs a => GetDefs (Elim' a) where getDefs = Fold.mapM_ getDefs instance GetDefs c => GetDefs (ArgInfo c) where getDefs = Fold.mapM_ getDefs instance (GetDefs c, GetDefs a) => GetDefs (Arg c a) where getDefs (Arg c a) = getDefs c >> getDefs a instance (GetDefs c, GetDefs a) => GetDefs (Dom c a) where getDefs (Dom c a) = getDefs c >> getDefs a instance GetDefs a => GetDefs (Abs a) where getDefs = getDefs . unAbs instance (GetDefs a, GetDefs b) => GetDefs (a,b) where getDefs (a,b) = getDefs a >> getDefs b Agda-2.4.2.5/src/full/Agda/Syntax/Concrete/0000755000000000000000000000000012635075266016335 5ustar0000000000000000Agda-2.4.2.5/src/full/Agda/Syntax/Concrete/Pretty.hs0000644000000000000000000005032012635075266020160 0ustar0000000000000000{-# OPTIONS_GHC -fno-warn-orphans #-} {-# LANGUAGE CPP #-} {-# LANGUAGE FlexibleInstances #-} {-| Pretty printer for the concrete syntax. -} module Agda.Syntax.Concrete.Pretty where import Prelude hiding (null) import Data.Char import Data.Functor import Data.Maybe import qualified Agda.Syntax.Common as Common import Agda.Syntax.Common hiding (Arg, Dom, NamedArg, ArgInfo) import Agda.Syntax.Concrete import Agda.Syntax.Fixity import Agda.Syntax.Literal import Agda.Syntax.Notation import Agda.Syntax.Position import Agda.Utils.Functor import Agda.Utils.Null import Agda.Utils.Pretty import Agda.Utils.String #include "undefined.h" import Agda.Utils.Impossible instance Show Expr where show = show . pretty instance Show Declaration where show = show . pretty instance Show Pattern where show = show . pretty instance Show TypedBinding where show = show . pretty instance Show TypedBindings where show = show . pretty instance Show LamBinding where show = show . pretty instance Show ImportDirective where show = show . pretty instance Show Pragma where show = show . pretty instance Show RHS where show = show . pretty braces' :: Doc -> Doc braces' d = case render d of -- Add space to avoid starting a comment '-':_ -> braces (text " " <> d) _ -> braces d -- double braces... dbraces :: Doc -> Doc dbraces = braces . braces' -- Lays out a list of documents [d₁, d₂, …] in the following way: -- @ -- { d₁ -- ; d₂ -- ⋮ -- } -- @ -- If the list is empty, then the notation @{}@ is used. bracesAndSemicolons :: [Doc] -> Doc bracesAndSemicolons [] = text "{}" bracesAndSemicolons (d : ds) = sep ([text "{" <+> d] ++ map (text ";" <+>) ds ++ [text "}"]) arrow, lambda :: Doc arrow = text "\x2192" lambda = text "\x03bb" -- | @prettyHiding info visible doc@ puts the correct braces -- around @doc@ according to info @info@ and returns -- @visible doc@ if the we deal with a visible thing. prettyHiding :: LensHiding a => a -> (Doc -> Doc) -> Doc -> Doc prettyHiding a parens = case getHiding a of Hidden -> braces' Instance -> dbraces NotHidden -> parens prettyRelevance :: LensRelevance a => a -> Doc -> Doc prettyRelevance a d = if render d == "_" then d else pretty (getRelevance a) <> d instance (Pretty a, Pretty b) => Pretty (a, b) where pretty (a, b) = parens $ pretty a <> comma <+> pretty b instance Pretty (ThingWithFixity Name) where pretty (ThingWithFixity n _) = pretty n instance Pretty a => Pretty (WithHiding a) where pretty w = prettyHiding w id $ pretty $ dget w instance Pretty Relevance where pretty Forced{} = empty pretty UnusedArg = empty pretty Relevant = empty pretty Irrelevant = text "." pretty NonStrict = text ".." instance Pretty Induction where pretty Inductive = text "data" pretty CoInductive = text "codata" instance Pretty (OpApp Expr) where pretty (Ordinary e) = pretty e pretty (SyntaxBindingLambda r bs e) = pretty (Lam r bs e) instance Pretty Expr where pretty e = case e of Ident x -> pretty x Lit l -> pretty l QuestionMark _ n -> text "?" <> maybe empty (text . show) n Underscore _ n -> maybe underscore text n -- Underscore _ n -> underscore <> maybe empty (text . show) n App _ _ _ -> case appView e of AppView e1 args -> fsep $ pretty e1 : map pretty args -- sep [ pretty e1 -- , nest 2 $ fsep $ map pretty args -- ] RawApp _ es -> fsep $ map pretty es OpApp _ q _ es -> fsep $ prettyOpApp q es WithApp _ e es -> fsep $ pretty e : map ((text "|" <+>) . pretty) es HiddenArg _ e -> braces' $ pretty e InstanceArg _ e -> dbraces $ pretty e Lam _ bs e -> sep [ lambda <+> fsep (map pretty bs) <+> arrow , nest 2 $ pretty e ] AbsurdLam _ NotHidden -> lambda <+> text "()" AbsurdLam _ Instance -> lambda <+> text "{{}}" AbsurdLam _ Hidden -> lambda <+> text "{}" ExtendedLam _ pes -> lambda <+> bracesAndSemicolons (map (\(x,y,z) -> prettyClause x y z) pes) where prettyClause lhs rhs wh = sep [ pretty lhs , nest 2 $ pretty' rhs ] $$ nest 2 (pretty wh) pretty' (RHS e) = arrow <+> pretty e pretty' AbsurdRHS = empty Fun _ e1 e2 -> sep [ pretty e1 <+> arrow , pretty e2 ] Pi tel e -> sep [ pretty (Tel $ smashTel tel) <+> arrow , pretty e ] Set _ -> text "Set" Prop _ -> text "Prop" SetN _ n -> text "Set" <> text (showIndex n) Let _ ds e -> sep [ text "let" <+> vcat (map pretty ds) , text "in" <+> pretty e ] Paren _ e -> parens $ pretty e As _ x e -> pretty x <> text "@" <> pretty e Dot _ e -> text "." <> pretty e Absurd _ -> text "()" Rec _ xs -> sep [text "record", bracesAndSemicolons (map recPr xs)] RecUpdate _ e xs -> sep [text "record" <+> pretty e, bracesAndSemicolons (map recPr xs)] ETel [] -> text "()" ETel tel -> fsep $ map pretty tel QuoteGoal _ x e -> sep [text "quoteGoal" <+> pretty x <+> text "in", nest 2 $ pretty e] QuoteContext _ x e -> sep [text "quoteContext" <+> pretty x <+> text "in", nest 2 $ pretty e] Quote _ -> text "quote" QuoteTerm _ -> text "quoteTerm" Unquote _ -> text "unquote" Tactic _ t es -> sep [ text "tactic" <+> pretty t , fsep [ text "|" <+> pretty e | e <- es ] ] -- Andreas, 2011-10-03 print irrelevant things as .(e) DontCare e -> text "." <> parens (pretty e) Equal _ a b -> pretty a <+> text "=" <+> pretty b where recPr (x, e) = sep [ pretty x <+> text "=" , nest 2 $ pretty e ] instance Pretty BoundName where pretty BName{ boundName = x, boundLabel = l } | x == l = pretty x | otherwise = pretty l <+> text "=" <+> pretty x instance Pretty LamBinding where -- TODO guilhem: colors are unused (colored syntax disallowed) pretty (DomainFree i x) = prettyRelevance i $ prettyHiding i id $ pretty x pretty (DomainFull b) = pretty b instance Pretty TypedBindings where pretty (TypedBindings _ a) = prettyRelevance a $ prettyHiding a p $ pretty $ WithColors (argColors a) $ unArg a where p | isUnderscore (unArg a) = id | otherwise = parens isUnderscore (TBind _ _ (Underscore _ Nothing)) = True isUnderscore _ = False newtype Tel = Tel Telescope instance Pretty Tel where pretty (Tel tel) | any isMeta tel = text "∀" <+> fsep (map pretty tel) | otherwise = fsep (map pretty tel) where isMeta (TypedBindings _ (Common.Arg _ (TBind _ _ (Underscore _ Nothing)))) = True isMeta _ = False instance Pretty ColoredTypedBinding where -- (x y :{ i j } A) -> ... pretty (WithColors [] (TBind _ xs (Underscore _ Nothing))) = fsep (map pretty xs) pretty (WithColors [] (TLet _ ds)) = text "let" <+> vcat (map pretty ds) pretty (WithColors _ (TLet _ _)) = __IMPOSSIBLE__ pretty (WithColors cs (TBind _ xs e)) = sep [ fsep (map pretty xs) , pColors ":" cs <+> pretty e ] pColors :: String -> [Color] -> Doc pColors s [] = text s pColors s cs = text (s ++ "{") <+> fsep (map pretty cs) <+> text "}" instance Pretty TypedBinding where pretty (TBind _ xs e) = sep [ fsep (map pretty xs) , text ":" <+> pretty e ] pretty (TLet _ ds) = text "let" <+> vcat (map pretty ds) smashTel :: Telescope -> Telescope smashTel (TypedBindings r (Common.Arg i (TBind r' xs e)) : TypedBindings _ (Common.Arg i' (TBind _ ys e')) : tel) | show i == show i' && show e == show e' && all (isUnnamed . dget) (xs ++ ys) = smashTel (TypedBindings r (Common.Arg i (TBind r' (xs ++ ys) e)) : tel) where isUnnamed x = boundLabel x == boundName x smashTel (b : tel) = b : smashTel tel smashTel [] = [] instance Pretty RHS where pretty (RHS e) = text "=" <+> pretty e pretty AbsurdRHS = empty instance Show WhereClause where show = show . pretty instance Pretty WhereClause where pretty NoWhere = empty pretty (AnyWhere [Module _ x [] ds]) | isNoName (unqualify x) = vcat [ text "where", nest 2 (vcat $ map pretty ds) ] pretty (AnyWhere ds) = vcat [ text "where", nest 2 (vcat $ map pretty ds) ] pretty (SomeWhere m ds) = vcat [ hsep [ text "module", pretty m, text "where" ] , nest 2 (vcat $ map pretty ds) ] instance Show LHS where show = show . pretty instance Pretty LHS where pretty lhs = case lhs of LHS p ps eqs es -> pr (pretty p) ps eqs es Ellipsis _ ps eqs es -> pr (text "...") ps eqs es where pr d ps eqs es = sep [ d , nest 2 $ fsep $ map ((text "|" <+>) . pretty) ps , nest 2 $ pThing "rewrite" eqs , nest 2 $ pThing "with" es ] pThing thing [] = empty pThing thing (e : es) = fsep $ (text thing <+> pretty e) : map ((text "|" <+>) . pretty) es instance Show LHSCore where show = show . pretty instance Pretty LHSCore where pretty (LHSHead f ps) = sep $ pretty f : map (parens . pretty) ps pretty (LHSProj d ps lhscore ps') = sep $ pretty d : map (parens . pretty) ps ++ parens (pretty lhscore) : map (parens . pretty) ps' instance Pretty [Declaration] where pretty = vcat . map pretty instance Show ModuleApplication where show = show . pretty instance Pretty ModuleApplication where pretty (SectionApp _ bs e) = fsep (map pretty bs) <+> text "=" <+> pretty e pretty (RecordModuleIFS _ rec) = text "=" <+> pretty rec <+> text "{{...}}" instance Pretty Declaration where pretty d = case d of TypeSig i x e -> sep [ prettyRelevance i $ pretty x <+> pColors ":" (argInfoColors i) , nest 2 $ pretty e ] Field x (Common.Arg i e) -> sep [ text "field" , nest 2 $ prettyRelevance i $ prettyHiding i id $ pretty $ TypeSig (i {argInfoRelevance = Relevant}) x e ] FunClause lhs rhs wh -> sep [ pretty lhs , nest 2 $ pretty rhs ] $$ nest 2 (pretty wh) DataSig _ ind x tel e -> sep [ hsep [ pretty ind , pretty x , fcat (map pretty tel) ] , nest 2 $ hsep [ text ":" , pretty e ] ] Data _ ind x tel (Just e) cs -> sep [ hsep [ pretty ind , pretty x , fcat (map pretty tel) ] , nest 2 $ hsep [ text ":" , pretty e , text "where" ] ] $$ nest 2 (vcat $ map pretty cs) Data _ ind x tel Nothing cs -> sep [ hsep [ pretty ind , pretty x , fcat (map pretty tel) ] , nest 2 $ text "where" ] $$ nest 2 (vcat $ map pretty cs) RecordSig _ x tel e -> sep [ hsep [ text "record" , pretty x , fcat (map pretty tel) ] , nest 2 $ hsep [ text ":" , pretty e ] ] Record _ x ind con tel me cs -> sep [ hsep [ text "record" , pretty x , fcat (map pretty tel) ] , nest 2 $ pType me ] $$ nest 2 (vcat $ pInd ++ pCon ++ map pretty cs) where pType (Just e) = hsep [ text ":" , pretty e , text "where" ] pType Nothing = text "where" pInd = maybeToList $ text . show . rangedThing <$> ind pCon = maybeToList $ (text "constructor" <+>) . pretty <$> con Infix f xs -> pretty f <+> (fsep $ punctuate comma $ map pretty xs) Syntax n xs -> text "syntax" <+> pretty n <+> text "..." PatternSyn _ n as p -> text "pattern" <+> pretty n <+> fsep (map pretty as) <+> text "=" <+> pretty p Mutual _ ds -> namedBlock "mutual" ds Abstract _ ds -> namedBlock "abstract" ds Private _ ds -> namedBlock "private" ds InstanceB _ ds -> namedBlock "instance" ds Postulate _ ds -> namedBlock "postulate" ds Primitive _ ds -> namedBlock "primitive" ds Module _ x tel ds -> hsep [ text "module" , pretty x , fcat (map pretty tel) , text "where" ] $$ nest 2 (vcat $ map pretty ds) ModuleMacro _ x (SectionApp _ [] e) DoOpen i | isNoName x -> sep [ pretty DoOpen , nest 2 $ pretty e , nest 4 $ pretty i ] ModuleMacro _ x (SectionApp _ tel e) open i -> sep [ pretty open <+> text "module" <+> pretty x <+> fcat (map pretty tel) , nest 2 $ text "=" <+> pretty e <+> pretty i ] ModuleMacro _ x (RecordModuleIFS _ rec) open i -> sep [ pretty open <+> text "module" <+> pretty x , nest 2 $ text "=" <+> pretty rec <+> text "{{...}}" ] Open _ x i -> hsep [ text "open", pretty x, pretty i ] Import _ x rn open i -> hsep [ pretty open, text "import", pretty x, as rn, pretty i ] where as Nothing = empty as (Just x) = text "as" <+> pretty (asName x) UnquoteDecl _ x t -> sep [ text "unquoteDecl" <+> pretty x <+> text "=", nest 2 $ pretty t ] Pragma pr -> sep [ text "{-#" <+> pretty pr, text "#-}" ] where namedBlock s ds = sep [ text s , nest 2 $ vcat $ map pretty ds ] instance Pretty OpenShortHand where pretty DoOpen = text "open" pretty DontOpen = empty instance Pretty Pragma where pretty (OptionsPragma _ opts) = fsep $ map text $ "OPTIONS" : opts pretty (BuiltinPragma _ b x) = hsep [ text "BUILTIN", text b, pretty x ] pretty (RewritePragma _ x) = hsep [ text "REWRITE", pretty x ] pretty (CompiledPragma _ x hs) = hsep [ text "COMPILED", pretty x, text hs ] pretty (CompiledExportPragma _ x hs) = hsep [ text "COMPILED_EXPORT", pretty x, text hs ] pretty (CompiledTypePragma _ x hs) = hsep [ text "COMPILED_TYPE", pretty x, text hs ] pretty (CompiledDataPragma _ x hs hcs) = hsep $ [text "COMPILED_DATA", pretty x] ++ map text (hs : hcs) pretty (CompiledEpicPragma _ x e) = hsep [ text "COMPILED_EPIC", pretty x, text e ] pretty (CompiledJSPragma _ x e) = hsep [ text "COMPILED_JS", pretty x, text e ] pretty (StaticPragma _ i) = hsep $ [text "STATIC", pretty i] pretty (ImportPragma _ i) = hsep $ [text "IMPORT", text i] pretty (ImpossiblePragma _) = hsep $ [text "IMPOSSIBLE"] pretty (EtaPragma _ x) = hsep $ [text "ETA", pretty x] pretty (TerminationCheckPragma _ tc) = case tc of TerminationCheck -> __IMPOSSIBLE__ NoTerminationCheck -> text "NO_TERMINATION_CHECK" NonTerminating -> text "NON_TERMINATING" Terminating -> text "TERMINATING" TerminationMeasure _ x -> hsep $ [text "MEASURE", pretty x] instance Pretty Fixity where pretty (Fixity _ n ass) = text s <+> text (show n) where s = case ass of LeftAssoc -> "infixl" RightAssoc -> "infixr" NonAssoc -> "infix" instance Pretty GenPart where pretty (IdPart x) = text x pretty BindHole{} = underscore pretty NormalHole{} = underscore instance Pretty Notation where pretty = hcat . map pretty instance Pretty Fixity' where pretty (Fixity' fix nota) | nota == defaultNotation = pretty fix | otherwise = text "syntax" <+> pretty nota instance Pretty e => Pretty (Arg e) where -- Andreas 2010-09-21: do not print relevance in general, only in function types! -- Andreas 2010-09-24: and in record fields pretty a = -- pRelevance r $ -- TODO guilhem: print colors prettyHiding (argInfo a) id $ pretty $ unArg a instance Pretty e => Pretty (Named_ e) where pretty (Named Nothing e) = pretty e pretty (Named (Just s) e) = sep [ text (rawNameToString $ rangedThing s) <+> text "=", pretty e ] instance Pretty [Pattern] where pretty = fsep . map pretty instance Pretty Pattern where pretty p = case p of IdentP x -> pretty x AppP p1 p2 -> sep [ pretty p1, nest 2 $ pretty p2 ] RawAppP _ ps -> fsep $ map pretty ps OpAppP _ q _ ps -> fsep $ prettyOpApp q ps HiddenP _ p -> braces' $ pretty p InstanceP _ p -> dbraces $ pretty p ParenP _ p -> parens $ pretty p WildP _ -> underscore AsP _ x p -> pretty x <> text "@" <> pretty p DotP _ p -> text "." <> pretty p AbsurdP _ -> text "()" LitP l -> pretty l QuoteP _ -> text "quote" prettyOpApp :: Pretty a => QName -> [a] -> [Doc] prettyOpApp q es = prOp ms xs es where ms = init (qnameParts q) xs = case unqualify q of Name _ xs -> xs NoName{} -> __IMPOSSIBLE__ prOp ms (Hole : xs) (e : es) = pretty e : prOp ms xs es prOp _ (Hole : _) [] = __IMPOSSIBLE__ prOp ms (Id x : xs) es = pretty (foldr Qual (QName (Name noRange $ [Id x])) ms) : prOp [] xs es prOp _ [] [] = [] prOp _ [] es = map pretty es instance Pretty ImportDirective where pretty i = sep [ public (publicOpen i) , pretty $ usingOrHiding i , rename $ renaming i ] where public True = text "public" public False = empty rename [] = empty rename xs = hsep [ text "renaming" , parens $ fsep $ punctuate (text ";") $ map pr xs ] pr r = hsep [ pretty (renFrom r), text "to", pretty (renTo r) ] instance Pretty UsingOrHiding where pretty (Hiding []) = empty pretty (Hiding xs) = text "hiding" <+> parens (fsep $ punctuate (text ";") $ map pretty xs) pretty (Using xs) = text "using" <+> parens (fsep $ punctuate (text ";") $ map pretty xs) instance Pretty ImportedName where pretty (ImportedName x) = pretty x pretty (ImportedModule x) = text "module" <+> pretty x Agda-2.4.2.5/src/full/Agda/Syntax/Concrete/Generic.hs0000644000000000000000000001644512635075266020257 0ustar0000000000000000{-# LANGUAGE CPP #-} {-# LANGUAGE FlexibleInstances #-} -- | Generic traversal and reduce for concrete syntax, -- in the style of "Agda.Syntax.Internal.Generic". -- -- However, here we use the terminology of 'Data.Traversable'. module Agda.Syntax.Concrete.Generic where import Control.Applicative import Data.Traversable import Data.Monoid import Data.Foldable import Agda.Syntax.Common hiding (Arg) import Agda.Syntax.Concrete #include "undefined.h" import Agda.Utils.Impossible -- | Generic traversals for concrete expressions. -- -- Note: does not go into patterns! class ExprLike a where mapExpr :: (Expr -> Expr) -> a -> a -- ^ This corresponds to 'map'. traverseExpr :: (Monad m, Applicative m) => (Expr -> m Expr) -> a -> m a -- ^ This corresponds to 'mapM'. foldExpr :: Monoid m => (Expr -> m) -> a -> m -- ^ This is a reduce. traverseExpr = __IMPOSSIBLE__ -- TODO: implement! foldExpr = __IMPOSSIBLE__ -- TODO: implement! -- * Instances for things that do not contain expressions. instance ExprLike Name where mapExpr f = id instance ExprLike QName where mapExpr f = id -- * Instances for functors. instance ExprLike a => ExprLike (Named name a) where mapExpr = fmap . mapExpr traverseExpr = traverse . traverseExpr foldExpr = foldMap . foldExpr instance ExprLike a => ExprLike (Arg a) where -- TODO guilhem mapExpr = fmap . mapExpr traverseExpr = traverse . traverseExpr foldExpr = foldMap . foldExpr instance ExprLike a => ExprLike [a] where mapExpr = fmap . mapExpr traverseExpr = traverse . traverseExpr foldExpr = foldMap . foldExpr instance ExprLike a => ExprLike (Maybe a) where mapExpr = fmap . mapExpr traverseExpr = traverse . traverseExpr foldExpr = foldMap . foldExpr instance ExprLike a => ExprLike (TypedBinding' a) where mapExpr = fmap . mapExpr traverseExpr = traverse . traverseExpr foldExpr = foldMap . foldExpr instance ExprLike a => ExprLike (RHS' a) where mapExpr = fmap . mapExpr traverseExpr = traverse . traverseExpr foldExpr = foldMap . foldExpr instance ExprLike a => ExprLike (WhereClause' a) where mapExpr = fmap . mapExpr traverseExpr = traverse . traverseExpr foldExpr = foldMap . foldExpr instance (ExprLike a, ExprLike b) => ExprLike (a, b) where mapExpr f (x, y) = (mapExpr f x, mapExpr f y) traverseExpr f (x, y) = (,) <$> traverseExpr f x <*> traverseExpr f y foldExpr f (x, y) = foldExpr f x `mappend` foldExpr f y instance (ExprLike a, ExprLike b, ExprLike c) => ExprLike (a, b, c) where mapExpr f (x, y, z) = (mapExpr f x, mapExpr f y, mapExpr f z) traverseExpr f (x, y, z) = (,,) <$> traverseExpr f x <*> traverseExpr f y <*> traverseExpr f z foldExpr f (x, y, z) = foldExpr f x `mappend` foldExpr f y `mappend` foldExpr f z -- * Interesting instances instance ExprLike Expr where mapExpr f e0 = case e0 of Ident{} -> f $ e0 Lit{} -> f $ e0 QuestionMark{} -> f $ e0 Underscore{} -> f $ e0 RawApp r es -> f $ RawApp r $ mapE es App r e es -> f $ App r (mapE e) $ mapE es OpApp r q ns es -> f $ OpApp r q ns $ mapE es WithApp r e es -> f $ WithApp r (mapE e) $ mapE es HiddenArg r e -> f $ HiddenArg r $ mapE e InstanceArg r e -> f $ InstanceArg r $ mapE e Lam r bs e -> f $ Lam r (mapE bs) $ mapE e AbsurdLam{} -> f $ e0 ExtendedLam r cs -> f $ ExtendedLam r $ mapE cs Fun r a b -> f $ Fun r (mapE a) $ mapE b Pi tel e -> f $ Pi (mapE tel) $ mapE e Set{} -> f $ e0 Prop{} -> f $ e0 SetN{} -> f $ e0 Rec r es -> f $ Rec r $ mapE es RecUpdate r e es -> f $ RecUpdate r (mapE e) $ mapE es Let r ds e -> f $ Let r (mapE ds) $ mapE e Paren r e -> f $ Paren r $ mapE e Absurd{} -> f $ e0 As r x e -> f $ As r x $ mapE e Dot r e -> f $ Dot r $ mapE e ETel tel -> f $ ETel $ mapE tel QuoteGoal r x e -> f $ QuoteGoal r x $ mapE e QuoteContext r x e -> f $ QuoteContext r x $ mapE e Tactic r e es -> f $ Tactic r (mapE e) $ mapE es Quote{} -> f $ e0 QuoteTerm{} -> f $ e0 Unquote{} -> f $ e0 DontCare e -> f $ DontCare $ mapE e Equal{} -> f $ e0 where mapE e = mapExpr f e instance ExprLike a => ExprLike (OpApp a) where mapExpr f e0 = case e0 of SyntaxBindingLambda r bs e -> SyntaxBindingLambda r (mapE bs) $ mapE e Ordinary e -> Ordinary $ mapE e where mapE e = mapExpr f e instance ExprLike LamBinding where mapExpr f e0 = case e0 of DomainFree{} -> e0 DomainFull bs -> DomainFull $ mapE bs where mapE e = mapExpr f e instance ExprLike TypedBindings where mapExpr f e0 = case e0 of TypedBindings r b -> TypedBindings r $ mapE b where mapE e = mapExpr f e instance ExprLike LHS where mapExpr f e0 = case e0 of LHS ps wps res wes -> LHS ps wps (mapE res) $ mapE wes Ellipsis r ps res wes -> Ellipsis r ps (mapE res) $ mapE wes where mapE e = mapExpr f e instance ExprLike ModuleApplication where mapExpr f e0 = case e0 of SectionApp r bs e -> SectionApp r (mapE bs) $ mapE e RecordModuleIFS{} -> e0 where mapE e = mapExpr f e instance ExprLike Declaration where mapExpr f e0 = case e0 of TypeSig ai x e -> TypeSig ai x $ mapE e Field x e -> Field x $ mapE e FunClause lhs rhs wh -> FunClause (mapE lhs) (mapE rhs) $ mapE wh DataSig r ind x bs e -> DataSig r ind x (mapE bs) $ mapE e Data r ind n bs e cs -> Data r ind n (mapE bs) (mapE e) $ mapE cs RecordSig r ind bs e -> RecordSig r ind (mapE bs) $ mapE e Record r n ind c tel e ds -> Record r n ind c (mapE tel) (mapE e) $ mapE ds Infix{} -> e0 Syntax{} -> e0 PatternSyn{} -> e0 Mutual r ds -> Mutual r $ mapE ds Abstract r ds -> Abstract r $ mapE ds Private r ds -> Private r $ mapE ds InstanceB r ds -> InstanceB r $ mapE ds Postulate r ds -> Postulate r $ mapE ds Primitive r ds -> Primitive r $ mapE ds Open{} -> e0 Import{} -> e0 ModuleMacro r n es op dir -> ModuleMacro r n (mapE es) op dir Module r n tel ds -> Module r n (mapE tel) $ mapE ds UnquoteDecl r x e -> UnquoteDecl r x (mapE e) Pragma{} -> e0 where mapE e = mapExpr f e {- Template instance ExprLike a where mapExpr f e0 = case e0 of where mapE e = mapExpr f e -} Agda-2.4.2.5/src/full/Agda/Syntax/Concrete/Name.hs0000644000000000000000000002522512635075266017557 0ustar0000000000000000{-# LANGUAGE CPP #-} {-# LANGUAGE DeriveDataTypeable #-} {-# LANGUAGE DeriveGeneric #-} {-# LANGUAGE FlexibleInstances #-} {-# LANGUAGE PatternGuards #-} {-# LANGUAGE StandaloneDeriving #-} {-| Names in the concrete syntax are just strings (or lists of strings for qualified names). -} module Agda.Syntax.Concrete.Name where import Control.DeepSeq import Control.Applicative import Data.ByteString.Char8 (ByteString) import qualified Data.ByteString.Char8 as ByteString import Data.List import Data.Typeable (Typeable) import GHC.Generics (Generic) import System.FilePath import Test.QuickCheck import Agda.Syntax.Common import Agda.Syntax.Position import Agda.Utils.FileName import Agda.Utils.Pretty #include "undefined.h" import Agda.Utils.Impossible {-| A name is a non-empty list of alternating 'Id's and 'Hole's. A normal name is represented by a singleton list, and operators are represented by a list with 'Hole's where the arguments should go. For instance: @[Hole,Id "+",Hole]@ is infix addition. Equality and ordering on @Name@s are defined to ignore range so same names in different locations are equal. -} data Name = Name !Range [NamePart] -- ^ A (mixfix) identifier. | NoName !Range NameId -- ^ @_@. deriving (Typeable) instance NFData Name where rnf x = seq x () instance Underscore Name where underscore = NoName noRange __IMPOSSIBLE__ isUnderscore NoName{} = True isUnderscore (Name _ [Id x]) = isUnderscore x isUnderscore _ = False -- | Mixfix identifiers are composed of words and holes, -- e.g. @_+_@ or @if_then_else_@ or @[_/_]@. data NamePart = Hole -- ^ @_@ part. | Id RawName -- ^ Identifier part. deriving (Typeable, Generic) -- | Define equality on @Name@ to ignore range so same names in different -- locations are equal. -- -- Is there a reason not to do this? -Jeff -- -- No. But there are tons of reasons to do it. For instance, when using -- names as keys in maps you really don't want to have to get the range -- right to be able to do a lookup. -Ulf instance Eq Name where Name _ xs == Name _ ys = xs == ys NoName _ i == NoName _ j = i == j _ == _ = False instance Ord Name where compare (Name _ xs) (Name _ ys) = compare xs ys compare (NoName _ i) (NoName _ j) = compare i j compare (NoName {}) (Name {}) = LT compare (Name {}) (NoName {}) = GT instance Eq NamePart where Hole == Hole = True Id s1 == Id s2 = s1 == s2 _ == _ = False instance Ord NamePart where compare Hole Hole = EQ compare Hole (Id {}) = LT compare (Id {}) Hole = GT compare (Id s1) (Id s2) = compare s1 s2 -- | @QName@ is a list of namespaces and the name of the constant. -- For the moment assumes namespaces are just @Name@s and not -- explicitly applied modules. -- Also assumes namespaces are generative by just using derived -- equality. We will have to define an equality instance to -- non-generative namespaces (as well as having some sort of -- lookup table for namespace names). data QName = Qual Name QName -- ^ @A.rest@. | QName Name -- ^ @x@. deriving (Typeable, Eq, Ord) instance Underscore QName where underscore = QName underscore isUnderscore (QName x) = isUnderscore x isUnderscore Qual{} = False -- | Top-level module names. Used in connection with the file system. -- -- Invariant: The list must not be empty. newtype TopLevelModuleName = TopLevelModuleName { moduleNameParts :: [String] } deriving (Show, Eq, Ord, Typeable) ------------------------------------------------------------------------ -- * Operations on 'Name' and 'NamePart' ------------------------------------------------------------------------ nameToRawName :: Name -> RawName nameToRawName = prettyShow nameParts :: Name -> [NamePart] nameParts (Name _ ps) = ps nameParts (NoName _ _) = [Hole] nameStringParts :: Name -> [RawName] nameStringParts n = [ s | Id s <- nameParts n ] -- | Parse a string to parts of a concrete name. stringNameParts :: String -> [NamePart] stringNameParts "" = [] stringNameParts ('_':s) = Hole : stringNameParts s stringNameParts s | (x, s') <- break (== '_') s = Id (stringToRawName x) : stringNameParts s' -- | Is the name an operator? isOperator :: Name -> Bool isOperator (NoName {}) = False isOperator (Name _ ps) = length ps > 1 isHole :: NamePart -> Bool isHole Hole = True isHole _ = False isPrefix, isPostfix, isInfix, isNonfix :: Name -> Bool isPrefix x = not (isHole (head xs)) && isHole (last xs) where xs = nameParts x isPostfix x = isHole (head xs) && not (isHole (last xs)) where xs = nameParts x isInfix x = isHole (head xs) && isHole (last xs) where xs = nameParts x isNonfix x = not (isHole (head xs)) && not (isHole (last xs)) where xs = nameParts x ------------------------------------------------------------------------ -- * Operations on qualified names ------------------------------------------------------------------------ -- | @qualify A.B x == A.B.x@ qualify :: QName -> Name -> QName qualify (QName m) x = Qual m (QName x) qualify (Qual m m') x = Qual m $ qualify m' x -- | @unqualify A.B.x == x@ -- -- The range is preserved. unqualify :: QName -> Name unqualify q = unqualify' q `withRangeOf` q where unqualify' (QName x) = x unqualify' (Qual _ x) = unqualify' x -- | @qnameParts A.B.x = [A, B, x]@ qnameParts :: QName -> [Name] qnameParts (Qual x q) = x : qnameParts q qnameParts (QName x) = [x] ------------------------------------------------------------------------ -- * Operations on 'TopLevelModuleName' ------------------------------------------------------------------------ -- | Turns a qualified name into a 'TopLevelModuleName'. The qualified -- name is assumed to represent a top-level module name. toTopLevelModuleName :: QName -> TopLevelModuleName toTopLevelModuleName = TopLevelModuleName . map prettyShow . qnameParts -- | Turns a top-level module name into a file name with the given -- suffix. moduleNameToFileName :: TopLevelModuleName -> String -> FilePath moduleNameToFileName (TopLevelModuleName []) ext = __IMPOSSIBLE__ moduleNameToFileName (TopLevelModuleName ms) ext = joinPath (init ms) last ms <.> ext -- | Finds the current project's \"root\" directory, given a project -- file and the corresponding top-level module name. -- -- Example: If the module \"A.B.C\" is located in the file -- \"/foo/A/B/C.agda\", then the root is \"/foo/\". -- -- Precondition: The module name must be well-formed. projectRoot :: AbsolutePath -> TopLevelModuleName -> AbsolutePath projectRoot file (TopLevelModuleName m) = mkAbsolute $ foldr (.) id (replicate (length m - 1) takeDirectory) $ takeDirectory $ filePath file ------------------------------------------------------------------------ -- * No name stuff ------------------------------------------------------------------------ -- | @noName_ = 'noName' 'noRange'@ noName_ :: Name noName_ = noName noRange -- | @noName r = 'Name' r ['Hole']@ noName :: Range -> Name noName r = NoName r (NameId 0 0) -- | Check whether a name is the empty name "_". class IsNoName a where isNoName :: a -> Bool instance IsNoName String where isNoName = isUnderscore instance IsNoName ByteString where isNoName = isUnderscore instance IsNoName Name where isNoName (NoName _ _) = True isNoName (Name _ [Hole]) = True -- TODO: Track down where these come from isNoName (Name _ []) = True isNoName _ = False instance IsNoName QName where isNoName (QName x) = isNoName x isNoName Qual{} = False -- M.A._ does not qualify as empty name -- no instance for TopLevelModuleName ------------------------------------------------------------------------ -- * Showing names ------------------------------------------------------------------------ -- deriving instance Show Name -- deriving instance Show NamePart -- deriving instance Show QName -- TODO: 'Show' should output Haskell-parseable representations. -- The following instances are deprecated, and Pretty should be used -- instead. Later, simply derive Show for these types: instance Show Name where show = prettyShow instance Show NamePart where show = prettyShow instance Show QName where show = prettyShow ------------------------------------------------------------------------ -- * Printing names ------------------------------------------------------------------------ instance Pretty Name where pretty (Name _ xs) = hcat $ map pretty xs pretty (NoName _ _) = text $ "_" instance Pretty NamePart where pretty Hole = text $ "_" pretty (Id s) = text $ rawNameToString s instance Pretty QName where pretty (Qual m x) = pretty m <> pretty "." <> pretty x pretty (QName x) = pretty x instance Pretty TopLevelModuleName where pretty (TopLevelModuleName ms) = text $ intercalate "." ms ------------------------------------------------------------------------ -- * QuickCheck instances ------------------------------------------------------------------------ instance Arbitrary TopLevelModuleName where arbitrary = TopLevelModuleName <$> listOf1 (listOf1 $ elements "AB") instance CoArbitrary TopLevelModuleName where coarbitrary (TopLevelModuleName m) = coarbitrary m instance Arbitrary Name where arbitrary = oneof [ Name <$> arbitrary <*> parts , NoName <$> arbitrary <*> arbitrary ] where parts = do parts <- listOf1 (elements ["x", "y", "z"]) startWithHole <- arbitrary endWithHole <- arbitrary return $ (if startWithHole then (Hole :) else id) $ (if endWithHole then (++ [Hole]) else id) $ intersperse Hole (map Id parts) instance CoArbitrary NamePart instance CoArbitrary Name where coarbitrary (Name _ ns) = variant 0 . coarbitrary ns coarbitrary (NoName _ i) = variant 1 . coarbitrary i ------------------------------------------------------------------------ -- * Range instances ------------------------------------------------------------------------ instance HasRange Name where getRange (Name r ps) = r getRange (NoName r _) = r instance HasRange QName where getRange (QName x) = getRange x getRange (Qual n x) = fuseRange n x instance SetRange Name where setRange r (Name _ ps) = Name r ps setRange r (NoName _ i) = NoName r i instance SetRange QName where setRange r (QName x) = QName (setRange r x) setRange r (Qual n x) = Qual (setRange r n) (setRange r x) instance KillRange QName where killRange (QName x) = QName $ killRange x killRange (Qual n x) = killRange n `Qual` killRange x instance KillRange Name where killRange (Name r ps) = Name (killRange r) ps killRange (NoName r i) = NoName (killRange r) i Agda-2.4.2.5/src/full/Agda/Syntax/Concrete/Operators.hs0000644000000000000000000004474612635075266020666 0ustar0000000000000000{-# LANGUAGE CPP #-} {-# LANGUAGE ScopedTypeVariables #-} {-| The parser doesn't know about operators and parses everything as normal function application. This module contains the functions that parses the operators properly. For a stand-alone implementation of this see @src\/prototyping\/mixfix\/old@. It also contains the function that puts parenthesis back given the precedence of the context. -} module Agda.Syntax.Concrete.Operators ( parseApplication , parseModuleApplication , parseLHS , parsePattern , parsePatternSyn ) where import Control.DeepSeq import Control.Applicative import Control.Monad import Data.Either (partitionEithers) import Data.Function import Data.List import Data.Maybe import Data.Map (Map) import qualified Data.Map as Map import Data.Set (Set) import qualified Data.Set as Set import Data.Traversable (traverse) import qualified Data.Traversable as Trav import Agda.Syntax.Concrete.Pretty () import Agda.Syntax.Common hiding (Arg, Dom, NamedArg) import qualified Agda.Syntax.Common as Common import Agda.Syntax.Concrete hiding (appView) import Agda.Syntax.Concrete.Operators.Parser import qualified Agda.Syntax.Abstract.Name as A import Agda.Syntax.Position import Agda.Syntax.Fixity import Agda.Syntax.Notation import Agda.Syntax.Scope.Base import Agda.Syntax.Scope.Monad import Agda.TypeChecking.Monad.Base (typeError, TypeError(..), LHSOrPatSyn(..)) import qualified Agda.TypeChecking.Monad.Benchmark as Bench import Agda.TypeChecking.Monad.State (getScope) import Agda.TypeChecking.Monad.Options import Agda.Utils.Either import Agda.Utils.ReadP #if MIN_VERSION_base(4,8,0) import Agda.Utils.List hiding ( uncons ) #else import Agda.Utils.List #endif #include "undefined.h" import Agda.Utils.Impossible --------------------------------------------------------------------------- -- * Billing --------------------------------------------------------------------------- -- | Bills the operator parser. billToParser :: ScopeM a -> ScopeM a billToParser = Bench.billTo [Bench.Parsing, Bench.Operators] --------------------------------------------------------------------------- -- * Building the parser --------------------------------------------------------------------------- type FlatScope = Map QName [AbstractName] -- | Compute all defined names in scope and their fixities/notations. -- Note that overloaded names (constructors) can have several -- fixities/notations. Then we 'mergeNotations'. (See issue 1194.) getDefinedNames :: [KindOfName] -> FlatScope -> [[NewNotation]] getDefinedNames kinds names = [ mergeNotations $ map (\d -> namesToNotation x (A.qnameName $ anameName d)) ds | (x, ds) <- Map.toList names , any ((`elem` kinds) . anameKind) ds , not (null ds) -- Andreas, 2013-03-21 see Issue 822 -- Names can have different kinds, i.e., 'defined' and 'constructor'. -- We need to consider all names that have *any* matching kind, -- not only those whose first appearing kind is matching. ] -- | Compute all names (first component) and operators/notations -- (second component) in scope. localNames :: FlatScope -> ScopeM ([QName], [NewNotation]) localNames flat = do let defs = getDefinedNames allKindsOfNames flat locals <- notShadowedLocals <$> getLocalVars -- Note: Debug printout aligned with the one in buildParsers. reportSLn "scope.operators" 50 $ unlines [ "flat = " ++ show flat , "defs = " ++ show defs , "locals= " ++ show locals ] let localNots = map localOp locals localNames = Set.fromList $ map notaName localNots otherNots = filter (\n -> not (Set.member (notaName n) localNames)) (concat defs) return $ split $ localNots ++ otherNots where localOp (x, y) = namesToNotation (QName x) y split ops = partitionEithers $ concatMap opOrNot ops opOrNot n = Left (notaName n) : if null (notation n) then [] else [Right n] -- | Data structure filled in by @buildParsers@. -- The top-level parser @pTop@ is of primary interest, -- but @pArgs@ is used to convert module application -- from concrete to abstract syntax. data Parsers e = Parsers { pTop :: ReadP e e , pApp :: ReadP e e , pArgs :: ReadP e [NamedArg e] , pNonfix :: ReadP e e , pAtom :: ReadP e e } data UseBoundNames = UseBoundNames | DontUseBoundNames {-| Builds parser for operator applications from all the operators and function symbols in scope. When parsing a pattern we use 'DontUseBoundNames'. The effect is that operator parts (that are not constructor parts) can be used as atomic names in the pattern (so they can be rebound). See test/succeed/OpBind.agda for an example. To avoid problems with operators of the same precedence but different associativity we decide (completely arbitrary) to fix the precedences of operators with the same given precedence in the following order (from loosest to hardest): - non-associative - left associative - right associative - prefix - postfix This has the effect that if you mix operators with the same precedence but different associativity the parser won't complain. One could argue that this is a Bad Thing, but since it's not trivial to implement the check it will stay this way until people start complaining about it. -} buildParsers :: forall e. IsExpr e => Range -> FlatScope -> UseBoundNames -> ScopeM (Parsers e) buildParsers r flat use = do (names, ops) <- localNames flat let cons = getDefinedNames [ConName, PatternSynName] flat reportSLn "scope.operators" 50 $ unlines [ "names = " ++ show names , "ops = " ++ show ops , "cons = " ++ show cons ] let conparts = Set.fromList $ concatMap notationNames $ concat cons opsparts = Set.fromList $ concatMap notationNames ops allParts = Set.union conparts opsparts connames = Set.fromList $ map (notaName . head) cons (non, fix) = partition nonfix ops set = Set.fromList names isAtom x = case use of UseBoundNames -> not (Set.member x allParts) || Set.member x set DontUseBoundNames -> not (Set.member x conparts) || Set.member x connames -- If string is a part of notation, it cannot be used as an identifier, -- unless it is also used as an identifier. See issue 307. let chain = foldr ( $ ) return $ Data.Function.fix $ \p -> Parsers { pTop = chain (pApp p) (concatMap (mkP (pTop p)) (order fix)) , pApp = appP (pNonfix p) (pArgs p) , pArgs = argsP (pNonfix p) , pNonfix = chain (pAtom p) (map (nonfixP . opP (pTop p)) non) , pAtom = atomP isAtom } where level :: NewNotation -> Integer level = fixityLevel . notaFixity nonfix, isprefix, ispostfix :: NewNotation -> Bool nonfix = (== NonfixNotation) . notationKind . notation isprefix = (== PrefixNotation) . notationKind . notation ispostfix = (== PostfixNotation) . notationKind . notation isinfix :: Associativity -> NewNotation -> Bool isinfix ass syn = notationKind (notation syn) == InfixNotation && fixityAssoc (notaFixity syn) == ass -- | Group operators by precedence level order :: [NewNotation] -> [[NewNotation]] order = groupBy ((==) `on` level) . sortBy (compare `on` level) -- | Each element of the returned list takes the parser for an -- expression of higher precedence as parameter. mkP :: ReadP e e -> [NewNotation] -> [ReadP e e -> ReadP e e] mkP p0 ops = case concat [infx, inlfx, inrfx, prefx, postfx] of [] -> [id] fs -> fs where inlfx = fixP infixlP (isinfix LeftAssoc) inrfx = fixP infixrP (isinfix RightAssoc) infx = fixP infixP (isinfix NonAssoc) prefx = fixP prefixP isprefix postfx = fixP postfixP ispostfix fixP :: (ReadP e (NewNotation,Range,[e]) -> ReadP e e -> ReadP e e) -> (NewNotation -> Bool) -> [ReadP e e -> ReadP e e] fixP f g = case filter g ops of [] -> [] ops -> [ f $ choice $ map (opP p0) ops ] --------------------------------------------------------------------------- -- * Helpers for pattern and lhs parsing --------------------------------------------------------------------------- -- | View a pattern @p@ as a list @p0 .. pn@ where @p0@ is the identifier -- (in most cases a constructor). -- -- Pattern needs to be parsed already (operators resolved). patternAppView :: Pattern -> [NamedArg Pattern] patternAppView p = case p of AppP p arg -> patternAppView p ++ [arg] OpAppP _ x _ ps -> defaultNamedArg (IdentP x) : ps ParenP _ p -> patternAppView p RawAppP _ _ -> __IMPOSSIBLE__ _ -> [ defaultNamedArg p ] --------------------------------------------------------------------------- -- * Parse functions --------------------------------------------------------------------------- -- | Returns the list of possible parses. parsePat :: ReadP Pattern Pattern -> Pattern -> [Pattern] parsePat prs p = case p of AppP p (Common.Arg info q) -> fullParen' <$> (AppP <$> parsePat prs p <*> (Common.Arg info <$> traverse (parsePat prs) q)) RawAppP _ ps -> fullParen' <$> (parsePat prs =<< parse prs ps) OpAppP r d ns ps -> fullParen' . OpAppP r d ns <$> (mapM . traverse . traverse) (parsePat prs) ps HiddenP _ _ -> fail "bad hidden argument" InstanceP _ _ -> fail "bad instance argument" AsP r x p -> AsP r x <$> parsePat prs p DotP r e -> return $ DotP r e ParenP r p -> fullParen' <$> parsePat prs p WildP _ -> return p AbsurdP _ -> return p LitP _ -> return p QuoteP _ -> return p IdentP _ -> return p {- Implement parsing of copattern left hand sides, e.g. record Tree (A : Set) : Set where field label : A child : Bool -> Tree A -- corecursive function defined by copattern matching alternate : {A : Set}(a b : A) -> Tree A -- shallow copatterns label (alternate a b) = a child (alternate a b) True = alternate b a -- deep copatterns: label (child (alternate a b) False) = b child (child (alternate a b) False) True = alternate a b child (child (alternate a b) False) False = alternate a b Delivers an infinite tree a b b a a a a b b b b b b b b ... Each lhs is a pattern tree with a distinct path of destructors ("child", "label") from the root to the defined symbol ("alternate"). All branches besides this distinct path are patterns. Syntax.Concrete.LHSCore represents a lhs - the destructor path - the side patterns - the defined function symbol - the applied patterns -} type ParseLHS = Either Pattern (Name, LHSCore) parseLHS' :: LHSOrPatSyn -> Maybe Name -> Pattern -> ScopeM ParseLHS parseLHS' lhsOrPatSyn top p = do let ms = qualifierModules $ patternQNames p flat <- flattenScope ms <$> getScope parsers <- buildParsers (getRange p) flat DontUseBoundNames let patP = pTop parsers let cons = getNames [ConName, PatternSynName] flat let flds = getNames [FldName] flat case [ res | p' <- force $ parsePat patP p , res <- validPattern (PatternCheckConfig top cons flds) p' ] of [(p,lhs)] -> return lhs [] -> typeError $ NoParseForLHS lhsOrPatSyn p rs -> typeError $ AmbiguousParseForLHS lhsOrPatSyn p $ map (fullParen . fst) rs where getNames kinds flat = map (notaName . head) $ getDefinedNames kinds flat -- validPattern returns an empty or singleton list (morally a Maybe) validPattern :: PatternCheckConfig -> Pattern -> [(Pattern, ParseLHS)] validPattern conf p = case (classifyPattern conf p, top) of (Just r@(Left _), Nothing) -> [(p, r)] -- expect pattern (Just r@(Right _), Just{}) -> [(p, r)] -- expect lhs _ -> [] -- | Name sets for classifying a pattern. data PatternCheckConfig = PatternCheckConfig { topName :: Maybe Name -- ^ name of defined symbol , conNames :: [QName] -- ^ valid constructor names , fldNames :: [QName] -- ^ valid field names } -- | Returns zero or one classified patterns. classifyPattern :: PatternCheckConfig -> Pattern -> Maybe ParseLHS classifyPattern conf p = case patternAppView p of -- case @f ps@ Common.Arg _ (Named _ (IdentP x@(QName f))) : ps | Just f == topName conf -> do guard $ all validPat ps return $ Right (f, LHSHead f ps) -- case @d ps@ Common.Arg _ (Named _ (IdentP x)) : ps | x `elem` fldNames conf -> do -- ps0 :: [NamedArg ParseLHS] ps0 <- mapM classPat ps let (ps1, rest) = span (isLeft . namedArg) ps0 (p2, ps3) <- uncons rest -- when (null rest): no field pattern or def pattern found guard $ all (isLeft . namedArg) ps3 let (f, lhs) = fromR p2 (ps', _:ps'') = splitAt (length ps1) ps return $ Right (f, LHSProj x ps' lhs ps'') -- case: ordinary pattern _ -> do guard $ validConPattern (conNames conf) p return $ Left p where -- allNames = conNames conf ++ fldNames conf validPat = validConPattern (conNames conf) . namedArg classPat :: NamedArg Pattern -> Maybe (NamedArg ParseLHS) classPat = Trav.mapM (Trav.mapM (classifyPattern conf)) fromR :: NamedArg (Either a (b, c)) -> (b, NamedArg c) fromR (Common.Arg info (Named n (Right (b, c)))) = (b, Common.Arg info (Named n c)) fromR (Common.Arg info (Named n (Left a ))) = __IMPOSSIBLE__ -- | Parses a left-hand side, and makes sure that it defined the expected name. parseLHS :: Name -> Pattern -> ScopeM LHSCore parseLHS top p = billToParser $ do res <- parseLHS' IsLHS (Just top) p case res of Right (f, lhs) -> return lhs _ -> typeError $ NoParseForLHS IsLHS p -- | Parses a pattern. parsePattern :: Pattern -> ScopeM Pattern parsePattern = parsePatternOrSyn IsLHS parsePatternSyn :: Pattern -> ScopeM Pattern parsePatternSyn = parsePatternOrSyn IsPatSyn parsePatternOrSyn :: LHSOrPatSyn -> Pattern -> ScopeM Pattern parsePatternOrSyn lhsOrPatSyn p = billToParser $ do res <- parseLHS' lhsOrPatSyn Nothing p case res of Left p -> return p _ -> typeError $ NoParseForLHS lhsOrPatSyn p -- | Helper function for 'parseLHS' and 'parsePattern'. validConPattern :: [QName] -> Pattern -> Bool validConPattern cons p = case appView p of [_] -> True IdentP x : ps -> elem x cons && all (validConPattern cons) ps [QuoteP _, _] -> True _ -> False -- Andreas, 2012-06-04: I do not know why the following line was -- the catch-all case. It seems that the new catch-all works also -- and is more logical. -- ps -> all (validConPattern cons) ps -- | Helper function for 'parseLHS' and 'parsePattern'. appView :: Pattern -> [Pattern] appView p = case p of AppP p a -> appView p ++ [namedArg a] OpAppP _ op _ ps -> IdentP op : map namedArg ps ParenP _ p -> appView p RawAppP _ _ -> __IMPOSSIBLE__ HiddenP _ _ -> __IMPOSSIBLE__ InstanceP _ _ -> __IMPOSSIBLE__ _ -> [p] -- | Return all qualifiers occuring in a list of 'QName's. -- Each qualifier is returned as a list of names, e.g. -- for @Data.Nat._+_@ we return the list @[Data,Nat]@. qualifierModules :: [QName] -> [[Name]] qualifierModules qs = nub $ filter (not . null) $ map (init . qnameParts) qs -- | Parse a list of expressions into an application. parseApplication :: [Expr] -> ScopeM Expr parseApplication [e] = return e parseApplication es = billToParser $ do -- Build the parser let ms = qualifierModules [ q | Ident q <- es ] flat <- flattenScope ms <$> getScope p <- buildParsers (getRange es) flat UseBoundNames -- Parse case force $ parse (pTop p) es of [e] -> return e [] -> typeError $ NoParseForApplication es es' -> typeError $ AmbiguousParseForApplication es $ map fullParen es' parseModuleIdentifier :: Expr -> ScopeM QName parseModuleIdentifier (Ident m) = return m parseModuleIdentifier e = typeError $ NotAModuleExpr e parseRawModuleApplication :: [Expr] -> ScopeM (QName, [NamedArg Expr]) parseRawModuleApplication es = billToParser $ do let e : es_args = es m <- parseModuleIdentifier e -- Build the arguments parser let ms = qualifierModules [ q | Ident q <- es_args ] flat <- flattenScope ms <$> getScope p <- buildParsers (getRange es_args) flat UseBoundNames -- Parse case {-force $-} parse (pArgs p) es_args of -- TODO: not sure about forcing [as] -> return (m, as) [] -> typeError $ NoParseForApplication es ass -> do let f = fullParen . foldl (App noRange) (Ident m) typeError $ AmbiguousParseForApplication es $ map f ass -- | Parse an expression into a module application -- (an identifier plus a list of arguments). parseModuleApplication :: Expr -> ScopeM (QName, [NamedArg Expr]) parseModuleApplication (RawApp _ es) = parseRawModuleApplication es parseModuleApplication (App r e1 e2) = do -- TODO: do we need this case? (m, args) <- parseModuleApplication e1 return (m, args ++ [e2]) parseModuleApplication e = do m <- parseModuleIdentifier e return (m, []) --------------------------------------------------------------------------- -- * Inserting parenthesis --------------------------------------------------------------------------- fullParen :: IsExpr e => e -> e fullParen e = case exprView $ fullParen' e of ParenV e -> e e' -> unExprView e' fullParen' :: IsExpr e => e -> e fullParen' e = case exprView e of LocalV _ -> e WildV _ -> e OtherV _ -> e HiddenArgV _ -> e InstanceArgV _ -> e ParenV _ -> e AppV e1 (Common.Arg info e2) -> par $ unExprView $ AppV (fullParen' e1) (Common.Arg info e2') where e2' = case argInfoHiding info of Hidden -> e2 Instance -> e2 NotHidden -> fullParen' <$> e2 OpAppV x ns es -> par $ unExprView $ OpAppV x ns $ (map . fmap . fmap . fmap) fullParen' es LamV bs e -> par $ unExprView $ LamV bs (fullParen e) where par = unExprView . ParenV Agda-2.4.2.5/src/full/Agda/Syntax/Concrete/Definitions.hs0000644000000000000000000014350312635075266021152 0ustar0000000000000000{-# LANGUAGE CPP #-} {-# LANGUAGE DeriveDataTypeable #-} {-# LANGUAGE FlexibleInstances #-} {-# LANGUAGE PatternGuards #-} {-# LANGUAGE TupleSections #-} #if __GLASGOW_HASKELL__ >= 710 {-# LANGUAGE FlexibleContexts #-} #endif -- | Preprocess 'Agda.Syntax.Concrete.Declaration's, producing 'NiceDeclaration's. -- -- * Attach fixity and syntax declarations to the definition they refer to. -- -- * Distribute the following attributes to the individual definitions: -- @abstract@, -- @instance@, -- @postulate@, -- @primitive@, -- @private@, -- termination pragmas. -- -- * Gather the function clauses belonging to one function definition. -- -- * Expand ellipsis @...@ in function clauses following @with@. -- -- * Infer mutual blocks. -- A block starts when a lone signature is encountered, and ends when -- all lone signatures have seen their definition. -- -- * Report basic well-formedness error, -- when one of the above transformation fails. module Agda.Syntax.Concrete.Definitions ( NiceDeclaration(..) , NiceConstructor, NiceTypeSignature , Clause(..) , DeclarationException(..) , Nice, runNice , niceDeclarations , notSoNiceDeclaration , niceHasAbstract , Measure ) where import Prelude hiding (null) import Control.Arrow ((***)) import Control.Applicative hiding (empty) import Control.Monad.State import Data.Foldable hiding ( all , concatMap , elem , mapM_ , notElem #if MIN_VERSION_base(4,8,0) , null #endif ) import qualified Data.Map as Map import Data.Map (Map) import Data.Maybe import Data.Monoid ( Monoid(mappend, mempty) ) import Data.List as List hiding (null) import Data.Traversable (traverse) import Data.Typeable (Typeable) import Agda.Syntax.Concrete import Agda.Syntax.Common hiding (Arg, Dom, NamedArg, ArgInfo, TerminationCheck()) import qualified Agda.Syntax.Common as Common import Agda.Syntax.Position import Agda.Syntax.Fixity import Agda.Syntax.Notation import Agda.Syntax.Concrete.Pretty () import Agda.Utils.Except ( Error(noMsg, strMsg), MonadError(throwError) ) import Agda.Utils.Lens import Agda.Utils.List (headMaybe, isSublistOf) import Agda.Utils.Monad import Agda.Utils.Null import Agda.Utils.Pretty import Agda.Utils.Update #include "undefined.h" import Agda.Utils.Impossible {-------------------------------------------------------------------------- Types --------------------------------------------------------------------------} {-| The nice declarations. No fixity declarations and function definitions are contained in a single constructor instead of spread out between type signatures and clauses. The @private@, @postulate@, @abstract@ and @instance@ modifiers have been distributed to the individual declarations. -} data NiceDeclaration = Axiom Range Fixity' Access IsInstance ArgInfo Name Expr -- ^ Axioms and functions can be declared irrelevant. (Hiding should be NotHidden) | NiceField Range Fixity' Access IsAbstract Name (Arg Expr) | PrimitiveFunction Range Fixity' Access IsAbstract Name Expr | NiceMutual Range TerminationCheck [NiceDeclaration] | NiceModule Range Access IsAbstract QName Telescope [Declaration] | NiceModuleMacro Range Access Name ModuleApplication OpenShortHand ImportDirective | NiceOpen Range QName ImportDirective | NiceImport Range QName (Maybe AsName) OpenShortHand ImportDirective | NicePragma Range Pragma | NiceRecSig Range Fixity' Access Name [LamBinding] Expr | NiceDataSig Range Fixity' Access Name [LamBinding] Expr | NiceFunClause Range Access IsAbstract TerminationCheck Declaration -- ^ An uncategorized function clause, could be a function clause -- without type signature or a pattern lhs (e.g. for irrefutable let). -- The 'Declaration' is the actual 'FunClause'. | FunSig Range Fixity' Access IsInstance ArgInfo TerminationCheck Name Expr | FunDef Range [Declaration] Fixity' IsAbstract TerminationCheck Name [Clause] -- ^ Block of function clauses (we have seen the type signature before). -- The 'Declaration's are the original declarations that were processed -- into this 'FunDef' and are only used in 'notSoNiceDeclaration'. | DataDef Range Fixity' IsAbstract Name [LamBinding] [NiceConstructor] | RecDef Range Fixity' IsAbstract Name (Maybe (Ranged Induction)) (Maybe (ThingWithFixity Name)) [LamBinding] [NiceDeclaration] | NicePatternSyn Range Fixity' Name [Arg Name] Pattern | NiceUnquoteDecl Range Fixity' Access IsInstance IsAbstract TerminationCheck Name Expr deriving (Typeable, Show) type TerminationCheck = Common.TerminationCheck Measure -- | Termination measure is, for now, a variable name. type Measure = Name -- | Only 'Axiom's. type NiceConstructor = NiceTypeSignature -- | Only 'Axiom's. type NiceTypeSignature = NiceDeclaration -- | One clause in a function definition. There is no guarantee that the 'LHS' -- actually declares the 'Name'. We will have to check that later. data Clause = Clause Name LHS RHS WhereClause [Clause] deriving (Typeable, Show) -- | The exception type. data DeclarationException = MultipleFixityDecls [(Name, [Fixity'])] | InvalidName Name | DuplicateDefinition Name | MissingDefinition Name | MissingWithClauses Name | MissingTypeSignature LHS -- Andreas 2012-06-02: currently unused, remove after a while -- Fredrik 2012-09-20: now used, can we keep it? | MissingDataSignature Name | WrongDefinition Name DataRecOrFun DataRecOrFun | WrongParameters Name | NotAllowedInMutual NiceDeclaration | UnknownNamesInFixityDecl [Name] | Codata Range | DeclarationPanic String | UselessPrivate Range | UselessAbstract Range | UselessInstance Range | WrongContentBlock KindOfBlock Range | AmbiguousFunClauses LHS [Name] -- ^ in a mutual block, a clause could belong to any of the @[Name]@ type signatures | InvalidTerminationCheckPragma Range | InvalidMeasureMutual Range -- ^ In a mutual block, all or none need a MEASURE pragma. -- Range is of mutual block. | PragmaNoTerminationCheck Range -- ^ Pragma @{-# NO_TERMINATION_CHECK #-}@ has been replaced -- by {-# TERMINATING #-} and {-# NON_TERMINATING #-}. deriving (Typeable) -- | Several declarations expect only type signatures as sub-declarations. These are: data KindOfBlock = PostulateBlock -- ^ @postulate@ | PrimitiveBlock -- ^ @primitive@. Ensured by parser. | InstanceBlock -- ^ @instance@. Actually, here all kinds of sub-declarations are allowed a priori. | FieldBlock -- ^ @field@. Ensured by parser. | DataBlock -- ^ @data ... where@. Here we got a bad error message for Agda-2.4.3 (Issue 1698). deriving (Typeable, Eq, Ord, Show) instance HasRange DeclarationException where getRange (MultipleFixityDecls xs) = getRange (fst $ head xs) getRange (InvalidName x) = getRange x getRange (DuplicateDefinition x) = getRange x getRange (MissingDefinition x) = getRange x getRange (MissingWithClauses x) = getRange x getRange (MissingTypeSignature x) = getRange x getRange (MissingDataSignature x) = getRange x getRange (WrongDefinition x k k') = getRange x getRange (WrongParameters x) = getRange x getRange (AmbiguousFunClauses lhs xs) = getRange lhs getRange (NotAllowedInMutual x) = getRange x getRange (UnknownNamesInFixityDecl xs) = getRange . head $ xs getRange (Codata r) = r getRange (DeclarationPanic _) = noRange getRange (UselessPrivate r) = r getRange (UselessAbstract r) = r getRange (UselessInstance r) = r getRange (WrongContentBlock _ r) = r getRange (InvalidTerminationCheckPragma r) = r getRange (InvalidMeasureMutual r) = r getRange (PragmaNoTerminationCheck r) = r instance HasRange NiceDeclaration where getRange (Axiom r _ _ _ _ _ _) = r getRange (NiceField r _ _ _ _ _) = r getRange (NiceMutual r _ _) = r getRange (NiceModule r _ _ _ _ _) = r getRange (NiceModuleMacro r _ _ _ _ _) = r getRange (NiceOpen r _ _) = r getRange (NiceImport r _ _ _ _) = r getRange (NicePragma r _) = r getRange (PrimitiveFunction r _ _ _ _ _) = r getRange (FunSig r _ _ _ _ _ _ _) = r getRange (FunDef r _ _ _ _ _ _) = r getRange (DataDef r _ _ _ _ _) = r getRange (RecDef r _ _ _ _ _ _ _) = r getRange (NiceRecSig r _ _ _ _ _) = r getRange (NiceDataSig r _ _ _ _ _) = r getRange (NicePatternSyn r _ _ _ _) = r getRange (NiceFunClause r _ _ _ _) = r getRange (NiceUnquoteDecl r _ _ _ _ _ _ _) = r instance Error DeclarationException where strMsg = DeclarationPanic -- These error messages can (should) be terminated by a dot ".", -- there is no error context printed after them. instance Pretty DeclarationException where pretty (MultipleFixityDecls xs) = sep [ fsep $ pwords "Multiple fixity or syntax declarations for" , vcat $ map f xs ] where f (x, fs) = pretty x <> text ": " <+> fsep (map pretty fs) pretty (InvalidName x) = fsep $ pwords "Invalid name:" ++ [pretty x] pretty (DuplicateDefinition x) = fsep $ pwords "Duplicate definition of" ++ [pretty x] pretty (MissingDefinition x) = fsep $ pwords "Missing definition for" ++ [pretty x] pretty (MissingWithClauses x) = fsep $ pwords "Missing with-clauses for function" ++ [pretty x] pretty (MissingTypeSignature x) = fsep $ pwords "Missing type signature for left hand side" ++ [pretty x] pretty (MissingDataSignature x) = fsep $ pwords "Missing type signature for " ++ [pretty x] pretty (WrongDefinition x k k') = fsep $ pretty x : pwords ("has been declared as a " ++ show k ++ ", but is being defined as a " ++ show k') pretty (WrongParameters x) = fsep $ pwords "List of parameters does not match previous signature for" ++ [pretty x] pretty (AmbiguousFunClauses lhs xs) = sep [ fsep $ pwords "More than one matching type signature for left hand side " ++ [pretty lhs] ++ pwords "it could belong to any of:" , vcat $ map (pretty . PrintRange) xs ] pretty (UnknownNamesInFixityDecl xs) = fsep $ pwords "The following names are not declared in the same scope as their syntax or fixity declaration (i.e., either not in scope at all, imported from another module, or declared in a super module):" ++ map pretty xs pretty (UselessPrivate _) = fsep $ pwords "Using private here has no effect. Private applies only to declarations that introduce new identifiers into the module, like type signatures and data, record, and module declarations." pretty (UselessAbstract _) = fsep $ pwords "Using abstract here has no effect. Abstract applies only definitions like data definitions, record type definitions and function clauses." pretty (UselessInstance _) = fsep $ pwords "Using instance here has no effect. Instance applies only to declarations that introduce new identifiers into the module, like type signatures and axioms." pretty (WrongContentBlock b _) = fsep $ pwords "A postulate block can only contain type signatures or instance blocks" pretty (PragmaNoTerminationCheck _) = fsep $ pwords "Pragma {-# NO_TERMINATION_CHECK #-} has been removed. To skip the termination check, label your definitions either as {-# TERMINATING #-} or {-# NON_TERMINATING #-}." pretty (InvalidTerminationCheckPragma _) = fsep $ pwords "Termination checking pragmas can only precede a mutual block or a function definition." pretty (InvalidMeasureMutual _) = fsep $ pwords "In a mutual block, either all functions must have the same (or no) termination checking pragma." pretty (NotAllowedInMutual nd) = fsep $ [text $ decl nd] ++ pwords "are not allowed in mutual blocks" where decl Axiom{} = "Postulates" decl NiceField{} = "Fields" decl NiceMutual{} = "Mutual blocks" decl NiceModule{} = "Modules" decl NiceModuleMacro{} = "Modules" decl NiceOpen{} = "Open declarations" decl NiceImport{} = "Import statements" decl NicePragma{} = "Pragmas" decl PrimitiveFunction{} = "Primitive declarations" decl NicePatternSyn{} = "Pattern synonyms" decl NiceUnquoteDecl{} = "Unquoted declarations" decl NiceRecSig{} = __IMPOSSIBLE__ decl NiceDataSig{} = __IMPOSSIBLE__ decl NiceFunClause{} = __IMPOSSIBLE__ decl FunSig{} = __IMPOSSIBLE__ decl FunDef{} = __IMPOSSIBLE__ decl RecDef{} = __IMPOSSIBLE__ decl DataDef{} = __IMPOSSIBLE__ pretty (Codata _) = text $ "The codata construction has been removed. " ++ "Use the INFINITY builtin instead." pretty (DeclarationPanic s) = text s {-------------------------------------------------------------------------- The niceifier --------------------------------------------------------------------------} data InMutual = InMutual -- ^ we are nicifying a mutual block | NotInMutual -- ^ we are nicifying decls not in a mutual block deriving (Eq, Show) -- | The kind of the forward declaration, remembering the parameters. data DataRecOrFun = DataName Params -- ^ name of a data with parameters | RecName Params -- ^ name of a record with parameters | FunName TerminationCheck -- ^ name of a function deriving (Eq) type Params = [Hiding] instance Show DataRecOrFun where show (DataName n) = "data type" -- "with " ++ show n ++ " visible parameters" show (RecName n) = "record type" -- "with " ++ show n ++ " visible parameters" show (FunName{}) = "function" isFunName :: DataRecOrFun -> Bool isFunName (FunName{}) = True isFunName _ = False sameKind :: DataRecOrFun -> DataRecOrFun -> Bool sameKind DataName{} DataName{} = True sameKind RecName{} RecName{} = True sameKind FunName{} FunName{} = True sameKind _ _ = False terminationCheck :: DataRecOrFun -> TerminationCheck terminationCheck (FunName tc) = tc terminationCheck _ = TerminationCheck -- | Check that declarations in a mutual block are consistently -- equipped with MEASURE pragmas, or whether there is a -- NO_TERMINATION_CHECK pragma. combineTermChecks :: Range -> [TerminationCheck] -> Nice TerminationCheck combineTermChecks r tcs = loop tcs where loop [] = return TerminationCheck loop (tc : tcs) = do let failure r = throwError $ InvalidMeasureMutual r tc' <- loop tcs case (tc, tc') of (TerminationCheck , tc' ) -> return tc' (tc , TerminationCheck ) -> return tc (NonTerminating , NonTerminating ) -> return NonTerminating (NoTerminationCheck , NoTerminationCheck ) -> return NoTerminationCheck (NoTerminationCheck , Terminating ) -> return Terminating (Terminating , NoTerminationCheck ) -> return Terminating (Terminating , Terminating ) -> return Terminating (TerminationMeasure{} , TerminationMeasure{} ) -> return tc (TerminationMeasure r _, NoTerminationCheck ) -> failure r (TerminationMeasure r _, Terminating ) -> failure r (NoTerminationCheck , TerminationMeasure r _) -> failure r (Terminating , TerminationMeasure r _) -> failure r (TerminationMeasure r _, NonTerminating ) -> failure r (NonTerminating , TerminationMeasure r _) -> failure r (NoTerminationCheck , NonTerminating ) -> failure r (Terminating , NonTerminating ) -> failure r (NonTerminating , NoTerminationCheck ) -> failure r (NonTerminating , Terminating ) -> failure r -- | Nicifier monad. type Nice = StateT NiceEnv (Either DeclarationException) -- | Nicifier state. data NiceEnv = NiceEnv { _loneSigs :: LoneSigs -- ^ Lone type signatures that wait for their definition. , fixs :: Fixities } type LoneSigs = Map Name DataRecOrFun type Fixities = Map Name Fixity' -- | Initial nicifier state. initNiceEnv :: NiceEnv initNiceEnv = NiceEnv { _loneSigs = empty , fixs = empty } -- * Handling the lone signatures, stored to infer mutual blocks. -- | Lens for field '_loneSigs'. loneSigs :: Lens' LoneSigs NiceEnv loneSigs f e = f (_loneSigs e) <&> \ s -> e { _loneSigs = s } -- | Adding a lone signature to the state. addLoneSig :: Name -> DataRecOrFun -> Nice () addLoneSig x k = loneSigs %== \ s -> do let (mr, s') = Map.insertLookupWithKey (\ k new old -> new) x k s case mr of Nothing -> return s' Just{} -> throwError $ DuplicateDefinition x -- | Remove a lone signature from the state. removeLoneSig :: Name -> Nice () removeLoneSig x = loneSigs %= Map.delete x -- | Search for forward type signature. getSig :: Name -> Nice (Maybe DataRecOrFun) getSig x = Map.lookup x <$> use loneSigs -- | Check that no lone signatures are left in the state. noLoneSigs :: Nice Bool noLoneSigs = null <$> use loneSigs -- | Ensure that all forward declarations have been given a definition. checkLoneSigs :: [(Name, a)] -> Nice () checkLoneSigs xs = case xs of [] -> return () (x, _):_ -> throwError $ MissingDefinition x -- | Check whether name is not "_" and return its fixity. getFixity :: Name -> Nice Fixity' getFixity x = do when (isUnderscore x) $ throwError $ InvalidName x Map.findWithDefault defaultFixity' x <$> gets fixs runNice :: Nice a -> Either DeclarationException a runNice nice = nice `evalStateT` initNiceEnv data DeclKind = LoneSig DataRecOrFun Name | LoneDef DataRecOrFun Name | OtherDecl deriving (Eq, Show) declKind :: NiceDeclaration -> DeclKind declKind (FunSig _ _ _ _ _ tc x _) = LoneSig (FunName tc) x declKind (NiceRecSig _ _ _ x pars _) = LoneSig (RecName $ parameters pars) x declKind (NiceDataSig _ _ _ x pars _) = LoneSig (DataName $ parameters pars) x declKind (FunDef _ _ _ _ tc x _) = LoneDef (FunName tc) x declKind (DataDef _ _ _ x pars _) = LoneDef (DataName $ parameters pars) x declKind (RecDef _ _ _ x _ _ pars _) = LoneDef (RecName $ parameters pars) x declKind _ = OtherDecl -- | Compute visible parameters of a data or record signature or definition. parameters :: [LamBinding] -> Params parameters = List.concat . List.map numP where numP (DomainFree i _) = [argInfoHiding i] numP (DomainFull (TypedBindings _ (Common.Arg i (TBind _ xs _)))) = List.replicate (length xs) $ argInfoHiding i numP (DomainFull (TypedBindings _ (Common.Arg _ TLet{}))) = [] -- | Main. niceDeclarations :: [Declaration] -> Nice [NiceDeclaration] niceDeclarations ds = do -- Get fixity and syntax declarations. fixs <- fixities ds case Map.keys fixs \\ concatMap declaredNames ds of -- If we have fixity/syntax decls for names not declared -- in the current scope, fail. xs@(_:_) -> throwError $ UnknownNamesInFixityDecl xs [] -> localState $ do -- Run the nicifier in an initial environment of fixity decls. put $ initNiceEnv { fixs = fixs } ds <- nice ds -- Check that every signature got its definition. checkLoneSigs . Map.toList =<< use loneSigs -- Note that loneSigs is ensured to be empty. -- (Important, since inferMutualBlocks also uses loneSigs state). inferMutualBlocks ds where -- Compute the names defined in a declaration. -- We stay in the current scope, i.e., do not go into modules. declaredNames :: Declaration -> [Name] declaredNames d = case d of TypeSig _ x _ -> [x] Field x _ -> [x] FunClause (LHS p [] [] []) _ _ | IdentP (QName x) <- removeSingletonRawAppP p -> [x] FunClause{} -> [] DataSig _ _ x _ _ -> [x] Data _ _ x _ _ cs -> x : concatMap declaredNames cs RecordSig _ x _ _ -> [x] Record _ x _ c _ _ _ -> x : foldMap (:[]) c Infix _ _ -> [] Syntax _ _ -> [] PatternSyn _ x _ _ -> [x] Mutual _ ds -> concatMap declaredNames ds Abstract _ ds -> concatMap declaredNames ds Private _ ds -> concatMap declaredNames ds InstanceB _ ds -> concatMap declaredNames ds Postulate _ ds -> concatMap declaredNames ds Primitive _ ds -> concatMap declaredNames ds Open{} -> [] Import{} -> [] ModuleMacro{} -> [] Module{} -> [] UnquoteDecl _ x _ -> [x] Pragma{} -> [] inferMutualBlocks :: [NiceDeclaration] -> Nice [NiceDeclaration] inferMutualBlocks [] = return [] inferMutualBlocks (d : ds) = case declKind d of OtherDecl -> (d :) <$> inferMutualBlocks ds LoneDef _ x -> __IMPOSSIBLE__ LoneSig k x -> do addLoneSig x k (tcs, (ds0, ds1)) <- untilAllDefined [terminationCheck k] ds tc <- combineTermChecks (getRange d) tcs -- Record modules are, for performance reasons, not always -- placed in mutual blocks. let prefix = case (d, ds0) of (NiceRecSig{}, [r@RecDef{}]) -> ([d, r] ++) _ -> (NiceMutual (getRange (d : ds0)) tc (d : ds0) :) prefix <$> inferMutualBlocks ds1 where untilAllDefined :: [TerminationCheck] -> [NiceDeclaration] -> Nice ([TerminationCheck], ([NiceDeclaration], [NiceDeclaration])) untilAllDefined tc ds = do done <- noLoneSigs if done then return (tc, ([], ds)) else case ds of [] -> __IMPOSSIBLE__ <$ (checkLoneSigs . Map.toList =<< use loneSigs) d : ds -> case declKind d of LoneSig k x -> addLoneSig x k >> cons d (untilAllDefined (terminationCheck k : tc) ds) LoneDef k x -> removeLoneSig x >> cons d (untilAllDefined (terminationCheck k : tc) ds) OtherDecl -> cons d (untilAllDefined tc ds) where cons d = fmap (id *** (d :) *** id) notMeasure TerminationMeasure{} = False notMeasure _ = True nice :: [Declaration] -> Nice [NiceDeclaration] nice [] = return [] -- Andreas, AIM XX: do not forbid NO_TERMINATION_CHECK in maintenance version. -- nice (Pragma (TerminationCheckPragma r NoTerminationCheck) : _) = -- throwError $ PragmaNoTerminationCheck r nice (Pragma (TerminationCheckPragma r tc) : ds@(Mutual{} : _)) | notMeasure tc = do ds <- nice ds case ds of NiceMutual r _ ds' : ds -> return $ NiceMutual r tc ds' : ds _ -> __IMPOSSIBLE__ nice (Pragma (TerminationCheckPragma r tc) : d@TypeSig{} : ds) = niceTypeSig tc d ds nice (Pragma (TerminationCheckPragma r tc) : d@FunClause{} : ds) | notMeasure tc = niceFunClause tc d ds nice (Pragma (TerminationCheckPragma r tc) : ds@(UnquoteDecl{} : _)) | notMeasure tc = do NiceUnquoteDecl r f p a i _ x e : ds <- nice ds return $ NiceUnquoteDecl r f p a i tc x e : ds nice (d@TypeSig{} : Pragma (TerminationCheckPragma r (TerminationMeasure _ x)) : ds) = niceTypeSig (TerminationMeasure r x) d ds -- nice (Pragma (MeasurePragma r x) : d@FunClause{} : ds) = -- niceFunClause (TerminationMeasure r x) d ds nice (d:ds) = do case d of TypeSig{} -> niceTypeSig TerminationCheck d ds FunClause{} -> niceFunClause TerminationCheck d ds Field x t -> (++) <$> niceAxioms FieldBlock [ d ] <*> nice ds DataSig r CoInductive x tel t -> throwError (Codata r) Data r CoInductive x tel t cs -> throwError (Codata r) DataSig r Inductive x tel t -> do addLoneSig x (DataName $ parameters tel) (++) <$> dataOrRec DataDef NiceDataSig (niceAxioms DataBlock) r x tel (Just t) Nothing <*> nice ds Data r Inductive x tel t cs -> do t <- defaultTypeSig (DataName $ parameters tel) x t (++) <$> dataOrRec DataDef NiceDataSig (niceAxioms DataBlock) r x tel t (Just cs) <*> nice ds RecordSig r x tel t -> do addLoneSig x (RecName $ parameters tel) fx <- getFixity x (NiceRecSig r fx PublicAccess x tel t :) <$> nice ds Record r x i c tel t cs -> do t <- defaultTypeSig (RecName $ parameters tel) x t c <- traverse (\c -> ThingWithFixity c <$> getFixity c) c (++) <$> dataOrRec (\x1 x2 x3 x4 -> RecDef x1 x2 x3 x4 i c) NiceRecSig niceDeclarations r x tel t (Just cs) <*> nice ds Mutual r ds' -> (:) <$> (mkOldMutual r =<< nice ds') <*> nice ds Abstract r ds' -> (++) <$> (abstractBlock r =<< nice ds') <*> nice ds Private r ds' -> (++) <$> (privateBlock r =<< nice ds') <*> nice ds InstanceB r ds' -> (++) <$> (instanceBlock r =<< nice ds') <*> nice ds Postulate _ ds' -> (++) <$> niceAxioms PostulateBlock ds' <*> nice ds Primitive _ ds' -> (++) <$> (map toPrim <$> niceAxioms PrimitiveBlock ds') <*> nice ds Module r x tel ds' -> (NiceModule r PublicAccess ConcreteDef x tel ds' :) <$> nice ds ModuleMacro r x modapp op is -> (NiceModuleMacro r PublicAccess x modapp op is :) <$> nice ds -- Fixity and syntax declarations have been looked at already. Infix _ _ -> nice ds Syntax _ _ -> nice ds PatternSyn r n as p -> do fx <- getFixity n (NicePatternSyn r fx n as p :) <$> nice ds Open r x is -> (NiceOpen r x is :) <$> nice ds Import r x as op is -> (NiceImport r x as op is :) <$> nice ds UnquoteDecl r x e -> do fx <- getFixity x (NiceUnquoteDecl r fx PublicAccess NotInstanceDef ConcreteDef TerminationCheck x e :) <$> nice ds -- Andreas, AIM XX: do not forbid NO_TERMINATION_CHECK in maintenance version. -- Pragma (TerminationCheckPragma r NoTerminationCheck) -> -- throwError $ PragmaNoTerminationCheck r Pragma (TerminationCheckPragma r _) -> throwError $ InvalidTerminationCheckPragma r Pragma p -> (NicePragma (getRange p) p :) <$> nice ds niceFunClause :: TerminationCheck -> Declaration -> [Declaration] -> Nice [NiceDeclaration] niceFunClause termCheck d@(FunClause lhs _ _) ds = do xs <- map fst . filter (isFunName . snd) . Map.toList <$> use loneSigs -- for each type signature 'x' waiting for clauses, we try -- if we have some clauses for 'x' fixs <- gets fixs case [ (x, (fits, rest)) | x <- xs , let (fits, rest) = span (couldBeFunClauseOf (Map.lookup x fixs) x) (d : ds) , not (null fits) ] of -- case: clauses match none of the sigs [] -> case lhs of -- Subcase: The lhs is single identifier. -- Treat it as a function clause without a type signature. LHS p [] [] [] | IdentP (QName x) <- removeSingletonRawAppP p -> do ds <- nice ds d <- mkFunDef defaultArgInfo termCheck x Nothing [d] -- fun def without type signature is relevant return $ d ++ ds -- Subcase: The lhs is a proper pattern. -- This could be a let-pattern binding. Pass it on. -- A missing type signature error might be raise in ConcreteToAbstract _ -> do ds <- nice ds return $ NiceFunClause (getRange d) PublicAccess ConcreteDef termCheck d : ds -- case: clauses match exactly one of the sigs [(x,(fits,rest))] -> do removeLoneSig x cs <- mkClauses x $ expandEllipsis fits ds1 <- nice rest fx <- getFixity x d <- return $ FunDef (getRange fits) fits fx ConcreteDef termCheck x cs return $ d : ds1 -- case: clauses match more than one sigs (ambiguity) l -> throwError $ AmbiguousFunClauses lhs $ reverse $ map fst l -- "ambiguous function clause; cannot assign it uniquely to one type signature" niceFunClause _ _ _ = __IMPOSSIBLE__ niceTypeSig :: TerminationCheck -> Declaration -> [Declaration] -> Nice [NiceDeclaration] niceTypeSig termCheck d@(TypeSig info x t) ds = do fx <- getFixity x -- register x as lone type signature, to recognize clauses later addLoneSig x (FunName termCheck) ds <- nice ds return $ FunSig (getRange d) fx PublicAccess NotInstanceDef info termCheck x t : ds niceTypeSig _ _ _ = __IMPOSSIBLE__ -- We could add a default type signature here, but at the moment we can't -- infer the type of a record or datatype, so better to just fail here. defaultTypeSig :: DataRecOrFun -> Name -> Maybe Expr -> Nice (Maybe Expr) defaultTypeSig k x t@Just{} = return t defaultTypeSig k x Nothing = do mk <- getSig x case mk of Nothing -> throwError $ MissingDataSignature x Just k' | k == k' -> Nothing <$ removeLoneSig x | sameKind k k' -> throwError $ WrongParameters x | otherwise -> throwError $ WrongDefinition x k' k dataOrRec mkDef mkSig niceD r x tel mt mcs = do mds <- traverse niceD mcs f <- getFixity x return $ catMaybes $ [ mt <&> \ t -> mkSig (fuseRange x t) f PublicAccess x tel t , mkDef r f ConcreteDef x (concatMap dropType tel) <$> mds ] where dropType :: LamBinding -> [LamBinding] dropType (DomainFull (TypedBindings _r (Common.Arg ai (TBind _ xs _)))) = map (mergeHiding . fmap (DomainFree ai)) xs dropType (DomainFull (TypedBindings _r (Common.Arg _ TLet{}))) = [] dropType b@DomainFree{} = [b] -- Translate axioms niceAxioms :: KindOfBlock -> [TypeSignatureOrInstanceBlock] -> Nice [NiceDeclaration] niceAxioms b ds = liftM List.concat $ mapM (niceAxiom b) ds niceAxiom :: KindOfBlock -> TypeSignatureOrInstanceBlock -> Nice [NiceDeclaration] niceAxiom b d = case d of TypeSig rel x t -> do fx <- getFixity x return [ Axiom (getRange d) fx PublicAccess NotInstanceDef rel x t ] Field x argt -> do fx <- getFixity x return [ NiceField (getRange d) fx PublicAccess ConcreteDef x argt ] InstanceB r decls -> do instanceBlock r =<< niceAxioms InstanceBlock decls Pragma p@(RewritePragma r _) -> do return [ NicePragma r p ] _ -> throwError $ WrongContentBlock b $ getRange d toPrim :: NiceDeclaration -> NiceDeclaration toPrim (Axiom r f a i rel x t) = PrimitiveFunction r f a ConcreteDef x t toPrim _ = __IMPOSSIBLE__ -- Create a function definition. mkFunDef info termCheck x mt ds0 = do cs <- mkClauses x $ expandEllipsis ds0 f <- getFixity x return [ FunSig (fuseRange x t) f PublicAccess NotInstanceDef info termCheck x t , FunDef (getRange ds0) ds0 f ConcreteDef termCheck x cs ] where t = case mt of Just t -> t Nothing -> underscore (getRange x) underscore r = Underscore r Nothing expandEllipsis :: [Declaration] -> [Declaration] expandEllipsis [] = [] expandEllipsis (d@(FunClause Ellipsis{} _ _) : ds) = d : expandEllipsis ds expandEllipsis (d@(FunClause lhs@(LHS p ps _ _) _ _) : ds) = d : expand p ps ds where expand _ _ [] = [] expand p ps (FunClause (Ellipsis r ps' eqs []) rhs wh : ds) = FunClause (LHS (setRange r p) ((setRange r ps) ++ ps') eqs []) rhs wh : expand p ps ds expand p ps (FunClause (Ellipsis r ps' eqs es) rhs wh : ds) = FunClause (LHS (setRange r p) ((setRange r ps) ++ ps') eqs es) rhs wh : expand p (ps ++ ps') ds expand p ps (d@(FunClause (LHS _ _ _ []) _ _) : ds) = d : expand p ps ds expand _ _ (d@(FunClause (LHS p ps _ (_ : _)) _ _) : ds) = d : expand p ps ds expand _ _ (_ : ds) = __IMPOSSIBLE__ expandEllipsis (_ : ds) = __IMPOSSIBLE__ -- Turn function clauses into nice function clauses. mkClauses :: Name -> [Declaration] -> Nice [Clause] mkClauses _ [] = return [] mkClauses x (FunClause lhs@(LHS _ _ _ []) rhs wh : cs) = (Clause x lhs rhs wh [] :) <$> mkClauses x cs mkClauses x (FunClause lhs@(LHS _ ps _ es) rhs wh : cs) = do when (null with) $ throwError $ MissingWithClauses x wcs <- mkClauses x with (Clause x lhs rhs wh wcs :) <$> mkClauses x cs' where (with, cs') = span subClause cs -- A clause is a subclause if the number of with-patterns is -- greater or equal to the current number of with-patterns plus the -- number of with arguments. subClause (FunClause (LHS _ ps' _ _) _ _) = length ps' >= length ps + length es subClause (FunClause (Ellipsis _ ps' _ _) _ _) = True subClause _ = __IMPOSSIBLE__ mkClauses x (FunClause lhs@Ellipsis{} rhs wh : cs) = (Clause x lhs rhs wh [] :) <$> mkClauses x cs -- Will result in an error later. mkClauses _ _ = __IMPOSSIBLE__ -- for finding clauses for a type sig in mutual blocks couldBeFunClauseOf :: Maybe Fixity' -> Name -> Declaration -> Bool couldBeFunClauseOf mFixity x (FunClause Ellipsis{} _ _) = True couldBeFunClauseOf mFixity x (FunClause (LHS p _ _ _) _ _) = let pns = patternNames p xStrings = nameStringParts x patStrings = concatMap nameStringParts pns in -- trace ("x = " ++ show x) $ -- trace ("pns = " ++ show pns) $ -- trace ("xStrings = " ++ show xStrings) $ -- trace ("patStrings = " ++ show patStrings) $ -- trace ("mFixity = " ++ show mFixity) $ case (headMaybe pns, mFixity) of -- first identifier in the patterns is the fun.symbol? (Just y, _) | x == y -> True -- trace ("couldBe since y = " ++ show y) $ True -- are the parts of x contained in p _ | xStrings `isSublistOf` patStrings -> True -- trace ("couldBe since isSublistOf") $ True -- looking for a mixfix fun.symb (_, Just fix) -> -- also matches in case of a postfix let notStrings = stringParts (theNotation fix) in -- trace ("notStrings = " ++ show notStrings) $ -- trace ("patStrings = " ++ show patStrings) $ (not $ null notStrings) && (notStrings `isSublistOf` patStrings) -- not a notation, not first id: give up _ -> False -- trace ("couldBe not (case default)") $ False couldBeFunClauseOf _ _ _ = False -- trace ("couldBe not (fun default)") $ False -- ASR (27 May 2014). Commented out unused code. -- @isFunClauseOf@ is for non-mutual blocks where clauses must follow the -- type sig immediately -- isFunClauseOf :: Name -> Declaration -> Bool -- isFunClauseOf x (FunClause Ellipsis{} _ _) = True -- isFunClauseOf x (FunClause (LHS p _ _ _) _ _) = -- -- p is the whole left hand side, excluding "with" patterns and clauses -- case removeSingletonRawAppP p of -- IdentP (QName q) -> x == q -- lhs is just an identifier -- _ -> True -- -- more complicated lhss must come with type signatures, so we just assume -- -- it's part of the current definition -- isFunClauseOf _ _ = False removeSingletonRawAppP :: Pattern -> Pattern removeSingletonRawAppP p = case p of RawAppP _ [p'] -> removeSingletonRawAppP p' ParenP _ p' -> removeSingletonRawAppP p' _ -> p -- Make an old style mutual block from a list of mutual declarations mkOldMutual :: Range -> [NiceDeclaration] -> Nice NiceDeclaration mkOldMutual r ds = do -- Check that there aren't any missing definitions checkLoneSigs loneNames -- Check that there are no declarations that aren't allowed in old style mutual blocks case filter notAllowedInMutual ds of [] -> return () (NiceFunClause _ _ _ _ (FunClause lhs _ _)):_ -> throwError $ MissingTypeSignature lhs d:_ -> throwError $ NotAllowedInMutual d let tcs = map termCheck ds tc <- combineTermChecks r tcs return $ NiceMutual r tc $ sigs ++ other where -- Andreas, 2013-11-23 allow postulates in mutual blocks notAllowedInMutual Axiom{} = False notAllowedInMutual d = declKind d == OtherDecl -- Pull type signatures to the top (sigs, other) = partition isTypeSig ds isTypeSig Axiom{} = True isTypeSig d | LoneSig{} <- declKind d = True isTypeSig _ = False sigNames = [ (x, k) | LoneSig k x <- map declKind ds ] defNames = [ (x, k) | LoneDef k x <- map declKind ds ] -- compute the set difference with equality just on names loneNames = [ (x, k) | (x, k) <- sigNames, List.all ((x /=) . fst) defNames ] -- Andreas, 2013-02-28 (issue 804): -- do not termination check a mutual block if any of its -- inner declarations comes with a {-# NO_TERMINATION_CHECK #-} termCheck (FunSig _ _ _ _ _ tc _ _) = tc termCheck (FunDef _ _ _ _ tc _ _) = tc termCheck (NiceMutual _ tc _) = tc termCheck (NiceUnquoteDecl _ _ _ _ _ tc _ _) = tc termCheck _ = TerminationCheck -- A mutual block cannot have a measure, -- but it can skip termination check. abstractBlock _ [] = return [] abstractBlock r ds = do let (ds', anyChange) = runChange $ mapM mkAbstract ds inherited = r == noRange -- hack to avoid failing on inherited abstract blocks in where clauses if anyChange || inherited then return ds' else throwError $ UselessAbstract r -- Make a declaration abstract mkAbstract :: Updater NiceDeclaration mkAbstract d = case d of NiceMutual r termCheck ds -> NiceMutual r termCheck <$> mapM mkAbstract ds FunDef r ds f a tc x cs -> (\ a -> FunDef r ds f a tc x) <$> setAbstract a <*> mapM mkAbstractClause cs DataDef r f a x ps cs -> (\ a -> DataDef r f a x ps) <$> setAbstract a <*> mapM mkAbstract cs RecDef r f a x i c ps cs -> (\ a -> RecDef r f a x i c ps) <$> setAbstract a <*> mapM mkAbstract cs NiceFunClause r p a termCheck d -> (\ a -> NiceFunClause r p a termCheck d) <$> setAbstract a -- no effect on fields or primitives, the InAbstract field there is unused NiceField r f p _ x e -> return $ NiceField r f p AbstractDef x e PrimitiveFunction r f p _ x e -> return $ PrimitiveFunction r f p AbstractDef x e NiceUnquoteDecl r f p i _ t x e -> return $ NiceUnquoteDecl r f p i AbstractDef t x e NiceModule{} -> return $ d NiceModuleMacro{} -> return $ d Axiom{} -> return $ d NicePragma{} -> return $ d NiceOpen{} -> return $ d NiceImport{} -> return $ d FunSig{} -> return $ d NiceRecSig{} -> return $ d NiceDataSig{} -> return $ d NicePatternSyn{} -> return $ d setAbstract :: Updater IsAbstract setAbstract a = case a of AbstractDef -> return a ConcreteDef -> dirty $ AbstractDef mkAbstractClause :: Updater Clause mkAbstractClause (Clause x lhs rhs wh with) = do wh <- mkAbstractWhere wh Clause x lhs rhs wh <$> mapM mkAbstractClause with mkAbstractWhere :: Updater WhereClause mkAbstractWhere NoWhere = return $ NoWhere mkAbstractWhere (AnyWhere ds) = dirty $ AnyWhere [Abstract noRange ds] mkAbstractWhere (SomeWhere m ds) = dirty $SomeWhere m [Abstract noRange ds] privateBlock _ [] = return [] privateBlock r ds = do let (ds', anyChange) = runChange $ mapM mkPrivate ds if anyChange then return ds' else throwError $ UselessPrivate r -- Make a declaration private. -- Andreas, 2012-11-17: -- Mark computation 'dirty' if there was a declaration that could be privatized. -- If no privatization is taking place, we want to complain about 'UselessPrivate'. -- Alternatively, we could only dirty if a non-private thing was privatized. -- Then, nested 'private's would sometimes also be complained about. mkPrivate :: Updater NiceDeclaration mkPrivate d = case d of Axiom r f p i rel x e -> (\ p -> Axiom r f p i rel x e) <$> setPrivate p NiceField r f p a x e -> (\ p -> NiceField r f p a x e) <$> setPrivate p PrimitiveFunction r f p a x e -> (\ p -> PrimitiveFunction r f p a x e) <$> setPrivate p NiceMutual r termCheck ds -> NiceMutual r termCheck <$> mapM mkPrivate ds NiceModule r p a x tel ds -> (\ p -> NiceModule r p a x tel ds) <$> setPrivate p NiceModuleMacro r p x ma op is -> (\ p -> NiceModuleMacro r p x ma op is) <$> setPrivate p FunSig r f p i rel tc x e -> (\ p -> FunSig r f p i rel tc x e) <$> setPrivate p NiceRecSig r f p x ls t -> (\ p -> NiceRecSig r f p x ls t) <$> setPrivate p NiceDataSig r f p x ls t -> (\ p -> NiceDataSig r f p x ls t) <$> setPrivate p NiceFunClause r p a termCheck d -> (\ p -> NiceFunClause r p a termCheck d) <$> setPrivate p NiceUnquoteDecl r f p i a t x e -> (\ p -> NiceUnquoteDecl r f p i a t x e) <$> setPrivate p NicePragma _ _ -> return $ d NiceOpen _ _ _ -> return $ d NiceImport _ _ _ _ _ -> return $ d FunDef{} -> return $ d DataDef{} -> return $ d RecDef{} -> return $ d NicePatternSyn _ _ _ _ _ -> return $ d setPrivate :: Updater Access setPrivate p = case p of PrivateAccess -> return p _ -> dirty $ PrivateAccess -- Andreas, 2012-11-22: Q: is this necessary? -- Are where clauses not always private? mkPrivateClause :: Updater Clause mkPrivateClause (Clause x lhs rhs wh with) = do wh <- mkPrivateWhere wh Clause x lhs rhs wh <$> mapM mkPrivateClause with mkPrivateWhere :: Updater WhereClause mkPrivateWhere NoWhere = return $ NoWhere mkPrivateWhere (AnyWhere ds) = dirty $ AnyWhere [Private (getRange ds) ds] mkPrivateWhere (SomeWhere m ds) = dirty $ SomeWhere m [Private (getRange ds) ds] instanceBlock _ [] = return [] instanceBlock r ds = do let (ds', anyChange) = runChange $ mapM mkInstance ds if anyChange then return ds' else throwError $ UselessInstance r -- Make a declaration eligible for instance search. mkInstance :: Updater NiceDeclaration mkInstance d = case d of Axiom r f p i rel x e -> (\ i -> Axiom r f p i rel x e) <$> setInstance i FunSig r f p i rel tc x e -> (\ i -> FunSig r f p i rel tc x e) <$> setInstance i NiceUnquoteDecl r f p i a tc x e -> (\ i -> NiceUnquoteDecl r f p i a tc x e) <$> setInstance i NiceMutual{} -> return $ d NiceFunClause{} -> return $ d FunDef{} -> return $ d NiceField{} -> return $ d PrimitiveFunction{} -> return $ d NiceRecSig{} -> return $ d NiceDataSig{} -> return $ d NiceModuleMacro{} -> return $ d NiceModule{} -> return $ d NicePragma _ _ -> return $ d NiceOpen _ _ _ -> return $ d NiceImport _ _ _ _ _ -> return $ d DataDef{} -> return $ d RecDef{} -> return $ d NicePatternSyn _ _ _ _ _ -> return $ d setInstance :: Updater IsInstance setInstance i = case i of InstanceDef -> return i _ -> dirty $ InstanceDef -- | Add more fixities. Throw an exception for multiple fixity declarations. -- OR: Disjoint union of fixity maps. Throws exception if not disjoint. plusFixities :: Fixities -> Fixities -> Nice Fixities plusFixities m1 m2 -- If maps are not disjoint, report conflicts as exception. | not (null isect) = throwError $ MultipleFixityDecls isect -- Otherwise, do the union. | otherwise = return $ Map.unionWithKey mergeFixites m1 m2 where -- Merge two fixities, assuming there is no conflict mergeFixites name (Fixity' f1 s1) (Fixity' f2 s2) = Fixity' f s where f | f1 == noFixity = f2 | f2 == noFixity = f1 | otherwise = __IMPOSSIBLE__ s | s1 == noNotation = s2 | s2 == noNotation = s1 | otherwise = __IMPOSSIBLE__ -- Compute a list of conflicts in a format suitable for error reporting. isect = [ (x, map (Map.findWithDefault __IMPOSSIBLE__ x) [m1,m2]) | (x, False) <- Map.assocs $ Map.intersectionWith compatible m1 m2 ] -- Check for no conflict. compatible (Fixity' f1 s1) (Fixity' f2 s2) = (f1 == noFixity || f2 == noFixity) && (s1 == noNotation || s2 == noNotation) -- | While 'Fixities' is not a monoid under disjoint union (which might fail), -- we get the monoid instance for the monadic @Nice Fixities@ which propagates -- the first error. instance Monoid (Nice Fixities) where mempty = return $ Map.empty mappend c1 c2 = plusFixities ==<< (c1, c2) -- | Get the fixities from the current block. -- Doesn't go inside modules and where blocks. -- The reason for this is that fixity declarations have to appear at the same -- level (or possibly outside an abstract or mutual block) as its target -- declaration. fixities :: [Declaration] -> Nice Fixities fixities = foldMap $ \ d -> case d of -- These declarations define fixities: Syntax x syn -> return $ Map.singleton x $ Fixity' noFixity syn Infix f xs -> return $ Map.fromList $ map (,Fixity' f noNotation) xs -- We look into these blocks: Mutual _ ds' -> fixities ds' Abstract _ ds' -> fixities ds' Private _ ds' -> fixities ds' InstanceB _ ds' -> fixities ds' -- All other declarations are ignored. -- We expand these boring cases to trigger a revisit -- in case the @Declaration@ type is extended in the future. TypeSig {} -> mempty Field {} -> mempty FunClause {} -> mempty DataSig {} -> mempty Data {} -> mempty RecordSig {} -> mempty Record {} -> mempty PatternSyn {} -> mempty Postulate {} -> mempty Primitive {} -> mempty Open {} -> mempty Import {} -> mempty ModuleMacro {} -> mempty Module {} -> mempty UnquoteDecl {} -> mempty Pragma {} -> mempty -- Andreas, 2012-04-07 -- The following function is only used twice, for building a Let, and for -- printing an error message. -- | (Approximately) convert a 'NiceDeclaration' back to a 'Declaration'. notSoNiceDeclaration :: NiceDeclaration -> Declaration notSoNiceDeclaration d = case d of Axiom _ _ _ _ rel x e -> TypeSig rel x e NiceField _ _ _ _ x argt -> Field x argt PrimitiveFunction r _ _ _ x e -> Primitive r [TypeSig defaultArgInfo x e] NiceMutual r _ ds -> Mutual r $ map notSoNiceDeclaration ds NiceModule r _ _ x tel ds -> Module r x tel ds NiceModuleMacro r _ x ma o dir -> ModuleMacro r x ma o dir NiceOpen r x dir -> Open r x dir NiceImport r x as o dir -> Import r x as o dir NicePragma _ p -> Pragma p NiceRecSig r _ _ x bs e -> RecordSig r x bs e NiceDataSig r _ _ x bs e -> DataSig r Inductive x bs e NiceFunClause _ _ _ _ d -> d FunSig _ _ _ _ rel tc x e -> TypeSig rel x e FunDef r [d] _ _ _ _ _ -> d FunDef r ds _ _ _ _ _ -> Mutual r ds -- Andreas, 2012-04-07 Hack! DataDef r _ _ x bs cs -> Data r Inductive x bs Nothing $ map notSoNiceDeclaration cs RecDef r _ _ x i c bs ds -> Record r x i (unThing <$> c) bs Nothing $ map notSoNiceDeclaration ds where unThing (ThingWithFixity c _) = c NicePatternSyn r _ n as p -> PatternSyn r n as p NiceUnquoteDecl r _ _ _ _ _ x e -> UnquoteDecl r x e -- | Has the 'NiceDeclaration' a field of type 'IsAbstract'? niceHasAbstract :: NiceDeclaration -> Maybe IsAbstract niceHasAbstract d = case d of Axiom{} -> Nothing NiceField _ _ _ a _ _ -> Just a PrimitiveFunction _ _ _ a _ _ -> Just a NiceMutual{} -> Nothing NiceModule _ _ a _ _ _ -> Just a NiceModuleMacro{} -> Nothing NiceOpen{} -> Nothing NiceImport{} -> Nothing NicePragma{} -> Nothing NiceRecSig{} -> Nothing NiceDataSig{} -> Nothing NiceFunClause _ _ a _ _ -> Just a FunSig{} -> Nothing FunDef _ _ _ a _ _ _ -> Just a DataDef _ _ a _ _ _ -> Just a RecDef _ _ a _ _ _ _ _ -> Just a NicePatternSyn{} -> Nothing NiceUnquoteDecl _ _ _ _ a _ _ _ -> Just a Agda-2.4.2.5/src/full/Agda/Syntax/Concrete/Operators/0000755000000000000000000000000012635075266020313 5ustar0000000000000000Agda-2.4.2.5/src/full/Agda/Syntax/Concrete/Operators/Parser.hs0000644000000000000000000002015012635075266022101 0ustar0000000000000000{-# LANGUAGE CPP #-} {-# LANGUAGE ScopedTypeVariables #-} module Agda.Syntax.Concrete.Operators.Parser where import Control.Exception (throw) import Data.Maybe import Data.Set (Set) import Agda.Syntax.Position import qualified Agda.Syntax.Abstract.Name as A import Agda.Syntax.Common hiding (Arg, Dom, NamedArg) import Agda.Syntax.Fixity import Agda.Syntax.Notation import Agda.Syntax.Concrete import Agda.TypeChecking.Monad.Base (TCErr(Exception)) import Agda.Utils.Monad import Agda.Utils.Pretty import Agda.Utils.ReadP #include "undefined.h" import Agda.Utils.Impossible data ExprView e = LocalV QName | WildV e | OtherV e | AppV e (NamedArg e) | OpAppV QName (Set A.Name) [NamedArg (OpApp e)] -- ^ The 'QName' is possibly ambiguous, but it must correspond -- to one of the names in the set. | HiddenArgV (Named_ e) | InstanceArgV (Named_ e) | LamV [LamBinding] e | ParenV e -- deriving (Show) class HasRange e => IsExpr e where exprView :: e -> ExprView e unExprView :: ExprView e -> e instance IsExpr e => HasRange (ExprView e) where getRange = getRange . unExprView instance IsExpr Expr where exprView e = case e of Ident x -> LocalV x App _ e1 e2 -> AppV e1 e2 OpApp r d ns es -> OpAppV d ns es HiddenArg _ e -> HiddenArgV e InstanceArg _ e -> InstanceArgV e Paren _ e -> ParenV e Lam _ bs e -> LamV bs e Underscore{} -> WildV e _ -> OtherV e unExprView e = case e of LocalV x -> Ident x AppV e1 e2 -> App (fuseRange e1 e2) e1 e2 OpAppV d ns es -> OpApp (fuseRange d es) d ns es HiddenArgV e -> HiddenArg (getRange e) e InstanceArgV e -> InstanceArg (getRange e) e ParenV e -> Paren (getRange e) e LamV bs e -> Lam (fuseRange bs e) bs e WildV e -> e OtherV e -> e instance IsExpr Pattern where exprView e = case e of IdentP x -> LocalV x AppP e1 e2 -> AppV e1 e2 OpAppP r d ns es -> OpAppV d ns ((map . fmap . fmap) Ordinary es) HiddenP _ e -> HiddenArgV e InstanceP _ e -> InstanceArgV e ParenP _ e -> ParenV e WildP{} -> WildV e _ -> OtherV e unExprView e = case e of LocalV x -> IdentP x AppV e1 e2 -> AppP e1 e2 OpAppV d ns es -> let ess :: [NamedArg Pattern] ess = (map . fmap . fmap) (fromOrdinary __IMPOSSIBLE__) es in OpAppP (fuseRange d es) d ns ess HiddenArgV e -> HiddenP (getRange e) e InstanceArgV e -> InstanceP (getRange e) e ParenV e -> ParenP (getRange e) e LamV _ _ -> __IMPOSSIBLE__ WildV e -> e OtherV e -> e --------------------------------------------------------------------------- -- * Parser combinators --------------------------------------------------------------------------- ---------------------------- -- Specific combinators -- | Parse a specific identifier as a NamePart partP :: IsExpr e => [Name] -> RawName -> ReadP e Range partP ms s = do tok <- get case isLocal tok of Just p -> return p Nothing -> pfail where str = show (foldr Qual (QName (Name noRange [Id s])) ms) isLocal e = case exprView e of LocalV y | str == show y -> Just (getRange y) _ -> Nothing binop :: IsExpr e => ReadP e (NewNotation,Range,[e]) -> ReadP e (e -> e -> e) binop middleP = do (nsyn,r,es) <- middleP return $ \x y -> rebuild nsyn r (x : es ++ [y]) preop, postop :: IsExpr e => ReadP e (NewNotation,Range,[e]) -> ReadP e (e -> e) preop middleP = do (nsyn,r,es) <- middleP return $ \x -> rebuild nsyn r (es ++ [x]) postop middleP = do (nsyn,r,es) <- middleP return $ \x -> rebuild nsyn r (x : es) -- | Parse the "operator part" of the given syntax. -- holes at beginning and end are IGNORED. -- Note: it would be better to take the decision of "postprocessing" at the same -- place as where the holes are discarded, however that would require a dependently -- typed function (or duplicated code) opP :: IsExpr e => ReadP e e -> NewNotation -> ReadP e (NewNotation,Range,[e]) opP p nsyn@(NewNotation q _ _ syn) = do (range,es) <- worker (init $ qnameParts q) $ removeExternalHoles syn return (nsyn,range,es) where worker ms [IdPart x] = do r <- partP ms x; return (r,[]) worker ms (IdPart x : _ : xs) = do r1 <- partP ms x e <- p (r2 , es) <- worker [] xs -- only the first part is qualified return (fuseRanges r1 r2, e : es) worker _ x = __IMPOSSIBLE__ -- holes and non-holes must be alternated. removeExternalHoles = reverse . removeLeadingHoles . reverse . removeLeadingHoles where removeLeadingHoles = dropWhile isAHole -- | Given a name with a syntax spec, and a list of parsed expressions -- fitting it, rebuild the expression. rebuild :: forall e. IsExpr e => NewNotation -> Range -> [e] -> e rebuild (NewNotation name names _ syn) r es = unExprView $ OpAppV (setRange r name) names exprs where exprs = map findExprFor [0..lastHole] filledHoles = zip es (filter isAHole syn) lastHole = maximum $ mapMaybe holeTarget syn findExprFor :: Int -> NamedArg (OpApp e) findExprFor n = case [setArgColors [] $ fmap (e <$) m | (e, NormalHole m) <- filledHoles, namedArg m == n] of [] -> __IMPOSSIBLE__ [x] -> case [e | (e, BindHole m) <- filledHoles, m == n] of [] -> (fmap . fmap) Ordinary x -- no variable to bind vars -> let bs = map (rebuildBinding . exprView) vars in (fmap . fmap) (SyntaxBindingLambda (fuseRange bs x) bs) x _ -> __IMPOSSIBLE__ rebuildBinding :: IsExpr e => ExprView e -> LamBinding -- Andreas, 2011-04-07 put just 'Relevant' here, is this correct? rebuildBinding (LocalV (QName name)) = DomainFree defaultArgInfo $ mkBoundName_ name rebuildBinding (WildV e) = DomainFree defaultArgInfo $ mkBoundName_ $ Name noRange [Hole] rebuildBinding e = throw $ Exception (getRange e) $ text "Expected variable name in binding position" -- | Parse using the appropriate fixity, given a parser parsing the -- operator part, the name of the operator, and a parser of -- subexpressions. infixP, infixrP, infixlP, postfixP, prefixP,nonfixP :: IsExpr e => ReadP e (NewNotation,Range,[e]) -> ReadP e e -> ReadP e e prefixP op p = do fs <- many (preop op) e <- p return $ foldr ( $ ) e fs postfixP op p = do e <- p fs <- many (postop op) return $ foldl (flip ( $ )) e fs infixlP op p = chainl1 p (binop op) infixrP op p = chainr1 p (binop op) infixP op p = do e <- p restP e where restP x = return x +++ do f <- binop op f x <$> p nonfixP op p = do (nsyn,r,es) <- op return $ rebuild nsyn r es +++ p argsP :: IsExpr e => ReadP e e -> ReadP e [NamedArg e] argsP p = many (nothidden +++ hidden +++ instanceH) where isHidden (HiddenArgV _) = True isHidden _ = False isInstance (InstanceArgV _) = True isInstance _ = False nothidden = defaultArg . unnamed <$> do e <- p case exprView e of HiddenArgV _ -> pfail InstanceArgV _ -> pfail _ -> return e instanceH = do InstanceArgV e <- exprView <$> satisfy (isInstance . exprView) return $ makeInstance $ defaultArg e hidden = do HiddenArgV e <- exprView <$> satisfy (isHidden . exprView) return $ hide $ defaultArg e appP :: IsExpr e => ReadP e e -> ReadP e [NamedArg e] -> ReadP e e appP p pa = do h <- p es <- pa return $ foldl app h es where app e = unExprView . AppV e atomP :: IsExpr e => (QName -> Bool) -> ReadP e e atomP p = do e <- get case exprView e of LocalV x | not (p x) -> pfail _ -> return e Agda-2.4.2.5/src/full/Agda/Syntax/Parser/0000755000000000000000000000000012635075266016027 5ustar0000000000000000Agda-2.4.2.5/src/full/Agda/Syntax/Parser/StringLiterals.hs0000644000000000000000000001512712635075266021337 0ustar0000000000000000{-| The code to lex string and character literals. Basically the same code as in GHC. -} module Agda.Syntax.Parser.StringLiterals ( litString, litChar ) where import Data.Char import Agda.Syntax.Parser.Alex import Agda.Syntax.Parser.Monad import Agda.Syntax.Parser.Tokens import Agda.Syntax.Parser.LookAhead import Agda.Syntax.Position import Agda.Syntax.Literal import Agda.Utils.Char ( decDigit, hexDigit, octDigit ) import Agda.Utils.Tuple ( (-*-) ) {-------------------------------------------------------------------------- Exported actions --------------------------------------------------------------------------} -- | Lex a string literal. Assumes that a double quote has been lexed. litString :: LexAction Token litString = stringToken '"' (\i s -> return $ TokLiteral $ LitString (getRange i) s) {-| Lex a character literal. Assumes that a single quote has been lexed. A character literal is lexed in exactly the same way as a string literal. Only before returning the token do we check that the lexed string is of length 1. This is maybe not the most efficient way of doing things, but on the other hand it will only be inefficient if there is a lexical error. -} litChar :: LexAction Token litChar = stringToken '\'' $ \i s -> do case s of [c] -> return $ TokLiteral $ LitChar (getRange i) c _ -> lexError "character literal must contain a single character" {-------------------------------------------------------------------------- Errors --------------------------------------------------------------------------} -- | Custom error function. litError :: String -> LookAhead a litError msg = do sync liftP $ lexError $ "Lexical error in string or character literal: " ++ msg {-------------------------------------------------------------------------- The meat --------------------------------------------------------------------------} -- | The general function to lex a string or character literal token. The -- character argument is the delimiter (@\"@ for strings and @\'@ for -- characters). stringToken :: Char -> (Interval -> String -> Parser tok) -> LexAction tok stringToken del mkTok inp inp' n = do setLastPos (backupPos $ lexPos inp') setLexInput inp' -- TODO: Should setPrevToken be run here? Compare with -- Agda.Syntax.Parser.LexActions.token. tok <- runLookAhead litError $ lexString del "" i <- getParseInterval mkTok i tok -- | This is where the work happens. The string argument is an accumulating -- parameter for the string being lexed. lexString :: Char -> String -> LookAhead String lexString del s = do c <- nextChar case c of c | c == del -> sync >> return (reverse s) '\\' -> do c' <- nextChar case c' of '&' -> sync >> lexString del s c | isSpace c -> sync >> lexStringGap del s _ -> normalChar _ -> normalChar where normalChar = do rollback c <- lexChar lexString del (c:s) -- | A string gap consists of whitespace (possibly including line breaks) -- enclosed in backslashes. The gap is not part of the resulting string. lexStringGap :: Char -> String -> LookAhead String lexStringGap del s = do c <- eatNextChar case c of '\\' -> lexString del s c | isSpace c -> lexStringGap del s _ -> fail "non-space in string gap" -- | Lex a single character. lexChar :: LookAhead Char lexChar = do c <- eatNextChar case c of '\\' -> lexEscape _ -> return c -- | Lex an escaped character. Assumes the backslash has been lexed. lexEscape :: LookAhead Char lexEscape = do c <- eatNextChar case c of '^' -> do c <- eatNextChar if c >= '@' && c <= '_' then return (chr (ord c - ord '@')) else fail "invalid control character" 'x' -> readNum isHexDigit 16 hexDigit 'o' -> readNum isOctDigit 8 octDigit x | isDigit x -> readNumAcc isDigit 10 decDigit (decDigit x) c -> -- Try to match the input (starting with c) against the -- silly escape codes. do esc <- match' c (map (id -*- return) sillyEscapeChars) (fail "bad escape code") sync return esc -- | Read a number in the specified base. readNum :: (Char -> Bool) -> Int -> (Char -> Int) -> LookAhead Char readNum isDigit base conv = do c <- eatNextChar if isDigit c then readNumAcc isDigit base conv (conv c) else fail "non-digit in numeral" -- | Same as 'readNum' but with an accumulating parameter. readNumAcc :: (Char -> Bool) -> Int -> (Char -> Int) -> Int -> LookAhead Char readNumAcc isDigit base conv i = scan i where scan i = do inp <- getInput c <- nextChar case c of c | isDigit c -> scan (i*base + conv c) _ -> do setInput inp sync if i >= ord minBound && i <= ord maxBound then return (chr i) else fail "character literal out of bounds" -- | The escape codes. sillyEscapeChars :: [(String, Char)] sillyEscapeChars = [ ("a", '\a') , ("b", '\b') , ("f", '\f') , ("n", '\n') , ("r", '\r') , ("t", '\t') , ("v", '\v') , ("\\", '\\') , ("\"", '\"') , ("'", '\'') , ("NUL", '\NUL') , ("SOH", '\SOH') , ("STX", '\STX') , ("ETX", '\ETX') , ("EOT", '\EOT') , ("ENQ", '\ENQ') , ("ACK", '\ACK') , ("BEL", '\BEL') , ("BS", '\BS') , ("HT", '\HT') , ("LF", '\LF') , ("VT", '\VT') , ("FF", '\FF') , ("CR", '\CR') , ("SO", '\SO') , ("SI", '\SI') , ("DLE", '\DLE') , ("DC1", '\DC1') , ("DC2", '\DC2') , ("DC3", '\DC3') , ("DC4", '\DC4') , ("NAK", '\NAK') , ("SYN", '\SYN') , ("ETB", '\ETB') , ("CAN", '\CAN') , ("EM", '\EM') , ("SUB", '\SUB') , ("ESC", '\ESC') , ("FS", '\FS') , ("GS", '\GS') , ("RS", '\RS') , ("US", '\US') , ("SP", '\SP') , ("DEL", '\DEL') ] Agda-2.4.2.5/src/full/Agda/Syntax/Parser/Tokens.hs0000644000000000000000000000604612635075266017634 0ustar0000000000000000module Agda.Syntax.Parser.Tokens ( Token(..) , Keyword(..) , layoutKeywords , Symbol(..) ) where import Agda.Syntax.Literal (Literal) import Agda.Syntax.Position data Keyword = KwLet | KwIn | KwWhere | KwData | KwCoData | KwPostulate | KwMutual | KwAbstract | KwPrivate | KwInstance | KwOpen | KwImport | KwModule | KwPrimitive | KwInfix | KwInfixL | KwInfixR | KwWith | KwRewrite | KwSet | KwProp | KwForall | KwRecord | KwConstructor | KwField | KwInductive | KwCoInductive | KwHiding | KwUsing | KwRenaming | KwTo | KwPublic | KwOPTIONS | KwBUILTIN | KwLINE | KwCOMPILED_DATA | KwCOMPILED_TYPE | KwCOMPILED | KwCOMPILED_EXPORT | KwCOMPILED_EPIC | KwCOMPILED_JS | KwIMPORT | KwIMPOSSIBLE | KwETA | KwSTATIC | KwNO_TERMINATION_CHECK | KwTERMINATING | KwNON_TERMINATING | KwMEASURE | KwREWRITE | KwQuoteGoal | KwQuoteContext | KwQuote | KwQuoteTerm | KwUnquote | KwUnquoteDecl | KwSyntax | KwPatternSyn | KwTactic deriving (Eq, Show) layoutKeywords :: [Keyword] layoutKeywords = [ KwLet, KwWhere, KwPostulate, KwMutual, KwAbstract, KwPrivate, KwInstance, KwPrimitive, KwField ] data Symbol = SymDot | SymSemi | SymVirtualSemi | SymBar | SymColon | SymArrow | SymEqual | SymLambda | SymUnderscore | SymQuestionMark | SymAs | SymOpenParen | SymCloseParen | SymDoubleOpenBrace | SymDoubleCloseBrace | SymOpenBrace | SymCloseBrace | SymOpenVirtualBrace | SymCloseVirtualBrace | SymOpenPragma | SymClosePragma | SymEllipsis | SymDotDot | SymEndComment -- ^ A misplaced end-comment "-}". deriving (Eq, Show) data Token -- Keywords = TokKeyword Keyword Interval -- Identifiers and operators | TokId (Interval, String) | TokQId [(Interval, String)] -- Non-empty namespace. The intervals for -- "A.B.x" correspond to "A.", "B." and "x". -- Literals | TokLiteral Literal -- Special symbols | TokSymbol Symbol Interval -- Other tokens | TokString (Interval, String) -- arbitrary string, used in pragmas | TokSetN (Interval, Integer) | TokTeX (Interval, String) | TokComment (Interval, String) | TokDummy -- Dummy token to make Happy not complain -- about overlapping cases. | TokEOF deriving (Eq, Show) instance HasRange Token where getRange (TokKeyword _ i) = getRange i getRange (TokId (i, _)) = getRange i getRange (TokQId iss) = Range $ map fst iss getRange (TokLiteral lit) = getRange lit getRange (TokSymbol _ i) = getRange i getRange (TokString (i, _)) = getRange i getRange (TokSetN (i, _)) = getRange i getRange (TokTeX (i, _)) = getRange i getRange (TokComment (i, _)) = getRange i getRange TokDummy = noRange getRange TokEOF = noRange Agda-2.4.2.5/src/full/Agda/Syntax/Parser/Layout.hs0000644000000000000000000001224612635075266017645 0ustar0000000000000000-- {-# LANGUAGE CPP #-} {-| This module contains the lex actions that handle the layout rules. The way it works is that the 'Parser' monad keeps track of a stack of 'LayoutContext's specifying the indentation of the layout blocks in scope. For instance, consider the following incomplete (Haskell) program: > f x = x' > where > x' = case x of { True -> False; False -> ... At the @...@ the layout context would be > [NoLayout, Layout 4, Layout 0] The closest layout block is the one containing the @case@ branches. This block starts with an open brace (@\'{\'@) and so doesn't use layout. The second closest block is the @where@ clause. Here, there is no open brace so the block is started by the @x'@ token which has indentation 4. Finally there is a top-level layout block with indentation 0. -} module Agda.Syntax.Parser.Layout ( openBrace, closeBrace , withLayout , offsideRule , newLayoutContext , emptyLayout ) where import Agda.Syntax.Parser.Lexer import Agda.Syntax.Parser.Alex import Agda.Syntax.Parser.Monad import Agda.Syntax.Parser.Tokens import Agda.Syntax.Parser.LexActions import Agda.Syntax.Position -- | Executed upon lexing an open brace (@\'{\'@). Enters the 'NoLayout' -- context. openBrace :: LexAction Token openBrace = token $ \_ -> do pushContext NoLayout i <- getParseInterval return (TokSymbol SymOpenBrace i) {-| Executed upon lexing a close brace (@\'}\'@). Exits the current layout context. This might look a bit funny--the lexer will happily use a close brace to close a context open by a virtual brace. This is not a problem since the parser will make sure the braces are appropriately matched. -} closeBrace :: LexAction Token closeBrace = token $ \_ -> do popContext i <- getParseInterval return (TokSymbol SymCloseBrace i) {-| Executed for the first token in each line (see 'Agda.Syntax.Parser.Lexer.bol'). Checks the position of the token relative to the current layout context. If the token is - /to the left/ : Exit the current context and a return virtual close brace (stay in the 'Agda.Syntax.Parser.Lexer.bol' state). - /same column/ : Exit the 'Agda.Syntax.Parser.Lexer.bol' state and return a virtual semi colon. - /to the right/ : Exit the 'Agda.Syntax.Parser.Lexer.bol' state and continue lexing. If the current block doesn't use layout (i.e. it was started by 'openBrace') all positions are considered to be /to the right/. -} offsideRule :: LexAction Token offsideRule inp _ _ = do offs <- getOffside p case offs of LT -> do popContext return (TokSymbol SymCloseVirtualBrace (Interval p p)) EQ -> do popLexState return (TokSymbol SymVirtualSemi (Interval p p)) GT -> do popLexState lexToken where p = lexPos inp {-| This action is only executed from the 'Agda.Syntax.Parser.Lexer.empty_layout' state. It will exit this state, enter the 'Agda.Syntax.Parser.Lexer.bol' state, and return a virtual close brace (closing the empty layout block started by 'newLayoutContext'). -} emptyLayout :: LexAction Token emptyLayout inp _ _ = do popLexState pushLexState bol return (TokSymbol SymCloseVirtualBrace (Interval p p)) where p = lexPos inp {-| Start a new layout context. This is one of two ways to get out of the 'Agda.Syntax.Parser.Lexer.layout' state (the other is 'openBrace'). There are two possibilities: - The current token is to the right of the current layout context (or we're in a no layout context). - The current token is to the left of or in the same column as the current context. In the first case everything is fine and we enter a new layout context at the column of the current token. In the second case we have an empty layout block so we enter the 'Agda.Syntax.Parser.Lexer.empty_layout' state. In both cases we return a virtual open brace without consuming any input. Entering a new state when we know we want to generate a virtual @{}@ may seem a bit roundabout. The thing is that we can only generate one token at a time, so the way to generate two tokens is to generate the first one and then enter a state in which the only thing you can do is generate the second one. -} newLayoutContext :: LexAction Token newLayoutContext inp _ _ = do let offset = posCol p ctx <- topContext case ctx of Layout prevOffs | prevOffs >= offset -> do pushLexState empty_layout return (TokSymbol SymOpenVirtualBrace (Interval p p)) _ -> do pushContext (Layout offset) return (TokSymbol SymOpenVirtualBrace (Interval p p)) where p = lexPos inp -- | Compute the relative position of a location to the -- current layout context. getOffside :: Position -> Parser Ordering getOffside loc = do ctx <- topContext return $ case ctx of Layout n -> compare (posCol loc) n _ -> GT Agda-2.4.2.5/src/full/Agda/Syntax/Parser/Alex.hs0000644000000000000000000000723612635075266017264 0ustar0000000000000000{-| This module defines the things required by Alex and some other Alex related things. -} module Agda.Syntax.Parser.Alex ( -- * Alex requirements AlexInput(..) , lensLexInput , alexInputPrevChar , alexGetChar, alexGetByte -- * Lex actions , LexAction, LexPredicate , (.&&.), (.||.), not' , PreviousInput, CurrentInput, TokenLength -- * Monad operations , getLexInput, setLexInput ) where import Control.Arrow import Control.Monad.State import Data.Word import Agda.Syntax.Position import Agda.Syntax.Parser.Monad import Agda.Utils.Lens import Agda.Utils.Monad -- | This is what the lexer manipulates. data AlexInput = AlexInput { lexPos :: !Position -- ^ current position , lexInput :: String -- ^ current input , lexPrevChar :: !Char -- ^ previously read character } -- | A lens for 'lexInput'. lensLexInput :: Lens' String AlexInput lensLexInput f r = f (lexInput r) <&> \ s -> r { lexInput = s } -- | Get the previously lexed character. Same as 'lexPrevChar'. Alex needs this -- to be defined to handle \"patterns with a left-context\". alexInputPrevChar :: AlexInput -> Char alexInputPrevChar = lexPrevChar -- | Lex a character. No surprises. -- -- This function is used by Alex 2. alexGetChar :: AlexInput -> Maybe (Char, AlexInput) alexGetChar (AlexInput { lexInput = [] }) = Nothing alexGetChar (AlexInput { lexInput = c:s, lexPos = p }) = Just (c, AlexInput { lexInput = s , lexPos = movePos p c , lexPrevChar = c } ) -- | A variant of 'alexGetChar'. -- -- This function is used by Alex 3. alexGetByte :: AlexInput -> Maybe (Word8, AlexInput) alexGetByte ai = -- Note that we ensure that every character presented to Alex fits -- in seven bits. (fromIntegral . fromEnum *** id) <$> alexGetChar ai {-------------------------------------------------------------------------- Monad operations --------------------------------------------------------------------------} getLexInput :: Parser AlexInput getLexInput = getInp <$> get where getInp s = AlexInput { lexPos = parsePos s , lexInput = parseInp s , lexPrevChar = parsePrevChar s } setLexInput :: AlexInput -> Parser () setLexInput inp = modify upd where upd s = s { parsePos = lexPos inp , parseInp = lexInput inp , parsePrevChar = lexPrevChar inp } {-------------------------------------------------------------------------- Lex actions --------------------------------------------------------------------------} type PreviousInput = AlexInput type CurrentInput = AlexInput type TokenLength = Int -- | In the lexer, regular expressions are associated with lex actions who's -- task it is to construct the tokens. type LexAction r = PreviousInput -> CurrentInput -> TokenLength -> Parser r -- | Sometimes regular expressions aren't enough. Alex provides a way to do -- arbitrary computations to see if the input matches. This is done with a -- lex predicate. type LexPredicate = ([LexState], ParseFlags) -> PreviousInput -> TokenLength -> CurrentInput -> Bool -- | Conjunction of 'LexPredicate's. (.&&.) :: LexPredicate -> LexPredicate -> LexPredicate p1 .&&. p2 = \x y z u -> p1 x y z u && p2 x y z u -- | Disjunction of 'LexPredicate's. (.||.) :: LexPredicate -> LexPredicate -> LexPredicate p1 .||. p2 = \x y z u -> p1 x y z u || p2 x y z u -- | Negation of 'LexPredicate's. not' :: LexPredicate -> LexPredicate not' p = \x y z u -> not (p x y z u) Agda-2.4.2.5/src/full/Agda/Syntax/Parser/Monad.hs0000644000000000000000000002452412635075266017430 0ustar0000000000000000{-# LANGUAGE DeriveDataTypeable #-} {-# LANGUAGE MultiParamTypeClasses #-} module Agda.Syntax.Parser.Monad ( -- * The parser monad Parser , ParseResult(..) , ParseState(..) , ParseError(..) , LexState , LayoutContext(..) , ParseFlags (..) -- * Running the parser , initState , defaultParseFlags , parse , parsePosString , parseFile -- * Manipulating the state , setParsePos, setLastPos, getParseInterval , setPrevToken , getParseFlags , getLexState, pushLexState, popLexState -- ** Layout , topContext, popContext, pushContext , pushCurrentContext -- ** Errors , parseError, parseErrorAt, parseError' , lexError ) where import Control.Exception import Data.Int import Data.Typeable ( Typeable ) import Control.Monad.State import Control.Applicative import Agda.Syntax.Position import Agda.Utils.Except ( MonadError(catchError, throwError) ) import Agda.Utils.FileName import qualified Agda.Utils.IO.UTF8 as UTF8 import Agda.Utils.Pretty {-------------------------------------------------------------------------- The parse monad --------------------------------------------------------------------------} -- | The parse monad. Equivalent to @StateT 'ParseState' (Either 'ParseError')@ -- except for the definition of @fail@, which builds a suitable 'ParseError' -- object. newtype Parser a = P { unP :: ParseState -> ParseResult a } -- | The parser state. Contains everything the parser and the lexer could ever -- need. data ParseState = PState { parsePos :: !Position -- ^ position at current input location , parseLastPos :: !Position -- ^ position of last token , parseInp :: String -- ^ the current input , parsePrevChar :: !Char -- ^ the character before the input , parsePrevToken:: String -- ^ the previous token , parseLayout :: [LayoutContext] -- ^ the stack of layout contexts , parseLexState :: [LexState] -- ^ the state of the lexer -- (states can be nested so we need a stack) , parseFlags :: ParseFlags -- ^ currently there are no flags } deriving Show {-| To do context sensitive lexing alex provides what is called /start codes/ in the Alex documentation. It is really an integer representing the state of the lexer, so we call it @LexState@ instead. -} type LexState = Int -- | We need to keep track of the context to do layout. The context -- specifies the indentation (if any) of a layout block. See -- "Agda.Syntax.Parser.Layout" for more informaton. data LayoutContext = NoLayout -- ^ no layout | Layout Int32 -- ^ layout at specified column deriving Show -- | There aren't any parser flags at the moment. data ParseFlags = ParseFlags { parseKeepComments :: Bool -- ^ Should comment tokens be returned by the lexer? } deriving Show -- | What you get if parsing fails. data ParseError = ParseError { errPos :: Position -- ^ where the error occured , errInput :: String -- ^ the remaining input , errPrevToken :: String -- ^ the previous token , errMsg :: String -- ^ hopefully an explanation of what happened } deriving (Typeable) instance Exception ParseError -- | The result of parsing something. data ParseResult a = ParseOk ParseState a | ParseFailed ParseError {-------------------------------------------------------------------------- Instances --------------------------------------------------------------------------} instance Monad Parser where return x = P $ \s -> ParseOk s x P m >>= f = P $ \s -> case m s of ParseFailed e -> ParseFailed e ParseOk s' x -> unP (f x) s' fail msg = P $ \s -> ParseFailed $ ParseError { errPos = parseLastPos s , errInput = parseInp s , errPrevToken = parsePrevToken s , errMsg = msg } instance Functor Parser where fmap = liftM instance Applicative Parser where pure = return (<*>) = ap instance MonadError ParseError Parser where throwError e = P $ \_ -> ParseFailed e P m `catchError` h = P $ \s -> case m s of ParseFailed err -> unP (h err) s m' -> m' instance MonadState ParseState Parser where get = P $ \s -> ParseOk s s put s = P $ \_ -> ParseOk s () instance Show ParseError where show = prettyShow instance Pretty ParseError where pretty err = vcat [ pretty (errPos err) <> colon <+> text (errMsg err) , text $ errPrevToken err ++ "" , text $ take 30 (errInput err) ++ "..." ] instance HasRange ParseError where getRange err = posToRange (errPos err) (errPos err) {-------------------------------------------------------------------------- Running the parser --------------------------------------------------------------------------} initStatePos :: Position -> ParseFlags -> String -> [LexState] -> ParseState initStatePos pos flags inp st = PState { parsePos = pos , parseLastPos = pos , parseInp = inp , parsePrevChar = '\n' , parsePrevToken = "" , parseLexState = st , parseLayout = [NoLayout] , parseFlags = flags } -- | Constructs the initial state of the parser. The string argument -- is the input string, the file path is only there because it's part -- of a position. initState :: Maybe AbsolutePath -> ParseFlags -> String -> [LexState] -> ParseState initState file = initStatePos (startPos file) -- | The default flags. defaultParseFlags :: ParseFlags defaultParseFlags = ParseFlags { parseKeepComments = False } -- | The most general way of parsing a string. The "Agda.Syntax.Parser" will define -- more specialised functions that supply the 'ParseFlags' and the -- 'LexState'. parse :: ParseFlags -> [LexState] -> Parser a -> String -> ParseResult a parse flags st p input = unP p (initState Nothing flags input st) -- | The even more general way of parsing a string. parsePosString :: Position -> ParseFlags -> [LexState] -> Parser a -> String -> ParseResult a parsePosString pos flags st p input = unP p (initStatePos pos flags input st) -- | The most general way of parsing a file. The "Agda.Syntax.Parser" will define -- more specialised functions that supply the 'ParseFlags' and the -- 'LexState'. -- -- Note that Agda source files always use the UTF-8 character -- encoding. parseFile :: ParseFlags -> [LexState] -> Parser a -> AbsolutePath -> IO (ParseResult a) parseFile flags st p file = do input <- liftIO $ UTF8.readTextFile $ filePath file return $ unP p (initState (Just file) flags input st) {-------------------------------------------------------------------------- Manipulating the state --------------------------------------------------------------------------} setParsePos :: Position -> Parser () setParsePos p = modify $ \s -> s { parsePos = p } setLastPos :: Position -> Parser () setLastPos p = modify $ \s -> s { parseLastPos = p } setPrevToken :: String -> Parser () setPrevToken t = modify $ \s -> s { parsePrevToken = t } getLastPos :: Parser Position getLastPos = get >>= return . parseLastPos -- | The parse interval is between the last position and the current position. getParseInterval :: Parser Interval getParseInterval = do s <- get return $ Interval (parseLastPos s) (parsePos s) getLexState :: Parser [LexState] getLexState = parseLexState <$> get setLexState :: [LexState] -> Parser () setLexState ls = do s <- get put $ s { parseLexState = ls } pushLexState :: LexState -> Parser () pushLexState l = do s <- getLexState setLexState (l:s) popLexState :: Parser () popLexState = do _:ls <- getLexState setLexState ls getParseFlags :: Parser ParseFlags getParseFlags = parseFlags <$> get -- | @parseError = fail@ parseError :: String -> Parser a parseError = fail -- | Fake a parse error at the specified position. Used, for instance, when -- lexing nested comments, which when failing will always fail at the end -- of the file. A more informative position is the beginning of the failing -- comment. parseErrorAt :: Position -> String -> Parser a parseErrorAt p msg = do setLastPos p parseError msg -- | Use 'parseErrorAt' or 'parseError' as appropriate. parseError' :: Maybe Position -> String -> Parser a parseError' = maybe parseError parseErrorAt -- | For lexical errors we want to report the current position as the site of -- the error, whereas for parse errors the previous position is the one -- we're interested in (since this will be the position of the token we just -- lexed). This function does 'parseErrorAt' the current position. lexError :: String -> Parser a lexError msg = do p <- parsePos <$> get parseErrorAt p msg {-------------------------------------------------------------------------- Layout --------------------------------------------------------------------------} getContext :: Parser [LayoutContext] getContext = parseLayout <$> get setContext :: [LayoutContext] -> Parser () setContext ctx = do s <- get put $ s { parseLayout = ctx } -- | Return the current layout context. topContext :: Parser LayoutContext topContext = do ctx <- getContext case ctx of [] -> parseError "No layout context in scope" l:_ -> return l popContext :: Parser () popContext = do ctx <- getContext case ctx of [] -> parseError "There is no layout block to close at this point." _:ctx -> setContext ctx pushContext :: LayoutContext -> Parser () pushContext l = do ctx <- getContext setContext (l : ctx) -- | Should only be used at the beginning of a file. When we start parsing -- we should be in layout mode. Instead of forcing zero indentation we use -- the indentation of the first token. pushCurrentContext :: Parser () pushCurrentContext = do p <- getLastPos pushContext (Layout (posCol p)) Agda-2.4.2.5/src/full/Agda/Syntax/Parser/Lexer.x0000644000000000000000000002660312635075266017306 0ustar0000000000000000{ {-# OPTIONS_GHC -fno-warn-deprecated-flags #-} {-# OPTIONS_GHC -fno-warn-missing-signatures #-} {-# OPTIONS_GHC -fno-warn-tabs #-} {-# OPTIONS_GHC -fno-warn-unused-imports #-} {-# LANGUAGE BangPatterns #-} {-| The lexer is generated by Alex () and is an adaptation of GHC's lexer. The main lexing function 'lexer' is called by the "Agda.Syntax.Parser.Parser" to get the next token from the input. -} module Agda.Syntax.Parser.Lexer ( -- * The main function lexer -- * Lex states , normal, literate, code , layout, empty_layout, bol, imp_dir -- * Alex generated functions , AlexReturn(..), alexScanUser ) where -- -- import Data.List import Agda.Syntax.Parser.Alex import Agda.Syntax.Parser.Comments #ifndef __HADDOCK__ import {-# SOURCE #-} Agda.Syntax.Parser.Layout import {-# SOURCE #-} Agda.Syntax.Parser.LexActions #endif import Agda.Syntax.Parser.Monad import Agda.Syntax.Parser.StringLiterals import Agda.Syntax.Parser.Tokens import Agda.Syntax.Literal } -- Unicode is not handled by the following regular expressions. -- Instead, unicode characters are translated to 7-bit ASCII -- by Agda.Syntax.Parser.LexActions.foolAlex in a preprocessing pass. $digit = 0-9 $hexdigit = [ $digit a-f A-F ] $alpha = [ A-Z a-z _ ] $op = [ \- \! \# \$ \% \& \* \+ \/ \< \= \> \^ \| \~ \? \` \[ \] \, \: ] $idstart = [ $digit $alpha $op ] $idchar = [ $idstart ' \\ ] $nonalpha = $idchar # $alpha $nonalphanum = $nonalpha # $digit $white_notab = $white # \t $white_nonl = $white_notab # \n @number = $digit+ | "0x" $hexdigit+ @exponent = [eE] [\-\+]? @number @float = @number \. @number @exponent? | @number @exponent -- A name can't start with \x (to allow \x -> x). -- Bug in alex: [ _ op ]+ doesn't seem to work! @start = ($idstart # [_]) | \\ [ $nonalpha ] @ident = @start $idchar* | [_] $idchar+ @namespace = (@ident \.)* @q_ident = @namespace @ident tokens :- -- Lexing literate files $white_nonl* \\ "begin{code}" $white_nonl* $ { end_ } .+ / { keepComments } { withInterval TokTeX } .+ ; \n ; () / { eof } { end_ } \\ "end{code}" / { inState code } { begin_ tex } -- \end{code} should only be recognized if the bottom of the stack is -- White space <0,code,bol_,layout_,empty_layout_,imp_dir_> $white_nonl+ ; $white_notab ; -- Pragmas <0,code> "{-#" { begin pragma } "{-#" { symbol SymOpenPragma } "#-}" { endWith $ symbol SymClosePragma } "OPTIONS" { keyword KwOPTIONS } "BUILTIN" { keyword KwBUILTIN } "REWRITE" { keyword KwREWRITE } "COMPILED_DATA" { keyword KwCOMPILED_DATA } "COMPILED_TYPE" { keyword KwCOMPILED_TYPE } "COMPILED" { keyword KwCOMPILED } "COMPILED_EXPORT" { keyword KwCOMPILED_EXPORT } "COMPILED_EPIC" { keyword KwCOMPILED_EPIC } "COMPILED_JS" { keyword KwCOMPILED_JS } "STATIC" { keyword KwSTATIC } "IMPORT" { keyword KwIMPORT } "IMPOSSIBLE" { keyword KwIMPOSSIBLE } "ETA" { keyword KwETA } "NO_TERMINATION_CHECK" { keyword KwNO_TERMINATION_CHECK } "NON_TERMINATING" { keyword KwNON_TERMINATING } "TERMINATING" { keyword KwTERMINATING } "MEASURE" { keyword KwMEASURE } "LINE" { keyword KwLINE } . # [ $white ] + { withInterval $ TokString } -- Comments -- We need to rule out pragmas here. Usually longest match would take -- precedence, but in some states pragmas aren't valid but comments are. <0,code,bol_,layout_,empty_layout_,imp_dir_> "{-" / { not' (followedBy '#') } { nestedComment } -- A misplaced end-comment, like in @f {x-} = x-@ gives a parse error. "-}" { symbol SymEndComment } @ident "-}" { symbol SymEndComment } -- Dashes followed by a name symbol should be parsed as a name. <0,code,bol_,layout_,empty_layout_,imp_dir_> "--" .* / { keepComments .&&. (followedBy '\n' .||. eof) } { withInterval TokComment } <0,code,bol_,layout_,empty_layout_,imp_dir_> "--" .* / { followedBy '\n' .||. eof } ; -- We need to check the offside rule for the first token on each line. We -- should not check the offside rule for the end of file token or an -- '\end{code}' <0,code,imp_dir_> \n { begin bol_ } { \n ; -- ^ \\ "end{code}" { end } () / { not' eof } { offsideRule } } -- After a layout keyword there is either an open brace (no layout) or the -- indentation of the first token decides the column of the layout block. { \n ; -- \{ { endWith openBrace } () { endWith newLayoutContext } } -- The only rule for the empty_layout state. Generates a close brace. () { emptyLayout } -- Keywords <0,code> let { keyword KwLet } <0,code> in { keyword KwIn } <0,code> where { keyword KwWhere } <0,code> field { keyword KwField } <0,code> with { keyword KwWith } <0,code> rewrite { keyword KwRewrite } <0,code> postulate { keyword KwPostulate } <0,code> primitive { keyword KwPrimitive } <0,code> open { keyword KwOpen } <0,code> import { keyword KwImport } <0,code> module { keyword KwModule } <0,code> data { keyword KwData } <0,code> codata { keyword KwCoData } <0,code> record { keyword KwRecord } <0,code> constructor { keyword KwConstructor } <0,code> inductive { keyword KwInductive } <0,code> coinductive { keyword KwCoInductive } <0,code> infix { keyword KwInfix } <0,code> infixl { keyword KwInfixL } <0,code> infixr { keyword KwInfixR } <0,code> mutual { keyword KwMutual } <0,code> abstract { keyword KwAbstract } <0,code> private { keyword KwPrivate } <0,code> instance { keyword KwInstance } <0,code> Set { keyword KwSet } <0,code> Prop { keyword KwProp } <0,code> forall { keyword KwForall } <0,code> Set @number { withInterval' (read . drop 3) TokSetN } <0,code> quoteGoal { keyword KwQuoteGoal } <0,code> quoteContext { keyword KwQuoteContext } <0,code> quote { keyword KwQuote } <0,code> quoteTerm { keyword KwQuoteTerm } <0,code> unquote { keyword KwUnquote } <0,code> unquoteDecl { keyword KwUnquoteDecl } <0,code> tactic { keyword KwTactic } <0,code> syntax { keyword KwSyntax } <0,code> pattern { keyword KwPatternSyn } -- The parser is responsible to put the lexer in the imp_dir_ state when it -- expects an import directive keyword. This means that if you run the -- tokensParser you will never see these keywords. <0,code> using { keyword KwUsing } <0,code> hiding { keyword KwHiding } <0,code> renaming { keyword KwRenaming } to { endWith $ keyword KwTo } <0,code> public { keyword KwPublic } -- Holes <0,code> "{!" { hole } -- Special symbols <0,code> "..." { symbol SymEllipsis } <0,code> ".." { symbol SymDotDot } <0,code> "." { symbol SymDot } <0,code> ";" { symbol SymSemi } <0,code> ":" { symbol SymColon } <0,code> "=" { symbol SymEqual } <0,code> "_" { symbol SymUnderscore } <0,code> "?" { symbol SymQuestionMark } <0,code> "|" { symbol SymBar } <0,code> "(" { symbol SymOpenParen } <0,code> ")" { symbol SymCloseParen } <0,code> "->" { symbol SymArrow } <0,code> "\" { symbol SymLambda } -- " <0,code> "@" { symbol SymAs } <0,code> "{{" /[^!] { symbol SymDoubleOpenBrace } -- We don't lex '}}' into a SymDoubleCloseBrace. Instead, we lex it as -- two SymCloseBrace's. When the parser is looking for a double -- closing brace, it will also accept two SymCloseBrace's, after -- verifying that they are immediately next to each other. -- This trick allows us to keep "record { a = record {}}" working -- properly. -- <0,code> "}}" { symbol SymDoubleCloseBrace } <0,code> "{" { symbol SymOpenBrace } -- you can't use braces for layout <0,code> "}" { symbol SymCloseBrace } -- Literals <0,code> \' { litChar } <0,code> \" { litString } <0,code> @number { literal LitInt } <0,code> @float { literal LitFloat } -- Identifiers <0,code,imp_dir_> @q_ident { identifier } -- Andreas, 2013-02-21, added identifiers to the 'imp_dir_' state. -- This is to fix issue 782: 'toz' should not be lexed as 'to' -- (followed by 'z' after leaving imp_dir_). -- With identifiers in state imp_dir_, 'toz' should be lexed as -- identifier 'toz' in imp_dir_ state, leading to a parse error later. { -- | This is the initial state for parsing a literate file. Code blocks -- should be enclosed in @\\begin{code}@ @\\end{code}@ pairs. literate :: LexState literate = tex -- | This is the initial state for parsing a regular, non-literate file. normal :: LexState normal = 0 {-| The layout state. Entered when we see a layout keyword ('withLayout') and exited either when seeing an open brace ('openBrace') or at the next token ('newLayoutContext'). Update: we don't use braces for layout anymore. -} layout :: LexState layout = layout_ {-| The state inside a pragma. -} pragma :: LexState pragma = pragma_ {-| We enter this state from 'newLayoutContext' when the token following a layout keyword is to the left of (or at the same column as) the current layout context. Example: > data Empty : Set where > foo : Empty -> Nat Here the second line is not part of the @where@ clause since it is has the same indentation as the @data@ definition. What we have to do is insert an empty layout block @{}@ after the @where@. The only thing that can happen in this state is that 'emptyLayout' is executed, generating the closing brace. The open brace is generated when entering by 'newLayoutContext'. -} empty_layout :: LexState empty_layout = empty_layout_ -- | This state is entered at the beginning of each line. You can't lex -- anything in this state, and to exit you have to check the layout rule. -- Done with 'offsideRule'. bol :: LexState bol = bol_ -- | This state can only be entered by the parser. In this state you can only -- lex the keywords @using@, @hiding@, @renaming@ and @to@. Moreover they are -- only keywords in this particular state. The lexer will never enter this -- state by itself, that has to be done in the parser. imp_dir :: LexState imp_dir = imp_dir_ -- | Return the next token. This is the function used by Happy in the parser. -- -- @lexer k = 'lexToken' >>= k@ lexer :: (Token -> Parser a) -> Parser a lexer k = lexToken >>= k -- | Do not use this function; it sets the 'ParseFlags' to -- 'undefined'. alexScan :: AlexInput -> Int -> AlexReturn (LexAction Token) -- | This is the main lexing function generated by Alex. alexScanUser :: ([LexState], ParseFlags) -> AlexInput -> Int -> AlexReturn (LexAction Token) } Agda-2.4.2.5/src/full/Agda/Syntax/Parser/Layout.hs-boot0000644000000000000000000000032512635075266020601 0ustar0000000000000000module Agda.Syntax.Parser.Layout where import Agda.Syntax.Parser.Alex import Agda.Syntax.Parser.Tokens offsideRule :: LexAction Token newLayoutContext :: LexAction Token emptyLayout :: LexAction Token Agda-2.4.2.5/src/full/Agda/Syntax/Parser/LexActions.hs0000644000000000000000000002035412635075266020440 0ustar0000000000000000-- {-# LANGUAGE CPP #-} {-| This module contains the building blocks used to construct the lexer. -} module Agda.Syntax.Parser.LexActions ( -- * Main function lexToken -- * Lex actions -- ** General actions , token , withInterval, withInterval', withInterval_ , withLayout , begin, end, endWith , begin_, end_ , lexError -- ** Specialized actions , keyword, symbol, identifier, literal -- * Lex predicates , followedBy, eof, inState ) where import Data.Char import Control.Arrow import Agda.Syntax.Parser.Lexer import Agda.Syntax.Parser.Alex import Agda.Syntax.Parser.Monad import Agda.Syntax.Parser.Tokens import Agda.Syntax.Position import Agda.Syntax.Literal import Agda.Utils.Lens import Agda.Utils.List import Agda.Utils.Tuple {-------------------------------------------------------------------------- Scan functions --------------------------------------------------------------------------} -- | Called at the end of a file. Returns 'TokEOF'. returnEOF :: AlexInput -> Parser Token returnEOF inp = do setLastPos $ lexPos inp setPrevToken "" return TokEOF -- | Set the current input and lex a new token (calls 'lexToken'). skipTo :: AlexInput -> Parser Token skipTo inp = setLexInput inp >> lexToken {-| Scan the input to find the next token. Calls 'Agda.Syntax.Parser.Lexer.alexScanUser'. This is the main lexing function where all the work happens. The function 'Agda.Syntax.Parser.Lexer.lexer', used by the parser is the continuation version of this function. -} lexToken :: Parser Token lexToken = do inp <- getLexInput lss@(ls:_) <- getLexState flags <- getParseFlags case alexScanUser (lss, flags) (foolAlex inp) ls of AlexEOF -> returnEOF inp AlexSkip inp' len -> skipTo (newInput inp inp' len) AlexToken inp' len action -> fmap postToken $ action inp (newInput inp inp' len) len AlexError i -> parseError $ "Lexical error" ++ (case lexInput i of '\t' : _ -> " (you may want to replace tabs with spaces)" _ -> "") ++ ":" postToken :: Token -> Token postToken (TokId (r, "\x03bb")) = TokSymbol SymLambda r postToken (TokId (r, "\x2192")) = TokSymbol SymArrow r postToken (TokId (r, "\x2983")) = TokSymbol SymDoubleOpenBrace r postToken (TokId (r, "\x2984")) = TokSymbol SymDoubleCloseBrace r postToken (TokId (r, "\x2200")) = TokKeyword KwForall r postToken (TokId (r, s)) | set == "Set" && all isSub n = TokSetN (r, readSubscript n) where (set, n) = splitAt 3 s isSub c = c `elem` ['\x2080'..'\x2089'] readSubscript = read . map (\c -> toEnum (fromEnum c - 0x2080 + fromEnum '0')) postToken t = t -- | Use the input string from the previous input (with the appropriate -- number of characters dropped) instead of the fake input string that -- was given to Alex (with unicode characters removed). newInput :: PreviousInput -> CurrentInput -> TokenLength -> CurrentInput newInput inp inp' len = case drop (len - 1) (lexInput inp) of c:s' -> inp' { lexInput = s' , lexPrevChar = c } [] -> inp' { lexInput = [] } -- we do get empty tokens moving between states -- | Alex 2 can't handle unicode characters. To solve this we -- translate all Unicode (non-ASCII) identifiers to @z@, all Unicode -- operator characters to @+@, and all whitespace characters (except -- for @\t@ and @\n@) to ' '. -- Further, non-printable Unicode characters are translated to an -- arbitrary, harmless ASCII non-printable character, @'\1'@. -- -- It is important that there aren't any keywords containing @z@, @+@ or @ @. foolAlex :: AlexInput -> AlexInput foolAlex = over lensLexInput $ map $ \ c -> case c of _ | isSpace c && not (c `elem` "\t\n") -> ' ' _ | isAscii c -> c _ | isPrint c -> if isAlpha c then 'z' else '+' _ | otherwise -> '\1' {-------------------------------------------------------------------------- Lex actions --------------------------------------------------------------------------} -- | The most general way of parsing a token. token :: (String -> Parser tok) -> LexAction tok token action inp inp' len = do setLexInput inp' setPrevToken t setLastPos $ lexPos inp action t where t = take len $ lexInput inp -- | Parse a token from an 'Interval' and the lexed string. withInterval :: ((Interval, String) -> tok) -> LexAction tok withInterval f = token $ \s -> do r <- getParseInterval return $ f (r,s) -- | Like 'withInterval', but applies a function to the string. withInterval' :: (String -> a) -> ((Interval, a) -> tok) -> LexAction tok withInterval' f t = withInterval (t . (id -*- f)) -- | Return a token without looking at the lexed string. withInterval_ :: (Interval -> r) -> LexAction r withInterval_ f = withInterval (f . fst) -- | Executed for layout keywords. Enters the 'Agda.Syntax.Parser.Lexer.layout' -- state and performs the given action. withLayout :: LexAction r -> LexAction r withLayout a i1 i2 n = do pushLexState layout a i1 i2 n -- | Enter a new state without consuming any input. begin :: LexState -> LexAction Token begin code _ _ _ = do pushLexState code lexToken -- | Enter a new state throwing away the current lexeme. begin_ :: LexState -> LexAction Token begin_ code _ inp' _ = do pushLexState code skipTo inp' -- | Exit the current state throwing away the current lexeme. end_ :: LexAction Token end_ _ inp' _ = do popLexState skipTo inp' -- | Exit the current state and perform the given action. endWith :: LexAction a -> LexAction a endWith a inp inp' n = do popLexState a inp inp' n -- | Exit the current state without consuming any input end :: LexAction Token end _ _ _ = do popLexState lexToken -- | Parse a 'Keyword' token, triggers layout for 'layoutKeywords'. keyword :: Keyword -> LexAction Token keyword k = layout $ withInterval_ (TokKeyword k) where layout | elem k layoutKeywords = withLayout | otherwise = id -- | Parse a 'Symbol' token. symbol :: Symbol -> LexAction Token symbol s = withInterval_ (TokSymbol s) -- | Parse a literal. literal :: Read a => (Range -> a -> Literal) -> LexAction Token literal lit = withInterval' read (TokLiteral . uncurry lit . (getRange *** id)) -- | Parse an identifier. Identifiers can be qualified (see 'Name'). -- Example: @Foo.Bar.f@ identifier :: LexAction Token identifier = qualified (either TokId TokQId) -- | Parse a possibly qualified name. qualified :: (Either (Interval, String) [(Interval, String)] -> a) -> LexAction a qualified tok = token $ \s -> do i <- getParseInterval case mkName i $ wordsBy (=='.') s of [] -> lexError "lex error on .." [x] -> return $ tok $ Left x xs -> return $ tok $ Right xs where -- Compute the ranges for the substrings (separated by '.') of -- a name. Dots are included: the intervals generated for -- "A.B.x" correspond to "A.", "B." and "x". mkName :: Interval -> [String] -> [(Interval, String)] mkName _ [] = [] mkName i [x] = [(i, x)] mkName i (x:xs) = (i0, x) : mkName i1 xs where p0 = iStart i p1 = iEnd i p' = movePos (movePosByString p0 x) '.' i0 = Interval p0 p' i1 = Interval p' p1 {-------------------------------------------------------------------------- Predicates --------------------------------------------------------------------------} -- | True when the given character is the next character of the input string. followedBy :: Char -> LexPredicate followedBy c' _ _ _ inp = case lexInput inp of [] -> False c:_ -> c == c' -- | True if we are at the end of the file. eof :: LexPredicate eof _ _ _ inp = null $ lexInput inp -- | True if the given state appears somewhere on the state stack inState :: LexState -> LexPredicate inState s (ls, _) _ _ _ = s `elem` ls Agda-2.4.2.5/src/full/Agda/Syntax/Parser/Parser.y0000644000000000000000000021307112635075266017461 0ustar0000000000000000{ {-# LANGUAGE TupleSections #-} {-| The parser is generated by Happy (). - - Ideally, ranges should be as precise as possible, to get messages that - emphasize precisely the faulting term(s) upon error. - - However, interactive highlighting is only applied at the end of each - mutual block, keywords are only highlighted once (see - `TypeChecking.Rules.Decl'). So if the ranges of two declarations - interleave, one must ensure that keyword ranges are not included in - the intersection. (Otherwise they are uncolored by the interactive - highlighting.) - -} module Agda.Syntax.Parser.Parser ( moduleParser , moduleNameParser , exprParser , tokensParser , tests ) where import Control.Monad import Data.Char import Data.Functor import Data.List import Data.Maybe import qualified Data.Traversable as T import Debug.Trace import Agda.Syntax.Position hiding (tests) import Agda.Syntax.Parser.Monad import Agda.Syntax.Parser.Lexer import Agda.Syntax.Parser.Tokens import Agda.Syntax.Concrete as C import Agda.Syntax.Concrete.Pretty () import Agda.Syntax.Common hiding (Arg, Dom, NamedArg) import qualified Agda.Syntax.Common as Common import Agda.Syntax.Fixity import Agda.Syntax.Notation import Agda.Syntax.Literal import Agda.Utils.Hash import Agda.Utils.List (spanJust) import Agda.Utils.Monad import Agda.Utils.Pretty import Agda.Utils.QuickCheck import Agda.Utils.Singleton import Agda.Utils.TestHelpers import Agda.Utils.Tuple } %name tokensParser Tokens %name exprParser Expr %name moduleParser File %name moduleNameParser ModuleName %tokentype { Token } %monad { Parser } %lexer { lexer } { TokEOF } %expect 1 -- shift/reduce for \ x y z -> foo = bar -- shifting means it'll parse as \ x y z -> (foo = bar) rather than -- (\ x y z -> foo) = bar -- This is a trick to get rid of shift/reduce conflicts arising because we want -- to parse things like "m >>= \x -> k x". See the Expr rule for more -- information. %nonassoc LOWEST %nonassoc '->' %token 'abstract' { TokKeyword KwAbstract $$ } 'codata' { TokKeyword KwCoData $$ } 'coinductive' { TokKeyword KwCoInductive $$ } 'constructor' { TokKeyword KwConstructor $$ } 'data' { TokKeyword KwData $$ } 'field' { TokKeyword KwField $$ } 'forall' { TokKeyword KwForall $$ } 'hiding' { TokKeyword KwHiding $$ } 'import' { TokKeyword KwImport $$ } 'in' { TokKeyword KwIn $$ } 'inductive' { TokKeyword KwInductive $$ } 'infix' { TokKeyword KwInfix $$ } 'infixl' { TokKeyword KwInfixL $$ } 'infixr' { TokKeyword KwInfixR $$ } 'instance' { TokKeyword KwInstance $$ } 'let' { TokKeyword KwLet $$ } 'module' { TokKeyword KwModule $$ } 'mutual' { TokKeyword KwMutual $$ } 'open' { TokKeyword KwOpen $$ } 'pattern' { TokKeyword KwPatternSyn $$ } 'postulate' { TokKeyword KwPostulate $$ } 'primitive' { TokKeyword KwPrimitive $$ } 'private' { TokKeyword KwPrivate $$ } 'Prop' { TokKeyword KwProp $$ } 'public' { TokKeyword KwPublic $$ } 'quote' { TokKeyword KwQuote $$ } 'quoteContext' { TokKeyword KwQuoteContext $$ } 'quoteGoal' { TokKeyword KwQuoteGoal $$ } 'quoteTerm' { TokKeyword KwQuoteTerm $$ } 'record' { TokKeyword KwRecord $$ } 'renaming' { TokKeyword KwRenaming $$ } 'rewrite' { TokKeyword KwRewrite $$ } 'Set' { TokKeyword KwSet $$ } 'syntax' { TokKeyword KwSyntax $$ } 'tactic' { TokKeyword KwTactic $$ } 'to' { TokKeyword KwTo $$ } 'unquote' { TokKeyword KwUnquote $$ } 'unquoteDecl' { TokKeyword KwUnquoteDecl $$ } 'using' { TokKeyword KwUsing $$ } 'where' { TokKeyword KwWhere $$ } 'with' { TokKeyword KwWith $$ } 'BUILTIN' { TokKeyword KwBUILTIN $$ } 'COMPILED' { TokKeyword KwCOMPILED $$ } 'COMPILED_DATA' { TokKeyword KwCOMPILED_DATA $$ } 'COMPILED_EPIC' { TokKeyword KwCOMPILED_EPIC $$ } 'COMPILED_EXPORT' { TokKeyword KwCOMPILED_EXPORT $$ } 'COMPILED_JS' { TokKeyword KwCOMPILED_JS $$ } 'COMPILED_TYPE' { TokKeyword KwCOMPILED_TYPE $$ } 'ETA' { TokKeyword KwETA $$ } 'IMPORT' { TokKeyword KwIMPORT $$ } 'IMPOSSIBLE' { TokKeyword KwIMPOSSIBLE $$ } 'MEASURE' { TokKeyword KwMEASURE $$ } 'NO_TERMINATION_CHECK' { TokKeyword KwNO_TERMINATION_CHECK $$ } 'NON_TERMINATING' { TokKeyword KwNON_TERMINATING $$ } 'OPTIONS' { TokKeyword KwOPTIONS $$ } 'REWRITE' { TokKeyword KwREWRITE $$ } 'STATIC' { TokKeyword KwSTATIC $$ } 'TERMINATING' { TokKeyword KwTERMINATING $$ } setN { TokSetN $$ } tex { TokTeX $$ } comment { TokComment $$ } '...' { TokSymbol SymEllipsis $$ } '..' { TokSymbol SymDotDot $$ } '.' { TokSymbol SymDot $$ } ';' { TokSymbol SymSemi $$ } ':' { TokSymbol SymColon $$ } '=' { TokSymbol SymEqual $$ } '_' { TokSymbol SymUnderscore $$ } '?' { TokSymbol SymQuestionMark $$ } '->' { TokSymbol SymArrow $$ } '\\' { TokSymbol SymLambda $$ } '@' { TokSymbol SymAs $$ } '|' { TokSymbol SymBar $$ } '(' { TokSymbol SymOpenParen $$ } ')' { TokSymbol SymCloseParen $$ } '{{' { TokSymbol SymDoubleOpenBrace $$ } '}}' { TokSymbol SymDoubleCloseBrace $$ } '{' { TokSymbol SymOpenBrace $$ } '}' { TokSymbol SymCloseBrace $$ } -- ':{' { TokSymbol SymColonBrace $$ } vopen { TokSymbol SymOpenVirtualBrace $$ } vclose { TokSymbol SymCloseVirtualBrace $$ } vsemi { TokSymbol SymVirtualSemi $$ } '{-#' { TokSymbol SymOpenPragma $$ } '#-}' { TokSymbol SymClosePragma $$ } id { TokId $$ } q_id { TokQId $$ } string { TokString $$ } literal { TokLiteral $$ } %% {-------------------------------------------------------------------------- Parsing the token stream. Used by the TeX compiler. --------------------------------------------------------------------------} -- Parse a list of tokens. Tokens :: { [Token] } Tokens : TokensR { reverse $1 } -- Happy is much better at parsing left recursive grammars (constant -- stack size vs. linear stack size for right recursive). TokensR :: { [Token] } TokensR : TokensR Token { $2 : $1 } | { [] } -- Parse single token. Token :: { Token } Token : 'abstract' { TokKeyword KwAbstract $1 } | 'codata' { TokKeyword KwCoData $1 } | 'coinductive' { TokKeyword KwCoInductive $1 } | 'constructor' { TokKeyword KwConstructor $1 } | 'data' { TokKeyword KwData $1 } | 'field' { TokKeyword KwField $1 } | 'forall' { TokKeyword KwForall $1 } | 'hiding' { TokKeyword KwHiding $1 } | 'import' { TokKeyword KwImport $1 } | 'in' { TokKeyword KwIn $1 } | 'inductive' { TokKeyword KwInductive $1 } | 'infix' { TokKeyword KwInfix $1 } | 'infixl' { TokKeyword KwInfixL $1 } | 'infixr' { TokKeyword KwInfixR $1 } | 'instance' { TokKeyword KwInstance $1 } | 'let' { TokKeyword KwLet $1 } | 'module' { TokKeyword KwModule $1 } | 'mutual' { TokKeyword KwMutual $1 } | 'open' { TokKeyword KwOpen $1 } | 'pattern' { TokKeyword KwPatternSyn $1 } | 'postulate' { TokKeyword KwPostulate $1 } | 'primitive' { TokKeyword KwPrimitive $1 } | 'private' { TokKeyword KwPrivate $1 } | 'Prop' { TokKeyword KwProp $1 } | 'public' { TokKeyword KwPublic $1 } | 'quote' { TokKeyword KwQuote $1 } | 'quoteContext' { TokKeyword KwQuoteContext $1 } | 'quoteGoal' { TokKeyword KwQuoteGoal $1 } | 'quoteTerm' { TokKeyword KwQuoteTerm $1 } | 'record' { TokKeyword KwRecord $1 } | 'renaming' { TokKeyword KwRenaming $1 } | 'rewrite' { TokKeyword KwRewrite $1 } | 'Set' { TokKeyword KwSet $1 } | 'syntax' { TokKeyword KwSyntax $1 } | 'tactic' { TokKeyword KwTactic $1 } | 'to' { TokKeyword KwTo $1 } | 'unquote' { TokKeyword KwUnquote $1 } | 'unquoteDecl' { TokKeyword KwUnquoteDecl $1 } | 'using' { TokKeyword KwUsing $1 } | 'where' { TokKeyword KwWhere $1 } | 'with' { TokKeyword KwWith $1 } | 'BUILTIN' { TokKeyword KwBUILTIN $1 } | 'COMPILED' { TokKeyword KwCOMPILED $1 } | 'COMPILED_DATA' { TokKeyword KwCOMPILED_DATA $1 } | 'COMPILED_EPIC' { TokKeyword KwCOMPILED_EPIC $1 } | 'COMPILED_EXPORT' { TokKeyword KwCOMPILED_EXPORT $1 } | 'COMPILED_JS' { TokKeyword KwCOMPILED_JS $1 } | 'COMPILED_TYPE' { TokKeyword KwCOMPILED_TYPE $1 } | 'ETA' { TokKeyword KwETA $1 } | 'IMPORT' { TokKeyword KwIMPORT $1 } | 'IMPOSSIBLE' { TokKeyword KwIMPOSSIBLE $1 } | 'MEASURE' { TokKeyword KwMEASURE $1 } | 'NO_TERMINATION_CHECK' { TokKeyword KwNO_TERMINATION_CHECK $1 } | 'NON_TERMINATING' { TokKeyword KwNON_TERMINATING $1 } | 'OPTIONS' { TokKeyword KwOPTIONS $1 } | 'REWRITE' { TokKeyword KwREWRITE $1 } | 'STATIC' { TokKeyword KwSTATIC $1 } | 'TERMINATING' { TokKeyword KwTERMINATING $1 } | setN { TokSetN $1 } | tex { TokTeX $1 } | comment { TokComment $1 } | '...' { TokSymbol SymEllipsis $1 } | '..' { TokSymbol SymDotDot $1 } | '.' { TokSymbol SymDot $1 } | ';' { TokSymbol SymSemi $1 } | ':' { TokSymbol SymColon $1 } | '=' { TokSymbol SymEqual $1 } | '_' { TokSymbol SymUnderscore $1 } | '?' { TokSymbol SymQuestionMark $1 } | '->' { TokSymbol SymArrow $1 } | '\\' { TokSymbol SymLambda $1 } | '@' { TokSymbol SymAs $1 } | '|' { TokSymbol SymBar $1 } | '(' { TokSymbol SymOpenParen $1 } | ')' { TokSymbol SymCloseParen $1 } | '{{' { TokSymbol SymDoubleOpenBrace $1 } | '}}' { TokSymbol SymDoubleCloseBrace $1 } | '{' { TokSymbol SymOpenBrace $1 } | '}' { TokSymbol SymCloseBrace $1 } | vopen { TokSymbol SymOpenVirtualBrace $1 } | vclose { TokSymbol SymCloseVirtualBrace $1 } | vsemi { TokSymbol SymVirtualSemi $1 } | '{-#' { TokSymbol SymOpenPragma $1 } | '#-}' { TokSymbol SymClosePragma $1 } | id { TokId $1 } | q_id { TokQId $1 } | string { TokString $1 } | literal { TokLiteral $1 } {-------------------------------------------------------------------------- Top level --------------------------------------------------------------------------} File :: { ([Pragma], [Declaration]) } File : vopen TopLevel maybe_vclose { takeOptionsPragmas $2 } maybe_vclose : {- empty -} { () } | vclose { () } {-------------------------------------------------------------------------- Meta rules --------------------------------------------------------------------------} -- The first token in a file decides the indentation of the top-level layout -- block. Or not. It will if we allow the top-level module to be omitted. -- topen : {- empty -} {% pushCurrentContext } {- A layout block might have to be closed by a parse error. Example: let x = e in e' Here the 'let' starts a layout block which should end before the 'in'. The problem is that the lexer doesn't know this, so there is no virtual close brace. However when the parser sees the 'in' there will be a parse error. This is our cue to close the layout block. -} close : vclose { () } | error {% popContext } -- You can use concrete semi colons in a layout block started with a virtual -- brace, so we don't have to distinguish between the two semi colons. You can't -- use a virtual semi colon in a block started by a concrete brace, but this is -- simply because the lexer will not generate virtual semis in this case. semi : ';' { $1 } | vsemi { $1 } -- Enter the 'imp_dir' lex state, where we can parse the keyword 'to'. beginImpDir :: { () } beginImpDir : {- empty -} {% pushLexState imp_dir } {-------------------------------------------------------------------------- Helper rules --------------------------------------------------------------------------} -- An integer. Used in fixity declarations. Int :: { Integer } Int : literal {% case $1 of { LitInt _ i -> return i; _ -> fail $ "Expected integer" } } | id {% case $1 of { (_, s) -> case readM s of { Right i -> return i; Left (err :: String) -> fail $ "Expected integer" } } } {-------------------------------------------------------------------------- Names --------------------------------------------------------------------------} -- A name is really a sequence of parts, but the lexer just sees it as a -- string, so we have to do the translation here. Id :: { Name } Id : id {% mkName $1 } -- Space separated list of one or more identifiers. SpaceIds :: { [Name] } SpaceIds : Id SpaceIds { $1 : $2 } | Id { [$1] } -- When looking for a double closed brace, we accept either a single token '}}' -- (which is what the unicode character "RIGHT WHITE CURLY BRACKET" is -- postprocessed into in LexActions.hs), but also two consecutive tokens '}' -- (which a string '}}' is lexed to). This small hack allows us to keep -- "record { a = record { }}" working. In the second case, we check that the two -- tokens '}' are immediately consecutive. DoubleCloseBrace :: { Range } DoubleCloseBrace : '}}' { getRange $1 } | '}' '}' {% if posPos (fromJust (rEnd (getRange $2))) - posPos (fromJust (rStart (getRange $1))) > 2 then parseErrorAt (fromJust (rStart (getRange $2))) "Expecting '}}', found separated '}'s." else return $ getRange ($1, $2) } -- A possibly dotted identifier. MaybeDottedId :: { Arg Name } MaybeDottedId : '.' Id { setRelevance Irrelevant $ defaultArg $2 } | Id { defaultArg $1 } -- Space separated list of one or more possibly dotted identifiers. MaybeDottedIds :: { [Arg Name] } MaybeDottedIds : MaybeDottedId MaybeDottedIds { $1 : $2 } | MaybeDottedId { [$1] } -- Space separated list of one or more identifiers, some of which may -- be surrounded by braces or dotted. ArgIds :: { [Arg Name] } ArgIds : MaybeDottedId ArgIds { $1 : $2 } | MaybeDottedId { [$1] } | '{{' MaybeDottedIds DoubleCloseBrace ArgIds { map makeInstance $2 ++ $4 } | '{{' MaybeDottedIds DoubleCloseBrace { map makeInstance $2 } | '{' MaybeDottedIds '}' ArgIds { map hide $2 ++ $4 } | '{' MaybeDottedIds '}' { map hide $2 } | '.' '{' SpaceIds '}' ArgIds { map (hide . setRelevance Irrelevant . defaultArg) $3 ++ $5 } | '.' '{' SpaceIds '}' { map (hide . setRelevance Irrelevant . defaultArg) $3 } | '.' '{{' SpaceIds DoubleCloseBrace ArgIds { map (makeInstance . setRelevance Irrelevant . defaultArg) $3 ++ $5 } | '.' '{{' SpaceIds DoubleCloseBrace { map (makeInstance . setRelevance Irrelevant . defaultArg) $3 } | '..' '{' SpaceIds '}' ArgIds { map (hide . setRelevance NonStrict . defaultArg) $3 ++ $5 } | '..' '{' SpaceIds '}' { map (hide . setRelevance NonStrict . defaultArg) $3 } | '..' '{{' SpaceIds DoubleCloseBrace ArgIds { map (makeInstance . setRelevance NonStrict . defaultArg) $3 ++ $5 } | '..' '{{' SpaceIds DoubleCloseBrace { map (makeInstance . setRelevance NonStrict . defaultArg) $3 } QId :: { QName } QId : q_id {% mkQName $1 } | Id { QName $1 } -- A module name is just a qualified name ModuleName :: { QName } ModuleName : QId { $1 } -- A binding variable. Can be '_' BId :: { Name } BId : Id { $1 } | '_' { Name (getRange $1) [Hole] } {- UNUSED -- A binding variable. Can be '_' MaybeDottedBId :: { (Relevance, Name) } MaybeDottedBId : BId { (Relevant , $1) } | '.' BId { (Irrelevant, $2) } | '..' BId { (NonStrict, $2) } -} -- Space separated list of binding identifiers. Used in fixity -- declarations infixl 100 + - SpaceBIds :: { [Name] } SpaceBIds : BId SpaceBIds { $1 : $2 } | BId { [$1] } {- DOES PRODUCE REDUCE/REDUCE CONFLICTS! -- Space-separated list of binding identifiers. Used in dependent -- function spaces: (x y z : Nat) -> ... -- (Used to be comma-separated; hence the name) -- QUESTION: Should this be replaced by SpaceBIds above? --CommaBIds :: { [(Relevance,Name)] } CommaBIds :: { [Name] } CommaBIds : CommaBIds BId { $1 ++ [$2] } -- SWITCHING DOES NOT HELP | BId { [$1] } -} -- Space-separated list of binding identifiers. Used in dependent -- function spaces: (x y z : Nat) -> ... -- (Used to be comma-separated; hence the name) -- QUESTION: Should this be replaced by SpaceBIds above? -- Andreas, 2011-04-07 the trick avoids reduce/reduce conflicts -- when parsing (x y z : A) -> B -- at point (x y it is not clear whether x y is an application or -- a variable list. We could be parsing (x y z) -> B -- with ((x y) z) being a type. CommaBIds :: { [Name] } CommaBIds : CommaBIdAndAbsurds { case $1 of Left ns -> ns Right _ -> fail $ "expected sequence of bound identifiers, not absurd pattern" } CommaBIdAndAbsurds :: { Either [Name] [Expr] } CommaBIdAndAbsurds : Application {% let getName :: Expr -> Maybe Name getName (Ident (QName x)) = Just x getName (Underscore r _) = Just (Name r [Hole]) getName _ = Nothing isAbsurd :: Expr -> Bool isAbsurd (Absurd _) = True isAbsurd (HiddenArg _ (Named _ e)) = isAbsurd e isAbsurd (InstanceArg _ (Named _ e)) = isAbsurd e isAbsurd (Paren _ expr) = isAbsurd expr isAbsurd (RawApp _ exprs) = any isAbsurd exprs isAbsurd _ = False in if any isAbsurd $1 then return $ Right $1 else case mapM getName $1 of Just good -> return $ Left good Nothing -> fail $ "expected sequence of bound identifiers" } -- Parse a sequence of identifiers, including hiding info. -- Does not include instance arguments. -- E.g. x {y z} _ {v} -- To be used in typed bindings, like (x {y z} _ {v} : Nat). BIdsWithHiding :: { [WithHiding Name] } BIdsWithHiding : Application {% let -- interpret an expression as name getName :: Expr -> Maybe Name getName (Ident (QName x)) = Just x getName (Underscore r _) = Just (Name r [Hole]) getName _ = Nothing getNames :: Expr -> Maybe [Name] getNames (RawApp _ es) = mapM getName es getNames e = singleton `fmap` getName e -- interpret an expression as name or list of hidden names getName1 :: Expr -> Maybe [WithHiding Name] getName1 (Ident (QName x)) = Just [WithHiding NotHidden x] getName1 (Underscore r _) = Just [WithHiding NotHidden $ Name r [Hole]] getName1 (HiddenArg _ (Named Nothing e)) = map (WithHiding Hidden) `fmap` getNames e getName1 _ = Nothing in case mapM getName1 $1 of Just good -> return $ concat good Nothing -> fail $ "expected sequence of possibly hidden bound identifiers" } -- Space separated list of strings in a pragma. PragmaStrings :: { [String] } PragmaStrings : {- empty -} { [] } | string PragmaStrings { snd $1 : $2 } PragmaString :: { String } PragmaString : string { snd $1 } PragmaName :: { Name } PragmaName : string {% mkName $1 } PragmaQName :: { QName } PragmaQName : string {% fmap QName (mkName $1) } {-------------------------------------------------------------------------- Expressions (terms and types) --------------------------------------------------------------------------} {- Expressions. You might expect lambdas and lets to appear in the first expression category (lowest precedence). The reason they don't is that we want to parse things like m >>= \x -> k x This will leads to a conflict in the following case m >>= \x -> k x >>= \y -> k' y At the second '>>=' we can either shift or reduce. We solve this problem using Happy's precedence directives. The rule 'Expr -> Expr1' (which is the rule you shouldn't use to reduce when seeing '>>=') is given LOWEST precedence. The terminals '->' and op (which is what you should shift) is given higher precedence. -} -- Top level: Function types. Expr :: { Expr } Expr : TeleArrow Expr { Pi $1 $2 } | Application3 '->' Expr { Fun (getRange ($1,$2,$3)) (RawApp (getRange $1) $1) $3 } | Expr1 '=' Expr { Equal (getRange ($1, $2, $3)) $1 $3 } | Expr1 %prec LOWEST { $1 } -- Level 1: Application Expr1 : WithExprs {% case $1 of { [e] -> return e ; e : es -> return $ WithApp (fuseRange e es) e es ; [] -> fail "impossible: empty with expressions" } } WithExprs :: { [Expr] } WithExprs : Application3 '|' WithExprs { RawApp (getRange $1) $1 : $3 } | Application { [RawApp (getRange $1) $1] } Application :: { [Expr] } Application : Expr2 { [$1] } | Expr3 Application { $1 : $2 } -- Level 2: Lambdas and lets Expr2 : '\\' LamBindings Expr { Lam (getRange ($1,$2,$3)) $2 $3 } | ExtendedOrAbsurdLam { $1 } | 'forall' ForallBindings Expr { forallPi $2 $3 } | 'let' Declarations 'in' Expr { Let (getRange ($1,$2,$3,$4)) $2 $4 } | Expr3 { $1 } | 'quoteGoal' Id 'in' Expr { QuoteGoal (getRange ($1,$2,$3,$4)) $2 $4 } | 'quoteContext' Id 'in' Expr { QuoteContext (getRange ($1,$2,$3,$4)) $2 $4 } | 'tactic' Application3 { Tactic (getRange ($1, $2)) (RawApp (getRange $2) $2) [] } | 'tactic' Application3 '|' WithExprs { Tactic (getRange ($1, $2, $3, $4)) (RawApp (getRange $2) $2) $4 } ExtendedOrAbsurdLam :: { Expr } ExtendedOrAbsurdLam : '\\' '{' LamClauses '}' { ExtendedLam (getRange ($1,$2,$3,$4)) (reverse $3) } | '\\' AbsurdLamBindings {% case $2 of Left (bs, h) -> if null bs then return $ AbsurdLam r h else return $ Lam r bs (AbsurdLam r h) where r = fuseRange $1 bs Right es -> do -- it is of the form @\ { p1 ... () }@ p <- exprToLHS (RawApp (getRange es) es); return $ ExtendedLam (fuseRange $1 es) [(p [] [], AbsurdRHS, NoWhere)] } Application3 :: { [Expr] } Application3 : Expr3 { [$1] } | Expr3 Application3 { $1 : $2 } -- Level 3: Atoms Expr3Curly : '{' Expr '}' { HiddenArg (getRange ($1,$2,$3)) (maybeNamed $2) } | '{' '}' { let r = fuseRange $1 $2 in HiddenArg r $ unnamed $ Absurd r } Expr3NoCurly : QId { Ident $1 } | literal { Lit $1 } | '?' { QuestionMark (getRange $1) Nothing } | '_' { Underscore (getRange $1) Nothing } | 'Prop' { Prop (getRange $1) } | 'Set' { Set (getRange $1) } | 'quote' { Quote (getRange $1) } | 'quoteTerm' { QuoteTerm (getRange $1) } | 'unquote' { Unquote (getRange $1) } | setN { SetN (getRange (fst $1)) (snd $1) } | '{{' Expr DoubleCloseBrace { InstanceArg (getRange ($1,$2,$3)) (maybeNamed $2) } | '(' Expr ')' { Paren (getRange ($1,$2,$3)) $2 } | '(' ')' { Absurd (fuseRange $1 $2) } | '{{' DoubleCloseBrace { let r = fuseRange $1 $2 in InstanceArg r $ unnamed $ Absurd r } | Id '@' Expr3 { As (getRange ($1,$2,$3)) $1 $3 } | '.' Expr3 { Dot (fuseRange $1 $2) $2 } | 'record' '{' FieldAssignments '}' { Rec (getRange ($1,$2,$3,$4)) $3 } | 'record' Expr3NoCurly '{' FieldAssignments '}' { RecUpdate (getRange ($1,$2,$3,$4,$5)) $2 $4 } Expr3 : Expr3Curly { $1 } | Expr3NoCurly { $1 } FieldAssignments :: { [(Name, Expr)] } FieldAssignments : {- empty -} { [] } | FieldAssignments1 { $1 } FieldAssignments1 :: { [(Name, Expr)] } FieldAssignments1 : FieldAssignment { [$1] } | FieldAssignment ';' FieldAssignments1 { $1 : $3 } FieldAssignment :: { (Name, Expr) } FieldAssignment : Id '=' Expr { ($1, $3) } {-------------------------------------------------------------------------- Bindings --------------------------------------------------------------------------} -- "Delta ->" to avoid conflict between Delta -> Gamma and Delta -> A. TeleArrow : Telescope1 '->' { $1 } Telescope1 : TypedBindingss { {-TeleBind-} $1 } TypedBindingss :: { [TypedBindings] } TypedBindingss : TypedBindings TypedBindingss { $1 : $2 } | TypedBindings { [$1] } -- A typed binding is either (x1 .. xn : A) or {y1 .. ym : B} -- Andreas, 2011-04-07: or .(x1 .. xn : A) or .{y1 .. ym : B} -- Andreas, 2011-04-27: or ..(x1 .. xn : A) or ..{y1 .. ym : B} TypedBindings :: { TypedBindings } TypedBindings : '.' '(' TBindWithHiding ')' { setRange (getRange ($2,$3,$4)) $ setRelevance Irrelevant $3 } | '.' '{' TBind '}' { setRange (getRange ($2,$3,$4)) $ setHiding Hidden $ setRelevance Irrelevant $3 } | '.' '{{' TBind DoubleCloseBrace { setRange (getRange ($2,$3,$4)) $ setHiding Instance $ setRelevance Irrelevant $3 } | '..' '(' TBindWithHiding ')' { setRange (getRange ($2,$3,$4)) $ setRelevance NonStrict $3 } | '..' '{' TBind '}' { setRange (getRange ($2,$3,$4)) $ setHiding Hidden $ setRelevance NonStrict $3 } | '..' '{{' TBind DoubleCloseBrace { setRange (getRange ($2,$3,$4)) $ setHiding Instance $ setRelevance NonStrict $3 } | '(' TBindWithHiding ')' { setRange (getRange ($1,$2,$3)) $2 } | '{{' TBind DoubleCloseBrace { setRange (getRange ($1,$2,$3)) $ setHiding Instance $2 } | '{' TBind '}' { setRange (getRange ($1,$2,$3)) $ setHiding Hidden $2 } | '(' Open ')' { tLet (getRange ($1,$3)) $2 } | '(' 'let' Declarations ')' { tLet (getRange ($1,$4)) $3 } -- x1 .. xn : A -- x1 .. xn :{i1 i2 ..} A TBind :: { TypedBindings } TBind : CommaBIds ':' Expr { let r = getRange ($1,$2,$3) -- the range is approximate only for TypedBindings in TypedBindings r $ defaultArg $ TBind r (map (pure . mkBoundName_) $1) $3 } -- | Colors are not yet allowed in the syntax. -- | CommaBIds ':{' Colors '}' Expr { ( $3, TBind (getRange ($1,$2,$3,$4,$5)) (map mkBoundName_ $1) $5 ) } {- Colors :: { [Color] } Colors : QId Colors { Ident $1 : $2 } | QId { [Ident $1] } -} -- x {y z} _ {v} : A TBindWithHiding :: { TypedBindings } TBindWithHiding : BIdsWithHiding ':' Expr { let r = getRange ($1,$2,$3) -- the range is approximate only for TypedBindings in TypedBindings r $ defaultArg $ TBind r (map (fmap mkBoundName_) $1) $3 } -- A non-empty sequence of lambda bindings. LamBindings :: { [LamBinding] } LamBindings : LamBinds '->' {% case reverse $1 of Left _ : _ -> parseError "Absurd lambda cannot have a body." _ : _ -> return [ b | Right b <- $1 ] [] -> parsePanic "Empty LamBinds" } AbsurdLamBindings :: { Either ([LamBinding], Hiding) [Expr] } AbsurdLamBindings : LamBindsAbsurd {% case $1 of Left lb -> case reverse lb of Right _ : _ -> parseError "Missing body for lambda" Left h : _ -> return $ Left ([ b | Right b <- init lb], h) _ -> parseError "Unsupported variant of lambda" Right es -> return $ Right es } -- absurd lambda is represented by @Left hiding@ LamBinds :: { [Either Hiding LamBinding] } LamBinds : DomainFreeBinding LamBinds { map Right $1 ++ $2 } | TypedBindings LamBinds { Right (DomainFull $1) : $2 } | DomainFreeBinding { map Right $1 } | TypedBindings { [Right $ DomainFull $1] } | '(' ')' { [Left NotHidden] } | '{' '}' { [Left Hidden] } | '{{' DoubleCloseBrace { [Left Instance] } -- Like LamBinds, but could also parse an absurd LHS of an extended lambda @{ p1 ... () }@ LamBindsAbsurd :: { Either [Either Hiding LamBinding] [Expr] } LamBindsAbsurd : DomainFreeBinding LamBinds { Left $ map Right $1 ++ $2 } | TypedBindings LamBinds { Left $ Right (DomainFull $1) : $2 } | DomainFreeBindingAbsurd { case $1 of Left lb -> Left $ map Right lb Right es -> Right es } | TypedBindings { Left [Right $ DomainFull $1] } | '(' ')' { Left [Left NotHidden] } | '{' '}' { Left [Left Hidden] } | '{{' DoubleCloseBrace { Left [Left Instance] } -- FNF, 2011-05-05: No where clauses in extended lambdas for now NonAbsurdLamClause :: { (LHS,RHS,WhereClause) } NonAbsurdLamClause : Application3 '->' Expr {% do p <- exprToLHS (RawApp (getRange $1) $1) ; return (p [] [], RHS $3, NoWhere) } AbsurdLamClause :: { (LHS,RHS,WhereClause) } AbsurdLamClause -- FNF, 2011-05-09: By being more liberal here, we avoid shift/reduce and reduce/reduce errors. -- Later stages such as scope checking will complain if we let something through which we should not : Application {% do p <- exprToLHS (RawApp (getRange $1) $1); return (p [] [], AbsurdRHS, NoWhere) } LamClause :: { (LHS,RHS,WhereClause) } LamClause : NonAbsurdLamClause { $1 } | AbsurdLamClause { $1 } -- Parses all extended lambda clauses except for a single absurd clause, which is taken care of -- in AbsurdLambda LamClauses :: { [(LHS,RHS,WhereClause)] } LamClauses : LamClauses semi LamClause { $3 : $1 } | AbsurdLamClause semi LamClause { [$3, $1] } | NonAbsurdLamClause { [$1] } -- | {- empty -} { [] } ForallBindings :: { [LamBinding] } ForallBindings : TypedUntypedBindings1 '->' { $1 } -- A non-empty sequence of possibly untyped bindings. TypedUntypedBindings1 :: { [LamBinding] } TypedUntypedBindings1 : DomainFreeBinding TypedUntypedBindings1 { $1 ++ $2 } | TypedBindings TypedUntypedBindings1 { DomainFull $1 : $2 } | DomainFreeBinding { $1 } | TypedBindings { [DomainFull $1] } -- A possibly empty sequence of possibly untyped bindings. -- This is used as telescope in data and record decls. TypedUntypedBindings :: { [LamBinding] } TypedUntypedBindings : DomainFreeBinding TypedUntypedBindings { $1 ++ $2 } | TypedBindings TypedUntypedBindings { DomainFull $1 : $2 } | { [] } -- A domain free binding is either x or {x1 .. xn} DomainFreeBinding :: { [LamBinding] } DomainFreeBinding : DomainFreeBindingAbsurd { case $1 of Left lbs -> lbs Right _ -> fail "expected sequence of bound identifiers, not absurd pattern" } {- : BId { [DomainFree NotHidden Relevant $ mkBoundName_ $1] } | '.' BId { [DomainFree NotHidden Irrelevant $ mkBoundName_ $2] } | '..' BId { [DomainFree NotHidden NonStrict $ mkBoundName_ $2] } | '{' CommaBIds '}' { map (DomainFree Hidden Relevant . mkBoundName_) $2 } | '{{' CommaBIds DoubleCloseBrace { map (DomainFree (setHiding Instance defaultArgInfo) . mkBoundName_) $2 } | '.' '{' CommaBIds '}' { map (DomainFree Hidden Irrelevant . mkBoundName_) $3 } | '.' '{{' CommaBIds DoubleCloseBrace { map (DomainFree Instance Irrelevant . mkBoundName_) $3 } | '..' '{' CommaBIds '}' { map (DomainFree Hidden NonStrict . mkBoundName_) $3 } | '..' '{{' CommaBIds DoubleCloseBrace { map (DomainFree Instance NonStrict . mkBoundName_) $3 } | '..' '{{' CommaBIds DoubleCloseBrace { map (DomainFree Instance NonStrict . mkBoundName_) $3 } -} -- A domain free binding is either x or {x1 .. xn} DomainFreeBindingAbsurd :: { Either [LamBinding] [Expr]} DomainFreeBindingAbsurd : BId { Left [DomainFree defaultArgInfo $ mkBoundName_ $1] } | '.' BId { Left [DomainFree (setRelevance Irrelevant $ defaultArgInfo) $ mkBoundName_ $2] } | '..' BId { Left [DomainFree (setRelevance NonStrict $ defaultArgInfo) $ mkBoundName_ $2] } | '{' CommaBIdAndAbsurds '}' { either (Left . map (DomainFree (setHiding Hidden $ defaultArgInfo) . mkBoundName_)) Right $2 } | '{{' CommaBIds DoubleCloseBrace { Left $ map (DomainFree (setHiding Instance $ defaultArgInfo) . mkBoundName_) $2 } | '.' '{' CommaBIds '}' { Left $ map (DomainFree (setHiding Hidden $ setRelevance Irrelevant $ defaultArgInfo) . mkBoundName_) $3 } | '.' '{{' CommaBIds DoubleCloseBrace { Left $ map (DomainFree (setHiding Instance $ setRelevance Irrelevant $ defaultArgInfo) . mkBoundName_) $3 } | '..' '{' CommaBIds '}' { Left $ map (DomainFree (setHiding Hidden $ setRelevance NonStrict $ defaultArgInfo) . mkBoundName_) $3 } | '..' '{{' CommaBIds DoubleCloseBrace { Left $ map (DomainFree (setHiding Instance $ setRelevance NonStrict $ defaultArgInfo) . mkBoundName_) $3 } {-------------------------------------------------------------------------- Modules and imports --------------------------------------------------------------------------} -- Import directives ImportDirective :: { ImportDirective } ImportDirective : ImportDirectives {% mergeImportDirectives $1 } ImportDirectives :: { [ImportDirective] } ImportDirectives : ImportDirective1 ImportDirectives { $1 : $2 } | {- empty -} { [] } ImportDirective1 :: { ImportDirective } : 'public' { defaultImportDir { importDirRange = getRange $1, publicOpen = True } } | UsingOrHiding { defaultImportDir { importDirRange = snd $1, usingOrHiding = fst $1 } } | RenamingDir { defaultImportDir { importDirRange = snd $1, renaming = fst $1 } } UsingOrHiding :: { (UsingOrHiding , Range) } UsingOrHiding : 'using' '(' CommaImportNames ')' { (Using $3 , getRange ($1,$2,$3,$4)) } -- using can have an empty list | 'hiding' '(' CommaImportNames ')' { (Hiding $3 , getRange ($1,$2,$3,$4)) } -- if you want to hide nothing that's fine, isn't it? RenamingDir :: { ([Renaming] , Range) } RenamingDir : 'renaming' '(' Renamings ')' { ($3 , getRange ($1,$2,$3,$4)) } | 'renaming' '(' ')' { ([] , getRange ($1,$2,$3)) } -- Renamings of the form 'x to y' Renamings :: { [Renaming] } Renamings : Renaming ';' Renamings { $1 : $3 } | Renaming { [$1] } Renaming :: { Renaming } Renaming : ImportName_ 'to' Id { Renaming $1 $3 (getRange $2) } -- We need a special imported name here, since we have to trigger -- the imp_dir state exactly one token before the 'to' ImportName_ :: { ImportedName } ImportName_ : beginImpDir Id { ImportedName $2 } | 'module' beginImpDir Id { ImportedModule $3 } ImportName :: { ImportedName } ImportName : Id { ImportedName $1 } | 'module' Id { ImportedModule $2 } -- Actually semi-colon separated CommaImportNames :: { [ImportedName] } CommaImportNames : {- empty -} { [] } | CommaImportNames1 { $1 } CommaImportNames1 : ImportName { [$1] } | ImportName ';' CommaImportNames1 { $1 : $3 } {-------------------------------------------------------------------------- Function clauses --------------------------------------------------------------------------} -- A left hand side of a function clause. We parse it as an expression, and -- then check that it is a valid left hand side. LHS :: { LHS } LHS : Expr1 RewriteEquations WithExpressions {% exprToLHS $1 >>= \p -> return (p $2 $3) } | '...' WithPats RewriteEquations WithExpressions { Ellipsis (getRange ($1,$2,$3,$4)) $2 $3 $4 } WithPats :: { [Pattern] } WithPats : {- empty -} { [] } | '|' Application3 WithPats {% exprToPattern (RawApp (getRange $2) $2) >>= \p -> return (p : $3) } WithExpressions :: { [Expr] } WithExpressions : {- empty -} { [] } | 'with' Expr { case $2 of { WithApp _ e es -> e : es; e -> [e] } } RewriteEquations :: { [Expr] } RewriteEquations : {- empty -} { [] } | 'rewrite' Expr1 { case $2 of { WithApp _ e es -> e : es; e -> [e] } } -- Where clauses are optional. WhereClause :: { WhereClause } WhereClause : {- empty -} { NoWhere } | 'where' Declarations0 { AnyWhere $2 } | 'module' Id 'where' Declarations0 { SomeWhere $2 $4 } | 'module' Underscore 'where' Declarations0 { SomeWhere $2 $4 } {-------------------------------------------------------------------------- Different kinds of declarations --------------------------------------------------------------------------} -- Top-level definitions. Declaration :: { [Declaration] } Declaration : Fields { $1 } | FunClause { $1 } | Data { [$1] } | DataSig { [$1] } -- lone data type signature in mutual block | Record { [$1] } | RecordSig { [$1] } -- lone record signature in mutual block | Infix { [$1] } | Mutual { [$1] } | Abstract { [$1] } | Private { [$1] } | Instance { [$1] } | Postulate { [$1] } | Primitive { [$1] } | Open { $1 } -- | Import { [$1] } | ModuleMacro { [$1] } | Module { [$1] } | Pragma { [$1] } | Syntax { [$1] } | PatternSyn { [$1] } | UnquoteDecl { [$1] } {-------------------------------------------------------------------------- Individual declarations --------------------------------------------------------------------------} -- Type signatures of the form "n1 n2 n3 ... : Type", with at least -- one bound name. TypeSigs :: { [Declaration] } TypeSigs : SpaceIds ':' Expr { map (\ x -> TypeSig defaultArgInfo x $3) $1 } -- A variant of TypeSigs where any sub-sequence of names can be marked -- as hidden or irrelevant using braces and dots: -- {n1 .n2} n3 .n4 {n5} .{n6 n7} ... : Type. ArgTypeSigs :: { [Arg Declaration] } ArgTypeSigs : ArgIds ':' Expr { map (fmap (\ x -> TypeSig defaultArgInfo x $3)) $1 } -- Function declarations. The left hand side is parsed as an expression to allow -- declarations like 'x::xs ++ ys = e', when '::' has higher precedence than '++'. -- FunClause also handle possibly dotted type signatures. FunClause :: { [Declaration] } FunClause : LHS RHS WhereClause {% funClauseOrTypeSigs $1 $2 $3 } RHS :: { RHSOrTypeSigs } RHS : '=' Expr { JustRHS (RHS $2) } | ':' Expr { TypeSigsRHS $2 } | {- empty -} { JustRHS AbsurdRHS } -- Data declaration. Can be local. Data :: { Declaration } Data : 'data' Id TypedUntypedBindings ':' Expr 'where' Constructors { Data (getRange ($1,$2,$3,$4,$5,$6,$7)) Inductive $2 $3 (Just $5) $7 } | 'codata' Id TypedUntypedBindings ':' Expr 'where' Constructors { Data (getRange ($1,$2,$3,$4,$5,$6,$7)) CoInductive $2 $3 (Just $5) $7 } -- New cases when we already had a DataSig. Then one can omit the sort. | 'data' Id TypedUntypedBindings 'where' Constructors { Data (getRange ($1,$2,$3,$4,$5)) Inductive $2 $3 Nothing $5 } | 'codata' Id TypedUntypedBindings 'where' Constructors { Data (getRange ($1,$2,$3,$4,$5)) CoInductive $2 $3 Nothing $5 } -- Data type signature. Found in mutual blocks. DataSig :: { Declaration } DataSig : 'data' Id TypedUntypedBindings ':' Expr { DataSig (getRange ($1,$2,$3,$4,$5)) Inductive $2 $3 $5 } -- Andreas, 2012-03-16: The Expr3NoCurly instead of Id in everything -- following 'record' is to remove the (harmless) shift/reduce conflict -- introduced by record update expressions. -- Record declarations. Record :: { Declaration } Record : 'record' Expr3NoCurly TypedUntypedBindings ':' Expr 'where' RecordDeclarations {% exprToName $2 >>= \ n -> return $ Record (getRange ($1,$2,$3,$4,$5,$6,$7)) n (fst3 $7) (snd3 $7) $3 (Just $5) (thd3 $7) } | 'record' Expr3NoCurly TypedUntypedBindings 'where' RecordDeclarations {% exprToName $2 >>= \ n -> return $ Record (getRange ($1,$2,$3,$4,$5)) n (fst3 $5) (snd3 $5) $3 Nothing (thd3 $5) } -- Record type signature. In mutual blocks. RecordSig :: { Declaration } RecordSig : 'record' Expr3NoCurly TypedUntypedBindings ':' Expr {% exprToName $2 >>= \ n -> return $ RecordSig (getRange ($1,$2,$3,$4,$5)) n $3 $5 } -- Declaration of record constructor name. RecordConstructorName :: { Name } RecordConstructorName : 'constructor' Id { $2 } -- Fixity declarations. Infix :: { Declaration } Infix : 'infix' Int SpaceBIds { Infix (Fixity (getRange ($1,$3)) $2 NonAssoc) $3 } | 'infixl' Int SpaceBIds { Infix (Fixity (getRange ($1,$3)) $2 LeftAssoc) $3 } | 'infixr' Int SpaceBIds { Infix (Fixity (getRange ($1,$3)) $2 RightAssoc) $3 } -- Field declarations. Fields :: { [Declaration] } Fields : 'field' ArgTypeSignatures { let toField (Common.Arg info (TypeSig _ x t)) = Field x (Common.Arg info t) in map toField $2 } --REM { let toField (h, TypeSig x t) = Field h x t in map toField $2 } -- Mutually recursive declarations. Mutual :: { Declaration } Mutual : 'mutual' Declarations { Mutual (fuseRange $1 $2) $2 } -- Abstract declarations. Abstract :: { Declaration } Abstract : 'abstract' Declarations { Abstract (fuseRange $1 $2) $2 } -- Private can only appear on the top-level (or rather the module level). Private :: { Declaration } Private : 'private' Declarations { Private (fuseRange $1 $2) $2 } -- Instance declarations. Instance :: { Declaration } Instance : 'instance' Declarations { InstanceB (fuseRange $1 $2) $2 } -- Postulates. Postulate :: { Declaration } Postulate : 'postulate' Declarations { Postulate (fuseRange $1 $2) $2 } -- Primitives. Can only contain type signatures. Primitive :: { Declaration } Primitive : 'primitive' TypeSignatures { Primitive (fuseRange $1 $2) $2 } -- Unquoting declarations. UnquoteDecl :: { Declaration } UnquoteDecl : 'unquoteDecl' Id '=' Expr { UnquoteDecl (fuseRange $1 $4) $2 $4 } -- Syntax declaration (To declare eg. mixfix binders) Syntax :: { Declaration } Syntax : 'syntax' Id HoleNames '=' SimpleIds {% case $2 of Name _ [_] -> case mkNotation $3 (map rangedThing $5) of Left err -> parseError $ "Malformed syntax declaration: " ++ err Right n -> return $ Syntax $2 n _ -> parseError "Syntax declarations are allowed only for simple names (without holes)" } -- Pattern synonyms. PatternSyn :: { Declaration } PatternSyn : 'pattern' Id PatternSynArgs '=' Expr {% do p <- exprToPattern $5 return (PatternSyn (getRange ($1,$2,$3,$4,$5)) $2 $3 p) } PatternSynArgs :: { [Arg Name] } PatternSynArgs : {- empty -} { [] } | LamBinds {% patternSynArgs $1 } SimpleIds :: { [RString] } SimpleIds : SimpleId { [$1] } | SimpleIds SimpleId {$1 ++ [$2]} HoleNames :: { [NamedArg HoleName] } HoleNames : HoleName { [$1] } | HoleNames HoleName {$1 ++ [$2]} HoleName :: { NamedArg HoleName } HoleName : SimpleTopHole { defaultNamedArg $1 } | '{' SimpleHole '}' { setHiding Hidden $ defaultNamedArg $2 } | '{{' SimpleHole '}}' { setHiding Instance $ defaultNamedArg $2 } | '{' SimpleId '=' SimpleHole '}' { setHiding Hidden $ defaultArg $ named $2 $4 } | '{{' SimpleId '=' SimpleHole '}}' { setHiding Instance $ defaultArg $ named $2 $4 } SimpleTopHole :: { HoleName } SimpleTopHole : SimpleId { ExprHole (rangedThing $1) } | '(' '\\' SimpleId '->' SimpleId ')' { LambdaHole (rangedThing $3) (rangedThing $5) } SimpleHole :: { HoleName } SimpleHole : SimpleId { ExprHole (rangedThing $1) } | '\\' SimpleId '->' SimpleId { LambdaHole (rangedThing $2) (rangedThing $4) } -- Variable name hole to be implemented later. -- Discard the interval. SimpleId :: { RString } SimpleId : id { Ranged (getRange $ fst $1) (stringToRawName $ snd $1) } MaybeOpen :: { Maybe Range } MaybeOpen : 'open' { Just (getRange $1) } | {- empty -} { Nothing } -- Open Open :: { [Declaration] } Open : MaybeOpen 'import' ModuleName OpenArgs ImportDirective {% let { doOpen = maybe DontOpen (const DoOpen) $1 ; m = $3 ; es = $4 ; dir = $5 ; r = getRange (m, es, dir) ; mr = getRange m ; unique = hashString $ show $ (Nothing :: Maybe ()) <$ r -- turn range into unique id, but delete file path -- which is absolute and messes up suite of failing tests -- (different hashs on different installations) -- TODO: Don't use (insecure) hashes in this way. ; fresh = Name mr [ Id $ stringToRawName $ ".#" ++ show m ++ "-" ++ show unique ] ; impStm asR = Import mr m (Just (AsName fresh asR)) DontOpen defaultImportDir ; appStm m' es = let r = getRange (m, es) in Private r [ ModuleMacro r m' (SectionApp (getRange es) [] (RawApp (getRange es) (Ident (QName fresh) : es))) doOpen dir ] ; (initArgs, last2Args) = splitAt (length es - 2) es ; parseAsClause = case last2Args of { [ Ident (QName (Name asR [Id x])) , Ident (QName m') ] | rawNameToString x == "as" -> Just (asR, m') ; _ -> Nothing } } in case es of { [] -> return [Import mr m Nothing doOpen dir] ; _ | Just (asR, m') <- parseAsClause -> if null initArgs then return [ Import (getRange (m, asR, m', dir)) m (Just (AsName m' asR)) doOpen dir ] else return [ impStm asR, appStm m' initArgs ] | DontOpen <- doOpen -> parseErrorAt (fromJust $ rStart $ getRange $2) "An import statement with module instantiation does not actually import the module. This statement achieves nothing. Either add the `open' keyword or bind the instantiated module with an `as' clause." | otherwise -> return [ impStm noRange , appStm (noName $ beginningOf $ getRange m) es ] } } |'open' ModuleName OpenArgs ImportDirective { let { m = $2 ; es = $3 ; dir = $4 ; r = getRange (m, es, dir) } in [ case es of { [] -> Open r m dir ; _ -> Private r [ ModuleMacro r (noName $ beginningOf $ getRange m) (SectionApp (getRange (m , es)) [] (RawApp (fuseRange m es) (Ident m : es))) DoOpen dir ] } ] } | 'open' ModuleName '{{' '...' DoubleCloseBrace ImportDirective { let r = getRange $2 in [ Private r [ ModuleMacro r (noName $ beginningOf $ getRange $2) (RecordModuleIFS r $2) DoOpen $6 ] ] } OpenArgs :: { [Expr] } OpenArgs : {- empty -} { [] } | Expr3 OpenArgs { $1 : $2 } ModuleApplication :: { [TypedBindings] -> Parser ModuleApplication } ModuleApplication : ModuleName '{{' '...' DoubleCloseBrace { (\ts -> if null ts then return $ RecordModuleIFS (getRange ($1,$2,$3,$4)) $1 else parseError "No bindings allowed for record module with non-canonical implicits" ) } | ModuleName OpenArgs { (\ts -> return $ SectionApp (getRange ($1, $2)) ts (RawApp (fuseRange $1 $2) (Ident $1 : $2)) ) } -- Module instantiation ModuleMacro :: { Declaration } ModuleMacro : 'module' ModuleName TypedUntypedBindings '=' ModuleApplication ImportDirective {% do { ma <- $5 (map addType $3) ; name <- ensureUnqual $2 ; return $ ModuleMacro (getRange ($1, $2, ma, $6)) name ma DontOpen $6 } } | 'open' 'module' Id TypedUntypedBindings '=' ModuleApplication ImportDirective {% do {ma <- $6 (map addType $4); return $ ModuleMacro (getRange ($1, $2, $3, ma, $7)) $3 ma DoOpen $7 } } -- Module Module :: { Declaration } Module : 'module' ModuleName TypedUntypedBindings 'where' Declarations0 { Module (getRange ($1,$2,$3,$4,$5)) $2 (map addType $3) $5 } | 'module' Underscore TypedUntypedBindings 'where' Declarations0 { Module (getRange ($1,$2,$3,$4,$5)) (QName $2) (map addType $3) $5 } Underscore :: { Name } Underscore : '_' { noName (getRange $1) } TopLevel :: { [Declaration] } TopLevel : TopDeclarations { figureOutTopLevelModule $1 } Pragma :: { Declaration } Pragma : DeclarationPragma { Pragma $1 } DeclarationPragma :: { Pragma } DeclarationPragma : BuiltinPragma { $1 } | RewritePragma { $1 } | CompiledPragma { $1 } | CompiledExportPragma { $1 } | CompiledDataPragma { $1 } | CompiledTypePragma { $1 } | CompiledEpicPragma { $1 } | CompiledJSPragma { $1 } | StaticPragma { $1 } | ImportPragma { $1 } | ImpossiblePragma { $1 } | RecordEtaPragma { $1 } | TerminatingPragma { $1 } | NonTerminatingPragma { $1 } | NoTerminationCheckPragma { $1 } | MeasurePragma { $1 } | OptionsPragma { $1 } -- Andreas, 2014-03-06 -- OPTIONS pragma not allowed everywhere, but don't give parse error. -- Give better error during type checking instead. OptionsPragma :: { Pragma } OptionsPragma : '{-#' 'OPTIONS' PragmaStrings '#-}' { OptionsPragma (getRange ($1,$2,$4)) $3 } BuiltinPragma :: { Pragma } BuiltinPragma : '{-#' 'BUILTIN' string PragmaQName '#-}' { BuiltinPragma (getRange ($1,$2,fst $3,$4,$5)) (snd $3) (Ident $4) } -- Extra rule to accept keword REWRITE also as built-in: | '{-#' 'BUILTIN' 'REWRITE' PragmaQName '#-}' { BuiltinPragma (getRange ($1,$2,$3,$4,$5)) "REWRITE" (Ident $4) } RewritePragma :: { Pragma } RewritePragma : '{-#' 'REWRITE' PragmaQName '#-}' { RewritePragma (getRange ($1,$2,$3,$4)) $3 } CompiledPragma :: { Pragma } CompiledPragma : '{-#' 'COMPILED' PragmaQName PragmaStrings '#-}' { CompiledPragma (getRange ($1,$2,$3,$5)) $3 (unwords $4) } CompiledExportPragma :: { Pragma } CompiledExportPragma : '{-#' 'COMPILED_EXPORT' PragmaQName PragmaString '#-}' { CompiledExportPragma (getRange ($1,$2,$3,$5)) $3 $4 } CompiledTypePragma :: { Pragma } CompiledTypePragma : '{-#' 'COMPILED_TYPE' PragmaQName PragmaStrings '#-}' { CompiledTypePragma (getRange ($1,$2,$3,$5)) $3 (unwords $4) } CompiledDataPragma :: { Pragma } CompiledDataPragma : '{-#' 'COMPILED_DATA' PragmaQName string PragmaStrings '#-}' { CompiledDataPragma (getRange ($1,$2,$3,fst $4,$6)) $3 (snd $4) $5 } CompiledEpicPragma :: { Pragma } CompiledEpicPragma : '{-#' 'COMPILED_EPIC' PragmaQName PragmaStrings '#-}' { CompiledEpicPragma (getRange ($1,$2,$3,$5)) $3 (unwords $4) } CompiledJSPragma :: { Pragma } CompiledJSPragma : '{-#' 'COMPILED_JS' PragmaQName PragmaStrings '#-}' { CompiledJSPragma (getRange ($1,$2,$3,$5)) $3 (unwords $4) } StaticPragma :: { Pragma } StaticPragma : '{-#' 'STATIC' PragmaQName '#-}' { StaticPragma (getRange ($1,$2,$3,$4)) $3 } RecordEtaPragma :: { Pragma } RecordEtaPragma : '{-#' 'ETA' PragmaQName '#-}' { EtaPragma (getRange ($1,$2,$3,$4)) $3 } NoTerminationCheckPragma :: { Pragma } NoTerminationCheckPragma : '{-#' 'NO_TERMINATION_CHECK' '#-}' { TerminationCheckPragma (getRange ($1,$2,$3)) NoTerminationCheck } NonTerminatingPragma :: { Pragma } NonTerminatingPragma : '{-#' 'NON_TERMINATING' '#-}' { TerminationCheckPragma (getRange ($1,$2,$3)) NonTerminating } TerminatingPragma :: { Pragma } TerminatingPragma : '{-#' 'TERMINATING' '#-}' { TerminationCheckPragma (getRange ($1,$2,$3)) Terminating } MeasurePragma :: { Pragma } MeasurePragma : '{-#' 'MEASURE' PragmaName '#-}' { let r = getRange ($1, $2, $3, $4) in TerminationCheckPragma r (TerminationMeasure r $3) } ImportPragma :: { Pragma } ImportPragma : '{-#' 'IMPORT' string '#-}' {% let s = snd $3 in if validHaskellModuleName s then return $ ImportPragma (getRange ($1,$2,fst $3,$4)) s else parseError $ "Malformed module name: " ++ s ++ "." } ImpossiblePragma :: { Pragma } : '{-#' 'IMPOSSIBLE' '#-}' { ImpossiblePragma (getRange ($1,$2,$3)) } {-------------------------------------------------------------------------- Sequences of declarations --------------------------------------------------------------------------} -- Non-empty list of type signatures, with several identifiers allowed -- for every signature. TypeSignatures :: { [TypeSignature] } TypeSignatures : vopen TypeSignatures1 close { reverse $2 } -- Inside the layout block. TypeSignatures1 :: { [TypeSignature] } TypeSignatures1 : TypeSignatures1 semi TypeSigs { reverse $3 ++ $1 } | TypeSigs { reverse $1 } -- A variant of TypeSignatures which uses ArgTypeSigs instead of -- TypeSigs. ArgTypeSignatures :: { [Arg TypeSignature] } ArgTypeSignatures : vopen ArgTypeSignatures1 close { reverse $2 } -- Inside the layout block. ArgTypeSignatures1 :: { [Arg TypeSignature] } ArgTypeSignatures1 : ArgTypeSignatures1 semi ArgTypeSigs { reverse $3 ++ $1 } | ArgTypeSigs { reverse $1 } -- Constructors are type signatures. But constructor lists can be empty. Constructors :: { [Constructor] } Constructors : vopen close { [] } | TypeSignatures { $1 } -- Record declarations, including an optional record constructor name. RecordDeclarations :: { (Maybe (Ranged Induction), Maybe Name, [Declaration]) } RecordDeclarations : vopen close { (Nothing, Nothing, []) } | vopen RecordConstructorName close { (Nothing, Just $2, []) } | vopen RecordConstructorName semi Declarations1 close { (Nothing, Just $2, $4) } | vopen Declarations1 close { (Nothing, Nothing, $2) } | vopen RecordInduction close { (Just $2, Nothing, []) } | vopen RecordInduction semi RecordConstructorName close { (Just $2, Just $4, []) } | vopen RecordInduction semi RecordConstructorName semi Declarations1 close { (Just $2, Just $4, $6) } | vopen RecordInduction semi Declarations1 close { (Just $2, Nothing, $4) } -- Declaration of record as 'inductive' or 'coinductive'. RecordInduction :: { Ranged Induction } RecordInduction : 'inductive' { Ranged (getRange $1) Inductive } | 'coinductive' { Ranged (getRange $1) CoInductive } -- Arbitrary declarations Declarations :: { [Declaration] } Declarations : vopen Declarations1 close { $2 } -- Arbitrary declarations Declarations0 :: { [Declaration] } Declarations0 : vopen close { [] } | Declarations { $1 } Declarations1 :: { [Declaration] } Declarations1 : Declaration semi Declarations1 { $1 ++ $3 } | Declaration { $1 } TopDeclarations :: { [Declaration] } TopDeclarations : {- empty -} { [] } | Declarations1 { $1 } { {-------------------------------------------------------------------------- Parsers --------------------------------------------------------------------------} -- | Parse the token stream. Used by the TeX compiler. tokensParser :: Parser [Token] -- | Parse an expression. Could be used in interactions. exprParser :: Parser Expr -- | Parse a module. moduleParser :: Parser Module {-------------------------------------------------------------------------- Happy stuff --------------------------------------------------------------------------} -- | Required by Happy. happyError :: Parser a happyError = parseError "Parse error" {-------------------------------------------------------------------------- Utility functions --------------------------------------------------------------------------} -- | Grab leading OPTIONS pragmas. takeOptionsPragmas :: [Declaration] -> ([Pragma], [Declaration]) takeOptionsPragmas = spanJust $ \ d -> case d of Pragma p@OptionsPragma{} -> Just p _ -> Nothing -- | Insert a top-level module if there is none. figureOutTopLevelModule :: [Declaration] -> [Declaration] figureOutTopLevelModule ds = case span isAllowedBeforeModule ds of (ds0, Module r m tel ds1 : ds2) -> ds0 ++ [Module r m tel $ ds1 ++ ds2] (ds0, ds1) -> ds0 ++ [Module (getRange ds1) (QName noName_) [] ds1] where isAllowedBeforeModule (Pragma OptionsPragma{}) = True isAllowedBeforeModule (Private _ ds) = all isAllowedBeforeModule ds isAllowedBeforeModule Import{} = True isAllowedBeforeModule ModuleMacro{} = True isAllowedBeforeModule Open{} = True isAllowedBeforeModule _ = False -- | Create a name from a string. mkName :: (Interval, String) -> Parser Name mkName (i, s) = do let xs = C.stringNameParts s mapM_ isValidId xs unless (alternating xs) $ fail $ "a name cannot contain two consecutive underscores" return $ Name (getRange i) xs where isValidId Hole = return () isValidId (Id y) = do let x = rawNameToString y case parse defaultParseFlags [0] (lexer return) x of ParseOk _ (TokId _) -> return () _ -> fail $ "in the name " ++ s ++ ", the part " ++ x ++ " is not valid" -- we know that there are no two Ids in a row alternating (Hole : Hole : _) = False alternating (_ : xs) = alternating xs alternating [] = True -- | Create a qualified name from a list of strings mkQName :: [(Interval, String)] -> Parser QName mkQName ss = do xs <- mapM mkName ss return $ foldr Qual (QName $ last xs) (init xs) ensureUnqual :: QName -> Parser Name ensureUnqual (QName x) = return x ensureUnqual q@Qual{} = parseError' (rStart $ getRange q) "Qualified name not allowed here" -- | Match a particular name. isName :: String -> (Interval, String) -> Parser () isName s (_,s') | s == s' = return () | otherwise = fail $ "expected " ++ s ++ ", found " ++ s' -- | Build a forall pi (forall x y z -> ...) forallPi :: [LamBinding] -> Expr -> Expr forallPi bs e = Pi (map addType bs) e -- | Build a telescoping let (let Ds) tLet :: Range -> [Declaration] -> TypedBindings tLet r = TypedBindings r . Common.Arg defaultArgInfo . TLet r -- | Converts lambda bindings to typed bindings. addType :: LamBinding -> TypedBindings addType (DomainFull b) = b addType (DomainFree info x) = TypedBindings r $ Common.Arg info $ TBind r [pure x] $ Underscore r Nothing where r = getRange x mergeImportDirectives :: [ImportDirective] -> Parser ImportDirective mergeImportDirectives is = do i <- foldl merge (return defaultImportDir) is verifyImportDirective i where merge mi i2 = do i1 <- mi let err = parseError' (rStart $ getRange i2) "Cannot mix using and hiding module directives" uh <- case (usingOrHiding i1, usingOrHiding i2) of (Hiding [], u) -> return u (u, Hiding []) -> return u (Using{}, Hiding{}) -> err (Hiding{}, Using{}) -> err (Using xs, Using ys) -> return $ Using (xs ++ ys) (Hiding xs, Hiding ys) -> return $ Hiding (xs ++ ys) return $ ImportDirective { importDirRange = fuseRange i1 i2 , usingOrHiding = uh , renaming = renaming i1 ++ renaming i2 , publicOpen = publicOpen i1 || publicOpen i2 } -- | Check that an import directive doesn't contain repeated names verifyImportDirective :: ImportDirective -> Parser ImportDirective verifyImportDirective i = case filter ((>1) . length) $ group $ sort xs of [] -> return i yss -> let Just pos = rStart $ getRange $ head $ concat yss in parseErrorAt pos $ "Repeated name" ++ s ++ " in import directive: " ++ concat (intersperse ", " $ map (show . head) yss) where s = case yss of [_] -> "" _ -> "s" where xs = names (usingOrHiding i) ++ map renFrom (renaming i) names (Using xs) = xs names (Hiding xs) = xs -- | Breaks up a string into substrings. Returns every maximal -- subsequence of zero or more characters distinct from @'.'@. -- -- > splitOnDots "" == [""] -- > splitOnDots "foo.bar" == ["foo", "bar"] -- > splitOnDots ".foo.bar" == ["", "foo", "bar"] -- > splitOnDots "foo.bar." == ["foo", "bar", ""] -- > splitOnDots "foo..bar" == ["foo", "", "bar"] splitOnDots :: String -> [String] splitOnDots "" = [""] splitOnDots ('.' : s) = [] : splitOnDots s splitOnDots (c : s) = case splitOnDots s of p : ps -> (c : p) : ps prop_splitOnDots = and [ splitOnDots "" == [""] , splitOnDots "foo.bar" == ["foo", "bar"] , splitOnDots ".foo.bar" == ["", "foo", "bar"] , splitOnDots "foo.bar." == ["foo", "bar", ""] , splitOnDots "foo..bar" == ["foo", "", "bar"] ] -- | Returns 'True' iff the name is a valid Haskell (hierarchical) -- module name. validHaskellModuleName :: String -> Bool validHaskellModuleName = all ok . splitOnDots where -- Checks if a dot-less module name is well-formed. ok :: String -> Bool ok [] = False ok (c : s) = isUpper c && all (\c -> isLower c || c == '_' || isUpper c || generalCategory c == DecimalNumber || c == '\'') s {-------------------------------------------------------------------------- Patterns --------------------------------------------------------------------------} -- | Turn an expression into a left hand side. exprToLHS :: Expr -> Parser ([Expr] -> [Expr] -> LHS) exprToLHS e = case e of WithApp r e es -> LHS <$> exprToPattern e <*> mapM exprToPattern es _ -> LHS <$> exprToPattern e <*> return [] -- | Turn an expression into a pattern. Fails if the expression is not a -- valid pattern. exprToPattern :: Expr -> Parser Pattern exprToPattern e = case e of Ident x -> return $ IdentP x App _ e1 e2 -> AppP <$> exprToPattern e1 <*> T.mapM (T.mapM exprToPattern) e2 Paren r e -> ParenP r <$> exprToPattern e Underscore r _ -> return $ WildP r Absurd r -> return $ AbsurdP r As r x e -> AsP r x <$> exprToPattern e Dot r (HiddenArg _ e) -> return $ HiddenP r $ fmap (DotP r) e Dot r e -> return $ DotP r e Lit l -> return $ LitP l HiddenArg r e -> HiddenP r <$> T.mapM exprToPattern e InstanceArg r e -> InstanceP r <$> T.mapM exprToPattern e RawApp r es -> RawAppP r <$> mapM exprToPattern es Quote r -> return $ QuoteP r _ -> let Just pos = rStart $ getRange e in parseErrorAt pos $ "Not a valid pattern: " ++ show e opAppExprToPattern :: OpApp Expr -> Parser Pattern opAppExprToPattern (SyntaxBindingLambda _ _ _) = parseError "Syntax binding lambda cannot appear in a pattern" opAppExprToPattern (Ordinary e) = exprToPattern e -- | Turn an expression into a name. Fails if the expression is not a -- valid identifier. exprToName :: Expr -> Parser Name exprToName (Ident (QName x)) = return x exprToName e = let Just pos = rStart $ getRange e in parseErrorAt pos $ "Not a valid identifier: " ++ show e stripSingletonRawApp :: Expr -> Expr stripSingletonRawApp (RawApp _ [e]) = stripSingletonRawApp e stripSingletonRawApp e = e isEqual :: Expr -> Maybe (Expr, Expr) isEqual e = case stripSingletonRawApp e of Equal _ a b -> Just (stripSingletonRawApp a, stripSingletonRawApp b) _ -> Nothing maybeNamed :: Expr -> Named_ Expr maybeNamed e = case isEqual e of Just (Ident (QName x), b) -> named (Ranged (getRange x) (nameToRawName x)) b _ -> unnamed e patternSynArgs :: [Either Hiding LamBinding] -> Parser [Arg Name] patternSynArgs = mapM pSynArg where pSynArg Left{} = parseError "Absurd patterns are not allowed in pattern synonyms" pSynArg (Right DomainFull{}) = parseError "Unexpected type signature in pattern synonym argument" pSynArg (Right (DomainFree a x)) | getHiding a `notElem` [Hidden, NotHidden] = parseError $ show (getHiding a) ++ " arguments not allowed to pattern synonyms" | getRelevance a /= Relevant = parseError "Arguments to pattern synonyms must be relevant" | otherwise = return $ Common.Arg a (boundName x) parsePanic s = parseError $ "Internal parser error: " ++ s ++ ". Please report this as a bug." {- RHS or type signature -} data RHSOrTypeSigs = JustRHS RHS | TypeSigsRHS Expr deriving Show patternToNames :: Pattern -> Parser [(C.ArgInfo, Name)] patternToNames p = case p of IdentP (QName i) -> return [(defaultArgInfo, i)] WildP r -> return [(defaultArgInfo, C.noName r)] DotP _ (Ident (QName i)) -> return [(setRelevance Irrelevant defaultArgInfo, i)] RawAppP _ ps -> concat <$> mapM patternToNames ps _ -> parseError $ "Illegal name in type signature: " ++ prettyShow p funClauseOrTypeSigs :: LHS -> RHSOrTypeSigs -> WhereClause -> Parser [Declaration] funClauseOrTypeSigs lhs mrhs wh = do -- traceShowM lhs case mrhs of JustRHS rhs -> return [FunClause lhs rhs wh] TypeSigsRHS e -> case wh of NoWhere -> case lhs of Ellipsis{} -> parseError "The ellipsis ... cannot have a type signature" LHS _ _ _ (_:_) -> parseError "Illegal: with in type signature" LHS _ _ (_:_) _ -> parseError "Illegal: rewrite in type signature" LHS _ (_:_) _ _ -> parseError "Illegal: with patterns in type signature" LHS p [] [] [] -> map (\ (x, y) -> TypeSig x y e) <$> patternToNames p _ -> parseError "A type signature cannot have a where clause" {-------------------------------------------------------------------------- Tests --------------------------------------------------------------------------} -- | Test suite. tests :: IO Bool tests = runTests "Agda.Syntax.Parser.Parser" [ quickCheck' prop_splitOnDots ] } Agda-2.4.2.5/src/full/Agda/Syntax/Parser/LexActions.hs-boot0000644000000000000000000000156312635075266021402 0ustar0000000000000000module Agda.Syntax.Parser.LexActions where import Agda.Syntax.Literal import Agda.Syntax.Parser.Alex import Agda.Syntax.Parser.Monad import Agda.Syntax.Parser.Tokens import Agda.Syntax.Position lexToken :: Parser Token token :: (String -> Parser tok) -> LexAction tok withInterval :: ((Interval, String) -> tok) -> LexAction tok withInterval' :: (String -> a) -> ((Interval, a) -> tok) -> LexAction tok withLayout :: LexAction r -> LexAction r begin :: LexState -> LexAction Token endWith :: LexAction a -> LexAction a begin_ :: LexState -> LexAction Token end_ :: LexAction Token keyword :: Keyword -> LexAction Token symbol :: Symbol -> LexAction Token identifier :: LexAction Token literal :: Read a => (Range -> a -> Literal) -> LexAction Token followedBy :: Char -> LexPredicate eof :: LexPredicate inState :: LexState -> LexPredicate Agda-2.4.2.5/src/full/Agda/Syntax/Parser/Comments.hs0000644000000000000000000000501612635075266020152 0ustar0000000000000000-- {-# LANGUAGE CPP #-} {-| This module defines the lex action to lex nested comments. As is well-known this cannot be done by regular expressions (which, incidently, is probably the reason why C-comments don't nest). When scanning nested comments we simply keep track of the nesting level, counting up for /open comments/ and down for /close comments/. -} module Agda.Syntax.Parser.Comments where import Data.List import {-# SOURCE #-} Agda.Syntax.Parser.LexActions import Agda.Syntax.Parser.Monad import Agda.Syntax.Parser.Tokens import Agda.Syntax.Parser.Alex import Agda.Syntax.Parser.LookAhead import Agda.Syntax.Position import Agda.Utils.Monad -- | Should comment tokens be output? keepComments :: LexPredicate keepComments (_, s) _ _ _ = parseKeepComments s -- | Should comment tokens be output? keepCommentsM :: Parser Bool keepCommentsM = fmap parseKeepComments getParseFlags -- | Manually lexing a block comment. Assumes an /open comment/ has been lexed. -- In the end the comment is discarded and 'lexToken' is called to lex a real -- token. nestedComment :: LexAction Token nestedComment inp inp' _ = do setLexInput inp' runLookAhead err $ skipBlock "{-" "-}" keep <- keepCommentsM if keep then do inp'' <- getLexInput let p1 = lexPos inp; p2 = lexPos inp'' i = Interval p1 p2 s = case (p1, p2) of (Pn { posPos = p1 }, Pn { posPos = p2 }) -> genericTake (p2 - p1) $ lexInput inp return $ TokComment (i, s) else lexToken where err _ = liftP $ parseErrorAt (lexPos inp) "Unterminated '{-'" -- | Lex a hole (@{! ... !}@). Holes can be nested. -- Returns @'TokSymbol' 'SymQuestionMark'@. hole :: LexAction Token hole inp inp' _ = do setLexInput inp' runLookAhead err $ skipBlock "{!" "!}" p <- lexPos <$> getLexInput return $ TokSymbol SymQuestionMark (Interval (lexPos inp) p) where err _ = liftP $ parseErrorAt (lexPos inp) "Unterminated '{!'" -- | Skip a block of text enclosed by the given open and close strings. Assumes -- the first open string has been consumed. Open-close pairs may be nested. skipBlock :: String -> String -> LookAhead () skipBlock open close = scan 1 where scan 0 = sync scan n = match [ open ==> scan (n + 1) , close ==> scan (n - 1) ] `other` scan n where (==>) = (,) other = ($) Agda-2.4.2.5/src/full/Agda/Syntax/Parser/LookAhead.hs0000644000000000000000000001040212635075266020207 0ustar0000000000000000{-# LANGUAGE GeneralizedNewtypeDeriving #-} {-# LANGUAGE Rank2Types #-} {-| When lexing by hands (for instance string literals) we need to do some looking ahead. The 'LookAhead' monad keeps track of the position we are currently looking at, and provides facilities to synchronise the look-ahead position with the actual position of the 'Parser' monad (see 'sync' and 'rollback'). -} module Agda.Syntax.Parser.LookAhead ( -- * The LookAhead monad LookAhead , runLookAhead -- * Operations , getInput, setInput, liftP , nextChar, eatNextChar , sync, rollback , match, match' ) where import Control.Applicative import Control.Monad.Reader import Control.Monad.State import Agda.Syntax.Parser.Alex import Agda.Syntax.Parser.Monad {-------------------------------------------------------------------------- The look-ahead monad --------------------------------------------------------------------------} {-| The LookAhead monad is basically a state monad keeping with an extra 'AlexInput', wrapped around the 'Parser' monad. -} newtype LookAhead a = LookAhead { unLookAhead :: ReaderT ErrorFunction (StateT AlexInput Parser) a } deriving (Functor, Applicative) newtype ErrorFunction = ErrorFun { throwError :: forall a. String -> LookAhead a } {-------------------------------------------------------------------------- Monad instances --------------------------------------------------------------------------} instance Monad LookAhead where return = LookAhead . return m >>= k = LookAhead $ unLookAhead m >>= unLookAhead . k fail s = do err <- LookAhead ask throwError err s {-------------------------------------------------------------------------- Operations --------------------------------------------------------------------------} -- | Get the current look-ahead position. getInput :: LookAhead AlexInput getInput = LookAhead get -- | Set the look-ahead position. setInput :: AlexInput -> LookAhead () setInput = LookAhead . put -- | Lift a computation in the 'Parser' monad to the 'LookAhead' monad. liftP :: Parser a -> LookAhead a liftP = LookAhead . lift . lift -- | Look at the next character. Fails if there are no more characters. nextChar :: LookAhead Char nextChar = do inp <- getInput case alexGetChar inp of Nothing -> fail "unexpected end of file" Just (c,inp') -> do setInput inp' return c -- | Consume all the characters up to the current look-ahead position. sync :: LookAhead () sync = do inp <- getInput liftP $ setLexInput inp -- | Undo look-ahead. Restores the input from the 'ParseState'. rollback :: LookAhead () rollback = do inp <- liftP getLexInput setInput inp -- | Consume the next character. Does 'nextChar' followed by 'sync'. eatNextChar :: LookAhead Char eatNextChar = do c <- nextChar sync return c {-| Do a case on the current input string. If any of the given strings match we move past it and execute the corresponding action. If no string matches, we execute a default action, advancing the input one character. This function only affects the look-ahead position. -} match :: [(String, LookAhead a)] -> LookAhead a -> LookAhead a match xs def = do c <- nextChar match' c xs def {-| Same as 'match' but takes the initial character from the first argument instead of reading it from the input. Consequently, in the default case the input is not advanced. -} match' :: Char -> [(String, LookAhead a)] -> LookAhead a -> LookAhead a match' c xs def = do inp <- getInput match'' inp xs c where match'' inp bs c = case bs' of [] -> setInput inp >> def [("",p)] -> p _ -> match'' inp bs' =<< nextChar where bs' = [ (s, p) | (c':s, p) <- bs, c == c' ] -- | Run a 'LookAhead' computation. The first argument is the error function. runLookAhead :: (forall b. String -> LookAhead b) -> LookAhead a -> Parser a runLookAhead err (LookAhead m) = do inp <- getLexInput evalStateT (runReaderT m (ErrorFun err)) inp Agda-2.4.2.5/src/full/Agda/Auto/0000755000000000000000000000000012635075266014215 5ustar0000000000000000Agda-2.4.2.5/src/full/Agda/Auto/NarrowingSearch.hs0000644000000000000000000004510312635075266017650 0ustar0000000000000000{-# LANGUAGE CPP #-} {-# LANGUAGE ExistentialQuantification #-} {-# LANGUAGE FlexibleInstances #-} {-# LANGUAGE FunctionalDependencies #-} {-# LANGUAGE MultiParamTypeClasses #-} {-# LANGUAGE Rank2Types #-} {-# LANGUAGE ScopedTypeVariables #-} module Agda.Auto.NarrowingSearch where import Data.IORef hiding (writeIORef, modifyIORef) import qualified Data.IORef as NoUndo (writeIORef, modifyIORef) import Control.Monad.State #include "undefined.h" import Agda.Utils.Impossible type Prio = Int class Trav a blk | a -> blk where trav :: Monad m => (forall b . Trav b blk => MM b blk -> m ()) -> a -> m () instance Trav a blk => Trav (MM a blk) blk where trav f me = f me data Term blk = forall a . Trav a blk => Term a -- | Result of type-checking. data Prop blk = OK -- ^ Success. | Error String -- ^ Definite failure. | forall a . AddExtraRef String (Metavar a blk) (Int, RefCreateEnv blk a) -- ^ Experimental. | And (Maybe [Term blk]) (MetaEnv (PB blk)) (MetaEnv (PB blk)) -- ^ Parallel conjunction of constraints. | Sidecondition (MetaEnv (PB blk)) (MetaEnv (PB blk)) -- ^ Experimental, related to 'mcompoint'. -- First arg is sidecondition. | Or Prio (MetaEnv (PB blk)) (MetaEnv (PB blk)) -- ^ Forking proof on something that is not part of the term language. -- E.g. whether a term will reduce or not. | ConnectHandle (OKHandle blk) (MetaEnv (PB blk)) -- ^ Obsolete. data OKVal = OKVal type OKHandle blk = MM OKVal blk type OKMeta blk = Metavar OKVal blk -- | Agsy's meta variables. -- -- @a@ the type of the metavariable (what it can be instantiated with). -- @blk@ the search control information (e.g. the scope of the meta). data Metavar a blk = Metavar { mbind :: IORef (Maybe a) -- ^ Maybe an instantiation (refinement). It is usually shallow, -- i.e., just one construct(or) with arguments again being metas. , mprincipalpresent :: IORef Bool -- ^ Does this meta block a principal constraint -- (i.e., a type-checking constraint). , mobs :: IORef [(QPB a blk, Maybe (CTree blk))] -- ^ List of observers, i.e., constraints blocked by this meta. , mcompoint :: IORef [SubConstraints blk] -- ^ Used for experiments with independence of subproofs. , mextrarefs :: IORef [(Int, RefCreateEnv blk a)] -- ^ Experimental. } hequalMetavar :: Metavar a1 blk1 -> Metavar a2 bkl2 -> Bool hequalMetavar m1 m2 = mprincipalpresent m1 == mprincipalpresent m2 instance Eq (Metavar a blk) where x == y = hequalMetavar x y newMeta :: IORef [SubConstraints blk] -> IO (Metavar a blk) newMeta mcompoint = do bind <- newIORef Nothing pp <- newIORef False obs <- newIORef [] erefs <- newIORef [] return $ Metavar bind pp obs mcompoint erefs initMeta :: IO (Metavar a blk) initMeta = do cp <- newIORef [] newMeta cp data CTree blk = CTree {ctpriometa :: IORef (PrioMeta blk), ctsub :: IORef (Maybe (SubConstraints blk)), ctparent :: IORef (Maybe (CTree blk)), -- Nothing - root cthandles :: IORef [OKMeta blk] } data SubConstraints blk = SubConstraints {scflip :: IORef Bool, sccomcount :: IORef Int, scsub1 :: CTree blk, scsub2 :: CTree blk } newCTree :: Maybe (CTree blk) -> IO (CTree blk) newCTree parent = do priometa <- newIORef (NoPrio False) sub <- newIORef Nothing rparent <- newIORef parent handles <- newIORef [] return $ CTree priometa sub rparent handles newSubConstraints :: CTree blk -> IO (SubConstraints blk) newSubConstraints node = do flip <- newIORef True -- False -- initially (and always) True, trying out prefer rightmost subterm when none have priority comcount <- newIORef 0 sub1 <- newCTree $ Just node sub2 <- newCTree $ Just node return $ SubConstraints flip comcount sub1 sub2 data PrioMeta blk = forall a . Refinable a blk => PrioMeta Prio (Metavar a blk) | NoPrio Bool -- True if subconstraint is done (all OK) instance Eq (PrioMeta blk) where NoPrio d1 == NoPrio d2 = d1 == d2 PrioMeta p1 m1 == PrioMeta p2 m2 = p1 == p2 && hequalMetavar m1 m2 _ == _ = False -- ----------------------- data Restore = forall a . Restore (IORef a) a type Undo = StateT [Restore] IO ureadIORef :: IORef a -> Undo a ureadIORef ptr = lift $ readIORef ptr uwriteIORef :: IORef a -> a -> Undo () uwriteIORef ptr newval = do oldval <- ureadIORef ptr modify (Restore ptr oldval :) lift $ NoUndo.writeIORef ptr newval umodifyIORef :: IORef a -> (a -> a) -> Undo () umodifyIORef ptr f = do oldval <- ureadIORef ptr modify (Restore ptr oldval :) lift $ NoUndo.writeIORef ptr (f oldval) ureadmodifyIORef :: IORef a -> (a -> a) -> Undo a ureadmodifyIORef ptr f = do oldval <- ureadIORef ptr modify (Restore ptr oldval :) lift $ NoUndo.writeIORef ptr (f oldval) return oldval runUndo :: Undo a -> IO a runUndo x = do (res, restores) <- runStateT x [] mapM_ (\(Restore ptr oldval) -> NoUndo.writeIORef ptr oldval) restores return res -- ----------------------- type RefCreateEnv blk = StateT ( ( (IORef [SubConstraints blk])), Int) IO data Pair a b = Pair a b class Refinable a blk where refinements :: blk -> [blk] -> Metavar a blk -> IO [(Int, RefCreateEnv blk a)] newPlaceholder :: RefCreateEnv blk (MM a blk) newPlaceholder = do (e@( ( mcompoint)), c) <- get m <- lift $ newMeta mcompoint put (e, (c + 1)) return $ Meta m newOKHandle :: RefCreateEnv blk (OKHandle blk) newOKHandle = do (e@( ( _)), c) <- get cp <- lift $ newIORef [] m <- lift $ newMeta cp put (e, (c + 1)) return $ Meta m dryInstantiate :: RefCreateEnv blk a -> IO a dryInstantiate bind = evalStateT bind ( ( __IMPOSSIBLE__), 0) type BlkInfo blk = (Bool, Prio, Maybe blk) -- Bool - is principal data MM a blk = NotM a | Meta (Metavar a blk) type MetaEnv = IO data MB a blk = NotB a | forall b . Refinable b blk => Blocked (Metavar b blk) (MetaEnv (MB a blk)) | Failed String data PB blk = NotPB (Prop blk) | forall b . Refinable b blk => PBlocked (Metavar b blk) (BlkInfo blk) (MetaEnv (PB blk)) | forall b1 b2 . (Refinable b1 blk, Refinable b2 blk) => PDoubleBlocked (Metavar b1 blk) (Metavar b2 blk) (MetaEnv (PB blk)) data QPB b blk = QPBlocked (BlkInfo blk) (MetaEnv (PB blk)) | QPDoubleBlocked (IORef Bool) (MetaEnv (PB blk)) -- flag set True by first observer that continues mmcase :: Refinable a blk => MM a blk -> (a -> MetaEnv (MB b blk)) -> MetaEnv (MB b blk) mmcase x f = case x of NotM x -> f x x@(Meta m) -> do bind <- readIORef $ mbind m case bind of Just x -> f x Nothing -> return $ Blocked m (mmcase x f) mmmcase :: Refinable a blk => MM a blk -> MetaEnv (MB b blk) -> (a -> MetaEnv (MB b blk)) -> MetaEnv (MB b blk) mmmcase x fm f = case x of NotM x -> f x Meta m -> do bind <- readIORef $ mbind m case bind of Just x -> f x Nothing -> fm mmpcase :: Refinable a blk => BlkInfo blk -> MM a blk -> (a -> MetaEnv (PB blk)) -> MetaEnv (PB blk) mmpcase blkinfo x f = case x of NotM x -> f x x@(Meta m) -> do bind <- readIORef $ mbind m case bind of Just x -> f x Nothing -> return $ PBlocked m blkinfo (mmpcase __IMPOSSIBLE__ x f) -- blkinfo not needed because will be notb next time doubleblock :: (Refinable a blk, Refinable b blk) => MM a blk -> MM b blk -> MetaEnv (PB blk) -> MetaEnv (PB blk) doubleblock (Meta m1) (Meta m2) cont = return $ PDoubleBlocked m1 m2 cont doubleblock _ _ _ = __IMPOSSIBLE__ mbcase :: MetaEnv (MB a blk) -> (a -> MetaEnv (MB b blk)) -> MetaEnv (MB b blk) mbcase x f = do x' <- x case x' of NotB x -> f x Blocked m x -> return $ Blocked m (mbcase x f) Failed msg -> return $ Failed msg mbpcase :: Prio -> Maybe blk -> MetaEnv (MB a blk) -> (a -> MetaEnv (PB blk)) -> MetaEnv (PB blk) mbpcase prio bi x f = do x' <- x case x' of NotB x -> f x Blocked m x -> return $ PBlocked m (False, prio, bi) (mbpcase prio bi x f) Failed msg -> return $ NotPB $ Error msg mmbpcase :: MetaEnv (MB a blk) -> (forall b . Refinable b blk => MM b blk -> MetaEnv (PB blk)) -> (a -> MetaEnv (PB blk)) -> MetaEnv (PB blk) mmbpcase x fm f = do x' <- x case x' of NotB x -> f x Blocked m x -> fm (Meta m) Failed msg -> return $ NotPB $ Error msg waitok :: OKHandle blk -> MetaEnv (MB b blk) -> MetaEnv (MB b blk) waitok okh f = mmcase okh $ \b -> case b of -- principle constraint is never present for okhandle so it will not be refined OKVal -> f mbret :: a -> MetaEnv (MB a blk) mbret x = return $ NotB x mbfailed :: String -> MetaEnv (MB a blk) mbfailed msg = return $ Failed msg mpret :: Prop blk -> MetaEnv (PB blk) mpret p = return $ NotPB p expandbind :: MM a blk -> MetaEnv (MM a blk) expandbind x = case x of NotM{} -> return x Meta m -> do bind <- readIORef $ mbind m case bind of Just x -> return $ NotM x Nothing -> return x -- ----------------------- type HandleSol = IO () type SRes = Either Bool Int topSearch :: forall blk . IORef Int -> IORef Int -> HandleSol -> blk -> MetaEnv (PB blk) -> Int -> Int -> IO Bool topSearch ticks nsol hsol envinfo p searchdepth depthinterval = do depthreached <- newIORef False mainroot <- newCTree Nothing let searchSubProb :: [(CTree blk, Maybe (IORef Bool))] -> Int -> IO SRes searchSubProb [] depth = do when (depth < depthinterval) $ do hsol n <- readIORef nsol NoUndo.writeIORef nsol $! n - 1 return $ Left True searchSubProb ((root, firstdone) : restprobs) depth = let search :: Int -> IO SRes search depth = do pm <- readIORef $ ctpriometa root case pm of NoPrio False -> return $ Left False -- nothing to refine but not done, this can happen when eq constraints are passed along with main constraint in agdaplugin NoPrio True -> searchSubProb restprobs depth -- ?? what should depth be PrioMeta _ m -> do let carryon = fork m depth sub <- readIORef $ ctsub root case sub of Nothing -> carryon Just sc -> do let sub1 = scsub1 sc sub2 = scsub2 sc pm1 <- readIORef $ ctpriometa sub1 pm2 <- readIORef $ ctpriometa sub2 let split = carryon -- split disabled case pm1 of NoPrio True -> split _ -> case pm2 of NoPrio True -> split _ -> do comc <- readIORef $ sccomcount sc case comc of 0 -> split _ -> carryon fork :: Refinable a blk => Metavar a blk -> Int -> IO SRes fork m depth = do blkinfos <- extractblkinfos m refs <- refinements envinfo blkinfos m f refs where f [] = do erefs <- readIORef $ mextrarefs m case erefs of [] -> return (Left False) _ -> do NoUndo.writeIORef (mextrarefs m) [] f erefs f ((cost, bind) : binds) = hsres (refine m bind (depth - cost) ) (f binds) hsres :: IO SRes -> IO SRes -> IO SRes hsres x1 x2 = do res <- x1 case res of Right _ -> return res Left found -> do n <- readIORef nsol if n == 0 then return res else do res2 <- x2 case res2 of Right _ -> if found then __IMPOSSIBLE__ else return res2 Left found2 -> return $ Left (found || found2) refine :: Metavar a blk -> RefCreateEnv blk a -> Int -> IO SRes refine _ _ depthleft | depthleft < 0 = do NoUndo.writeIORef depthreached True return $ Left False refine m bind depthleft = runUndo $ do t <- ureadIORef ticks lift $ NoUndo.writeIORef ticks $! t + 1 (bind, (_, nnewmeta)) <- lift $ runStateT bind ( ( (mcompoint m)), 0) uwriteIORef (mbind m) (Just bind) mcomptr <- ureadIORef $ mcompoint m mapM_ (\comptr -> umodifyIORef (sccomcount comptr) (+ (nnewmeta - 1)) -- umodifyIORef (scflip comptr) not -- don't flip now since trying prefer rightmost subterm if non have prio ) mcomptr obs <- ureadIORef (mobs m) res <- recalcs obs case res of True -> -- failed return $ Left False False -> lift $ search depthleft -- succeeded doit = do res <- search depth return $ case res of Right n -> case firstdone of Nothing -> if n == 0 then Left False else Right (n - 1) Just _ -> Right (n + 1) res@(Left True) -> res res@(Left False) -> case firstdone of Nothing -> res Just _ -> Right 0 in case firstdone of Nothing -> doit Just rdone -> do done <- readIORef rdone if done then searchSubProb restprobs depth else do NoUndo.writeIORef rdone True doit runUndo $ do res <- reccalc p (Just mainroot) case res of True -> -- failed immediately return False False -> do Left solfound <- lift $ searchSubProb [(mainroot, Nothing)] searchdepth dr <- lift $ readIORef depthreached return dr extractblkinfos :: Metavar a blk -> IO [blk] extractblkinfos m = do obs <- readIORef $ mobs m return $ f obs where f [] = [] f ((QPBlocked (_,_,mblkinfo) _, _) : cs) = case mblkinfo of Nothing -> f cs Just blkinfo -> blkinfo : f cs f ((QPDoubleBlocked{}, _) : cs) = f cs recalcs :: [(QPB a blk, Maybe (CTree blk))] -> Undo Bool recalcs [] = return False recalcs (c : cs) = seqc (recalc c) (recalcs cs) seqc :: Undo Bool -> Undo Bool -> Undo Bool seqc x y = do res1 <- x case res1 of res1@True -> return res1 False -> y recalc :: (QPB a blk, Maybe (CTree blk)) -> Undo Bool recalc (con, node) = case con of QPBlocked _ cont -> reccalc cont node QPDoubleBlocked flag cont -> do fl <- ureadIORef flag if fl then return False else do uwriteIORef flag True reccalc cont node reccalc :: MetaEnv (PB blk) -> Maybe (CTree blk) -> Undo Bool reccalc cont node = do res <- calc cont node case res of Nothing -> return True Just pendhandles -> foldM (\res1 h -> case res1 of True -> return res1 False -> do uwriteIORef (mbind h) $ Just OKVal obs <- ureadIORef (mobs h) recalcs obs ) False pendhandles calc :: forall blk . MetaEnv (PB blk) -> Maybe (CTree blk) -> Undo (Maybe [OKMeta blk]) calc cont node = do res <- donewp node cont case res of Just (_, pendhandles) -> do pendhandles2 <- case node of Just node -> propagatePrio node Nothing -> return [] return $ Just (pendhandles ++ pendhandles2) Nothing -> return Nothing where storeprio (Just node) pm pendhandles = do pendhandles' <- case pm of NoPrio True -> do handles <- ureadIORef (cthandles node) return $ handles ++ pendhandles _ -> return pendhandles uwriteIORef (ctpriometa node) pm return $ Just (pm, pendhandles') storeprio Nothing _ _ = return $ Just (NoPrio False, []) donewp node p = do bp <- lift p case bp of NotPB p -> doprop node p PBlocked m blkinfo cont -> do oldobs <- ureadmodifyIORef (mobs m) ((QPBlocked blkinfo cont, node) :) let (princ, prio, _) = blkinfo pp <- ureadIORef (mprincipalpresent m) when (princ && not pp) $ do uwriteIORef (mprincipalpresent m) True mapM_ (\(qpb, node) -> case node of Just node -> case qpb of QPBlocked (_, prio, _) _ -> do uwriteIORef (ctpriometa node) (PrioMeta prio m) propagatePrio node QPDoubleBlocked flag _ -> return [] Nothing -> return [] ) oldobs if pp || princ then storeprio node (PrioMeta prio m) [] else storeprio node (NoPrio False) [] PDoubleBlocked m1 m2 cont -> do flag <- lift $ newIORef False let newobs = ((QPDoubleBlocked flag cont, node) :) umodifyIORef (mobs m1) newobs umodifyIORef (mobs m2) newobs storeprio node (NoPrio False) [] doprop node p = case p of OK -> storeprio node (NoPrio True) [] Error _ -> return Nothing AddExtraRef _ m eref -> do lift $ NoUndo.modifyIORef (mextrarefs m) (eref :) return Nothing And coms p1 p2 -> do let Just jnode = node sc <- lift $ newSubConstraints jnode uwriteIORef (ctsub jnode) $ Just sc ndep <- case coms of Nothing -> return 1 -- no metas pointing to it so will never decrement to 0 Just coms -> return 1 -- dito lift $ NoUndo.writeIORef (sccomcount sc) ndep -- OK since sc was just created resp1 <- donewp (Just $ scsub1 sc) p1 case resp1 of Just (pm1, phs1) -> do resp2 <- donewp (Just $ scsub2 sc) p2 case resp2 of Just (pm2, phs2) -> storeprio node (choosePrioMeta False pm1 pm2) (phs1 ++ phs2) resp2@Nothing -> return resp2 resp1@Nothing -> return resp1 Sidecondition sidep mainp -> do resp1 <- donewp Nothing sidep case resp1 of Just{} -> do resp2 <- donewp node mainp case resp2 of Just (pm2, phs2) -> storeprio node pm2 phs2 resp2@Nothing -> return resp2 resp1@Nothing -> return resp1 Or prio p1 p2 -> do cm <- lift $ initMeta donewp node (choose (Meta cm) prio p1 p2) ConnectHandle (Meta handle) p' -> do let Just jnode = node umodifyIORef (cthandles jnode) (handle :) donewp node p' ConnectHandle (NotM _) _ -> __IMPOSSIBLE__ choosePrioMeta :: Bool -> PrioMeta blk -> PrioMeta blk -> PrioMeta blk choosePrioMeta flip pm1@(PrioMeta p1 _) pm2@(PrioMeta p2 _) = if p1 > p2 then pm1 else if p2 > p1 then pm2 else if flip then pm2 else pm1 choosePrioMeta _ pm@(PrioMeta _ _) (NoPrio _) = pm choosePrioMeta _ (NoPrio _) pm@(PrioMeta _ _) = pm choosePrioMeta _ (NoPrio d1) (NoPrio d2) = NoPrio (d1 && d2) propagatePrio :: CTree blk -> Undo [OKMeta blk] propagatePrio node = do parent <- lift $ readIORef $ ctparent node case parent of Nothing -> return [] Just parent -> do Just sc <- ureadIORef (ctsub parent) pm1 <- ureadIORef $ ctpriometa $ scsub1 sc pm2 <- ureadIORef $ ctpriometa $ scsub2 sc flip <- ureadIORef $ scflip sc let pm = choosePrioMeta flip pm1 pm2 opm <- ureadIORef (ctpriometa parent) if (not (pm == opm)) then do uwriteIORef (ctpriometa parent) pm phs <- case pm of NoPrio True -> ureadIORef (cthandles parent) _ -> return [] phs2 <- propagatePrio parent return $ phs ++ phs2 else return [] data Choice = LeftDisjunct | RightDisjunct choose :: MM Choice blk -> Prio -> MetaEnv (PB blk) -> MetaEnv (PB blk) -> MetaEnv (PB blk) choose c prio p1 p2 = mmpcase (True, prio, Nothing) c $ \c -> case c of LeftDisjunct -> p1 RightDisjunct -> p2 instance Refinable Choice blk where refinements _ x _ = return [(0, return LeftDisjunct), (0, return RightDisjunct)] instance Refinable OKVal blk where refinements _ _ _ = __IMPOSSIBLE__ -- OKVal should never be refined -- ------------------------------------ Agda-2.4.2.5/src/full/Agda/Auto/CaseSplit.hs0000644000000000000000000005220312635075266016442 0ustar0000000000000000{-# LANGUAGE CPP #-} {-# LANGUAGE Rank2Types #-} {-# LANGUAGE ScopedTypeVariables #-} module Agda.Auto.CaseSplit where import Data.IORef import Data.List (findIndex, union) import qualified Data.IntMap as IntMap import Agda.Auto.NarrowingSearch import Agda.Auto.Syntax import Agda.Auto.SearchControl import Agda.Auto.Typecheck #include "undefined.h" import Agda.Utils.Impossible abspatvarname :: String abspatvarname = "\0absurdPattern" costCaseSplitVeryHigh, costCaseSplitHigh, costCaseSplitLow, costAddVarDepth :: Nat costCaseSplitVeryHigh = 10000 costCaseSplitHigh = 5000 costCaseSplitLow = 2000 costAddVarDepth = 1000 data HI a = HI FMode a drophid :: [HI a] -> [a] drophid = map (\(HI _ x) -> x) type CSPat o = HI (CSPatI o) type CSCtx o = [HI (MId, MExp o)] data CSPatI o = CSPatConApp (ConstRef o) [CSPat o] | CSPatVar Nat | CSPatExp (MExp o) | CSWith (MExp o) -- always an App | CSAbsurd | CSOmittedArg type Sol o = [(CSCtx o, [CSPat o], Maybe (MExp o))] caseSplitSearch :: forall o . IORef Int -> Int -> [ConstRef o] -> Maybe (EqReasoningConsts o) -> Int -> Int -> ConstRef o -> CSCtx o -> MExp o -> [CSPat o] -> IO [Sol o] caseSplitSearch ticks nsolwanted chints meqr depthinterval depth recdef ctx tt pats = do let branchsearch depth ctx tt termcheckenv = do nsol <- newIORef 1 m <- initMeta sol <- newIORef Nothing let trm = Meta m hsol = do trm' <- expandExp trm writeIORef sol (Just trm') hpartsol = __IMPOSSIBLE__ initcon = mpret $ Sidecondition (localTerminationSidecond termcheckenv recdef trm) ( (case meqr of Nothing -> id Just eqr -> mpret . Sidecondition (calcEqRState eqr trm) ) (tcSearch False (map (\(id, t) -> (id, closify t)) (drophid ctx)) (closify tt) trm) ) recdefd <- readIORef recdef let env = RIEnv {rieHints = (recdef, HMRecCall) : map (\x -> (x, HMNormal)) chints, rieDefFreeVars = cddeffreevars recdefd , rieEqReasoningConsts = meqr } depreached <- topSearch ticks nsol hsol env initcon depth (depth + 1) rsol <- readIORef sol return rsol ctx' = ff 1 ctx ff _ [] = [] ff n (HI hid (id, t) : ctx) = HI hid (id, lift n t) : ff (n + 1) ctx caseSplitSearch' branchsearch depthinterval depth recdef ctx' tt pats caseSplitSearch' :: forall o . (Int -> CSCtx o -> MExp o -> ([Nat], Nat, [Nat]) -> IO (Maybe (MExp o))) -> Int -> Int -> ConstRef o -> CSCtx o -> MExp o -> [CSPat o] -> IO [Sol o] caseSplitSearch' branchsearch depthinterval depth recdef ctx tt pats = do recdefd <- readIORef recdef sols <- rc depth (cddeffreevars recdefd) ctx tt pats return sols where rc :: Int -> Int -> CSCtx o -> MExp o -> [CSPat o] -> IO [Sol o] rc depth _ _ _ _ | depth < 0 = return [] rc depth nscrutavoid ctx tt pats = do mblkvar <- getblks tt fork mblkvar where fork :: [Nat] -> IO [Sol o] fork mblkvar = do sols1 <- dobody case sols1 of (_:_) -> return sols1 [] -> do let r [] = return [] r (v:vs) = do sols2 <- splitvar mblkvar v case sols2 of (_:_) -> return sols2 [] -> r vs r [nv - x | x <- [0..nv]] -- [0..length ctx - 1 - nscrutavoid] where nv = length ctx - 1 dobody :: IO [Sol o] dobody = do case findperm (map snd (drophid ctx)) of Just perm -> do let (ctx', tt', pats') = applyperm perm ctx tt pats res <- branchsearch depth ctx' tt' (localTerminationEnv pats') return $ case res of Just trm -> [[(ctx', pats', Just trm)]] Nothing -> [] Nothing -> __IMPOSSIBLE__ -- no permutation found splitvar :: [Nat] -> Nat -> IO [Sol o] splitvar mblkvar scrut = do let scruttype = infertypevar ctx scrut case rm scruttype of App _ _ (Const c) _ -> do cd <- readIORef c case cdcont cd of Datatype cons _ -> do sols <- dobranches cons return $ map (\sol -> case sol of [] -> case findperm (map snd (drophid ctx)) of Just perm -> let HI scrhid(_, scrt) = ctx !! scrut ctx1 = take scrut ctx ++ (HI scrhid (stringToMyId abspatvarname, scrt)) : drop (scrut + 1) ctx (ctx', _, pats') = applyperm perm ctx1 tt ({-map (replacep scrut 1 CSAbsurd __IMPOSSIBLE__) -}pats) in [(ctx', pats', Nothing)] Nothing -> __IMPOSSIBLE__ -- no permutation found _ -> sol ) sols where dobranches :: [ConstRef o] -> IO [Sol o] dobranches [] = return [[]] dobranches (con : cons) = do cond <- readIORef con let ff t = case rm t of Pi _ h _ it (Abs id ot) -> let (xs, inft) = ff ot in ((Pair h (scrut + length xs), id, lift (scrut + length xs + 1) it) : xs, inft) _ -> ([], lift scrut t) (newvars, inftype) = ff (cdtype cond) constrapp = mm $ App Nothing (mm OKVal) (Const con) (foldl (\xs (Pair h v, _, _) -> mm $ ALCons h (mm $ App Nothing (mm OKVal) (Var v) (mm ALNil)) xs) (mm ALNil) (reverse newvars)) pconstrapp = CSPatConApp con (map (\(Pair hid v, _, _) -> HI hid (CSPatVar v)) newvars) thesub = replace scrut (length newvars) constrapp Id newvarprefix = fst $ (drophid ctx) !! scrut ctx1 = map (\(HI hid (id, t)) -> HI hid (id, thesub t)) (take scrut ctx) ++ reverse (map (\((Pair hid _, id, t), i) -> HI hid (Id (case id of {NoId -> newvarprefix{- ++ show i-}; Id id -> id}), t) ) (zip newvars [0..])) ++ map (\(HI hid (id, t)) -> HI hid (id, thesub t)) (drop (scrut + 1) ctx) tt' = thesub tt pats' = map (replacep scrut (length newvars) pconstrapp constrapp) pats scruttype' = thesub scruttype -- scruttype shouldn't really refer to scrutvar so lift is enough, but what if circular ref has been created and this is not detected until case split is done case unifyexp inftype scruttype' of Nothing -> do res <- notequal scrut (length newvars) scruttype' inftype if res then -- branch absurd dobranches cons else -- branch dont know return [] Just unif -> do let (ctx2, tt2, pats2) = removevar ctx1 tt' pats' unif --cost = if elem scrut mblkvar then costCaseSplit - (costCaseSplit - costCaseSplitFollow) `div` (length mblkvar) else costCaseSplit cost = if null mblkvar then if scrut < length ctx - nscrutavoid && nothid then costCaseSplitLow + costAddVarDepth * depthofvar scrut pats else costCaseSplitVeryHigh else if elem scrut mblkvar then costCaseSplitLow else (if scrut < length ctx - nscrutavoid && nothid then costCaseSplitHigh else costCaseSplitVeryHigh) nothid = let HI hid _ = ctx !! scrut in case hid of {Hidden -> False; Instance -> False; NotHidden -> True} sols <- rc (depth - cost) (length ctx - 1 - scrut) ctx2 tt2 pats2 case sols of [] -> return [] _ -> do sols2 <- dobranches cons return $ concat (map (\sol -> map (\sol2 -> sol ++ sol2) sols2) sols) _ -> return [] -- split failed "scrut type is not datatype" _ -> return [] -- split failed "scrut type is not datatype" infertypevar :: CSCtx o -> Nat -> MExp o infertypevar ctx v = snd $ (drophid ctx) !! v replace :: Nat -> Nat -> MExp o -> MExp o -> MExp o replace sv nnew re = r 0 where r n e = case rm e of App uid ok elr@(Var v) args -> if v >= n then if v - n == sv then betareduce (lift n re) (rs n args) else if v - n > sv then mm $ App uid ok (Var (v + nnew - 1)) (rs n args) else mm $ App uid ok elr (rs n args) else mm $ App uid ok elr (rs n args) App uid ok elr@(Const _) args -> mm $ App uid ok elr (rs n args) Lam hid (Abs mid e) -> mm $ Lam hid (Abs mid (r (n + 1) e)) Pi uid hid possdep it (Abs mid ot) -> mm $ Pi uid hid possdep (r n it) (Abs mid (r (n + 1) ot)) Sort{} -> e AbsurdLambda{} -> e rs n es = case rm es of ALNil -> mm $ ALNil ALCons hid a as -> mm $ ALCons hid (r n a) (rs n as) ALProj{} -> __IMPOSSIBLE__ ALConPar as -> mm $ ALConPar (rs n as) betareduce :: MExp o -> MArgList o -> MExp o betareduce e args = case rm args of ALNil -> e ALCons _ a rargs -> case rm e of App uid ok elr eargs -> mm $ App uid ok elr (concatargs eargs args) Lam _ (Abs _ b) -> betareduce (replace 0 0 a b) rargs _ -> __IMPOSSIBLE__ -- not type correct if this happens ALProj{} -> __IMPOSSIBLE__ ALConPar as -> __IMPOSSIBLE__ concatargs :: MM (ArgList o) (RefInfo o) -> MArgList o -> MArgList o concatargs xs ys = case rm xs of ALNil -> ys ALCons hid x xs -> mm $ ALCons hid x (concatargs xs ys) ALProj{} -> __IMPOSSIBLE__ ALConPar as -> mm $ ALConPar (concatargs xs ys) eqelr :: Elr o -> Elr o -> Bool eqelr (Var v1) (Var v2) = v1 == v2 eqelr (Const c1) (Const c2) = c1 == c2 eqelr _ _ = False replacep :: Nat -> Nat -> CSPatI o -> MExp o -> CSPat o -> CSPat o replacep sv nnew rp re = r where r (HI hid (CSPatConApp c ps)) = HI hid (CSPatConApp c (map r ps)) r (HI hid (CSPatVar v)) = if v == sv then HI hid rp else if v > sv then HI hid (CSPatVar (v + nnew - 1)) else HI hid (CSPatVar v) r (HI hid (CSPatExp e)) = HI hid (CSPatExp $ replace sv nnew re e) r p@(HI _ CSOmittedArg) = p r _ = __IMPOSSIBLE__ -- other constructors dont appear in indata Pats rm :: MM a b -> a rm (NotM x) = x rm (Meta{}) = __IMPOSSIBLE__ mm :: a -> MM a b mm = NotM unifyexp :: MExp o -> MExp o -> Maybe [(Nat, MExp o)] unifyexp e1 e2 = r e1 e2 (\unif -> Just unif) [] where r e1 e2 cont unif = case (rm e1, rm e2) of (App _ _ elr1 args1, App _ _ elr2 args2) | eqelr elr1 elr2 -> rs args1 args2 cont unif (Lam hid1 (Abs _ b1), Lam hid2 (Abs _ b2)) | hid1 == hid2 -> r b1 b2 cont unif (Pi _ hid1 _ it1 (Abs _ ot1), Pi _ hid2 _ it2 (Abs _ ot2)) | hid1 == hid2 -> r it1 it2 (r ot1 ot2 cont) unif (Sort _, Sort _) -> cont unif -- a bit sloppy (App _ _ (Var v) (NotM ALNil), App _ _ (Var u) (NotM ALNil)) | v == u -> cont unif (App _ _ (Var v) (NotM ALNil), _) | elem v (freevars e2) -> Nothing -- Occurs check (_, App _ _ (Var v) (NotM ALNil)) | elem v (freevars e1) -> Nothing -- Occurs check (App _ _ (Var v) (NotM ALNil), _) -> case lookup v unif of Nothing -> cont ((v, e2) : unif) Just e1' -> r e1' e2 cont unif (_, App _ _ (Var v) (NotM ALNil)) -> case lookup v unif of Nothing -> cont ((v, e1) : unif) Just e2' -> r e1 e2' cont unif _ -> Nothing rs args1 args2 cont unif = case (rm args1, rm args2) of (ALNil, ALNil) -> cont unif (ALCons hid1 a1 as1, ALCons hid2 a2 as2) | hid1 == hid2 -> r a1 a2 (rs as1 as2 cont) unif (ALConPar as1, ALCons _ _ as2) -> rs as1 as2 cont unif (ALCons _ _ as1, ALConPar as2) -> rs as1 as2 cont unif (ALConPar as1, ALConPar as2) -> rs as1 as2 cont unif _ -> Nothing lift :: Nat -> MExp o -> MExp o lift 0 = id lift n = r 0 where r j e = case rm e of App uid ok elr args -> case elr of Var v | v >= j -> mm $ App uid ok (Var (v + n)) (rs j args) _ -> mm $ App uid ok elr (rs j args) Lam hid (Abs mid e) -> mm $ Lam hid (Abs mid (r (j + 1) e)) Pi uid hid possdep it (Abs mid ot) -> mm $ Pi uid hid possdep (r j it) (Abs mid (r (j + 1) ot)) Sort{} -> e AbsurdLambda{} -> e rs j es = case rm es of ALNil -> mm $ ALNil ALCons hid a as -> mm $ ALCons hid (r j a) (rs j as) ALProj{} -> __IMPOSSIBLE__ ALConPar as -> mm $ ALConPar (rs j as) removevar :: CSCtx o -> MExp o -> [CSPat o] -> [(Nat, MExp o)] -> (CSCtx o, MExp o, [CSPat o]) removevar ctx tt pats [] = (ctx, tt, pats) removevar ctx tt pats ((v, e) : unif) = let e2 = replace v 0 (__IMPOSSIBLE__ {- occurs check failed -}) e thesub = replace v 0 e2 ctx1 = map (\(HI hid (id, t)) -> HI hid (id, thesub t)) (take v ctx) ++ map (\(HI hid (id, t)) -> HI hid (id, thesub t)) (drop (v + 1) ctx) tt' = thesub tt pats' = map (replacep v 0 (CSPatExp e2) e2) pats unif' = map (\(uv, ue) -> (if uv > v then uv - 1 else uv, thesub ue)) unif in removevar ctx1 tt' pats' unif' notequal :: Nat -> Nat -> MExp o -> MExp o -> IO Bool notequal firstnew nnew e1 e2 = case (rm e1, rm e2) of (App _ _ _ es1, App _ _ _ es2) -> rs es1 es2 (\_ -> return False) [] _ -> __IMPOSSIBLE__ where rs :: MArgList o -> MArgList o -> ([(Nat, MExp o)] -> IO Bool) -> [(Nat, MExp o)] -> IO Bool rs es1 es2 cont unifier2 = case (rm es1, rm es2) of (ALCons _ e1 es1, ALCons _ e2 es2) -> r e1 e2 (rs es1 es2 cont) unifier2 (ALConPar es1, ALConPar es2) -> rs es1 es2 cont unifier2 _ -> cont unifier2 r :: MExp o -> MExp o -> ([(Nat, MExp o)] -> IO Bool) -> [(Nat, MExp o)] -> IO Bool r e1 e2 cont unifier2 = case rm e2 of App _ _ (Var v2) es2 | firstnew <= v2 && v2 < firstnew + nnew -> case rm es2 of ALNil -> case lookup v2 unifier2 of Nothing -> cont ((v2, e1) : unifier2) Just e2' -> cc e1 e2' ALCons{} -> cont unifier2 ALProj{} -> __IMPOSSIBLE__ ALConPar{} -> __IMPOSSIBLE__ _ -> cc e1 e2 where cc e1 e2 = case (rm e1, rm e2) of (App _ _ (Const c1) es1, App _ _ (Const c2) es2) -> do cd1 <- readIORef c1 cd2 <- readIORef c2 case (cdcont cd1, cdcont cd2) of (Constructor{}, Constructor{}) -> if c1 == c2 then rs es1 es2 cont unifier2 else return True _ -> cont unifier2 _ -> cont unifier2 findperm :: [MExp o] -> Maybe [Nat] findperm ts = let frees = map freevars ts m = IntMap.fromList (map (\i -> (i, length (filter (elem i) frees))) [0..length ts - 1]) r _ perm 0 = Just $ reverse perm r m perm n = case lookup 0 (map (\(x,y) -> (y,x)) (IntMap.toList m)) of Nothing -> Nothing Just i -> r (foldl (\m i -> IntMap.adjust (\x -> x - 1) i m) (IntMap.insert i (-1) m) (frees !! i)) (i : perm) (n - 1) in r m [] (length ts) freevars :: MExp o -> [Nat] freevars = f 0 where f n e = case rm e of App _ _ (Var v) args -> union [v - n] (fs n args) App _ _ (Const _) args -> fs n args Lam _ (Abs _ b) -> f (n + 1) b Pi _ _ _ it (Abs _ ot) -> union (f n it) (f (n + 1) ot) Sort{} -> [] AbsurdLambda{} -> [] fs n es = case rm es of ALNil -> [] ALCons _ e es -> union (f n e) (fs n es) ALProj{} -> __IMPOSSIBLE__ ALConPar es -> fs n es applyperm :: [Nat] -> CSCtx o -> MExp o -> [CSPat o] -> (CSCtx o, MExp o, [CSPat o]) applyperm perm ctx tt pats = let ctx1 = map (\(HI hid (id, t)) -> HI hid (id, rename (ren perm) t)) ctx ctx2 = map (\i -> ctx1 !! i) perm ctx3 = seqctx ctx2 tt' = rename (ren perm) tt pats' = map (renamep (ren perm)) pats in (ctx3, tt', pats') ren :: [Nat] -> Nat -> Int ren n i = let Just j = findIndex (== i) n in j rename :: (Nat -> Nat) -> MExp o -> MExp o rename ren = r 0 where r j e = case rm e of App uid ok elr args -> case elr of Var v | v >= j -> mm $ App uid ok (Var (ren (v - j) + j)) (rs j args) _ -> mm $ App uid ok elr (rs j args) Lam hid (Abs mid e) -> mm $ Lam hid (Abs mid (r (j + 1) e)) Pi uid hid possdep it (Abs mid ot) -> mm $ Pi uid hid possdep (r j it) (Abs mid (r (j + 1) ot)) Sort{} -> e AbsurdLambda{} -> e rs j es = case rm es of ALNil -> mm $ ALNil ALCons hid a as -> mm $ ALCons hid (r j a) (rs j as) ALProj{} -> __IMPOSSIBLE__ ALConPar as -> mm $ ALConPar (rs j as) renamep :: (Nat -> Nat) -> CSPat o -> CSPat o renamep ren = r where r (HI hid (CSPatConApp c pats)) = HI hid (CSPatConApp c (map r pats)) r (HI hid (CSPatVar i)) = HI hid (CSPatVar $ ren i) r (HI hid (CSPatExp e)) = HI hid (CSPatExp $ rename ren e) r p@(HI _ CSOmittedArg) = p r _ = __IMPOSSIBLE__ seqctx :: CSCtx o -> CSCtx o seqctx = r (-1) where r _ [] = [] r n (HI hid (id, t) : ctx) = HI hid (id, lift n t) : r (n - 1) ctx -- -------------------- depthofvar :: Nat -> [CSPat o] -> Nat depthofvar v pats = let [depth] = concatMap (f 0) (drophid pats) f d (CSPatConApp _ pats) = concatMap (f (d + 1)) (drophid pats) f d (CSPatVar v') = if v == v' then [d] else [] f _ _ = [] in depth -- -------------------- localTerminationEnv :: [CSPat o] -> ([Nat], Nat, [Nat]) localTerminationEnv pats = let g _ [] = ([], 0, []) g i (hp@(HI _ p) : ps) = case p of CSPatConApp{} -> let (size, vars) = h hp (is, size', vars') = g (i + 1) ps in (i : is, size + size', vars ++ vars') _ -> g (i + 1) ps h (HI _ p) = case p of CSPatConApp c ps -> let (size, vars) = hs ps in (size + 1, vars) CSPatVar n -> (0, [n]) CSPatExp e -> he e _ -> (0, []) hs [] = (0, []) hs (p : ps) = let (size, vars) = h p (size', vars') = hs ps in (size + size', vars ++ vars') he e = case rm e of App _ _ (Var v) _ -> (0, [v]) App _ _ (Const _) args -> let (size, vars) = hes args in (size + 1, vars) _ -> (0, []) hes as = case rm as of ALNil -> (0, []) ALCons _ a as -> let (size, vars) = he a (size', vars') = hes as in (size + size', vars ++ vars') ALProj{} -> __IMPOSSIBLE__ ALConPar as -> hes as in g 0 pats localTerminationSidecond :: ([Nat], Nat, [Nat]) -> ConstRef o -> MExp o -> EE (MyPB o) localTerminationSidecond (is, size, vars) reccallc b = ok b where ok e = mmpcase (False, prioNo, Nothing) e $ \e -> case e of App _ _ elr args -> mpret $ Sidecondition (oks args) (case elr of Const c | c == reccallc -> if size == 0 then mpret (Error "localTerminationSidecond: no size to decrement") else okcall 0 size vars args _ -> mpret OK ) Lam _ (Abs _ e) -> ok e Pi _ _ _ it (Abs _ ot) -> mpret $ Sidecondition (ok it) (ok ot) Sort{} -> mpret OK AbsurdLambda{} -> mpret OK oks as = mmpcase (False, prioNo, Nothing) as $ \as -> case as of ALNil -> mpret OK ALCons _ a as -> mpret $ Sidecondition (ok a) (oks as) ALProj eas _ _ as -> mpret $ Sidecondition (oks eas) (oks as) ALConPar as -> oks as okcall i size vars as = mmpcase (False, prioNo, Nothing) as $ \as -> case as of ALNil -> mpret OK ALCons _ a as | elem i is -> mbpcase prioNo Nothing (he size vars a) $ \x -> case x of Nothing -> mpret $ Error "localTerminationSidecond: reccall not ok" Just (size', vars') -> okcall (i + 1) size' vars' as ALCons _ a as -> okcall (i + 1) size vars as ALProj{} -> mpret OK ALConPar as -> __IMPOSSIBLE__ he size vars e = mmcase e $ \e -> case e of App _ _ (Var v) _ -> case remove v vars of Nothing -> mbret Nothing Just vars' -> mbret $ Just (size, vars') App _ _ (Const c) args -> do cd <- readIORef c case cdcont cd of Constructor{} -> if size == 1 then mbret Nothing else hes (size - 1) vars args _ -> mbret Nothing _ -> mbret Nothing hes size vars as = mmcase as $ \as -> case as of ALNil -> mbret $ Just (size, vars) ALCons _ a as -> mbcase (he size vars a) $ \x -> case x of Nothing -> mbret Nothing Just (size', vars') -> hes size' vars' as ALProj{} -> __IMPOSSIBLE__ ALConPar as -> __IMPOSSIBLE__ remove _ [] = Nothing remove x (y : ys) | x == y = Just ys remove x (y : ys) = case remove x ys of {Nothing -> Nothing; Just ys' -> Just (y : ys')} -- --------------------------- getblks :: MExp o -> IO [Nat] getblks tt = do NotB (hntt, blks) <- hnn_blks (Clos [] tt) case f blks of Just v -> return [v] Nothing -> case hntt of HNApp _ (Const c) args -> do cd <- readIORef c case cdcont cd of Datatype{} -> g [] args _ -> return [] _ -> return [] where f blks = case blks of (_:_) -> case last blks of HNApp _ (Var v) _ -> Just v _ -> Nothing _ -> Nothing g vs args = do NotB hnargs <- hnarglist args case hnargs of HNALCons _ a as -> do NotB (_, blks) <- hnn_blks a let vs' = case f blks of Just v | v `notElem` vs -> v : vs _ -> vs g vs' as _ -> return vs -- --------------------------- Agda-2.4.2.5/src/full/Agda/Auto/Typecheck.hs0000644000000000000000000007557012635075266016506 0ustar0000000000000000{-# LANGUAGE CPP #-} {-# LANGUAGE ExistentialQuantification #-} {-# LANGUAGE FlexibleContexts #-} {-# LANGUAGE ScopedTypeVariables #-} module Agda.Auto.Typecheck where import Data.IORef import Control.Monad (liftM) import Agda.Auto.NarrowingSearch import Agda.Auto.Syntax import Agda.Auto.SearchControl #include "undefined.h" import Agda.Utils.Impossible -- --------------------------------- -- | Typechecker drives the solution of metas. tcExp :: Bool -> Ctx o -> CExp o -> MExp o -> EE (MyPB o) tcExp isdep ctx typ@(TrBr typtrs ityp@(Clos _ itypexp)) trm = mbpcase prioTypeUnknown Nothing (hnn_checkstep ityp) $ \(hntyp, iotastepdone) -> mmpcase (True, prioTypecheck isdep, Just (RIMainInfo (length ctx) hntyp iotastepdone)) trm $ \trm -> case trm of App _ okh elr args -> case hntyp of HNPi{} | isdep -> mpret $ Error "tcExp, dep terms should be eta-long" _ -> do (ityp, sc) <- case elr of Var v -> -- assuming within scope return (weak (v + 1) (snd $ ctx !! v), id) Const c -> do cdef <- readIORef c return (closify (cdtype cdef), \x -> mpret $ And (Just [Term args]) (noiotastep_term c args) x) ndfv <- case elr of Var{} -> return 0 Const c -> readIORef c >>= \cd -> return (cddeffreevars cd) isconstructor <- case elr of Var{} -> return False Const c -> do cdef <- readIORef c return $ case cdcont cdef of {Constructor{} -> True; _ -> False} sc $ tcargs ndfv isdep ctx ityp args (NotM $ App Nothing (NotM OKVal) elr (NotM ALNil)) isconstructor $ \ityp _ -> mpret $ ConnectHandle okh (comp' True typ ityp) Lam hid (Abs id1 b) -> case hntyp of HNPi _ hid2 _ it (Abs id2 ot) | hid == hid2 -> tcExp isdep ((pickid id1 id2, t it) : ctx) (t ot) b _ -> mpret $ Error "tcExp, type of lam should be fun or pi (and same hid)" Pi _ _ _ it (Abs id ot) -> case hntyp of HNSort s -> mpret $ And (Just [Term ctx, Term it]) (tcExp True ctx (closify (NotM $ Sort s)) it) (tcExp isdep ((id, closify it) : ctx) (closify (NotM $ Sort s)) ot) _ -> mpret $ Error "tcExp, type of pi should be set" Sort (Set i) -> case hntyp of HNSort s2 -> case s2 of Set j -> mpret $ if i < j then OK else Error "tcExp, type of set should be larger set" UnknownSort -> mpret OK -- mpret $ Error "tcExp, type of set i unknown sort" -- OK instead? (prev __IMPOSSIBLE__) Type -> mpret OK _ -> mpret $ Error "tcExp, type of set should be set" Sort UnknownSort -> __IMPOSSIBLE__ Sort Type -> __IMPOSSIBLE__ AbsurdLambda hid -> case hntyp of HNPi _ hid2 _ it _ | hid == hid2 -> mbpcase prioAbsurdLambda Nothing (getDatatype it) $ \res -> case res of Just (indeces, cons) -> foldl (\p con -> mpret $ And Nothing p ( constructorImpossible indeces con )) (mpret OK) cons Nothing -> mpret $ Error "tcExp, absurd lambda, datatype needed" _ -> mpret $ Error "tcExp, type of absurd lam should be fun or pi (and same hid)" where t = TrBr typtrs getDatatype :: ICExp o -> EE (MyMB (Maybe (ICArgList o, [ConstRef o])) o) getDatatype t = mbcase (hnn t) $ \hnt -> case hnt of HNApp _ (Const c) args -> do cd <- readIORef c case cdcont cd of Datatype cons _ -> mbret $ Just (args, cons) -- ?? check that lenth args corresponds to type of datatype _ -> mbret Nothing _ -> mbret Nothing constructorImpossible :: ICArgList o -> ConstRef o -> EE (MyPB o) constructorImpossible args c = do cd <- readIORef c mbpcase prioAbsurdLambda Nothing (traversePi (-1) (Clos [] $ cdtype cd)) $ \hnot -> case hnot of HNApp _ _ args2 -> unequals args args2 (\_ -> mpret $ Error "not unequal") [] _ -> mpret $ Error "constructorImpossible 1" unequals :: ICArgList o -> ICArgList o -> ([(Nat, HNExp o)] -> EE (MyPB o)) -> [(Nat, HNExp o)] -> EE (MyPB o) unequals es1 es2 cont unifier2 = mbpcase prioAbsurdLambda Nothing (hnarglist es1) $ \hnes1 -> mbpcase prioAbsurdLambda Nothing (hnarglist es2) $ \hnes2 -> case (hnes1, hnes2) of (HNALCons _ e1 es1, HNALCons _ e2 es2) -> unequal e1 e2 (unequals es1 es2 cont) unifier2 (HNALConPar es1, HNALConPar es2) -> unequals es1 es2 cont unifier2 _ -> cont unifier2 unequal :: ICExp o -> ICExp o -> ([(Nat, HNExp o)] -> EE (MyPB o)) -> [(Nat, HNExp o)] -> EE (MyPB o) unequal e1 e2 cont unifier2 = mbpcase prioAbsurdLambda Nothing (hnn e1) $ \hne1 -> mbpcase prioAbsurdLambda Nothing (hnn e2) $ \hne2 -> case hne2 of HNApp _ (Var v2) es2 | v2 < 0 -> mbpcase prioAbsurdLambda Nothing (hnarglist es2) $ \hnes2 -> case hnes2 of HNALNil -> case lookup v2 unifier2 of Nothing -> cont ((v2, hne1) : unifier2) Just hne2' -> cc hne1 hne2' HNALCons{} -> cont unifier2 HNALConPar{} -> __IMPOSSIBLE__ _ -> cc hne1 hne2 where cc hne1 hne2 = case (hne1, hne2) of (HNApp _ (Const c1) es1, HNApp _ (Const c2) es2) -> do cd1 <- readIORef c1 cd2 <- readIORef c2 case (cdcont cd1, cdcont cd2) of (Constructor{}, Constructor{}) -> if c1 == c2 then unequals es1 es2 cont unifier2 else mpret OK _ -> cont unifier2 _ -> cont unifier2 traversePi :: Int -> ICExp o -> EE (MyMB (HNExp o) o) traversePi v t = mbcase (hnn t) $ \hnt -> case hnt of HNPi _ _ _ _ (Abs _ ot) -> traversePi (v - 1) (subi (NotM $ App Nothing (NotM OKVal) (Var v) (NotM ALNil)) ot) _ -> mbret hnt tcargs :: Nat -> Bool -> Ctx o -> CExp o -> MArgList o -> MExp o -> Bool -> (CExp o -> MExp o -> EE (MyPB o)) -> EE (MyPB o) tcargs ndfv isdep ctx ityp@(TrBr ityptrs iityp) args elimtrm isconstructor cont = mmpcase (True, prioTypecheckArgList, (Just $ RICheckElim $ isdep || isconstructor)) args $ \args' -> case args' of ALNil -> cont ityp elimtrm ALCons hid a as -> mbpcase prioInferredTypeUnknown (Just RIInferredTypeUnknown) (hnn iityp) $ \hnityp -> case hnityp of HNPi _ hid2 possdep it (Abs _ ot) | ndfv > 0 || copyarg a || hid == hid2 -> mpret $ And (Just ((if possdep then [Term a] else []) ++ [Term ctx, Term ityptrs])) (if ndfv > 0 then mpret OK else (tcExp (isdep || possdep) ctx (t it) a)) (tcargs (ndfv - 1) isdep ctx (sub a (t ot)) as (addend hid a elimtrm) isconstructor cont) _ -> mpret $ Error "tcargs, inf type should be fun or pi (and same hid)" ALProj{} | ndfv > 0 -> __IMPOSSIBLE__ ALProj preas projidx hid as -> mbpcase prioInferredTypeUnknown (Just RIInferredTypeUnknown) (hnn iityp) $ \hnityp -> case hnityp of HNApp _ (Const dd) _ -> do dddef <- readIORef dd case cdcont dddef of Datatype _ projs -> mmpcase (True, prioProjIndex, Just (RICheckProjIndex projs)) projidx $ \projidx -> do projd <- readIORef projidx tcargs (cddeffreevars projd) isdep ctx (closify $ cdtype projd) preas (NotM $ App Nothing (NotM OKVal) (Const projidx) (NotM ALNil)) True $ \ityp2@(TrBr ityp2trs iityp2) elimtrm2 -> case iityp2 of Clos _ (NotM (Pi _ _ _ (NotM (App _ _ (Const dd2) _)) _)) | dd2 == dd -> mbpcase prioInferredTypeUnknown (Just RIInferredTypeUnknown) (hnn iityp2) $ \hnityp2 -> case hnityp2 of HNPi _ hid2 possdep it (Abs _ ot) | hid == hid2 -> mpret $ And Nothing (comp' True (TrBr ityp2trs it) ityp) (tcargs 0 isdep ctx (sub elimtrm (t ot)) as (addend hid elimtrm elimtrm2) isconstructor cont) _ -> mpret $ Error "proj function type is not a Pi" _ -> mpret $ Error "proj function type is not correct" _ -> mpret $ Error "proj, not a datatype" _ -> mpret $ Error "proj, not a const app" ALConPar _ -> __IMPOSSIBLE__ where t = TrBr ityptrs addend :: FMode -> MExp o -> MM (Exp o) blk -> MM (Exp o) blk addend hid a (NotM (App uid okh elr as)) = NotM $ App uid okh elr (f as) where f (NotM ALNil) = NotM $ ALCons hid a (NotM $ ALNil) f (NotM (ALCons hid a as)) = NotM $ ALCons hid a (f as) f _ = __IMPOSSIBLE__ addend _ _ _ = __IMPOSSIBLE__ copyarg :: MExp o -> Bool copyarg _ = False -- --------------------------------- type HNNBlks o = [HNExp o] noblks :: HNNBlks o noblks = [] addblk :: HNExp o -> HNNBlks o -> HNNBlks o addblk = (:) hnn :: ICExp o -> EE (MyMB (HNExp o) o) hnn e = mbcase (hnn_blks e) $ \(hne, _) -> mbret hne hnn_blks :: ICExp o -> EE (MyMB (HNExp o, HNNBlks o) o) hnn_blks e = hnn' e CALNil hnn_checkstep :: ICExp o -> EE (MyMB (HNExp o, Bool) o) hnn_checkstep e = mbcase (hnb e CALNil) $ \hne -> mbcase (iotastep True hne) $ \res -> case res of Right _ -> mbret (hne, False) Left (e, as) -> mbcase (hnn' e as) $ \(hne, _) -> mbret (hne, True) hnn' :: ICExp o -> ICArgList o -> EE (MyMB (HNExp o, HNNBlks o) o) hnn' e as = mbcase (hnb e as) $ \hne -> mbcase (iotastep True hne) $ \res -> case res of Right blks -> mbret (hne, blks) Left (e, as) -> hnn' e as hnb :: ICExp o -> ICArgList o -> EE (MyMB (HNExp o) o) hnb e as = mbcase (hnc False e as []) $ \res -> case res of HNDone _ hne -> mbret hne HNMeta{} -> __IMPOSSIBLE__ data HNRes o = HNDone (Maybe (Metavar (Exp o) (RefInfo o))) (HNExp o) | HNMeta (ICExp o) (ICArgList o) [Maybe (UId o)] hnc :: Bool -> ICExp o -> ICArgList o -> [Maybe (UId o)] -> EE (MyMB (HNRes o) o) hnc haltmeta = loop where loop ce@(Clos cl e) cargs seenuids = (if haltmeta then mmmcase e (mbret $ HNMeta ce cargs seenuids) else mmcase e) $ \ee -> case ee of App uid okh elr args -> let ncargs = CALConcat (Clos cl args) cargs in case elr of Var v -> case doclos cl v of Left v' -> mbret $ HNDone expmeta (HNApp (uid : seenuids) (Var v') ncargs) Right f -> loop f ncargs (uid : seenuids) Const _ -> mbret $ HNDone expmeta (HNApp (uid : seenuids) elr ncargs) Lam hid (Abs id b) -> mbcase (hnarglist cargs) $ \hncargs -> case hncargs of HNALNil -> mbret $ HNDone expmeta (HNLam seenuids hid (Abs id (Clos (Skip : cl) b))) HNALCons _ arg cargs' -> loop (Clos (Sub arg : cl) b) cargs' seenuids HNALConPar{} -> __IMPOSSIBLE__ Pi uid hid possdep it (Abs id ot) -> checkNoArgs cargs $ mbret $ HNDone expmeta (HNPi (uid : seenuids) hid possdep (Clos cl it) (Abs id (Clos (Skip : cl) ot))) Sort s -> checkNoArgs cargs $ mbret $ HNDone expmeta (HNSort s) AbsurdLambda{} -> mbfailed "hnc: encountered absurdlambda" where expmeta = case e of {Meta m -> Just m; NotM _ -> Nothing} checkNoArgs cargs c = mbcase (hnarglist cargs) $ \hncargs -> case hncargs of HNALNil -> c HNALCons{} -> mbfailed "hnc: there should be no args" HNALConPar{} -> __IMPOSSIBLE__ hnarglist :: ICArgList o -> EE (MyMB (HNArgList o) o) hnarglist args = case args of CALNil -> mbret HNALNil CALConcat (Clos cl args) args2 -> mmcase args $ \args -> case args of ALNil -> hnarglist args2 ALCons hid arg argsb -> mbret $ HNALCons hid (Clos cl arg) (CALConcat (Clos cl argsb) args2) ALProj{} -> mbret HNALNil -- dirty hack to make check of no-iota in term work ALConPar args -> mbret $ HNALConPar (CALConcat (Clos cl args) args2) -- ----------------------------- getNArgs :: Nat -> ICArgList o -> EE (MyMB (Maybe ([ICExp o], ICArgList o)) o) getNArgs 0 args = mbret $ Just ([], args) getNArgs narg args = mbcase (hnarglist args) $ \hnargs -> case hnargs of HNALNil -> mbret Nothing HNALCons _ arg args' -> mbcase (getNArgs (narg - 1) args') $ \res -> case res of Nothing -> mbret Nothing Just (pargs, rargs) -> mbret $ Just (arg : pargs, rargs) HNALConPar{} -> __IMPOSSIBLE__ getAllArgs :: ICArgList o -> EE (MyMB [ICExp o] o) getAllArgs args = mbcase (hnarglist args) $ \hnargs -> case hnargs of HNALNil -> mbret [] HNALCons _ arg args' -> mbcase (getAllArgs args') $ \args'' -> mbret (arg : args'') HNALConPar args2 -> mbcase (getAllArgs args2) $ \args3 -> mbret (__IMPOSSIBLE__ : args3) data PEval o = PENo (ICExp o) | PEConApp (ICExp o) (ConstRef o) [PEval o] iotastep :: Bool -> HNExp o -> EE (MyMB (Either (ICExp o, ICArgList o) (HNNBlks o)) o) iotastep smartcheck e = case e of HNApp _ (Const c) args -> do cd <- readIORef c case cdcont cd of Def narg cls _ _ -> mbcase (getNArgs narg args) $ \res -> case res of Nothing -> mbret (Right noblks) Just (pargs, rargs) -> mbcase (dorules cls (map PENo pargs)) $ \res -> case res of Right blks -> mbret (Right blks) Left rhs -> mbret $ Left (rhs, rargs) _ -> mbret $ Right noblks _ -> mbret $ Right noblks where dorules :: [Clause o] -> [PEval o] -> EE (MyMB (Either (ICExp o) (HNNBlks o)) o) dorules [] _ = mbret $ Right noblks dorules (rule:rules') as = mbcase (dorule rule as) $ \x -> case x of Left (Left as') -> dorules rules' as' Left (Right blks) -> mbret (Right blks) Right rhs -> mbret $ Left rhs dorule :: Clause o -> [PEval o] -> EE (MyMB (Either (Either [PEval o] (HNNBlks o)) (ICExp o)) o) dorule (pats, rhs) as = mbcase (dopats pats as) $ \x -> case x of Right (_, ss) -> mbret $ Right (Clos (map Sub ss) rhs) Left hnas -> mbret $ Left hnas dopats :: [Pat o] -> [PEval o] -> EE (MyMB (Either (Either [PEval o] (HNNBlks o)) ([PEval o], [ICExp o])) o) dopats [] [] = mbret $ Right ([], []) dopats (p:ps') (a:as') = mbcase (dopat p a) $ \x -> case x of Right (hna, ss) -> mbcase (dopats ps' as') $ \x -> case x of Right (hnas, ss2) -> mbret $ Right (hna : hnas, ss2 ++ ss) Left (Right blks) -> mbret $ Left (Right blks) Left (Left hnas) -> mbret $ Left $ Left (hna : hnas) Left (Right blks) -> mbret $ Left (Right blks) Left (Left hna) -> mbret $ Left $ Left (hna : as') dopats _ _ = __IMPOSSIBLE__ dopat :: Pat o -> PEval o -> EE (MyMB (Either (Either (PEval o) (HNNBlks o)) (PEval o, [ICExp o])) o) dopat (PatConApp c pas) a = case a of PENo a -> if smartcheck then mbcase (meta_not_constructor a) $ \notcon -> if notcon then mbret $ Left $ Right noblks else qq -- to know more often if iota step is possible else qq where qq = mbcase (hnn_blks a) $ \(hna, blks) -> case hna of HNApp _ (Const c') as -> if c == c' then mbcase (getAllArgs as) $ \as' -> if length as' == length pas then mbcase (dopats pas (map PENo as')) $ \x -> case x of Right (hnas, ss) -> mbret $ Right (PEConApp a c' hnas, ss) Left (Right blks) -> mbret $ Left (Right blks) Left (Left hnas) -> mbret $ Left $ Left (PEConApp a c' hnas) else mbfailed "dopat: wrong amount of args" else do cd <- readIORef c' case cdcont cd of Constructor{} -> mbcase (getAllArgs as) $ \as' -> mbret $ Left (Left (PEConApp a c' (map PENo as'))) _ -> mbret $ Left (Right (addblk hna blks)) _ -> mbret $ Left (Right (addblk hna blks)) aa@(PEConApp a c' as) -> if c == c' then if length as == length pas then mbcase (dopats pas as) $ \x -> case x of Right (hnas, ss) -> mbret $ Right (PEConApp a c' hnas, ss) Left (Right blks) -> mbret $ Left (Right blks) Left (Left hnas) -> mbret $ Left $ Left (PEConApp a c' hnas) else mbfailed "dopat: wrong amount of args" else mbret $ Left (Left aa) dopat PatVar{} a@(PENo a') = mbret $ Right (a, [a']) dopat PatVar{} a@(PEConApp a' _ _) = mbret $ Right (a, [a']) dopat PatExp a = mbret $ Right (a, []) -- ----------------------------- noiotastep :: HNExp o -> EE (MyPB o) noiotastep hne = mbpcase prioNoIota Nothing (iotastep False hne) $ \res -> case res of Left _ -> mpret $ Error "iota step possible contrary to assumed" Right _ -> mpret OK noiotastep_term :: ConstRef o -> MArgList o -> EE (MyPB o) noiotastep_term c args = f (HNApp [] (Const c) (CALConcat (Clos [] args) CALNil)) where f hne@(HNApp _ (Const c) _) = do cd <- readIORef c let isshorthand = case cdcont cd of Def _ [(pats, _)] _ _ -> True -- all (\pat -> case pat of {PatConApp{} -> False; _ -> True}) pats _ -> False if isshorthand then mpret OK else noiotastep hne f _ = __IMPOSSIBLE__ data CMode o = CMRigid (Maybe (Metavar (Exp o) (RefInfo o))) (HNExp o) | forall b . Refinable b (RefInfo o) => CMFlex (MM b (RefInfo o)) (CMFlex o) data CMFlex o = CMFFlex (ICExp o) (ICArgList o) [Maybe (UId o)] | CMFSemi (Maybe (Metavar (Exp o) (RefInfo o))) (HNExp o) | CMFBlocked (Maybe (Metavar (Exp o) (RefInfo o))) (HNExp o) comp' :: forall o . Bool -> CExp o -> CExp o -> EE (MyPB o) comp' ineq lhs@(TrBr trs1 e1) rhs@(TrBr trs2 e2) = comp ineq e1 e2 where comp :: Bool -> ICExp o -> ICExp o -> EE (MyPB o) comp ineq e1 e2 = proc e1 e2 where proc e1 e2 = f True e1 CALNil [] $ \res1 -> f True e2 CALNil [] $ \res2 -> g res1 res2 f semifok e as seenuids cont = mbpcase prioCompBeta Nothing (hnc True e as seenuids) $ \res -> case res of HNDone mexpmeta hne -> fhn semifok mexpmeta hne cont HNMeta ce@(Clos cl m) cargs seenuids -> do b1 <- boringClos cl b2 <- boringArgs cargs if b1 && b2 then cont $ CMFlex m (CMFFlex ce cargs seenuids) else mbpcase prioCompBetaStructured Nothing (hnc False ce cargs seenuids) $ \res -> case res of HNDone mexpmeta hne -> cont $ CMFlex m (CMFBlocked mexpmeta hne) HNMeta{} -> __IMPOSSIBLE__ fhn semifok mexpmeta hne cont = mmbpcase (iotastep True hne) (\m -> do sf <- return False {- semiflex hne -} if semifok && sf then cont (CMFlex m (CMFSemi mexpmeta hne)) else cont (CMFlex m (CMFBlocked mexpmeta hne)) ) (\res -> case res of Right _ -> cont (CMRigid mexpmeta hne) Left (e, as) -> f semifok e as [] cont ) g res1 res2 = case (res1, res2) of (CMRigid mexpmeta1 hne1, CMRigid mexpmeta2 hne2) -> comphn ineq mexpmeta1 hne1 mexpmeta2 hne2 (CMFlex m1 (CMFBlocked mexpmeta1 hne1), _) -> mstp False mexpmeta1 hne1 $ \res1 -> g res1 res2 (_, CMFlex m2 (CMFBlocked mexpmeta2 hne2)) -> mstp False mexpmeta2 hne2 $ \res2 -> g res1 res2 (CMRigid mexpmeta1 hne1, CMFlex _ fl2) -> unif True mexpmeta1 hne1 fl2 (CMFlex _ fl1, CMRigid mexpmeta2 hne2) -> unif False mexpmeta2 hne2 fl1 (CMFlex m1 fl1, CMFlex m2 fl2) -> doubleblock m1 m2 $ fcm fl1 $ \res1 -> fcm fl2 $ \res2 -> g res1 res2 fcm (CMFFlex ce cargs seenuids) = f True ce cargs seenuids fcm (CMFSemi mexpmeta hne) = fhn True mexpmeta hne fcm (CMFBlocked _ hne) = __IMPOSSIBLE__ -- not used. if so should be: fhn False hne mstp semif mexpmeta hne cont = mpret $ Or prioCompChoice (mpret $ And (Just [Term lhs, Term rhs]) (noiotastep hne) (cont (CMRigid mexpmeta hne)) ) (stp semif hne cont) stp semif hne cont = mbpcase prioCompIota (Just $ RIIotaStep semif) (iotastep True hne) $ \res -> case res of Right _ -> mpret $ Error "no iota step possible, contrary to assumed" Left (e, as) -> f semif e as [] cont unif oppis1 oppmexpmeta opphne res = let iter res = if oppis1 then g (CMRigid oppmexpmeta opphne) res else g res (CMRigid oppmexpmeta opphne) in case res of CMFFlex ce cargs seenuids -> do poss <- iotapossmeta ce cargs maybeor poss prioCompChoice (loop ce cargs seenuids) -- (mbpcase prioCompBeta (Just $ RIIotaStep False) (hnb ce cargs) $ \hne -> (mbpcase prioCompBeta (Just $ RIIotaStep False) (hnc False ce cargs seenuids) $ \res -> -- RIIotaStep here on beta-norm to make cost high when guessing elim const in type par case res of HNDone mexpmeta hne -> stp False hne iter HNMeta{} -> __IMPOSSIBLE__ ) where loop ce@(Clos cl m) cargs seenuids = mmpcase (False, prioCompUnif, Just (RIUnifInfo cl opphne)) m $ \_ -> mbpcase prioCompBeta Nothing (hnc True ce cargs seenuids) $ \res -> case res of HNDone mexpmeta hne -> mpret $ And (Just [Term lhs, Term rhs]) (noiotastep hne) (iter (CMRigid mexpmeta hne)) HNMeta ce cargs seenuids -> loop ce cargs seenuids CMFSemi _ hne -> __IMPOSSIBLE__ -- CMFSemi disabled, if used should be: stp True hne iter CMFBlocked{} -> __IMPOSSIBLE__ comphn :: Bool -> Maybe (Metavar (Exp o) (RefInfo o)) -> HNExp o -> Maybe (Metavar (Exp o) (RefInfo o)) -> HNExp o -> EE (MyPB o) comphn ineq mexpmeta1 hne1 mexpmeta2 hne2 = case (hne1, hne2) of (HNApp _ elr1 args1, HNApp _ elr2 args2) -> let ce = case (elr1, elr2) of (Var v1, Var v2) -> if v1 == v2 then Nothing else Just "comphn, elr, vars not equal" (Const c1, Const c2) -> if c1 == c2 then Nothing else Just "comphn, elr, consts not equal" (_, _) -> Just "comphn, elrs not equal" in case ce of Nothing -> compargs args1 args2 Just msg -> mpret $ Error msg (HNLam _ hid1 (Abs id1 b1), HNLam _ hid2 (Abs id2 b2)) -> comp False b1 b2 (HNLam seenuids _ (Abs _ b1), HNApp uid2 elr2 args2) -> f True b1 CALNil seenuids $ \res1 -> fhn True mexpmeta2 (HNApp uid2 (weakelr 1 elr2) (addtrailingargs (Clos [] $ NotM $ ALCons NotHidden{- arbitrary -} (NotM $ App Nothing (NotM OKVal) (Var 0) (NotM ALNil)) (NotM ALNil)) (weakarglist 1 args2))) $ \res2 -> g res1 res2 (HNApp uid1 elr1 args1, HNLam seenuids _ (Abs _ b2)) -> fhn True mexpmeta1 (HNApp uid1 (weakelr 1 elr1) (addtrailingargs (Clos [] $ NotM $ ALCons NotHidden{- arbitrary -} (NotM $ App Nothing (NotM OKVal) (Var 0) (NotM ALNil)) (NotM ALNil)) (weakarglist 1 args1))) $ \res1 -> f True b2 CALNil seenuids $ \res2 -> g res1 res2 {- (HNLam _ (Abs _ b1), HNApp uid2 elr2 args2) -> f True b1 CALNil $ \res1 -> g res1 (CMRigid mexpmeta2 (HNApp uid2 (weakelr 1 elr2) (addtrailingargs (Clos [] $ NotM $ ALCons NotHidden{- arbitrary -} (NotM $ App Nothing (NotM OKVal) (Var 0) (NotM ALNil)) (NotM ALNil)) (weakarglist 1 args2)))) (HNApp uid1 elr1 args1, HNLam _ (Abs _ b2)) -> f True b2 CALNil $ \res2 -> g (CMRigid mexpmeta1 (HNApp uid1 (weakelr 1 elr1) (addtrailingargs (Clos [] $ NotM $ ALCons NotHidden{- arbitrary -} (NotM $ App Nothing (NotM OKVal) (Var 0) (NotM ALNil)) (NotM ALNil)) (weakarglist 1 args1)))) res2 -} (HNPi _ hid1 _ it1 (Abs id1 ot1), HNPi _ hid2 _ it2 (Abs id2 ot2)) -> mpret $ And (Just [Term trs1, Term trs2]) (comp False it1 it2) (comp ineq ot1 ot2) (HNSort s1, HNSort s2) -> mpret $ case (s1, s2) of (Set i1, Set i2) -> if i1 == i2 || ineq && i1 > i2 then OK else Error "comphn, set levels not matching" (Set _, UnknownSort) -> OK (UnknownSort, Set _) -> OK (UnknownSort, UnknownSort) -> OK (Type, Set _) | ineq -> OK (Type, UnknownSort) | ineq -> OK _ -> __IMPOSSIBLE__ (HNApp uid1 (Const c1) _, _) -> case mexpmeta2 of Nothing -> mpret $ Error "comphn, not equal (2)" Just m2 -> mpret $ AddExtraRef "comphn: not equal, adding extra ref" m2 (extraref m2 uid1 c1) (_, HNApp uid2 (Const c2) _) -> case mexpmeta1 of Nothing -> mpret $ Error "comphn, not equal (3)" Just m1 -> mpret $ AddExtraRef "comphn: not equal, adding extra ref" m1 (extraref m1 uid2 c2) (_, _) -> mpret $ Error "comphn, not equal" compargs :: ICArgList o -> ICArgList o -> EE (MyPB o) compargs args1 args2 = mbpcase prioCompareArgList Nothing (hnarglist args1) $ \hnargs1 -> mbpcase prioCompareArgList Nothing (hnarglist args2) $ \hnargs2 -> case (hnargs1, hnargs2) of (HNALNil, HNALNil) -> mpret OK (HNALCons hid1 arg1 args1b, HNALCons hid2 arg2 args2b) -> mpret $ And (Just [Term trs1, Term trs2]) (comp False arg1 arg2) (compargs args1b args2b) (HNALConPar args1b, HNALCons _ _ args2b) -> compargs args1b args2b (HNALCons _ _ args1b, HNALConPar args2b) -> compargs args1b args2b (HNALConPar args1', HNALConPar args2') -> compargs args1' args2' (_, _) -> mpret $ Error $ "comphnargs, not equal" boringExp :: ICExp o -> EE Bool boringExp (Clos cl e) = do e <- expandbind e case e of Meta{} -> boringClos cl NotM e -> case e of App _ _ (Var v) as -> do as <- expandbind as case as of Meta{} -> return False NotM as -> case as of ALNil -> case doclos cl v of Left _ -> return True Right e -> boringExp e ALCons{} -> return False ALProj{} -> return False ALConPar{} -> return False _ -> return False boringClos :: [CAction o] -> EE Bool boringClos cl = liftM (all id) $ mapM f cl where f (Sub e) = boringExp e f Skip = return True f (Weak _) = return True boringArgs :: ICArgList o -> EE Bool boringArgs CALNil = return True boringArgs (CALConcat (Clos cl as) as2) = do b1 <- f cl as b2 <- boringArgs as2 return $ b1 && b2 where f cl as = do as <- expandbind as case as of Meta{} -> return False NotM as -> case as of ALNil -> return True ALCons _ a as -> do b1 <- boringExp (Clos cl a) b2 <- f cl as return $ b1 && b2 ALProj{} -> __IMPOSSIBLE__ ALConPar as -> f cl as -- --------------------------------- checkeliminand :: MExp o -> EE (MyPB o) checkeliminand = f [] [] where f uids used e = mmpcase (False, prioNo, Just (RIUsedVars uids used)) e $ \e -> case e of App uid _ elr@(Var{}) args -> fs (adduid uid uids) (elr : used) args App uid _ elr@(Const c) args -> do cd <- readIORef c case cdcont cd of Def _ _ (Just i) _ -> mpret $ Sidecondition (fs (adduid uid uids) (elr : used) args) (g i args) where g i as = mmpcase (False, prioNo, Nothing) as $ \as -> case as of ALNil -> mpret OK ALCons _ a as -> case i of 0 -> mmpcase (False, prioNo, Just RINotConstructor) a $ \_ -> mpret OK _ -> g (i - 1) as ALProj eas _ _ as -> mpret OK ALConPar as -> case i of 0 -> __IMPOSSIBLE__ _ -> g (i - 1) as _ -> fs (adduid uid uids) (elr : used) args Lam _ (Abs _ e) -> f uids (w used) e Pi uid _ _ e1 (Abs _ e2) -> mpret $ Sidecondition (f (adduid uid uids) used e1) (f (adduid uid uids) (w used) e2) Sort _ -> mpret OK AbsurdLambda{} -> mpret OK fs uids used as = mmpcase (False, prioNo, Nothing) as $ \as -> case as of ALNil -> mpret OK ALCons _ a as -> mpret $ Sidecondition (f uids used a) (fs uids used as) ALProj eas _ _ as -> mpret $ Sidecondition (fs uids used eas) (fs uids used as) ALConPar as -> fs uids used as w = map (\x -> case x of {Var v -> Var (v + 1); Const{} -> x}) adduid (Just uid) uids = uid : uids adduid Nothing uids = uids -- --------------------------------- maybeor :: Bool -> Int -> IO (PB (RefInfo o)) -> IO (PB (RefInfo o)) -> IO (PB (RefInfo o)) maybeor _ _ mainalt _ = mainalt iotapossmeta :: ICExp o -> ICArgList o -> EE Bool iotapossmeta ce@(Clos cl _) cargs = do xs <- mapM ncaction cl y <- nccargs cargs return $ not (all id xs && y) where ncaction (Sub ce) = nonconstructor ce ncaction Skip = return True ncaction (Weak{}) = return True nccargs CALNil = return True nccargs (CALConcat (Clos cl margs) cargs) = do x <- ncmargs cl margs y <- nccargs cargs return $ x && y ncmargs cl (Meta m) = do mb <- readIORef (mbind m) case mb of Nothing -> return False Just x -> ncargs cl x ncmargs cl (NotM args) = ncargs cl args ncargs cl ALNil = return True ncargs cl (ALCons _ a args) = do x <- nonconstructor (Clos cl a) y <- ncmargs cl args return $ x && y ncargs _ (ALProj{}) = __IMPOSSIBLE__ ncargs cl (ALConPar args) = ncmargs cl args nonconstructor :: ICExp o -> EE Bool nonconstructor ce = do res <- hnc True ce CALNil [] case res of Blocked{} -> return False Failed{} -> return False NotB res -> case res of HNMeta ce _ _ -> do let (Clos _ (Meta m)) = ce infos <- extractblkinfos m if any (\info -> case info of {RINotConstructor -> True; _ -> False}) infos then do return True else return False -- return False -- return True -- ?? removes completeness - Yes, in DavidW1.additionRight HNDone{} -> do res <- hnn ce case res of NotB hne -> case hne of HNApp _ (Const c) _ -> do cd <- readIORef c case cdcont cd of Constructor{} -> return False _ -> return True _ -> return True Blocked m _ -> return False -- not necessary to do check here because already done by hnn (!! if it's known that m stands for an eliminator then it cannot be constructor so True instead) Failed _ -> return False meta_not_constructor :: ICExp o -> EE (MB Bool (RefInfo o)) meta_not_constructor a = mbcase (hnc True a CALNil []) $ \res -> case res of HNMeta ce _ _ -> do let (Clos _ (Meta m)) = ce infos <- extractblkinfos m if any (\info -> case info of {RINotConstructor -> True; _ -> False}) infos then do b <- iotapossmeta ce CALNil mbret $ not b else mbret False HNDone{} -> mbret False -- --------------------------------- calcEqRState :: EqReasoningConsts o -> MExp o -> EE (MyPB o) calcEqRState cs = f EqRSNone where f s e = mmpcase (False, prioNo, Just (RIEqRState s)) e $ \e -> case e of App _ _ (Const c) args -> case () of _ | c == eqrcBegin cs -> fs [EqRSNone, EqRSNone, EqRSNone, EqRSNone, EqRSChain] args _ | c == eqrcStep cs -> fs [EqRSNone, EqRSNone, EqRSNone, EqRSNone, EqRSNone, EqRSPrf1, EqRSChain] args _ | c == eqrcSym cs -> fs [EqRSNone, EqRSNone, EqRSNone, EqRSNone, EqRSPrf2] args _ | c == eqrcCong cs -> fs [EqRSNone, EqRSNone, EqRSNone, EqRSNone, EqRSNone, EqRSNone, EqRSNone, EqRSPrf3] args _ -> fs [] args App _ _ (Var{}) args -> fs [] args Lam _ (Abs _ b) -> f EqRSNone b Pi _ _ _ it (Abs _ ot) -> mpret $ Sidecondition (f EqRSNone it) (f EqRSNone ot) Sort{} -> mpret OK AbsurdLambda{} -> mpret OK fs ss args = mmpcase (False, prioNo, Nothing) args $ \args -> case (ss, args) of (_, ALNil) -> mpret OK (s : ss, ALCons _ a args) -> mpret $ Sidecondition (f s a) (fs ss args) ([], ALCons _ a args) -> mpret $ Sidecondition (f EqRSNone a) (fs [] args) (_, ALProj eas _ _ as) -> mpret $ Sidecondition (fs [] eas) (fs [] as) -- when eqr-hint is given manually, ss can be non-empty here (_ : ss, ALConPar args) -> fs ss args ([], ALConPar args) -> fs [] args -- --------------------------------- pickid :: MId -> MId -> MId pickid mid1@(Id _) _ = mid1 pickid _ mid2 = mid2 -- --------------------------------- tcSearch :: Bool -> Ctx o -> CExp o -> MExp o -> EE (MyPB o) tcSearch isdep ctx typ trm = mpret $ Sidecondition (checkeliminand trm) (tcExp isdep ctx typ trm) -- ---------------------------- Agda-2.4.2.5/src/full/Agda/Auto/SearchControl.hs0000644000000000000000000003350112635075266017321 0ustar0000000000000000{-# LANGUAGE CPP #-} {-# LANGUAGE FlexibleInstances #-} {-# LANGUAGE MultiParamTypeClasses #-} {-# LANGUAGE UndecidableInstances #-} {-# OPTIONS_GHC -fno-warn-orphans #-} module Agda.Auto.SearchControl where import Control.Monad import Data.IORef import Control.Monad.State import Data.Maybe (mapMaybe) import Agda.Auto.NarrowingSearch import Agda.Auto.Syntax #include "undefined.h" import Agda.Utils.Impossible instance Refinable (ArgList o) (RefInfo o) where refinements _ infos _ = return $ [ (0, return ALNil), (0, cons NotHidden), (0, cons Hidden) ] ++ (let isdep = rr infos rr (RICheckElim isdep : _) = isdep rr (_ : xs) = rr xs rr _ = __IMPOSSIBLE__ proj hid = newPlaceholder >>= \p1 -> newPlaceholder >>= \p2 -> newPlaceholder >>= \p3 -> return $ ALProj p1 p2 hid p3 in if isdep then [] else [(0, proj NotHidden), (0, proj Hidden)] ) where cons hid = newPlaceholder >>= \p1 -> newPlaceholder >>= \p2 -> return $ ALCons hid p1 p2 data ExpRefInfo o = ExpRefInfo {eriMain :: Maybe (RefInfo o), eriUnifs :: [RefInfo o], eriInfTypeUnknown, eriIsEliminand :: Bool, eriUsedVars :: Maybe ([UId o], [Elr o]), eriIotaStep :: Maybe Bool, eriPickSubsVar :: Bool , eriEqRState :: Maybe EqReasoningState } getinfo :: [RefInfo o] -> ExpRefInfo o getinfo = f (ExpRefInfo {eriMain = Nothing , eriUnifs = [] , eriInfTypeUnknown = False , eriIsEliminand = False , eriUsedVars = Nothing , eriIotaStep = Nothing , eriPickSubsVar = False , eriEqRState = Nothing } ) where f i [] = i f i (x@RIMainInfo{} : xs) = f (i {eriMain = Just x}) xs f i (x@RIUnifInfo{} : xs) = f (i {eriUnifs = x : eriUnifs i}) xs f i (RIInferredTypeUnknown : xs) = f (i {eriInfTypeUnknown = True}) xs f i (RINotConstructor : xs) = f (i {eriIsEliminand = True}) xs f i (RIUsedVars nuids nused : xs) = f (i {eriUsedVars = Just (nuids, nused)}) xs f i (RIIotaStep semif : xs) = f (i {eriIotaStep = Just (semif || maybe False id (eriIotaStep i))}) xs f i (RIPickSubsvar : xs) = f (i {eriPickSubsVar = True}) xs f i (RIEqRState s : xs) = f (i {eriEqRState = Just s}) xs f i _ = __IMPOSSIBLE__ univar :: [CAction o] -> Nat -> Maybe Nat univar cl v = f cl v 0 where f [] v v' = Just (v' + v) f (Weak n : _) v v' | v < n = Nothing f (Weak n : xs) v v' = f xs (v - n) v' f (Sub _ : xs) v v' = f xs v (v' + 1) f (Skip : _) 0 v' = Just v' f (Skip : xs) v v' = f xs (v - 1) (v' + 1) subsvars :: [CAction o] -> [Nat] subsvars = f 0 where f n [] = [] f n (Weak _ : xs) = f n xs f n (Sub _ : xs) = n : f (n + 1) xs f n (Skip : xs) = f (n + 1) xs instance Refinable (Exp o) (RefInfo o) where refinements envinfo infos meta = let hints = rieHints envinfo deffreevars = rieDefFreeVars envinfo meqr = rieEqReasoningConsts envinfo ExpRefInfo {eriMain = Just (RIMainInfo n tt iotastepdone), eriUnifs = unis, eriInfTypeUnknown = inftypeunknown, eriIsEliminand = iseliminand, eriUsedVars = Just (uids, usedvars), eriIotaStep = iotastep, eriPickSubsVar = picksubsvar , eriEqRState = meqrstate } = getinfo infos eqrstate = maybe EqRSNone id meqrstate app muid elr = do p <- newPlaceholder p <- case elr of Var{} -> return p Const c -> do cd <- lift $ readIORef c let dfvapp 0 _ = p dfvapp i n = NotM $ ALCons NotHidden (NotM $ App Nothing (NotM $ OKVal) (Var n) (NotM ALNil)) (dfvapp (i - 1) (n - 1)) -- NotHidden is ok because agda reification throws these arguments away and agsy skips typechecking them return $ dfvapp (cddeffreevars cd) (n - 1) okh <- newOKHandle let uid = case muid of Just _ -> muid Nothing -> Just meta return $ App uid okh elr p lam hid id = do p <- newPlaceholder return $ Lam hid (Abs id p) pi muid dep hid = do p1 <- newPlaceholder p2 <- newPlaceholder let uid = case muid of Just _ -> muid Nothing -> Just meta return $ Pi uid hid dep p1 (Abs NoId p2) set l = return $ Sort (Set l) in case unis of [] -> let eqr = maybe __IMPOSSIBLE__ id meqr foldargs [] = NotM ALNil foldargs ((h, a) : xs) = NotM $ ALCons h a (foldargs xs) eq_begin_step_step = (costEqStep, do psb <- replicateM 4 newPlaceholder okhb <- newOKHandle pss1 <- replicateM 6 newPlaceholder okhs1 <- newOKHandle pss2 <- replicateM 7 newPlaceholder okhs2 <- newOKHandle return $ App (Just meta) okhb (Const $ eqrcBegin eqr) (foldargs (zip [Hidden, Hidden, Hidden, Hidden, NotHidden] (psb ++ [ NotM $ App (Just meta) okhs1 (Const $ eqrcStep eqr) (foldargs (zip [Hidden, Hidden, NotHidden, Hidden, Hidden, NotHidden, NotHidden] (pss1 ++ [ NotM $ App (Just meta) okhs2 (Const $ eqrcStep eqr) (foldargs (zip [Hidden, Hidden, NotHidden, Hidden, Hidden, NotHidden, NotHidden] pss2)) ]))) ]))) ) eq_step = (costEqStep, do ps <- replicateM 7 newPlaceholder okh <- newOKHandle return $ App (Just meta) okh (Const $ eqrcStep eqr) (foldargs (zip [Hidden, Hidden, NotHidden, Hidden, Hidden, NotHidden, NotHidden] ps)) ) eq_end = (costEqEnd, do ps <- replicateM 3 newPlaceholder okh <- newOKHandle return $ App (Just meta) okh (Const $ eqrcEnd eqr) (foldargs (zip [Hidden, Hidden, NotHidden] ps)) ) eq_sym = (costEqSym, do ps <- replicateM 5 newPlaceholder okh <- newOKHandle return $ App (Just meta) okh (Const $ eqrcSym eqr) (foldargs (zip [Hidden, Hidden, Hidden, Hidden, NotHidden] ps)) ) eq_cong = (costEqCong, do ps <- replicateM 8 newPlaceholder okh <- newOKHandle return $ App (Just meta) okh (Const $ eqrcCong eqr) (foldargs (zip [Hidden, Hidden, Hidden, Hidden, NotHidden, Hidden, Hidden, NotHidden] ps)) ) pcav i = if inftypeunknown then costInferredTypeUnkown else i pc i = pcav i varcost v | v < n - deffreevars = pcav (case Just usedvars of {Just usedvars -> if elem v (mapMaybe (\x -> case x of {Var v -> Just v; Const{} -> Nothing}) usedvars) then costAppVarUsed else costAppVar; Nothing -> if picksubsvar then costAppVar else costAppVarUsed}) varcost v | otherwise = pcav costAppHint varapps = map (\v -> (varcost v, app Nothing (Var v) )) [0..n - 1] hintapps = map (\(c, hm) -> (cost c hm, app Nothing (Const c) )) hints where cost c hm = pc (case iotastep of Just _ -> costIotaStep Nothing -> if elem c (mapMaybe (\x -> case x of {Var{} -> Nothing; Const c -> Just c}) usedvars) then case hm of {HMNormal -> costAppHintUsed; HMRecCall -> costAppRecCallUsed} else case hm of {HMNormal -> costAppHint; HMRecCall -> costAppRecCall}) generics = varapps ++ hintapps in case tt of _ | eqrstate == EqRSChain -> return $ [eq_end, eq_step] HNPi _ hid possdep _ (Abs id _) -> return $ (pc (if iotastepdone then costLamUnfold else costLam), lam hid id) : (costAbsurdLam, return $ AbsurdLambda hid) : generics HNSort (Set l) -> return $ map (\l -> (pc costSort, set l)) [0..l - 1] ++ [(pc costPi, pi Nothing True NotHidden), (pc costPi, pi Nothing True Hidden)] ++ generics HNApp _ (Const c) _ -> do cd <- readIORef c return $ case cdcont cd of Datatype cons _ | eqrstate == EqRSNone -> map (\c -> (pc (case iotastep of {Just True -> costUnification; _ -> if length cons <= 1 then costAppConstructorSingle else costAppConstructor}), app Nothing (Const c))) cons ++ generics ++ if maybe False (\eqr -> c == eqrcId eqr) meqr then [eq_sym, eq_cong, eq_begin_step_step] else [] _ | eqrstate == EqRSPrf1 -> generics ++ [eq_sym, eq_cong] _ | eqrstate == EqRSPrf2 -> generics ++ [eq_cong] _ -> generics _ -> return generics (RIUnifInfo cl hne : _) -> let subsvarapps = map (\v -> (costUnification, app Nothing (Var v) )) (subsvars cl) mlam = case tt of HNPi _ hid _ _ (Abs id _) -> [(costUnification, lam hid id)] _ -> [] generics = mlam ++ subsvarapps pickuid seenuids = case f seenuids of Just uid -> (uid, True) Nothing -> (head seenuids, False) -- ?? which uid to pick where f [] = Nothing f (Nothing:_) = Just Nothing f (Just u:us) = if elem u uids then f us else Just (Just u) in return $ case hne of HNApp seenuids (Var v) _ -> let (uid, isunique) = pickuid seenuids uni = case univar cl v of Just v | v < n -> [(if isunique then costUnification else costUnificationOccurs, app uid (Var v))] _ -> [] in uni ++ generics HNApp seenuids (Const c) _ -> let (uid, isunique) = pickuid seenuids in (if isunique then costUnification else costUnificationOccurs, app uid (Const c)) : generics HNLam{} -> generics HNPi seenuids hid possdep _ _ -> let (uid, isunique) = pickuid seenuids in (if isunique then costUnification else costUnificationOccurs, pi uid possdep hid) : generics HNSort (Set l) -> map (\l -> (costUnification, set l)) [0..l] ++ generics HNSort _ -> generics _ -> __IMPOSSIBLE__ extraref :: UId o -> [Maybe (UId o)] -> ConstRef o -> (Int, StateT (IORef [SubConstraints (RefInfo o)], Int) IO (Exp o)) extraref meta seenuids c = (costAppExtraRef, app (head seenuids) (Const c)) where app muid elr = do p <- newPlaceholder okh <- newOKHandle let uid = case muid of Just _ -> muid Nothing -> Just meta return $ App uid okh elr p instance Refinable (ICExp o) (RefInfo o) where refinements _ infos _ = let (RICopyInfo e : _) = infos in return [(0, return e)] instance Refinable (ConstRef o) (RefInfo o) where refinements _ [RICheckProjIndex projs] _ = return $ map (\x -> (0, return x)) projs refinements _ _ _ = __IMPOSSIBLE__ -- --------------------------------- costIncrease, costUnificationOccurs, costUnification, costAppVar, costAppVarUsed, costAppHint, costAppHintUsed, costAppRecCall, costAppRecCallUsed, costAppConstructor, costAppConstructorSingle, costAppExtraRef, costLam, costLamUnfold, costPi, costSort, costIotaStep, costInferredTypeUnkown, costAbsurdLam :: Int costIncrease = 1000 costUnificationOccurs = 100 -- 1000001 -- 1 -- 100 costUnification = 0000 costAppVar = 0000 -- 0, 1 costAppVarUsed = 1000 -- 5 costAppHint = 3000 -- 2, 5 costAppHintUsed = 5000 costAppRecCall = 0 -- 1000? costAppRecCallUsed = 10000 -- 1000? costAppConstructor = 1000 costAppConstructorSingle = 0000 costAppExtraRef = 1000 costLam = 0000 -- 1, 0 costLamUnfold = 1000 -- 1, 0 costPi = 1000003 -- 100 -- 5 costSort = 1000004 -- 0 costIotaStep = 3000 -- 1000005 -- 2 -- 100 costInferredTypeUnkown = 1000006 -- 100 costAbsurdLam = 0 costEqStep, costEqEnd, costEqSym, costEqCong :: Int costEqStep = 2000 costEqEnd = 0 costEqSym = 0 costEqCong = 500 prioNo, prioTypeUnknown, prioTypecheckArgList, prioInferredTypeUnknown, prioCompBeta, prioCompBetaStructured, prioCompareArgList, prioCompIota, prioCompChoice, prioCompUnif, prioCompCopy, prioNoIota, prioAbsurdLambda, prioProjIndex :: Int prioNo = (-1) prioTypeUnknown = 0 prioTypecheckArgList = 3000 prioInferredTypeUnknown = 4000 prioCompBeta = 4000 prioCompBetaStructured = 4000 prioCompIota = 4000 prioCompChoice = 5000 -- 700 -- 5000 prioCompUnif = 6000 -- 2 prioCompCopy = 8000 prioCompareArgList = 7000 -- 5 -- 2 prioNoIota = 500 -- 500 prioAbsurdLambda = 1000 prioProjIndex = 3000 prioTypecheck :: Bool -> Int prioTypecheck False = 1000 prioTypecheck True = 0 -- --------------------------------- instance Trav a blk => Trav [a] blk where trav _ [] = return () trav f (x:xs) = trav f x >> trav f xs instance Trav (MId, CExp o) (RefInfo o) where trav f (_, ce) = trav f ce instance Trav (TrBr a o) (RefInfo o) where trav f (TrBr es _) = trav f es instance Trav (Exp o) (RefInfo o) where trav f e = case e of App _ _ _ args -> trav f args Lam _ (Abs _ b) -> trav f b Pi _ _ _ it (Abs _ ot) -> trav f it >> trav f ot Sort _ -> return () AbsurdLambda{} -> return () instance Trav (ArgList o) (RefInfo o) where trav _ ALNil = return () trav f (ALCons _ arg args) = trav f arg >> trav f args trav f (ALProj eas _ _ as) = trav f eas >> trav f as trav f (ALConPar args) = trav f args -- --------------------------------- Agda-2.4.2.5/src/full/Agda/Auto/Syntax.hs0000644000000000000000000002463412635075266016050 0ustar0000000000000000{-# LANGUAGE CPP #-} {-# LANGUAGE ExistentialQuantification #-} module Agda.Auto.Syntax where import Data.IORef import Agda.Auto.NarrowingSearch #include "undefined.h" import Agda.Utils.Impossible -- | Unique identifiers for variable occurrences in unification. type UId o = Metavar (Exp o) (RefInfo o) data HintMode = HMNormal | HMRecCall data EqReasoningConsts o = EqReasoningConsts {eqrcId, eqrcBegin, eqrcStep, eqrcEnd, eqrcSym, eqrcCong :: ConstRef o} -- "_≡_", "begin_", "_≡⟨_⟩_", "_∎", "sym", "cong" data EqReasoningState = EqRSNone | EqRSChain | EqRSPrf1 | EqRSPrf2 | EqRSPrf3 deriving (Eq, Show) -- | The concrete instance of the 'blk' parameter in 'Metavar'. -- I.e., the information passed to the search control. data RefInfo o = RIEnv { rieHints :: [(ConstRef o, HintMode)] , rieDefFreeVars :: Nat -- ^ Nat - deffreevars -- (to make cost of using module parameters correspond to that of hints). , rieEqReasoningConsts :: Maybe (EqReasoningConsts o) } | RIMainInfo { riMainCxtLength :: Nat -- ^ Size of typing context in which meta was created. , riMainType :: HNExp o -- ^ Head normal form of type of meta. , riMainIota :: Bool -- ^ True if iota steps performed when normalising target type -- (used to put cost when traversing a definition -- by construction instantiation). } | RIUnifInfo [CAction o] (HNExp o) -- meta environment, opp hne | RICopyInfo (ICExp o) | RIIotaStep Bool -- True - semiflex | RIInferredTypeUnknown | RINotConstructor | RIUsedVars [UId o] [Elr o] | RIPickSubsvar | RIEqRState EqReasoningState | RICheckElim Bool -- isdep | RICheckProjIndex [ConstRef o] -- noof proj functions type MyPB o = PB (RefInfo o) type MyMB a o = MB a (RefInfo o) type Nat = Int -- | 'Hiding' in Agda. data FMode = Hidden | Instance | NotHidden deriving Eq data MId = Id String | NoId stringToMyId :: String -> MId stringToMyId = Id -- | Abstraction with maybe a name. -- -- Different from Agda, where there is also info -- whether function is constant. data Abs a = Abs MId a -- | Constant signatures. data ConstDef o = ConstDef { cdname :: String -- ^ For debug printing. , cdorigin :: o -- ^ Reference to the Agda constant. , cdtype :: MExp o -- ^ Type of constant. , cdcont :: DeclCont o -- ^ Constant definition. , cddeffreevars :: Nat -- ^ Free vars of the module where the constant is defined.. } -- contains no metas -- | Constant definitions. data DeclCont o = Def Nat [Clause o] (Maybe Nat) (Maybe Nat) -- maybe an index to elimand argument, maybe index to elim arg if semiflex | Datatype [ConstRef o] -- constructors [ConstRef o] -- projection functions (in case it is a record) | Constructor Nat -- number of omitted args | Postulate type Clause o = ([Pat o], MExp o) data Pat o = PatConApp (ConstRef o) [Pat o] | PatVar String | PatExp -- ^ Dot pattern. {- TODO: projection patterns. | PatProj (ConstRef o) -- ^ Projection pattern. -} type ConstRef o = IORef (ConstDef o) -- | Head of application (elimination). data Elr o = Var Nat | Const (ConstRef o) data Sort = Set Nat | UnknownSort | Type -- | Agsy's internal syntax. data Exp o = App { appUId :: Maybe (UId o) -- ^ Unique identifier of the head. , appOK :: OKHandle (RefInfo o) -- ^ This application has been type-checked. , appHead :: Elr o -- ^ Head. , appElims :: MArgList o -- ^ Arguments. } | Lam FMode (Abs (MExp o)) -- ^ Lambda with hiding information. | Pi (Maybe (UId o)) FMode Bool (MExp o) (Abs (MExp o)) -- ^ @True@ if possibly dependent (var not known to not occur). -- @False@ if non-dependent. | Sort Sort | AbsurdLambda FMode -- ^ Absurd lambda with hiding information. dontCare :: Exp o dontCare = Sort UnknownSort -- | "Maybe expression": Expression or reference to meta variable. type MExp o = MM (Exp o) (RefInfo o) data ArgList o = ALNil -- ^ No more eliminations. | ALCons FMode (MExp o) (MArgList o) -- ^ Application and tail. | ALProj (MArgList o) (MM (ConstRef o) (RefInfo o)) FMode (MArgList o) -- ^ proj pre args, projfcn idx, tail | ALConPar (MArgList o) -- ^ Constructor parameter (missing in Agda). -- Agsy has monomorphic constructors. -- Inserted to cover glitch of polymorphic constructor -- applications coming from Agda type MArgList o = MM (ArgList o) (RefInfo o) data HNExp o = HNApp [Maybe (UId o)] (Elr o) (ICArgList o) | HNLam [Maybe (UId o)] FMode (Abs (ICExp o)) | HNPi [Maybe (UId o)] FMode Bool (ICExp o) (Abs (ICExp o)) | HNSort Sort -- | Head-normal form of 'ICArgList'. First entry is exposed. -- -- Q: Why are there no projection eliminations? data HNArgList o = HNALNil | HNALCons FMode (ICExp o) (ICArgList o) | HNALConPar (ICArgList o) -- | Lazy concatenation of argument lists under explicit substitutions. data ICArgList o = CALNil | CALConcat (Clos (MArgList o) o) (ICArgList o) -- | An expression @a@ in an explicit substitution @[CAction a]@. type ICExp o = Clos (MExp o) o data Clos a o = Clos [CAction o] a type CExp o = TrBr (ICExp o) o data TrBr a o = TrBr [MExp o] a -- | Entry of an explicit substitution. -- -- An explicit substitution is a list of @CAction@s. -- This is isomorphic to the usual presentation where -- @Skip@ and @Weak@ would be constructors of exp. substs. data CAction o = Sub (ICExp o) -- ^ Instantation of variable. | Skip -- ^ For going under a binder, often called "Lift". | Weak Nat -- ^ Shifting substitution (going to a larger context). type Ctx o = [(MId, CExp o)] type EE = IO -- ------------------------------------------- detecteliminand :: [Clause o] -> Maybe Nat detecteliminand cls = case map cleli cls of [] -> Nothing (i:is) -> if all (i ==) is then i else Nothing where cleli (pats, _) = pateli 0 pats pateli i (PatConApp _ args : pats) = if all notcon (args ++ pats) then Just i else Nothing pateli i (_ : pats) = pateli (i + 1) pats pateli i [] = Nothing notcon PatConApp{} = False notcon _ = True detectsemiflex :: ConstRef o -> [Clause o] -> IO Bool detectsemiflex _ _ = return False -- disabled categorizedecl :: ConstRef o -> IO () categorizedecl c = do cd <- readIORef c case cdcont cd of Def narg cls _ _ -> do semif <- detectsemiflex c cls let elim = detecteliminand cls semifb = case (semif, elim) of (True, Just i) -> Just i -- just copying val of elim arg. this should be changed (_, _) -> Nothing writeIORef c (cd {cdcont = Def narg cls elim semifb}) _ -> return () -- ------------------------------------------- metaliseokh :: MExp o -> IO (MExp o) metaliseokh = fm where fm (Meta m) = return $ Meta m fm (NotM e) = do e <- f e return $ NotM e f (App uid _ elr args) = do m <- initMeta args <- fms args return $ App uid (Meta m) elr args f (Lam hid (Abs id b)) = do b <- fm b return $ Lam hid (Abs id b) f (Pi uid hid posdep it (Abs id ot)) = do it <- fm it ot <- fm ot return $ Pi uid hid posdep it (Abs id ot) f e@(Sort{}) = return e f e@(AbsurdLambda{}) = return e fms (Meta m) = return $ Meta m fms (NotM es) = do es <- fs es return $ NotM es fs ALNil = return ALNil fs (ALCons hid a as) = do a <- fm a as <- fms as return $ ALCons hid a as fs (ALProj eas idx hid as) = do eas <- fms eas as <- fms as return $ ALProj eas idx hid as fs (ALConPar as) = do as <- fms as return $ ALConPar as -- ------------------------------------------- expandExp :: MExp o -> IO (MExp o) expandExp = fm where fm (Meta m) = do mb <- readIORef $ mbind m case mb of Nothing -> return $ Meta m Just e -> fm (NotM e) fm (NotM e) = do e <- f e return $ NotM e f (App uid okh elr args) = do args <- fms args return $ App uid okh elr args f (Lam hid (Abs id b)) = do b <- fm b return $ Lam hid (Abs id b) f (Pi uid hid posdep it (Abs id ot)) = do it <- fm it ot <- fm ot return $ Pi uid hid posdep it (Abs id ot) f e@(Sort{}) = return e f e@(AbsurdLambda{}) = return e fms (Meta m) = do mb <- readIORef $ mbind m case mb of Nothing -> return $ Meta m Just es -> fms (NotM es) fms (NotM es) = do es <- fs es return $ NotM es fs ALNil = return ALNil fs (ALCons hid a as) = do a <- fm a as <- fms as return $ ALCons hid a as fs (ALProj eas idx hid as) = do idx <- expandbind idx eas <- fms eas as <- fms as return $ ALProj eas idx hid as fs (ALConPar as) = do as <- fms as return $ ALConPar as -- --------------------------------- addtrailingargs :: Clos (MArgList o) o -> ICArgList o -> ICArgList o addtrailingargs newargs CALNil = CALConcat newargs CALNil addtrailingargs newargs (CALConcat x xs) = CALConcat x (addtrailingargs newargs xs) -- --------------------------------- closify :: MExp o -> CExp o closify e = TrBr [e] (Clos [] e) sub :: MExp o -> CExp o -> CExp o -- sub e (Clos [] x) = Clos [Sub e] x sub e (TrBr trs (Clos (Skip : as) x)) = TrBr (e : trs) (Clos (Sub (Clos [] e) : as) x) {-sub e (Clos (Weak n : as) x) = if n == 1 then Clos as x else Clos (Weak (n - 1) : as) x-} sub _ _ = __IMPOSSIBLE__ subi :: MExp o -> ICExp o -> ICExp o subi e (Clos (Skip : as) x) = Clos (Sub (Clos [] e) : as) x subi _ _ = __IMPOSSIBLE__ weak :: Nat -> CExp o -> CExp o weak n (TrBr trs e) = TrBr trs (weaki n e) weaki :: Nat -> Clos a o -> Clos a o weaki 0 x = x weaki n (Clos as x) = Clos (Weak n : as) x weakarglist :: Nat -> ICArgList o -> ICArgList o weakarglist 0 = id weakarglist n = f where f CALNil = CALNil f (CALConcat (Clos cl as) as2) = CALConcat (Clos (Weak n : cl) as) (f as2) weakelr :: Nat -> Elr o -> Elr o weakelr 0 elr = elr weakelr n (Var v) = Var (v + n) weakelr _ elr@(Const _) = elr -- | Substituting for a variable. doclos :: [CAction o] -> Nat -> Either Nat (ICExp o) doclos = f 0 where -- ns is the number of weakenings f ns [] i = Left (ns + i) f ns (Weak n : xs) i = f (ns + n) xs i f ns (Sub s : _ ) 0 = Right (weaki ns s) f ns (Skip : _ ) 0 = Left ns f ns (Skip : xs) i = f (ns + 1) xs (i - 1) f ns (Sub _ : xs) i = f ns xs (i - 1) Agda-2.4.2.5/src/full/Agda/Auto/Auto.hs0000644000000000000000000005642012635075266015470 0ustar0000000000000000{-# LANGUAGE CPP #-} {-# LANGUAGE TupleSections #-} #if __GLASGOW_HASKELL__ >= 710 {-# LANGUAGE FlexibleContexts #-} #endif module Agda.Auto.Auto (auto) where import Prelude hiding (null) import Control.Monad.State import Data.List hiding (null) import qualified Data.Map as Map import Data.IORef import qualified System.Timeout import Data.Maybe import Data.Functor import qualified Data.Traversable as Trav import Agda.Utils.Permutation (permute, takeP) import Agda.TypeChecking.Monad hiding (withCurrentModule) -- import Agda.TypeChecking.Monad.Base -- import Agda.TypeChecking.Monad.MetaVars -- import Agda.TypeChecking.Monad.Context -- import Agda.TypeChecking.Monad.Signature import Agda.TypeChecking.Substitute import qualified Agda.Syntax.Abstract as A import Agda.Syntax.Abstract.Pretty (prettyA) import qualified Text.PrettyPrint as PP import qualified Agda.TypeChecking.Pretty as TCM import Agda.Syntax.Position import qualified Agda.Syntax.Internal as I import Agda.Syntax.Translation.InternalToAbstract import Agda.Syntax.Translation.AbstractToConcrete (abstractToConcreteEnv, abstractToConcrete_, makeEnv, runAbsToCon, toConcrete) import Agda.Interaction.BasicOps hiding (refine) import Agda.TypeChecking.Reduce (normalise) import Agda.Syntax.Common import qualified Agda.Syntax.Scope.Base as Scope import Agda.Syntax.Scope.Monad (withCurrentModule) import qualified Agda.Syntax.Abstract.Name as AN import qualified Agda.TypeChecking.Monad.Base as TCM import Agda.TypeChecking.EtaContract (etaContract) import qualified Agda.Utils.HashMap as HMap import Agda.Auto.Convert import Agda.Auto.NarrowingSearch import Agda.Auto.Syntax import Agda.Auto.SearchControl import Agda.Auto.Typecheck import Agda.Auto.CaseSplit import Agda.Utils.Except ( runExceptT, MonadError(catchError) ) import Agda.Utils.Functor import Agda.Utils.Impossible import Agda.Utils.Lens import Agda.Utils.Maybe import Agda.Utils.Null import Agda.Utils.Tuple #include "undefined.h" insertAbsurdPattern :: String -> String insertAbsurdPattern [] = [] insertAbsurdPattern s@(_:_) | take (length abspatvarname) s == abspatvarname = "()" ++ drop (length abspatvarname) s insertAbsurdPattern (c:s) = c : insertAbsurdPattern s getName :: A.Expr -> Maybe (Bool, I.QName) getName (A.ScopedExpr _ e) = getName e getName (A.Def qname) = Just (False, qname) getName (A.Proj qname) = Just (False, qname) getName (A.Con qname) = Just (True, head $ I.unAmbQ qname) getName _ = Nothing dispmsg :: String -> TCM (Either [(InteractionId, String)] (Either [String] String) , Maybe String) dispmsg msg = return (Left [], Just msg) -- | Entry point for Auto tactic (Agsy). -- -- @auto ii rng s = return (res, mmsg)@ -- -- If @mmsg = Just msg@, the message @msg@ produced by Agsy should -- be displayed to the user. -- -- The result @res@ of the Auto tactic can be one of the following three: -- -- 1. @Left [(ii,s)]@ -- A list of solutions @s@ for interaction ids @ii@. -- In particular, @Left []@ means Agsy found no solution. -- -- 2. @Right (Left cs)@ -- A list of clauses (the user allowed case-split). -- -- 3. @Right (Right s)@ -- A refinement for the interaction id @ii@ in which Auto was invoked. auto :: InteractionId -> Range -> String -> TCM ( Either [(InteractionId, String)] (Either [String] String) , Maybe String) auto ii rng argstr = do -- Parse hints and other configuration. let (hints, timeout, pick, mode, hintmode) = parseargs argstr ahints <- case mode of MRefine{} -> return [] _ -> mapM (parseExprIn ii rng) hints let failHints = dispmsg "Hints must be a list of constant names" caseMaybe (mapM getName ahints) failHints $ \ ehints -> do -- Get names for equality reasoning. -- @eqstuff == []@ if any of these names is not defined. eqstuffExprs <- mapM (parseExprIn ii rng) ["_≡_", "begin_", "_≡⟨_⟩_", "_∎", "sym", "cong"] `catchError` (\_ -> return []) let eqstuff = fromMaybe [] $ mapM getName eqstuffExprs -- Get the meta variable for the interaction point we are trying to fill. -- Add the @autohints@ for that meta to the hints collection. mi <- lookupInteractionId ii --thisdefinfo <- catchError (liftM Just $ findClause mi) (\_ -> return Nothing) thisdefinfo <- findClauseDeep mi ehints <- (ehints ++) <$> do autohints hintmode mi $ fmap fst3 thisdefinfo -- If @thisdefinfo /= Nothing@ get the its type (normalized). mrectyp <- maybeToList <$> do Trav.forM thisdefinfo $ \ (def, _, _) -> do normalise =<< do TCM.defType <$> getConstInfo def (myhints', mymrectyp, tccons, eqcons, cmap) <- tomy mi (ehints ++ eqstuff) mrectyp let (myhints, c1to6) = splitAt (length myhints' - length eqstuff) myhints' meqr = ifNull eqstuff Nothing $ \ _ -> {- else -} let [c1, c2, c3, c4, c5, c6] = c1to6 in Just $ EqReasoningConsts c1 c2 c3 c4 c5 c6 let tcSearchSC isdep ctx typ trm = caseMaybe meqr a $ \ eqr -> mpret $ Sidecondition (calcEqRState eqr trm) a where a = tcSearch isdep ctx typ trm let (mainm, _, _, _) = tccons Map.! mi case mode of MNormal listmode disprove -> do let numsols = if listmode then 10 else 1 -- Andreas, 2015-05-17 Issue 1504: -- wish to produce several solutions, as -- the first one might be ill-typed. -- However, currently changing the 1 to something higher makes Agsy loop. sols <- liftIO $ newIORef ([] :: [[I.Term]]) nsol <- liftIO $ newIORef $ pick + numsols let hsol = do nsol' <- readIORef nsol let cond = nsol' <= numsols when cond $ do trms <- runExceptT $ mapM (\ (m, _, _, _) -> frommy (Meta m)) $ Map.elems tccons case trms of Left{} -> writeIORef nsol $! nsol' + 1 Right trms -> modifyIORef sols (trms :) -- Right trms -> if listmode then modifyIORef sols (trms :) -- else writeIORef sols [trms] ticks <- liftIO $ newIORef 0 let exsearch initprop recinfo defdfv = liftIO $ System.Timeout.timeout (timeout * 1000000) $ loop 0 where loop d = do let rechint x = case recinfo of Nothing -> x Just (_, recdef) -> (recdef, HMRecCall) : x env = RIEnv { rieHints = rechint $ map (,HMNormal) myhints , rieDefFreeVars = defdfv , rieEqReasoningConsts = meqr } depreached <- topSearch ticks nsol hsol env (initprop) d costIncrease nsol' <- readIORef nsol if nsol' /= 0 && depreached then loop (d + costIncrease) else return depreached let getsols sol = do exprs <- forM (zip (Map.keys tccons) sol) $ \ (mi, e) -> do mv <- lookupMeta mi e <- etaContract e expr <- modifyAbstractExpr <$> do withMetaInfo (getMetaInfo mv) $ reify e return (mi, expr) let loop :: I.MetaId -> StateT [I.MetaId] TCM [(I.MetaId, A.Expr)] loop midx = do let (m, _, _, deps) = tccons Map.! midx asolss <- mapM loop deps dones <- get asols <- if midx `elem` dones then return [] else do put (midx : dones) return [(midx, fromMaybe __IMPOSSIBLE__ $ lookup midx exprs)] return $ concat asolss ++ asols (asols, _) <- runStateT (loop mi) [] return asols if disprove then case eqcons of [] -> case Map.elems tccons of (m, mytype, mylocalVars, _) : [] -> do defdfv <- case thisdefinfo of Just (def, _, _) -> getdfv mi def Nothing -> return 0 ee <- liftIO $ newIORef $ ConstDef {cdname = "T", cdorigin = __IMPOSSIBLE__, cdtype = NotM $ Sort (Set 0), cdcont = Postulate, cddeffreevars = 0} let (restargs, modargs) = splitAt (length mylocalVars - defdfv) mylocalVars mytype' = foldl (\x y -> NotM $ Pi Nothing Agda.Auto.Syntax.NotHidden (freeIn 0 y) y (Abs NoId x)) mytype restargs htyp = negtype ee mytype' sctx = (Id "h", closify htyp) : map (\x -> (NoId, closify x)) modargs ntt = closify (NotM $ App Nothing (NotM OKVal) (Const ee) (NotM ALNil)) res <- exsearch (tcSearchSC False sctx ntt (Meta m)) Nothing defdfv rsols <- liftM reverse $ liftIO $ readIORef sols if null rsols then do nsol' <- liftIO $ readIORef nsol dispmsg $ insuffsols (pick + numsols - nsol') else do aexprss <- mapM getsols rsols cexprss <- forM aexprss $ mapM $ \(mi, e) -> do mv <- lookupMeta mi withMetaInfo (getMetaInfo mv) $ do (mi,) <$> abstractToConcrete_ e let ss = dropWhile (== ' ') . dropWhile (/= ' ') . show disp [(_, cexpr)] = ss cexpr disp cexprs = concat $ map (\ (mi, cexpr) -> ss cexpr ++ " ") cexprs ticks <- liftIO $ readIORef ticks dispmsg $ unlines $ ("Listing disproof(s) " ++ show pick ++ "-" ++ show (pick + length rsols - 1)) : for (zip cexprss [pick..]) (\ (x, y) -> show y ++ " " ++ disp x) _ -> dispmsg "Metavariable dependencies not allowed in disprove mode" _ -> dispmsg "Metavariable dependencies not allowed in disprove mode" else do (recinfo, defdfv) <- case thisdefinfo of Just (def, clause, _) -> do let [rectyp'] = mymrectyp defdfv <- getdfv mi def myrecdef <- liftIO $ newIORef $ ConstDef {cdname = "", cdorigin = (Nothing, def), cdtype = rectyp', cdcont = Postulate, cddeffreevars = defdfv} (_, pats) <- constructPats cmap mi clause defdfv <- getdfv mi def return $ if contains_constructor pats then (Just (pats, myrecdef), defdfv) else (Nothing, defdfv) Nothing -> return (Nothing, 0) let tc (m, mytype, mylocalVars) isdep = tcSearchSC isdep (map (\x -> (NoId, closify x)) mylocalVars) (closify mytype) (Meta m) initprop = foldl (\x (ineq, e, i) -> mpret $ And Nothing x (comp' ineq (closify e) (closify i))) (foldl (\x (m, mt, mlv, _) -> if hequalMetavar m mainm then case recinfo of Just (recpats, recdef) -> mpret $ Sidecondition (localTerminationSidecond (localTerminationEnv recpats) recdef (Meta m)) (tc (m, mt, mlv) False) Nothing -> mpret $ And Nothing x (tc (m, mt, mlv) False) else mpret $ And Nothing x (tc (m, mt, mlv) True) ) (mpret OK) (Map.elems tccons) ) eqcons res <- exsearch initprop recinfo defdfv riis <- map swap <$> getInteractionIdsAndMetas let timeoutString | isNothing res = " after timeout (" ++ show timeout ++ "s)" | otherwise = "" if listmode then do rsols <- liftM reverse $ liftIO $ readIORef sols if null rsols then do nsol' <- liftIO $ readIORef nsol dispmsg $ insuffsols (pick + numsols - nsol') ++ timeoutString else do aexprss <- mapM getsols rsols -- cexprss <- mapM (mapM (\(mi, e) -> lookupMeta mi >>= \mv -> withMetaInfo (getMetaInfo mv) $ abstractToConcrete_ e >>= \e' -> return (mi, e'))) aexprss cexprss <- forM aexprss $ do mapM $ \ (mi, e) -> do mv <- lookupMeta mi withMetaInfo (getMetaInfo mv) $ do e' <- abstractToConcrete_ e return (mi, e') let disp [(_, cexpr)] = show cexpr disp cexprs = concat $ for cexprs $ \ (mi, cexpr) -> maybe (show mi) show (lookup mi riis) ++ " := " ++ show cexpr ++ " " ticks <- liftIO $ readIORef ticks dispmsg $ "Listing solution(s) " ++ show pick ++ "-" ++ show (pick + length rsols - 1) ++ timeoutString ++ "\n" ++ unlines (map (\(x, y) -> show y ++ " " ++ disp x) $ zip cexprss [pick..]) else {- not listmode -} case res of Nothing -> do nsol' <- liftIO $ readIORef nsol dispmsg $ insuffsols (pick + numsols - nsol') ++ timeoutString Just depthreached -> do ticks <- liftIO $ readIORef ticks rsols <- liftIO $ readIORef sols case rsols of [] -> do nsol' <- liftIO $ readIORef nsol dispmsg $ insuffsols (pick + numsols - nsol') terms -> loop terms where -- Andreas, 2015-05-17 Issue 1504 -- If giving a solution failed (e.g. ill-typed) -- we could try the next one. -- However, currently @terms@ is always a singleton list. -- Thus, the following @loop@ is not doing something very -- meaningful. loop [] = return (Left [], Just "") loop (term : terms') = do -- On exception, try next solution flip catchError (const $ loop terms') $ do exprs <- getsols term reportSDoc "auto" 20 $ TCM.text "Trying solution " TCM.<+> TCM.prettyTCM exprs giveress <- forM exprs $ \ (mi, expr0) -> do let expr = killRange expr0 case lookup mi riis of Nothing -> -- catchError (giveExpr mi expr >> return (Nothing, Nothing)) -- (const retry) -- (\_ -> return (Nothing, Just ("Failed to give expr for side solution of " ++ show mi))) Just ii' -> do ae <- give ii' Nothing expr mv <- lookupMeta mi let scope = getMetaScope mv ce <- abstractToConcreteEnv (makeEnv scope) ae let cmnt = if ii' == ii then agsyinfo ticks else "" return (Just (ii', show ce ++ cmnt), Nothing) -- Andreas, 2015-05-17, Issue 1504 -- When Agsy produces an ill-typed solution, return nothing. -- TODO: try other solution. -- `catchError` const retry -- (return (Nothing, Nothing)) let msg = if length exprs == 1 then Nothing else Just $ "Also gave solution(s) for hole(s)" ++ concatMap (\(mi', _) -> if mi' == mi then "" else (" " ++ case lookup mi' riis of {Nothing -> show mi'; Just ii -> show ii}) ) exprs let msgs = catMaybes $ msg : map snd giveress msg' = case msgs of [] -> Nothing _ -> Just $ unlines msgs return (Left $ catMaybes $ map fst giveress, msg') MCaseSplit -> do case thisdefinfo of Just (def, clause, True) -> case Map.elems tccons of [(m, mytype, mylocalVars, _)] | null eqcons -> do (ids, pats) <- constructPats cmap mi clause let ctx = map (\((hid, id), t) -> HI hid (id, t)) (zip ids mylocalVars) ticks <- liftIO $ newIORef 0 let [rectyp'] = mymrectyp defdfv <- getdfv mi def myrecdef <- liftIO $ newIORef $ ConstDef {cdname = "", cdorigin = (Nothing, def), cdtype = rectyp', cdcont = Postulate, cddeffreevars = defdfv} sols <- liftIO $ System.Timeout.timeout (timeout * 1000000) ( let r d = do sols <- liftIO $ caseSplitSearch ticks __IMPOSSIBLE__ myhints meqr __IMPOSSIBLE__ d myrecdef ctx mytype pats case sols of [] -> r (d + costIncrease) (_:_) -> return sols in r 0) case sols of Just (cls : _) -> withInteractionId ii $ do cls' <- liftIO $ runExceptT (mapM frommyClause cls) case cls' of Left{} -> dispmsg "No solution found" Right cls' -> do cls'' <- forM cls' $ \ (I.Clause _ tel perm ps body t) -> do withCurrentModule (AN.qnameModule def) $ do -- Normalise the dot patterns ps <- addCtxTel tel $ normalise ps body <- etaContractBody body liftM modifyAbstractClause $ inContext [] $ reify $ AN.QNamed def $ I.Clause noRange tel perm ps body t pcs <- withInteractionId ii $ mapM prettyA cls'' ticks <- liftIO $ readIORef ticks return (Right $ Left (map (insertAbsurdPattern . PP.renderStyle (PP.style { PP.mode = PP.OneLineMode })) pcs), Nothing) Just [] -> dispmsg "No solution found" -- case not possible at the moment because case split doesnt care about search exhaustiveness Nothing -> dispmsg $ "No solution found at time out (" ++ show timeout ++ "s)" _ -> dispmsg "Metavariable dependencies not allowed in case split mode" _ -> dispmsg "Metavariable is not at top level of clause RHS" MRefine listmode -> do mv <- lookupMeta mi let tt = jMetaType $ mvJudgement mv minfo = getMetaInfo mv targettyp <- withMetaInfo minfo $ do vs <- getContextArgs let targettype = tt `piApply` permute (takeP (length vs) $ mvPermutation mv) vs normalise targettype let tctx = length $ envContext $ clEnv minfo hits <- if elem "-a" hints then do st <- liftTCM $ join $ pureTCM $ \st _ -> return st let defs = st^.stSignature.sigDefinitions idefs = st^.stImports.sigDefinitions alldefs = HMap.keys defs ++ HMap.keys idefs liftM catMaybes $ mapM (\n -> case thisdefinfo of Just (def, _, _) | def == n -> return Nothing _ -> do cn <- withMetaInfo minfo $ runAbsToCon $ toConcrete n if head (show cn) == '.' then -- not in scope return Nothing else do c <- getConstInfo n ctyp <- normalise $ defType c cdfv <- withMetaInfo minfo $ getDefFreeVars n return $ case matchType cdfv tctx ctyp targettyp of Nothing -> Nothing Just score -> Just (show cn, score) ) alldefs else do let scopeinfo = clScope (getMetaInfo mv) namespace = Scope.everythingInScope scopeinfo names = Scope.nsNames namespace qnames = map (\(x, y) -> (x, Scope.anameName $ head y)) $ Map.toList names modnames = case thisdefinfo of Just (def, _, _) -> filter (\(_, n) -> n /= def) qnames Nothing -> qnames liftM catMaybes $ mapM (\(cn, n) -> do c <- getConstInfo n ctyp <- normalise $ defType c cdfv <- withMetaInfo minfo $ getDefFreeVars n return $ case matchType cdfv tctx ctyp targettyp of Nothing -> Nothing Just score -> Just (show cn, score) ) modnames let sorthits = sortBy (\(_, (pa1, pb1)) (_, (pa2, pb2)) -> case compare pa2 pa1 of {EQ -> compare pb1 pb2; o -> o}) hits if listmode || pick == (-1) then let pick' = max 0 pick in if pick' >= length sorthits then dispmsg $ insuffcands $ length sorthits else let showhits = take 10 $ drop pick' sorthits in dispmsg $ "Listing candidate(s) " ++ show pick' ++ "-" ++ show (pick' + length showhits - 1) ++ " (found " ++ show (length sorthits) ++ " in total)\n" ++ unlines (map (\(i, (cn, _)) -> show i ++ " " ++ cn) (zip [pick'..pick' + length showhits - 1] showhits)) else if pick >= length sorthits then dispmsg $ insuffcands $ length sorthits else return (Right $ Right (fst $ sorthits !! pick), Nothing) where agsyinfo ticks = "" -- Get the functions and axioms defined in the same module as @def@. autohints :: AutoHintMode -> I.MetaId -> Maybe AN.QName -> TCM [(Bool, AN.QName)] autohints AHMModule mi (Just def) = do scope <- clScope . getMetaInfo <$> lookupMeta mi let names = Scope.nsNames $ Scope.everythingInScope scope qnames = map (Scope.anameName . head) $ Map.elems names modnames = filter (\n -> AN.qnameModule n == AN.qnameModule def && n /= def) qnames map (False,) <$> do (`filterM` modnames) $ \ n -> do c <- getConstInfo n case theDef c of Axiom{} -> return True Function{} -> return True _ -> return False autohints _ _ _ = return [] insuffsols :: Int -> String insuffsols 0 = "No solution found" insuffsols n = "Only " ++ show n ++ " solution(s) found" insuffcands :: Int -> String insuffcands 0 = "No candidate found" insuffcands n = "Only " ++ show n ++ " candidate(s) found" data Mode = MNormal Bool Bool -- true if list mode, true if disprove | MCaseSplit | MRefine Bool -- true if list mode data AutoHintMode = AHMNone | AHMModule parseargs :: String -> ([String], Int, Int, Mode, AutoHintMode) parseargs s = let r ("-t" : timeout : ws) (_, pick, mode, hintmode) = r ws (read timeout, pick, mode, hintmode) r ("-s" : pick : ws) (timeout, _, mode, hintmode) = r ws (timeout, read pick, mode, hintmode) r ("-l" : ws) (timeout, pick, MNormal _ disprove, hintmode) = r ws (timeout, pick, MNormal True disprove, hintmode) r ("-l" : ws) (timeout, pick, MRefine _, hintmode) = r ws (timeout, pick, MRefine True, hintmode) r ("-d" : ws) (timeout, pick, MNormal listmode _, hintmode) = r ws (timeout, pick, MNormal listmode True, hintmode) r ("-m" : ws) (timeout, pick, mode, _) = r ws (timeout, pick, mode, AHMModule) r ("-c" : ws) (timeout, pick, _, hintmode) = r ws (timeout, pick, MCaseSplit, hintmode) r ("-r" : ws) (timeout, pick, _, hintmode) = r ws (timeout, (-1), MRefine False, hintmode) r (h : ws) x = let (hints, timeout, pick, mode, hintmode) = r ws x in (h : hints, timeout, pick, mode, hintmode) r [] (x,y,z,w) = ([],x,y,z,w) in r (words s) (5, 0, MNormal False False, AHMNone) Agda-2.4.2.5/src/full/Agda/Auto/Convert.hs0000644000000000000000000007607512635075266016210 0ustar0000000000000000{-# LANGUAGE CPP #-} #if __GLASGOW_HASKELL__ >= 710 {-# LANGUAGE FlexibleContexts #-} #endif module Agda.Auto.Convert where import Control.Applicative hiding (getConst, Const(..)) import Data.IORef import Data.Map (Map) import qualified Data.Map as Map import Control.Monad.State import qualified Agda.Syntax.Internal as I import qualified Agda.Syntax.Common as Common import qualified Agda.Syntax.Abstract.Name as AN import qualified Agda.Syntax.Abstract as A import qualified Agda.Syntax.Position as SP import qualified Agda.TypeChecking.Monad.Base as MB import Agda.TypeChecking.Monad.State (getImportedSignature) import Agda.TypeChecking.Monad.Signature (getConstInfo, getDefFreeVars) import Agda.Utils.Permutation (Permutation(Perm), permute, takeP, compactP) import Agda.TypeChecking.Level (reallyUnLevelView) import Agda.TypeChecking.Monad.Base (mvJudgement, mvPermutation, getMetaInfo, ctxEntry, envContext, clEnv) import Agda.TypeChecking.Monad.MetaVars (lookupMeta, withMetaInfo) import Agda.TypeChecking.Monad.Context (getContextArgs) import Agda.TypeChecking.Monad.Constraints (getAllConstraints) import Agda.TypeChecking.Substitute (piApply, applySubst) import Agda.TypeChecking.Telescope (renamingR) import qualified Agda.TypeChecking.Substitute as I (absBody) import Agda.TypeChecking.Reduce (Normalise, normalise, instantiate) import Agda.TypeChecking.EtaContract (etaContract) import Agda.TypeChecking.Monad.Builtin (constructorForm) import Agda.TypeChecking.Free (freeIn) import qualified Agda.Utils.HashMap as HMap import Agda.Auto.NarrowingSearch import Agda.Auto.Syntax import Agda.Auto.CaseSplit hiding (lift) import Agda.Utils.Except ( Error(strMsg) , ExceptT , MonadError(catchError, throwError) ) import Agda.Utils.Lens import Agda.Utils.Impossible #include "undefined.h" norm :: Normalise t => t -> MB.TCM t norm x = normalise x --norm x = return x type O = (Maybe Int, AN.QName) -- Nothing - Def, Just npar - Con with npar parameters which don't appear in Agda data TMode = TMAll -- can be extended to distinguish between different modes (all, only def) deriving Eq type MapS a b = (Map a b, [a]) initMapS :: MapS a b initMapS = (Map.empty, []) popMapS :: (S -> (a, [b])) -> ((a, [b]) -> S -> S) -> TOM (Maybe b) popMapS r w = do (m, xs) <- gets r case xs of [] -> return Nothing (x:xs) -> do modify (w (m, xs)) return $ Just x data S = S {sConsts :: MapS AN.QName (TMode, ConstRef O), sMetas :: MapS I.MetaId (Metavar (Exp O) (RefInfo O), Maybe (MExp O, [MExp O]), [I.MetaId]), sEqs :: MapS Int (Maybe (Bool, MExp O, MExp O)), sCurMeta :: Maybe I.MetaId, sMainMeta :: I.MetaId } type TOM = StateT S MB.TCM tomy :: I.MetaId -> [(Bool, AN.QName)] -> [I.Type] -> MB.TCM ([ConstRef O], [MExp O], Map I.MetaId (Metavar (Exp O) (RefInfo O), MExp O, [MExp O], [I.MetaId]), [(Bool, MExp O, MExp O)], Map AN.QName (TMode, ConstRef O)) tomy imi icns typs = do eqs <- getEqs let r :: [AN.QName] -> TOM [AN.QName] r projfcns = do nxt <- popMapS sConsts (\x y -> y {sConsts = x}) case nxt of Just cn -> do cmap <- fst `liftM` gets sConsts let (mode, c) = cmap Map.! cn def <- lift $ getConstInfo cn let typ = MB.defType def defn = MB.theDef def typ <- lift $ norm typ typ' <- tomyType typ let clausesToDef clauses = do clauses' <- tomyClauses clauses let narg = case clauses of [] -> 0 I.Clause {I.namedClausePats = xs} : _ -> length xs return (Def narg clauses' Nothing Nothing, []) (cont, projfcns2) <- case defn of MB.Axiom {} -> return (Postulate, []) MB.Function {MB.funClauses = clauses} -> clausesToDef clauses -- MB.Primitive {MB.primClauses = []} -> throwError $ strMsg "Auto: Primitive functions are not supported" -- Andreas, 2013-06-17 breaks interaction/AutoMisc MB.Primitive {MB.primClauses = clauses} -> clausesToDef clauses MB.Datatype {MB.dataCons = cons} -> do cons2 <- mapM (\con -> getConst True con TMAll) cons return (Datatype cons2 [], []) MB.Record {MB.recFields = fields, MB.recTel = tel} -> do -- the value of recPars seems unreliable or don't know what it signifies let pars n (I.El _ (I.Pi it typ)) = Common.Arg (Common.domInfo it) (I.var n) : pars (n - 1) (I.unAbs typ) pars n (I.El s (I.Shared p)) = pars n (I.El s (I.derefPtr p)) pars _ (I.El _ _) = [] contyp npar I.EmptyTel = I.El (I.mkType 0 {- arbitrary -}) $ I.Def cn $ map I.Apply $ pars (npar - 1) typ contyp npar (I.ExtendTel it (I.Abs v tel)) = I.El (I.mkType 0 {- arbitrary -}) (I.Pi it (I.Abs v (contyp (npar + 1) tel))) contyp npar (I.ExtendTel it I.NoAbs{}) = __IMPOSSIBLE__ contyp' <- tomyType $ contyp 0 tel cc <- lift $ liftIO $ readIORef c let Datatype [con] [] = cdcont cc lift $ liftIO $ modifyIORef con (\cdef -> cdef {cdtype = contyp'}) projfcns <- mapM (\name -> getConst False name TMAll) (map Common.unArg fields) return (Datatype [con] projfcns, []{-map snd fields-}) MB.Constructor {MB.conData = dt} -> do _ <- getConst False dt TMAll -- make sure that datatype is included cc <- lift $ liftIO $ readIORef c let (Just nomi, _) = cdorigin cc return (Constructor (nomi - cddeffreevars cc), []) lift $ liftIO $ modifyIORef c (\cdef -> cdef {cdtype = typ', cdcont = cont}) r $ projfcns2 ++ projfcns Nothing -> do nxt <- popMapS sMetas (\x y -> y {sMetas = x}) case nxt of Just mi -> do mapM_ (\((_, e, i), eqi) -> do when (fmExp mi e || fmExp mi i) $ do (eqsm, eqsl) <- gets sEqs when (Map.notMember eqi eqsm) $ do modify $ \s -> s {sEqs = (Map.insert eqi Nothing eqsm, eqi : eqsl)} ) (zip eqs [0..]) mv <- lift $ lookupMeta mi msol <- case MB.mvInstantiation mv of MB.InstV{} -> lift $ withMetaInfo (getMetaInfo mv) $ do args <- getContextArgs --sol <- norm (I.MetaV mi args) sol <- instantiate $ I.MetaV mi $ map I.Apply $ permute (takeP (length args) $ mvPermutation mv) args return $ Just sol _ -> return Nothing case msol of Nothing -> return () Just sol -> do m <- getMeta mi sol' <- tomyExp sol modify $ \s -> s {sEqs = (Map.insert (Map.size (fst $ sEqs s)) (Just (False, Meta m, sol')) (fst $ sEqs s), snd $ sEqs s)} let tt = MB.jMetaType $ mvJudgement mv minfo = getMetaInfo mv localVars = map (snd . Common.unDom . ctxEntry) . envContext . clEnv $ minfo (targettype, localVars) <- lift $ withMetaInfo minfo $ do vs <- getContextArgs let targettype = tt `piApply` permute (takeP (length vs) $ mvPermutation mv) vs targettype <- norm targettype localVars <- mapM norm localVars return (targettype, localVars) modify (\s -> s {sCurMeta = Just mi}) typ' <- tomyType targettype ctx' <- mapM tomyType localVars modify (\s -> s {sCurMeta = Nothing}) modify (\s -> s {sMetas = (Map.adjust (\(m, _, deps) -> (m, Just (typ', ctx'), deps)) mi (fst $ sMetas s), snd $ sMetas s)}) r projfcns Nothing -> do nxt <- popMapS sEqs (\x y -> y {sEqs = x}) case nxt of Just eqi -> do let (ineq, e, i) = eqs !! eqi e' <- tomyExp e i' <- tomyExp i modify (\s -> s {sEqs = (Map.adjust (\_ -> Just (ineq, e', i')) eqi (fst $ sEqs s), snd $ sEqs s)}) r projfcns Nothing -> return projfcns ((icns', typs'), s) <- runStateT (do _ <- getMeta imi icns' <- mapM (\(iscon, name) -> getConst iscon name TMAll) icns typs' <- mapM tomyType typs projfcns <- r [] projfcns' <- mapM (\name -> getConst False name TMAll) projfcns [] <- r [] return (projfcns' ++ icns', typs') ) (S {sConsts = initMapS, sMetas = initMapS, sEqs = initMapS, sCurMeta = Nothing, sMainMeta = imi}) lift $ liftIO $ mapM_ categorizedecl icns' return (icns', typs', Map.map flatten (fst (sMetas s)), map fromJust $ Map.elems (fst (sEqs s)), fst (sConsts s)) where flatten (x, Just (y, z), w) = (x, y, z, w) flatten (x, Nothing, w) = __IMPOSSIBLE__ fromJust (Just x) = x fromJust Nothing = __IMPOSSIBLE__ getConst :: Bool -> AN.QName -> TMode -> TOM (ConstRef O) getConst iscon name mode = do def <- lift $ getConstInfo name case MB.theDef def of MB.Record {MB.recConHead = con} -> do let conname = I.conName con cmap <- fst `liftM` gets sConsts case Map.lookup name cmap of Just (mode', c) -> if iscon then do cd <- lift $ liftIO $ readIORef c let Datatype [con] _ = cdcont cd return con else return c Nothing -> do mainm <- gets sMainMeta dfv <- lift $ getdfv mainm name let nomi = I.arity (MB.defType def) ccon <- lift $ liftIO $ newIORef (ConstDef {cdname = show name ++ ".CONS", cdorigin = (Just nomi, conname), cdtype = __IMPOSSIBLE__, cdcont = Constructor (nomi - dfv), cddeffreevars = dfv}) -- ?? correct value of deffreevars for records? c <- lift $ liftIO $ newIORef (ConstDef {cdname = show name, cdorigin = (Nothing, name), cdtype = __IMPOSSIBLE__, cdcont = Datatype [ccon] [], cddeffreevars = dfv}) -- ?? correct value of deffreevars for records? modify (\s -> s {sConsts = (Map.insert name (mode, c) cmap, name : snd (sConsts s))}) return $ if iscon then ccon else c _ -> do cmap <- fst `liftM` gets sConsts case Map.lookup name cmap of Just (mode', c) -> return c Nothing -> do (miscon, sname) <- if iscon then do let MB.Constructor {MB.conPars = npar, MB.conData = dname} = MB.theDef def return (Just npar, show dname ++ "." ++ show (I.qnameName name)) else return (Nothing, show name) mainm <- gets sMainMeta dfv <- lift $ getdfv mainm name c <- lift $ liftIO $ newIORef (ConstDef {cdname = sname, cdorigin = (miscon, name), cdtype = __IMPOSSIBLE__, cdcont = __IMPOSSIBLE__, cddeffreevars = dfv}) modify (\s -> s {sConsts = (Map.insert name (mode, c) cmap, name : snd (sConsts s))}) return c getdfv :: I.MetaId -> A.QName -> MB.TCM Common.Nat getdfv mainm name = do mv <- lookupMeta mainm withMetaInfo (getMetaInfo mv) $ getDefFreeVars name getMeta :: I.MetaId -> TOM (Metavar (Exp O) (RefInfo O)) getMeta name = do mmap <- fst `liftM` gets sMetas case Map.lookup name mmap of Just (m, _, _) -> return m Nothing -> do m <- lift $ liftIO initMeta modify (\s -> s {sMetas = (Map.insert name (m, Nothing, []) mmap, name : snd (sMetas s))}) return m getEqs :: MB.TCM [(Bool, I.Term, I.Term)] getEqs = do eqs <- getAllConstraints let r = mapM (\eqc -> do neqc <- norm eqc case MB.clValue $ MB.theConstraint neqc of MB.ValueCmp ineq _ i e -> do ei <- etaContract i ee <- etaContract e return [(tomyIneq ineq, ee, ei)] MB.TypeCmp ineq i e -> do I.El _ ei <- etaContract i I.El _ ee <- etaContract e return [(tomyIneq ineq, ee, ei)] MB.Guarded (MB.UnBlock _) pid -> return [] _ -> return [] ) eqs' <- r eqs return $ concat eqs' copatternsNotImplemented :: MB.TCM a copatternsNotImplemented = MB.typeError $ MB.NotImplemented $ "The Agda synthesizer (Agsy) does not support copatterns yet" tomyClauses :: [I.Clause] -> TOM [([Pat O], MExp O)] tomyClauses [] = return [] tomyClauses (cl:cls) = do cl' <- tomyClause cl cls' <- tomyClauses cls return $ case cl' of Just cl' -> cl' : cls' Nothing -> cls' tomyClause :: I.Clause -> TOM (Maybe ([Pat O], MExp O)) tomyClause cl@(I.Clause {I.clausePerm = Perm n ps, I.clauseBody = body}) = do let pats = I.clausePats cl pats' <- mapM tomyPat pats body' <- tomyBody body return $ case body' of Just (body', _) -> Just (pats', body') Nothing -> Nothing tomyPat :: I.Arg I.Pattern -> TOM (Pat O) tomyPat p = case Common.unArg p of I.ProjP _ -> lift $ copatternsNotImplemented I.VarP n -> return $ PatVar (show n) I.DotP _ -> return $ PatVar "_" -- because Agda includes these when referring to variables in the body I.ConP con _ pats -> do let n = I.conName con c <- getConst True n TMAll pats' <- mapM (tomyPat . fmap Common.namedThing) pats def <- lift $ getConstInfo n cc <- lift $ liftIO $ readIORef c let Just npar = fst $ cdorigin cc return $ PatConApp c (replicate npar PatExp ++ pats') I.LitP _ -> throwError $ strMsg "Auto: Literals in patterns are not supported" tomyBody :: I.ClauseBodyF I.Term -> TOM (Maybe (MExp O, Int)) tomyBody (I.Body t) = do t <- lift $ norm t t' <- tomyExp t return $ Just (t', 0) tomyBody (I.Bind (I.Abs _ b)) = do res <- tomyBody b return $ case res of Nothing -> Nothing Just (b', i) -> Just (b', i + 1) tomyBody (I.Bind (I.NoAbs _ b)) = tomyBody b tomyBody I.NoBody = return Nothing weaken :: Int -> MExp O -> MExp O weaken _ e@(Meta m) = e weaken i (NotM e) = case e of App uid okh elr as -> let elr' = case elr of Var v -> if v >= i then Var (v + 1) else elr Const{} -> elr as' = weakens i as in NotM $ App uid okh elr' as' Lam hid (Abs mid t) -> let t' = weaken (i + 1) t in NotM $ Lam hid (Abs mid t') Pi uid hid possdep x (Abs mid y) -> let x' = weaken i x y' = weaken (i + 1) y in NotM $ Pi uid hid possdep x' (Abs mid y') Sort{} -> NotM e AbsurdLambda{} -> NotM e weakens :: Int -> MArgList O -> MArgList O weakens _ as@(Meta m) = as weakens i (NotM as) = case as of ALNil -> NotM as ALCons hid x xs -> let x' = weaken i x xs' = weakens i xs in NotM $ ALCons hid x' xs' ALProj{} -> __IMPOSSIBLE__ ALConPar xs -> let xs' = weakens i xs in NotM $ ALConPar xs' tomyType :: I.Type -> TOM (MExp O) tomyType (I.El _ t) = tomyExp t -- sort info is thrown away tomyExp :: I.Term -> TOM (MExp O) tomyExp v0 = case I.unSpine v0 of I.Var v es -> do let Just as = I.allApplyElims es as' <- tomyExps as return $ NotM $ App Nothing (NotM OKVal) (Var v) as' I.Lam info b -> do b' <- tomyExp (I.absBody b) return $ NotM $ Lam (cnvh info) (Abs (Id $ I.absName b) b') t@I.Lit{} -> do t <- lift $ constructorForm t case t of I.Lit{} -> throwError $ strMsg "Auto: Literals in terms are not supported" _ -> tomyExp t I.Level l -> tomyExp =<< lift (reallyUnLevelView l) I.Def name es -> do let Just as = I.allApplyElims es c <- getConst False name TMAll as' <- tomyExps as return $ NotM $ App Nothing (NotM OKVal) (Const c) as' I.Con con as -> do let name = I.conName con c <- getConst True name TMAll as' <- tomyExps as def <- lift $ getConstInfo name cc <- lift $ liftIO $ readIORef c let Just npar = fst $ cdorigin cc return $ NotM $ App Nothing (NotM OKVal) (Const c) (foldl (\x _ -> NotM $ ALConPar x) as' [1..npar]) I.Pi (Common.Dom info x) b -> do let y = I.absBody b name = I.absName b x' <- tomyType x y' <- tomyType y return $ NotM $ Pi Nothing (cnvh info) (Agda.TypeChecking.Free.freeIn 0 y) x' (Abs (Id name) y') I.Sort (I.Type (I.Max [I.ClosedLevel l])) -> return $ NotM $ Sort $ Set $ fromIntegral l I.Sort _ -> return $ NotM $ Sort UnknownSort t@I.MetaV{} -> do t <- lift $ instantiate t case t of I.MetaV mid _ -> do mcurmeta <- gets sCurMeta case mcurmeta of Nothing -> return () Just curmeta -> modify $ \ s -> s { sMetas = ( Map.adjust (\(m, x, deps) -> (m, x, mid : deps)) curmeta (fst $ sMetas s) , snd $ sMetas s ) } m <- getMeta mid return $ Meta m _ -> tomyExp t I.DontCare _ -> return $ NotM $ dontCare I.Shared p -> tomyExp $ I.derefPtr p I.ExtLam{} -> __IMPOSSIBLE__ tomyExps :: I.Args -> TOM (MM (ArgList O) (RefInfo O)) tomyExps [] = return $ NotM ALNil tomyExps (Common.Arg info a : as) = do a' <- tomyExp a as' <- tomyExps as return $ NotM $ ALCons (cnvh info) a' as' tomyIneq :: MB.Comparison -> Bool tomyIneq MB.CmpEq = False tomyIneq MB.CmpLeq = True -- --------------------------------------------- fmType :: I.MetaId -> I.Type -> Bool fmType m (I.El _ t) = fmExp m t fmExp :: I.MetaId -> I.Term -> Bool fmExp m (I.Var _ as) = fmExps m $ I.argsFromElims as fmExp m (I.Lam _ b) = fmExp m (I.unAbs b) fmExp m (I.Lit _) = False fmExp m (I.Level (I.Max as)) = any (fmLevel m) as fmExp m (I.Def _ as) = fmExps m $ I.argsFromElims as fmExp m (I.Con _ as) = fmExps m as fmExp m (I.Pi x y) = fmType m (Common.unDom x) || fmType m (I.unAbs y) fmExp m (I.Sort _) = False fmExp m (I.MetaV mid _) = mid == m fmExp m (I.DontCare _) = False fmExp m (I.Shared p) = fmExp m $ I.derefPtr p fmExp m I.ExtLam{} = __IMPOSSIBLE__ fmExps :: I.MetaId -> I.Args -> Bool fmExps m [] = False fmExps m (a : as) = fmExp m (Common.unArg a) || fmExps m as fmLevel :: I.MetaId -> I.PlusLevel -> Bool fmLevel m I.ClosedLevel{} = False fmLevel m (I.Plus _ l) = case l of I.MetaLevel m' _ -> m == m' I.NeutralLevel _ v -> fmExp m v I.BlockedLevel _ v -> fmExp m v I.UnreducedLevel v -> fmExp m v -- --------------------------------------------- cnvh :: Common.LensHiding a => a -> FMode cnvh info = case Common.getHiding info of Common.NotHidden -> NotHidden Common.Instance -> Instance Common.Hidden -> Hidden icnvh :: FMode -> I.ArgInfo icnvh h = (Common.setHiding h' Common.defaultArgInfo) where h' = case h of NotHidden -> Common.NotHidden Instance -> Common.Instance Hidden -> Common.Hidden -- --------------------------------------------- frommy :: MExp O -> ExceptT String IO I.Term frommy = frommyExp frommyType :: MExp O -> ExceptT String IO I.Type frommyType e = do e' <- frommyExp e return $ I.El (I.mkType 0) e' -- 0 is arbitrary, sort not read by Agda when reifying frommyExp :: MExp O -> ExceptT String IO I.Term frommyExp (Meta m) = do bind <- lift $ readIORef $ mbind m case bind of Nothing -> throwError "meta not bound" Just e -> frommyExp (NotM e) frommyExp (NotM e) = case e of App _ _ (Var v) as -> frommyExps 0 as (I.Var v []) App _ _ (Const c) as -> do cdef <- lift $ readIORef c let (iscon, name) = cdorigin cdef {- case iscon of Just n -> do v <- getConTerm name -- We are not in TCM frommyExps n as v -} (ndrop, h) = case iscon of Just n -> (n, \ q -> I.Con (I.ConHead q Common.Inductive [])) -- TODO: restore fields Nothing -> (0, \ f vs -> I.Def f $ map I.Apply vs) frommyExps ndrop as (h name []) Lam hid (Abs mid t) -> do t' <- frommyExp t return $ I.Lam (icnvh hid) (I.Abs (case mid of {NoId -> "x"; Id id -> id}) t') Pi _ hid _ x (Abs mid y) -> do x' <- frommyType x y' <- frommyType y return $ I.Pi (Common.Dom (icnvh hid) x') (I.Abs (case mid of {NoId -> "x"; Id id -> id}) y') -- maybe have case for Pi where possdep is False which produces Fun (and has to unweaken y), return $ I.Fun (Common.Arg (icnvh hid) x') y' Sort (Set l) -> return $ I.Sort (I.mkType (fromIntegral l)) Sort Type -> __IMPOSSIBLE__ Sort UnknownSort -> return $ I.Sort (I.mkType 0) -- hoping that it's thrown away AbsurdLambda hid -> return $ I.Lam (icnvh hid) (I.Abs abslamvarname (I.Var 0 [])) frommyExps :: Nat -> MArgList O -> I.Term -> ExceptT String IO I.Term frommyExps ndrop (Meta m) trm = do bind <- lift $ readIORef $ mbind m case bind of Nothing -> throwError "meta not bound" Just e -> frommyExps ndrop (NotM e) trm frommyExps ndrop (NotM as) trm = case as of ALNil -> return trm ALCons _ _ xs | ndrop > 0 -> frommyExps (ndrop - 1) xs trm ALCons hid x xs -> do x' <- frommyExp x frommyExps ndrop xs (addend (Common.Arg (icnvh hid) x') trm) -- Andreas, 2013-10-19 TODO: restore postfix projections ALProj eas idx hid xs -> do idx <- lift $ expandbind idx c <- case idx of NotM c -> return c Meta{} -> throwError "meta not bound" cdef <- lift $ readIORef c let name = snd $ cdorigin cdef trm2 <- frommyExps 0 eas (I.Def name []) frommyExps 0 xs (addend (Common.Arg (icnvh hid) trm) trm2) ALConPar xs | ndrop > 0 -> frommyExps (ndrop - 1) xs trm ALConPar _ -> __IMPOSSIBLE__ where addend x (I.Var h xs) = I.Var h (xs ++ [I.Apply x]) addend x (I.Con h xs) = I.Con h (xs ++ [x]) addend x (I.Def h xs) = I.Def h (xs ++ [I.Apply x]) addend x (I.Shared p) = addend x (I.derefPtr p) addend _ _ = __IMPOSSIBLE__ -- -------------------------------- abslamvarname :: String abslamvarname = "\0absurdlambda" modifyAbstractExpr :: A.Expr -> A.Expr modifyAbstractExpr = f where f (A.App i e1 (Common.Arg info (Common.Named n e2))) = A.App i (f e1) (Common.Arg info (Common.Named n (f e2))) f (A.Lam i (A.DomainFree info n) _) | show (A.nameConcrete n) == abslamvarname = A.AbsurdLam i $ Common.argInfoHiding info f (A.Lam i b e) = A.Lam i b (f e) f (A.Rec i xs) = A.Rec i (map (\(n, e) -> (n, f e)) xs) f (A.RecUpdate i e xs) = A.RecUpdate i (f e) (map (\(n, e) -> (n, f e)) xs) f (A.ScopedExpr i e) = A.ScopedExpr i (f e) f e = e modifyAbstractClause :: A.Clause -> A.Clause modifyAbstractClause (A.Clause lhs (A.RHS e) decls) = A.Clause lhs (A.RHS (modifyAbstractExpr e)) decls modifyAbstractClause cl = cl -- --------------------------------- constructPats :: Map AN.QName (TMode, ConstRef O) -> I.MetaId -> I.Clause -> MB.TCM ([(FMode, MId)], [CSPat O]) constructPats cmap mainm clause = do let cnvps ns [] = return (ns, []) cnvps ns (p : ps) = do (ns', ps') <- cnvps ns ps (ns'', p') <- cnvp ns' p return (ns'', p' : ps') cnvp ns p = let hid = cnvh $ Common.argInfo p in case Common.namedArg p of I.VarP n -> return ((hid, Id n) : ns, HI hid (CSPatVar $ length ns)) I.ConP con _ ps -> do let c = I.conName con (c2, _) <- runStateT (getConst True c TMAll) (S {sConsts = (cmap, []), sMetas = initMapS, sEqs = initMapS, sCurMeta = Nothing, sMainMeta = mainm}) (ns', ps') <- cnvps ns ps cc <- liftIO $ readIORef c2 let Just npar = fst $ cdorigin cc return (ns', HI hid (CSPatConApp c2 (replicate npar (HI Hidden CSOmittedArg) ++ ps'))) I.DotP t -> do (t2, _) <- runStateT (tomyExp t) (S {sConsts = (cmap, []), sMetas = initMapS, sEqs = initMapS, sCurMeta = Nothing, sMainMeta = mainm}) return (ns, HI hid (CSPatExp t2)) I.ProjP{} -> copatternsNotImplemented _ -> __IMPOSSIBLE__ (names, pats) <- cnvps [] (I.namedClausePats clause) return (reverse names, pats) frommyClause :: (CSCtx O, [CSPat O], Maybe (MExp O)) -> ExceptT String IO I.Clause frommyClause (ids, pats, mrhs) = do let ctel [] = return I.EmptyTel ctel (HI hid (mid, t) : ctx) = do let Id id = mid tel <- ctel ctx t' <- frommyType t return $ I.ExtendTel (Common.Dom (icnvh hid) t') (I.Abs id tel) tel <- ctel $ reverse ids let getperms 0 [] perm nv = return (perm, nv) getperms n [] _ _ = __IMPOSSIBLE__ getperms 0 (p : ps) perm nv = do (perm, nv) <- getperm p perm nv getperms 0 ps perm nv getperms n (HI _ CSPatExp{} : ps) perm nv = getperms (n - 1) ps perm nv getperms n (HI _ CSOmittedArg{} : ps) perm nv = getperms (n - 1) ps perm nv getperms n (_ : _) _ _ = __IMPOSSIBLE__ getperm (HI _ p) perm nv = case p of --CSPatVar v -> return (length ids + nv - 1 - v : perm, nv) CSPatVar v -> return ((length ids - 1 - v, nv) : perm, nv + 1) CSPatConApp c ps -> do cdef <- lift $ readIORef c let (Just ndrop, _) = cdorigin cdef getperms ndrop ps perm nv CSPatExp e -> return (perm, nv + 1) _ -> __IMPOSSIBLE__ (rperm, nv) <- getperms 0 pats [] 0 let --perm = reverse rperm perm = map (\i -> let Just x = lookup i rperm in x) [0..length ids - 1] --renperm = map (\i -> length ids + nv - 1 - i) rperm --renm = rename (\i -> renperm !! i) cnvps 0 [] = return [] cnvps n [] = __IMPOSSIBLE__ cnvps 0 (p : ps) = do p' <- cnvp p ps' <- cnvps 0 ps return (p' : ps') cnvps n (HI _ CSPatExp{} : ps) = cnvps (n - 1) ps cnvps n (HI _ CSOmittedArg{} : ps) = cnvps (n - 1) ps cnvps n (_ : _) = __IMPOSSIBLE__ cnvp (HI hid p) = do p' <- case p of CSPatVar v -> return (I.VarP $ let HI _ (Id n, _) = ids !! v in n) CSPatConApp c ps -> do cdef <- lift $ readIORef c let (Just ndrop, name) = cdorigin cdef ps' <- cnvps ndrop ps let con = I.ConHead name Common.Inductive [] -- TODO: restore record fields! return (I.ConP con I.noConPatternInfo ps') CSPatExp e -> do e' <- frommyExp e {- renm e -} -- renaming before adding to clause below return (I.DotP e') CSAbsurd -> __IMPOSSIBLE__ -- CSAbsurd not used _ -> __IMPOSSIBLE__ return $ Common.Arg (icnvh hid) $ Common.unnamed p' -- TODO: recover names ps <- cnvps 0 pats body <- case mrhs of Nothing -> return $ I.NoBody Just e -> do e' <- frommyExp e {- renm e -} -- renaming before adding to clause below let r 0 = I.Body e' r n = I.Bind $ I.Abs "h" $ r (n - 1) e'' = r nv return e'' let cperm = Perm nv perm return $ I.Clause { I.clauseRange = SP.noRange , I.clauseTel = tel , I.clausePerm = cperm , I.namedClausePats = applySubst (renamingR $ compactP cperm) ps , I.clauseBody = applySubst (renamingR cperm) <$> body , I.clauseType = Nothing -- TODO: compute clause type } contains_constructor :: [CSPat O] -> Bool contains_constructor = any f where f (HI _ p) = case p of CSPatConApp{} -> True _ -> False etaContractBody :: I.ClauseBody -> MB.TCM I.ClauseBody etaContractBody (I.NoBody) = return I.NoBody etaContractBody (I.Body b) = etaContract b >>= \b -> return (I.Body b) etaContractBody (I.Bind (I.Abs id b)) = etaContractBody b >>= \b -> return (I.Bind (I.Abs id b)) etaContractBody (I.Bind (I.NoAbs x b)) = I.Bind . I.NoAbs x <$> etaContractBody b -- --------------------------------- freeIn :: Nat -> MExp o -> Bool freeIn = f where mr x = let NotM x' = x in x' f v e = case mr e of App _ _ elr args -> case elr of Var v' | v' == v -> False _ -> fs v args Lam _ (Abs _ b) -> f (v + 1) b Pi _ _ _ it (Abs _ ot) -> f v it && f (v + 1) ot Sort{} -> True AbsurdLambda{} -> True fs v es = case mr es of ALNil -> True ALCons _ a as -> f v a && fs v as ALProj{} -> __IMPOSSIBLE__ ALConPar as -> fs v as negtype :: ConstRef o -> MExp o -> MExp o negtype ee = f (0 :: Int) where mr x = let NotM x' = x in x' f n e = case mr e of Pi uid hid possdep it (Abs id ot) -> NotM $ Pi uid hid possdep it (Abs id (f (n + 1) ot)) _ -> NotM $ Pi Nothing NotHidden False (NotM $ Pi Nothing NotHidden False e (Abs NoId (NotM $ Pi Nothing NotHidden True (NotM $ Sort (Set 0)) (Abs NoId (NotM $ App Nothing (NotM OKVal) (Var 0) (NotM ALNil)))))) (Abs NoId (NotM $ App Nothing (NotM OKVal) (Const ee) (NotM ALNil))) -- --------------------------------------- findClauseDeep :: I.MetaId -> MB.TCM (Maybe (AN.QName, I.Clause, Bool)) findClauseDeep m = do sig <- getImportedSignature let res = do def <- HMap.elems $ sig ^. MB.sigDefinitions MB.Function{MB.funClauses = cs} <- [MB.theDef def] c <- cs unless (peelbinds False findMeta $ I.clauseBody c) [] return (MB.defName def, c, peelbinds __IMPOSSIBLE__ toplevel $ I.clauseBody c) return $ case res of [] -> Nothing r:_ -> Just r -- TODO: with pattern matching lambdas we might get more than one hit, which to choose? where peelbinds d f = r where r b = case b of I.Bind b -> r $ I.absBody b I.NoBody -> d I.Body e -> f e findMeta e = case I.ignoreSharing e of I.Var _ es -> findMetas $ I.argsFromElims es I.Lam _ b -> findMeta (I.absBody b) I.Lit{} -> False I.Level (I.Max as) -> any (fmLevel m) as I.Def _ es -> findMetas $ I.argsFromElims es I.Con _ as -> findMetas as I.Pi it ot -> findMetat (Common.unDom it) || findMetat (I.unAbs ot) I.Sort{} -> False I.MetaV m' _ -> m == m' I.DontCare _ -> False I.Shared{} -> __IMPOSSIBLE__ I.ExtLam{} -> __IMPOSSIBLE__ findMetas = any (findMeta . Common.unArg) findMetat (I.El _ e) = findMeta e toplevel e = case I.ignoreSharing e of I.MetaV{} -> True _ -> False -- --------------------------------------- matchType :: Int -> Int -> I.Type -> I.Type -> Maybe (Nat, Nat) -- Nat is deffreevars of const, Nat is ctx length of target type, left arg is const type, right is target type matchType cdfv tctx ctyp ttyp = trmodps cdfv ctyp where trmodps 0 ctyp = tr 0 0 ctyp trmodps n ctyp = case I.ignoreSharing $ I.unEl ctyp of I.Pi _ ot -> trmodps (n - 1) (I.absBody ot) _ -> __IMPOSSIBLE__ tr narg na ctyp = case ft 0 0 Just ctyp ttyp of Just n -> Just (n, narg) Nothing -> case I.ignoreSharing $ I.unEl ctyp of I.Pi _ (I.Abs _ ot) -> tr (narg + 1) (na + 1) ot I.Pi _ (I.NoAbs _ ot) -> tr (narg + 1) na ot _ -> Nothing where ft nl n c (I.El _ e1) (I.El _ e2) = f nl n c e1 e2 f nl n c e1 e2 = case I.ignoreSharing e1 of I.Var v1 as1 | v1 < nl -> case e2 of I.Var v2 as2 | v1 == v2 -> fes nl (n + 1) c as1 as2 _ -> Nothing I.Var v1 _ | v1 < nl + na -> c n -- unify vars with no args? I.Var v1 as1 -> case e2 of I.Var v2 as2 | cdfv + na + nl - v1 == tctx + nl - v2 -> fes nl (n + 1) c as1 as2 _ -> Nothing _ -> case (I.ignoreSharing e1, I.ignoreSharing e2) of (I.MetaV{}, _) -> c n (_, I.MetaV{}) -> c n (I.Lam hid1 b1, I.Lam hid2 b2) | hid1 == hid2 -> f (nl + 1) n c (I.absBody b1) (I.absBody b2) (I.Lit lit1, I.Lit lit2) | lit1 == lit2 -> c (n + 1) (I.Def n1 as1, I.Def n2 as2) | n1 == n2 -> fes nl (n + 1) c as1 as2 (I.Con n1 as1, I.Con n2 as2) | n1 == n2 -> fs nl (n + 1) c as1 as2 (I.Pi (Common.Dom info1 it1) ot1, I.Pi (Common.Dom info2 it2) ot2) | Common.argInfoHiding info1 == Common.argInfoHiding info2 -> ft nl n (\n -> ft (nl + 1) n c (I.absBody ot1) (I.absBody ot2)) it1 it2 (I.Sort{}, I.Sort{}) -> c n -- sloppy _ -> Nothing fs nl n c es1 es2 = case (es1, es2) of ([], []) -> c n (Common.Arg info1 e1 : es1, Common.Arg info2 e2 : es2) | Common.argInfoHiding info1 == Common.argInfoHiding info2 -> f nl n (\n -> fs nl n c es1 es2) e1 e2 _ -> Nothing fes nl n c es1 es2 = case (es1, es2) of ([], []) -> c n (I.Proj f : es1, I.Proj f' : es2) | f == f' -> fes nl n c es1 es2 (I.Apply (Common.Arg info1 e1) : es1, I.Apply (Common.Arg info2 e2) : es2) | Common.argInfoHiding info1 == Common.argInfoHiding info2 -> f nl n (\n -> fes nl n c es1 es2) e1 e2 _ -> Nothing Agda-2.4.2.5/src/full/Agda/Compiler/0000755000000000000000000000000012635075266015057 5ustar0000000000000000Agda-2.4.2.5/src/full/Agda/Compiler/CallCompiler.hs0000644000000000000000000000447612635075266017774 0ustar0000000000000000{-# LANGUAGE CPP #-} ------------------------------------------------------------------------ -- | A command which calls a compiler ------------------------------------------------------------------------ module Agda.Compiler.CallCompiler where import qualified Control.Exception as E import Control.Monad.Trans import Data.List as L import System.Exit import System.IO import System.Process import Agda.TypeChecking.Monad #include "undefined.h" import Agda.Utils.Impossible -- | Calls a compiler: -- -- * Checks the exit code to see if the compiler exits successfully. -- If not, then an exception is raised, containing the text the -- compiler printed to stderr (if any). -- -- * Uses the debug printout machinery to relay any progress -- information the compiler prints to stdout. callCompiler :: FilePath -- ^ The path to the compiler -> [String] -- ^ Command-line arguments. -> TCM () callCompiler cmd args = do merrors <- callCompiler' cmd args case merrors of Nothing -> return () Just errors -> typeError (CompilationError errors) -- | Generalisation of @callCompiler@ where the raised exception is -- returned. callCompiler' :: FilePath -- ^ The path to the compiler -> [String] -- ^ Command-line arguments. -> TCM (Maybe String) callCompiler' cmd args = do reportSLn "" 1 $ "Calling: " ++ intercalate " " (cmd : args) (_, out, err, p) <- liftIO $ createProcess (proc cmd args) { std_err = CreatePipe , std_out = CreatePipe } -- In -v0 mode we throw away any progress information printed to -- stdout. case out of Nothing -> __IMPOSSIBLE__ Just out -> forkTCM $ do -- The handle should be in text mode. liftIO $ hSetBinaryMode out False progressInfo <- liftIO $ hGetContents out mapM_ (reportSLn "" 1) $ lines progressInfo errors <- liftIO $ case err of Nothing -> __IMPOSSIBLE__ Just err -> do -- The handle should be in text mode. hSetBinaryMode err False hGetContents err exitcode <- liftIO $ do -- Ensure that the output has been read before waiting for the -- process. _ <- E.evaluate (length errors) waitForProcess p case exitcode of ExitFailure _ -> return $ Just errors _ -> return Nothing Agda-2.4.2.5/src/full/Agda/Compiler/HaskellTypes.hs0000644000000000000000000001057112635075266020027 0ustar0000000000000000{-# LANGUAGE CPP #-} -- | Translating Agda types to Haskell types. Used to ensure that imported -- Haskell functions have the right type. module Agda.Compiler.HaskellTypes where import Control.Applicative import Data.Maybe (fromMaybe) import Agda.Syntax.Common import Agda.Syntax.Internal import Agda.TypeChecking.Monad import Agda.TypeChecking.Monad.Builtin import Agda.TypeChecking.Pretty import Agda.TypeChecking.Reduce import Agda.TypeChecking.Substitute import Agda.TypeChecking.Free import Agda.Utils.Except ( MonadError(catchError) ) import Agda.Utils.Impossible #include "undefined.h" type HaskellKind = String hsStar :: HaskellKind hsStar = "*" hsKFun :: HaskellKind -> HaskellKind -> HaskellKind hsKFun k l = "(" ++ k ++ " -> " ++ l ++ ")" hsFun :: HaskellKind -> HaskellKind -> HaskellKind hsFun a b = "(" ++ a ++ " -> " ++ b ++ ")" hsUnit :: HaskellType hsUnit = "()" hsVar :: Name -> HaskellType hsVar x = "x" ++ concatMap encode (show x) where okChars = ['a'..'z'] ++ ['A'..'Y'] ++ "_'" encode 'Z' = "ZZ" encode c | c `elem` okChars = [c] | otherwise = "Z" ++ show (fromEnum c) hsApp :: String -> [HaskellType] -> HaskellType hsApp d [] = d hsApp d as = "(" ++ unwords (d : as) ++ ")" hsForall :: String -> HaskellType -> HaskellType hsForall x a = "(forall " ++ x ++ ". " ++ a ++ ")" notAHaskellKind :: Type -> TCM a notAHaskellKind a = do err <- fsep $ pwords "The type" ++ [prettyTCM a] ++ pwords "cannot be translated to a Haskell kind." typeError $ GenericError $ show err notAHaskellType :: Type -> TCM a notAHaskellType a = do err <- fsep $ pwords "The type" ++ [prettyTCM a] ++ pwords "cannot be translated to a Haskell type." typeError $ GenericError $ show err getHsType :: QName -> TCM HaskellType getHsType x = do d <- compiledHaskell . defCompiledRep <$> getConstInfo x case d of Just (HsType t) -> return t Just (HsDefn t c) -> return hsUnit _ -> notAHaskellType (El Prop $ Def x []) getHsVar :: Nat -> TCM HaskellCode getHsVar i = hsVar <$> nameOfBV i isHaskellKind :: Type -> TCM Bool isHaskellKind a = (const True <$> haskellKind a) `catchError` \_ -> return False haskellKind :: Type -> TCM HaskellKind haskellKind a = do a <- reduce a case unEl a of Sort _ -> return hsStar Pi a b -> hsKFun <$> haskellKind (unDom a) <*> underAbstraction a b haskellKind Def d _ -> do d <- compiledHaskell . defCompiledRep <$> getConstInfo d case d of Just (HsType t) -> return hsStar _ -> notAHaskellKind a _ -> notAHaskellKind a -- | Note that @Inf a b@, where @Inf@ is the INFINITY builtin, is -- translated to @@ (assuming that all coinductive -- builtins are defined). -- -- Note that if @haskellType@ supported universe polymorphism then the -- special treatment of INFINITY might not be needed. haskellType :: Type -> TCM HaskellType haskellType t = fromType t where err = notAHaskellType t fromArgs = mapM (fromTerm . unArg) fromType = fromTerm . unEl fromTerm v = do v <- unSpine <$> reduce v reportSLn "compile.haskell.type" 50 $ "toHaskellType " ++ show v kit <- liftTCM coinductionKit case v of Var x es -> do let args = fromMaybe __IMPOSSIBLE__ $ allApplyElims es hsApp <$> getHsVar x <*> fromArgs args Def d es | Just d == (nameOfInf <$> kit) -> case es of [Apply a, Apply b] -> fromTerm (unArg b) _ -> err Def d es -> do let args = fromMaybe __IMPOSSIBLE__ $ allApplyElims es hsApp <$> getHsType d <*> fromArgs args Pi a b -> if isBinderUsed b -- Andreas, 2012-04-03. Q: could we rely on Abs/NoAbs instead of again checking freeness of variable? then do hsA <- fromType (unDom a) underAbstraction a b $ \b -> hsForall <$> getHsVar 0 <*> (hsFun hsA <$> fromType b) else hsFun <$> fromType (unDom a) <*> fromType (noabsApp __IMPOSSIBLE__ b) Con c args -> hsApp <$> getHsType (conName c) <*> fromArgs args Lam{} -> err Level{} -> return hsUnit Lit{} -> return hsUnit Sort{} -> return hsUnit Shared p -> fromTerm $ derefPtr p MetaV{} -> err DontCare{} -> err ExtLam{} -> __IMPOSSIBLE__ Agda-2.4.2.5/src/full/Agda/Compiler/MAlonzo/0000755000000000000000000000000012635075266016436 5ustar0000000000000000Agda-2.4.2.5/src/full/Agda/Compiler/MAlonzo/Primitives.hs0000644000000000000000000003020612635075266021126 0ustar0000000000000000{-# LANGUAGE CPP #-} module Agda.Compiler.MAlonzo.Primitives where import Control.Monad.Reader import Control.Monad.State import Data.Char import Data.List as L import Data.Map as M import qualified Language.Haskell.Exts.Syntax as HS import {-# SOURCE #-} Agda.Compiler.MAlonzo.Compiler (closedTerm) import Agda.Compiler.MAlonzo.Misc import Agda.Compiler.MAlonzo.Pretty import Agda.Syntax.Common import Agda.Syntax.Internal import Agda.TypeChecking.Monad import Agda.TypeChecking.Monad.Builtin import Agda.TypeChecking.Reduce import Agda.TypeChecking.Pretty import Agda.Utils.Monad import qualified Agda.Utils.HashMap as HMap #include "undefined.h" import Agda.Utils.Impossible {- OLD -- | Check that the main function has type IO a, for some a. checkTypeOfMain :: QName -> Type -> TCM () checkTypeOfMain q ty | show (qnameName q) /= "main" = return () | otherwise = do Def io _ <- ignoreSharing <$> primIO ty <- normalise ty case ignoreSharing $ unEl ty of Def d _ | d == io -> return () _ -> do err <- fsep $ pwords "The type of main should be" ++ [prettyTCM io] ++ pwords " A, for some A. The given type is" ++ [prettyTCM ty] typeError $ GenericError $ show err -} -- | Check that the main function has type IO a, for some a. checkTypeOfMain :: QName -> Type -> TCM [HS.Decl] -> TCM [HS.Decl] checkTypeOfMain q ty ret | show (nameConcrete $ qnameName q) /= "main" = ret | otherwise = do Def io _ <- ignoreSharing <$> primIO ty <- normalise ty case ignoreSharing $ unEl ty of Def d _ | d == io -> (mainAlias :) <$> ret _ -> do err <- fsep $ pwords "The type of main should be" ++ [prettyTCM io] ++ pwords " A, for some A. The given type is" ++ [prettyTCM ty] typeError $ GenericError $ show err where mainAlias = HS.FunBind [HS.Match dummy mainLHS [] Nothing mainRHS emptyBinds ] mainLHS = HS.Ident "main" mainRHS = HS.UnGuardedRhs $ HS.Var $ HS.UnQual $ unqhname "d" q -- Haskell modules to be imported for BUILT-INs importsForPrim :: TCM [HS.ModuleName] importsForPrim = xForPrim $ L.map (\(s, ms) -> (s, return (L.map HS.ModuleName ms))) $ [ "CHAR" |-> ["Data.Char"] , "primIsDigit" |-> ["Data.Char"] , "primIsLower" |-> ["Data.Char"] , "primIsDigit" |-> ["Data.Char"] , "primIsAlpha" |-> ["Data.Char"] , "primIsSpace" |-> ["Data.Char"] , "primIsAscii" |-> ["Data.Char"] , "primIsLatin1" |-> ["Data.Char"] , "primIsPrint" |-> ["Data.Char"] , "primIsHexDigit" |-> ["Data.Char"] , "primToUpper" |-> ["Data.Char"] , "primToLower" |-> ["Data.Char"] ] where (|->) = (,) -- Declarations of helper functions for BUILT-INs declsForPrim :: TCM [HS.Decl] declsForPrim = xForPrim $ [ "NATURAL" |-> (++) <$> natToFrom "Integer" mazNatToInteger mazIntegerToNat <*> natToFrom "Int" mazNatToInt mazIntToNat , "LIST" |-> forList mazListToHList mazHListToList , "STRING" |-> forList mazListToString mazStringToList , "BOOL" |-> decls ["TRUE", "FALSE"] mazBoolToHBool "let { f <<0>> = True; f <<1>> = False; } in f" mazHBoolToBool "let { f True = <<0>>; f False = <<1>>; } in f" , "CHAR" |-> return [ fakeDS mazCharToInteger "(fromIntegral . Data.Char.ord :: Char -> Integer)" ] ] where infix 1 |-> (|->) = (,) forList toH toA = decls ["NIL", "CONS"] toH (concat ["let { f <<0>> = [];" ," f (<<1>> x xs) = x : f (" ++ prettyPrint mazCoerce ++ " xs)" ,"} in f"]) toA (concat ["let { f [] = <<0>>;" ," f (c:cs) = <<1>> c (" ++ prettyPrint mazCoerce ++ " (f cs));" ,"} in f"]) natToFrom hty to from = let totxt = repl ["<<0>>", "<<1>>", hty, to] $ concat [ "\\ x -> case x of { <<0>> -> 0 :: <<2>>; " , "<<1>> x -> 1 + (<<3>> (" ++ prettyPrint mazCoerce ++ " x)) }" ] fromtxt = repl ["<<0>>", "<<1>>", hty, from] $ concat [ "\\ x -> if x <= (0 :: <<2>>) then <<0>> " , "else <<1>> (" ++ prettyPrint mazCoerce ++ " (<<3>> (x - 1)))" ] in do ds <- decls ["ZERO", "SUC"] to totxt from fromtxt let rule name = HS.Rule name HS.AlwaysActive (Just [HS.RuleVar $ HS.Ident "x"]) qname = HS.UnQual . HS.Ident var = HS.Var . qname (%) = HS.App return $ [HS.RulePragmaDecl dummy [ rule (to ++ "-" ++ from) (var to % (var from % var "x")) (var "x") , rule (from ++ "-" ++ to) (var from % (var to % var "x")) (var "x") ], HS.InlineSig dummy True (HS.ActiveFrom 2) (qname to), HS.InlineSig dummy True (HS.ActiveFrom 2) (qname from) ] ++ ds decls cs n1 b1 n2 b2 = do cs' <- mapM pconName cs return $ zipWith (\ n -> fakeDS n . repl cs') [n1, n2] [b1, b2] mazNatToInteger, mazIntegerToNat, mazNatToInt, mazIntToNat, mazCharToInteger, mazListToHList, mazHListToList, mazListToString, mazStringToList, mazBoolToHBool, mazHBoolToBool :: String mazNatToInteger = "mazNatToInteger" mazIntegerToNat = "mazIntegerToNat" mazNatToInt = "mazNatToInt" mazIntToNat = "mazIntToNat" mazCharToInteger = "mazCharToInteger" mazListToHList = "mazListToHList" mazHListToList = "mazHListToList" mazListToString = "mazListToString" mazStringToList = "mazStringToList" mazBoolToHBool = "mazBoolToHBool" mazHBoolToBool = "mazHBoolToBool" -------------- xForPrim :: [(String, TCM [a])] -> TCM [a] xForPrim table = do qs <- HMap.keys <$> curDefs bs <- toList <$> gets stBuiltinThings let getName (Builtin (Def q _)) = q getName (Builtin (Con q _)) = conName q getName (Builtin (Shared p)) = getName (Builtin $ derefPtr p) getName (Builtin _) = __IMPOSSIBLE__ getName (Prim (PrimFun q _ _)) = q concat <$> sequence [ maybe (return []) id $ L.lookup s table | (s, def) <- bs, getName def `elem` qs ] -- Definition bodies for primitive functions primBody :: String -> TCM HS.Exp primBody s = maybe unimplemented (either (hsVarUQ . HS.Ident) id <$>) $ L.lookup s $ [ -- Integer functions "primIntegerPlus" |-> binAsis "(+)" "Integer" , "primIntegerMinus" |-> binAsis "(-)" "Integer" , "primIntegerTimes" |-> binAsis "(*)" "Integer" , "primIntegerDiv" |-> binAsis "div" "Integer" , "primIntegerMod" |-> binAsis "mod" "Integer" , "primIntegerEquality"|-> rel "(==)" "Integer" , "primIntegerLess" |-> rel "(<)" "Integer" , "primIntegerAbs" |-> do toN <- bltQual' "NATURAL" mazIntegerToNat return $ repl [toN] $ "\\ x -> <<0>> (abs x)" , "primNatToInteger" |-> bltQual' "NATURAL" mazNatToInteger , "primShowInteger" |-> return "(show :: Integer -> String)" -- Levels , "primLevelZero" |-> return "()" , "primLevelSuc" |-> return "(\\ _ -> ())" , "primLevelMax" |-> return "(\\ _ _ -> ())" -- Natural number functions , "primNatPlus" |-> binNat "(+)" , "primNatMinus" |-> binNat "(-)" , "primNatTimes" |-> binNat "(*)" , "primNatDivSuc" |-> binNat "(\\ x y -> div x (y + 1))" , "primNatModSuc" |-> binNat "(\\ x y -> mod x (y + 1))" , "primNatEquality" |-> relNat "(==)" , "primNatLess" |-> relNat "(<)" -- Floating point functions , "primIntegerToFloat" |-> return "(fromIntegral :: Integer -> Double)" , "primFloatPlus" |-> return "((+) :: Double -> Double -> Double)" , "primFloatMinus" |-> return "((-) :: Double -> Double -> Double)" , "primFloatTimes" |-> return "((*) :: Double -> Double -> Double)" , "primFloatDiv" |-> return "((/) :: Double -> Double -> Double)" , "primFloatEquality" |-> rel "(==)" "Double" , "primFloatLess" |-> rel "(<)" "Double" , "primRound" |-> return "(round :: Double -> Integer)" , "primFloor" |-> return "(floor :: Double -> Integer)" , "primCeiling" |-> return "(ceiling :: Double -> Integer)" , "primExp" |-> return "(exp :: Double -> Double)" , "primLog" |-> return "(log :: Double -> Double)" -- partial , "primSin" |-> return "(sin :: Double -> Double)" , "primShowFloat" |-> return "(show :: Double -> String)" , "primRound" |-> return "(round :: Double -> Integer)" -- Character functions , "primCharEquality" |-> rel "(==)" "Char" , "primIsLower" |-> pred "Data.Char.isLower" , "primIsDigit" |-> pred "Data.Char.isDigit" , "primIsAlpha" |-> pred "Data.Char.isAlpha" , "primIsSpace" |-> pred "Data.Char.isSpace" , "primIsAscii" |-> pred "Data.Char.isAscii" , "primIsLatin1" |-> pred "Data.Char.isLatin1" , "primIsPrint" |-> pred "Data.Char.isPrint" , "primIsHexDigit" |-> pred "Data.Char.isHexDigit" , "primToUpper" |-> return "Data.Char.toUpper" , "primToLower" |-> return "Data.Char.toLower" , "primCharToNat" |-> do toN <- bltQual' "NATURAL" mazIntToNat return $ repl [toN] $ "(\\ x -> <<0>> ((fromEnum :: Char -> Int) x))" , "primNatToChar" |-> do toI <- bltQual' "NATURAL" mazNatToInt return $ repl[toI] $ "(\\ x -> (toEnum :: Int -> Char) (<<0>> x))" , "primShowChar" |-> return "(show :: Char -> String)" -- String functions , "primStringToList" |-> bltQual' "STRING" mazStringToList , "primStringFromList" |-> bltQual' "STRING" mazListToString , "primStringAppend" |-> binAsis "(++)" "String" , "primStringEquality" |-> rel "(==)" "String" , "primShowString" |-> return "(show :: String -> String)" -- Reflection , "primQNameEquality" |-> rel "(==)" "MAlonzo.RTE.QName () ()" , "primShowQName" |-> return "MAlonzo.RTE.qnameString" , "primQNameType" |-> return "MAlonzo.RTE.qnameType" , "primQNameDefinition" |-> return "MAlonzo.RTE.qnameDefinition" , "primDataConstructors" |-> return "(error \"primDataConstructors: not implemented\")" -- Trust me , ("primTrustMe" , Right <$> do refl <- primRefl closedTerm $ lam "a" (lam "A" (lam "x" (lam "y" refl)))) ] where x |-> s = (x, Left <$> s) bin blt op ty from to = do from' <- bltQual' blt from to' <- bltQual' blt to return $ repl [op, opty ty, from', to'] $ "\\ x y -> <<3>> ((<<0>> :: <<1>>) (<<2>> x) (<<2>> y))" binNat op = bin "NATURAL" op "Integer" mazNatToInteger mazIntegerToNat binAsis op ty = return $ repl [op, opty ty] $ "((<<0>>) :: <<1>>)" rel' toTy op ty = do toHB <- bltQual' "BOOL" mazHBoolToBool return $ repl [op, ty, toHB, toTy] $ "(\\ x y -> <<2>> ((<<0>> :: <<1>> -> <<1>> -> Bool) (<<3>> x) (<<3>> y)))" relNat op = do toHI <- bltQual' "NATURAL" mazNatToInteger rel' toHI op "Integer" rel op ty = rel' "" op ty pred p = do toHB <- bltQual' "BOOL" mazHBoolToBool return $ repl [p, toHB] $ "(\\ x -> <<1>> (<<0>> x))" opty t = t ++ "->" ++ t ++ "->" ++ t unimplemented = typeError $ NotImplemented s lam x t = Lam (setHiding Hidden defaultArgInfo) (Abs x t) ---------------------- repl :: [String] -> String -> String repl subs = go where go ('<':'<':c:'>':'>':s) | 0 <= i && i < length subs = subs !! i ++ go s where i = ord c - ord '0' go (c:s) = c : go s go [] = [] pconName :: String -> TCM String pconName s = toS =<< getBuiltin s where toS (Con q _) = prettyPrint <$> conhqn (conName q) toS (Lam _ t) = toS (unAbs t) toS _ = mazerror $ "pconName" ++ s hasCompiledData :: [String] -> TCM Bool hasCompiledData (s:_) = toB =<< getBuiltin s where toB (Con q _) = do def <- getConstInfo =<< ignoreAbstractMode (canonicalName (conName q)) return $ case compiledHaskell $ defCompiledRep def of Just{} -> True Nothing -> False toB (Lam _ t) = toB (unAbs t) toB _ = return False hasCompiledData _ = return False bltQual' :: String -> String -> TCM String bltQual' b s = prettyPrint <$> bltQual b s Agda-2.4.2.5/src/full/Agda/Compiler/MAlonzo/Pretty.hs0000644000000000000000000000241512635075266020263 0ustar0000000000000000{-# LANGUAGE FlexibleContexts #-} {-# LANGUAGE FlexibleInstances #-} {-# LANGUAGE MultiParamTypeClasses #-} {-# LANGUAGE TemplateHaskell #-} ------------------------------------------------------------------------ -- Pretty-printing of Haskell modules ------------------------------------------------------------------------ module Agda.Compiler.MAlonzo.Pretty where import Data.Generics.Geniplate import qualified Language.Haskell.Exts.Pretty as Pretty import qualified Language.Haskell.Exts.Syntax as HS import Agda.Compiler.MAlonzo.Encode -- | Encodes module names just before pretty-printing. prettyPrint :: (Pretty.Pretty a, TransformBi HS.ModuleName (Wrap a)) => a -> String prettyPrint = Pretty.prettyPrint . unwrap . transformBi encodeModuleName . Wrap -- | A wrapper type used to avoid orphan instances. newtype Wrap a = Wrap { unwrap :: a } -- Some TransformBiT instances. instanceTransformBiT [ [t| String |] ] [t| (HS.ModuleName, Wrap HS.Exp) |] instanceTransformBiT [ [t| String |] ] [t| (HS.ModuleName, Wrap HS.Module) |] instanceTransformBiT [ [t| String |] ] [t| (HS.ModuleName, Wrap HS.ModuleName) |] instanceTransformBiT [ [t| String |] ] [t| (HS.ModuleName, Wrap HS.QName) |] Agda-2.4.2.5/src/full/Agda/Compiler/MAlonzo/Encode.hs0000644000000000000000000000732212635075266020173 0ustar0000000000000000------------------------------------------------------------------------ -- Module name encoding ------------------------------------------------------------------------ module Agda.Compiler.MAlonzo.Encode ( encodeModuleName , tests ) where import Data.Char import Data.Function import Data.List import qualified Language.Haskell.Exts.Syntax as HS import Test.QuickCheck import Agda.Compiler.MAlonzo.Misc import Agda.Utils.QuickCheck import Agda.Utils.TestHelpers -- | Can the character be used in a Haskell module name part -- (@conid@)? This function is more restrictive than what the Haskell -- report allows. isModChar :: Char -> Bool isModChar c = isLower c || c == '_' || isUpper c || isDigit c || c == '\'' -- | Haskell module names have to satisfy the Haskell (including the -- hierarchical module namespace extension) lexical syntax: -- -- @modid -> [modid.] large {small | large | digit | ' }@ -- -- 'encodeModuleName' is an injective function into the set of module -- names defined by @modid@. The function preserves @.@s, and it also -- preserves module names whose first name part is not 'mazstr'. -- -- Precondition: The input must not start or end with @.@, and no two -- @.@s may be adjacent. encodeModuleName :: HS.ModuleName -> HS.ModuleName encodeModuleName (HS.ModuleName s) = HS.ModuleName $ case splitUp s of ps | mazstr' `isPrefixOf` ps -> concat (mazstr' ++ map encNamePart (drop (length mazstr') ps)) _ -> s where -- splitUp ".apa.bepa." == [".","apa",".","bepa","."] splitUp = groupBy ((&&) `on` (/= '.')) mazstr' = splitUp mazstr encNamePart "." = "." encNamePart s = ensureFirstCharLarge s ++ concatMap enc s ensureFirstCharLarge s = case s of c : cs | isUpper c && c /= largeChar -> "" _ -> [largeChar] largeChar = 'Q' escapeChar = 'Z' isOK c = c /= escapeChar && isModChar c enc c | isOK c = [c] | otherwise = [escapeChar] ++ show (fromEnum c) ++ [escapeChar] -- Note: This injectivity test is quite weak. A better, dedicated -- generator could strengthen it. prop_encodeModuleName_injective :: M -> M -> Bool prop_encodeModuleName_injective (M s1) (M s2) = if encodeModuleName (HS.ModuleName s1) == encodeModuleName (HS.ModuleName s2) then s1 == s2 else True prop_encodeModuleName_OK :: M -> Bool prop_encodeModuleName_OK (M s') = s ~= unM (encodeModuleName (HS.ModuleName s)) where s = mazstr ++ "." ++ s' "" ~= "" = True ('.' : s) ~= ('.' : s') = s ~= s' s ~= (c : s') = isUpper c && all isModChar s1' && dropWhile (/= '.') s ~= s2' where (s1', s2') = span (/= '.') s' _ ~= _ = False unM (HS.ModuleName s) = s prop_encodeModuleName_preserved :: M -> Property prop_encodeModuleName_preserved (M m) = shouldBePreserved m ==> encodeModuleName (HS.ModuleName m) == HS.ModuleName m where shouldBePreserved m = not (m == mazstr || (mazstr ++ ".") `isPrefixOf` m) -- | Agda module names. Used to test 'encodeModuleName'. newtype M = M String deriving (Show) instance Arbitrary M where arbitrary = do ms <- choose (0, 2) m <- vectorOf ms namePart return $ M (intercalate "." m) where namePart = oneof [ return mazstr , do cs <- choose (1, 2) vectorOf cs (elements "a_AQZ0'-∀") ] ------------------------------------------------------------------------ -- All tests -- | All the properties. tests :: IO Bool tests = runTests "Agda.Compiler.MAlonzo.Encode" [ quickCheck' prop_encodeModuleName_injective , quickCheck' prop_encodeModuleName_OK , quickCheck' prop_encodeModuleName_preserved ] Agda-2.4.2.5/src/full/Agda/Compiler/MAlonzo/Misc.hs0000644000000000000000000001527512635075266017677 0ustar0000000000000000{-# LANGUAGE CPP #-} module Agda.Compiler.MAlonzo.Misc where import Control.Monad.State import Data.List as List import Data.Map as Map import Data.Set as Set import Data.Function import qualified Language.Haskell.Exts.Syntax as HS import Agda.Syntax.Common import Agda.Syntax.Internal import Agda.TypeChecking.Monad import Agda.TypeChecking.Monad.Builtin import Agda.Utils.Lens import Agda.Utils.Monad import Agda.Utils.Pretty #include "undefined.h" import Agda.Utils.Impossible -------------------------------------------------- -- Setting up Interface before compile -------------------------------------------------- setInterface :: Interface -> TCM () setInterface i = do stImportedModules .= Set.empty stCurrentModule .= Just (iModuleName i) curIF :: TCM Interface curIF = do mName <- use stCurrentModule case mName of Nothing -> __IMPOSSIBLE__ Just name -> do mm <- getVisitedModule (toTopLevelModuleName name) case mm of Nothing -> __IMPOSSIBLE__ Just mi -> return $ miInterface mi curSig :: TCM Signature curSig = iSignature <$> curIF curMName :: TCM ModuleName curMName = sigMName <$> curSig curHsMod :: TCM HS.ModuleName curHsMod = mazMod <$> curMName curDefs :: TCM Definitions curDefs = (^. sigDefinitions) <$> curSig sigMName :: Signature -> ModuleName sigMName sig = case Map.keys (sig ^. sigSections) of [] -> __IMPOSSIBLE__ m : _ -> m -------------------------------------------------- -- utilities for haskell names -------------------------------------------------- -- The following naming scheme seems to be used: -- -- * Types coming from Agda are named "T\". -- -- * Other definitions coming from Agda are named "d\". -- Exception: the main function is named "main". -- -- * Names coming from Haskell must always be used qualified. -- Exception: names from the Prelude. ihname :: String -> Nat -> HS.Name ihname s i = HS.Ident $ s ++ show i unqhname :: String -> QName -> HS.Name {- NOT A GOOD IDEA, see Issue 728 unqhname s q | ("d", "main") == (s, show(qnameName q)) = HS.Ident "main" | otherwise = ihname s (idnum $ nameId $ qnameName $ q) -} unqhname s q = ihname s (idnum $ nameId $ qnameName $ q) where idnum (NameId x _) = fromIntegral x -- the toplevel module containing the given one tlmodOf :: ModuleName -> TCM HS.ModuleName tlmodOf = fmap mazMod . tlmname tlmname :: ModuleName -> TCM ModuleName tlmname m = do -- get the names of the visited modules visited <- List.map (iModuleName . miInterface) . Map.elems <$> getVisitedModules -- find the module with the longest matching prefix to m let ms = sortBy (compare `on` (length . mnameToList)) $ List.filter (\ m' -> mnameToList m' `isPrefixOf` mnameToList m) visited case ms of (m' : _) -> return m' -- if we did not get anything, it may be because m is a section -- (a module _ ) [] -> curMName {- NOT IMPOSSIBLE! _ -> do reportSDoc "impossible" 10 $ sep [ text $ "m = " ++ show m , text $ "should be contained in the visited modules " ++ show visited ] __IMPOSSIBLE__ -} -- qualify HS.Name n by the module of QName q, if necessary; -- accumulates the used module in stImportedModules at the same time. xqual :: QName -> HS.Name -> TCM HS.QName xqual q n = do m1 <- tlmname (qnameModule q) m2 <- curMName if m1 == m2 then return (HS.UnQual n) else addImport m1 >> return (HS.Qual (mazMod m1) n) xhqn :: String -> QName -> TCM HS.QName xhqn s q = xqual q (unqhname s q) -- always use the original name for a constructor even when it's redefined. conhqn :: QName -> TCM HS.QName conhqn q = do cq <- canonicalName q def <- getConstInfo cq case (compiledHaskell (defCompiledRep def), theDef def) of (Just (HsDefn _ hs), Constructor{}) -> return $ HS.UnQual $ HS.Ident hs _ -> xhqn "C" cq -- qualify name s by the module of builtin b bltQual :: String -> String -> TCM HS.QName bltQual b s = do Def q _ <- ignoreSharing <$> getBuiltin b xqual q (HS.Ident s) -- Sub-naming for cascaded definitions for consecutive clauses. dsubname :: QName -> Nat -> HS.Name dsubname q i | i == 0 = unqhname "d" q | otherwise = unqhname ("d_" ++ show i ++ "_") q hsVarUQ :: HS.Name -> HS.Exp hsVarUQ = HS.Var . HS.UnQual -------------------------------------------------- -- Hard coded module names -------------------------------------------------- mazstr :: String mazstr = "MAlonzo.Code" mazName :: Name mazName = mkName_ dummy mazstr mazMod' :: String -> HS.ModuleName mazMod' s = HS.ModuleName $ mazstr ++ "." ++ s mazMod :: ModuleName -> HS.ModuleName mazMod = mazMod' . prettyShow mazerror :: String -> a mazerror msg = error $ mazstr ++ ": " ++ msg mazCoerce :: HS.Exp -- mazCoerce = HS.Var $ HS.Qual unsafeCoerceMod (HS.Ident "unsafeCoerce") mazCoerce = HS.Var $ HS.Qual mazRTE $ HS.Ident "mazCoerce" -- Andreas, 2011-11-16: error incomplete match now RTE-call mazIncompleteMatch :: HS.Exp mazIncompleteMatch = HS.Var $ HS.Qual mazRTE $ HS.Ident "mazIncompleteMatch" rtmIncompleteMatch :: QName -> HS.Exp rtmIncompleteMatch q = mazIncompleteMatch `HS.App` hsVarUQ (unqhname "name" q) mazRTE :: HS.ModuleName mazRTE = HS.ModuleName "MAlonzo.RTE" -- for Runtime module: Not really used (Runtime modules has been abolished). rtmMod :: HS.ModuleName rtmMod = mazMod' "Runtime" rtmQual :: String -> HS.QName rtmQual = HS.UnQual . HS.Ident rtmVar :: String -> HS.Exp rtmVar = HS.Var . rtmQual rtmError :: String -> HS.Exp rtmError s = rtmVar "error" `HS.App` (HS.Lit $ HS.String $ "MAlonzo Runtime Error: " ++ s) unsafeCoerceMod :: HS.ModuleName unsafeCoerceMod = HS.ModuleName "Unsafe.Coerce" -------------------------------------------------- -- Sloppy ways to declare = -------------------------------------------------- fakeD :: HS.Name -> String -> HS.Decl fakeD v s = HS.FunBind [ HS.Match dummy v [] Nothing (HS.UnGuardedRhs $ hsVarUQ $ HS.Ident $ s) emptyBinds ] fakeDS :: String -> String -> HS.Decl fakeDS = fakeD . HS.Ident fakeDQ :: QName -> String -> HS.Decl fakeDQ = fakeD . unqhname "d" fakeType :: String -> HS.Type fakeType = HS.TyVar . HS.Ident fakeExp :: String -> HS.Exp fakeExp = HS.Var . HS.UnQual . HS.Ident dummy :: a dummy = error "MAlonzo : this dummy value should not have been eval'ed." -------------------------------------------------- -- Auxiliary definitions -------------------------------------------------- #if MIN_VERSION_haskell_src_exts(1,17,0) emptyBinds :: Maybe HS.Binds emptyBinds = Nothing #else emptyBinds :: HS.Binds emptyBinds = HS.BDecls [] #endif Agda-2.4.2.5/src/full/Agda/Compiler/MAlonzo/Compiler.hs0000644000000000000000000007450312635075266020555 0ustar0000000000000000{-# LANGUAGE CPP #-} {-# LANGUAGE FlexibleContexts #-} {-# LANGUAGE PatternGuards #-} {-# LANGUAGE ScopedTypeVariables #-} module Agda.Compiler.MAlonzo.Compiler where #if __GLASGOW_HASKELL__ <= 708 import Prelude hiding (mapM_, mapM, sequence, concat) #endif import Control.Applicative import Control.Monad.Reader hiding (mapM_, forM_, mapM, forM, sequence) import Control.Monad.State hiding (mapM_, forM_, mapM, forM, sequence) import Data.Generics.Geniplate import Data.Foldable import qualified Data.List as List import Data.Map (Map) import qualified Data.Map as Map import Data.Maybe import Data.Set (Set) import qualified Data.Set as Set import Data.Traversable hiding (for) import qualified Language.Haskell.Exts.Extension as HS import qualified Language.Haskell.Exts.Parser as HS import qualified Language.Haskell.Exts.Pretty as HS import qualified Language.Haskell.Exts.Syntax as HS import System.Directory (createDirectoryIfMissing) import System.FilePath hiding (normalise) import Agda.Compiler.CallCompiler import Agda.Compiler.MAlonzo.Misc import Agda.Compiler.MAlonzo.Pretty import Agda.Compiler.MAlonzo.Primitives import Agda.Interaction.FindFile import Agda.Interaction.Imports import Agda.Interaction.Options import Agda.Syntax.Common import qualified Agda.Syntax.Abstract.Name as A import qualified Agda.Syntax.Concrete.Name as C import Agda.Syntax.Internal as I import Agda.Syntax.Literal import Agda.TypeChecking.Monad import Agda.TypeChecking.Monad.Builtin import Agda.TypeChecking.Datatypes import Agda.TypeChecking.Records import Agda.TypeChecking.Reduce import Agda.TypeChecking.Pretty import Agda.TypeChecking.Substitute import Agda.TypeChecking.Telescope import Agda.TypeChecking.Level (reallyUnLevelView) import Agda.TypeChecking.CompiledClause import Agda.Utils.FileName import Agda.Utils.Functor import Agda.Utils.Lens import Agda.Utils.List import Agda.Utils.Maybe import Agda.Utils.Monad import Agda.Utils.Pretty (prettyShow) import qualified Agda.Utils.IO.UTF8 as UTF8 import qualified Agda.Utils.HashMap as HMap import Agda.Utils.Singleton import Agda.Utils.Tuple #include "undefined.h" import Agda.Utils.Impossible compilerMain :: Bool -> Interface -> TCM () compilerMain modIsMain mainI = -- Preserve the state (the compiler modifies the state). -- Andreas, 2014-03-23 But we might want to collect Benchmark info, -- so use localTCState. localTCState $ do -- Compute the output directory. opts <- commandLineOptions compileDir <- case optCompileDir opts of Just dir -> return dir Nothing -> do -- The default output directory is the project root. let tm = toTopLevelModuleName $ iModuleName mainI f <- findFile tm return $ filePath $ C.projectRoot f tm setCommandLineOptions $ opts { optCompileDir = Just compileDir } ignoreAbstractMode $ do mapM_ (compile . miInterface) =<< (Map.elems <$> getVisitedModules) writeModule rteModule callGHC modIsMain mainI compile :: Interface -> TCM () compile i = do setInterface i ifM uptodate noComp $ {- else -} do yesComp writeModule =<< decl <$> curHsMod <*> (definitions =<< curDefs) <*> imports where decl mn ds imp = HS.Module dummy mn [] Nothing Nothing imp ds uptodate = liftIO =<< (isNewerThan <$> outFile_ <*> ifile) ifile = maybe __IMPOSSIBLE__ filePath <$> (findInterfaceFile . toTopLevelModuleName =<< curMName) noComp = reportSLn "" 1 . (++ " : no compilation is needed.") . show . A.mnameToConcrete =<< curMName yesComp = reportSLn "" 1 . (`repl` "Compiling <<0>> in <<1>> to <<2>>") =<< sequence [show . A.mnameToConcrete <$> curMName, ifile, outFile_] :: TCM () -------------------------------------------------- -- imported modules -- I use stImportedModules in a non-standard way, -- accumulating in it what are acutally used in Misc.xqual -------------------------------------------------- imports :: TCM [HS.ImportDecl] imports = (++) <$> hsImps <*> imps where hsImps :: TCM [HS.ImportDecl] hsImps = (List.map decl . Set.toList . Set.insert mazRTE . Set.map HS.ModuleName) <$> getHaskellImports imps :: TCM [HS.ImportDecl] imps = List.map decl . uniq <$> ((++) <$> importsForPrim <*> (List.map mazMod <$> mnames)) decl :: HS.ModuleName -> HS.ImportDecl decl m = HS.ImportDecl dummy m True False False Nothing Nothing Nothing mnames :: TCM [ModuleName] mnames = (++) <$> (Set.elems <$> use stImportedModules) <*> (List.map fst . iImportedModules <$> curIF) uniq :: [HS.ModuleName] -> [HS.ModuleName] uniq = List.map head . List.group . List.sort -------------------------------------------------- -- Main compiling clauses -------------------------------------------------- definitions :: Definitions -> TCM [HS.Decl] definitions defs = do kit <- coinductionKit HMap.foldr (liftM2 (++) . (definition kit <=< instantiateFull)) declsForPrim defs -- | Note that the INFINITY, SHARP and FLAT builtins are translated as -- follows (if a 'CoinductionKit' is given): -- -- @ -- type Infinity a b = b -- -- sharp :: a -> a -- sharp x = x -- -- flat :: a -> a -- flat x = x -- @ definition :: Maybe CoinductionKit -> Definition -> TCM [HS.Decl] -- ignore irrelevant definitions {- Andreas, 2012-10-02: Invariant no longer holds definition kit (Defn Forced{} _ _ _ _ _ _ _ _) = __IMPOSSIBLE__ definition kit (Defn UnusedArg _ _ _ _ _ _ _ _) = __IMPOSSIBLE__ definition kit (Defn NonStrict _ _ _ _ _ _ _ _) = __IMPOSSIBLE__ -} definition kit Defn{defArgInfo = info, defName = q} | isIrrelevant info = do reportSDoc "malonzo.definition" 10 $ text "Not compiling" <+> prettyTCM q <> text "." return [] definition kit Defn{defName = q, defType = ty, defCompiledRep = compiled, theDef = d} = do reportSDoc "malonzo.definition" 10 $ vcat [ text "Compiling" <+> prettyTCM q <> text ":" , nest 2 $ text (show d) ] checkTypeOfMain q ty $ do (infodecl q :) <$> case d of _ | Just (HsDefn ty hs) <- compiledHaskell compiled -> return $ fbWithType ty (fakeExp hs) -- Special treatment of coinductive builtins. Datatype{} | Just q == (nameOfInf <$> kit) -> do let infT = unqhname "T" q infV = unqhname "d" q a = ihname "a" 0 b = ihname "a" 1 vars = [a, b] return [ HS.TypeDecl dummy infT (List.map HS.UnkindedVar vars) (HS.TyVar b) , HS.FunBind [HS.Match dummy infV (List.map HS.PVar vars) Nothing (HS.UnGuardedRhs HS.unit_con) emptyBinds] ] Constructor{} | Just q == (nameOfSharp <$> kit) -> do let sharp = unqhname "d" q x = ihname "x" 0 return $ [ HS.TypeSig dummy [sharp] $ fakeType $ "forall a. a -> a" , HS.FunBind [HS.Match dummy sharp [HS.PVar x] Nothing (HS.UnGuardedRhs (HS.Var (HS.UnQual x))) emptyBinds] ] Function{} | Just q == (nameOfFlat <$> kit) -> do let flat = unqhname "d" q x = ihname "x" 0 return $ [ HS.TypeSig dummy [flat] $ fakeType $ "forall a. a -> a" , HS.FunBind [HS.Match dummy flat [HS.PVar x] Nothing (HS.UnGuardedRhs (HS.Var (HS.UnQual x))) emptyBinds] ] Axiom{} -> return $ fb axiomErr Primitive{ primClauses = [], primName = s } -> fb <$> primBody s Primitive{ primClauses = cls } -> function Nothing $ functionFromClauses cls -- Currently, catchAllBranches cannot be handled properly by casetree Function{ funCompiled = Just cc } | not (hasCatchAll cc) -> function (exportHaskell compiled) $ functionFromCaseTree q cc Function{ funClauses = cls } -> function (exportHaskell compiled) $ functionFromClauses cls Datatype{ dataPars = np, dataIxs = ni, dataClause = cl, dataCons = cs } | Just (HsType ty) <- compiledHaskell compiled -> do ccs <- List.concat <$> mapM checkConstructorType cs cov <- checkCover q ty np cs return $ tvaldecl q (dataInduction d) 0 (np + ni) [] (Just __IMPOSSIBLE__) ++ ccs ++ cov Datatype{ dataPars = np, dataIxs = ni, dataClause = cl, dataCons = cs } -> do (ars, cds) <- unzip <$> mapM condecl cs return $ tvaldecl q (dataInduction d) (List.maximum (np:ars) - np) (np + ni) cds cl Constructor{} -> return [] Record{ recClause = cl, recConHead = con, recFields = flds } -> do let c = conName con let noFields = length flds let ar = I.arity ty cd <- snd <$> condecl c -- cd <- case c of -- Nothing -> return $ cdecl q noFields -- Just c -> snd <$> condecl c return $ tvaldecl q Inductive noFields ar [cd] cl where function :: Maybe HaskellExport -> TCM [HS.Decl] -> TCM [HS.Decl] function mhe fun = do ccls <- mkwhere <$> fun case mhe of Nothing -> return ccls Just (HsExport t name) -> do let tsig :: HS.Decl tsig = HS.TypeSig dummy [HS.Ident name] (fakeType t) def :: HS.Decl def = HS.FunBind [HS.Match dummy (HS.Ident name) [] Nothing (HS.UnGuardedRhs (hsVarUQ $ dsubname q 0)) emptyBinds] return ([tsig,def] ++ ccls) functionFromClauses :: [Clause] -> TCM [HS.Decl] functionFromClauses cls = mapM (clause q Nothing) (tag 0 cls) functionFromCaseTree :: QName -> CompiledClauses -> TCM [HS.Decl] functionFromCaseTree q cc = do e <- casetree cc `runReaderT` initCCEnv (Just q) return $ [HS.FunBind [HS.Match dummy (dsubname q 0) [] Nothing (HS.UnGuardedRhs e) emptyBinds]] tag :: Nat -> [Clause] -> [(Nat, Bool, Clause)] tag _ [] = [] tag i [cl] = (i, True , cl) : [] tag i (cl:cls) = (i, False, cl) : tag (i + 1) cls mkwhere :: [HS.Decl] -> [HS.Decl] mkwhere (HS.FunBind [m0, HS.Match _ dn ps mt rhs emptyBinds] : fbs@(_:_)) = [HS.FunBind [m0, HS.Match dummy dn ps mt rhs bindsAux]] where #if MIN_VERSION_haskell_src_exts(1,17,0) bindsAux :: Maybe HS.Binds bindsAux = Just $ HS.BDecls fbs #else bindsAux :: HS.Binds bindsAux = HS.BDecls fbs #endif mkwhere fbs = fbs fbWithType :: HaskellType -> HS.Exp -> [HS.Decl] fbWithType ty e = [ HS.TypeSig dummy [unqhname "d" q] $ fakeType ty ] ++ fb e fb :: HS.Exp -> [HS.Decl] fb e = [HS.FunBind [HS.Match dummy (unqhname "d" q) [] Nothing (HS.UnGuardedRhs $ e) emptyBinds]] axiomErr :: HS.Exp axiomErr = rtmError $ "postulate evaluated: " ++ show (A.qnameToConcrete q) -- | Environment for naming of local variables. -- Invariant: @reverse ccCxt ++ ccNameSupply@ data CCEnv = CCEnv { ccFunName :: Maybe QName -- ^ Agda function we are currently compiling. , ccNameSupply :: NameSupply -- ^ Supply of fresh names , ccCxt :: CCContext -- ^ Names currently in scope , ccCatchAll :: Maybe CompiledClauses -- ^ Naive catch-all implementation. -- If an inner case has no catch-all clause, we use the one from its parent. } type NameSupply = [HS.Name] type CCContext = [HS.Name] mapNameSupply :: (NameSupply -> NameSupply) -> CCEnv -> CCEnv mapNameSupply f e = e { ccNameSupply = f (ccNameSupply e) } mapContext :: (CCContext -> CCContext) -> CCEnv -> CCEnv mapContext f e = e { ccCxt = f (ccCxt e) } -- | Initial environment for expression generation. initCCEnv :: Maybe QName -> CCEnv initCCEnv q = CCEnv { ccFunName = q , ccNameSupply = map (ihname "v") [0..] -- DON'T CHANGE THESE NAMES! , ccCxt = [] , ccCatchAll = Nothing } -- | Term variables are de Bruijn indices. lookupIndex :: Int -> CCContext -> HS.Name lookupIndex i xs = fromMaybe __IMPOSSIBLE__ $ xs !!! i -- | Case variables are de Bruijn levels. lookupLevel :: Int -> CCContext -> HS.Name lookupLevel l xs = fromMaybe __IMPOSSIBLE__ $ xs !!! (length xs - 1 - l) type CC = ReaderT CCEnv TCM -- | Compile a case tree into nested case and record expressions. casetree :: CompiledClauses -> CC HS.Exp casetree cc = do case cc of Fail -> return $ rtmError $ "Impossible Clause Body" Done xs v -> lambdasUpTo (length xs) $ hsCast <$> term v Case n (Branches True conBrs _ _) -> lambdasUpTo n $ do mkRecord =<< mapM casetree (content <$> conBrs) Case n (Branches False conBrs litBrs catchAll) -> lambdasUpTo (n + 1) $ do x <- lookupLevel n <$> asks ccCxt HS.Case (hsCast $ hsVarUQ x) <$> do updateCatchAll catchAll $ do br1 <- conAlts n conBrs br2 <- litAlts litBrs br3 <- catchAllAlts =<< asks ccCatchAll return (br1 ++ br2 ++ br3) -- | Replace the current catch-all clause with a new one, if given. updateCatchAll :: Maybe CompiledClauses -> CC a -> CC a updateCatchAll Nothing = id updateCatchAll (Just cc) = local $ \ e -> e { ccCatchAll = Just cc } -- -- | Replace de Bruijn index by term in catch-all tree. -- substCatchAll :: Int -> I.Term -> CC a -> CC a -- substCatchAll i t = local $ \ e -> e { ccCatchAll = subst i t $ ccCatchAll e } conAlts :: Int -> Map QName (WithArity CompiledClauses) -> CC [HS.Alt] conAlts x br = forM (Map.toList br) $ \ (c, WithArity n cc) -> do c <- lift $ conhqn c -- TODO: substitute in ccCatchAll somehow replaceVar x n $ \ xs -> do branch (HS.PApp c $ map HS.PVar xs) cc litAlts :: Map Literal CompiledClauses -> CC [HS.Alt] litAlts br = forM (Map.toList br) $ \ (l, cc) -> -- TODO: substitute in ccCatchAll somehow branch (HS.PLit HS.Signless $ hslit l) cc catchAllAlts :: Maybe CompiledClauses -> CC [HS.Alt] catchAllAlts (Just cc) = mapM (branch HS.PWildCard) [cc] catchAllAlts Nothing = do q <- fromMaybe __IMPOSSIBLE__ <$> asks ccFunName return [ HS.Alt dummy HS.PWildCard (HS.UnGuardedRhs $ rtmIncompleteMatch q) emptyBinds ] branch :: HS.Pat -> CompiledClauses -> CC HS.Alt branch pat cc = do e <- casetree cc return $ HS.Alt dummy pat (HS.UnGuardedRhs e) emptyBinds -- | Replace de Bruijn Level @x@ by @n@ new variables. replaceVar :: Int -> Int -> ([HS.Name] -> CC a) -> CC a replaceVar x n cont = do (xs, rest) <- splitAt n <$> asks ccNameSupply let upd cxt = ys ++ reverse xs ++ zs -- We reverse xs to get nicer names. where -- compute the de Bruijn index i = length cxt - 1 - x -- discard index i (ys, _:zs) = splitAt i cxt local (mapNameSupply (const rest) . mapContext upd) $ cont xs -- | Precondition: Map not empty. mkRecord :: Map QName HS.Exp -> CC HS.Exp mkRecord fs = lift $ do -- Get the name of the first field let p1 = fst $ fromMaybe __IMPOSSIBLE__ $ headMaybe $ Map.toList fs -- Use the field name to get the record constructor and the field names. ConHead c _ind xs <- recConFromProj p1 -- Convert the constructor to a Haskell name c <- conhqn c let (args :: [HS.Exp]) = for xs $ \ x -> fromMaybe __IMPOSSIBLE__ $ Map.lookup x fs return $ hsCast $ List.foldl HS.App (HS.Con c) args -- -- | Precondition: Map not empty. -- MAlonzo does not translate field names in data decls. -- mkRecord :: Map QName HS.Exp -> CC HS.Exp -- mkRecord fs = lift $ do -- -- Get the list of (field name, expression pairs) -- let l = Map.toList fs -- -- Get the name of the first field -- let p1 = fst $ fromMaybe __IMPOSSIBLE__ $ headMaybe l -- -- Use the field name to get the record constructor -- c <- I.conName <$> recConFromProj p1 -- -- Convert it to a Haskell name -- c <- conhqn c -- -- Convert the field names into Haskell names -- fs <- mapM (mapFstM (xhqn "d")) l -- return $ hsCast $ HS.RecConstr c $ map (uncurry HS.FieldUpdate) fs recConFromProj :: QName -> TCM I.ConHead recConFromProj q = do caseMaybeM (isProjection q) __IMPOSSIBLE__ $ \ proj -> do let d = projFromType proj getRecordConstructor d -- | Introduce lambdas such that @n@ variables are in scope. lambdasUpTo :: Int -> CC HS.Exp -> CC HS.Exp lambdasUpTo n cont = do diff <- (n -) . length <$> asks ccCxt lambdas diff cont -- | Introduce n lambdas. lambdas :: Int -> CC HS.Exp -> CC HS.Exp lambdas diff cont = intros diff $ \ xs -> mkLams xs <$> cont -- -- | Introduce variables such that @n@ are in scope. -- introsUpTo :: Int -> ([HS.Name] -> CC HS.Exp) -> CC HS.Exp -- introsUpTo n cont = do -- diff <- (n -) . length <$> asks ccCxt -- intros diff cont -- | Introduce n variables into the context. intros :: Int -> ([HS.Name] -> CC HS.Exp) -> CC HS.Exp intros diff cont = do if diff <= 0 then cont [] else do -- Need diff lambdas to continue. (xs, rest) <- splitAt diff <$> asks ccNameSupply local (mapNameSupply (const rest) . mapContext (reverse xs ++)) $ cont xs -- | Prefix a Haskell expression with lambda abstractions. mkLams :: [HS.Name] -> HS.Exp -> HS.Exp mkLams [] e = e mkLams xs e = HS.Lambda dummy (map HS.PVar xs) e checkConstructorType :: QName -> TCM [HS.Decl] checkConstructorType q = do Just (HsDefn ty hs) <- compiledHaskell . defCompiledRep <$> getConstInfo q return [ HS.TypeSig dummy [unqhname "check" q] $ fakeType ty , HS.FunBind [HS.Match dummy (unqhname "check" q) [] Nothing (HS.UnGuardedRhs $ fakeExp hs) emptyBinds] ] checkCover :: QName -> HaskellType -> Nat -> [QName] -> TCM [HS.Decl] checkCover q ty n cs = do let tvs = [ "a" ++ show i | i <- [1..n] ] makeClause c = do (a, _) <- conArityAndPars c Just (HsDefn _ hsc) <- compiledHaskell . defCompiledRep <$> getConstInfo c let pat = HS.PApp (HS.UnQual $ HS.Ident hsc) $ replicate a HS.PWildCard return $ HS.Alt dummy pat (HS.UnGuardedRhs $ HS.unit_con) emptyBinds cs <- mapM makeClause cs let rhs = case cs of [] -> fakeExp "()" -- There is no empty case statement in Haskell _ -> HS.Case (HS.Var $ HS.UnQual $ HS.Ident "x") cs return [ HS.TypeSig dummy [unqhname "cover" q] $ fakeType $ unwords (ty : tvs) ++ " -> ()" , HS.FunBind [HS.Match dummy (unqhname "cover" q) [HS.PVar $ HS.Ident "x"] Nothing (HS.UnGuardedRhs rhs) emptyBinds] ] -- | Move somewhere else! conArityAndPars :: QName -> TCM (Nat, Nat) conArityAndPars q = do def <- getConstInfo q TelV tel _ <- telView $ defType def let Constructor{ conPars = np } = theDef def n = length (telToList tel) return (n - np, np) clause :: QName -> Maybe String -> (Nat, Bool, Clause) -> TCM HS.Decl clause q maybeName (i, isLast, Clause{ namedClausePats = ps, clauseBody = b }) = HS.FunBind . (: cont) <$> main where main = match <$> argpatts ps (bvars b (0::Nat)) <*> clausebody b cont | isLast && List.any isCon ps = [match (List.map HS.PVar cvs) failrhs] | isLast = [] | otherwise = [match (List.map HS.PVar cvs) crhs] cvs = List.map (ihname "v") [0 .. length ps - 1] crhs = hsCast$ List.foldl HS.App (hsVarUQ $ dsubname q (i + 1)) (List.map hsVarUQ cvs) failrhs = rtmIncompleteMatch q -- Andreas, 2011-11-16 call to RTE instead of inlined error -- failrhs = rtmError $ "incomplete pattern matching: " ++ show q match hps rhs = HS.Match dummy (maybe (dsubname q i) HS.Ident maybeName) hps Nothing (HS.UnGuardedRhs rhs) emptyBinds bvars (Body _) _ = [] bvars (Bind (Abs _ b')) n = HS.PVar (ihname "v" n) : bvars b' (n + 1) bvars (Bind (NoAbs _ b)) n = HS.PWildCard : bvars b n bvars NoBody _ = repeat HS.PWildCard -- ? isCon (Arg _ (Named _ ConP{})) = True isCon _ = False -- argpatts aps xs = hps -- xs is alist of haskell *variables* in form of patterns (because of wildcard) argpatts :: [I.NamedArg Pattern] -> [HS.Pat] -> TCM [HS.Pat] argpatts ps0 bvs = evalStateT (List.concat <$> mapM pat' ps0) bvs where pat :: Pattern -> StateT [HS.Pat] TCM [HS.Pat] pat (ProjP p ) = do kit <- lift coinductionKit -- Sharps and flats are erased from compiled code if Just p == fmap nameOfFlat kit then return [] else lift $ typeError $ NotImplemented $ "Compilation of copatterns" pat (VarP _ ) = do v <- gets head; modify tail; return [v] pat (DotP _ ) = pat (VarP dummy) -- WHY NOT: return HS.PWildCard -- SEE ABOVE pat (LitP (LitQName _ x)) = return [ litqnamepat x ] pat (LitP l ) = return [ HS.PLit HS.Signless $ hslit l ] pat p@(ConP c _ ps) = do -- Note that irr is applied once for every subpattern, so in the -- worst case it is quadratic in the size of the pattern. I -- suspect that this will not be a problem in practice, though. irrefutable <- lift $ irr p let tilde :: HS.Pat -> HS.Pat tilde = if tildesEnabled && irrefutable then HS.PParen . HS.PIrrPat else id ((:[]) . tilde . HS.PParen) <$> (HS.PApp <$> lift (conhqn $ conName c) <*> (List.concat <$> mapM pat' ps)) {- Andreas, 2013-02-15 this triggers Issue 794, because it fails to count the variables bound in p, thus, the following variables bound by patterns do not correspond to the according rhs-variables. -- Andreas, 2010-09-29 -- do not match against irrelevant stuff pat' a | isIrrelevant a = return $ HS.PWildCard -} pat' :: I.NamedArg Pattern -> StateT [HS.Pat] TCM [HS.Pat] pat' a = pat $ namedArg a tildesEnabled = False -- | Is the pattern irrefutable? irr :: Pattern -> TCM Bool irr (ProjP {}) = __IMPOSSIBLE__ irr (VarP {}) = return True irr (DotP {}) = return True irr (LitP {}) = return False irr (ConP c _ ps) = (&&) <$> singleConstructorType (conName c) <*> (andM $ List.map irr' ps) -- | Irrelevant patterns are naturally irrefutable. irr' :: I.NamedArg Pattern -> TCM Bool irr' a | isIrrelevant a = return $ True irr' a = irr $ namedArg a clausebody :: ClauseBody -> TCM HS.Exp clausebody b0 = go 0 b0 where go n (Body tm ) = hsCast <$> do runReaderT (intros n $ const $ term tm) (initCCEnv Nothing) go n (Bind (Abs _ b)) = go (n+1) b go n (Bind (NoAbs _ b)) = go n b go n NoBody = return $ rtmError $ "Impossible Clause Body" closedTerm :: Term -> TCM HS.Exp closedTerm v = term v `runReaderT` initCCEnv Nothing -- | Extract Agda term to Haskell expression. -- Irrelevant arguments are extracted as @()@. -- Types are extracted as @()@. -- @DontCare@ outside of irrelevant arguments is extracted as @error@. term :: Term -> CC HS.Exp term tm0 = case unSpine $ ignoreSharing tm0 of Var i es -> do x <- lookupIndex i <$> asks ccCxt apps (hsVarUQ x) $ fromMaybe __IMPOSSIBLE__ $ allApplyElims es Lam _ at -> lambdas 1 $ term $ absBody at Lit l -> lift $ literal l Def q es -> do let Just as = allApplyElims es q <- lift $ xhqn "d" q HS.Var q `apps` as Con c as -> do let q = conName c kit <- lift coinductionKit if Just q == (nameOfSharp <$> kit) then (`apps` as) . HS.Var =<< lift (xhqn "d" q) else (`apps` as) . HS.Con =<< lift (conhqn q) Level l -> term =<< lift (reallyUnLevelView l) Pi _ _ -> return HS.unit_con Sort _ -> return HS.unit_con MetaV _ _ -> mazerror "hit MetaV" DontCare _ -> return $ rtmError $ "hit DontCare" Shared{} -> __IMPOSSIBLE__ ExtLam{} -> __IMPOSSIBLE__ where apps = foldM (\ h a -> HS.App h <$> term' a) -- | Irrelevant arguments are replaced by Haskells' (). term' :: I.Arg Term -> CC HS.Exp term' a | isIrrelevant a = return HS.unit_con term' a = term $ unArg a literal :: Literal -> TCM HS.Exp literal l = case l of LitInt _ _ -> do toN <- bltQual "NATURAL" mazIntegerToNat return $ HS.Var toN `HS.App` typed "Integer" LitFloat _ _ -> return $ typed "Double" LitQName _ x -> return $ litqname x _ -> return $ l' where l' = HS.Lit $ hslit l typed = HS.ExpTypeSig dummy l' . HS.TyCon . rtmQual hslit :: Literal -> HS.Literal hslit l = case l of LitInt _ x -> HS.Int x LitFloat _ x -> HS.Frac (toRational x) LitString _ x -> HS.String x LitChar _ x -> HS.Char x LitQName _ x -> __IMPOSSIBLE__ litqname :: QName -> HS.Exp litqname x = HS.Con (HS.Qual mazRTE $ HS.Ident "QName") `HS.App` HS.Lit (HS.Int n) `HS.App` HS.Lit (HS.Int m) `HS.App` (rtmError "primQNameType: not implemented") `HS.App` (rtmError "primQNameDefinition: not implemented") `HS.App` HS.Lit (HS.String $ show x ) where NameId n m = nameId $ qnameName x litqnamepat :: QName -> HS.Pat litqnamepat x = HS.PApp (HS.Qual mazRTE $ HS.Ident "QName") [ HS.PLit HS.Signless (HS.Int n) , HS.PLit HS.Signless (HS.Int m) , HS.PWildCard , HS.PWildCard , HS.PWildCard] where NameId n m = nameId $ qnameName x condecl :: QName -> TCM (Nat, HS.ConDecl) condecl q = do (ar, np) <- conArityAndPars q return $ (ar + np, cdecl q ar) cdecl :: QName -> Nat -> HS.ConDecl cdecl q n = HS.ConDecl (unqhname "C" q) [ HS.TyVar $ ihname "a" i | i <- [0 .. n - 1] ] tvaldecl :: QName -> Induction -- ^ Is the type inductive or coinductive? -> Nat -> Nat -> [HS.ConDecl] -> Maybe Clause -> [HS.Decl] tvaldecl q ind ntv npar cds cl = HS.FunBind [HS.Match dummy vn pvs Nothing (HS.UnGuardedRhs HS.unit_con) emptyBinds] : maybe [HS.DataDecl dummy kind [] tn tvs (List.map (HS.QualConDecl dummy [] []) cds) []] (const []) cl where (tn, vn) = (unqhname "T" q, unqhname "d" q) tvs = [ HS.UnkindedVar $ ihname "a" i | i <- [0 .. ntv - 1]] pvs = [ HS.PVar $ ihname "a" i | i <- [0 .. npar - 1]] -- Inductive data types consisting of a single constructor with a -- single argument are translated into newtypes. kind = case (ind, cds) of (Inductive, [HS.ConDecl _ [_]]) -> HS.NewType (Inductive, [HS.RecDecl _ [_]]) -> HS.NewType _ -> HS.DataType infodecl :: QName -> HS.Decl infodecl q = fakeD (unqhname "name" q) $ show $ prettyShow q -------------------------------------------------- -- Inserting unsafeCoerce -------------------------------------------------- hsCast :: HS.Exp -> HS.Exp {- hsCast = addcast . go where addcast [e@(HS.Var(HS.UnQual(HS.Ident(c:ns))))] | c == 'v' && all isDigit ns = e addcast es = foldl HS.App mazCoerce es -- this need to be extended if you generate other kinds of exps. go (HS.App e1 e2 ) = go e1 ++ [hsCast e2] go (HS.Lambda _ ps e) = [ HS.Lambda dummy ps (hsCast e) ] go e = [e] -} hsCast e = mazCoerce `HS.App` hsCast' e hsCast' :: HS.Exp -> HS.Exp hsCast' (HS.App e1 e2) = hsCast' e1 `HS.App` (hsCoerce $ hsCast' e2) hsCast' (HS.Lambda _ ps e) = HS.Lambda dummy ps $ hsCast' e hsCast' e = e -- No coercion for literal integers hsCoerce :: HS.Exp -> HS.Exp hsCoerce e@(HS.ExpTypeSig _ (HS.Lit (HS.Int{})) _) = e hsCoerce e = HS.App mazCoerce e -------------------------------------------------- -- Writing out a haskell module -------------------------------------------------- writeModule :: HS.Module -> TCM () writeModule (HS.Module l m ps w ex imp ds) = do -- Note that GHC assumes that sources use ASCII or UTF-8. out <- outFile m liftIO $ UTF8.writeFile out $ prettyPrint $ HS.Module l m (p : ps) w ex imp ds where p = HS.LanguagePragma dummy $ List.map HS.Ident $ [ "EmptyDataDecls" , "ExistentialQuantification" , "ScopedTypeVariables" , "NoMonomorphismRestriction" , "Rank2Types" ] rteModule :: HS.Module rteModule = ok $ parse $ unlines [ "module " ++ prettyPrint mazRTE ++ " where" , "import Unsafe.Coerce" , "" , "-- Special version of coerce that plays well with rules." , "{-# INLINE [1] mazCoerce #-}" , "mazCoerce = Unsafe.Coerce.unsafeCoerce" , "{-# RULES \"coerce-id\" forall (x :: a) . mazCoerce x = x #-}" , "" , "-- Builtin QNames, the third field is for the type." , "data QName a b = QName { nameId, moduleId :: Integer, qnameType :: a, qnameDefinition :: b, qnameString :: String}" , "instance Eq (QName a b) where" , " QName a b _ _ _ == QName c d _ _ _ = (a, b) == (c, d)" , "" , "mazIncompleteMatch :: String -> a" , "mazIncompleteMatch s = error (\"MAlonzo Runtime Error: incomplete pattern matching: \" ++ s)" ] where parse :: String -> HS.ParseResult HS.Module parse = HS.parseModuleWithMode HS.defaultParseMode { HS.extensions = [ HS.EnableExtension HS.ExplicitForAll ] } ok :: HS.ParseResult HS.Module -> HS.Module ok (HS.ParseOk d) = d ok HS.ParseFailed{} = __IMPOSSIBLE__ compileDir :: TCM FilePath compileDir = do mdir <- optCompileDir <$> commandLineOptions case mdir of Just dir -> return dir Nothing -> __IMPOSSIBLE__ outFile' :: (HS.Pretty a, TransformBi HS.ModuleName (Wrap a)) => a -> TCM (FilePath, FilePath) outFile' m = do mdir <- compileDir let (fdir, fn) = splitFileName $ repldot pathSeparator $ prettyPrint m let dir = mdir fdir fp = dir replaceExtension fn "hs" liftIO $ createDirectoryIfMissing True dir return (mdir, fp) where repldot c = List.map $ \ c' -> if c' == '.' then c else c' outFile :: HS.ModuleName -> TCM FilePath outFile m = snd <$> outFile' m outFile_ :: TCM FilePath outFile_ = outFile =<< curHsMod callGHC :: Bool -> Interface -> TCM () callGHC modIsMain i = do setInterface i mdir <- compileDir hsmod <- prettyPrint <$> curHsMod MName agdaMod <- curMName let outputName = case agdaMod of [] -> __IMPOSSIBLE__ ms -> last ms (mdir, fp) <- outFile' =<< curHsMod opts <- optGhcFlags <$> commandLineOptions let overridableArgs = [ "-O"] ++ (if modIsMain then ["-o", mdir show (nameConcrete outputName)] else []) ++ [ "-Werror"] otherArgs = [ "-i" ++ mdir] ++ (if modIsMain then ["-main-is", hsmod] else []) ++ [ fp , "--make" , "-fwarn-incomplete-patterns" , "-fno-warn-overlapping-patterns" ] args = overridableArgs ++ opts ++ otherArgs compiler = "ghc" -- Note: Some versions of GHC use stderr for progress reports. For -- those versions of GHC we don't print any progress information -- unless an error is encountered. callCompiler compiler args Agda-2.4.2.5/src/full/Agda/Compiler/MAlonzo/Compiler.hs-boot0000644000000000000000000000031412635075266021503 0ustar0000000000000000module Agda.Compiler.MAlonzo.Compiler where import qualified Language.Haskell.Exts.Syntax as HS import Agda.Syntax.Internal (Term) import Agda.TypeChecking.Monad (TCM) closedTerm :: Term -> TCM HS.Exp Agda-2.4.2.5/src/full/Agda/Compiler/Epic/0000755000000000000000000000000012635075266015737 5ustar0000000000000000Agda-2.4.2.5/src/full/Agda/Compiler/Epic/Smashing.hs0000644000000000000000000001201212635075266020040 0ustar0000000000000000{-# LANGUAGE CPP #-} -- | Smash functions which return something that can be inferred -- (something of a type with only one element) module Agda.Compiler.Epic.Smashing where import Control.Monad.State import Data.List import Data.Maybe import Data.Set (Set) import qualified Data.Set as Set import Agda.Syntax.Common import Agda.Syntax.Internal as SI import Agda.TypeChecking.Monad import Agda.TypeChecking.Substitute import Agda.TypeChecking.Telescope import Agda.TypeChecking.Pretty import Agda.TypeChecking.Reduce import Agda.Compiler.Epic.AuxAST as AA import Agda.Compiler.Epic.CompileState import Agda.Compiler.Epic.Interface import Agda.Utils.Lens import Agda.Utils.Monad import Agda.Utils.Size import qualified Agda.Utils.HashMap as HM #include "undefined.h" import Agda.Utils.Impossible defnPars :: Integral n => Defn -> n defnPars (Record {recPars = p}) = fromIntegral p defnPars (Constructor {conPars = p}) = fromIntegral p defnPars d = 0 -- | Main function, smash as much as possible smash'em :: [Fun] -> Compile TCM [Fun] smash'em funs = do defs <- lift $ use $ stImports . sigDefinitions funs' <- forM funs $ \f -> case f of AA.Fun{} -> case funQName f >>= flip HM.lookup defs of Nothing -> do lift $ reportSDoc "epic.smashing" 10 $ vcat [ (text . show) f <+> text " was not found"] return f Just def -> do lift $ reportSLn "epic.smashing" 10 $ "running on:" ++ (show (funQName f)) minfered <- smashable (length (funArgs f) + defnPars (theDef def)) (defType def) case minfered of Just infered -> do lift $ reportSDoc "smashing" 5 $ vcat [ prettyTCM (defName def) <+> text "is smashable"] return f { funExpr = infered , funInline = True , funComment = funComment f ++ " [SMASHED]" } Nothing -> return f _ -> do lift $ reportSLn "epic.smashing" 10 $ "smashing!" return f return funs' (+++) :: Telescope -> Telescope -> Telescope xs +++ ys = unflattenTel names $ map (raise (size ys)) (flattenTel xs) ++ flattenTel ys where names = teleNames xs ++ teleNames ys -- | Can a datatype be inferred? If so, return the only possible value. inferable :: Set QName -> QName -> [SI.Arg Term] -> Compile TCM (Maybe Expr) inferable visited dat args | dat `Set.member` visited = return Nothing inferable visited dat args = do lift $ reportSLn "epic.smashing" 10 $ " inferring:" ++ (show dat) defs <- lift $ use $ stImports . sigDefinitions let def = fromMaybe __IMPOSSIBLE__ $ HM.lookup dat defs case theDef def of d@Datatype{} -> do case dataCons d of [c] -> inferableArgs c (dataPars d) _ -> return Nothing r@Record{} -> inferableArgs (recCon r) (recPars r) f@Function{} -> do term <- lift $ normalise $ Def dat $ map SI.Apply args inferableTerm visited' term d -> do lift $ reportSLn "epic.smashing" 10 $ " failed (inferable): " ++ (show d) return Nothing where inferableArgs c pars = do defs <- lift $ use $ stImports . sigDefinitions let def = fromMaybe __IMPOSSIBLE__ $ HM.lookup c defs forc <- getForcedArgs c TelV tel _ <- lift $ telView (defType def `apply` genericTake pars args) tag <- getConstrTag c lift $ reportSDoc "epic.smashing" 10 $ nest 2 $ vcat [ text "inferableArgs!" , text "tele" <+> prettyTCM tel , text "constr:" <+> prettyTCM c ] (AA.Con tag c <$>) <$> sequence <$> forM (notForced forc $ flattenTel tel) (inferableTerm visited' . unEl . unDom) visited' = Set.insert dat visited inferableTerm :: Set QName -> Term -> Compile TCM (Maybe Expr) inferableTerm visited t = do case t of Def q es -> case allApplyElims es of Just vs -> inferable visited q vs Nothing -> return Nothing Pi _ b -> (AA.Lam "_" <$>) <$> inferableTerm visited (unEl $ unAbs b) Sort {} -> return . return $ AA.UNIT t -> do lift $ reportSLn "epic.smashing" 10 $ " failed to infer: " ++ show t return Nothing -- | Find the only possible value for a certain type. If we fail return Nothing smashable :: Int -> Type -> Compile TCM (Maybe Expr) smashable origArity typ = do defs <- lift $ use $ stImports . sigDefinitions TelV tele retType <- lift $ telView typ retType' <- return retType -- lift $ reduce retType inf <- inferableTerm Set.empty (unEl retType') lift $ reportSDoc "epic.smashing" 10 $ nest 2 $ vcat [ text "Result is" , text "inf: " <+> (text . show) inf , text "type: " <+> prettyTCM retType' ] return $ buildLambda (size tele - origArity) <$> inf buildLambda :: (Ord n, Num n) => n -> Expr -> Expr buildLambda n e | n <= 0 = e buildLambda n e | otherwise = AA.Lam "_" (buildLambda (n - 1) e) Agda-2.4.2.5/src/full/Agda/Compiler/Epic/Erasure.hs0000644000000000000000000002044512635075266017706 0ustar0000000000000000{-# LANGUAGE CPP #-} -- | Some arguments to functions (types in particular) will not be used in the -- body. Wouldn't it be useful if these wasn't passed around at all? -- Fear not, we here perform some analysis and try to remove as many of these -- occurences as possible. -- -- We employ the worker/wrapper transform, so if f x1 .. xn = e -- and we notice that some is not needed we create: f' xj .. xk = e [xi := unit] -- and f x1 .. xn = f' xj .. xk. -- i.e we erase them in f' and replace by unit, and the original f function -- calls the new f'. The idea is that f should be inlined and then peace on earth. module Agda.Compiler.Epic.Erasure where import Control.Applicative import Control.Monad.State import Data.Map (Map) import qualified Data.Map as Map import Data.Maybe import Agda.Compiler.Epic.AuxAST import Agda.Compiler.Epic.CompileState import Agda.Compiler.Epic.Interface import Agda.TypeChecking.Monad.Base (TCM) import qualified Agda.Syntax.Internal as SI import qualified Agda.Syntax.Common as Common import Agda.TypeChecking.Monad (reportSDoc) import Agda.TypeChecking.Pretty as P #include "undefined.h" import Agda.Utils.Impossible isIrr :: Relevance -> Bool isIrr Irr = True isIrr Rel = False isRel :: Relevance -> Bool isRel = not . isIrr -- | Relevance "or" (||-) :: Relevance -> Relevance -> Relevance Irr ||- b = b _ ||- _ = Rel infixr 2 ||- -- | Relevance "and" (&&-) :: Relevance -> Relevance -> Relevance Rel &&- b = b _ &&- _ = Irr infixr 3 &&- data ErasureState = ErasureState { relevancies :: Map Var [Relevance] , funs :: Map Var Fun } type Erasure = StateT ErasureState -- | Try to find as many unused variables as possible erasure :: [Fun] -> Compile TCM [Fun] erasure fs = do orgRel <- gets (relevantArgs . importedModules) (rels, erasureState) <- flip runStateT (ErasureState orgRel Map.empty) $ do mapM_ initiate fs fu <- gets funs Map.mapKeys (fromMaybe __IMPOSSIBLE__ . flip Map.lookup fu) <$> step 1 modifyEI $ \s -> s { relevantArgs = Map.mapKeys funName rels } concat <$> mapM (\f -> map (rem (relevancies erasureState)) <$> check f (Map.lookup f rels)) fs where rem rels f@Fun{} = f { funExpr = removeUnused rels (funExpr f) } rem _ f = f -- | Perform the worker//wrapper transform check :: Fun -> Maybe [Relevance] -> Compile TCM [Fun] -- If the function is already marked as to inline we don't need to create a -- new function. Also If all arguments are relevant there is nothing to do. check f@Fun{} (Just rs) | any isIrr rs && not (funInline f) = do f' <- (funName f ++) <$> newName let args' = pairwiseFilter (map isRel rs) (funArgs f) subs = pairwiseFilter (map isIrr rs) (funArgs f) e' = foldr (\v e -> subst v "primUnit" e) (funExpr f) subs return [ Fun { funInline = True , funName = funName f , funQName = funQName f , funComment = funComment f , funArgs = funArgs f , funExpr = App f' $ map Var args' } , Fun { funInline = False , funName = f' , funQName = Nothing , funComment = funComment f ++ " [ERASED]" , funArgs = args' , funExpr = e' } ] check f _ = return [f] removeUnused :: Map Var [Relevance] -> Expr -> Expr removeUnused rels t = let rem = removeUnused rels in case t of Var _ -> t Lit _ -> t Lam v e -> Lam v (rem e) Con tag qn es -> Con tag qn (map rem es) App v es -> case Map.lookup v rels of Just re -> App v $ zipWith (\r x -> if isIrr r then UNIT else rem x) (re ++ repeat Rel) es Nothing -> App v $ map rem es Case e brs -> Case (rem e) (map (\br -> br {brExpr = rem $ brExpr br}) brs) If a b c -> If (rem a) (rem b) (rem c) Let v e1 e2 -> lett v (rem e1) (rem e2) Lazy e -> lazy (rem e) UNIT -> t IMPOSSIBLE -> t -- | Initiate a function's relevancies initiate :: Fun -> Erasure (Compile TCM) () initiate f@(Fun _ name mqname _ args _) = do let rels = replicate (length args) Irr modify $ \s -> s { relevancies = Map.insert name rels (relevancies s) , funs = Map.insert name f (funs s) } initiate f@(EpicFun {funName = name, funQName = mqname}) = case mqname of Just qn -> do ty <- lift $ getType qn let rels = initialRels ty Rel return () modify $ \s -> s { relevancies = Map.insert name rels (relevancies s) , funs = Map.insert name f (funs s) } Nothing -> return () initialRels :: SI.Type -> Relevance -> [Relevance] initialRels ty rel = case SI.unEl ty of SI.Pi a b -> mkRel a : initialRels (SI.unAbs b) rel _ -> [] where mkRel :: SI.Dom SI.Type -> Relevance mkRel a | ignoreForced (Common.getRelevance a) = Irr mkRel a = case SI.unEl (Common.unDom a) of SI.Sort _ -> Irr _ -> rel ignoreForced :: Common.Relevance -> Bool ignoreForced Common.Relevant = False ignoreForced _ = True -- | Calculate if a variable is relevant in an expression relevant :: (Functor m, Monad m) => Var -> Expr -> Erasure m Relevance relevant var expr = case expr of Var v | v == var -> return Rel | otherwise -> return Irr Lit _l -> return Irr Lam _ e -> relevant var e Con _ _ es -> relevants var es App v es | v == var -> return Rel | otherwise -> do -- The variable is relevant if it is used in a relevant position mvrs <- gets (Map.lookup v . relevancies) case mvrs of Nothing -> relevants var es Just vrs -> relevants var $ map snd $ filter ((==) Rel . fst) $ zip (vrs ++ repeat Rel) es -- foldr (||-) Irr <$> zipWith (&&-) (vrs ++ repeat Rel) <$> mapM (relevant var) es -- {- Case e [br@Branch{}] -> do cvars <- foldr (||-) Irr <$> mapM (flip relevant $ brExpr br) (brVars br) vare <- relevant var e varbr <- relevant var (brExpr br) return ((vare &&- cvars) ||- varbr) -- -} Case e brs -> (||-) <$> relevant var e <*> relevants var (map brExpr brs) If a b c -> relevants var [a,b,c] Let x e1 e2 -> (||-) <$> ((&&-) <$> relevant var e1 <*> relevant x e2) <*> relevant var e2 Lazy e -> relevant var e UNIT -> return Irr IMPOSSIBLE -> return Irr where relevants :: (Functor m, Monad m) => Var -> [Expr] -> Erasure m Relevance relevants v [] = return Irr relevants v (e : es) = do r <- relevant v e case r of Rel -> return r _ -> relevants v es -- relevants v es = return . foldr (\x y -> x ||- y) Irr =<< mapM (relevant v) es -- | Try to find a fixpoint for all the functions relevance. step :: Integer -> Erasure (Compile TCM) (Map Var [Relevance]) step nrOfLoops = do s <- get newRels <- (Map.fromList <$>) $ forM (Map.toList (funs s)) $ \(v, f) -> ((,) v <$>) $ do let funRels = fromMaybe __IMPOSSIBLE__ $ Map.lookup v (relevancies s) case f of EpicFun{} -> return funRels Fun{} -> do forM (zip (funArgs f) (funRels ++ repeat Rel)) $ \ (x, rel) -> case rel of Rel -> return Rel Irr -> do lift $ lift $ reportSDoc "epic.erasure" 10 $ P.text "running erasure:" P.<+> (P.text . show) (funQName f) relevant x (funExpr f) let relsm = newRels `Map.union` relevancies s if relevancies s == relsm then return newRels else do put s {relevancies = relsm} step (nrOfLoops + 1) diff :: (Ord k, Eq a) => Map k a -> Map k a -> [(k,(a,a))] diff m1 m2 = catMaybes $ zipWith (\(k, x) (_, y) -> if x == y then Nothing else Just (k, (x, y))) (Map.toList m1) (Map.toList m2) Agda-2.4.2.5/src/full/Agda/Compiler/Epic/Interface.hs0000644000000000000000000000452212635075266020176 0ustar0000000000000000{-# LANGUAGE DeriveDataTypeable #-} -- | Epic interface data structure, which is serialisable and stored for each -- compiled file module Agda.Compiler.Epic.Interface where import Control.Monad import Data.Function import Data.Map(Map) import Data.Monoid import Data.Set (Set) import Data.Typeable ( Typeable ) import Agda.Syntax.Common (Nat) import Agda.Syntax.Internal type Var = String data Tag = Tag Int | PrimTag Var deriving (Show, Eq, Ord, Typeable) data Forced = NotForced | Forced deriving (Show, Typeable, Eq) -- | Filter a list using a list of Bools specifying what to keep. pairwiseFilter :: [Bool] -> [a] -> [a] pairwiseFilter (True :bs) (a:as) = a : pairwiseFilter bs as pairwiseFilter (False:bs) (_:as) = pairwiseFilter bs as pairwiseFilter _ _ = [] notForced :: ForcedArgs -> [a] -> [a] notForced = pairwiseFilter . map (== NotForced) forced :: ForcedArgs -> [a] -> [a] forced = pairwiseFilter . map (== Forced) data Relevance = Irr | Rel deriving (Eq, Ord, Show, Typeable) type ForcedArgs = [Forced] type RelevantArgs = [Relevance] data InjectiveFun = InjectiveFun { injArg :: Nat , injArity :: Nat } deriving (Show, Typeable, Eq) data EInterface = EInterface { constrTags :: Map QName Tag , definitions :: Set Var , defDelayed :: Map QName Bool , conArity :: Map QName Int , mainName :: Maybe QName , relevantArgs :: Map Var RelevantArgs , forcedArgs :: Map QName ForcedArgs , injectiveFuns :: Map QName InjectiveFun } deriving (Typeable, Show) instance Monoid EInterface where mempty = EInterface { constrTags = mempty , definitions = mempty , defDelayed = mempty , conArity = mempty , mainName = Nothing , relevantArgs = mempty , forcedArgs = mempty , injectiveFuns = mempty } mappend x y = EInterface { constrTags = comb constrTags , definitions = comb definitions , defDelayed = comb defDelayed , conArity = comb conArity , mainName = mainName x `mplus` mainName y , relevantArgs = comb relevantArgs , forcedArgs = comb forcedArgs , injectiveFuns = comb injectiveFuns } where comb :: Monoid a => (EInterface -> a) -> a comb f = (mappend `on` f) x y Agda-2.4.2.5/src/full/Agda/Compiler/Epic/Injection.hs0000644000000000000000000003621012635075266020217 0ustar0000000000000000{-# LANGUAGE CPP #-} {-# LANGUAGE FlexibleInstances #-} {-# LANGUAGE PatternGuards #-} module Agda.Compiler.Epic.Injection where import Control.Monad.State import Control.Monad.Reader import Data.IntMap (IntMap) import qualified Data.IntMap as IntMap import Data.List import Data.Map (Map) import qualified Data.Map as Map import Data.Maybe import Data.Set (Set) import qualified Data.Set as Set import Agda.Syntax.Common import Agda.Syntax.Internal as I import Agda.Syntax.Internal.Pattern (FunArity(..)) import Agda.Syntax.Literal import Agda.TypeChecking.CompiledClause import Agda.TypeChecking.Monad import Agda.TypeChecking.Monad.Builtin import Agda.TypeChecking.Pretty import Agda.TypeChecking.Reduce import Agda.TypeChecking.Substitute import Agda.Utils.List import Agda.Utils.Monad import Agda.Utils.Null import qualified Agda.Utils.HashMap as HM import Agda.Compiler.Epic.CompileState import Agda.Compiler.Epic.Interface as Interface #include "undefined.h" import Agda.Utils.Impossible import Agda.Utils.Lens -- | Find potentially injective functions, solve constraints to fix some constructor -- tags and make functions whose constraints are fulfilled injections findInjection :: [(QName, Definition)] -> Compile TCM [(QName, Definition)] findInjection defs = do funs <- forM defs $ \(name, def) -> case theDef def of f@(Function{}) -> isInjective name (funClauses f) _ -> return Nothing newNames <- Map.keys <$> gets (Interface.conArity . curModule) injFuns <- solve newNames (catMaybes funs) defs' <- forM defs $ \(q, def) -> case q `isIn` injFuns of Nothing -> return (q, def) Just inj@(InjectiveFun nvar arity) -> case theDef def of f@(Function{}) -> do modifyEI $ \s -> s { injectiveFuns = Map.insert q inj (injectiveFuns s) } let ns = replicate arity (defaultArg empty) return $ (,) q $ def { theDef = f { funCompiled = Just $ Done ns $ var $ arity - nvar - 1 } } _ -> __IMPOSSIBLE__ lift $ reportSLn "epic.injection" 10 $ "injfuns: " ++ show injFuns return defs' where q `isIn` funs = case filter (\(nam, _) -> q == nam) funs of [] -> Nothing (_,x):_ -> Just x replaceFunCC :: QName -> CompiledClauses -> Compile TCM () replaceFunCC name cc = lift $ do stSignature %= updateDefinition name replaceDef stImports %= updateDefinition name replaceDef where replaceDef :: Definition -> Definition replaceDef def = case theDef def of f@(Function{}) -> def {theDef = f { funCompiled = Just $ cc } } x -> __IMPOSSIBLE__ -- | If the pairs of constructor names have the same tags, the function is -- injective. If Nothing, the function is not injective. type InjConstraints = Maybe [(QName,QName)] isInjective :: QName -- ^ Name of the function being tested -> [Clause] -- ^ The function's clauses -> Compile TCM (Maybe ((QName, InjectiveFun) , [(QName, QName)] -- These construtors should have the same name )) isInjective nam [] = return Nothing isInjective nam cls@(cl : _) = do lift $ reportSLn "epic.injection" 20 $ "checking isInjective " ++ show nam let total = funArity cls (listToMaybe . catMaybes <$>) . forM [0 .. total - 1] $ \i -> do cli <- forM cls $ \ cl -> isInjectiveHere nam i cl let cli' = catMaybes cli return $ if length cli == length cli' then Just ((nam, InjectiveFun i total), concat cli') else Nothing patternToTerm :: Nat -> Pattern -> Term patternToTerm n p = case p of VarP v -> var n DotP t -> t ConP c typ args -> Con c $ zipWith (\ arg t -> arg {unArg = t}) args $ snd $ foldr (\ arg (n, ts) -> (n + nrBinds arg, patternToTerm n arg : ts)) (n , []) $ map namedArg args LitP l -> Lit l ProjP d -> Def d [] -- Andreas, 2012-10-31 that might not be enought to get a term from list of patterns (TODO) nrBinds :: Num i => Pattern -> i nrBinds p = case p of VarP v -> 1 DotP t -> 0 ConP c typ args -> sum $ map (nrBinds . namedArg) args LitP l -> 0 ProjP{} -> 0 substForDot :: [I.NamedArg Pattern] -> Substitution substForDot = makeSubst 0 0 . reverse . calcDots where makeSubst i accum [] = raiseS (i + accum) makeSubst i accum (True : ps) = makeSubst i (accum +1) ps makeSubst i accum (False : ps) = consS (var $ i + accum) $ makeSubst (i+1) accum ps calcDots = concatMap calcDots' . map namedArg calcDots' p = case p of VarP v -> [False] DotP t -> [True] ConP c typ args -> calcDots args LitP l -> [False] ProjP{} -> [False] isInjectiveHere :: QName -- ^ Name of the function being tested -> Int -- ^ The current argument -> Clause -> Compile TCM InjConstraints isInjectiveHere nam idx clause = do lift $ reportSDoc "epic.injection" 40 $ sep [ text "isInjectiveHere" , prettyTCM nam , text ("argumentNo=" ++ show idx) -- , prettyTCM (clausePats clause) ] case getBody clause of Nothing -> return emptyC Just body -> do let t = patternToTerm idxR $ unArg $ fromMaybe __IMPOSSIBLE__ $ clausePats clause !!! idx t' = applySubst (substForDot $ namedClausePats clause) t idxR = sum . map (nrBinds . unArg) . genericDrop (idx + 1) $ clausePats clause body' <- lift $ reduce body lift $ reportSLn "epic.injection" 40 "reduced body" injFs <- gets (injectiveFuns . importedModules) lift $ reportSLn "epic.injection" 40 "calculated injFs" res <- (t' <: body') `runReaderT` (Map.insert nam (InjectiveFun idx (length (clausePats clause))) injFs) lift $ reportSDoc "epic.injection" 20 $ vcat [ text "isInjective:" <+> text (show nam) , text "at Index :" <+> text (show idx) , nest 2 $ vcat [ text "clause :" <+> text (show clause) , text "t :" <+> prettyTCM t , text "idxR :" <+> (text . show) idxR , text "body' :" <+> (text . show) body' ] , text "res :" <+> text (show res) ] return res -- | Turn NATURAL literal n into suc^n zero. litToCon :: Literal -> TCM Term litToCon l = case l of LitInt r n | n > 0 -> do inner <- litToCon (LitInt r (n - 1)) suc <- primSuc return $ suc `apply` [defaultArg inner] | otherwise -> primZero -- LitLevel _ n -> -- Does not really matter lit -> return $ Lit lit litInt :: Literal -> Bool litInt LitInt{} = True litInt _ = False insertAt :: (Nat,Term) -> Term -> Term insertAt (index, ins) = applySubst $ [var i | i <- [0 .. index - 1]] ++# consS ins (raiseS $ index + 1) solve :: [QName] -> [((QName, InjectiveFun), [(QName,QName)])] -> Compile TCM [(QName, InjectiveFun)] solve newNames xs = do lift $ reportSDoc "epic.injection" 30 $ sep $ text "Epic.Injection.solve" : map prettyTCM newNames -- Only primitive lists should be in the current module at this point, -- but we still want them conGraph <- Map.union <$> gets (constrTags . curModule) <*> gets (constrTags . importedModules) (funs, mconstr) <- ($ xs) $ flip foldM ([] , Just $ initialTags conGraph newNames) $ \ (xs , prev) (fun , con) -> do m <- foldM solvable prev con return $ case m of Nothing -> (xs, prev) Just next -> (fun : xs, m) case mconstr of Nothing -> __IMPOSSIBLE__ Just constr -> updateTags constr return funs where solvable :: Maybe Tags -> (QName, QName) -> Compile TCM (Maybe Tags) solvable Nothing _ = return Nothing solvable (Just st) (c1, c2) = unify c1 c2 st updateTags :: Tags -> Compile TCM () updateTags tags = do let (hasTags, eqs) = Map.partition isTag (constrGroup tags) isTag (IsTag _) = True isTag _ = False forM_ (Map.toList hasTags) $ \ (c, tagged) -> case tagged of IsTag tag -> putCon c tag _ -> __IMPOSSIBLE__ case Map.toList eqs of (c, Same n) : _ -> do let grp = fromMaybe __IMPOSSIBLE__ $ IntMap.lookup n $ eqGroups tags tag <- assignConstrTag' c (Set.toList grp) updateTags . fromMaybe __IMPOSSIBLE__ =<< setTag n tag tags { constrGroup = eqs } _ -> return () putCon :: QName -> Tag -> Compile TCM () putCon con tag = do m <- gets (constrTags . importedModules) case Map.lookup con m of Nothing -> putConstrTag con tag Just _ -> return () -- old emptyC :: InjConstraints emptyC = Just [] addConstraint :: QName -> QName -> InjConstraints -> InjConstraints addConstraint q1 q2 Nothing = Nothing addConstraint q1 q2 (Just xs) = Just (if q1 == q2 then xs else (q1,q2) : xs) unionConstraints :: [InjConstraints] -> InjConstraints unionConstraints [] = Just [] unionConstraints (Nothing : _) = Nothing unionConstraints (Just c : cs) = do cs' <- unionConstraints cs return (c ++ cs') -- | Are two terms injectible? -- Tries to find a mapping between constructors that equates the terms. -- -- Precondition: t1 is normalised, t2 is in WHNF -- When reducing t2, it may become a literal, which makes this not work in some cases... class Injectible a where (<:) :: a -> a -> ReaderT (Map QName InjectiveFun) (Compile TCM) InjConstraints instance Injectible a => Injectible (I.Arg a) where a1 <: a2 = unArg a1 <: unArg a2 instance Injectible a => Injectible [a] where l1 <: l2 | length l1 == length l2 = unionConstraints <$> zipWithM (<:) l1 l2 | otherwise = return Nothing instance Injectible a => Injectible (Elim' a) where e1 <: e2 = case (e1, e2) of (Proj f1 , Proj f2 ) | f1 == f2 -> return $ Just [] (Apply a1, Apply a2) -> a1 <: a2 _ -> return Nothing instance Injectible Term where t1 <: t2 = do injs <- ask -- Andreas, 2013-10-18: ignoring the precondition (NF, WHNF) since I am not maintaining it -- in recursive calls. -- The original code did not follow this invariant in the Var-Var and Def-Def case, -- thus, I am not trusting it. Also the call site does not seem to ensure it. -- It could be restored by only reducing the right argument in the Arg-instance. -- (t1, t2) <- lift . lift . reduce $ (t1, t2) -- NOTE: reduce *introduces* Lit! Loops! case (t1, t2) of (Lit l, Lit l') | l == l' -> return $ Just [] (Lit l, _) | litInt l -> do l' <- lift . lift $ litToCon l l' <: t2 (_, Lit l) | litInt l -> do l' <- lift . lift $ litToCon l t1 <: l' (_, Def n2 es2) | Just (InjectiveFun argn arit) <- Map.lookup n2 injs -> do if genericLength es2 /= arit then return Nothing else do case es2 !!! argn of Nothing -> __IMPOSSIBLE__ Just (Proj{}) -> __IMPOSSIBLE__ Just (Apply a) -> t1 <: unArg a (Var i1 es1, Var i2 es2) | i1 == i2 -> es1 <: es2 (Def q1 es1, Def q2 es2) | q1 == q2 -> es1 <: es2 (Con con1 args1, Con con2 args2) -> do let c1 = conName con1 c2 = conName con2 args1' <- flip notForced args1 <$> do lift . getForcedArgs $ c1 args2' <- flip notForced args2 <$> do lift . getForcedArgs $ c2 addConstraint c1 c2 <$> do args1' <: args2' _ -> return Nothing {- (_, Def n2 args2) | Just (InjectiveFun argn arit) <- Map.lookup n2 injs -> do if genericLength args2 /= arit then return Nothing else do arg <- lift . lift . reduce $ unArg $ args2 !! argn t1 <: arg (Var n1 args1, Var n2 args2) | n1 == n2 && length args1 == length args2 -> do args1' <- map unArg <$> mapM (lift . lift . reduce) args1 args2' <- map unArg <$> mapM (lift . lift . reduce) args2 unionConstraints <$> zipWithM (\a b -> (a <: b)) args1' args2' (Def q1 args1, Def q2 args2) | q1 == q2 && length args1 == length args2 -> do args1' <- map unArg <$> mapM (lift . lift . reduce) args1 args2' <- map unArg <$> mapM (lift . lift . reduce) args2 unionConstraints <$> zipWithM (\a b -> (a <: b)) args1' args2' (Con con1 args1, Con con2 args2) -> do let c1 = conName con1 c2 = conName con2 args1' <- map unArg <$> flip notForced args1 <$> getForcedArgs c1 args2' <- map unArg <$> (mapM (lift . lift . reduce) =<< flip notForced args2 <$> getForcedArgs c2) if length args1' == length args2' then addConstraint c1 c2 <$> unionConstraints <$> zipWithM (\a b -> (a <: b)) args1' args2' else return Nothing _ -> return Nothing -} data TagEq = Same Int | IsTag Tag deriving Eq data Tags = Tags { eqGroups :: IntMap (Set QName) , constrGroup :: Map QName TagEq } initialTags :: Map QName Tag -> [QName] -> Tags initialTags setTags newNames = Tags { eqGroups = IntMap.fromList $ zip [0..] (map Set.singleton newNames) , constrGroup = Map.map IsTag setTags `Map.union` Map.fromList (zip newNames (map Same [0..])) } unify :: QName -> QName -> Tags -> Compile TCM (Maybe Tags) unify c1 c2 ts = do let g1 = constrGroup ts !!!! c1 g2 = constrGroup ts !!!! c2 case (g1, g2) of (Same n1, Same n2) | n1 == n2 -> return $ Just ts (IsTag t1, IsTag t2) | t1 == t2 -> return $ Just ts (Same n1, Same n2) -> mergeGroups n1 n2 ts (Same n1, IsTag t2) -> setTag n1 t2 ts (IsTag t1 , Same n2) -> setTag n2 t1 ts _ -> return $ Nothing setTag :: Int -> Tag -> Tags -> Compile TCM (Maybe Tags) setTag gid tag ts = return $ Just $ ts { constrGroup = foldr (\ c -> Map.insert c (IsTag tag)) (constrGroup ts) (Set.toList $ fromMaybe __IMPOSSIBLE__ $ IntMap.lookup gid $ eqGroups ts) } mergeGroups :: Int -> Int -> Tags -> Compile TCM (Maybe Tags) mergeGroups n1 n2 ts = do let g1s = fromMaybe __IMPOSSIBLE__ $ IntMap.lookup n1 $ eqGroups ts g2s = fromMaybe __IMPOSSIBLE__ $ IntMap.lookup n2 $ eqGroups ts gs = Set.union g1s g2s g1l = Set.toList g1s g2l = Set.toList g2s ifNotM (andM $ zipWith unifiable g1l g2l) (return Nothing) $ return $ Just $ ts { eqGroups = IntMap.delete n2 $ IntMap.insert n1 gs (eqGroups ts) , constrGroup = Map.fromList [ (e2, Same n1) | e2 <- g2l ] `Map.union` constrGroup ts } unifiable :: QName -> QName -> Compile TCM Bool unifiable c1 c2 = do d1 <- getConData c1 d2 <- getConData c2 return $ d1 /= d2 (!!!!) :: Ord k => Map k v -> k -> v m !!!! k = case Map.lookup k m of Nothing -> __IMPOSSIBLE__ Just x -> x Agda-2.4.2.5/src/full/Agda/Compiler/Epic/AuxAST.hs0000644000000000000000000001200712635075266017400 0ustar0000000000000000{-# LANGUAGE CPP #-} -- | Intermediate abstract syntax tree used in the compiler. Pretty close to -- Epic syntax. module Agda.Compiler.Epic.AuxAST where import Data.Set (Set) import qualified Data.Set as Set import Agda.Syntax.Abstract.Name import Agda.Compiler.Epic.Interface #include "undefined.h" import Agda.Utils.Impossible type Comment = String type Inline = Bool data Fun = Fun { funInline :: Inline , funName :: Var , funQName :: Maybe QName , funComment :: Comment , funArgs :: [Var] , funExpr :: Expr } | EpicFun { funName :: Var , funQName :: Maybe QName , funComment :: Comment , funEpicCode :: String --EpicCode } deriving (Eq, Ord, Show) data Lit = LInt Integer | LChar Char | LString String | LFloat Double deriving (Show, Ord, Eq) data Expr = Var Var | Lit Lit | Lam Var Expr | Con Tag QName [Expr] | App Var [Expr] | Case Expr [Branch] | If Expr Expr Expr | Let Var Expr Expr | Lazy Expr | UNIT | IMPOSSIBLE deriving (Show, Ord, Eq) data Branch = Branch {brTag :: Tag, brName :: QName, brVars :: [Var], brExpr :: Expr} | BrInt {brInt :: Int, brExpr :: Expr} | Default {brExpr :: Expr} deriving (Show, Ord, Eq) getBrVars :: Branch -> [Var] getBrVars (Branch {brVars = vs}) = vs getBrVars _ = [] -------------------------------------------------------------------------------- -- * Some smart constructors -- | Smart constructor for let expressions to avoid unneceessary lets lett :: Var -> Expr -> Expr -> Expr lett v (Var v') e' = subst v v' e' lett v e e' = if v `elem` fv e' then Let v e e' else e' -- | Some things are pointless to make lazy lazy :: Expr -> Expr lazy (Lazy e) = Lazy e lazy (Lit l) = Lit l lazy UNIT = UNIT lazy x = Lazy x -- | If casing on the same expression in a sub-expression, we know what branch to -- pick casee :: Expr -> [Branch] -> Expr casee x brs = Case x [br{brExpr = casingE br (brExpr br)} | br <- brs] where casingE br expr = let rec = casingE br in case expr of Var v -> Var v Lit l -> Lit l Lam v e -> Lam v (rec e) Con t n es -> Con t n (map rec es) App v es -> App v (map rec es) Case e brs | expr == e -> case filter (sameCon br) brs of [] -> Case (rec e) [b {brExpr = rec (brExpr b)} | b <- brs] [b] -> substs (getBrVars br `zip` getBrVars b) (brExpr b) _ -> __IMPOSSIBLE__ | otherwise -> Case (rec e) [b {brExpr = rec (brExpr b)} | b <- brs] If e1 e2 e3 -> If (rec e1) (rec e2) (rec e3) Let v e1 e2 -> Let v (rec e1) (rec e2) Lazy e -> Lazy (rec e) UNIT -> UNIT IMPOSSIBLE -> IMPOSSIBLE sameCon (Branch {brTag = t1}) (Branch {brTag = t2}) = t1 == t2 sameCon (BrInt {brInt = i1}) (BrInt {brInt = i2}) = i1 == i2 sameCon _ _ = False -- | Smart constructor for applications to avoid empty applications apps :: Var -> [Expr] -> Expr apps v [] = Var v apps v as = App v as -------------------------------------------------------------------------------- -- * Substitution -- | Substitution subst :: Var -- ^ Substitute this ... -> Var -- ^ with this ... -> Expr -- ^ in this. -> Expr subst var var' expr = case expr of Var v | var == v -> Var var' | otherwise -> Var v Lit l -> Lit l Lam v e | var == v -> Lam v e | otherwise -> Lam v (subst var var' e) Con t q es -> Con t q (map (subst var var') es) App v es | var == v -> App var' (map (subst var var') es) | otherwise -> App v (map (subst var var') es) Case e brs -> Case (subst var var' e) (map (substBranch var var') brs) If a b c -> let s = subst var var' in If (s a) (s b) (s c) Let v e e' | var == v -> Let v (subst var var' e) e' | otherwise -> Let v (subst var var' e) (subst var var' e') Lazy e -> Lazy (subst var var' e) UNIT -> UNIT IMPOSSIBLE -> IMPOSSIBLE substs :: [(Var, Var)] -> Expr -> Expr substs ss e = foldr (uncurry subst) e ss substBranch :: Var -> Var -> Branch -> Branch substBranch x e br = br { brExpr = subst x e (brExpr br) } -- | Get the free variables in an expression fv :: Expr -> [Var] fv = Set.toList . fv' where fv' :: Expr -> Set Var fv' expr = case expr of Var v -> Set.singleton v Lit _ -> Set.empty Lam v e1 -> Set.delete v (fv' e1) Con _ _ es -> Set.unions (map fv' es) App v es -> Set.insert v $ Set.unions (map fv' es) Case e brs -> fv' e `Set.union` Set.unions (map fvBr brs) If a b c -> Set.unions (map fv' [a,b,c]) Let v e e' -> fv' e `Set.union` (Set.delete v $ fv' e') Lazy e -> fv' e UNIT -> Set.empty IMPOSSIBLE -> Set.empty fvBr :: Branch -> Set Var fvBr b = case b of Branch _ _ vs e -> fv' e Set.\\ Set.fromList vs BrInt _ e -> fv' e Default e -> fv' e Agda-2.4.2.5/src/full/Agda/Compiler/Epic/Epic.hs0000644000000000000000000000606712635075266017164 0ustar0000000000000000{-# LANGUAGE CPP #-} -- | Pretty-print the AuxAST to valid Epic code. module Agda.Compiler.Epic.Epic ( prettyEpicFun , prettyEpic ) where import Data.Char import Data.List import Agda.TypeChecking.Monad import Agda.Compiler.Epic.AuxAST import Agda.Compiler.Epic.CompileState import Agda.Compiler.Epic.Interface #include "undefined.h" import Agda.Utils.Impossible -- * Some auxilliary pretty-printer functions (<+>) :: String -> String -> String x <+> y = x ++ " " ++ y infixr 6 <+> ($$) :: String -> String -> String x $$ y = x ++ "\n" ++ y infixr 5 $$ many :: [String] -> String many vs = paren $ intercalate ", " vs many' :: [String] -> String many' [] = "" many' vs = paren $ intercalate ", " vs paren :: String -> String paren s = "(" <+> s <+> ")" curly :: String -> String curly s = "{-" <+> s <+> "-}" -- * Pretty-printer -- | Print a function to an Epic string prettyEpicFun :: MonadTCM m => Fun -> Compile m String prettyEpicFun (Fun inline name mqname comment vars e) = do {- defs <- lift (gets (sigDefinitions . stImports)) typ <- case mqname >>= flip M.lookup defs of Nothing -> return "-" Just def -> do doc <- lift $ prettyTCM =<< normalise (defType def) return $ show doc -} return $ "--" <+> comment $$ -- unlines (map ("-- " <+>) (lines typ)) $$ (if inline then "%inline " else "") ++ name <+> many (map typVar vars) <+> "-> Any" <+> "=" <+> prettyEpic e prettyEpicFun (EpicFun name _mqname comment def) = return $ "--" <+> comment $$ {-"%inline" <+> -} name <+> def -- | Print expression to Epic expression prettyEpic :: Expr -> String prettyEpic expr = case expr of Var v -> v Lit l -> prettyEpicLit l Lam x e -> paren $ "\\" <+> typVar x <+> "." <+> paren (prettyEpic e)-- __IMPOSSIBLE__ -- We have lambda lifted away all λs Con (Tag t) q args -> curly (show q) <+> paren ("Con" <+> show t <+> many (map prettyEpic args)) If a b c -> "if" <+> prettyEpic a <+> "then" <+> prettyEpic b <+> "else" <+> prettyEpic c Let v e e' -> "let" <+> typVar v <+> "=" <+> prettyEpic (id e) <+> "in" <+> prettyEpic e' App "proj" (Lit (LInt n) : e : es) -> paren (prettyEpic e <+> "!" <+> show n) <+> many' (map prettyEpic es) App v es -> v <+> many' (map (prettyEpic . id) es) Case e brs -> "case" <+> prettyEpic e <+> "of {" <+> intercalate "\n | " (map prettyEpicBr brs) <+> "}" Lazy e -> "lazy" <+> paren (prettyEpic e) UNIT -> "unit" IMPOSSIBLE -> "impossible" _ -> __IMPOSSIBLE__ prettyEpicBr :: Branch -> String prettyEpicBr br = case br of Branch (Tag c) q vs e -> curly (show q) <+> "Con" <+> show c <+> many (map typVar vs) <+> "->" <+> prettyEpic e BrInt n e -> show n <+> "->" <+> prettyEpic e Default e -> "Default ->" <+> prettyEpic e _ -> __IMPOSSIBLE__ prettyEpicLit :: Lit -> String prettyEpicLit l = case l of LInt n -> show n ++ "L" LChar c -> show (ord c) LString s -> show s LFloat f -> show f typVar :: Var -> String typVar v = v <+> ":" <+> "Any" Agda-2.4.2.5/src/full/Agda/Compiler/Epic/NatDetection.hs0000644000000000000000000000536712635075266020667 0ustar0000000000000000{-# LANGUAGE CPP #-} -- | Detect if a datatype could be represented as a primitive integer. -- If it has one constructor with no arguments and one with a recursive -- argument this is true. This is done using IrrFilters which filter out -- forced arguments, so for example Fin becomes primitive. module Agda.Compiler.Epic.NatDetection where import Control.Applicative import Control.Monad import Control.Monad.State import Data.Function import Data.List import Data.Maybe import Agda.Syntax.Common import Agda.Syntax.Internal import Agda.TypeChecking.Monad import Agda.Utils.Monad (andM) import Agda.Compiler.Epic.CompileState import Agda.Compiler.Epic.Interface import qualified Agda.Utils.HashMap as HM #include "undefined.h" import Agda.Utils.Impossible import Agda.Utils.Lens -- | Get a list of all the datatypes that look like nats. The [QName] is on the -- form [zeroConstr, sucConstr] getNatish :: Compile TCM [(ForcedArgs, [QName])] getNatish = do sig <- lift $ use $ stImports . sigDefinitions let defs = HM.toList sig fmap catMaybes $ forM defs $ \(q, def) -> case theDef def of d@(Datatype {}) -> isNatish q d _ -> return Nothing isNatish :: QName -> Defn -> Compile TCM (Maybe (ForcedArgs, [QName])) isNatish q d = do -- A datatype ... case dataCons d of constrs | length constrs == 2 -> do -- with two constructors ... b <- andM $ map constrInScope constrs if b then do z <- zip constrs <$> mapM getForcedArgs constrs case sortBy (compare `on` nrRel . snd) z of [(cz,fz), (cs,fs)] -> do sig <- lift $ use $ stImports . sigDefinitions let ts = defType $ sig HM.! cs nr = dataPars d return $ do guard (nrRel fz == 0) -- where one constructor has zero arguments ... guard (nrRel fs == 1) -- and the other one one argument ... guard (isRec ((fromMaybe __IMPOSSIBLE__ $ elemIndex NotForced fs) + nr) ts q) -- which is recursive. return (fs, [cz, cs]) -- It's natish! _ -> return Nothing else return Nothing _ -> return Nothing -- | Count the number of relevant arguments nrRel :: ForcedArgs -> Integer nrRel = sum . map (const 1) . filter (== NotForced) -- | Check if argument n is recursive isRec :: Int -> Type -> QName -> Bool isRec 0 (El _ t) dat = case t of Pi arg _ -> argIsDef (unDom arg) dat _ -> False isRec n (El _ t) dat = case t of Pi _ ab -> isRec (n - 1) (unAbs ab) dat _ -> False argIsDef :: Type -> QName -> Bool argIsDef (El _ t) dat = case t of Def q _ -> q == dat _ -> False Agda-2.4.2.5/src/full/Agda/Compiler/Epic/Static.hs0000644000000000000000000000770012635075266017526 0ustar0000000000000000{-# LANGUAGE CPP #-} {-# LANGUAGE FlexibleInstances #-} -- | Find the places where the builtin static is used and do some normalisation -- there. module Agda.Compiler.Epic.Static where import Control.Applicative import Control.Monad import Control.Monad.State import qualified Data.Map as Map import Data.Traversable (traverse) import Agda.Syntax.Common import Agda.Syntax.Internal as I import Agda.TypeChecking.CompiledClause import Agda.TypeChecking.Monad.Base import Agda.TypeChecking.Monad.Options import Agda.TypeChecking.Monad.Sharing import Agda.TypeChecking.Reduce import Agda.TypeChecking.Substitute import Agda.TypeChecking.Pretty import Agda.Utils.Monad import qualified Agda.Utils.HashMap as HM import Agda.Compiler.Epic.CompileState #include "undefined.h" import Agda.Utils.Impossible import Agda.Utils.Lens normaliseStatic :: CompiledClauses -> Compile TCM CompiledClauses normaliseStatic = evaluateCC evaluateCC :: CompiledClauses -> Compile TCM CompiledClauses evaluateCC ccs = case ccs of Case n brs -> do cbrs <- forM (Map.toList $ conBranches brs) $ \(c, WithArity n cc) -> (,) c <$> (WithArity n <$> evaluateCC cc) lbrs <- forM (Map.toList $ litBranches brs) $ \(l, cc) -> (,) l <$> evaluateCC cc cab <- case catchAllBranch brs of Nothing -> return Nothing Just cc -> Just <$> evaluateCC cc return $ Case n Branches { projPatterns = projPatterns brs , conBranches = Map.fromList cbrs , litBranches = Map.fromList lbrs , catchAllBranch = cab } Done n t -> Done n <$> evaluate t Fail -> return Fail etaExpand :: Term -> Compile TCM Term etaExpand def@(Def n ts) = do defs <- lift $ use $ stImports . sigDefinitions let f = maybe __IMPOSSIBLE__ theDef (HM.lookup n defs) len = length . clausePats . head . funClauses $ f toEta :: Num a => a toEta = fromIntegral $ len - length ts term = raise toEta def `apply` [ defaultArg $ Var i [] | i <- [toEta - 1, toEta - 2 .. 0]] return $ foldr (\ v t -> Lam defaultArgInfo (Abs v t)) term $ replicate toEta "staticVar" etaExpand x = return x class Evaluate a where evaluate :: a -> Compile TCM a instance Evaluate a => Evaluate [a] where evaluate = traverse evaluate instance Evaluate a => Evaluate (I.Arg a) where evaluate = traverse evaluate instance Evaluate a => Evaluate (Abs a) where evaluate = traverse evaluate -- TODO: maintain context instance Evaluate a => Evaluate (Elim' a) where evaluate = traverse evaluate instance Evaluate Term where evaluate term = case term of Var x es -> Var x <$> evaluate es Lam h b -> Lam h <$> evaluate b {- ab' <- evaluateTerm (unAbs ab) return $ Lam h $ Abs (absName ab) ab' -} Lit l -> return $ Lit l Def n es -> ifNotM (isStatic n) {- then -} (Def n <$> evaluate es) $ {- else -} do feta <- return term -- etaExpand term f <- lift $ normalise feta lift $ reportSDoc "epic.static" 10 $ vcat [ text "STATIC pragma fired" , nest 2 $ vcat [ text "before :" <+> prettyTCM term , text "after :" <+> prettyTCM f ] ] return f Con c args -> Con c <$> evaluate args Pi arg abs -> return term Sort s -> return term MetaV i args -> return term Level l -> return term DontCare i -> return term Shared{} -> updateSharedTermT evaluate term ExtLam{} -> __IMPOSSIBLE__ where {- evaluateTerms :: Args -> Compile TCM Args evaluateTerms as = forM as $ \x -> do y <- evaluateTerm (unArg x) return x { unArg = y } -} isStatic :: QName -> Compile TCM Bool isStatic q = do defs <- lift $ use $ stImports . sigDefinitions return $ case fmap theDef $ HM.lookup q defs of Nothing -> False Just (f@Function{}) -> funStatic f Just _ -> False Agda-2.4.2.5/src/full/Agda/Compiler/Epic/Forcing.hs0000644000000000000000000003247512635075266017675 0ustar0000000000000000{-# LANGUAGE CPP #-} {-# LANGUAGE ScopedTypeVariables #-} module Agda.Compiler.Epic.Forcing where import Control.Applicative import Control.Monad import Control.Monad.State import Data.Char import Data.List hiding (sort) import Data.Maybe import Agda.Syntax.Common import qualified Agda.Syntax.Internal as I import Agda.Syntax.Literal import Agda.Syntax.Position(noRange) import Agda.Syntax.Internal(Tele(..), Telescope, Term, Abs(..), unAbs, absName, Type, Args, QName, unEl) import Agda.TypeChecking.Monad import Agda.TypeChecking.Rules.LHS.Problem (FlexibleVars, defaultFlexibleVar) import Agda.TypeChecking.Rules.LHS.Unify import Agda.TypeChecking.Substitute (applySubst, apply, wkS, raiseS, dropS, (++#), TelV(..)) import qualified Agda.TypeChecking.Substitute as S import Agda.TypeChecking.Pretty as P import Agda.TypeChecking.Reduce import Agda.TypeChecking.Telescope import Agda.Utils.List import Agda.Utils.Monad import Agda.Utils.Size import qualified Agda.Utils.HashMap as HM import Agda.Compiler.Epic.AuxAST import Agda.Compiler.Epic.CompileState import Agda.Compiler.Epic.Epic import Agda.Compiler.Epic.Interface import qualified Agda.Compiler.Epic.FromAgda as FA #include "undefined.h" import Agda.Utils.Impossible import Agda.Utils.Lens -- | Returns how many parameters a datatype has dataParameters :: QName -> Compile TCM Nat dataParameters = lift . dataParametersTCM -- | Returns how many parameters a datatype has dataParametersTCM :: QName -> TCM Nat dataParametersTCM name = do m <- use $ stImports . sigDefinitions return $ maybe __IMPOSSIBLE__ (defnPars . theDef) (HM.lookup name m) where defnPars :: Defn -> Nat defnPars (Datatype {dataPars = p}) = p defnPars (Record {recPars = p}) = p defnPars d = 0 -- error (show d) -- __IMPOSSIBLE__ -- Not so sure about this. report :: Int -> TCM P.Doc -> Compile TCM () report n s = lift $ reportSDoc "epic.forcing" n s piApplyM' :: Type -> Args -> TCM Type piApplyM' t as = do {- reportSDoc "" 10 $ vcat [ text "piApplyM'" , text "type: " <+> prettyTCM t , text "args: " <+> prettyTCM as ]-} piApplyM t as {- | insertTele i xs t tele tpos tele := Gamma ; (i : T as) ; Delta n := parameters T xs' := xs `apply` (take n as) becomes tpos ( Gamma ; xs' ; Delta[i := t] --note that Delta still reference Gamma correctly , T as ^ (size xs') ) we raise the type since we have added xs' new bindings before Gamma, and as can only bind to Gamma. -} insertTele ::(QName, Args) -> Int -- ^ ABS `pos` in tele -> Maybe Type -- ^ If Just, it is the type to insert patterns from -- is nothing if we only want to delete a binding. -> Term -- ^ Term to replace at pos -> Telescope -- ^ The telescope `tele` where everything is at -> Compile TCM ( Telescope -- Resulting telescope , ( Telescope , Type -- The type at pos in tele , Type -- The return Type of the inserted type ) ) insertTele x 0 ins term (ExtendTel t to) = do t' <- lift $ normalise t report 12 $ vcat [ text "t' :" <+> prettyTCM t' , text "term:" <+> prettyTCM term , text "to:" <+> prettyTCM (unAbs to) ] (st, arg) <- case I.unEl . unDom $ t' of I.Def st es -> return (st, fromMaybe __IMPOSSIBLE__ $ I.allApplyElims es) s -> do report 10 $ vcat [ text "ERROR!!!" , text "found: " <+> (text . show) s , text "ins" <+> (prettyTCM . fromMaybe __IMPOSSIBLE__) ins ] return x -- Apply the parameters of the type of t -- Because: parameters occurs in the type of constructors but are not bound by it. pars <- dataParameters st report 10 $ text "apply in insertTele" TelV ctele ctyp <- lift $ telView =<< maybe (return $ unDom t') (`piApplyM'` genericTake pars arg) ins -- (`piApplyM'` take (fromIntegral pars) arg) ins {- OLD CODE: () <- if length (take (fromIntegral pars) arg) == fromIntegral pars then return () else __IMPOSSIBLE__ -} when (genericLength arg < pars) __IMPOSSIBLE__ -- we deal with absBody to directly since we remove t return ( ctele +:+ (S.subst 0 term $ S.raiseFrom 1 (size ctele) (unAbs to)) , (ctele, S.raise (size ctele) $ unDom t , ctyp) ) where -- Append the telescope, we raise since we add a new binding and all the previous -- bindings need to be preserved (+:+) :: Telescope -> Telescope -> Telescope EmptyTel +:+ t2 = t2 ExtendTel t t1 +:+ t2 = ExtendTel t (Abs (absName t1) $ unAbs t1 +:+ {-raise 1-} t2 ) -- This case is impossible since we are trying to split a variable outside the tele insertTele x n ins term EmptyTel = __IMPOSSIBLE__ insertTele er n ins term (ExtendTel x xs) = do (xs', typ) <- insertTele er (n - 1) ins term (unAbs xs) return (ExtendTel x $ Abs (absName xs) xs' , typ) -- TODO: restore fields in ConHead mkCon :: QName -> Int -> Term mkCon c n = I.Con (I.ConHead c Inductive []) [ defaultArg $ I.Var i [] | i <- [n - 1, n - 2 .. 0] ] unifyI :: Telescope -> FlexibleVars -> Type -> Args -> Args -> Compile TCM [Maybe Term] unifyI tele flex typ a1 a2 = lift $ addCtxTel tele $ unifyIndices_ flex typ a1 a2 takeTele :: Int -> Telescope -> Telescope takeTele 0 _ = EmptyTel takeTele n (ExtendTel t ts) = ExtendTel t $ Abs (absName ts) $ takeTele (n-1) (unAbs ts) takeTele _ _ = __IMPOSSIBLE__ -- | Main function for removing pattern matching on forced variables remForced :: [Fun] -> Compile TCM [Fun] remForced fs = do defs <- lift $ use $ stImports . sigDefinitions forM fs $ \f -> case f of Fun{} -> case funQName f >>= flip HM.lookup defs of Nothing -> __IMPOSSIBLE__ Just def -> do TelV tele _ <- lift $ telView (defType def) report 10 $ vcat [ text "compiling fun" <+> (text . show) (funQName f) ] e <- forcedExpr (funArgs f) tele (funExpr f) report 10 $ vcat [ text "compilied fun" <+> (text . show) (funQName f) , text "before:" <+> (text . prettyEpic) (funExpr f) , text "after:" <+> (text . prettyEpic) e ] return $ f { funExpr = e} EpicFun{} -> return f -- | For a given expression, in a certain telescope (the list of Var) is a mapping -- of variable name to the telescope. forcedExpr :: [Var] -> Telescope -> Expr -> Compile TCM Expr forcedExpr vars tele expr = case expr of Var _ -> return expr Lit _ -> return expr Lam x e -> Lam x <$> rec e -- necessary? Con t q es -> Con t q <$> mapM rec es App v es -> App v <$> mapM rec es If a b c -> If <$> rec a <*> rec b <*> rec c Let v e1 e2 -> Let v <$> rec e1 <*> rec e2 Lazy e -> Lazy <$> rec e UNIT -> return expr IMPOSSIBLE -> return expr Case v@(Var x) brs -> do let n = fromMaybe __IMPOSSIBLE__ $ elemIndex x vars (Case v <$>) . forM brs $ \ br -> case br of BrInt i e -> do (tele'', _) <- insertTele __IMPOSSIBLE__ n Nothing (I.Lit (LitChar noRange (chr i))) tele BrInt i <$> forcedExpr (replaceAt n vars []) tele'' e Default e -> Default <$> rec e Branch t constr as e -> do typ <- getType constr forc <- getForcedArgs constr (tele'', (_, ntyp, ctyp)) <- insertTele __IMPOSSIBLE__ n (Just typ) (mkCon constr (length as)) tele ntyp <- lift $ reduce ntyp ctyp <- lift $ reduce ctyp if null (forced forc as) then Branch t constr as <$> forcedExpr (replaceAt n vars as) tele'' e else do -- unify the telescope type with the return type of the constructor unif <- case (unEl ntyp, unEl ctyp) of (I.Def st es1, I.Def st' es2) | st == st' -> do let a1 = fromMaybe __IMPOSSIBLE__ $ I.allApplyElims es1 let a2 = fromMaybe __IMPOSSIBLE__ $ I.allApplyElims es2 typPars <- dataParameters st setType <- getType st report 10 $ vcat [ text "ntyp:" <+> prettyTCM ntyp , text "ctyp:" <+> prettyTCM ctyp ] unifyI (takeTele (n + length as) tele'') (map defaultFlexibleVar [0 .. n + length as]) (setType `apply` take typPars a1) (drop typPars a1) (drop typPars a2) _ -> __IMPOSSIBLE__ let lower = wkS (-1) . dropS 1 subT 0 tel = let ss = [fromMaybe (I.Var n []) t | (n , t) <- zip [0..] unif] ++# raiseS (length unif) in (applySubst ss tel, lower ss) subT n (ExtendTel a t) = let (tb' , ss) = subT (n - 1) (unAbs t) in (ExtendTel a $ Abs (absName t) tb', lower ss) subT _ _ = __IMPOSSIBLE__ (tele'''', _) = subT (n + length as) tele'' report 10 $ nest 2 $ vcat [ text "remforced" , text "tele=" <+> prettyTCM tele'' , text "tele'=" <+> prettyTCM tele'''' , text "unif=" <+> (text . show) unif , text "forced=" <+> (text . show) (forced forc as) , text "constr" <+> prettyTCM constr ] -- replace all forced variables found using the unification Branch t constr as <$> replaceForced (replaceAt n vars as, reverse $ take n vars ++ as) (tele'''') (forced forc as) unif e _ -> __IMPOSSIBLE__ where rec = forcedExpr vars tele -- | replace the forcedVar with pattern matching from the outside. replaceForced :: ([Var],[Var]) -> Telescope -> [Var] -> [Maybe I.Term] -> Expr -> Compile TCM Expr replaceForced (vars,_) tele [] _ e = forcedExpr vars tele e replaceForced (vars,uvars) tele (fvar : fvars) unif e = do let n = fromMaybe __IMPOSSIBLE__ $ elemIndex fvar uvars mpos <- findPosition n unif case mpos of Nothing -> case fromMaybe __IMPOSSIBLE__ $ unif !!! n of Nothing | fvar `notElem` fv e -> replaceForced (vars, uvars) tele fvars unif e Nothing -> do report 10 $ vcat [ text "failure comming!" , text "unif" <+> (text . show) unif , text "n" <+> (text . show) n , text "fvar" <+> (text fvar) , text "fv" <+> (text . show) (fv e) ] __IMPOSSIBLE__ Just t -> do v <- newName te <- FA.substTerm uvars t subst fvar v <$> replaceForced (vars, uvars) tele fvars unif (Let v te e) Just (pos , term) -> do (build, v) <- buildTerm (fromMaybe __IMPOSSIBLE__ $ uvars !!! pos) n term build . subst fvar v <$> replaceForced (vars, uvars) tele fvars unif e where sub fvar v = map $ \x -> if x == fvar then v else x -- | Given a term containg the forced var, dig out the variable by inserting -- the proper case-expressions. buildTerm :: Var -> Nat -> Term -> Compile TCM (Expr -> Expr, Var) buildTerm var idx (I.Var i _) | idx == i = return (id, var) buildTerm var idx (I.Con con args) = do let c = I.conName con vs <- replicateM (length args) newName (pos , arg) <- fromMaybe __IMPOSSIBLE__ <$> findPosition idx (map (Just . unArg) args) (fun2 , v) <- buildTerm (fromMaybe __IMPOSSIBLE__ $ vs !!! pos) idx arg tag <- getConstrTag c let fun1 e = casee (Var var) [Branch tag c vs e] return (fun1 . fun2 , v) buildTerm _ _ _ = __IMPOSSIBLE__ -- | Find the location where a certain Variable index is by searching the constructors -- aswell. i.e find a term that can be transformed into a pattern that contains the -- same value the index. This fails if no such term is present. findPosition :: Nat -> [Maybe I.Term] -> Compile TCM (Maybe (Nat, I.Term)) findPosition var ts = (listToMaybe . catMaybes <$>) . forM (zip [0..] ts) $ \ (n, mt) -> do ifM (maybe (return False) pred mt) (return (Just (n, fromMaybe __IMPOSSIBLE__ mt))) (return Nothing) where pred :: Term -> Compile TCM Bool pred t = case t of I.Var i _ | var == i -> return True I.Con c args -> do forc <- getForcedArgs $ I.conName c or <$> mapM (pred . unArg) (notForced forc args) _ -> return False Agda-2.4.2.5/src/full/Agda/Compiler/Epic/FromAgda.hs0000644000000000000000000002660412635075266017763 0ustar0000000000000000{-# LANGUAGE CPP #-} -- | Convert from Agda's internal representation to our auxiliary AST. module Agda.Compiler.Epic.FromAgda where import Control.Applicative import Control.Monad import Control.Monad.State import Data.Char import qualified Data.Map as Map import Data.Maybe import Agda.Syntax.Common import Agda.Syntax.Internal hiding (Term(..)) import qualified Agda.Syntax.Internal as T import qualified Agda.Syntax.Literal as TL import qualified Agda.TypeChecking.CompiledClause as CC import Agda.TypeChecking.Monad import Agda.TypeChecking.Level (reallyUnLevelView) import qualified Agda.TypeChecking.Substitute as S import Agda.TypeChecking.Pretty import Agda.Utils.List import Agda.Compiler.Epic.AuxAST import Agda.Compiler.Epic.CompileState import Agda.Compiler.Epic.Interface import Agda.Compiler.Epic.Static import Agda.Compiler.Epic.Epic #include "undefined.h" import Agda.Utils.Impossible -- | Convert from Agda's internal representation to our auxiliary AST. fromAgda :: Maybe T.Term -> [(QName, Definition)] -> Compile TCM [Fun] fromAgda msharp defs = catMaybes <$> mapM (translateDefn msharp) defs -- | Translate an Agda definition to an Epic function where applicable translateDefn :: Maybe T.Term -> (QName, Definition) -> Compile TCM (Maybe Fun) translateDefn msharp (n, defini) = let n' = unqname n epDef = compiledEpic $ defCompiledRep defini in case theDef defini of d@(Datatype {}) -> do -- become functions returning unit vars <- replicateM (dataPars d + dataIxs d) newName return . return $ Fun True n' (Just n) ("datatype: " ++ show n) vars UNIT f@(Function{}) -> do let projArgs = projectionArgs f cc = fromMaybe __IMPOSSIBLE__ $ funCompiled f ccs <- reverseCCBody projArgs <$> normaliseStatic cc let len = (+ projArgs) . length . clausePats . head . funClauses $ f toEta = arity (defType defini) - len -- forcing <- lift $ gets (optForcing . stPersistentOptions) lift $ reportSDoc "epic.fromagda" 5 $ text "compiling fun:" <+> prettyTCM n lift $ reportSDoc "epic.fromagda" 5 $ text "len:" <+> (text . show) len lift $ reportSDoc "epic.fromagda" 5 $ text "pats:" <+> (text . show) (clausePats $ head $ funClauses f) modify $ \s -> s {curFun = show n} lift $ reportSDoc "epic.fromagda" 5 $ text "ccs: " <+> (text . show) ccs res <- return <$> (etaExpand toEta =<< compileClauses n len ccs) pres <- case res of Nothing -> return Nothing Just c -> return <$> prettyEpicFun c lift $ reportSDoc "" 5 $ text $ show pres -- (fmap prettyEpicFun res) return res Constructor{} -> do -- become functions returning a constructor with their tag arit <- lift $ constructorArity n tag <- getConstrTag n -- Sharp has to use the primSharp function from AgdaPrelude.e case msharp of Just (T.Def sharp []) | sharp == n -> return <$> mkFun n n' "primSharp" 3 _ -> return <$> mkCon n tag arit r@(Record{}) -> do vars <- replicateM (recPars r) newName return . return $ Fun True n' (Just n) ("record: " ++ show n) vars UNIT a@(Axiom{}) -> do -- Axioms get their code from COMPILED_EPIC pragmas case epDef of Nothing -> return . return $ EpicFun n' (Just n) ("AXIOM_UNDEFINED: " ++ show n) $ "() -> Any = lazy(error \"Axiom " ++ show n ++ " used but has no computation\")" Just x -> return . return $ EpicFun n' (Just n) ("COMPILED_EPIC: " ++ show n) x p@(Primitive{}) -> do -- Primitives use primitive functions from AgdaPrelude.e of the same name. -- Hopefully they are defined! let ar = arity $ defType defini return <$> mkFun n n' (primName p) ar where mkFun q = mkFunGen q apps ("primitive: " ++) mkCon q tag ari = do let name = unqname q mkFunGen q (flip Con q) (const $ "constructor: " ++ show q) name tag ari mkFunGen :: QName -- ^ Original name -> (name -> [Expr] -> Expr) -- ^ combinator -> (name -> String) -- ^ make comment -> Var -- ^ Name of the function -> name -- ^ Primitive function name -> Int -- ^ Arity ofthe function -> Compile TCM Fun -- ^ Result? mkFunGen qn comb sh name primname arit = do vars <- replicateM arit newName return $ Fun True name (Just qn) (sh primname) vars (comb primname (map Var vars)) etaExpand :: Int -> Fun -> Compile TCM Fun etaExpand num fun = return fun -- do {- names <- replicateM num newName return $ fun { funExpr = funExpr fun @@ names , funArgs = funArgs fun ++ names } -} (@@) :: Expr -> [Var] -> Expr e @@ [] = e e @@ vs = let ts = map Var vs in case e of Var var -> apps var ts Lam var expr -> case vs of v:vs' -> subst var v expr @@ vs' [] -> __IMPOSSIBLE__ Con tag qName es -> Con tag qName (es ++ ts) App var es -> App var (es ++ ts) Case expr bs -> Case expr (map (flip appBranch vs) bs) If ea eb ec -> If ea (eb @@ vs) (ec @@ vs) Let var el e' -> lett var el (e' @@ vs) Lazy e' -> Lazy (e' @@ vs) Lit _lit -> IMPOSSIBLE -- Right? UNIT -> IMPOSSIBLE IMPOSSIBLE -> IMPOSSIBLE appBranch :: Branch -> [Var] -> Branch appBranch b vs = b {brExpr = brExpr b @@ vs} reverseCCBody :: Int -> CC.CompiledClauses -> CC.CompiledClauses reverseCCBody c cc = case cc of CC.Case n (CC.Branches cop cbr lbr cabr) -> CC.Case (c+n) $ CC.Branches cop (Map.map (fmap $ reverseCCBody c) cbr) (Map.map (reverseCCBody c) lbr) (fmap (reverseCCBody c) cabr) CC.Done i t -> CC.Done i (S.applySubst (S.parallelS $ map (flip T.Var []) $ reverse $ take (length i) [c..]) t) CC.Fail -> CC.Fail -- | Translate from Agda's desugared pattern matching (CompiledClauses) to our AuxAST. -- This is all done by magic. It uses 'substTerm' to translate the actual -- terms when the cases have been gone through. -- The case expressions that we get use de Bruijn indices that change after -- each case in the following way. -- Say we have this pattern: -- -- > f (X x y) (Y z) = term -- -- Initially, the variables have these indexes: -- -- > f 0@(X x y) 1@(Y z) = term -- -- The first case will be on @0@, and the variables bound inside the @X@ -- pattern will replace the outer index, so we get something like this: -- -- > f 0 2@(Y z) = case 0 of X 0 1 -> term -- -- Notice how @(Y z)@ now has index @2@. -- Then the second pattern is desugared in the same way: -- -- > f 0 2 = case 0 of X 0 1 -> case 2 of Y 2 -> term -- -- This replacement is what is done using the replaceAt function. -- -- CompiledClauses also have default branches for when all branches fail (even -- inner branches), the catchAllBranch. Epic does not support this, so -- we have to add the catchAllBranch to each inner case (here we are calling -- it omniDefault). To avoid code duplication it is first bound by a let -- expression. compileClauses :: QName -> Int -- ^ Number of arguments in the definition -> CC.CompiledClauses -> Compile TCM Fun compileClauses name nargs c = do let n' = unqname name vars <- replicateM nargs newName e <- compileClauses' vars Nothing c return $ Fun False n' (Just name) ("function: " ++ show name) vars e where compileClauses' :: [Var] -> Maybe Var -> CC.CompiledClauses -> Compile TCM Expr compileClauses' env omniDefault cc = case cc of CC.Case n nc -> case length env <= n of True -> __IMPOSSIBLE__ False -> case CC.catchAllBranch nc of Nothing -> Case (Var (fromMaybe __IMPOSSIBLE__ $ env !!! n)) <$> compileCase env omniDefault n nc Just de -> do def <- compileClauses' env omniDefault de bindExpr (lazy def) $ \ var -> Case (Var (fromMaybe __IMPOSSIBLE__ $ env !!! n)) <$> compileCase env (Just var) n nc CC.Done _ t -> substTerm ({- reverse -} env) t CC.Fail -> return IMPOSSIBLE compileCase :: [Var] -> Maybe Var -> Int -> CC.Case CC.CompiledClauses -> Compile TCM [Branch] compileCase env omniDefault casedvar nc = do cb <- if Map.null (CC.conBranches nc) -- Lit branch then forM (Map.toList (CC.litBranches nc)) $ \(l, cc) -> do cc' <- compileClauses' (replaceAt casedvar env []) omniDefault cc case l of TL.LitChar _ cha -> return $ BrInt (ord cha) cc' -- TODO: Handle other literals _ -> epicError $ "case on literal not supported: " ++ show l -- Con branch else forM (Map.toList (CC.conBranches nc)) $ \(b, CC.WithArity ar cc) -> do arit <- getConArity b -- Andreas, 2012-10-12: is the constructor arity @ar@ from Agda the same as the one from the Epic backen? tag <- getConstrTag b vars <- replicateM arit newName cc' <- compileClauses' (replaceAt casedvar env vars) omniDefault cc return $ Branch tag b vars cc' case omniDefault of Nothing -> return cb Just cc -> do return $ cb ++ [Default (Var cc)] -- | Translate the actual Agda terms, with an environment of all the bound variables -- from patternmatching. Agda terms are in de Bruijn so we just check the new -- names in the position. substTerm :: [Var] -> T.Term -> Compile TCM Expr substTerm env term = case T.unSpine term of T.Var ind es -> do let args = fromMaybe __IMPOSSIBLE__ $ allApplyElims es case length env <= ind of True -> __IMPOSSIBLE__ False -> apps (fromMaybe __IMPOSSIBLE__ $ env !!! ind) <$> mapM (substTerm env . unArg) args T.Lam _ (Abs _ te) -> do name <- newName Lam name <$> substTerm (name : env) te T.Lam _ (NoAbs _ te) -> do name <- newName Lam name <$> substTerm env te T.Lit l -> Lit <$> substLit l T.Level l -> substTerm env =<< lift (reallyUnLevelView l) T.Def q es -> do let args = fromMaybe __IMPOSSIBLE__ $ allApplyElims es let name = unqname q del <- getDelayed q def <- theDef <$> lift (getConstInfo q) let nr = projectionArgs def f <- apps name . (replicate nr UNIT ++) <$> mapM (substTerm env . unArg) args return $ case del of True -> Lazy f False -> f T.Con c args -> do let con = unqname $ conName c apps con <$> mapM (substTerm env . unArg) args T.Shared p -> substTerm env $ derefPtr p T.Pi _ _ -> return UNIT T.Sort _ -> return UNIT T.MetaV _ _ -> return UNIT T.DontCare _ -> return UNIT T.ExtLam{} -> __IMPOSSIBLE__ -- | Translate Agda literals to our AUX definition substLit :: TL.Literal -> Compile TCM Lit substLit lit = case lit of TL.LitInt _ i -> return $ LInt i TL.LitString _ s -> return $ LString s TL.LitChar _ c -> return $ LChar c TL.LitFloat _ f -> return $ LFloat f _ -> epicError $ "literal not supported: " ++ show lit Agda-2.4.2.5/src/full/Agda/Compiler/Epic/CompileState.hs0000644000000000000000000001622712635075266020674 0ustar0000000000000000{-# LANGUAGE CPP #-} -- | Contains the state monad that the compiler works in and some functions -- for tampering with the state. module Agda.Compiler.Epic.CompileState where import Control.Applicative import Control.Monad.State import Data.List import Data.Map (Map) import qualified Data.Map as Map import Data.Maybe import Data.Monoid import Data.Set (Set) import qualified Data.Set as Set import Agda.Compiler.Epic.AuxAST as AuxAST import Agda.Compiler.Epic.Interface import Agda.Interaction.Options import Agda.Syntax.Internal import Agda.Syntax.Concrete(TopLevelModuleName) import Agda.Syntax.Common import Agda.TypeChecking.Monad (TCM, internalError, defType, theDef, getConstInfo, sigDefinitions, stImports, stPersistentOptions, stPersistentState) import qualified Agda.TypeChecking.Monad as TM import Agda.TypeChecking.Reduce import qualified Agda.Utils.HashMap as HM import Agda.Utils.Lens #include "undefined.h" import Agda.Utils.Impossible -- | Stuff we need in our compiler data CompileState = CompileState { nameSupply :: [Var] , compiledModules :: Map TopLevelModuleName (EInterface, Set FilePath) , curModule :: EInterface , importedModules :: EInterface , curFun :: String } deriving Show -- | The initial (empty) state initCompileState :: CompileState initCompileState = CompileState { nameSupply = map (('h':) . show) [0 :: Integer ..] , compiledModules = Map.empty , curModule = mempty , importedModules = mempty , curFun = undefined } -- | Compiler monad type Compile = StateT CompileState -- | When normal errors are not enough epicError :: String -> Compile TCM a epicError = lift . internalError -- | Modify the state of the current module's Epic Interface modifyEI :: (EInterface -> EInterface) -> Compile TCM () modifyEI f = modify $ \s -> s {curModule = f (curModule s)} -- | Get the state of the current module's Epic Interface getsEI :: (EInterface -> a) -> Compile TCM a getsEI f = gets (f . curModule) -- | Returns the type of a definition given its name getType :: QName -> Compile TCM Type getType q = do map <- lift $ use $ stImports . sigDefinitions return $ maybe __IMPOSSIBLE__ defType (HM.lookup q map) -- | Create a name which can be used in Epic code from a QName. unqname :: QName -> Var unqname qn = case nameId $ qnameName qn of NameId name modul -> 'd' : show modul ++ "_" ++ show name -- * State modifiers resetNameSupply :: Compile TCM () resetNameSupply = modify $ \s -> s {nameSupply = nameSupply initCompileState} getDelayed :: QName -> Compile TCM Bool getDelayed q = lookInterface (Map.lookup q . defDelayed) (return False) putDelayed :: QName -> Bool -> Compile TCM () putDelayed q d = modifyEI $ \s -> s {defDelayed = Map.insert q d (defDelayed s)} newName :: Compile TCM Var newName = do n:ns <- gets nameSupply modify $ \s -> s { nameSupply = ns} return n putConstrTag :: QName -> Tag -> Compile TCM () putConstrTag q t = modifyEI $ \s -> s { constrTags = Map.insert q t $ constrTags s } assignConstrTag :: QName -> Compile TCM Tag assignConstrTag constr = assignConstrTag' constr [] assignConstrTag' :: QName -> [QName] -> Compile TCM Tag assignConstrTag' constr constrs = do constrs <- concat <$> mapM ((getDataCon =<<) . getConData) (constr : constrs) tags <- catMaybes <$> mapM getConstrTag' constrs let tag = head $ map Tag [0..] \\ tags putConstrTag constr tag return tag getConData :: QName -> Compile TCM QName getConData con = do lmap <- lift $ use $ TM.stImports . TM.sigDefinitions case HM.lookup con lmap of Just def -> case theDef def of c@(TM.Constructor{}) -> return $ TM.conData c _ -> __IMPOSSIBLE__ Nothing -> __IMPOSSIBLE__ getDataCon :: QName -> Compile TCM [QName] getDataCon con = do lmap <- lift $ use $ TM.stImports . TM.sigDefinitions case HM.lookup con lmap of Just def -> case theDef def of d@(TM.Datatype{}) -> return $ TM.dataCons d r@(TM.Record{}) -> return [ TM.recCon r] _ -> __IMPOSSIBLE__ Nothing -> __IMPOSSIBLE__ getConstrTag :: QName -> Compile TCM Tag getConstrTag con = lookInterface (Map.lookup con . constrTags) (assignConstrTag con) getConstrTag' :: QName -> Compile TCM (Maybe Tag) getConstrTag' con = do cur <- gets curModule case Map.lookup con (constrTags cur) of Just x -> return (Just x) Nothing -> do imps <- gets importedModules return $ Map.lookup con (constrTags imps) addDefName :: QName -> Compile TCM () addDefName q = do modifyEI $ \s -> s {definitions = Set.insert (unqname q) $ definitions s } topBindings :: Compile TCM (Set Var) topBindings = Set.union <$> gets (definitions . importedModules) <*> gets (definitions . curModule) getConArity :: QName -> Compile TCM Int getConArity n = lookInterface (Map.lookup n . conArity) __IMPOSSIBLE__ putConArity :: QName -> Int -> Compile TCM () putConArity n p = modifyEI $ \s -> s { conArity = Map.insert n p (conArity s) } putMain :: QName -> Compile TCM () putMain m = modifyEI $ \s -> s { mainName = Just m } getMain :: Compile TCM Var getMain = maybe (epicError "Where is main? :(") (return . unqname) =<< getsEI mainName lookInterface :: (EInterface -> Maybe a) -> Compile TCM a -> Compile TCM a lookInterface f def = do cur <- gets curModule case f cur of Just x -> return x Nothing -> do imps <- gets importedModules case f imps of Nothing -> def Just x -> return x constrInScope :: QName -> Compile TCM Bool constrInScope name = do cur <- gets curModule case Map.lookup name (constrTags cur) of Just x -> return True Nothing -> do imps <- gets importedModules case Map.lookup name (constrTags imps) of Nothing -> return False Just x -> return True getForcedArgs :: QName -> Compile TCM ForcedArgs getForcedArgs q = lookInterface (Map.lookup q . forcedArgs) __IMPOSSIBLE__ putForcedArgs :: QName -> ForcedArgs -> Compile TCM () putForcedArgs n f = do b <- lift $ gets (optForcing . stPersistentOptions . stPersistentState) let f' | b = f | otherwise = replicate (length f) NotForced modifyEI $ \s -> s {forcedArgs = Map.insert n f' $ forcedArgs s} replaceAt :: Int -- ^ replace at -> [a] -- ^ to replace -> [a] -- ^ replace with -> [a] -- ^ result? replaceAt n xs inserts = let (as, _:bs) = splitAt n xs in as ++ inserts ++ bs -- | Copy pasted from MAlonzo, HAHA!!! -- Move somewhere else! constructorArity :: Num a => QName -> TCM a constructorArity q = do def <- getConstInfo q a <- normalise $ defType def case theDef def of TM.Constructor{ TM.conPars = np } -> return . fromIntegral $ arity a - np _ -> internalError $ "constructorArity: non constructor: " ++ show q -- | Bind an expression to a fresh variable name bindExpr :: Expr -> (Var -> Compile TCM Expr) -> Compile TCM Expr bindExpr expr f = case expr of AuxAST.Var v -> f v _ -> do v <- newName lett v expr <$> f v Agda-2.4.2.5/src/full/Agda/Compiler/Epic/ForceConstrs.hs0000644000000000000000000000534612635075266020715 0ustar0000000000000000{-# LANGUAGE CPP #-} -- | Remove forced arguments from constructors. module Agda.Compiler.Epic.ForceConstrs where import Control.Applicative import Agda.Compiler.Epic.AuxAST import Agda.Compiler.Epic.CompileState import Agda.Compiler.Epic.Interface import qualified Agda.Syntax.Common as Common import qualified Agda.Syntax.Internal as T import Agda.TypeChecking.Monad (TCM) #include "undefined.h" import Agda.Utils.Impossible -- | Check which arguments are forced makeForcedArgs :: T.Type -> ForcedArgs makeForcedArgs (T.El _ term) = case term of T.Pi arg ab -> isRel arg : makeForcedArgs (T.unAbs ab) _ -> [] where isRel :: T.Dom T.Type -> Forced isRel arg = case Common.getRelevance arg of Common.Relevant -> NotForced Common.Irrelevant -> Forced Common.UnusedArg -> Forced Common.NonStrict -> Forced -- can never be executed Common.Forced{} -> Forced -- It can be inferred -- | Remove forced arguments from constructors and branches forceConstrs :: [Fun] -> Compile TCM [Fun] forceConstrs fs = mapM forceFun fs forceFun :: Fun -> Compile TCM Fun forceFun e@(EpicFun{}) = return e forceFun (Fun inline name qname comment args expr) = Fun inline name qname comment args <$> forceExpr expr where -- | Remove all arguments to constructors that we don't need to store in an -- expression. forceExpr :: Expr -> Compile TCM Expr forceExpr expr = case expr of Var v -> return $ Var v Lit l -> return $ Lit l Lam v e -> Lam v <$> forceExpr e Con tag q es -> do -- We only need to apply the non-forced arguments forcArgs <- getForcedArgs q return $ Con tag q $ notForced forcArgs es App v es -> App v <$> mapM forceExpr es Case e bs -> Case <$> forceExpr e <*> mapM forceBranch bs Let v e e' -> lett v <$> forceExpr e <*> forceExpr e' If a b c -> If <$> forceExpr a <*> forceExpr b <*> forceExpr c Lazy e -> Lazy <$> forceExpr e UNIT -> return expr IMPOSSIBLE -> return expr -- | Remove all the arguments that don't need to be stored in the constructor -- For the branch forceBranch :: Branch -> Compile TCM Branch forceBranch br = case br of Branch tag name vars e -> do ir <- getForcedArgs name let vs = notForced ir vars subs = forced ir vars e'' <- if all (`notElem` fv e) subs then return e else __IMPOSSIBLE__ -- If so, the removal of forced args has gone wrong Branch tag name vs <$> forceExpr e'' BrInt i e -> BrInt i <$> forceExpr e Default e -> Default <$> forceExpr e Agda-2.4.2.5/src/full/Agda/Compiler/Epic/Compiler.hs0000644000000000000000000002543112635075266020052 0ustar0000000000000000{-# LANGUAGE CPP #-} -- | Epic compiler backend. module Agda.Compiler.Epic.Compiler(compilerMain) where import Control.Applicative import Control.Monad import Control.Monad.Reader import Control.Monad.State import qualified Data.ByteString.Lazy as BS import qualified Data.Map as Map import Data.Maybe import Data.Monoid import Data.Set (Set) import qualified Data.Set as Set import System.Directory ( canonicalizePath, createDirectoryIfMissing , getCurrentDirectory, setCurrentDirectory ) import System.Exit import System.FilePath hiding (normalise) import System.Process hiding (env) import Paths_Agda import Agda.Interaction.FindFile import Agda.Interaction.Options import Agda.Interaction.Imports import Agda.Syntax.Common (Delayed(..)) import qualified Agda.Syntax.Concrete.Name as CN import Agda.Syntax.Internal hiding (Term(..)) import Agda.TypeChecking.Monad import Agda.TypeChecking.Monad.Builtin import Agda.TypeChecking.Serialise import Agda.Compiler.CallCompiler import Agda.Compiler.Epic.CompileState import qualified Agda.Compiler.Epic.CaseOpts as COpts import qualified Agda.Compiler.Epic.ForceConstrs as ForceC import Agda.Compiler.Epic.Epic import Agda.Compiler.Epic.Interface import qualified Agda.Compiler.Epic.Erasure as Eras import qualified Agda.Compiler.Epic.FromAgda as FAgda import qualified Agda.Compiler.Epic.Forcing as Forcing import qualified Agda.Compiler.Epic.Injection as ID import qualified Agda.Compiler.Epic.NatDetection as ND import qualified Agda.Compiler.Epic.Primitive as Prim import qualified Agda.Compiler.Epic.Smashing as Smash import Agda.Utils.FileName import qualified Agda.Utils.HashMap as HMap import Agda.Utils.Lens import Agda.Utils.List import Agda.Utils.Pretty ( prettyShow ) #include "undefined.h" import Agda.Utils.Impossible compilePrelude :: Compile TCM () compilePrelude = do dataDir <- ( "EpicInclude") <$> liftIO getDataDir pwd <- liftIO $ getCurrentDirectory liftIO $ setCurrentDirectory dataDir let prelude = "AgdaPrelude" uptodate <- liftIO $ (prelude <.> "ei") `isNewerThan` (prelude <.> "e") when (not uptodate) $ callEpic False [ "-c" , prelude <.> "e" ] liftIO $ setCurrentDirectory pwd -- | Compile an interface into an executable using Epic compilerMain :: Interface -> TCM () compilerMain inter = do (epic_exist, _, _) <- liftIO $ readProcessWithExitCode "ghc-pkg" ["-v0", "field", "epic", "id"] "" case epic_exist of ExitSuccess -> flip evalStateT initCompileState $ do compilePrelude setEpicDir inter (_, imports) <- compileModule inter main <- getMain runEpicMain main (Set.toList imports) (iModuleName inter) ExitFailure _ -> internalError $ unlines [ "Agda cannot find the Epic compiler." , "This can perhaps be fixed by running `cabal install epic'." , "See the README for more information." ] outFile :: CN.TopLevelModuleName -> Compile TCM FilePath outFile mod = do let (dir, fn) = splitFileName . foldl1 () $ CN.moduleNameParts mod fp | dir == "./" = "src" fn | otherwise = "src" dir fn liftIO $ createDirectoryIfMissing True ("src" dir) return $ fp where repldot c = map (\c' -> if c' == '.' then c else c') readEInterface :: FilePath -> Compile TCM EInterface readEInterface file = fromMaybe __IMPOSSIBLE__ <$> lift (decode =<< liftTCM (liftIO (BS.readFile file))) compileModule :: Interface -> Compile TCM (EInterface, Set FilePath) compileModule i = do cm <- gets compiledModules let moduleName = toTopLevelModuleName $ iModuleName i file <- outFile moduleName case Map.lookup moduleName cm of Just eifs -> return eifs Nothing -> do imports <- map miInterface . catMaybes <$> mapM (lift . getVisitedModule . toTopLevelModuleName . fst) (iImportedModules i) (ifaces, limps) <- mapAndUnzipM compileModule imports let imps = Set.unions limps modify $ \s -> s { importedModules = importedModules s `mappend` mconcat ifaces } ifile <- maybe __IMPOSSIBLE__ filePath <$> lift (findInterfaceFile moduleName) let eifFile = file <.> "aei" uptodate <- liftIO $ isNewerThan eifFile ifile (eif, imps') <- case uptodate of True -> do lift $ reportSLn "" 1 $ (prettyShow . iModuleName) i ++ " : no compilation is needed." eif <- readEInterface eifFile modify $ \s -> s { curModule = eif } return (eif, Set.insert file imps) False -> do lift $ reportSLn "" 1 $ "Compiling: " ++ (prettyShow . iModuleName) i resetNameSupply initialAnalysis i let defns = HMap.toList $ iSignature i ^. sigDefinitions -- Epic cannot parse files with no definitions if (not $ null defns) then do code <- compileDefns defns runEpic file (Set.toList imps) code eif <- gets curModule lift $ do bif <- encode eif liftIO $ BS.writeFile eifFile bif return (eif, Set.insert file imps) else flip (,) imps <$> gets curModule modify $ \s -> s { compiledModules = (Map.insert moduleName (eif, imps') (compiledModules s))} return (eif, imps') -- | Before running the compiler, we need to store some things in the state, -- namely constructor tags, constructor irrelevancies and the delayed field -- in functions (for coinduction). initialAnalysis :: Interface -> Compile TCM () initialAnalysis inter = do Prim.initialPrims modify $ \s -> s {curModule = mempty} let defs = HMap.toList $ iSignature inter ^. sigDefinitions forM_ defs $ \(q, def) -> do addDefName q case theDef def of d@(Datatype {}) -> do saker <- ND.isNatish q d case saker of Just (_, [zer, suc]) -> do putConstrTag zer (PrimTag "primZero") putConstrTag suc (PrimTag "primSuc") _ -> return () Constructor {conPars = np} -> do putForcedArgs q . drop np . ForceC.makeForcedArgs $ defType def putConArity q =<< lift (constructorArity q) f@(Function{}) -> do when ("main" == (prettyShow . qnameName) q) $ do -- lift $ liftTCM $ checkTypeOfMain q (defType def) putMain q putDelayed q $ case funDelayed f of Delayed -> True NotDelayed -> False a@(Axiom {}) -> do case defEpicDef def of Nothing -> putDelayed q True _ -> return () _ -> return () idPrint :: String -> (a -> Compile TCM b) -> a -> Compile TCM b idPrint s m x = do lift $ reportSLn "epic.phases" 10 s m x -- | Perform the chain of compilation stages, from definitions to epic code compileDefns :: [(QName, Definition)] -> Compile TCM EpicCode compileDefns defs = do -- We need to handle sharp (coinduction) differently, so we get it here. msharp <- lift $ getBuiltin' builtinSharp emits <- return defs >>= idPrint "findInjection" ID.findInjection >>= idPrint "fromAgda" (FAgda.fromAgda msharp) >>= idPrint "forcing" Forcing.remForced >>= idPrint "irr" ForceC.forceConstrs >>= idPrint "primitivise" Prim.primitivise >>= idPrint "smash" Smash.smash'em >>= idPrint "erasure" Eras.erasure >>= idPrint "caseOpts" COpts.caseOpts >>= idPrint "done" return unlines <$> mapM prettyEpicFun emits -- | Change the current directory to Epic folder, create it if it doesn't already -- exist. setEpicDir :: Interface -> Compile (TCMT IO) () setEpicDir mainI = do let tm = toTopLevelModuleName $ iModuleName mainI f <- lift $ findFile tm compileDir' <- lift $ gets (fromMaybe (filePath $ CN.projectRoot f tm) . optCompileDir . stPersistentOptions . stPersistentState) compileDir <- liftIO $ canonicalizePath compileDir' liftIO $ setCurrentDirectory compileDir liftIO $ createDirectoryIfMissing False "Epic" liftIO $ setCurrentDirectory $ compileDir "Epic" -- | Make a program from the given Epic code. -- -- The program is written to the file @../m@, where m is the last -- component of the given module name. runEpic :: FilePath -> [FilePath] -> EpicCode -> Compile TCM () runEpic fp imports code = do dataDir <- ( "EpicInclude") <$> liftIO getDataDir let imports' = unlines ["include \"" ++ imp ++ "\"" | imp <- (dataDir "AgdaPrelude.ei") : map (<.> "ei") imports] code' = imports' ++ code liftIO $ writeFile (fp <.> "e") code' callEpic True $ [ "-c", fp <.> "e" ] -- | Create the Epic main file, which calls the Agda main function runEpicMain :: Var -> [FilePath] -> ModuleName -> Compile TCM () runEpicMain mainName imports m = do dataDir <- ( "EpicInclude") <$> liftIO getDataDir let imports' = (dataDir "AgdaPrelude") : imports let code = unlines ["include \"" ++ imp <.> "ei" ++ "\"" | imp <- imports' ] ++ "main() -> Unit = init() ; " ++ mainName ++ "(unit)" liftIO $ writeFile ("main" <.> "e") code let outputName :: CN.Name outputName = maybe __IMPOSSIBLE__ nameConcrete $ lastMaybe $ mnameToList m callEpic' $ \epic -> [ "main" <.> "e" , "-o", ".." prettyShow outputName ] ++ epic ++ map (<.> "o") imports' -- | Call epic, with a given set of flags, if the |Bool| is True then include -- the command line flags at the end callEpic :: Bool -> [String] -> Compile TCM () callEpic incEFlags flags = callEpic' $ \epicFlags -> flags ++ if incEFlags then epicFlags else [] -- | Call epic with a given set of flags, the argument function receives the flags given -- at the command line callEpic' :: ([String] -> [String]) -> Compile TCM () callEpic' flags = do epicFlags <- optEpicFlags <$> lift commandLineOptions dataDir <- ( "EpicInclude") <$> liftIO getDataDir let epic = "epic" epicCommand = [ "-keepc" -- , "-g" -- , "-checking", "0" -- , "-trace" , "-i", dataDir "stdagda" <.> "c" ] ++ flags epicFlags lift $ callCompiler epic epicCommand Agda-2.4.2.5/src/full/Agda/Compiler/Epic/CaseOpts.hs0000644000000000000000000000306312635075266020016 0ustar0000000000000000-- | Perform simple optimisations based on case-laws module Agda.Compiler.Epic.CaseOpts where import Control.Applicative import Agda.TypeChecking.Monad import Agda.Compiler.Epic.AuxAST import Agda.Compiler.Epic.CompileState caseOpts :: [Fun] -> Compile TCM [Fun] caseOpts = mapM $ \ def -> case def of Fun{} -> do e' <- caseOptsExpr (funExpr def) return def { funExpr = e' } _ -> return def -- | Run the case-opts on an expression caseOptsExpr :: Expr -> Compile TCM Expr caseOptsExpr expr = case expr of Var v -> return $ Var v Lit l -> return $ Lit l Lam v e -> Lam v <$> caseOptsExpr e Con c n es -> Con c n <$> mapM caseOptsExpr es App v es -> apps v <$> mapM caseOptsExpr es -- If there is only one constructor branch, perform a projection to get the result Case e [Branch {brVars = vs, brExpr = eorg}] -> do e' <- caseOptsExpr eorg bindExpr e $ \var -> return $ foldr (\(v, n) -> lett v $ App "proj" [Lit (LInt n), Var var]) e' $ zip vs [0..] -- If there is only a default branch, the case is not necessary Case e [Default{brExpr = e'}] -> caseOptsExpr e' Case e brs -> Case <$> caseOptsExpr e <*> (mapM (\br -> do e' <- caseOptsExpr (brExpr br) return br {brExpr = e'}) brs) If a b c -> If <$> caseOptsExpr a <*> caseOptsExpr b <*> caseOptsExpr c Let v e1 e2 -> Let v <$> caseOptsExpr e1 <*> caseOptsExpr e2 Lazy e -> Lazy <$> caseOptsExpr e UNIT -> return UNIT IMPOSSIBLE -> return IMPOSSIBLE Agda-2.4.2.5/src/full/Agda/Compiler/Epic/Primitive.hs0000644000000000000000000001764212635075266020255 0ustar0000000000000000{-# LANGUAGE CPP #-} -- | Change constructors and cases on builtins and natish datatypes to use -- primitive data module Agda.Compiler.Epic.Primitive where import Control.Applicative import Control.Monad import Control.Monad.Trans import Data.Map (Map) import qualified Data.Map as Map import Data.Maybe import Agda.Syntax.Internal(QName) import qualified Agda.Syntax.Internal as T import Agda.TypeChecking.Monad hiding (defName) import Agda.TypeChecking.Monad.Builtin import Agda.Utils.Monad (andM) import Agda.Compiler.Epic.AuxAST import Agda.Compiler.Epic.CompileState import Agda.Compiler.Epic.Interface import Agda.Compiler.Epic.NatDetection import Agda.Utils.List import Agda.Utils.Impossible #include "undefined.h" {- Stacken, Heapen -- Optimizern -} data PrimTransform = PrimTF { mapCon :: Map QName Var , translateCase :: Expr -> [Branch] -> Expr } prZero, prSuc, prTrue, prFalse, prPred, prNatEquality :: Var prZero = "primZero" prSuc = "primSuc" prTrue = "primTrue" prFalse = "primFalse" prPred = "primPred" prNatEquality = "primNatEquality" -- | Change constructors and cases on builtins and natish datatypes to use -- primitive data primitivise :: [Fun] -> Compile TCM [Fun] primitivise funs = do ptfs <- getBuiltins natish <- getNatish mapM (primFun $ ptfs ++ map (uncurry natPrimTF) natish) funs -- | Map primitive constructors to primitive tags initialPrims :: Compile TCM () -- [Fun] initialPrims = do -- TODO: Natishness is calculated here and could be stored so it does not have -- to be recalculated in primitivise natish <- getNatish -- This has to be done because injection detection may otherwise flag injections -- between non-primitive and primitive datatypes in the wrong way sequence_ [zipWithM_ putConstrTag [zc, sc] (prim [prZero, prSuc]) | (_, [zc, sc]) <- natish] sequence_ [ [builtinNil, builtinCons] ~> tags [0, 1] , [builtinZero, builtinSuc ] ~> prim [prZero, prSuc] , [builtinLevelZero, builtinLevelSuc] ~> prim [prZero, prSuc] , [builtinTrue, builtinFalse] ~> prim [prTrue, prFalse] , [builtinRefl] ~> tags [0] ] where prim = map PrimTag tags = map Tag constrs ~> tags = do builtins <- lift $ mapM getBuiltin' constrs if all isJust builtins then do let names = map (defName . fromMaybe __IMPOSSIBLE__) builtins -- b <- and <$> mapM constrInScope names -- if b then return $ Just (transf names) else return Nothing zipWithM_ putConstrTag names tags else return () -- | Build transforms using the names of builtins getBuiltins :: Compile TCM [PrimTransform] getBuiltins = catMaybes <$> sequence [ [builtinZero, builtinSuc ] ~> natPrimTF [NotForced] -- ? is this ok to have [NotForced] , [builtinLevelZero, builtinLevelSuc] ~> natPrimTF [NotForced] , [builtinTrue, builtinFalse] ~> boolPrimTF ] where constrs ~> transf = do builtins <- lift $ mapM getBuiltin' constrs if all isJust builtins then do let names = map (defName . fromMaybe __IMPOSSIBLE__) builtins b <- andM $ map constrInScope names if b then return $ Just (transf names) else return Nothing else return Nothing defName :: T.Term -> QName defName (T.Def q []) = q defName (T.Con q []) = T.conName q defName _ = __IMPOSSIBLE__ -- | Translation to primitive integer functions natPrimTF :: ForcedArgs -> [QName] -> PrimTransform natPrimTF filt [zero, suc] = PrimTF { mapCon = Map.fromList [(zero, prZero), (suc, prSuc)] , translateCase = \ce brs -> case brs of -- Assuming only the first two branches are relevant when casing on Nats (Branch _ n vs e:Branch _ _n' vs'' e'':_) -> if n == zero then primNatCaseZS ce e (headWithDefault __IMPOSSIBLE__ vs'') e'' else primNatCaseZS ce e'' (headWithDefault __IMPOSSIBLE__ vs) e (Branch _ n vs e:Default e'':_) -> if n == zero then primNatCaseZD ce e e'' -- zero else primNatCaseZS ce e'' (headWithDefault __IMPOSSIBLE__ vs) e -- suc [ Branch _ n vs e ] -> if n == zero then e else lett (headWithDefault __IMPOSSIBLE__ vs) (App prPred [ce]) e _ -> __IMPOSSIBLE__ } natPrimTF _ _ = __IMPOSSIBLE__ -- | Corresponds to a case for natural numbers primNatCaseZS :: Expr -- ^ Expression that is cased on -> Expr -- ^ Expression for the zero branch -> Var -- ^ Variable that is bound in suc branch -> Expr -- ^ Expression used for suc branch -> Expr -- ^ Result? primNatCaseZS n zeroBr v sucBr = If (App prNatEquality [n, Var prZero]) zeroBr (lett v (App prPred [n]) sucBr) -- | Corresponds to a case with a zero and default branch primNatCaseZD :: Expr -- ^ Expression that is cased on -> Expr -- ^ Zero branch -> Expr -- ^ Default branch -> Expr -- ^ Result? primNatCaseZD n zeroBr defBr = If (App prNatEquality [n, Var prZero]) zeroBr defBr -- | Translation to primitive bool functions boolPrimTF :: [QName] -> PrimTransform boolPrimTF [true, false] = PrimTF { mapCon = Map.fromList [(true, prTrue), (false, prFalse)] , translateCase = \ce brs -> case brs of (Branch _ n _vs e:b':_) -> (if n == true then If ce e (brExpr b') else If ce (brExpr b') e) _ -> __IMPOSSIBLE__ } boolPrimTF _ = __IMPOSSIBLE__ -- | Change all the primitives in the function using the PrimTransform primFun :: [PrimTransform] -> Fun -> Compile TCM Fun primFun ptfs (Fun i n qn c args e) = Fun i n qn c args <$> primExpr ptfs e primFun _ e@(EpicFun {}) = return e -- | Change all the primitives in an expression using PrimTransform primExpr :: [PrimTransform] -> Expr -> Compile TCM Expr primExpr prim ex = case ex of Var{} -> return ex Lit{} -> return ex Lam v e1 -> Lam v <$> primExpr prim e1 Con c n es -> case testCon prim n of Just pn -> do filt <- getForcedArgs n apps pn <$> mapM (primExpr prim) es Nothing -> Con c n <$> mapM (primExpr prim) es App v es -> App v <$> mapM (primExpr prim) es Case e brs -> case testBranch prim brs of Just p -> primExpr prim $ translateCase p e brs Nothing -> Case <$> primExpr prim e <*> mapM primBranch brs If a b c -> If <$> primExpr prim a <*> primExpr prim b <*> primExpr prim c Let v e e' -> Let v <$> primExpr prim e <*> primExpr prim e' Lazy e -> Lazy <$> primExpr prim e UNIT -> return ex IMPOSSIBLE -> return ex where -- | Test if any PrimTransform have any primitive function for -- a constructor, gives the name of that primitive function in that -- case, otherwise Nothing. testCon :: [PrimTransform] -> QName -> Maybe Var testCon [] _ = Nothing testCon (p : ps) k = Map.lookup k (mapCon p) `mplus` testCon ps k -- | Test if we should transform the case, based on the branches. Returns -- the (first) PrimTransform that is applicable. testBranch :: [PrimTransform] -> [Branch] -> Maybe PrimTransform testBranch [] _ = Nothing testBranch (p:ps) brs = msum (map (check p) brs) `mplus` testBranch ps brs -- | Check if a particular PrimTransform can be used on a particular Branch -- Returns the PrimTransform in that case. check :: PrimTransform -> Branch -> Maybe PrimTransform check p br = case br of Branch _ n _ _ -> fmap (const p) $ Map.lookup n (mapCon p) BrInt _ _ -> Nothing Default _ -> Nothing -- | Change all primitives in a branch primBranch :: Branch -> Compile TCM Branch primBranch br = do e' <- primExpr prim (brExpr br) return br {brExpr = e'} Agda-2.4.2.5/src/full/Agda/Compiler/JS/0000755000000000000000000000000012635075266015373 5ustar0000000000000000Agda-2.4.2.5/src/full/Agda/Compiler/JS/Substitution.hs0000644000000000000000000001001312635075266020436 0ustar0000000000000000module Agda.Compiler.JS.Substitution where import Prelude hiding ( map, lookup ) import Data.Map ( empty, unionWith, singleton, findWithDefault ) import qualified Data.Map as M ( map ) import Data.List ( genericIndex ) import qualified Data.List as L ( map ) import Agda.Syntax.Common ( Nat ) import Agda.Compiler.JS.Syntax ( Exp(Self,Undefined,Local,Lambda,Object,Apply,Lookup,If,BinOp,PreOp), MemberId, LocalId(LocalId) ) import Agda.Utils.Function ( iterate' ) -- Map for expressions map :: Nat -> (Nat -> LocalId -> Exp) -> Exp -> Exp map m f (Local i) = f m i map m f (Lambda i e) = Lambda i (map (m + i) f e) map m f (Object o) = Object (M.map (map m f) o) map m f (Apply e es) = Apply (map m f e) (L.map (map m f) es) map m f (Lookup e l) = Lookup (map m f e) l map m f (If e e' e'') = If (map m f e) (map m f e') (map m f e'') map m f (PreOp op e) = PreOp op (map m f e) map m f (BinOp e op e') = BinOp (map m f e) op (map m f e') map m f e = e -- Shifting shift :: Nat -> Exp -> Exp shift = shiftFrom 0 shiftFrom :: Nat -> Nat -> Exp -> Exp shiftFrom m 0 e = e shiftFrom m n e = map m (shifter n) e shifter :: Nat -> Nat -> LocalId -> Exp shifter n m (LocalId i) | i < m = Local (LocalId i) shifter n m (LocalId i) | otherwise = Local (LocalId (i + n)) -- Substitution subst :: Nat -> [Exp] -> Exp -> Exp subst 0 es e = e subst n es e = map 0 (substituter n es) e substituter :: Nat -> [Exp] -> Nat -> LocalId -> Exp substituter n es m (LocalId i) | i < m = Local (LocalId i) substituter n es m (LocalId i) | (i - m) < n = shift m (genericIndex (es ++ repeat Undefined) (n - (i + 1 - m))) substituter n es m (LocalId i) | otherwise = Local (LocalId (i - n)) -- A variant on substitution which performs beta-reduction map' :: Nat -> (Nat -> LocalId -> Exp) -> Exp -> Exp map' m f (Local i) = f m i map' m f (Lambda i e) = Lambda i (map' (m + i) f e) map' m f (Object o) = Object (M.map (map' m f) o) map' m f (Apply e es) = apply (map' m f e) (L.map (map' m f) es) map' m f (Lookup e l) = lookup (map' m f e) l map' m f (If e e' e'') = If (map' m f e) (map' m f e') (map' m f e'') map' m f (PreOp op e) = PreOp op (map' m f e) map' m f (BinOp e op e') = BinOp (map' m f e) op (map' m f e') map' m f e = e subst' :: Nat -> [Exp] -> Exp -> Exp subst' 0 es e = e subst' n es e = map' 0 (substituter n es) e -- Beta-reducing application and field access apply :: Exp -> [Exp] -> Exp apply (Lambda i e) es = subst' i es e apply e es = Apply e es lookup :: Exp -> MemberId -> Exp lookup (Object o) l = findWithDefault Undefined l o lookup e l = Lookup e l -- Replace any top-level occurrences of self -- (needed because JS is a cbv language, so any top-level -- recursions would evaluate before the module has been defined, -- e.g. exports = { x: 1, y: exports.x } results in an exception, -- as exports is undefined at the point that exports.x is evaluated), self :: Exp -> Exp -> Exp self e (Self) = e self e (Object o) = Object (M.map (self e) o) self e (Apply f es) = case (self e f) of (Lambda n g) -> self e (subst' n es g) g -> Apply g (L.map (self e) es) self e (Lookup f l) = lookup (self e f) l self e (If f g h) = If (self e f) (self e g) (self e h) self e (BinOp f op g) = BinOp (self e f) op (self e g) self e (PreOp op f) = PreOp op (self e f) self e f = f -- Find the fixed point of an expression, with no top-level occurrences -- of self. fix :: Exp -> Exp fix f = e where e = self e f -- Some helper functions curriedApply :: Exp -> [Exp] -> Exp curriedApply = foldl (\ f e -> apply f [e]) curriedLambda :: Nat -> Exp -> Exp curriedLambda n = iterate' n (Lambda 1) emp :: Exp emp = Object (empty) union :: Exp -> Exp -> Exp union (Object o) (Object p) = Object (unionWith union o p) union e f = e vine :: [MemberId] -> Exp -> Exp vine ls e = foldr (\ l e -> Object (singleton l e)) e ls object :: [([MemberId],Exp)] -> Exp object = foldr (\ (ls,e) -> (union (vine ls e))) emp Agda-2.4.2.5/src/full/Agda/Compiler/JS/Pretty.hs0000644000000000000000000001053212635075266017217 0ustar0000000000000000module Agda.Compiler.JS.Pretty where import Prelude hiding ( null ) import Data.List ( intercalate ) import Data.Set ( Set, toList, singleton, insert, member ) import Data.Map ( Map, toAscList, empty, null ) import Agda.Syntax.Common ( Nat ) import Agda.Compiler.JS.Syntax ( Exp(Self,Local,Global,Undefined,String,Char,Integer,Double,Lambda,Object,Apply,Lookup,If,BinOp,PreOp,Const), LocalId(LocalId), GlobalId(GlobalId), MemberId(MemberId), Module(Module), Export(Export), globals ) -- Pretty-print a lambda-calculus expression as ECMAScript. -- Since ECMAScript is C-like rather than Haskell-like, it's easier to -- do the pretty-printing directly than use the Pretty library, which -- assumes Haskell-like indentation. br :: Int -> String br i = "\n" ++ take (2*i) (repeat ' ') unescape :: Char -> String unescape '"' = "\\\"" unescape '\\' = "\\\\" unescape '\n' = "\\n" unescape '\r' = "\\r" unescape '\x2028' = "\\u2028" unescape '\x2029' = "\\u2029" unescape c = [c] unescapes :: String -> String unescapes s = concat (map unescape s) -- pretty n i e pretty-prints e, under n levels of de Bruijn binding, -- with i levels of indentation. class Pretty a where pretty :: Nat -> Int -> a -> String instance (Pretty a, Pretty b) => Pretty (a,b) where pretty n i (x,y) = pretty n i x ++ ": " ++ pretty n (i+1) y -- Pretty-print collections class Pretties a where pretties :: Nat -> Int -> a -> [String] instance Pretty a => Pretties [a] where pretties n i = map (pretty n i) instance (Pretty a, Pretty b) => Pretties (Map a b) where pretties n i o = pretties n i (toAscList o) -- Pretty print identifiers instance Pretty LocalId where pretty n i (LocalId x) = "x" ++ show (n - x - 1) instance Pretty GlobalId where pretty n i (GlobalId m) = intercalate "_" m instance Pretty MemberId where pretty n i (MemberId s) = "\"" ++ unescapes s ++ "\"" -- Pretty print expressions instance Pretty Exp where pretty n i (Self) = "exports" pretty n i (Local x) = pretty n i x pretty n i (Global m) = pretty n i m pretty n i (Undefined) = "undefined" pretty n i (String s) = "\"" ++ unescapes s ++ "\"" pretty n i (Char c) = "\"" ++ unescape c ++ "\"" pretty n i (Integer x) = show x pretty n i (Double x) = show x pretty n i (Lambda x e) = "function (" ++ intercalate ", " (pretties (n+x) i (map LocalId [x-1, x-2 .. 0])) ++ ") " ++ block (n+x) i e pretty n i (Object o) | null o = "{}" pretty n i (Object o) | otherwise = "{" ++ br (i+1) ++ intercalate ("," ++ br (i+1)) (pretties n i o) ++ br i ++ "}" pretty n i (Apply f es) = pretty n i f ++ "(" ++ intercalate ", " (pretties n i es) ++ ")" pretty n i (Lookup e l) = pretty n i e ++ "[" ++ pretty n i l ++ "]" pretty n i (If e f g) = "(" ++ pretty n i e ++ "? " ++ pretty n i f ++ ": " ++ pretty n i g ++ ")" pretty n i (PreOp op e) = "(" ++ op ++ " " ++ pretty n i e ++ ")" pretty n i (BinOp e op f) = "(" ++ pretty n i e ++ " " ++ op ++ " " ++ pretty n i f ++ ")" pretty n i (Const c) = c block :: Nat -> Int -> Exp -> String block n i (If e f g) = "{" ++ br (i+1) ++ block' n (i+1) (If e f g) ++ br i ++ "}" block n i e = "{" ++ br (i+1) ++ "return " ++ pretty n (i+1) e ++ ";" ++ br i ++ "}" block' :: Nat -> Int -> Exp -> String block' n i (If e f g) = "if (" ++ pretty n i e ++ ") " ++ block n i f ++ " else " ++ block' n i g block' n i e = block n i e modname :: GlobalId -> String modname (GlobalId ms) = "\"" ++ intercalate "." ms ++ "\"" exports :: Nat -> Int -> Set [MemberId] -> [Export] -> String exports n i lss [] = "" exports n i lss (Export ls e : es) | member (init ls) lss = "exports[" ++ intercalate "][" (pretties n i ls) ++ "] = " ++ pretty n (i+1) e ++ ";" ++ br i ++ exports n i (insert ls lss) es exports n i lss (Export ls e : es) | otherwise = exports n i lss (Export (init ls) (Object empty) : Export ls e : es) instance Pretty Module where pretty n i (Module m es) = "define([" ++ intercalate "," ("\"exports\"" : map modname js) ++ "]," ++ "function(" ++ intercalate "," ("exports" : pretties n i js) ++ ") {" ++ br (i+1) ++ exports n (i+1) (singleton []) es ++ "});" ++ br i where js = toList (globals es) Agda-2.4.2.5/src/full/Agda/Compiler/JS/Case.hs0000644000000000000000000000770412635075266016612 0ustar0000000000000000{-# LANGUAGE CPP #-} module Agda.Compiler.JS.Case where import Prelude hiding ( null ) import Data.Map ( Map, empty, null, mapWithKey, fromListWith, unionWith ) import Data.List ( genericLength, genericTake, intercalate ) import Agda.Syntax.Common ( Nat ) import Agda.Compiler.JS.Pretty ( Pretty, pretty, pretties ) import Agda.Compiler.JS.Syntax ( Exp(Undefined,Local,Lambda,Object,Apply), LocalId(LocalId), MemberId ) import Agda.Compiler.JS.Substitution ( shiftFrom ) #include "undefined.h" import Agda.Utils.Impossible ( Impossible(Impossible), throwImpossible ) -- ECMAScript doesn't support pattern-mathching case, so -- we translate to a visitor pattern. We use a decision-tree -- translation, as that seems to fit visitor objects better. data Case = Case { pats :: [Patt], body :: Exp } deriving (Show) instance Pretty Case where pretty n i (Case ps e) = intercalate " " (pretties n i ps) ++ " -> " ++ pretty (n + numVars ps) i e -- Not handling literal patterns yet -- Note that all patterns introduce binders, in depth-first prefix order, -- for example Tagged l [ VarPatt , VarPatt ] should be thought -- of as "x2 @ l (x1, x0)". data Patt = VarPatt | Tagged Tag [Patt] deriving (Show) instance Pretty Patt where pretty n i VarPatt = "x" pretty n i (Tagged (Tag l _ _) ps) = "(" ++ intercalate " " (pretty n i l : pretties n i ps) ++ ")" -- With each tag, we record its name, and the names of the -- other constructors of the datatype (e.g. we'd represent -- zero as Tag "zero" ["suc","zero"]). We also record the -- the function which accepts a visitor (by default Apply, -- but can be over-ridden by the FFI). data Tag = Tag MemberId [MemberId] (Exp -> [Exp] -> Exp) instance Show Tag where show (Tag i is _) = show i -- Number of bound variables in a pattern numVars :: [Patt] -> Nat numVars = sum . map numVars' numVars' :: Patt -> Nat numVars' (VarPatt) = 1 numVars' (Tagged l ps) = 1 + numVars ps -- Compile a case statement to a function -- in lambda n cs, n is the number of parameters lambda :: [Case] -> Exp lambda [] = Undefined lambda (c:cs) = lambda' 0 0 (genericLength (pats c)) (c:cs) -- In lambda' l m n cs, -- l is the number of free variables, -- m is the number of already read parameters, with m <= l, and -- n is the number of unread parameters. -- Each case should be of the form (Case ps e) where ps has length m+n. -- e can have (l - m + #bv ps) variables free. -- lambda' l m n cs can have l variables free. lambda' :: Nat -> Nat -> Nat -> [Case] -> Exp lambda' l m n [] = Undefined lambda' l 0 0 (c : cs) = body c lambda' l 0 n cs = Lambda 1 (lambda' (l+1) 1 (n-1) cs) lambda' l m n cs = case null ts of True -> lambda' l (m-1) n (map pop cs) False -> visit cs (Local (LocalId (m-1))) [Object (mapWithKey (match l (m-1) n cs) ts)] where ts = tags cs -- Pop cases pop :: Case -> Case pop (Case (VarPatt : ps) e) = (Case ps e) pop _ = __IMPOSSIBLE__ -- Cases which match a given tag/arity match :: Nat -> Nat -> Nat -> [Case] -> MemberId -> Nat -> Exp match l m n cs t x = Lambda x (lambda' (l + x) (m + x) n (concat (map (refine t x) cs))) -- Refine a case statement by a given tag/arity refine :: MemberId -> Nat -> Case -> [Case] refine t x (Case (VarPatt : qs) e) = [Case (genericTake x (repeat VarPatt) ++ qs) (shiftFrom (numVars qs) x e)] refine t x (Case (Tagged (Tag u _ _) ps : qs) e) | t == u = [Case (ps ++ qs) e] refine _ _ _ = [] -- Extract the visit function visit :: [Case] -> Exp -> [Exp] -> Exp visit (Case (Tagged (Tag _ _ v) _ : _) _ : _ ) = v visit (Case (VarPatt : _) _ : cs) = visit cs visit _ = Apply -- Extract the list of possible tags, and their arity. tags :: [Case] -> Map MemberId Nat tags = foldl (unionWith max) empty . map tag tag :: Case -> Map MemberId Nat tag (Case (Tagged (Tag t us _) ps : qs) e) = fromListWith max ((t, genericLength ps) : [ (u, 0) | u <- us ]) tag _ = empty Agda-2.4.2.5/src/full/Agda/Compiler/JS/Parser.hs0000644000000000000000000001173612635075266017173 0ustar0000000000000000module Agda.Compiler.JS.Parser where -- This is a simple parser for the ECMAScript FFI, which parses a -- subset of ECMAscript expressions. We do this so that we can -- optimize code that contains FFI expressions, for example -- {-# COMPILED_JS _+_ function (x) { return function (y) { return x+y; }; } #-} -- will generate ECMAScript "1 + 2" from Agda "1 + 2". import Prelude hiding ( exp, lookup ) import Data.List ( genericLength ) import Data.Char ( isLetter, isAlphaNum, isDigit ) import Data.Map ( Map, fromList, union, empty ) import qualified Data.Map as M import Agda.Utils.ReadP ( ReadP, (+++), (<++), between, char, choice, look, many, munch, munch1, parse', pfail, satisfy, sepBy, string, skipSpaces ) import Agda.Syntax.Common ( Nat ) import Agda.Compiler.JS.Syntax ( LocalId(LocalId), GlobalId(GlobalId), MemberId(MemberId), Exp(Local,Global,Undefined,String,Integer,Lambda,Apply,Object,Lookup,If,BinOp,PreOp,Const) ) type Parser = ReadP Char identifier :: Parser String identifier = do c <- satisfy isLetter cs <- munch isAlphaNum skipSpaces return (c : cs) wordBoundary :: Parser () wordBoundary = do cs <- look case cs of (c:_) | isAlphaNum c -> pfail _ -> return () token :: String -> Parser () token s = string s >> wordBoundary >> skipSpaces punct :: Char -> Parser () punct c = char c >> skipSpaces parened :: Parser a -> Parser a parened = between (punct '(') (punct ')') braced :: Parser a -> Parser a braced = between (punct '{') (punct '}') bracketed :: Parser a -> Parser a bracketed = between (punct '[') (punct ']') quoted :: Parser a -> Parser a quoted = between (char '"') (punct '"') stringLit :: Parser Exp stringLit = do s <- stringStr; return (String s) stringStr :: Parser String stringStr = quoted (many stringChr) stringChr :: Parser Char stringChr = satisfy (`notElem` "\\\"") +++ escChr -- Not handling all escape sequences escChr :: Parser Char escChr = char '\\' >> ( (char 'n' >> return '\n') +++ (char 'r' >> return '\r') +++ (char 't' >> return '\t') +++ (char '"' >> return '"') +++ (char '\\' >> return '\\') ) -- Not handling all integer constants intLit :: Parser Exp intLit = do s <- munch1 isDigit; skipSpaces; return (Integer (read s)) undef :: Parser Exp undef = token "undefined" >> return Undefined localid :: (Map String Nat) -> Parser Exp localid m = do s <- identifier case M.lookup s m of Nothing -> return (Const s) Just i -> return (Local (LocalId i)) globalid :: Parser Exp globalid = do token "require" i <- parened (quoted (sepBy (munch1 isAlphaNum) (char '.'))) return (Global (GlobalId i)) preop :: Parser String preop = do op <- choice (map string [ "+", "-", "!" ]) skipSpaces return op binop :: Parser String binop = do op <- choice (map string [ "<", ">", "<=", ">=", "==", "===", "<<", ">>", "<<<", ">>>", "!=", "!==", "+", "-", "*", "%", "/", "&", "&&", "|", "||", "^" ]) skipSpaces return op field :: (Map String Nat) -> Parser (MemberId,Exp) field m = do l <- stringStr punct ':' e <- exp m return (MemberId l, e) object :: (Map String Nat) -> Parser Exp object m = do o <- braced (sepBy (field m) (punct ',')) return (Object (fromList o)) function :: (Map String Nat) -> Parser Exp function m = do token "function" xs <- parened (sepBy identifier (punct ',')) n <- return (genericLength xs) m' <- return (union (fromList (zip xs [n-1,n-2..0])) (M.map (+n) m)) e <- bracedBlock m' return (Lambda n e) bracedBlock :: (Map String Nat) -> Parser Exp bracedBlock m = braced (returnBlock m +++ ifBlock m +++ bracedBlock m) returnBlock :: (Map String Nat) -> Parser Exp returnBlock m = between (token "return") (punct ';') (exp m) ifBlock :: (Map String Nat) -> Parser Exp ifBlock m = do token "if" e <- parened (exp m) f <- bracedBlock m token "else" g <- (ifBlock m +++ bracedBlock m) return (If e f g) exp0 :: (Map String Nat) -> Parser Exp exp0 m = function m <++ undef <++ globalid <++ localid m <++ object m <++ stringLit <++ intLit <++ parened (exp m) exp1 :: (Map String Nat) -> Parser Exp exp1 m = (do op <- preop; e <- exp1 m; return (PreOp op e)) <++ (exp0 m) exp2 :: (Map String Nat) -> Parser Exp exp2 m = exp1 m >>= exp2' m -- Not handling operator fixity or precedence exp2' :: (Map String Nat) -> Exp -> Parser Exp exp2' m e = (do es <- parened (sepBy (exp m) (punct ',')); exp2' m (Apply e es)) <++ (do i <- bracketed stringStr; exp2' m (Lookup e (MemberId i))) <++ (do punct '.'; i <- identifier; exp2' m (Lookup e (MemberId i))) <++ (do op <- binop; f <- exp0 m; exp2' m (BinOp e op f)) <++ (return e) exp3 :: (Map String Nat) -> Parser Exp exp3 m = exp2 m >>= exp3' m exp3' :: (Map String Nat) -> Exp -> Parser Exp exp3' m e = (do punct '?'; f <- exp2 m; punct ':'; g <- exp2 m; return (If e f g)) <++ (return e) exp :: (Map String Nat) -> Parser Exp exp = exp3 topLevel :: Parser Exp topLevel = skipSpaces >> exp empty parse :: String -> Either Exp String parse = parse' topLevel Agda-2.4.2.5/src/full/Agda/Compiler/JS/Syntax.hs0000644000000000000000000000566312635075266017227 0ustar0000000000000000{-# LANGUAGE DeriveDataTypeable #-} module Agda.Compiler.JS.Syntax where import Data.Typeable ( Typeable ) import Data.Map ( Map, fold ) import Data.Set ( Set, empty, singleton, union ) import Agda.Syntax.Common ( Nat ) -- An untyped lambda calculus with records, -- and a special self-binder for recursive declarations data Exp = Self | Local LocalId | Global GlobalId | Undefined | String String | Char Char | Integer Integer | Double Double | Lambda Nat Exp | Object (Map MemberId Exp) | Apply Exp [Exp] | Lookup Exp MemberId | If Exp Exp Exp | BinOp Exp String Exp | PreOp String Exp | Const String deriving (Typeable, Show) -- Local identifiers are named by De Bruijn indices. -- Global identifiers are named by string lists. -- Object members are named by strings. newtype LocalId = LocalId Nat deriving (Typeable, Eq, Ord, Show) newtype GlobalId = GlobalId [String] deriving (Typeable, Eq, Ord, Show) newtype MemberId = MemberId String deriving (Typeable, Eq, Ord, Show) -- The top-level compilation unit is a module, which names -- the GId of its exports, and a list of definitions data Export = Export { expName :: [MemberId], defn :: Exp } deriving (Typeable, Show) data Module = Module { modName :: GlobalId, exports :: [Export] } deriving (Typeable, Show) -- Note that modules are allowed to be recursive, via the Self expression, -- which is bound to the exported module. -- Top-level uses of the form exports.l1....lN. class Uses a where uses :: a -> Set [MemberId] instance Uses a => Uses [a] where uses = foldr (union . uses) empty instance Uses a => Uses (Map k a) where uses = fold (union . uses) empty instance Uses Exp where uses (Object o) = fold (union . uses) empty o uses (Apply e es) = foldr (union . uses) (uses e) es uses (Lookup e l) = uses' e [l] where uses' Self ls = singleton ls uses' (Lookup e l) ls = uses' e (l : ls) uses' e ls = uses e uses (If e f g) = uses e `union` uses f `union` uses g uses (BinOp e op f) = uses e `union` uses f uses (PreOp op e) = uses e uses e = empty instance Uses Export where uses (Export ls e) = uses e -- All global ids class Globals a where globals :: a -> Set GlobalId instance Globals a => Globals [a] where globals = foldr (union . globals) empty instance Globals a => Globals (Map k a) where globals = fold (union . globals) empty instance Globals Exp where globals (Global i) = singleton i globals (Lambda n e) = globals e globals (Object o) = globals o globals (Apply e es) = globals e `union` globals es globals (Lookup e l) = globals e globals (If e f g) = globals e `union` globals f `union` globals g globals (BinOp e op f) = globals e `union` globals f globals (PreOp op e) = globals e globals _ = empty instance Globals Export where globals (Export ls e) = globals e instance Globals Module where globals (Module m es) = globals es Agda-2.4.2.5/src/full/Agda/Compiler/JS/Compiler.hs0000644000000000000000000004205012635075266017502 0ustar0000000000000000{-# LANGUAGE CPP #-} {-# LANGUAGE NamedFieldPuns #-} module Agda.Compiler.JS.Compiler where import Prelude hiding ( null, writeFile ) import Control.Monad.Reader ( liftIO ) import Data.List ( intercalate, genericLength, partition ) import Data.Maybe ( isJust ) import Data.Set ( Set, null, insert, difference, delete ) import Data.Map ( fromList, elems ) import qualified Data.Set as Set import qualified Data.Map as Map import System.Directory ( createDirectoryIfMissing ) import System.FilePath ( splitFileName, () ) import Agda.Interaction.FindFile ( findFile, findInterfaceFile ) import Agda.Interaction.Imports ( isNewerThan ) import Agda.Interaction.Options ( optCompileDir ) import Agda.Syntax.Common ( Nat, unArg, namedArg ) import Agda.Syntax.Concrete.Name ( projectRoot ) import Agda.Syntax.Abstract.Name ( ModuleName(MName), QName, mnameToConcrete, mnameToList, qnameName, qnameModule, isInModule, nameId ) import Agda.Syntax.Internal ( Name, Args, Type, Clause, Pattern, Pattern'(VarP,DotP,LitP,ConP,ProjP), ClauseBodyF(Body,NoBody,Bind),ClauseBody, Term(Var,Lam,Lit,Level,Def,Con,Pi,Sort,MetaV,DontCare,Shared,ExtLam), unSpine, allApplyElims, conName, derefPtr, toTopLevelModuleName, clausePats, clauseBody, arity, unEl, unAbs ) import Agda.TypeChecking.Substitute ( absBody ) import Agda.Syntax.Literal ( Literal(LitInt,LitFloat,LitString,LitChar,LitQName) ) import Agda.TypeChecking.Level ( reallyUnLevelView ) import Agda.TypeChecking.Monad ( TCM, Definition(Defn), Interface, JSCode, Defn(Record,Datatype,Constructor,Primitive,Function,Axiom), Projection(Projection), projProper, projFromType, projIndex, iModuleName, iImportedModules, theDef, getConstInfo, ignoreAbstractMode, miInterface, getVisitedModules, defName, defType, funClauses, funProjection, projectionArgs, dataPars, dataCons, conPars, conData, recConHead, recFields, recNamedCon, localTCState, typeError, TypeError(NotImplemented), defJSDef ) import Agda.TypeChecking.Monad.Options ( setCommandLineOptions, commandLineOptions, reportSLn ) import Agda.TypeChecking.Reduce ( instantiateFull, normalise ) import Agda.Utils.FileName ( filePath ) import Agda.Utils.Function ( iterate' ) import Agda.Utils.Monad ( (<$>), (<*>), ifM ) import Agda.Utils.Pretty (prettyShow) import Agda.Utils.IO.UTF8 ( writeFile ) import qualified Agda.Utils.HashMap as HMap import Agda.Compiler.MAlonzo.Misc ( curDefs, curIF, curMName, setInterface ) import Agda.Compiler.MAlonzo.Primitives ( repl ) import Agda.Compiler.JS.Syntax ( Exp(Self,Local,Global,Undefined,String,Char,Integer,Double,Lambda,Object,Apply,Lookup), LocalId(LocalId), GlobalId(GlobalId), MemberId(MemberId), Export(Export), Module(Module), modName, expName, uses ) import Agda.Compiler.JS.Substitution ( curriedLambda, curriedApply, emp, subst, apply ) import Agda.Compiler.JS.Case ( Tag(Tag), Case(Case), Patt(VarPatt,Tagged), lambda ) import Agda.Compiler.JS.Pretty ( pretty ) #include "undefined.h" import Agda.Utils.Impossible ( Impossible(Impossible), throwImpossible ) -------------------------------------------------- -- Entry point into the compiler -------------------------------------------------- compilerMain :: Interface -> TCM () compilerMain mainI = -- Preserve the state (the compiler modifies the state). localTCState $ do -- Compute the output directory. opts <- commandLineOptions compileDir <- case optCompileDir opts of Just dir -> return dir Nothing -> do -- The default output directory is the project root. let tm = toTopLevelModuleName $ iModuleName mainI f <- findFile tm return $ filePath $ projectRoot f tm setCommandLineOptions $ opts { optCompileDir = Just compileDir } ignoreAbstractMode $ do mapM_ (compile . miInterface) =<< (elems <$> getVisitedModules) compile :: Interface -> TCM () compile i = do setInterface i ifM uptodate noComp $ do yesComp writeModule =<< curModule where uptodate = liftIO =<< (isNewerThan <$> outFile_ <*> ifile) ifile = maybe __IMPOSSIBLE__ filePath <$> (findInterfaceFile . toTopLevelModuleName =<< curMName) noComp = reportSLn "" 1 . (++ " : no compilation is needed.") . prettyShow =<< curMName yesComp = reportSLn "" 1 . (`repl` "Compiling <<0>> in <<1>> to <<2>>") =<< sequence [prettyShow <$> curMName, ifile, outFile_] :: TCM () -------------------------------------------------- -- Naming -------------------------------------------------- prefix :: [Char] prefix = "jAgda" jsMod :: ModuleName -> GlobalId jsMod m = GlobalId (prefix : map show (mnameToList m)) jsFileName :: GlobalId -> String jsFileName (GlobalId ms) = intercalate "." ms ++ ".js" jsMember :: Name -> MemberId jsMember n = -- Anonymous fields are used for where clauses, -- and they're all given the concrete name "_", -- so we disambiguate them using their name id. case show n of "_" -> MemberId ("_" ++ show (nameId n)) l -> MemberId l -- Rather annoyingly, the anonymous construtor of a record R in module M -- is given the name M.recCon, but a named constructor C -- is given the name M.R.C, sigh. This causes a lot of hoop-jumping -- in the map from Agda names to JS names, which we patch by renaming -- anonymous constructors to M.R.record. global' :: QName -> TCM (Exp,[MemberId]) global' q = do i <- iModuleName <$> curIF is <- filter (isInModule q) <$> map (iModuleName . miInterface) <$> elems <$> getVisitedModules case is of [] -> __IMPOSSIBLE__ _ -> let seg = maximum (map (length . mnameToList) is) ms = mnameToList (qnameModule q) m = MName (take seg ms) ls = map jsMember (drop seg ms ++ [qnameName q]) in case (m == i) of True -> return (Self, ls) False -> return (Global (jsMod m), ls) global :: QName -> TCM (Exp,[MemberId]) global q = do d <- getConstInfo q case d of Defn { theDef = Constructor { conData = p } } -> do e <- getConstInfo p case e of Defn { theDef = Record { recNamedCon = False } } -> do (m,ls) <- global' p return (m, ls ++ [MemberId "record"]) _ -> global' (defName d) _ -> global' (defName d) -- Reorder a list of exports to ensure def-before-use. -- Note that this can diverge in the case when there is no such reordering. -- Only top-level values are evaluated before definitions are added to the -- module, so we put those last, ordered in dependency order. There can't be -- any recursion between top-level values (unless termination checking has been -- disabled and someone's written a non-sensical program), so reordering will -- terminate. reorder :: [Export] -> [Export] reorder es = datas ++ funs ++ reorder' (Set.fromList $ map expName $ datas ++ funs) vals where (vs, funs) = partition isTopLevelValue es (datas, vals) = partition isEmptyObject vs reorder' :: Set [MemberId] -> [Export] -> [Export] reorder' defs [] = [] reorder' defs (e : es) = let us = uses e `difference` defs in case null us of True -> e : (reorder' (insert (expName e) defs) es) False -> reorder' defs (insertAfter us e es) isTopLevelValue :: Export -> Bool isTopLevelValue (Export _ e) = case e of Lambda{} -> False _ -> True isEmptyObject :: Export -> Bool isEmptyObject (Export _ e) = case e of Object m -> Map.null m _ -> False insertAfter :: Set [MemberId] -> Export -> [Export] -> [Export] insertAfter us e [] = [e] insertAfter us e (f:fs) | null us = e : f : fs insertAfter us e (f:fs) | otherwise = f : insertAfter (delete (expName f) us) e fs -------------------------------------------------- -- Main compiling clauses -------------------------------------------------- curModule :: TCM Module curModule = do m <- (jsMod <$> curMName) is <- map jsMod <$> (map fst . iImportedModules <$> curIF) es <- mapM definition =<< (HMap.toList <$> curDefs) return (Module m (reorder es)) definition :: (QName,Definition) -> TCM Export definition (q,d) = do (_,ls) <- global q d <- instantiateFull d e <- defn q ls (defType d) (defJSDef d) (theDef d) return (Export ls e) defn :: QName -> [MemberId] -> Type -> Maybe JSCode -> Defn -> TCM Exp defn q ls t (Just e) Axiom = return e defn q ls t Nothing Axiom = do t <- normalise t s <- isSingleton t case s of -- Inline and eta-expand postulates of singleton type Just e -> return (curriedLambda (arity t) e) -- Everything else we leave undefined Nothing -> return Undefined defn q ls t (Just e) (Function {}) = return e defn q ls t Nothing (Function { funProjection = proj, funClauses = cls }) = do t <- normalise t s <- isSingleton t cs <- mapM clause cls case s of -- Inline and eta-expand expressions of singleton type Just e -> return (curriedLambda (arity t) e) Nothing -> case proj of Just Projection{ projProper, projFromType = p, projIndex = i } -> do -- Andreas, 2013-05-20: whether a projection is proper is now stored. if isJust projProper then -- For projections from records we use a field lookup return (curriedLambda (numPars cls) (Lookup (Local (LocalId 0)) (last ls))) else -- For anything else we generate code, after adding (i-1) dummy lambdas return (dummyLambda (i-1) (lambda cs)) {- OLD way of finding out whether a projection is proper (ie. from record) d <- getConstInfo p case theDef d of -- For projections from records we use a field lookup Record { recFields = flds } | q `elem` map unArg flds -> return (curriedLambda (numPars cls) (Lookup (Local (LocalId 0)) (last ls))) _ -> -- For anything else we generate code, after adding (i-1) dummy lambdas return (dummyLambda (i-1) (lambda cs)) -} Nothing -> return (lambda cs) defn q ls t (Just e) (Primitive {}) = return e defn q ls t _ (Primitive {}) = return Undefined defn q ls t _ (Datatype {}) = return emp defn q ls t (Just e) (Constructor {}) = return e defn q ls t _ (Constructor { conData = p, conPars = nc }) = do np <- return (arity t - nc) d <- getConstInfo p case theDef d of Record { recFields = flds } -> return (curriedLambda np (Object (fromList ( (last ls , Lambda 1 (Apply (Lookup (Local (LocalId 0)) (last ls)) [ Local (LocalId (np - i)) | i <- [0 .. np-1] ])) : (zip [ jsMember (qnameName (unArg fld)) | fld <- flds ] [ Local (LocalId (np - i)) | i <- [1 .. np] ]))))) _ -> return (curriedLambda (np + 1) (Apply (Lookup (Local (LocalId 0)) (last ls)) [ Local (LocalId (np - i)) | i <- [0 .. np-1] ])) defn q ls t _ (Record {}) = return emp -- Number of params in a function declaration numPars :: [Clause] -> Nat numPars [] = 0 numPars (c : _) = genericLength (clausePats c) -- One clause in a function definition clause :: Clause -> TCM Case clause c = do ps <- mapM (pattern . unArg) (clausePats c) (av,bv,es) <- return (mapping (map unArg (clausePats c))) e <- body (clauseBody c) return (Case ps (subst av es e)) -- Mapping from Agda variables to JS variables in a pattern. -- If mapping ps = (av,bv,es) then av is the number of Agda variables, -- bv is the number of JS variables, and es is a list of expressions, -- where es[i] is the JS variable corresponding to Agda variable i. mapping :: [Pattern] -> (Nat,Nat,[Exp]) mapping = foldr mapping' (0,0,[]) mapping' :: Pattern -> (Nat,Nat,[Exp]) -> (Nat,Nat,[Exp]) mapping' (ProjP _) (av,bv,es) = __IMPOSSIBLE__ mapping' (VarP _) (av,bv,es) = (av+1, bv+1, Local (LocalId bv) : es) mapping' (DotP _) (av,bv,es) = (av+1, bv+1, Local (LocalId bv) : es) mapping' (ConP _ _ ps) (av,bv,es) = (av',bv'+1,es') where (av',bv',es') = foldr mapping' (av,bv,es) (map namedArg ps) mapping' (LitP _) (av,bv,es) = (av, bv+1, es) -- Not doing literal patterns yet pattern :: Pattern -> TCM Patt pattern (ProjP _) = typeError $ NotImplemented $ "Compilation of copatterns" pattern (ConP c _ ps) = do l <- tag $ conName c ps <- mapM (pattern . namedArg) ps return (Tagged l ps) pattern _ = return VarPatt tag :: QName -> TCM Tag tag q = do l <- visitorName q c <- getConstInfo q case theDef c of (Constructor { conData = p }) -> do d <- getConstInfo p case (defJSDef d, theDef d) of (Just e, Datatype { dataCons = qs }) -> do ls <- mapM visitorName qs return (Tag l ls (\ x xs -> apply e (x:xs))) (Nothing, Datatype { dataCons = qs }) -> do ls <- mapM visitorName qs return (Tag l ls Apply) (Just e, Record {}) -> do return (Tag l [l] (\ x xs -> apply e (x:xs))) (Nothing, Record {}) -> do return (Tag l [l] Apply) _ -> __IMPOSSIBLE__ _ -> __IMPOSSIBLE__ visitorName :: QName -> TCM MemberId visitorName q = do (m,ls) <- global q; return (last ls) body :: ClauseBody -> TCM Exp body (Body e) = term e body (Bind b) = body (unAbs b) body (NoBody) = return Undefined term :: Term -> TCM Exp term v = do case unSpine v of (Var i es) -> do let Just as = allApplyElims es e <- return (Local (LocalId i)) es <- args 0 as return (curriedApply e es) (Lam _ at) -> Lambda 1 <$> term (absBody at) (Lit l) -> return (literal l) (Level l) -> term =<< reallyUnLevelView l (Shared p) -> term $ derefPtr p (Def q es) -> do let Just as = allApplyElims es d <- getConstInfo q case theDef d of -- Datatypes and records are erased Datatype {} -> return (String "*") Record {} -> return (String "*") _ -> case defJSDef d of -- Inline functions with an FFI definition Just e -> do es <- args (projectionArgs $ theDef d) as return (curriedApply e es) Nothing -> do t <- normalise (defType d) s <- isSingleton t case s of -- Inline and eta-expand singleton types Just e -> return (curriedLambda (arity t) e) -- Everything else we leave non-inline Nothing -> do e <- qname q es <- args (projectionArgs $ theDef d) as return (curriedApply e es) (Con con as) -> do let q = conName con d <- getConstInfo q case defJSDef d of -- Inline functions with an FFI definition Just e -> do es <- args 0 as return (curriedApply e es) -- Everything else we leave non-inline Nothing -> do e <- qname q es <- args 0 as return (curriedApply e es) (Pi _ _) -> return (String "*") (Sort _) -> return (String "*") (MetaV _ _) -> return (Undefined) (DontCare _) -> return (Undefined) ExtLam{} -> __IMPOSSIBLE__ -- Check to see if a type is a singleton, and if so, return its only -- member. Singleton types are of the form T1 -> ... -> Tn -> T where -- T is either a record with no fields, a datatype with one -- no-argument constructor, a datatype with no constructors, -- or (since this is a type-erasing translation) Set. isSingleton :: Type -> TCM (Maybe Exp) isSingleton t = case unEl t of Pi _ b -> isSingleton (unAbs b) Sort _ -> return (Just (String "*")) Def q as -> do d <- getConstInfo q case (theDef d) of Datatype { dataPars = np, dataCons = [] } -> return (Just Undefined) Datatype { dataPars = np, dataCons = [p] } -> do c <- getConstInfo p case (arity (defType c) == np) of True -> Just <$> qname p False -> return (Nothing) Record { recConHead = con, recFields = [] } -> Just <$> qname (conName con) _ -> return (Nothing) _ -> return (Nothing) args :: Int -> Args -> TCM [Exp] args n as = (replicate n Undefined ++) <$> mapM (term . unArg) as qname :: QName -> TCM Exp qname q = do (e,ls) <- global q return (foldl Lookup e ls) literal :: Literal -> Exp literal (LitInt _ x) = Integer x literal (LitFloat _ x) = Double x literal (LitString _ x) = String x literal (LitChar _ x) = Char x literal (LitQName _ x) = String (show x) dummyLambda :: Int -> Exp -> Exp dummyLambda n = iterate' n (Lambda 0) -------------------------------------------------- -- Writing out an ECMAScript module -------------------------------------------------- writeModule :: Module -> TCM () writeModule m = do out <- outFile (modName m) liftIO (writeFile out (pretty 0 0 m)) compileDir :: TCM FilePath compileDir = do mdir <- optCompileDir <$> commandLineOptions case mdir of Just dir -> return dir Nothing -> __IMPOSSIBLE__ outFile :: GlobalId -> TCM FilePath outFile m = do mdir <- compileDir let (fdir, fn) = splitFileName (jsFileName m) let dir = mdir fdir fp = dir fn liftIO $ createDirectoryIfMissing True dir return fp outFile_ :: TCM FilePath outFile_ = do m <- curMName outFile (jsMod m) Agda-2.4.2.5/src/data/0000755000000000000000000000000012635075266012420 5ustar0000000000000000Agda-2.4.2.5/src/data/Agda.css0000644000000000000000000000230312635075266013764 0ustar0000000000000000/* Aspects. */ .Comment { color: #B22222 } .Keyword { color: #CD6600 } .String { color: #B22222 } .Number { color: #A020F0 } .Symbol { color: #404040 } .PrimitiveType { color: #0000CD } .Operator {} /* NameKinds. */ .Bound { color: black } .InductiveConstructor { color: #008B00 } .CoinductiveConstructor { color: #8B7500 } .Datatype { color: #0000CD } .Field { color: #EE1289 } .Function { color: #0000CD } .Module { color: #A020F0 } .Postulate { color: #0000CD } .Primitive { color: #0000CD } .Record { color: #0000CD } /* OtherAspects. */ .DottedPattern {} .UnsolvedMeta { color: black; background: yellow } .UnsolvedConstraint { color: black; background: yellow } .TerminationProblem { color: black; background: #FFA07A } .IncompletePattern { color: black; background: #F5DEB3 } .Error { color: red; text-decoration: underline } .TypeChecks { color: black; background: #ADD8E6 } /* Standard attributes. */ a { text-decoration: none } a[href]:hover { background-color: #B4EEB4 } Agda-2.4.2.5/src/data/postprocess-latex.pl0000644000000000000000000000071612635075266016460 0ustar0000000000000000#!/usr/bin/env perl use strict; use warnings; my $tag_prefix = "AgdaTag"; my $underscore = "AgdaUnderscore"; my $commands = qr"(InductiveConstructor|CoinductiveConstructor\ |Datatype|Field|Function|Module|Postulate|Record)"; while (<>) { s|(\\Agda$commands){(.*?)} | my $cmd = $1; my $arg = $3; my $tag = "$tag_prefix-$3" =~ s/\\_/$underscore/gr; $_ = "\n%<*$tag>\n$cmd\{$arg\}\n%\n"; |gxe; print; } Agda-2.4.2.5/src/data/agda.sty0000644000000000000000000003105712635075266014063 0ustar0000000000000000% ---------------------------------------------------------------------- % Some useful commands when doing highlighting of Agda code in LaTeX. % ---------------------------------------------------------------------- \ProvidesPackage{agda} \RequirePackage{ifxetex, ifluatex, xifthen, xcolor, polytable, etoolbox} % http://tex.stackexchange.com/questions/47576/combining-ifxetex-and-ifluatex-with-the-logical-or-operation \newif\ifxetexorluatex \ifxetex \xetexorluatextrue \else \ifluatex \xetexorluatextrue \else \xetexorluatexfalse \fi \fi % XeLaTeX or LuaLaTeX \ifxetexorluatex % Hack to get the amsthm package working. % http://tex.stackexchange.com/questions/130491/xelatex-error-paragraph-ended-before-tempa-was-complete \let\AgdaOpenBracket\[\let\AgdaCloseBracket\] \RequirePackage{fontspec} \let\[\AgdaOpenBracket\let\]\AgdaCloseBracket \RequirePackage{unicode-math} \tracinglostchars=2 % If the font is missing some symbol, then say % so in the compilation output. \setmainfont[Ligatures=TeX]{texgyrepagella-regular.otf} \setmathfont{Asana-Math.otf} \providecommand{\DeclareUnicodeCharacter}[2]{\relax} % pdfLaTeX \else \RequirePackage{ucs, amsfonts, amssymb} \RequirePackage[safe]{tipa} % See page 12 of the tipa manual for what % safe does. % http://tex.stackexchange.com/questions/1774/how-to-insert-pipe-symbol-in-latex \RequirePackage[T1]{fontenc} \RequirePackage[utf8x]{inputenc} \fi % ---------------------------------------------------------------------- % Options \DeclareOption{bw} {\newcommand{\AgdaColourScheme}{bw}} \DeclareOption{conor}{\newcommand{\AgdaColourScheme}{conor}} \newif\if@AgdaEnableReferences\@AgdaEnableReferencesfalse \DeclareOption{references}{ \@AgdaEnableReferencestrue } \newif\if@AgdaEnableLinks\@AgdaEnableLinksfalse \DeclareOption{links}{ \@AgdaEnableLinkstrue } \ProcessOptions\relax % ---------------------------------------------------------------------- % Colour schemes. \providecommand{\AgdaColourScheme}{standard} % ---------------------------------------------------------------------- % References to code (needs additional post-processing of tex files to % work, see wiki for details). \if@AgdaEnableReferences \RequirePackage{catchfilebetweentags, xstring} \newcommand{\AgdaRef}[2][]{% \StrSubstitute{#2}{\_}{AgdaUnderscore}[\tmp]% \ifthenelse{\isempty{#1}}% {\ExecuteMetaData{AgdaTag-\tmp}}% {\ExecuteMetaData{#1}{AgdaTag-\tmp}} } \fi \providecommand{\AgdaRef}[2][]{#2} % ---------------------------------------------------------------------- % Links (only done if the option is passed and the user has loaded the % hyperref package). \if@AgdaEnableLinks \@ifpackageloaded{hyperref}{ % List that holds added targets. \newcommand{\AgdaList}[0]{} \newtoggle{AgdaIsElem} \newcounter{AgdaIndex} \newcommand{\AgdaLookup}[3]{% \togglefalse{AgdaIsElem}% \setcounter{AgdaIndex}{0}% \renewcommand*{\do}[1]{% \ifstrequal{#1}{##1}% {\toggletrue{AgdaIsElem}\listbreak}% {\stepcounter{AgdaIndex}}}% \dolistloop{\AgdaList}% \iftoggle{AgdaIsElem}{#2}{#3}% } \newcommand*{\AgdaTargetHelper}[1]{% \AgdaLookup{#1}% {\PackageError{agda}{``#1'' used as target more than once}% {Overloaded identifiers and links do not% work well, consider using unique% \MessageBreak identifiers instead.}% }% {\listadd{\AgdaList}{#1}% \hypertarget{Agda\theAgdaIndex}{}% }% } \newcommand{\AgdaTarget}[1]{\forcsvlist{\AgdaTargetHelper}{#1}} \newcommand{\AgdaLink}[1]{% \AgdaLookup{#1}% {\hyperlink{Agda\theAgdaIndex}{#1}}% {#1}% } }{\PackageError{agda}{Load the hyperref package before the agda package}{}} \fi \providecommand{\AgdaTarget}[1]{} \providecommand{\AgdaLink}[1]{#1} % ---------------------------------------------------------------------- % Font styles. \ifxetexorluatex \newcommand{\AgdaFontStyle}[1]{\ensuremath{\mathsf{#1}}} \ifthenelse{\equal{\AgdaColourScheme}{bw}}{ \newcommand{\AgdaKeywordFontStyle}[1]{\underline{#1}} }{ \newcommand{\AgdaKeywordFontStyle}[1]{\ensuremath{\mathsf{#1}}} } \newcommand{\AgdaStringFontStyle}[1]{\ensuremath{\mathtt{#1}}} \newcommand{\AgdaCommentFontStyle}[1]{\ensuremath{\mathtt{#1}}} \newcommand{\AgdaBoundFontStyle}[1]{\ensuremath{\mathit{#1}}} \else \newcommand{\AgdaFontStyle}[1]{\textsf{#1}} \ifthenelse{\equal{\AgdaColourScheme}{bw}}{ \newcommand{\AgdaKeywordFontStyle}[1]{\underline{#1}} }{ \newcommand{\AgdaKeywordFontStyle}[1]{\textsf{#1}} } \newcommand{\AgdaStringFontStyle}[1]{\texttt{#1}} \newcommand{\AgdaCommentFontStyle}[1]{\texttt{#1}} \newcommand{\AgdaBoundFontStyle}[1]{\textit{#1}} \fi % ---------------------------------------------------------------------- % Colours. % ---------------------------------- % The black and white colour scheme. \ifthenelse{\equal{\AgdaColourScheme}{bw}}{ % Aspect colours. \definecolor{AgdaComment} {HTML}{000000} \definecolor{AgdaKeyword} {HTML}{000000} \definecolor{AgdaString} {HTML}{000000} \definecolor{AgdaNumber} {HTML}{000000} \definecolor{AgdaSymbol} {HTML}{000000} \definecolor{AgdaPrimitiveType}{HTML}{000000} \definecolor{AgdaOperator} {HTML}{000000} % NameKind colours. \definecolor{AgdaBound} {HTML}{000000} \definecolor{AgdaInductiveConstructor} {HTML}{000000} \definecolor{AgdaCoinductiveConstructor}{HTML}{000000} \definecolor{AgdaDatatype} {HTML}{000000} \definecolor{AgdaField} {HTML}{000000} \definecolor{AgdaFunction} {HTML}{000000} \definecolor{AgdaModule} {HTML}{000000} \definecolor{AgdaPostulate} {HTML}{000000} \definecolor{AgdaPrimitive} {HTML}{000000} \definecolor{AgdaRecord} {HTML}{000000} \definecolor{AgdaArgument} {HTML}{000000} % Other aspect colours. \definecolor{AgdaDottedPattern} {HTML}{000000} \definecolor{AgdaUnsolvedMeta} {HTML}{D3D3D3} \definecolor{AgdaTerminationProblem}{HTML}{BEBEBE} \definecolor{AgdaIncompletePattern} {HTML}{D3D3D3} \definecolor{AgdaError} {HTML}{696969} % Misc. \definecolor{AgdaHole} {HTML}{BEBEBE} % ---------------------------------- % Conor McBride's colour scheme. }{ \ifthenelse{\equal{\AgdaColourScheme}{conor}}{ % Aspect colours. \definecolor{AgdaComment} {HTML}{B22222} \definecolor{AgdaKeyword} {HTML}{000000} \definecolor{AgdaString} {HTML}{000000} \definecolor{AgdaNumber} {HTML}{000000} \definecolor{AgdaSymbol} {HTML}{000000} \definecolor{AgdaPrimitiveType}{HTML}{0000CD} \definecolor{AgdaOperator} {HTML}{000000} % NameKind colours. \definecolor{AgdaBound} {HTML}{A020F0} \definecolor{AgdaInductiveConstructor} {HTML}{8B0000} \definecolor{AgdaCoinductiveConstructor}{HTML}{8B0000} \definecolor{AgdaDatatype} {HTML}{0000CD} \definecolor{AgdaField} {HTML}{8B0000} \definecolor{AgdaFunction} {HTML}{006400} \definecolor{AgdaModule} {HTML}{006400} \definecolor{AgdaPostulate} {HTML}{006400} \definecolor{AgdaPrimitive} {HTML}{006400} \definecolor{AgdaRecord} {HTML}{0000CD} \definecolor{AgdaArgument} {HTML}{404040} % Other aspect colours. \definecolor{AgdaDottedPattern} {HTML}{000000} \definecolor{AgdaUnsolvedMeta} {HTML}{FFD700} \definecolor{AgdaTerminationProblem}{HTML}{FF0000} \definecolor{AgdaIncompletePattern} {HTML}{A020F0} \definecolor{AgdaError} {HTML}{F4A460} % Misc. \definecolor{AgdaHole} {HTML}{9DFF9D} % ---------------------------------- % The standard colour scheme. }{ % Aspect colours. \definecolor{AgdaComment} {HTML}{B22222} \definecolor{AgdaKeyword} {HTML}{CD6600} \definecolor{AgdaString} {HTML}{B22222} \definecolor{AgdaNumber} {HTML}{A020F0} \definecolor{AgdaSymbol} {HTML}{404040} \definecolor{AgdaPrimitiveType}{HTML}{0000CD} \definecolor{AgdaOperator} {HTML}{000000} % NameKind colours. \definecolor{AgdaBound} {HTML}{000000} \definecolor{AgdaInductiveConstructor} {HTML}{008B00} \definecolor{AgdaCoinductiveConstructor}{HTML}{8B7500} \definecolor{AgdaDatatype} {HTML}{0000CD} \definecolor{AgdaField} {HTML}{EE1289} \definecolor{AgdaFunction} {HTML}{0000CD} \definecolor{AgdaModule} {HTML}{A020F0} \definecolor{AgdaPostulate} {HTML}{0000CD} \definecolor{AgdaPrimitive} {HTML}{0000CD} \definecolor{AgdaRecord} {HTML}{0000CD} \definecolor{AgdaArgument} {HTML}{404040} % Other aspect colours. \definecolor{AgdaDottedPattern} {HTML}{000000} \definecolor{AgdaUnsolvedMeta} {HTML}{FFFF00} \definecolor{AgdaTerminationProblem}{HTML}{FFA07A} \definecolor{AgdaIncompletePattern} {HTML}{F5DEB3} \definecolor{AgdaError} {HTML}{FF0000} % Misc. \definecolor{AgdaHole} {HTML}{9DFF9D} }} % ---------------------------------------------------------------------- % Commands. % Aspect commands. \newcommand{\AgdaComment} [1] {\AgdaCommentFontStyle{\textcolor{AgdaComment}{#1}}} \newcommand{\AgdaKeyword} [1] {\AgdaKeywordFontStyle{\textcolor{AgdaKeyword}{#1}}} \newcommand{\AgdaString} [1]{\AgdaStringFontStyle{\textcolor{AgdaString}{#1}}} \newcommand{\AgdaNumber} [1]{\AgdaFontStyle{\textcolor{AgdaNumber}{#1}}} \newcommand{\AgdaSymbol} [1]{\AgdaFontStyle{\textcolor{AgdaSymbol}{#1}}} \newcommand{\AgdaPrimitiveType}[1] {\AgdaFontStyle{\textcolor{AgdaPrimitiveType}{#1}}} \newcommand{\AgdaOperator} [1]{\AgdaFontStyle{\textcolor{AgdaOperator}{#1}}} % NameKind commands. \newcommand{\AgdaNoSpaceMath}[1] {\begingroup\thickmuskip=0mu\medmuskip=0mu#1\endgroup} \newcommand{\AgdaBound}[1] {\AgdaNoSpaceMath{\AgdaBoundFontStyle{\textcolor{AgdaBound}{#1}}}} \newcommand{\AgdaInductiveConstructor}[1] {\AgdaNoSpaceMath{\AgdaFontStyle{\textcolor{AgdaInductiveConstructor}{\AgdaLink{#1}}}}} \newcommand{\AgdaCoinductiveConstructor}[1] {\AgdaNoSpaceMath{\AgdaFontStyle{\textcolor{AgdaCoinductiveConstructor}{\AgdaLink{#1}}}}} \newcommand{\AgdaDatatype}[1] {\AgdaNoSpaceMath{\AgdaFontStyle{\textcolor{AgdaDatatype}{\AgdaLink{#1}}}}} \newcommand{\AgdaField}[1] {\AgdaNoSpaceMath{\AgdaFontStyle{\textcolor{AgdaField}{\AgdaLink{#1}}}}} \newcommand{\AgdaFunction}[1] {\AgdaNoSpaceMath{\AgdaFontStyle{\textcolor{AgdaFunction}{\AgdaLink{#1}}}}} \newcommand{\AgdaModule}[1] {\AgdaNoSpaceMath{\AgdaFontStyle{\textcolor{AgdaModule}{\AgdaLink{#1}}}}} \newcommand{\AgdaPostulate}[1] {\AgdaNoSpaceMath{\AgdaFontStyle{\textcolor{AgdaPostulate}{\AgdaLink{#1}}}}} \newcommand{\AgdaPrimitive}[1] {\AgdaNoSpaceMath{\AgdaFontStyle{\textcolor{AgdaPrimitive}{#1}}}} \newcommand{\AgdaRecord}[1] {\AgdaNoSpaceMath{\AgdaFontStyle{\textcolor{AgdaRecord}{\AgdaLink{#1}}}}} \newcommand{\AgdaArgument}[1] {\AgdaNoSpaceMath{\AgdaFontStyle{\textcolor{AgdaArgument}{\AgdaLink{#1}}}}} % Other aspect commands. \newcommand{\AgdaFixityOp} [1]{\AgdaNoSpaceMath{$#1$}} \newcommand{\AgdaDottedPattern} [1]{\textcolor{AgdaDottedPattern}{#1}} \newcommand{\AgdaUnsolvedMeta} [1] {\AgdaFontStyle{\colorbox{AgdaUnsolvedMeta}{#1}}} \newcommand{\AgdaTerminationProblem}[1] {\AgdaFontStyle{\colorbox{AgdaTerminationProblem}{#1}}} \newcommand{\AgdaIncompletePattern} [1]{\colorbox{AgdaIncompletePattern}{#1}} \newcommand{\AgdaError} [1] {\AgdaFontStyle{\textcolor{AgdaError}{\underline{#1}}}} % Misc. \newcommand{\AgdaHole}[1]{\colorbox{AgdaHole}{#1}} \long\def\AgdaHide#1{} % Used to hide code from LaTeX. \newcommand{\AgdaIndent}[1]{$\;\;$} % ---------------------------------------------------------------------- % The code environment. \newcommand{\AgdaCodeStyle}{} % \newcommand{\AgdaCodeStyle}{\tiny} \ifdefined\mathindent {} \else \newdimen\mathindent\mathindent\leftmargini \fi \newenvironment{code}% {\noindent\ignorespaces\advance\leftskip\mathindent\AgdaCodeStyle\pboxed}% {\endpboxed\par\noindent% \ignorespacesafterend} % Default column for polytable. \defaultcolumn{@{~}l@{~}} \endinput Agda-2.4.2.5/src/data/emacs-mode/0000755000000000000000000000000012635075266014432 5ustar0000000000000000Agda-2.4.2.5/src/data/emacs-mode/agda2.el0000644000000000000000000000105612635075266015734 0ustar0000000000000000;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Agda mode code which should run before the first Agda file is ;; loaded (defvar agda2-directory (file-name-directory load-file-name) "Path to the directory that contains agda2.el(c).") (add-to-list 'load-path (or agda2-directory (car load-path))) (autoload 'agda2-mode "agda2-mode" "Major mode for editing Agda files (version ≥ 2)." t) (add-to-list 'auto-mode-alist '("\\.l?agda\\'" . agda2-mode)) (modify-coding-system-alist 'file "\\.l?agda\\'" 'utf-8) (provide 'agda2) Agda-2.4.2.5/src/data/emacs-mode/agda2-abbrevs.el0000644000000000000000000000506112635075266017356 0ustar0000000000000000;; agda2-abbrevs.el --- Default Agda abbrevs ;;; Commentary: ;;; Code: ;; Skeletons (require 'skeleton) (define-skeleton agda2-abbrevs-module "Inserts a module header template." nil "module " _ " where\n") (define-skeleton agda2-abbrevs-data "Inserts a data template." nil "data " _ " : Set where\n") (define-skeleton agda2-abbrevs-codata "Inserts a codata template." nil "codata " _ " : Set where\n") (define-skeleton agda2-abbrevs-record "Inserts a record type template." nil "record " _ " : Set where\n" " field\n") (define-skeleton agda2-abbrevs-record-value "Inserts a record value template." nil "record {" _ "}") (define-skeleton agda2-abbrevs-using "Inserts a using template." nil "using (" _ ")") (define-skeleton agda2-abbrevs-hiding "Inserts a hiding template." nil "hiding (" _ ")") (define-skeleton agda2-abbrevs-renaming "Inserts a renaming template." nil "renaming (" _ " to " _ ")") (define-skeleton agda2-abbrevs-forall "Inserts a forall template." nil "∀ {" _ "} ") ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Abbrevs (defvar agda2-abbrevs-defaults '( ("m" "" agda2-abbrevs-module) ("d" "" agda2-abbrevs-data) ("c" "" agda2-abbrevs-codata) ("re" "" agda2-abbrevs-record) ("rec" "" agda2-abbrevs-record-value) ("u" "" agda2-abbrevs-using) ("h" "" agda2-abbrevs-hiding) ("r" "" agda2-abbrevs-renaming) ("w" "where\n") ("po" "postulate") ("a" "abstract\n") ("pr" "private\n") ("pu" "public") ("mu" "mutual\n") ("f" "" agda2-abbrevs-forall) ("oi" "open import ")) "Abbreviations defined by default in the Agda mode.") (defcustom agda2-mode-abbrevs-use-defaults nil "If non-nil include the default Agda mode abbrevs in `agda2-mode-abbrev-table'. The abbrevs are designed to be expanded explicitly, so users of `abbrev-mode' probably do not want to include them. Restart Emacs in order for this change to take effect." :group 'agda2 :type '(choice (const :tag "Yes" t) (const :tag "No" nil))) (defvar agda2-mode-abbrev-table nil "Agda mode abbrev table.") (define-abbrev-table 'agda2-mode-abbrev-table (if agda2-mode-abbrevs-use-defaults (mapcar (lambda (abbrev) (append abbrev (make-list (- 4 (length abbrev)) nil) '((:system t)))) agda2-abbrevs-defaults))) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Administrative details (provide 'agda2-abbrevs) ;;; agda2-abbrevs.el ends here Agda-2.4.2.5/src/data/emacs-mode/annotation.el0000644000000000000000000002146412635075266017135 0ustar0000000000000000;;; annotation.el --- Functions for annotating text with faces and help bubbles ;;; Commentary: ;; ;;; Code: (require 'cl) (defconst annotations-offset (- (save-restriction (widen) (point-min)) 1) "Offset between buffer positions and annotations's positions. Annotations's positions are based on 1, so this adjusts it to the base position used by your Emacs.") (defvar annotation-bindings nil "An association list mapping symbols to faces.") (make-variable-buffer-local 'annotation-bindings) (defvar annotation-goto-stack nil "Positions from which `annotation-goto' was invoked.") (defun annotation-goto-indirect (link &optional other-window) "Follow the `annotation-goto' hyperlink pointed to by LINK, if any. LINK should be a buffer position, or an event object (in which case the ending position is used). If the hyperlink exists and the jump is performed successfully, then `t' is returned, and otherwise `nil' (unless an error is raised). If OTHER-WINDOW is non-nil, then another window is used to display the target position." (let (source-pos source-window source-buffer source-file-name target) (cond ((eventp link) (let ((pn (event-end link))) (when (not (posn-area pn)) (setq source-pos (posn-point pn)) (setq source-window (posn-window pn)) (setq source-buffer (window-buffer source-window))))) ((integerp link) (setq source-pos link) (setq source-window (selected-window)) (setq source-buffer (current-buffer))) (t (error "Not an integer or event object: %S" link))) (when (and source-pos source-buffer) (with-current-buffer source-buffer (setq source-file-name buffer-file-name) (setq target (get-text-property source-pos 'annotation-goto))) (when target (unless (equal source-window (selected-window)) (select-window source-window)) (when (annotation-goto target other-window) (unless (and (equal source-buffer (current-buffer)) (eq source-pos (point))) (push `(,source-file-name . ,source-pos) annotation-goto-stack)) t))))) (defun annotation-go-back nil "Go back to the previous position in which `annotation-goto' was successfully invoked." (when annotation-goto-stack (let ((pos (pop annotation-goto-stack))) (annotation-goto pos)))) (defun annotation-goto (filepos &optional other-window) "Go to file position FILEPOS if the file is readable. FILEPOS should have the form (FILE . POS). Return t if successful. If OTHER-WINDOW is non-nil, use another window to display the given position." (when (consp filepos) (let ((file (car filepos))) (if (file-readable-p file) (progn (if other-window (find-file-other-window file) (find-file file)) (goto-char (+ (cdr filepos) annotations-offset)) t) (error "File does not exist or is unreadable: %s." file))))) (defun annotation-annotate (start end anns &optional info goto) "Annotate text between START and END in the current buffer. Nothing happens if either START or END are out of bounds for the current (possibly narrowed) buffer, or END <= START. If ANNS is nil, then those text properties between START and END that have been set by this function are deleted. Otherwise the following happens. All the symbols in ANNS are looked up in `annotation-bindings', and the font-lock-face text property for the given character range is set to the resulting list of faces. If the string INFO is non-nil, the mouse-face property is set to highlight, and INFO is used as the help-echo string. If GOTO has the form (FILENAME . POSITION), then the mouse-face property is set to highlight, and the given filename/position will be used by `annotation-goto-indirect' when it is invoked with a position in the given range. Note that if a given attribute is defined by several faces, then the first face's setting takes precedence. All characters whose text properties get set also have the annotation-annotated property set to t, and annotation-annotations is set to a list with all the properties that have been set; this ensures that the text properties can later be removed (if the annotation-* properties are not tampered with)." (incf start annotations-offset) (incf end annotations-offset) (when (and (<= (point-min) start) (< start end) (<= end (point-max))) (if (null anns) (annotation-remove-annotations start end) (let ((faces (delq nil (mapcar (lambda (ann) (cdr (assoc ann annotation-bindings))) anns))) (props nil)) (when faces (put-text-property start end 'font-lock-face faces) (add-to-list 'props 'font-lock-face)) (when (consp goto) (add-text-properties start end `(annotation-goto ,goto mouse-face highlight)) (add-to-list 'props 'annotation-goto) (add-to-list 'props 'mouse-face)) (when info (add-text-properties start end `(mouse-face highlight help-echo ,info)) (add-to-list 'props 'mouse-face) (add-to-list 'props 'help-echo)) (when props (let ((pos start) mid) (while (< pos end) (setq mid (next-single-property-change pos 'annotation-annotations nil end)) (let* ((old-props (get-text-property pos 'annotation-annotations)) (all-props (union old-props props))) (add-text-properties pos mid `(annotation-annotated t annotation-annotations ,all-props)) (setq pos mid))))))))) (defmacro annotation-preserve-mod-p-and-undo (&rest code) "Run CODE preserving both the undo data and the modification bit. Modification hooks are also disabled." (let ((modp (make-symbol "modp"))) `(let ((,modp (buffer-modified-p)) ;; Don't check if the file is being modified by some other process. (buffer-file-name nil) ;; Don't record those changes on the undo-log. (buffer-undo-list t) ;; Don't run modification hooks. (inhibit-modification-hooks t)) (unwind-protect (progn ,@code) (restore-buffer-modified-p ,modp))))) (defun annotation-remove-annotations (&optional start end) "Remove all text properties set by `annotation-annotate'. In the current buffer. If START and END are given, then properties are only removed between these positions. This function preserves the file modification stamp of the current buffer, does not modify the undo list, and temporarily disables all modification hooks. Note: This function may fail if there is read-only text in the buffer." ;; remove-text-properties fails for read-only text. (annotation-preserve-mod-p-and-undo (let ((pos (or start (point-min))) pos2) (while pos (setq pos2 (next-single-property-change pos 'annotation-annotated nil end)) (let ((props (get-text-property pos 'annotation-annotations))) (when props (remove-text-properties pos (or pos2 (point-max)) (mapcan (lambda (prop) (list prop nil)) (append '(annotation-annotated annotation-annotations) props))))) (setq pos (unless (equal pos2 end) pos2)))))) (defun annotation-load (goto-help &rest cmds) "Apply highlighting annotations in CMDS in the current buffer. The argument CMDS should be a list of lists (start end anns &optional info goto). Text between start and end will be annotated with the annotations in the list anns (using `annotation-annotate'). If info and/or goto are present they will be used as the corresponding arguments to `annotation-annotate'. If INFO is nil in a call to `annotation-annotate', and the GOTO argument is a cons-cell, then the INFO argument is set to GOTO-HELP. The intention is that the default help text should inform the user about the \"goto\" facility. This function preserves the file modification stamp of the current buffer, does not modify the undo list, and temporarily disables all modification hooks. Note: This function may fail if there is read-only text in the buffer." (annotation-preserve-mod-p-and-undo (when (listp cmds) (dolist (cmd cmds) (destructuring-bind (start end anns &optional info goto) cmd (let ((info (if (and (not info) (consp goto)) goto-help info))) (annotation-annotate start end anns info goto))))))) (provide 'annotation) ;;; annotation.el ends here Agda-2.4.2.5/src/data/emacs-mode/agda2-queue.el0000644000000000000000000000264712635075266017065 0ustar0000000000000000;;; agda2-queue.el --- Simple FIFO character queues. (defun agda2-queue-empty () "Creates a new empty FIFO character queue. Queues are represented as pairs. The car contains the queue. If the queue is empty, then the cdr contains the symbol nil, and otherwise it points to the queue's last cons-cell." (cons nil nil)) (defun agda2-queue-is-prefix-of (prefix queue) "Returns a non-nil result iff the string PREFIX is a prefix of QUEUE. Linear in the length of PREFIX." (let ((queue (car queue)) (prefix (append prefix nil))) (while (and (consp queue) (consp prefix) (equal (car queue) (car prefix))) (pop queue) (pop prefix)) (null prefix))) (defun agda2-queue-enqueue (queue string) "Adds the characters in STRING to the end of QUEUE. This function updates QUEUE destructively, and is linear in the length of STRING." (let ((chars (append string nil))) (when (consp chars) (if (null (cdr queue)) (setcar queue chars) (setcdr (cdr queue) chars)) (setcdr queue (last chars)))) queue) (defun agda2-queue-from-string (string) "Creates a new FIFO containing the characters in STRING. Linear in the length of STRING." (agda2-queue-enqueue (agda2-queue-empty) string)) (defun agda2-queue-to-string (queue) "Constructs a string containing all the characters in QUEUE. Linear in the length of QUEUE." (concat "" (car queue))) (provide 'agda2-queue) Agda-2.4.2.5/src/data/emacs-mode/agda2-mode.el0000644000000000000000000020544612635075266016667 0ustar0000000000000000;;; agda2-mode.el --- Major mode for Agda ;;; Commentary: ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;; Dependency ;;; Code: (defvar agda2-version "2.4.2.5" "The version of the Agda mode. Note that the same version of the Agda executable must be used.") (require 'cl) (require 'compile) (require 'pp) (require 'time-date) (require 'eri) (require 'annotation) (require 'fontset) (require 'agda-input) (require 'agda2) (require 'agda2-highlight) (require 'agda2-abbrevs) (require 'agda2-queue) (eval-and-compile ;; Load filladapt, if it is installed. (condition-case nil (require 'filladapt) (error nil)) (unless (fboundp 'overlays-in) (load "overlay")) ; for Xemacs (unless (fboundp 'propertize) ; for Xemacs 21.4 ;; FIXME: XEmacs-21.4 (patch 22) does have `propertize' and so does Emacs-22 ;; (and agda2-mode doesn't work in Emacs-21, AFAICT). (defun propertize (string &rest properties) "Return a copy of STRING with text properties added. First argument is the string to copy. Remaining arguments form a sequence of PROPERTY VALUE pairs for text properties to add to the result." (let ((str (copy-sequence string))) (add-text-properties 0 (length str) properties str) str))) (unless (fboundp 'prog-mode) ;For Emacs<24. (defalias 'prog-mode 'fundamental-mode))) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;; Utilities (defmacro agda2-let (varbind funcbind &rest body) "Expands to (let* VARBIND (cl-labels FUNCBIND BODY...)). Or possibly (let* VARBIND (labels FUNCBIND BODY...))." (declare (debug ((&rest [&or symbolp (symbolp form)]) (&rest (cl-defun)) body)) (indent 2)) ;; Use cl-labels if available to avoid obsolescence warnings. `(let* ,varbind (,(if (fboundp 'cl-labels) 'cl-labels 'labels) ,funcbind ,@body))) (defun agda2-chunkify (n xs) "Returns a list containing chunks of XS of length at most N. All the elements of XS are included, in their original order." (let ((i 0) (len (length xs)) out) (while (< i len) (let ((new-i (+ i (min n (- len i))))) (setq out (cons (subseq xs i new-i) out)) (setq i new-i))) (nreverse out))) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;; User options (defgroup agda2 nil "Major mode for interactively developing Agda programs." :group 'languages) (defcustom agda2-include-dirs '(".") "The directories Agda uses to search for files. The directory names should either be absolute or be relative to the root of the current project." :type '(repeat directory) :group 'agda2) (defcustom agda2-program-name "agda" "The name of the Agda executable." :type 'string :group 'agda2) (defcustom agda2-program-args nil "Command-line arguments given to the Agda executable (one per string). Note: Do not give several arguments in the same string. The flag \"--interaction\" is always included as the first argument, and does not need to be listed here." :type '(repeat string) :group 'agda2) (defcustom agda2-backend "MAlonzo" "The backend which is used to compile Agda programs." :type '(choice (const "MAlonzo") (const "MAlonzoNoMain") (const "Epic") (const "JS")) :group 'agda2) (defcustom agda2-toplevel-module "Agda.Interaction.GhciTop" "The name of the Agda toplevel module." :type 'string :group 'agda2) (defcustom agda2-information-window-max-height 0.35 "The maximum height of the information window. A multiple of the frame height." :type 'number :group 'agda2) (defcustom agda2-fontset-name (unless (or (eq window-system 'mac) ;; Emacs-23 uses a revamped font engine which should ;; make agda2-fontset-name unnecessary in most cases. ;; And if it turns out to be necessary, we should ;; probably use face-remapping-alist rather than ;; set-frame-font so the special font only applies to ;; Agda buffers, and so it applies in all frames where ;; Agda buffers are displayed. (boundp 'face-remapping-alist)) "fontset-agda2") "Default font to use in the selected frame when activating the Agda mode. This is only used if it's non-nil and Emacs is not running in a terminal. Note that this setting (if non-nil) affects non-Agda buffers as well, and that you have to restart Emacs if you want settings to this variable to take effect." :type '(choice (string :tag "Fontset name") (const :tag "Do not change the font" nil)) :group 'agda2) (defcustom agda2-fontset-spec-of-fontset-agda2 "-*-fixed-Medium-r-Normal-*-18-*-*-*-c-*-fontset-agda2, ascii:-Misc-Fixed-Medium-R-Normal--18-120-100-100-C-90-ISO8859-1, latin-iso8859-2:-*-Fixed-*-r-*-*-18-*-*-*-c-*-iso8859-2, latin-iso8859-3:-*-Fixed-*-r-*-*-18-*-*-*-c-*-iso8859-3, latin-iso8859-4:-*-Fixed-*-r-*-*-18-*-*-*-c-*-iso8859-4, cyrillic-iso8859-5:-*-Fixed-*-r-*-*-18-*-*-*-c-*-iso8859-5, greek-iso8859-7:-*-Fixed-*-r-*-*-18-*-*-*-c-*-iso8859-7, latin-iso8859-9:-*-Fixed-*-r-*-*-18-*-*-*-c-*-iso8859-9, mule-unicode-0100-24ff:-Misc-Fixed-Medium-R-Normal--18-120-100-100-C-90-ISO10646-1, mule-unicode-2500-33ff:-Misc-Fixed-Medium-R-Normal--18-120-100-100-C-90-ISO10646-1, mule-unicode-e000-ffff:-Misc-Fixed-Medium-R-Normal--18-120-100-100-C-90-ISO10646-1, japanese-jisx0208:-Misc-Fixed-Medium-R-Normal-ja-18-*-*-*-C-*-JISX0208.1990-0, japanese-jisx0212:-Misc-Fixed-Medium-R-Normal-ja-18-*-*-*-C-*-JISX0212.1990-0, thai-tis620:-Misc-Fixed-Medium-R-Normal--24-240-72-72-C-120-TIS620.2529-1, lao:-Misc-Fixed-Medium-R-Normal--24-240-72-72-C-120-MuleLao-1, tibetan:-TibMdXA-fixed-medium-r-normal--16-160-72-72-m-160-MuleTibetan-0, tibetan-1-column:-TibMdXA-fixed-medium-r-normal--16-160-72-72-m-80-MuleTibetan-1, korean-ksc5601:-Daewoo-Mincho-Medium-R-Normal--16-120-100-100-C-160-KSC5601.1987-0, chinese-gb2312:-ISAS-Fangsong ti-Medium-R-Normal--16-160-72-72-c-160-GB2312.1980-0, chinese-cns11643-1:-HKU-Fixed-Medium-R-Normal--16-160-72-72-C-160-CNS11643.1992.1-0, chinese-big5-1:-ETen-Fixed-Medium-R-Normal--16-150-75-75-C-160-Big5.ETen-0, chinese-big5-2:-ETen-Fixed-Medium-R-Normal--16-150-75-75-C-160-Big5.ETen-0" "Specification of the \"fontset-agda2\" fontset. This fontset is only created if `agda2-fontset-name' is \"fontset-agda2\" and Emacs is not run in a terminal. Note that the text \"fontset-agda2\" has to be part of the string (in a certain way; see the default setting) in order for the agda2 fontset to be created properly. Note also that the default setting may not work unless suitable fonts are installed on your system. Refer to the README file accompanying the Agda distribution for more details. Note finally that you have to restart Emacs if you want settings to this variable to take effect." :group 'agda2 :type 'string) (if (and (equal agda2-fontset-name "fontset-agda2") window-system) (create-fontset-from-fontset-spec agda2-fontset-spec-of-fontset-agda2 t t)) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;; Global and buffer-local vars, initialization (defvar agda2-mode-syntax-table (let ((tbl (make-syntax-table))) ;; Set the syntax of every char to "w" except for those whose default ;; syntax in `standard-syntax-table' is `paren' or `whitespace'. (map-char-table (lambda (keys val) ;; `keys' here can be a normal char, a generic char ;; (Emacs<23), or a char range (Emacs>=23). (unless (memq (car val) (eval-when-compile (mapcar 'car (list (string-to-syntax "(") (string-to-syntax ")") (string-to-syntax " "))))) (modify-syntax-entry keys "w" tbl))) (standard-syntax-table)) ;; Then override the remaining special cases. (dolist (cs '((?{ . "(}1n") (?} . "){4n") (?- . "w 123b") (?\n . "> b") (?. . ".") (?\; . ".") (?_ . ".") (?! . "."))) (modify-syntax-entry (car cs) (cdr cs) tbl)) tbl) "Syntax table used by the Agda mode: {} | Comment characters, matching parentheses. - | Comment character, word constituent. \n | Comment ender. .;_! | Punctuation. Remaining characters inherit their syntax classes from the standard syntax table if that table treats them as matching parentheses or whitespace. Otherwise they are treated as word constituents.") (defconst agda2-command-table `( (agda2-load "\C-c\C-l" (global) "Load") (agda2-load "\C-c\C-x\C-l") (agda2-compile "\C-c\C-x\C-c" (global) "Compile") (agda2-quit "\C-c\C-x\C-q" (global) "Quit") (agda2-restart "\C-c\C-x\C-r" (global) "Kill and restart Agda") (agda2-remove-annotations "\C-c\C-x\C-d" (global) "Remove goals and highlighting (\"deactivate\")") (agda2-display-implicit-arguments "\C-c\C-x\C-h" (global) "Toggle display of hidden arguments") (agda2-show-constraints ,(kbd "C-c C-=") (global) "Show constraints") (agda2-solveAll ,(kbd "C-c C-s") (global) "Solve constraints") (agda2-show-goals ,(kbd "C-c C-?") (global) "Show goals") (agda2-next-goal "\C-c\C-f" (global) "Next goal") ; Forward. (agda2-previous-goal "\C-c\C-b" (global) "Previous goal") ; Back. (agda2-give ,(kbd "C-c C-SPC") (local) "Give") (agda2-refine "\C-c\C-r" (local) "Refine") (agda2-auto "\C-c\C-a" (local) "Auto") (agda2-make-case "\C-c\C-c" (local) "Case") (agda2-goal-type "\C-c\C-t" (local) "Goal type") (agda2-show-context "\C-c\C-e" (local) "Context (environment)") (agda2-helper-function-type "\C-c\C-h" (local) "Helper function type") (agda2-infer-type-maybe-toplevel "\C-c\C-d" (local global) "Infer (deduce) type") (agda2-why-in-scope-maybe-toplevel "\C-c\C-w" (local global) "Explain why a particular name is in scope") (agda2-goal-and-context ,(kbd "C-c C-,") (local) "Goal type and context") (agda2-goal-and-context-and-inferred ,(kbd "C-c C-.") (local) "Goal type, context and inferred type") (agda2-module-contents-maybe-toplevel ,(kbd "C-c C-o") (local global) "Module contents") (agda2-compute-normalised-maybe-toplevel "\C-c\C-n" (local global) "Evaluate term to normal form") (describe-char nil (global) "Information about the character at point") (agda2-comment-dwim-rest-of-buffer ,(kbd "C-c C-x M-;") (global) "Comment/uncomment the rest of the buffer") (agda2-display-program-version nil (global) "Version") (agda2-set-program-version nil (global) "Switch to another version of Agda") (eri-indent ,(kbd "TAB")) (eri-indent-reverse [S-iso-lefttab]) (eri-indent-reverse [S-lefttab]) (eri-indent-reverse [S-tab]) (agda2-goto-definition-mouse [mouse-2]) (agda2-goto-definition-keyboard "\M-.") (agda2-go-back "\M-*") ) "Table of commands, used to build keymaps and menus. Each element has the form (CMD &optional KEYS WHERE DESC) where CMD is a command; KEYS is its key binding (if any); WHERE is a list which should contain 'local if the command should exist in the goal menu and 'global if the command should exist in the main menu; and DESC is the description of the command used in the menus.") (defvar agda2-mode-map (let ((map (make-sparse-keymap "Agda mode"))) (define-key map [menu-bar Agda] (cons "Agda" (make-sparse-keymap "Agda"))) (define-key map [down-mouse-3] 'agda2-popup-menu-3) (dolist (d (reverse agda2-command-table)) (destructuring-bind (f &optional keys kinds desc) d (if keys (define-key map keys f)) (if (member 'global kinds) (define-key map (vector 'menu-bar 'Agda (intern desc)) (cons desc f))))) map) "Keymap for `agda2-mode'.") (defvar agda2-goal-map (let ((map (make-sparse-keymap "Agda goal"))) (dolist (d (reverse agda2-command-table)) (destructuring-bind (f &optional keys kinds desc) d (if (member 'local kinds) (define-key map (vector (intern desc)) (cons desc f))))) map) "Keymap for agda2 goal menu.") (defvar agda2-info-buffer nil "Agda information buffer.") (defvar agda2-process-buffer nil "Agda subprocess buffer. Set in `agda2-restart'.") (defvar agda2-process nil "Agda subprocess. Set in `agda2-restart'.") (defvar agda2-in-progress nil "Is the Agda process currently busy?") ;; Some buffer locals (defvar agda2-buffer-external-status "" "External status of an `agda2-mode' buffer (dictated by the Haskell side).") (make-variable-buffer-local 'agda2-buffer-external-status) (defvar agda2-output-prompt "Agda2> " "The Agda2 buffer's prompt.") (defconst agda2-help-address "" "Address accepting submissions of bug reports and questions.") ;; Annotation for a goal ;; {! .... !} ;; ---------- overlay: agda2-gn num, face highlight, after-string num, ;; modification-hooks (agda2-protect-goal-markers) ;; - text-props: category agda2-delim1 ;; - text-props: category agda2-delim2 ;; - text-props: category agda2-delim3 ;; - text-props: category agda2-delim4 ;; ;; Char categories for {! ... !} (defvar agda2-open-brace "{") (defvar agda2-close-brace " }") (setplist 'agda2-delim1 `(display ,agda2-open-brace)) (setplist 'agda2-delim2 `(display ,agda2-open-brace rear-nonsticky t agda2-delim2 t)) (setplist 'agda2-delim3 `(display ,agda2-close-brace agda2-delim3 t)) (setplist 'agda2-delim4 `(display ,agda2-close-brace rear-nonsticky t)) ;; Note that strings used with the display property are compared by ;; reference. If the agda2-*-brace definitions were inlined, then ;; goals would be displayed as "{{ }}n" instead of "{ }n". (defvar agda2-measure-data nil "Used by `agda2-measure-load-time'. This value is either nil or a pair containing a continuation (or nil) and the time at which the measurement was started.") (make-variable-buffer-local 'agda2-measure-data) ;; The following variables are used by the filter process, ;; `agda2-output-filter'. Their values are only modified by the filter ;; process, `agda2-go', `agda2-restart', and ;; `agda2-abort-highlighting'. (defvar agda2-responses-expected nil "Is the Agda process expected to produce at least one response?") (make-variable-buffer-local 'agda2-responses-expected) (defvar agda2-responses 0 "The number of encountered response commands.") (make-variable-buffer-local 'agda2-responses) (defvar agda2-output-chunk-incomplete (agda2-queue-empty) "Buffer for incomplete lines. \(See `agda2-output-filter'.)") (make-variable-buffer-local 'agda2-output-chunk-incomplete) (defvar agda2-last-responses nil "Response commands which should be run after other commands. The command which arrived last is stored first in the list.") (make-variable-buffer-local 'agda2-last-responses) (defvar agda2-file-buffer nil "The Agda buffer. Note that this variable is not buffer-local.") ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;; agda2-mode ;;;###autoload (add-to-list 'auto-mode-alist '("\\.l?agda\\'" . agda2-mode)) ;;;###autoload (modify-coding-system-alist 'file "\\.l?agda\\'" 'utf-8) ;;;###autoload (define-derived-mode agda2-mode prog-mode "Agda" "Major mode for Agda files. The following paragraph does not apply to Emacs 23 or newer. Note that when this mode is activated the default font of the current frame is changed to the fontset `agda2-fontset-name'. The reason is that Agda programs often use mathematical symbols and other Unicode characters, so we try to provide a suitable default font setting, which can display many of the characters encountered. If you prefer to use your own settings, set `agda2-fontset-name' to nil. Special commands: \\{agda2-mode-map}" ;; Check that the right version of Agda is used. (let* ((coding-system-for-read 'utf-8) (output (with-output-to-string (call-process agda2-program-name nil standard-output nil "--version"))) (version (and (string-match "^Agda version \\([0-9.]+\\)$" output) (match-string 1 output)))) (unless (equal version agda2-version) (error "The Agda mode's version (%s) does not match that of %s (%s)." agda2-version agda2-program-name (or version "unknown")))) (setq local-abbrev-table agda2-mode-abbrev-table indent-tabs-mode nil mode-line-process '((:eval (unless (eq 0 (length agda2-buffer-external-status)) (concat ":" agda2-buffer-external-status))))) (let ((l '(max-specpdl-size 2600 max-lisp-eval-depth 2800))) (while l (set (make-local-variable (pop l)) (pop l)))) (if (and window-system agda2-fontset-name) (condition-case nil (set-frame-font agda2-fontset-name) (error (error "Unable to change the font; change agda2-fontset-name or tweak agda2-fontset-spec-of-fontset-agda2")))) ;; Deactivate highlighting if the buffer is edited before ;; typechecking is complete. (add-hook 'first-change-hook 'agda2-abort-highlighting nil 'local) ;; If Agda is not running syntax highlighting does not work properly. (unless (eq 'run (agda2-process-status)) (agda2-restart)) (agda2-highlight-setup) (condition-case err (agda2-highlight-reload) (error (message "Highlighting not loaded: %s" (error-message-string err)))) (agda2-comments-and-paragraphs-setup) (force-mode-line-update) ;; Protect global value of default-input-method from set-input-method. (make-local-variable 'default-input-method) (set-input-method "Agda") ;; Highlighting etc. is removed when we switch from the Agda mode. ;; Use case: When a file M.lagda with a local variables list ;; including "mode: latex" is loaded chances are that the Agda mode ;; is activated before the LaTeX mode, and the LaTeX mode does not ;; seem to remove the text properties set by the Agda mode. (add-hook 'change-major-mode-hook 'agda2-quit nil 'local)) (defun agda2-restart () "Kill and restart the *agda2* buffer and load `agda2-toplevel-module'." (interactive) (save-excursion (let ((agda2-bufname "*agda2*")) (condition-case nil (agda2-term) (error nil)) ;; Start the Agda2 process in a new buffer. (message "Starting agda process `%s'." agda2-program-name) (let ((process-connection-type nil)) ; pipes are faster than PTYs (apply 'start-process "Agda2" agda2-bufname agda2-program-name (cons "--interaction" agda2-program-args))) ;; Select agda buffer temporarily. (with-current-buffer agda2-bufname (setq process-adaptive-read-buffering t) ;; Clear message area. (message "") (setq agda2-process (get-buffer-process agda2-bufname) agda2-process-buffer (process-buffer agda2-process) agda2-in-progress nil mode-name "Agda executable" agda2-last-responses nil) (set-buffer-file-coding-system 'utf-8) (set-buffer-process-coding-system 'utf-8 'utf-8) (set-process-query-on-exit-flag agda2-process nil)))) (setq agda2-file-buffer (current-buffer)) (set-process-filter agda2-process 'agda2-output-filter) (agda2-remove-annotations)) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;; Communicating with Agda (defun agda2-raise-error () "Raises an error. The error message directs the user to the *agda2* buffer." (error "Problem encountered. The *agda2* buffer can perhaps explain why.")) (defun agda2-running-p nil "Does the *agda2* buffer exist, and is the Agda2 process running?" (and (buffer-live-p agda2-process-buffer) (eq (agda2-process-status) 'run))) (defun agda2-send-command (restart &rest args) "Send a command to the Agda2 asyncronous process. Saves the buffer and sends the list of strings ARGS to Agda2. If RESTART is non-nil and the Agda2 process is not running, or the *agda2* buffer does not exist, then an attempt is made to restart the process." (save-buffer) (when (and restart (not (agda2-running-p))) ;; Try restarting automatically, but only once, in case there is ;; some major problem. (agda2-restart) (unless (agda2-running-p) (agda2-raise-error))) (let ((command (apply 'concat (agda2-intersperse " " args)))) (with-current-buffer agda2-process-buffer (goto-char (point-max)) (insert command) (insert "\n") (process-send-string agda2-process (concat command "\n"))))) (defun agda2-abort-if-in-progress () "Raise an error if the Agda process is (thought to be) busy." (when agda2-in-progress (error "Another command is currently in progress \(if a command has been aborted you may want to restart Agda)"))) (defun agda2-go (responses-expected highlight do-abort &rest args) "Executes commands in the Agda2 interpreter. Sends the list of strings ARGS to the Agda2 interpreter, waits for output and executes the responses, if any. If no responses are received, and RESPONSES-EXPECTED is non-nil, then an error is raised. If HIGHLIGHT is non-nil, then the buffer's syntax highlighting may be updated." (if do-abort (agda2-abort-if-in-progress)) (setq agda2-in-progress t agda2-highlight-in-progress highlight agda2-responses-expected responses-expected agda2-responses 0 agda2-output-chunk-incomplete (agda2-queue-empty) agda2-file-buffer (current-buffer)) (apply 'agda2-send-command 'restart "IOTCM" (agda2-string-quote (buffer-file-name)) (if highlight (agda2-highlight-level) "None") "Indirect" "(" (append args '(")")))) (defun agda2-output-filter (proc chunk) "Evaluate the Agda process's commands. This filter function assumes that every line contains either some kind of error message (which cannot be parsed as a list), or exactly one command. Incomplete lines are stored in a buffer (`agda2-output-chunk-incomplete'). Every command is run by this function, unless it has the form \"(('last . priority) . cmd)\", in which case it is run by `agda2-run-last-commands' at the end, after the Agda2 prompt has reappeared, after all non-last commands, and after all interactive highlighting is complete. The last commands can have different integer priorities; those with the lowest priority are executed first. Non-last commands should not call the Agda process. All commands are echoed to the *agda2* buffer, with the exception of commands of the form \"(agda2-highlight-... ...)\". The non-last commands are run in the order in which they appear. When the prompt has been reached an error is raised if `agda2-responses-expected' is non-nil and no commands have arrived. Otherwise highlighting annotations are reloaded from `agda2-highlighting-file', unless `agda2-highlighting-in-progress' is nil." ;; Beware: the buffer may have been killed in the mean time. E.g. when ;; viewing an attachment containing Agda code in Gnus, Gnus will ;; create a temp buffer, set it in agda2-mode, call font-lock-ensure on it ;; (which won't know that it needs to wait for some process to reply), then ;; extract the fontified text and kill the temp buffer; so when Agda ;; finally answers, the temp buffer is long gone. (when (buffer-live-p agda2-file-buffer) (let (;; The input lines in the current chunk. (lines (split-string chunk "\n")) ;; Non-last commands found in the current chunk (reversed). (non-last-commands ()) ;; Last incomplete line, if any. (output-chunk-incomplete "")) (with-current-buffer agda2-file-buffer (when (consp lines) (agda2-queue-enqueue agda2-output-chunk-incomplete (pop lines)) (when (consp lines) ;; The previous uncomplete chunk is now complete. (push (agda2-queue-to-string agda2-output-chunk-incomplete) lines) ;; Stash away the last incomplete line, if any. (Note that ;; (split-string "...\n" "\n") evaluates to (... "").) (setq output-chunk-incomplete (car (last lines)) agda2-output-chunk-incomplete (agda2-queue-from-string output-chunk-incomplete)) ;; Handle every complete line. (dolist (line (butlast lines)) (let* (;; The command. Lines which cannot be parsed as a single ;; list, without any junk, are ignored. (cmd (condition-case nil (let ((result (read-from-string line))) (if (and (listp (car result)) (= (cdr result) (length line))) (car result))) (error nil)))) (when cmd (unless (and (symbolp (car cmd)) (let ((case-fold-search nil)) (string-match "^agda2-highlight-" (symbol-name (car cmd))))) ;; Do not echo highlighting commands. (with-current-buffer agda2-process-buffer (save-excursion (goto-char (point-max)) (insert line) (insert "\n"))) (incf agda2-responses)) (if (equal 'last (car-safe (car cmd))) (push (cons (cdr (car cmd)) (cdr cmd)) agda2-last-responses) (push cmd non-last-commands))))) ;; Run non-last commands. (mapc 'agda2-exec-response (nreverse non-last-commands))) ;; Check if the prompt has been reached. This function assumes ;; that the prompt does not include any newline characters. (when (agda2-queue-is-prefix-of agda2-output-prompt agda2-output-chunk-incomplete) (with-current-buffer agda2-process-buffer (insert output-chunk-incomplete)) (setq agda2-output-chunk-incomplete (agda2-queue-empty) agda2-in-progress nil agda2-last-responses (nreverse agda2-last-responses)) (when (and agda2-responses-expected (equal agda2-responses 0)) (agda2-raise-error)) (agda2-run-last-commands) (when agda2-measure-data (let ((elapsed (format "%.2fs" (float-time (time-since (cdr agda2-measure-data))))) (continuation (car agda2-measure-data))) (setq agda2-measure-data nil) (message "Load time: %s." elapsed) (when continuation (funcall continuation elapsed)))))))))) (defun agda2-run-last-commands nil "Execute the last commands in the right order. \(After the prompt has reappeared.) See `agda2-output-filter'." ;; with-current-buffer is used repeatedly below, because some last ;; commands may switch the focus to another buffer. (while (with-current-buffer agda2-file-buffer (and (not agda2-in-progress) (consp agda2-last-responses))) (with-current-buffer agda2-file-buffer ;; The list is sorted repeatedly because this function may be ;; called recursively (via `agda2-exec-response'). (setq agda2-last-responses (sort agda2-last-responses (lambda (x y) (<= (car x) (car y))))) (let ((r (pop agda2-last-responses))) (agda2-exec-response (cdr r))))) ;; Unset agda2-highlight-in-progress when all the asynchronous ;; commands have terminated. (unless agda2-in-progress (setq agda2-highlight-in-progress nil))) (defun agda2-abort-highlighting nil "Abort any interactive highlighting. This function should be used in `first-change-hook'." (when agda2-highlight-in-progress (setq agda2-highlight-in-progress nil) (message "\"%s\" has been modified. Interrupting highlighting." (buffer-name (current-buffer))))) (defun agda2-goal-cmd (cmd &optional want ask &rest args) "Reads input from goal or minibuffer and sends command to Agda. An error is raised if point is not in a goal. The command sent to Agda is CMD ARGS. The user input is computed as follows: * If WANT is nil, then the user input is the empty string. * If WANT is a string, and either ASK is non-nil or the goal only contains whitespace, then the input is taken from the minibuffer. In this case WANT is used as the prompt string. * Otherwise (including if WANT is 'goal) the goal contents are used. If the user input is not taken from the goal, then an empty goal range is given. An error is raised if no responses are received." (multiple-value-bind (o g) (agda2-goal-at (point)) (unless g (error "For this command, please place the cursor in a goal")) (let ((txt (buffer-substring-no-properties (+ (overlay-start o) 2) (- (overlay-end o) 2))) (input-from-goal nil)) (cond ((null want) (setq txt "")) ((and (stringp want) (or ask (string-match "\\`\\s *\\'" txt))) (setq txt (read-string (concat want ": ") nil nil txt t))) (t (setq input-from-goal t))) (apply 'agda2-go t t t cmd (format "%d" g) (if input-from-goal (agda2-goal-Range o) "noRange") (agda2-string-quote txt) args)))) ;; Note that the following function is a security risk, since it ;; evaluates code without first inspecting it. The code (supposedly) ;; comes from the Agda backend, but there could be bugs in the backend ;; which can be exploited by an attacker which manages to trick ;; someone into type-checking compromised Agda code. (defun agda2-exec-response (response) "Interprets response." (let ((inhibit-read-only t)) (eval response))) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;; User commands and response processing (defun agda2-load () "Load current buffer." (interactive) (agda2-go t t t "Cmd_load" (agda2-string-quote (buffer-file-name)) (agda2-list-quote agda2-include-dirs) )) (defun agda2-measure-load-time (&optional highlighting-level dont-touch continuation) "Load the current buffer and print how much time it takes. \(Wall-clock time.) The given HIGHLIGHTING-LEVEL is used (if non-nil). The file is first saved and \"touched\", unless DONT-TOUCH is non-nil. If CONTINUATION is non-nil, then CONTINUATION is applied to the resulting time (represented as a string)." (interactive) (agda2-abort-if-in-progress) (unless dont-touch (save-buffer) (shell-command (concat "touch \"" (buffer-file-name) "\""))) (let* ((agda2-highlight-level (or highlighting-level agda2-highlight-level))) (setq agda2-measure-data (cons continuation (current-time))) (agda2-load))) (defun agda2-compile () "Compile the current module. The variable `agda2-backend' determines which backend is used." (interactive) (agda2-go t t t "Cmd_compile" agda2-backend (agda2-string-quote (buffer-file-name)) (agda2-list-quote agda2-include-dirs) )) (defun agda2-give() "Give to the goal at point the expression in it" (interactive) (agda2-goal-cmd "Cmd_give" "expression to give")) (defun agda2-give-action (old-g paren) "Update the goal OLD-G with the expression in it." (let ;; Don't run modification hooks: we don't want this to ;; trigger agda2-abort-highlighting. ((inhibit-modification-hooks t)) (agda2-update old-g paren))) (defun agda2-refine (pmlambda) "Refine the goal at point. If the goal contains an expression e, and some \"suffix\" of the type of e unifies with the goal type, then the goal is replaced by e applied to a suitable number of new goals. PMLAMBDA is only used if the goal has a functional type. When the prefix argument is given a pattern maching lambda will be inserted, otherwise a standard lambda will be used. If the goal is empty, the goal type is a data type, and there is exactly one constructor which unifies with this type, then the goal is replaced by the constructor applied to a suitable number of new goals." (interactive "P") (if pmlambda (agda2-goal-cmd "Cmd_refine_or_intro True" 'goal) (agda2-goal-cmd "Cmd_refine_or_intro False" 'goal))) (defun agda2-auto () "Simple proof search" (interactive) (agda2-goal-cmd "Cmd_auto" 'goal)) (defun agda2-make-case () "Refine the pattern variables given in the goal. Assumes that = {!!} is on one line." (interactive) (agda2-goal-cmd "Cmd_make_case" "pattern variables to case (empty for split on result)")) (defun agda2-make-case-action (newcls) "Replace the line at point with new clauses NEWCLS and reload." (agda2-forget-all-goals);; we reload later anyway. (let* ((p0 (point)) ;; (p1 (goto-char (agda2-decl-beginning))) (p1 (goto-char (+ (current-indentation) (line-beginning-position)))) (indent (current-column)) cl) (goto-char p0) (re-search-forward "!}" (line-end-position) 'noerr) (delete-region p1 (point)) (while (setq cl (pop newcls)) (insert cl) (if newcls (insert "\n" (make-string indent ? )))) (goto-char p1)) (agda2-load)) (defun agda2-make-case-action-extendlam (newcls) "Replace definition of extended lambda with new clauses NEWCLS and reload." (agda2-forget-all-goals);; we reload later anyway. (let* ((pmax (- (re-search-forward "\\([^!]}\\)\\|;") 1)) (bracketCount 0) cl) (re-search-backward "{!") (while (and (not (equal (preceding-char) ?\;)) (>= bracketCount 0)) (backward-char) (if (equal (preceding-char) ?}) (incf bracketCount)) (if (equal (preceding-char) ?{) (decf bracketCount))) (let ((p (point))) (delete-region (point) pmax) (insert " ") (while (setq cl (pop newcls)) (insert cl) (if newcls (insert " ; "))) (insert " ") (goto-char p))) (agda2-load)) (defun agda2-status-action (status) "Display the string STATUS in the current buffer's mode line. \(precondition: the current buffer has to use the Agda mode as the major mode)." (setq agda2-buffer-external-status status)) (defun agda2-info-buffer nil "Creates the Agda info buffer, if it does not already exist. The buffer is returned." (unless (buffer-live-p agda2-info-buffer) (setq agda2-info-buffer (generate-new-buffer "*Agda information*")) (with-current-buffer agda2-info-buffer (compilation-mode "AgdaInfo") ;; Support for jumping to positions mentioned in the text. (set (make-local-variable 'compilation-error-regexp-alist) '(("\\([\\\\/][^[:space:]]*\\):\\([0-9]+\\),\\([0-9]+\\)-\\(\\([0-9]+\\),\\)?\\([0-9]+\\)" 1 (2 . 5) (3 . 6)))) ;; No support for recompilation. The key binding is removed, and ;; attempts to run `recompile' will (hopefully) result in an ;; error. (let ((map (copy-keymap (current-local-map)))) (define-key map (kbd "g") 'undefined) (use-local-map map)) (set (make-local-variable 'compile-command) 'agda2-does-not-support-compilation-via-the-compilation-mode) (set-syntax-table agda2-mode-syntax-table) (set-input-method "Agda"))) agda2-info-buffer) (defun agda2-info-action (name text &optional append) "Insert TEXT into the Agda info buffer and display it. NAME is displayed in the buffer's mode line. If APPEND is non-nil, then TEXT is appended at the end of the buffer, and point placed after this text. If APPEND is nil, then any previous text is removed before TEXT is inserted, and point is placed before this text." (interactive) (with-current-buffer (agda2-info-buffer) ;; In some cases the jump-to-position-mentioned-in-text ;; functionality (see compilation-error-regexp-alist above) didn't ;; work: Emacs jumped to the wrong position. However, it seems to ;; work if compilation-forget-errors is used. This problem may be ;; related to Emacs bug #9679 ;; (http://debbugs.gnu.org/cgi/bugreport.cgi?bug=9679). The idea ;; to use compilation-forget-errors comes from a comment due to ;; Oleksandr Manzyuk ;; (https://github.com/haskell/haskell-mode/issues/67). (compilation-forget-errors) (unless append (erase-buffer)) (save-excursion (goto-char (point-max)) (insert text)) (put-text-property 0 (length name) 'face '(:weight bold) name) (setq mode-line-buffer-identification name) (save-selected-window (let (;; If there is only one window, then the info window ;; should be created above or below the code window, not ;; to the left or right. (split-width-threshold nil) (buf (current-buffer)) ) ;; Andreas, 2014-02-23, issue 1061 ;; If the buffer is already displayed in some window, ;; do not display it again. Also, do not raise its frame. ;; This allows undisturbed working on something else while ;; Agda is type-checking. ;; The solution is to query for the window displaying the buffer ;; via get-buffer-window. Only if it return nil, we pop-to-buffer. ;; Credits go to Iqbal Ansari who anwered my question on ;; http://stackoverflow.com/questions/21955162/emacs-how-to-display-a-buffer-without-switching-window-and-without-raising-fram ;; 2014-03-01 DISABLED FIX ;; (unless (get-buffer-window buf t) (pop-to-buffer buf nil 'norecord) (fit-window-to-buffer nil (truncate (* (frame-height) agda2-information-window-max-height))) ;; ) (if append (goto-char (point-max)) (goto-char (point-min))))))) (defun agda2-info-action-and-copy (name text &optional append) "Same as agda2-info-action but also puts TEXT in the kill ring." (kill-new text) (agda2-info-action name text append)) (defun agda2-show-goals() "Show all goals." (interactive) (agda2-go t t t "Cmd_metas")) (defun agda2-show-constraints() "Show constraints." (interactive) (agda2-go t t t "Cmd_constraints")) (defun agda2-remove-annotations () "Removes buffer annotations (overlays and text properties)." (interactive) (dolist (o (overlays-in (point-min) (point-max))) (delete-overlay o)) (let ((inhibit-read-only t)) (annotation-preserve-mod-p-and-undo (set-text-properties (point-min) (point-max) '())) (force-mode-line-update))) (defun agda2-next-goal () "Go to the next goal, if any." (interactive) (agda2-mv-goal 'next-single-property-change 'agda2-delim2 1 (point-min))) (defun agda2-previous-goal () "Go to the previous goal, if any." (interactive) (agda2-mv-goal 'previous-single-property-change 'agda2-delim3 0 (point-max))) (defun agda2-mv-goal (change delim adjust wrapped) (agda2-let () ((go (p) (while (and (setq p (funcall change p 'category)) (not (eq (get-text-property p 'category) delim)))) (if p (goto-char (+ adjust p))))) (or (go (point)) (go wrapped) (message "No goals in the buffer")))) (defun agda2-quit () "Quit and clean up after agda2." (interactive) (remove-hook 'first-change-hook 'agda2-abort-highlighting 'local) (agda2-remove-annotations) (agda2-term)) (defun agda2-term () "Send a SIGTERM signal to the Agda2 process, then kill its buffer." (interactive) (when (buffer-live-p agda2-process-buffer) (with-current-buffer agda2-process-buffer (condition-case nil (signal-process agda2-process 'SIGTERM) (error nil)) (kill-buffer)))) (defmacro agda2-maybe-normalised (name comment cmd want) "This macro constructs a function NAME which runs CMD. COMMENT is used to build the function's comment. The function NAME takes a prefix argument which tells whether it should normalise types or not when running CMD (through `agda2-goal-cmd'; WANT is used as `agda2-goal-cmd's WANT argument)." (let ((eval (make-symbol "eval"))) `(defun ,name (&optional prefix) ,(concat comment ". The form of the result depends on the prefix argument: * If the prefix argument is `nil' (i.e., if no prefix argument is given), then the result is simplified. * If the prefix argument is `(4)' (for instance if C-u is typed exactly once right before the command is invoked), then the result is neither explicitly normalised nor simplified. * If any other prefix argument is used (for instance if C-u is typed twice right before the command is invoked), then the result is normalised.") (interactive "P") (let ((,eval (cond ((equal prefix nil) "Simplified") ((equal prefix '(4)) "Instantiated") ("Normalised")))) (agda2-goal-cmd (concat ,cmd " " ,eval) ,want))))) (defmacro agda2-maybe-normalised-toplevel (name comment cmd prompt) "This macro constructs a function NAME which runs CMD. COMMENT is used to build the function's comments. The function NAME takes a prefix argument which tells whether it should normalise types or not when running CMD (through `agda2-go' t nil t; the string PROMPT is used as the goal command prompt)." (let ((eval (make-symbol "eval"))) `(defun ,name (prefix expr) ,(concat comment ". The form of the result depends on the prefix argument: * If the prefix argument is `nil' (i.e., if no prefix argument is given), then the result is simplified. * If the prefix argument is `(4)' (for instance if C-u is typed exactly once right before the command is invoked), then the result is neither explicitly normalised nor simplified. * If any other prefix argument is used (for instance if C-u is typed twice right before the command is invoked), then the result is normalised.") (interactive ,(concat "P\nM" prompt ": ")) (let ((,eval (cond ((equal prefix nil) "Simplified") ((equal prefix '(4)) "Instantiated") ("Normalised")))) (agda2-go t nil t (concat ,cmd " " ,eval " " (agda2-string-quote expr))))))) (agda2-maybe-normalised agda2-goal-type "Show the type of the goal at point" "Cmd_goal_type" nil) (agda2-maybe-normalised agda2-infer-type "Infer the type of the goal at point" "Cmd_infer" "expression to type") (agda2-maybe-normalised-toplevel agda2-infer-type-toplevel "Infers the type of the given expression. The scope used for the expression is that of the last point inside the current top-level module" "Cmd_infer_toplevel" "Expression") (defun agda2-infer-type-maybe-toplevel () "Infers the type of the given expression. Either uses the scope of the current goal or, if point is not in a goal, the top-level scope." (interactive) (call-interactively (if (agda2-goal-at (point)) 'agda2-infer-type 'agda2-infer-type-toplevel))) (defun agda2-why-in-scope () "Explain why something is in scope in a goal." (interactive) (agda2-goal-cmd "Cmd_why_in_scope" "Name")) (defun agda2-why-in-scope-toplevel (name) "Explain why something is in scope at the top level." (interactive "MName: ") (agda2-go t nil t "Cmd_why_in_scope_toplevel" (agda2-string-quote name))) (defun agda2-why-in-scope-maybe-toplevel () "Explains why a given name is in scope." (interactive) (call-interactively (if (agda2-goal-at (point)) 'agda2-why-in-scope 'agda2-why-in-scope-toplevel))) (agda2-maybe-normalised agda2-goal-and-context "Shows the type of the goal at point and the currect context" "Cmd_goal_type_context" nil) (agda2-maybe-normalised agda2-goal-and-context-and-inferred "Shows the context, the goal and the given expression's inferred type" "Cmd_goal_type_context_infer" "expression to type") (agda2-maybe-normalised agda2-show-context "Show the context of the goal at point" "Cmd_context" nil) (agda2-maybe-normalised agda2-helper-function-type "Compute the type of a hypothetical helper function." "Cmd_helper_function" "Expression") (agda2-maybe-normalised agda2-module-contents "Shows all the top-level names in the given module. Along with their types." "Cmd_show_module_contents" "Module name") (agda2-maybe-normalised-toplevel agda2-module-contents-toplevel "Shows all the top-level names in the given module. Along with their types." "Cmd_show_module_contents_toplevel" "Module name" ) (defun agda2-module-contents-maybe-toplevel () "Shows all the top-level names in the given module. Along with their types. Uses either the scope of the current goal or, if point is not in a goal, the top-level scope." (interactive) (call-interactively (if (agda2-goal-at (point)) 'agda2-module-contents 'agda2-module-contents-toplevel))) (defun agda2-solveAll () "Solves all goals that are already instantiated internally." (interactive) (agda2-go t t t "Cmd_solveAll")) (defun agda2-solveAll-action (iss) (while iss (let* ((g (pop iss)) (txt (pop iss)) (cmd (cons 'agda2-solve-action (cons g (cons txt nil))))) (if (null agda2-last-responses) (push (cons 1 cmd) agda2-last-responses) (nconc agda2-last-responses (cons (cons 3 cmd) nil)))))) (defun agda2-solve-action (g txt) (save-excursion (agda2-replace-goal g txt) (agda2-goto-goal g) (agda2-give))) (defun agda2-compute-normalised (&optional arg) "Compute the normal form of the expression in the goal at point. With a prefix argument \"abstract\" is ignored during the computation." (interactive "P") (let ((cmd (concat "Cmd_compute" (if arg " True" " False")))) (agda2-goal-cmd cmd "expression to normalise"))) (defun agda2-compute-normalised-toplevel (expr &optional arg) "Computes the normal form of the given expression. The scope used for the expression is that of the last point inside the current top-level module. With a prefix argument \"abstract\" is ignored during the computation." (interactive "MExpression: \nP") (let ((cmd (concat "Cmd_compute_toplevel" (if arg " True" " False") " "))) (agda2-go t nil t (concat cmd (agda2-string-quote expr))))) (defun agda2-compute-normalised-maybe-toplevel () "Computes the normal form of the given expression, using the scope of the current goal or, if point is not in a goal, the top-level scope. With a prefix argument \"abstract\" is ignored during the computation." (interactive) (if (agda2-goal-at (point)) (call-interactively 'agda2-compute-normalised) (call-interactively 'agda2-compute-normalised-toplevel))) (defun agda2-display-program-version () "Display version of Agda" (interactive) (agda2-go nil nil t "Cmd_show_version")) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;; (defun agda2-highlight-reload nil "Loads precomputed syntax highlighting info for the current buffer. If there is any to load." (agda2-go nil t t "Cmd_load_highlighting_info" (agda2-string-quote (buffer-file-name)))) (defun agda2-literate-p () "Is the current buffer a literate Agda buffer?" (equal (file-name-extension (buffer-name)) "lagda")) (defmacro agda2--case (exp &rest branches) ;FIXME: Use `pcase' instead! (declare (debug t) (indent 1)) (let ((s (make-symbol "v"))) `(let ((,s ,exp)) (cond ,@(mapcar (lambda (branch) `((equal ,s ,(car branch)) ,@(cdr branch))) branches))))) (defun agda2-goals-action (goals) "Annotates the goals in the current buffer with text properties. GOALS is a list of the buffer's goal numbers, in the order in which they appear in the buffer. Note that this function should be run /after/ syntax highlighting information has been loaded, because the two highlighting mechanisms interact in unfortunate ways." (agda2-forget-all-goals) (agda2-let ((literate (agda2-literate-p)) stk top ;; Don't run modification hooks: we don't want this function to ;; trigger agda2-abort-highlighting. (inhibit-modification-hooks t)) ((delims() (re-search-forward "[?]\\|[{][-!]\\|[-!][}]\\|--\\|\\\\begin{code}\\|\\\\end{code}" nil t)) ;; is-proper checks whether string s (e.g. "?" or "--") is proper ;; i.e., is not part of an identifier. ;; comment-starter is true if s starts a comment (e.g. "--") (is-proper (s comment-starter) (save-excursion (save-match-data (backward-char (length s)) (unless (bolp) (backward-char 1)) ;; bolp = pointer at beginning of line ;; Andreas, 2014-05-17 Issue 1132 ;; A questionmark can also follow immediately after a . ;; for instance to be a place holder for a dot pattern. (looking-at (concat "\\([.{}();]\\|^\\|\\s \\)" ;; \\s = whitespace (regexp-quote s) (unless comment-starter "\\([{}();]\\|$\\|\\s \\)")))))) (make(p) (agda2-make-goal p (point) (pop goals))) (inside-comment() (and stk (null (car stk)))) (inside-goal() (and stk (integerp (car stk)))) (outside-code() (and stk (eq (car stk) 'outside))) (inside-code() (not (outside-code))) ;; inside a multi-line comment ignore everything but the multi-line comment markers (safe-delims() (if (inside-comment) (re-search-forward "{-\\|-}" nil t) (delims)))) (save-excursion ;; In literate mode we should start out in the "outside of code" ;; state. (if literate (push 'outside stk)) (goto-char (point-min)) (while (and goals (safe-delims)) (agda2--case (match-string 0) ("\\begin{code}" (when (outside-code) (pop stk))) ("\\end{code}" (when (not stk) (push 'outside stk))) ("--" (when (and (not stk) (is-proper "--" t)) (end-of-line))) ("{-" (when (and (inside-code) (not (inside-goal))) (push nil stk))) ("-}" (when (inside-comment) (pop stk))) ("{!" (when (and (inside-code) (not (inside-comment))) (push (- (point) 2) stk))) ("!}" (when (inside-goal) (setq top (pop stk)) (unless stk (make top)))) ("?" (progn (when (and (not stk) (is-proper "?" nil)) (delete-char -1) (insert "{!!}") (make (- (point) 4)))))))))) (defun agda2-make-goal (p q n) "Make a goal with number N at

{!...!}. Assume the region is clean." (annotation-preserve-mod-p-and-undo (let ((atp (lambda (x ps) (add-text-properties x (1+ x) ps)))) (funcall atp p '(category agda2-delim1)) (funcall atp (1+ p) '(category agda2-delim2)) (funcall atp (- q 2) '(category agda2-delim3)) (funcall atp (1- q) '(category agda2-delim4))) (let ((o (make-overlay p q nil t nil))) (overlay-put o 'modification-hooks '(agda2-protect-goal-markers)) (overlay-put o 'agda2-gn n) (overlay-put o 'face 'highlight) (overlay-put o 'after-string (propertize (format "%s" n) 'face 'highlight))))) (defun agda2-protect-goal-markers (ol action beg end &optional length) "Ensures that the goal markers cannot be tampered with. Except if `inhibit-read-only' is non-nil or /all/ of the goal is modified." (if action ;; This is the after-change hook. nil ;; This is the before-change hook. (cond ((and (<= beg (overlay-start ol)) (>= end (overlay-end ol))) ;; The user is trying to remove the whole goal: ;; manually evaporate the overlay and add an undo-log entry so ;; it gets re-added if needed. (when (listp buffer-undo-list) (push (list 'apply 0 (overlay-start ol) (overlay-end ol) 'move-overlay ol (overlay-start ol) (overlay-end ol)) buffer-undo-list)) (delete-overlay ol)) ((or (< beg (+ (overlay-start ol) 2)) (> end (- (overlay-end ol) 2))) (unless inhibit-read-only (signal 'text-read-only nil)))))) (defun agda2-update (old-g new-txt) "Update the goal OLD-G. If NEW-TXT is a string, then the goal is replaced by the string, and otherwise the text inside the goal is retained (parenthesised if NEW-TXT is `'paren'). Removes the goal braces, but does not remove the goal overlay or text properties." (multiple-value-bind (p q) (agda2-range-of-goal old-g) (save-excursion (cond ((stringp new-txt) (agda2-replace-goal old-g new-txt)) ((equal new-txt 'paren) (goto-char (- q 2)) (insert ")") (goto-char (+ p 2)) (insert "("))) (multiple-value-bind (p q) (agda2-range-of-goal old-g) (delete-region (- q 2) q) (delete-region p (+ p 2))) ;; Update highlighting (if (and (not (equal new-txt 'paren)) (not (equal new-txt 'no-paren))) (apply 'agda2-go t t nil "Cmd_highlight" (format "%d" old-g) (agda2-mkRange p (- q 2)) (agda2-string-quote new-txt) nil)) ))) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;; Misc (defun agda2-process-status () "Status of `agda2-process-buffer', or \"no process\"." (condition-case nil (process-status agda2-process) (error "no process"))) (defun agda2-intersperse (sep xs) (let(ys)(while xs (push (pop xs) ys)(push sep ys))(pop ys)(nreverse ys))) (defun agda2-goal-Range (o) "The Haskell Range of goal overlay O." (agda2-mkRange (+ (overlay-start o) 2) (- (overlay-end o) 2))) (defun agda2-mkRange (p q) "The Haskell Range corresponding to two points." (format "(Range [Interval %s %s])" (agda2-mkPos p) (agda2-mkPos q))) (defun agda2-mkPos (&optional p) "The Haskell Position corresponding to P or `point'." (save-excursion (if p (goto-char p)) (format "(Pn (Just (mkAbsolute %s)) %d %d %d)" (agda2-string-quote (file-truename (buffer-file-name))) (point) (count-lines (point-min) (point)) (1+ (current-column))))) (defun agda2-char-quote (c) "Convert character C to the notation used in Haskell strings. The non-ASCII characters are actually rendered as \"\\xNNNN\\&\", i.e. followed by a \"null character\", to avoid problems if they are followed by digits. ASCII characters (code points < 128) are converted to singleton strings." (if (< c 128) (list c) ;; FIXME: Why return a list rather than a string? --Stef (append (format "\\x%x\\&" (encode-char c 'ucs)) nil))) (defun agda2-string-quote (s) "Format S as a Haskell string literal. Removes any text properties, escapes newlines, double quotes, etc., adds surrounding double quotes, and converts non-ASCII characters to the \\xNNNN notation used in Haskell strings." (let ((pp-escape-newlines t) (s2 (copy-sequence s))) (set-text-properties 0 (length s2) nil s2) (mapconcat 'agda2-char-quote (pp-to-string s2) ""))) (defun agda2-list-quote (strings) "Convert a list of STRINGS into a string representing it in Haskell syntax." (concat "[" (mapconcat 'agda2-string-quote strings ", ") "]")) (defun agda2-goal-at(pos) "Return (goal overlay, goal number) at POS, or nil." (let ((os (and pos (overlays-at pos))) o g) (while (and os (not(setq g (overlay-get (setq o (pop os)) 'agda2-gn))))) (if g (list o g)))) (defun agda2-goal-overlay (g) "Returns the overlay of goal number G, if any." (car (remove nil (mapcar (lambda (o) (if (equal (overlay-get o 'agda2-gn) g) o)) (overlays-in (point-min) (point-max)))))) (defun agda2-range-of-goal (g) "The range of goal G." (let ((o (agda2-goal-overlay g))) (if o (list (overlay-start o) (overlay-end o))))) (defun agda2-goto-goal (g) (let ((p (+ 2 (car (agda2-range-of-goal g))))) (if p (goto-char p)))) (defun agda2-replace-goal (g newtxt) "Replace the content of goal G with NEWTXT." (interactive) (save-excursion (multiple-value-bind (p q) (agda2-range-of-goal g) (setq p (+ p 2) q (- q 2)) (let ((indent (and (goto-char p) (current-column)))) (delete-region p q) (insert newtxt) (while (re-search-backward "^" p t) (insert-char ? indent) (backward-char (1+ indent))))))) (defun agda2-forget-all-goals () "Remove all goal annotations. \(Including some text properties which might be used by other \(minor) modes.)" (annotation-preserve-mod-p-and-undo (remove-text-properties (point-min) (point-max) '(category nil agda2-delim2 nil agda2-delim3 nil display nil rear-nonsticky nil))) (let ((p (point-min))) (while (< (setq p (next-single-char-property-change p 'agda2-gn)) (point-max)) (delete-overlay (car (agda2-goal-at p)))))) (defun agda2-decl-beginning () "Find the beginning point of the declaration containing the point. To do: dealing with semicolon separated decls." (interactive) (save-excursion (let* ((pEnd (point)) (pDef (progn (goto-char (point-min)) (re-search-forward "\\s *" pEnd t))) (cDef (current-column))) (while (re-search-forward "where\\(\\s +\\)\\S \\|^\\(\\s *\\)\\S " pEnd t) (if (match-end 1) (setq pDef (goto-char (match-end 1)) cDef (current-column)) (goto-char (match-end 2)) (if (>= cDef (current-column)) (setq pDef (point) cDef (current-column)))) (forward-char)) (goto-char pDef) (if (equal (current-word) "mutual") (or (match-end 2) (match-end 1)) pDef)))) (defun agda2-beginning-of-decl () (interactive) (goto-char (agda2-decl-beginning))) (defvar agda2-debug-buffer-name "*Agda debug*" "The name of the buffer used for Agda debug messages.") (defun agda2-verbose (msg) "Appends the string MSG to the `agda2-debug-buffer-name' buffer. Note that this buffer's contents is not erased automatically when a file is loaded." (with-current-buffer (get-buffer-create agda2-debug-buffer-name) (save-excursion (goto-char (point-max)) (insert msg)))) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Comments and paragraphs (defun agda2-comments-and-paragraphs-setup nil "Set up comment and paragraph handling for Agda mode." ;; Syntax table setup for comments is done elsewhere. ;; Enable highlighting of comments via Font Lock mode (which uses ;; the syntax table). (set (make-local-variable 'font-lock-defaults) '(nil nil nil nil nil)) ;; If the following s-expression is removed, then highlighting of ;; comments stops working. (when font-lock-mode (font-lock-mode t)) ;; Empty lines (all white space according to Emacs) delimit ;; paragraphs. (set (make-local-variable 'paragraph-start) "\\s-*$") (set (make-local-variable 'paragraph-separate) paragraph-start) ;; Support for adding/removing comments. (set (make-local-variable 'comment-start) "-- ") ;; Support for proper filling of text in comments (requires that ;; Filladapt is activated). (when (featurep 'filladapt) (add-to-list (make-local-variable 'filladapt-token-table) '("--" agda2-comment)) (add-to-list (make-local-variable 'filladapt-token-match-table) '(agda2-comment agda2-comment) t) (add-to-list (make-local-variable 'filladapt-token-conversion-table) '(agda2-comment . exact)))) (defun agda2-comment-dwim-rest-of-buffer () "Comment or uncomment the rest of the buffer. From the beginning of the current line to the end of the buffer." (interactive) (save-excursion (forward-line 0) (push-mark (point) 'no-message 'activate-mark) (unwind-protect (progn (goto-char (point-max)) (comment-dwim nil)) (pop-mark)))) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Go to definition site (defun agda2-goto (filepos &optional other-window) "Like `annotation-goto', unless `agda2-highlight-in-progress' is nil." (if agda2-highlight-in-progress (annotation-goto filepos other-window))) (defun agda2-goto-definition-keyboard (&optional other-window) "Go to the definition site of the name under point (if any). If this function is invoked with a prefix argument then another window is used to display the given position." (interactive "P") (annotation-goto-indirect (point) other-window)) (defun agda2-goto-definition-mouse (ev) "Go to the definition site of the name clicked on, if any. Otherwise, yank (see `mouse-yank-primary')." (interactive "e") (unless (annotation-goto-indirect ev) ;; FIXME: Shouldn't we use something like ;; (call-interactively (key-binding ev))? --Stef (mouse-yank-primary ev))) (defun agda2-go-back nil "Go back to the previous position in which `agda2-goto-definition-keyboard' or `agda2-goto-definition-mouse' was invoked." (interactive) (annotation-go-back)) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Implicit arguments (defun agda2-display-implicit-arguments (&optional arg) "Toggle display of implicit arguments. With prefix argument, turn on display of implicit arguments if the argument is a positive number, otherwise turn it off." (interactive "P") (cond ((eq arg nil) (agda2-go t t t "ToggleImplicitArgs")) ((and (numberp arg) (> arg 0)) (agda2-go t t t "ShowImplicitArgs" "True")) (t (agda2-go t t t "ShowImplicitArgs" "False")))) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;; (defun agda2-popup-menu-3 (ev) "If in a goal, popup the goal menu and call chosen command." (interactive "e") (let (choice) (save-excursion (and (agda2-goal-at (goto-char (posn-point (event-end ev)))) (setq choice (x-popup-menu ev agda2-goal-map)) (call-interactively (lookup-key agda2-goal-map (apply 'vector choice))))))) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Switching to a different version of Agda ;; Note that other versions of Agda may use different protocols, so ;; this function unloads the Emacs mode. (defun agda2-set-program-version (version) "Tries to switch to Agda version VERSION. This command assumes that the agda and agda-mode executables for Agda version VERSION are called agda-VERSION and agda-mode-VERSION, and that they are located on the PATH. (If VERSION is empty, then agda and agda-mode are used instead.)" (interactive "M") (let* ((agda-buffers (mapcan (lambda (buf) (with-current-buffer buf (when (equal major-mode 'agda2-mode) (list buf)))) (buffer-list))) (version-suffix (if (or (equal version "") (equal version nil)) "" (concat "-" version))) ;; Run agda-mode and make sure that it returns ;; successfully. (coding-system-for-read 'utf-8) (agda-mode-prog (concat "agda-mode" version-suffix)) (agda-mode-path (condition-case nil (with-temp-buffer (unless (equal 0 (call-process agda-mode-prog nil (current-buffer) nil "locate")) (error "%s" (concat "Error when running " agda-mode-prog))) (buffer-string)) (file-error (error "%s" (concat "Could not find " agda-mode-prog)))))) ;; Make sure that agda-mode returns a valid file. (unless (file-readable-p agda-mode-path) (error "%s" (concat "Could not read " agda-mode-path))) ;; Kill some processes/buffers related to Agda. (when (and agda2-process (process-status agda2-process)) (kill-process agda2-process)) (when (buffer-live-p agda2-process-buffer) (kill-buffer agda2-process-buffer)) (when (buffer-live-p agda2-info-buffer) (kill-buffer agda2-info-buffer)) (when (and agda2-debug-buffer-name (get-buffer agda2-debug-buffer-name)) (kill-buffer agda2-debug-buffer-name)) ;; Remove the Agda mode directory from the load path. (setq load-path (delete agda2-directory load-path)) ;; Unload the Agda mode and its dependencies. (unload-feature 'agda2-mode 'force) (unload-feature 'agda2 'force) (unload-feature 'eri 'force) (unload-feature 'annotation 'force) (unload-feature 'agda-input 'force) (unload-feature 'agda2-highlight 'force) (unload-feature 'agda2-abbrevs 'force) (unload-feature 'agda2-queue 'force) ;; Load the new version of Agda. (load-file agda-mode-path) (require 'agda2-mode) (setq agda2-program-name (concat "agda" version-suffix)) ;; Restart the Agda mode in all former Agda mode buffers. (mapc (lambda (buf) (with-current-buffer buf (agda2-mode))) agda-buffers))) (provide 'agda2-mode) ;;; agda2-mode.el ends here Agda-2.4.2.5/src/data/emacs-mode/agda2-highlight.el0000644000000000000000000004403612635075266017706 0ustar0000000000000000;;; agda2-highlight.el --- Syntax highlighting for Agda (version ≥ 2) ;;; Commentary: ;; Code to apply syntactic highlighting to Agda source code. This uses ;; Agda's own annotations to figure out what is what, so the parsing ;; is always done correctly, but highlighting is not done on the fly. ;;; Code: (require 'annotation) (require 'font-lock) (defgroup agda2-highlight nil "Syntax highlighting for Agda." :group 'agda2) (defcustom agda2-highlight-level 'non-interactive "How much syntax highlighting should be produced? Interactive highlighting includes highlighting of the expression that is currently being type-checked." :type '(choice (const :tag "None" none) (const :tag "Non-interactive" non-interactive) (const :tag "Interactive" interactive)) :group 'agda2-highlight) (defun agda2-highlight-level nil "Formats the highlighting level in a Haskelly way." (cond ((equal agda2-highlight-level 'none) "None") ((equal agda2-highlight-level 'non-interactive) "NonInteractive") ((equal agda2-highlight-level 'interactive) "Interactive") (t "None"))) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Functions for setting faces (defun agda2-highlight-set-face-attribute (face attrs) "Reset (globally) all attributes of the face FACE according to ATTRS. If the face does not exist, then it is created first." (make-face face) (set-face-attribute face nil :family 'unspecified :width 'unspecified :height 'unspecified :weight 'unspecified :slant 'unspecified :foreground 'unspecified :background 'unspecified :inverse-video 'unspecified :stipple 'unspecified :underline 'unspecified :overline 'unspecified :strike-through 'unspecified :inherit 'unspecified :box 'unspecified :font 'unspecified) (eval `(set-face-attribute face nil ,@attrs))) (defvar agda2-highlight-face-attributes-list '(:family :width :height :weight :slant :foreground :background :inverse-video :stipple :underline :overline :strike-through :inherit :box :font) "The attributes considered by `agda2-highlight-face-attributes'.") (defun agda2-highlight-face-attributes (face) "The names and values of all attributes in FACE. Only the attributes in `agda2-highlight-face-attributes-list' are considered. The attributes are returned in a flat list of the form (name1 value1 name2 value2...)." (apply 'append (mapcar (lambda (attr) (let ((val (face-attribute face attr))) (if (member val '(unspecified nil)) '() (list attr (if (symbolp val) `',val val))))) agda2-highlight-face-attributes-list))) (defun agda2-highlight-set-faces (variable group) "Set all Agda faces according to the value of GROUP. Also sets the default value of VARIABLE to GROUP." (set-default variable group) (mapc (lambda (face-and-attrs) (agda2-highlight-set-face-attribute (car face-and-attrs) (cdr face-and-attrs))) (cond ((equal group 'conor) '((agda2-highlight-keyword-face :bold t) (agda2-highlight-string-face :foreground "firebrick3") (agda2-highlight-number-face :foreground "firebrick3") (agda2-highlight-symbol-face :foreground "grey25") (agda2-highlight-primitive-type-face :foreground "medium blue") (agda2-highlight-bound-variable-face :foreground "purple") (agda2-highlight-inductive-constructor-face :foreground "firebrick3") (agda2-highlight-coinductive-constructor-face :foreground "firebrick3") (agda2-highlight-datatype-face :foreground "medium blue") (agda2-highlight-field-face :foreground "deeppink") (agda2-highlight-function-face :foreground "darkgreen") (agda2-highlight-module-face :foreground "medium blue") (agda2-highlight-postulate-face :foreground "darkgreen") (agda2-highlight-primitive-face :foreground "darkgreen") (agda2-highlight-record-face :foreground "medium blue") (agda2-highlight-dotted-face) (agda2-highlight-error-face :foreground "red" :underline t) (agda2-highlight-unsolved-meta-face :foreground "black" :background "yellow") (agda2-highlight-unsolved-constraint-face :foreground "black" :background "yellow") (agda2-highlight-termination-problem-face :foreground "black" :background "light salmon") (agda2-highlight-incomplete-pattern-face :foreground "black" :background "purple") (agda2-highlight-typechecks-face :foreground "black" :background "light blue"))) ((equal group 'default-faces) (list (cons 'agda2-highlight-keyword-face (agda2-highlight-face-attributes font-lock-keyword-face)) (cons 'agda2-highlight-string-face (agda2-highlight-face-attributes font-lock-string-face)) (cons 'agda2-highlight-number-face (agda2-highlight-face-attributes font-lock-constant-face)) (cons 'agda2-highlight-symbol-face (agda2-highlight-face-attributes font-lock-keyword-face)) (cons 'agda2-highlight-primitive-type-face (agda2-highlight-face-attributes font-lock-keyword-face)) (cons 'agda2-highlight-bound-variable-face (agda2-highlight-face-attributes font-lock-variable-name-face)) (cons 'agda2-highlight-inductive-constructor-face (agda2-highlight-face-attributes font-lock-type-face)) (cons 'agda2-highlight-coinductive-constructor-face (agda2-highlight-face-attributes font-lock-type-face)) (cons 'agda2-highlight-datatype-face (agda2-highlight-face-attributes font-lock-type-face)) (cons 'agda2-highlight-field-face (agda2-highlight-face-attributes font-lock-variable-name-face)) (cons 'agda2-highlight-function-face (agda2-highlight-face-attributes font-lock-function-name-face)) (cons 'agda2-highlight-module-face (agda2-highlight-face-attributes font-lock-type-face)) (cons 'agda2-highlight-postulate-face (agda2-highlight-face-attributes font-lock-type-face)) (cons 'agda2-highlight-primitive-face (agda2-highlight-face-attributes font-lock-constant-face)) (cons 'agda2-highlight-record-face (agda2-highlight-face-attributes font-lock-variable-name-face)) (cons 'agda2-highlight-dotted-face (agda2-highlight-face-attributes font-lock-variable-name-face)) (cons 'agda2-highlight-operator-face (agda2-highlight-face-attributes font-lock-function-name-face)) (cons 'agda2-highlight-error-face (agda2-highlight-face-attributes font-lock-warning-face)) (cons 'agda2-highlight-typechecks-face (agda2-highlight-face-attributes font-lock-type-face)) (cons 'agda2-highlight-typechecking-face (agda2-highlight-face-attributes font-lock-preprocessor-face))))))) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Faces (defcustom agda2-highlight-face-groups nil "Colour scheme used in Agda buffers. Changes to this variable may not take full effect until you have restarted Emacs. Note also that if you are using the default-faces option and change your colour theme, then the changes may not take effect in Agda buffers until you have restarted Emacs." :type '(choice (const :tag "Use the settings in the \"Agda2 Highlight Faces\" subgroup." nil) (const :tag "Use an approximation of Conor McBride's colour scheme." conor) (const :tag "Use simplified highlighting and default font-lock faces." default-faces)) :group 'agda2-highlight :set 'agda2-highlight-set-faces) (defgroup agda2-highlight-faces nil "Faces used to highlight Agda code. If `agda2-highlight-face-groups' is nil." :group 'agda2-highlight) (defface agda2-highlight-keyword-face '((t (:foreground "DarkOrange3"))) "The face used for keywords." :group 'agda2-highlight-faces) (defface agda2-highlight-string-face '((t (:foreground "firebrick"))) "The face used for strings." :group 'agda2-highlight-faces) (defface agda2-highlight-number-face '((t (:foreground "purple"))) "The face used for numbers." :group 'agda2-highlight-faces) (defface agda2-highlight-symbol-face '((((background light)) (:foreground "gray25")) (((background dark)) (:foreground "gray75"))) "The face used for symbols like forall, =, ->, etc." :group 'agda2-highlight-faces) (defface agda2-highlight-primitive-type-face '((t (:foreground "medium blue"))) "The face used for primitive types (like Set and Prop)." :group 'agda2-highlight-faces) (defface agda2-highlight-bound-variable-face '((t nil)) "The face used for bound variables." :group 'agda2-highlight-faces) (defface agda2-highlight-inductive-constructor-face '((t (:foreground "green4"))) "The face used for inductive constructors." :group 'agda2-highlight-faces) (defface agda2-highlight-coinductive-constructor-face '((t (:foreground "gold4"))) "The face used for coinductive constructors." :group 'agda2-highlight-faces) (defface agda2-highlight-datatype-face '((t (:foreground "medium blue"))) "The face used for datatypes." :group 'agda2-highlight-faces) (defface agda2-highlight-field-face '((t (:foreground "DeepPink2"))) "The face used for record fields." :group 'agda2-highlight-faces) (defface agda2-highlight-function-face '((t (:foreground "medium blue"))) "The face used for functions." :group 'agda2-highlight-faces) (defface agda2-highlight-module-face '((t (:foreground "purple"))) "The face used for module names." :group 'agda2-highlight-faces) (defface agda2-highlight-postulate-face '((t (:foreground "medium blue"))) "The face used for postulates." :group 'agda2-highlight-faces) (defface agda2-highlight-primitive-face '((t (:foreground "medium blue"))) "The face used for primitive functions." :group 'agda2-highlight-faces) (defface agda2-highlight-record-face '((t (:foreground "medium blue"))) "The face used for record types." :group 'agda2-highlight-faces) (defface agda2-highlight-dotted-face '((t nil)) "The face used for dotted patterns." :group 'agda2-highlight-faces) (defface agda2-highlight-operator-face '((t nil)) "The face used for operators." :group 'agda2-highlight-faces) (defface agda2-highlight-error-face '((t (:foreground "red" :underline t))) "The face used for errors." :group 'agda2-highlight-faces) (defface agda2-highlight-unsolved-meta-face '((t (:background "yellow" :foreground "black"))) "The face used for unsolved meta variables." :group 'agda2-highlight-faces) (defface agda2-highlight-unsolved-constraint-face '((t (:background "yellow" :foreground "black"))) "The face used for unsolved constraints which are not connected to metas." :group 'agda2-highlight-faces) (defface agda2-highlight-termination-problem-face '((t (:background "light salmon" :foreground "black"))) "The face used for termination problems." :group 'agda2-highlight-faces) (defface agda2-highlight-incomplete-pattern-face '((t (:background "wheat" :foreground "black"))) "The face used for incomplete patterns. (Currently unused.)" :group 'agda2-highlight-faces) (defface agda2-highlight-typechecks-face '((t (:background "light blue" :foreground "black"))) "The face used for code which is being type-checked." :group 'agda2-highlight-faces) (defvar agda2-highlight-faces '((keyword . agda2-highlight-keyword-face) (string . agda2-highlight-string-face) (number . agda2-highlight-number-face) (symbol . agda2-highlight-symbol-face) (primitivetype . agda2-highlight-primitive-type-face) (bound . agda2-highlight-bound-variable-face) (inductiveconstructor . agda2-highlight-inductive-constructor-face) (coinductiveconstructor . agda2-highlight-coinductive-constructor-face) (datatype . agda2-highlight-datatype-face) (field . agda2-highlight-field-face) (function . agda2-highlight-function-face) (module . agda2-highlight-module-face) (postulate . agda2-highlight-postulate-face) (primitive . agda2-highlight-primitive-face) (record . agda2-highlight-record-face) (dotted . agda2-highlight-dotted-face) (operator . agda2-highlight-operator-face) (error . agda2-highlight-error-face) (unsolvedmeta . agda2-highlight-unsolved-meta-face) (unsolvedconstraint . agda2-highlight-unsolved-constraint-face) (terminationproblem . agda2-highlight-termination-problem-face) (incompletepattern . agda2-highlight-incomplete-pattern-face) (typechecks . agda2-highlight-typechecks-face)) "Alist mapping code aspects to the face used when displaying them. The aspects currently recognised are the following: `bound' Bound variables. `coinductiveconstructor' Coinductive constructors. `datatype' Data types. `dotted' Dotted patterns. `error' Errors. `field' Record fields. `function' Functions. `incompletepattern' Incomplete patterns. `inductiveconstructor' Inductive constructors. `keyword' Keywords. `module' Module names. `number' Numbers. `operator' Operators. `postulate' Postulates. `primitive' Primitive functions. `primitivetype' Primitive types (like Set and Prop). `record' Record types. `string' Strings. `symbol' Symbols like forall, =, ->, etc. `terminationproblem' Termination problems. `typechecks' Code which is being type-checked. `unsolvedconstraint' Unsolved constraints, not connected to meta variables. `unsolvedmeta' Unsolved meta variables. The following aspect is ignored: `comment' Comments. Comments are handled by Font Lock mode (which uses the syntax table). The face `font-lock-comment-face' is used for comments.") ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Variables (defvar agda2-highlight-in-progress nil "If nil, then highlighting annotations are not applied.") (make-variable-buffer-local 'agda2-highlight-in-progress) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Functions (defun agda2-highlight-setup nil "Set up the `annotation' library for use with `agda2-mode'." (setq annotation-bindings agda2-highlight-faces)) (defun agda2-highlight-apply (&rest cmds) "Adds the syntax highlighting information in the annotation list CMDS. Old syntax highlighting information is not removed." (let (;; Ignore read-only status, otherwise this function may fail. (inhibit-read-only t)) (apply 'annotation-load "Click mouse-2 to jump to definition" cmds))) (defun agda2-highlight-add-annotations (&rest cmds) "Like `agda2-highlight-apply'. But only if `agda2-highlight-in-progress' is non-nil." (if agda2-highlight-in-progress (apply 'agda2-highlight-apply cmds))) (defun agda2-highlight-load (file) "Load syntax highlighting information from FILE. Old syntax highlighting information is not removed." (let* ((coding-system-for-read 'utf-8) (cmds (with-temp-buffer (insert-file-contents file) (goto-char (point-min)) (read (current-buffer))))) (apply 'agda2-highlight-apply cmds))) (defun agda2-highlight-load-and-delete-action (file) "Like `agda2-highlight-load', but deletes FILE when done. And highlighting is only updated if `agda2-highlight-in-progress' is non-nil." (unwind-protect (if agda2-highlight-in-progress (agda2-highlight-load file)) (delete-file file))) (defun agda2-highlight-clear nil "Remove all syntax highlighting added by `agda2-highlight-reload'." (interactive) (let ((inhibit-read-only t)) ; Ignore read-only status, otherwise this function may fail. (annotation-remove-annotations))) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Administrative details (provide 'agda2-highlight) ;;; agda2-highlight.el ends here Agda-2.4.2.5/src/data/emacs-mode/eri.el0000644000000000000000000001543512635075266015543 0ustar0000000000000000;;; eri.el --- Enhanced relative indentation (eri) ;;; Commentary: ;;; Code: (require 'cl) (defun eri-current-line-length nil "Calculate length of current line." (- (line-end-position) (line-beginning-position))) (defun eri-current-line-empty nil "Return non-nil if the current line is empty (not counting white space)." (equal (current-indentation) (eri-current-line-length))) (defun eri-maximum (xs) "Calculate maximum element in XS. Returns nil if the list is empty." (if xs (apply 'max xs))) (defun eri-take (n xs) "Return the first N elements of XS." (butlast xs (- (length xs) n))) (defun eri-split (x xs) "Return a pair of lists (XS1 . XS2). If XS is sorted, then XS = (append XS1 XS2), and all elements in XS1 are <= X, whereas all elements in XS2 are > X." (let* ((pos (or (position-if (lambda (y) (> y x)) xs) (length xs))) (xs1 (eri-take pos xs)) (xs2 (nthcdr pos xs))) (cons xs1 xs2))) (defun eri-calculate-indentation-points-on-line (max) "Calculate indentation points on current line. Only points left of column number MAX are included. If MAX is nil, then all points are included. Points are returned in ascending order. Example (positions marked with ^ are returned): f x y = g 3 (Just y) 5 4 ^ ^ ^ ^ ^ ^ ^ ^ | | MAX" (let ((result)) (save-excursion (save-restriction (beginning-of-line) ; To make \\` work in the regexp below: (narrow-to-region (line-beginning-position) (line-end-position)) (while (progn (let ((pos (and (search-forward-regexp "\\(?:\\s-\\|\\`\\)\\(\\S-\\)" nil t) (match-beginning 1)))) (when (not (null pos)) (let ((pos1 (- pos (line-beginning-position)))) (when (or (null max) (< pos1 max)) (add-to-list 'result pos1)))) (and pos (< (point) (line-end-position)) (or (null max) (< (current-column) max)))))) (nreverse result) ; Destructive operation. )))) (defun eri-new-indentation-points () "Calculate new indentation points. Returns a singleton list containing the column number two steps in from the indentation of the first non-empty line (white space excluded) above the current line. If there is no such line, then the empty list is returned." (let ((start (line-beginning-position))) (save-excursion ; Find a non-empty line above the current one, if any. (while (progn (forward-line -1) (not (or (bobp) (not (eri-current-line-empty)))))) (if (or (equal (point) start) (eri-current-line-empty)) nil (list (+ 2 (current-indentation))))))) (defun eri-calculate-indentation-points (reverse) "Calculate points used to indent the current line. The points are given in reverse order if REVERSE is non-nil. See `eri-indent' for a description of how the indentation points are calculated; note that the current indentation is not included in the returned list." ;; First find a bunch of indentations used above the current line. (let ((points) (max) (start (line-beginning-position))) (save-excursion (while (progn (forward-line -1) ; Skip the line we started from and lines with nothing but ; white space. (unless (or (equal (point) start) (eri-current-line-empty)) (setq points (append (eri-calculate-indentation-points-on-line max) points)) (setq max (car points))) ;; Stop after hitting the beginning of the buffer or a ;; non-empty, non-indented line. (not (or (bobp) (and (equal (current-indentation) 0) (> (eri-current-line-length) 0))))))) ;; Add new indentation points, but remove the current indentation. ;; Sort the indentations. Rearrange the points so that the next ;; point is the one after the current one. Reverse if necessary. ;; ;; Note: sort and nreverse are destructive. (let* ((ps0 (remove (current-indentation) (append (eri-new-indentation-points) points))) (ps1 (eri-split (current-indentation) (sort ps0 '<))) (ps2 (append (cdr ps1) (car ps1)))) (if reverse (nreverse ps2) ps2)))) (defun eri-indent (&optional reverse) "Cycle between some possible indentation points. With prefix argument REVERSE, cycle in reverse order. Assume that a file contains the following lines of code, with point on the line with three dots: frob = loooooooooooooooooooooooooong identifier foo = f a b where f (Foo x) y = let bar = x baz = 3 + 5 ... ^ ^ ^ ^ ^ ^ ^ ^ ^ * ^ ^ ^ ^ Then the ^'s and the * mark the indentation points that this function cycles through. The indentation points are selected as follows: * All lines before the current one, up to and including the first non-indented line (or the beginning of the buffer) are considered. foo = f a b where f (Foo x) y = let bar = x baz = 3 + 5 * On these lines, erase all characters that stand to the right of some non-white space character on a lower line. foo whe f (Foo x) y = let b baz = 3 + 5 * Also erase all characters not immediately preceded by white space. f w f ( x y = l b b = 3 + 5 * The columns of all remaining characters are indentation points. f w f ( x y = l b = 3 + 5 ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ * A new indentation point is also added, two steps in from the indentation of the first non-empty line (white space excluded) above the current line (if there is such a line). f w f ( x y = l b = 3 + 5 ^ ^ ^ ^ ^ ^ ^ ^ ^ * ^ ^ ^ ^" (interactive "P") (let* ((points (eri-calculate-indentation-points reverse)) (remaining-points (cdr (member (current-indentation) points))) (indentation (if remaining-points (car remaining-points) (car points)))) (when indentation (save-excursion (indent-line-to indentation)) (if (< (current-column) indentation) (indent-line-to indentation))))) (defun eri-indent-reverse nil "Cycle between some possible indentation points (in reverse order). See `eri-indent' for a description of how the indentation points are calculated." (interactive) (eri-indent t)) (provide 'eri) ;;; eri.el ends here Agda-2.4.2.5/src/data/emacs-mode/agda-input.el0000644000000000000000000010541212635075266017010 0ustar0000000000000000;;; agda-input.el --- The Agda input method ;;; Commentary: ;; A highly customisable input method which can inherit from other ;; Quail input methods. By default the input method is geared towards ;; the input of mathematical and other symbols in Agda programs. ;; ;; Use M-x customize-group agda-input to customise this input method. ;; Note that the functions defined under "Functions used to tweak ;; translation pairs" below can be used to tweak both the key ;; translations inherited from other input methods as well as the ;; ones added specifically for this one. ;; ;; Use agda-input-show-translations to see all the characters which ;; can be typed using this input method (except for those ;; corresponding to ASCII characters). ;;; Code: (require 'quail) (require 'cl) ;; Quail is quite stateful, so be careful when editing this code. Note ;; that with-temp-buffer is used below whenever buffer-local state is ;; modified. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Utility functions (defun agda-input-concat-map (f xs) "Concat (map F XS)." (apply 'append (mapcar f xs))) (defun agda-input-to-string-list (s) "Convert a string S to a list of one-character strings, after removing all space and newline characters." (agda-input-concat-map (lambda (c) (if (member c (string-to-list " \n")) nil (list (string c)))) (string-to-list s))) (defun agda-input-character-range (from to) "A string consisting of the characters from FROM to TO." (let (seq) (dotimes (i (1+ (- to from))) (setq seq (cons (+ from i) seq))) (concat (nreverse seq)))) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Functions used to tweak translation pairs ;; lexical-let is used since Elisp lacks lexical scoping. (defun agda-input-compose (f g) "\x -> concatMap F (G x)" (lexical-let ((f1 f) (g1 g)) (lambda (x) (agda-input-concat-map f1 (funcall g1 x))))) (defun agda-input-or (f g) "\x -> F x ++ G x" (lexical-let ((f1 f) (g1 g)) (lambda (x) (append (funcall f1 x) (funcall g1 x))))) (defun agda-input-nonempty () "Only keep pairs with a non-empty first component." (lambda (x) (if (> (length (car x)) 0) (list x)))) (defun agda-input-prepend (prefix) "Prepend PREFIX to all key sequences." (lexical-let ((prefix1 prefix)) (lambda (x) `((,(concat prefix1 (car x)) . ,(cdr x)))))) (defun agda-input-prefix (prefix) "Only keep pairs whose key sequence starts with PREFIX." (lexical-let ((prefix1 prefix)) (lambda (x) (if (equal (substring (car x) 0 (length prefix1)) prefix1) (list x))))) (defun agda-input-suffix (suffix) "Only keep pairs whose key sequence ends with SUFFIX." (lexical-let ((suffix1 suffix)) (lambda (x) (if (equal (substring (car x) (- (length (car x)) (length suffix1))) suffix1) (list x))))) (defun agda-input-drop (ss) "Drop pairs matching one of the given key sequences. SS should be a list of strings." (lexical-let ((ss1 ss)) (lambda (x) (unless (member (car x) ss1) (list x))))) (defun agda-input-drop-beginning (n) "Drop N characters from the beginning of each key sequence." (lexical-let ((n1 n)) (lambda (x) `((,(substring (car x) n1) . ,(cdr x)))))) (defun agda-input-drop-end (n) "Drop N characters from the end of each key sequence." (lexical-let ((n1 n)) (lambda (x) `((,(substring (car x) 0 (- (length (car x)) n1)) . ,(cdr x)))))) (defun agda-input-drop-prefix (prefix) "Only keep pairs whose key sequence starts with PREFIX. This prefix is dropped." (agda-input-compose (agda-input-drop-beginning (length prefix)) (agda-input-prefix prefix))) (defun agda-input-drop-suffix (suffix) "Only keep pairs whose key sequence ends with SUFFIX. This suffix is dropped." (lexical-let ((suffix1 suffix)) (agda-input-compose (agda-input-drop-end (length suffix1)) (agda-input-suffix suffix1)))) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Customization ;; The :set keyword is set to 'agda-input-incorporate-changed-setting ;; so that the input method gets updated immediately when users ;; customize it. However, the setup functions cannot be run before all ;; variables have been defined. Hence the :initialize keyword is set to ;; 'custom-initialize-default to ensure that the setup is not performed ;; until agda-input-setup is called at the end of this file. (defgroup agda-input nil "The Agda input method. After tweaking these settings you may want to inspect the resulting translations using `agda-input-show-translations'." :group 'agda2 :group 'leim) (defcustom agda-input-tweak-all '(agda-input-compose (agda-input-prepend "\\") (agda-input-nonempty)) "An expression yielding a function which can be used to tweak all translations before they are included in the input method. The resulting function (if non-nil) is applied to every \(KEY-SEQUENCE . TRANSLATION) pair and should return a list of such pairs. (Note that the translations can be anything accepted by `quail-defrule'.) If you change this setting manually (without using the customization buffer) you need to call `agda-input-setup' in order for the change to take effect." :group 'agda-input :set 'agda-input-incorporate-changed-setting :initialize 'custom-initialize-default :type 'sexp) (defcustom agda-input-inherit `(("TeX" . (agda-input-compose (agda-input-drop '("geq" "leq" "bullet" "qed" "par")) (agda-input-or (agda-input-drop-prefix "\\") (agda-input-or (agda-input-compose (agda-input-drop '("^l" "^o" "^r" "^v")) (agda-input-prefix "^")) (agda-input-prefix "_"))))) ) "A list of Quail input methods whose translations should be inherited by the Agda input method (with the exception of translations corresponding to ASCII characters). The list consists of pairs (qp . tweak), where qp is the name of a Quail package, and tweak is an expression of the same kind as `agda-input-tweak-all' which is used to tweak the translation pairs of the input method. The inherited translation pairs are added last, after `agda-input-user-translations' and `agda-input-translations'. If you change this setting manually (without using the customization buffer) you need to call `agda-input-setup' in order for the change to take effect." :group 'agda-input :set 'agda-input-incorporate-changed-setting :initialize 'custom-initialize-default :type '(repeat (cons (string :tag "Quail package") (sexp :tag "Tweaking function")))) (defcustom agda-input-translations (let ((max-lisp-eval-depth 2800)) `( ;; Equality and similar symbols. ("eq" . ,(agda-input-to-string-list "=∼∽≈≋∻∾∿≀≃⋍≂≅ ≌≊≡≣≐≑≒≓≔≕≖≗≘≙≚≛≜≝≞≟≍≎≏≬⋕")) ("eqn" . ,(agda-input-to-string-list "≠≁ ≉ ≄ ≇≆ ≢ ≭ ")) ("=n" . ("≠")) ("~" . ("∼")) ("~n" . ("≁")) ("~~" . ("≈")) ("~~n" . ("≉")) ("~~~" . ("≋")) (":~" . ("∻")) ("~-" . ("≃")) ("~-n" . ("≄")) ("-~" . ("≂")) ("~=" . ("≅")) ("~=n" . ("≇")) ("~~-" . ("≊")) ("==" . ("≡")) ("==n" . ("≢")) ("===" . ("≣")) (".=" . ("≐")) (".=." . ("≑")) (":=" . ("≔")) ("=:" . ("≕")) ("=o" . ("≗")) ("(=" . ("≘")) ("and=" . ("≙")) ("or=" . ("≚")) ("*=" . ("≛")) ("t=" . ("≜")) ("def=" . ("≝")) ("m=" . ("≞")) ("?=" . ("≟")) ;; Inequality and similar symbols. ("leq" . ,(agda-input-to-string-list "<≪⋘≤≦≲ ≶≺≼≾⊂⊆ ⋐⊏⊑ ⊰⊲⊴⋖⋚⋜⋞")) ("leqn" . ,(agda-input-to-string-list "≮ ≰≨≴⋦≸⊀ ⋨⊄⊈⊊ ⋢⋤ ⋪⋬ ⋠")) ("geq" . ,(agda-input-to-string-list ">≫⋙≥≧≳ ≷≻≽≿⊃⊇ ⋑⊐⊒ ⊱⊳⊵⋗⋛⋝⋟")) ("geqn" . ,(agda-input-to-string-list "≯ ≱≩≵⋧≹⊁ ⋩⊅⊉⊋ ⋣⋥ ⋫⋭ ⋡")) ("<=" . ("≤")) (">=" . ("≥")) ("<=n" . ("≰")) (">=n" . ("≱")) ("len" . ("≰")) ("gen" . ("≱")) ("n" . ("≯")) ("<~" . ("≲")) (">~" . ("≳")) ("<~n" . ("⋦")) (">~n" . ("⋧")) ("<~nn" . ("≴")) (">~nn" . ("≵")) ("sub" . ("⊂")) ("sup" . ("⊃")) ("subn" . ("⊄")) ("supn" . ("⊅")) ("sub=" . ("⊆")) ("sup=" . ("⊇")) ("sub=n" . ("⊈")) ("sup=n" . ("⊉")) ("squb" . ("⊏")) ("squp" . ("⊐")) ("squb=" . ("⊑")) ("squp=" . ("⊒")) ("squb=n" . ("⋢")) ("squp=n" . ("⋣")) ;; Set membership etc. ("member" . ,(agda-input-to-string-list "∈∉∊∋∌∍⋲⋳⋴⋵⋶⋷⋸⋹⋺⋻⋼⋽⋾⋿")) ("inn" . ("∉")) ("nin" . ("∌")) ;; Intersections, unions etc. ("intersection" . ,(agda-input-to-string-list "∩⋂∧⋀⋏⨇⊓⨅⋒∏ ⊼ ⨉")) ("union" . ,(agda-input-to-string-list "∪⋃∨⋁⋎⨈⊔⨆⋓∐⨿⊽⊻⊍⨃⊎⨄⊌∑⅀")) ("and" . ("∧")) ("or" . ("∨")) ("And" . ("⋀")) ("Or" . ("⋁")) ("i" . ("∩")) ("un" . ("∪")) ("u+" . ("⊎")) ("u." . ("⊍")) ("I" . ("⋂")) ("Un" . ("⋃")) ("U+" . ("⨄")) ("U." . ("⨃")) ("glb" . ("⊓")) ("lub" . ("⊔")) ("Glb" . ("⨅")) ("Lub" . ("⨆")) ;; Entailment etc. ("entails" . ,(agda-input-to-string-list "⊢⊣⊤⊥⊦⊧⊨⊩⊪⊫⊬⊭⊮⊯")) ("|-" . ("⊢")) ("|-n" . ("⊬")) ("-|" . ("⊣")) ("|=" . ("⊨")) ("|=n" . ("⊭")) ("||-" . ("⊩")) ("||-n" . ("⊮")) ("||=" . ("⊫")) ("||=n" . ("⊯")) ("|||-" . ("⊪")) ;; Divisibility, parallelity. ("|" . ("∣")) ("|n" . ("∤")) ("||" . ("∥")) ("||n" . ("∦")) ;; Some symbols from logic and set theory. ("all" . ("∀")) ("ex" . ("∃")) ("exn" . ("∄")) ("0" . ("∅")) ("C" . ("∁")) ;; Corners, ceilings and floors. ("c" . ,(agda-input-to-string-list "⌜⌝⌞⌟⌈⌉⌊⌋")) ("cu" . ,(agda-input-to-string-list "⌜⌝ ⌈⌉ ")) ("cl" . ,(agda-input-to-string-list " ⌞⌟ ⌊⌋")) ("cul" . ("⌜")) ("cuL" . ("⌈")) ("cur" . ("⌝")) ("cuR" . ("⌉")) ("cll" . ("⌞")) ("clL" . ("⌊")) ("clr" . ("⌟")) ("clR" . ("⌋")) ;; Various operators/symbols. ("qed" . ("∎")) ("x" . ("×")) ("o" . ("∘")) ("comp" . ("∘")) ("." . ("∙")) ("*" . ("⋆")) (".+" . ("∔")) (".-" . ("∸")) (":" . ("∶")) ("::" . ("∷")) ("::-" . ("∺")) ("-:" . ("∹")) ("+ " . ("⊹")) ("surd3" . ("∛")) ("surd4" . ("∜")) ("increment" . ("∆")) ("inf" . ("∞")) ("&" . ("⅋")) ;; Circled operators. ("o+" . ("⊕")) ("o--" . ("⊖")) ("ox" . ("⊗")) ("o/" . ("⊘")) ("o." . ("⊙")) ("oo" . ("⊚")) ("o*" . ("⊛")) ("o=" . ("⊜")) ("o-" . ("⊝")) ("O+" . ("⨁")) ("Ox" . ("⨂")) ("O." . ("⨀")) ("O*" . ("⍟")) ;; Boxed operators. ("b+" . ("⊞")) ("b-" . ("⊟")) ("bx" . ("⊠")) ("b." . ("⊡")) ;; Various symbols. ("integral" . ,(agda-input-to-string-list "∫∬∭∮∯∰∱∲∳")) ("angle" . ,(agda-input-to-string-list "∟∡∢⊾⊿")) ("join" . ,(agda-input-to-string-list "⋈⋉⋊⋋⋌⨝⟕⟖⟗")) ;; Arrows. ("l" . ,(agda-input-to-string-list "←⇐⇚⇇⇆↤⇦↞↼↽⇠⇺↜⇽⟵⟸↚⇍⇷ ↹ ↢↩↫⇋⇜⇤⟻⟽⤆↶↺⟲ ")) ("r" . ,(agda-input-to-string-list "→⇒⇛⇉⇄↦⇨↠⇀⇁⇢⇻↝⇾⟶⟹↛⇏⇸⇶ ↴ ↣↪↬⇌⇝⇥⟼⟾⤇↷↻⟳⇰⇴⟴⟿ ➵➸➙➔➛➜➝➞➟➠➡➢➣➤➧➨➩➪➫➬➭➮➯➱➲➳➺➻➼➽➾⊸")) ("u" . ,(agda-input-to-string-list "↑⇑⟰⇈⇅↥⇧↟↿↾⇡⇞ ↰↱➦ ⇪⇫⇬⇭⇮⇯ ")) ("d" . ,(agda-input-to-string-list "↓⇓⟱⇊⇵↧⇩↡⇃⇂⇣⇟ ↵↲↳➥ ↯ ")) ("ud" . ,(agda-input-to-string-list "↕⇕ ↨⇳ ")) ("lr" . ,(agda-input-to-string-list "↔⇔ ⇼↭⇿⟷⟺↮⇎⇹ ")) ("ul" . ,(agda-input-to-string-list "↖⇖ ⇱↸ ")) ("ur" . ,(agda-input-to-string-list "↗⇗ ➶➹➚ ")) ("dr" . ,(agda-input-to-string-list "↘⇘ ⇲ ➴➷➘ ")) ("dl" . ,(agda-input-to-string-list "↙⇙ ")) ("l-" . ("←")) ("<-" . ("←")) ("l=" . ("⇐")) ("r-" . ("→")) ("->" . ("→")) ("r=" . ("⇒")) ("=>" . ("⇒")) ("u-" . ("↑")) ("u=" . ("⇑")) ("d-" . ("↓")) ("d=" . ("⇓")) ("ud-" . ("↕")) ("ud=" . ("⇕")) ("lr-" . ("↔")) ("<->" . ("↔")) ("lr=" . ("⇔")) ("<=>" . ("⇔")) ("ul-" . ("↖")) ("ul=" . ("⇖")) ("ur-" . ("↗")) ("ur=" . ("⇗")) ("dr-" . ("↘")) ("dr=" . ("⇘")) ("dl-" . ("↙")) ("dl=" . ("⇙")) ("l==" . ("⇚")) ("l-2" . ("⇇")) ("l-r-" . ("⇆")) ("r==" . ("⇛")) ("r-2" . ("⇉")) ("r-3" . ("⇶")) ("r-l-" . ("⇄")) ("u==" . ("⟰")) ("u-2" . ("⇈")) ("u-d-" . ("⇅")) ("d==" . ("⟱")) ("d-2" . ("⇊")) ("d-u-" . ("⇵")) ("l--" . ("⟵")) ("<--" . ("⟵")) ("l~" . ("↜" "⇜")) ("r--" . ("⟶")) ("-->" . ("⟶")) ("r~" . ("↝" "⇝" "⟿")) ("lr--" . ("⟷")) ("<-->" . ("⟷")) ("lr~" . ("↭")) ("l-n" . ("↚")) ("<-n" . ("↚")) ("l=n" . ("⇍")) ("r-n" . ("↛")) ("->n" . ("↛")) ("r=n" . ("⇏")) ("=>n" . ("⇏")) ("lr-n" . ("↮")) ("<->n" . ("↮")) ("lr=n" . ("⇎")) ("<=>n" . ("⇎")) ("l-|" . ("↤")) ("ll-" . ("↞")) ("r-|" . ("↦")) ("rr-" . ("↠")) ("u-|" . ("↥")) ("uu-" . ("↟")) ("d-|" . ("↧")) ("dd-" . ("↡")) ("ud-|" . ("↨")) ("l->" . ("↢")) ("r->" . ("↣")) ("r-o" . ("⊸")) ("-o" . ("⊸")) ("dz" . ("↯")) ;; Ellipsis. ("..." . ,(agda-input-to-string-list "⋯⋮⋰⋱")) ;; Box-drawing characters. ("---" . ,(agda-input-to-string-list "─│┌┐└┘├┤┬┼┴╴╵╶╷╭╮╯╰╱╲╳")) ("--=" . ,(agda-input-to-string-list "═║╔╗╚╝╠╣╦╬╩ ╒╕╘╛╞╡╤╪╧ ╓╖╙╜╟╢╥╫╨")) ("--_" . ,(agda-input-to-string-list "━┃┏┓┗┛┣┫┳╋┻╸╹╺╻ ┍┯┑┕┷┙┝┿┥┎┰┒┖┸┚┠╂┨┞╀┦┟╁┧┢╈┪┡╇┩ ┮┭┶┵┾┽┲┱┺┹╊╉╆╅╄╃ ╿╽╼╾")) ("--." . ,(agda-input-to-string-list "╌╎┄┆┈┊ ╍╏┅┇┉┋")) ;; Triangles. ;; Big/small, black/white. ("t" . ,(agda-input-to-string-list "◂◃◄◅▸▹►▻▴▵▾▿◢◿◣◺◤◸◥◹")) ("T" . ,(agda-input-to-string-list "◀◁▶▷▲△▼▽◬◭◮")) ("tb" . ,(agda-input-to-string-list "◂▸▴▾◄►◢◣◤◥")) ("tw" . ,(agda-input-to-string-list "◃▹▵▿◅▻◿◺◸◹")) ("Tb" . ,(agda-input-to-string-list "◀▶▲▼")) ("Tw" . ,(agda-input-to-string-list "◁▷△▽")) ;; Squares. ("sq" . ,(agda-input-to-string-list "■□◼◻◾◽▣▢▤▥▦▧▨▩◧◨◩◪◫◰◱◲◳")) ("sqb" . ,(agda-input-to-string-list "■◼◾")) ("sqw" . ,(agda-input-to-string-list "□◻◽")) ("sq." . ("▣")) ("sqo" . ("▢")) ;; Rectangles. ("re" . ,(agda-input-to-string-list "▬▭▮▯")) ("reb" . ,(agda-input-to-string-list "▬▮")) ("rew" . ,(agda-input-to-string-list "▭▯")) ;; Parallelograms. ("pa" . ,(agda-input-to-string-list "▰▱")) ("pab" . ("▰")) ("paw" . ("▱")) ;; Diamonds. ("di" . ,(agda-input-to-string-list "◆◇◈")) ("dib" . ("◆")) ("diw" . ("◇")) ("di." . ("◈")) ;; Circles. ("ci" . ,(agda-input-to-string-list "●○◎◌◯◍◐◑◒◓◔◕◖◗◠◡◴◵◶◷⚆⚇⚈⚉")) ("cib" . ("●")) ("ciw" . ("○")) ("ci." . ("◎")) ("ci.." . ("◌")) ("ciO" . ("◯")) ;; Stars. ("st" . ,(agda-input-to-string-list "⋆✦✧✶✴✹ ★☆✪✫✯✰✵✷✸")) ("st4" . ,(agda-input-to-string-list "✦✧")) ("st6" . ("✶")) ("st8" . ("✴")) ("st12" . ("✹")) ;; Blackboard bold letters. ("bn" . ("ℕ")) ("bz" . ("ℤ")) ("bq" . ("ℚ")) ("br" . ("ℝ")) ("bc" . ("ℂ")) ("bp" . ("ℙ")) ("bb" . ("𝔹")) ("bsum" . ("⅀")) ;; Blackboard bold numbers. ("b0" . ("𝟘")) ("b1" . ("𝟙")) ("b2" . ("𝟚")) ("b3" . ("𝟛")) ("b4" . ("𝟜")) ("b5" . ("𝟝")) ("b6" . ("𝟞")) ("b7" . ("𝟟")) ("b8" . ("𝟠")) ("b9" . ("𝟡")) ;; Parentheses. ("(" . ,(agda-input-to-string-list "([{⁅⁽₍〈⎴⟅⟦⟨⟪⦃〈《「『【〔〖〚︵︷︹︻︽︿﹁﹃﹙﹛﹝([{「")) (")" . ,(agda-input-to-string-list ")]}⁆⁾₎〉⎵⟆⟧⟩⟫⦄〉》」』】〕〗〛︶︸︺︼︾﹀﹂﹄﹚﹜﹞)]}」")) ("[[" . ("⟦")) ("]]" . ("⟧")) ("<" . ("⟨")) (">" . ("⟩")) ("<<" . ("⟪")) (">>" . ("⟫")) ("{{" . ("⦃")) ("}}" . ("⦄")) ("(b" . ("⟅")) (")b" . ("⟆")) ("lbag" . ("⟅")) ("rbag" . ("⟆")) ;; Primes. ("'" . ,(agda-input-to-string-list "′″‴⁗")) ("`" . ,(agda-input-to-string-list "‵‶‷")) ;; Fractions. ("frac" . ,(agda-input-to-string-list "¼½¾⅓⅔⅕⅖⅗⅘⅙⅚⅛⅜⅝⅞⅟")) ;; Bullets. ("bu" . ,(agda-input-to-string-list "•◦‣⁌⁍")) ("bub" . ("•")) ("buw" . ("◦")) ("but" . ("‣")) ;; Musical symbols. ("note" . ,(agda-input-to-string-list "♩♪♫♬")) ("b" . ("♭")) ("#" . ("♯")) ;; Other punctuation and symbols. ("\\" . ("\\")) ("en" . ("–")) ("em" . ("—")) ("!!" . ("‼")) ("??" . ("⁇")) ("?!" . ("‽" "⁈")) ("!?" . ("⁉")) ("die" . ,(agda-input-to-string-list "⚀⚁⚂⚃⚄⚅")) ("asterisk" . ,(agda-input-to-string-list "⁎⁑⁂✢✣✤✥✱✲✳✺✻✼✽❃❉❊❋")) ("8<" . ("✂" "✄")) ("tie" . ("⁀")) ("undertie" . ("‿")) ("apl" . ,(agda-input-to-string-list "⌶⌷⌸⌹⌺⌻⌼⌽⌾⌿⍀⍁⍂⍃⍄⍅⍆⍇⍈ ⍉⍊⍋⍌⍍⍎⍏⍐⍑⍒⍓⍔⍕⍖⍗⍘⍙⍚⍛ ⍜⍝⍞⍟⍠⍡⍢⍣⍤⍥⍦⍧⍨⍩⍪⍫⍬⍭⍮ ⍯⍰⍱⍲⍳⍴⍵⍶⍷⍸⍹⍺⎕")) ;; Some combining characters. ;; ;; The following combining characters also have (other) ;; translations: ;; ̀ ́ ̂ ̃ ̄ ̆ ̇ ̈ ̋ ̌ ̣ ̧ ̱ ("^--" . ,(agda-input-to-string-list"̅̿")) ("_--" . ,(agda-input-to-string-list"̲̳")) ("^~" . ,(agda-input-to-string-list"̃͌")) ("_~" . ( "̰")) ("^." . ,(agda-input-to-string-list"̇̈⃛⃜")) ("_." . ,(agda-input-to-string-list"̣̤")) ("^l" . ,(agda-input-to-string-list"⃖⃐⃔")) ("^l-" . ( "⃖")) ("^r" . ,(agda-input-to-string-list"⃗⃑⃕")) ("^r-" . ( "⃗")) ("^lr" . ( "⃡")) ("_lr" . ( "͍")) ("^^" . ,(agda-input-to-string-list"̂̑͆")) ("_^" . ,(agda-input-to-string-list"̭̯̪")) ("^v" . ,(agda-input-to-string-list"̌̆")) ("_v" . ,(agda-input-to-string-list"̬̮̺")) ;; Shorter forms of many greek letters plus ƛ. ("Ga" . ("α")) ("GA" . ("Α")) ("Gb" . ("β")) ("GB" . ("Β")) ("Gg" . ("γ")) ("GG" . ("Γ")) ("Gd" . ("δ")) ("GD" . ("Δ")) ("Ge" . ("ε")) ("GE" . ("Ε")) ("Gz" . ("ζ")) ("GZ" . ("Ζ")) ;; \eta \Eta ("Gth" . ("θ")) ("GTH" . ("Θ")) ("Gi" . ("ι")) ("GI" . ("Ι")) ("Gk" . ("κ")) ("GK" . ("Κ")) ("Gl" . ("λ")) ("GL" . ("Λ")) ("Gl-" . ("ƛ")) ("Gm" . ("μ")) ("GM" . ("Μ")) ("Gn" . ("ν")) ("GN" . ("Ν")) ("Gx" . ("ξ")) ("GX" . ("Ξ")) ;; \omicron \Omicron ;; \pi \Pi ("Gr" . ("ρ")) ("GR" . ("Ρ")) ("Gs" . ("σ")) ("GS" . ("Σ")) ("Gt" . ("τ")) ("GT" . ("Τ")) ("Gu" . ("υ")) ("GU" . ("Υ")) ("Gf" . ("φ")) ("GF" . ("Φ")) ("Gc" . ("χ")) ("GC" . ("Χ")) ("Gp" . ("ψ")) ("GP" . ("Ψ")) ("Go" . ("ω")) ("GO" . ("Ω")) ;; Mathematical characters ("MiA" . ("𝐴")) ("MiB" . ("𝐵")) ("MiC" . ("𝐶")) ("MiD" . ("𝐷")) ("MiE" . ("𝐸")) ("MiF" . ("𝐹")) ("MiG" . ("𝐺")) ("MiH" . ("𝐻")) ("MiI" . ("𝐼")) ("MiJ" . ("𝐽")) ("MiK" . ("𝐾")) ("MiL" . ("𝐿")) ("MiM" . ("𝑀")) ("MiN" . ("𝑁")) ("MiO" . ("𝑂")) ("MiP" . ("𝑃")) ("MiQ" . ("𝑄")) ("MiR" . ("𝑅")) ("MiS" . ("𝑆")) ("MiT" . ("𝑇")) ("MiU" . ("𝑈")) ("MiV" . ("𝑉")) ("MiW" . ("𝑊")) ("MiX" . ("𝑋")) ("MiY" . ("𝑌")) ("MiZ" . ("𝑍")) ("Mia" . ("𝑎")) ("Mib" . ("𝑏")) ("Mic" . ("𝑐")) ("Mid" . ("𝑑")) ("Mie" . ("𝑒")) ("Mif" . ("𝑓")) ("Mig" . ("𝑔")) ("Mii" . ("𝑖")) ("Mij" . ("𝑗")) ("Mik" . ("𝑘")) ("Mil" . ("𝑙")) ("Mim" . ("𝑚")) ("Min" . ("𝑛")) ("Mio" . ("𝑜")) ("Mip" . ("𝑝")) ("Miq" . ("𝑞")) ("Mir" . ("𝑟")) ("Mis" . ("𝑠")) ("Mit" . ("𝑡")) ("Miu" . ("𝑢")) ("Miv" . ("𝑣")) ("Miw" . ("𝑤")) ("Mix" . ("𝑥")) ("Miy" . ("𝑦")) ("Miz" . ("𝑧")) ("MIA" . ("𝑨")) ("MIB" . ("𝑩")) ("MIC" . ("𝑪")) ("MID" . ("𝑫")) ("MIE" . ("𝑬")) ("MIF" . ("𝑭")) ("MIG" . ("𝑮")) ("MIH" . ("𝑯")) ("MII" . ("𝑰")) ("MIJ" . ("𝑱")) ("MIK" . ("𝑲")) ("MIL" . ("𝑳")) ("MIM" . ("𝑴")) ("MIN" . ("𝑵")) ("MIO" . ("𝑶")) ("MIP" . ("𝑷")) ("MIQ" . ("𝑸")) ("MIR" . ("𝑹")) ("MIS" . ("𝑺")) ("MIT" . ("𝑻")) ("MIU" . ("𝑼")) ("MIV" . ("𝑽")) ("MIW" . ("𝑾")) ("MIX" . ("𝑿")) ("MIY" . ("𝒀")) ("MIZ" . ("𝒁")) ("MIa" . ("𝒂")) ("MIb" . ("𝒃")) ("MIc" . ("𝒄")) ("MId" . ("𝒅")) ("MIe" . ("𝒆")) ("MIf" . ("𝒇")) ("MIg" . ("𝒈")) ("MIh" . ("𝒉")) ("MIi" . ("𝒊")) ("MIj" . ("𝒋")) ("MIk" . ("𝒌")) ("MIl" . ("𝒍")) ("MIm" . ("𝒎")) ("MIn" . ("𝒏")) ("MIo" . ("𝒐")) ("MIp" . ("𝒑")) ("MIq" . ("𝒒")) ("MIr" . ("𝒓")) ("MIs" . ("𝒔")) ("MIt" . ("𝒕")) ("MIu" . ("𝒖")) ("MIv" . ("𝒗")) ("MIw" . ("𝒘")) ("MIx" . ("𝒙")) ("MIy" . ("𝒚")) ("MIz" . ("𝒛")) ("McA" . ("𝒜")) ("McC" . ("𝒞")) ("McD" . ("𝒟")) ("McG" . ("𝒢")) ("McJ" . ("𝒥")) ("McK" . ("𝒦")) ("McN" . ("𝒩")) ("McO" . ("𝒪")) ("McP" . ("𝒫")) ("McQ" . ("𝒬")) ("McS" . ("𝒮")) ("McT" . ("𝒯")) ("McU" . ("𝒰")) ("McV" . ("𝒱")) ("McW" . ("𝒲")) ("McX" . ("𝒳")) ("McY" . ("𝒴")) ("McZ" . ("𝒵")) ("Mca" . ("𝒶")) ("Mcb" . ("𝒷")) ("Mcc" . ("𝒸")) ("Mcd" . ("𝒹")) ("Mcf" . ("𝒻")) ("Mch" . ("𝒽")) ("Mci" . ("𝒾")) ("Mcj" . ("𝒿")) ("Mck" . ("𝓀")) ("Mcl" . ("𝓁")) ("Mcm" . ("𝓂")) ("Mcn" . ("𝓃")) ("Mcp" . ("𝓅")) ("Mcq" . ("𝓆")) ("Mcr" . ("𝓇")) ("Mcs" . ("𝓈")) ("Mct" . ("𝓉")) ("Mcu" . ("𝓊")) ("Mcv" . ("𝓋")) ("Mcw" . ("𝓌")) ("Mcx" . ("𝓍")) ("Mcy" . ("𝓎")) ("Mcz" . ("𝓏")) ("MCA" . ("𝓐")) ("MCB" . ("𝓑")) ("MCC" . ("𝓒")) ("MCD" . ("𝓓")) ("MCE" . ("𝓔")) ("MCF" . ("𝓕")) ("MCG" . ("𝓖")) ("MCH" . ("𝓗")) ("MCI" . ("𝓘")) ("MCJ" . ("𝓙")) ("MCK" . ("𝓚")) ("MCL" . ("𝓛")) ("MCM" . ("𝓜")) ("MCN" . ("𝓝")) ("MCO" . ("𝓞")) ("MCP" . ("𝓟")) ("MCQ" . ("𝓠")) ("MCR" . ("𝓡")) ("MCS" . ("𝓢")) ("MCT" . ("𝓣")) ("MCU" . ("𝓤")) ("MCV" . ("𝓥")) ("MCW" . ("𝓦")) ("MCX" . ("𝓧")) ("MCY" . ("𝓨")) ("MCZ" . ("𝓩")) ("MCa" . ("𝓪")) ("MCb" . ("𝓫")) ("MCc" . ("𝓬")) ("MCd" . ("𝓭")) ("MCe" . ("𝓮")) ("MCf" . ("𝓯")) ("MCg" . ("𝓰")) ("MCh" . ("𝓱")) ("MCi" . ("𝓲")) ("MCj" . ("𝓳")) ("MCk" . ("𝓴")) ("MCl" . ("𝓵")) ("MCm" . ("𝓶")) ("MCn" . ("𝓷")) ("MCo" . ("𝓸")) ("MCp" . ("𝓹")) ("MCq" . ("𝓺")) ("MCr" . ("𝓻")) ("MCs" . ("𝓼")) ("MCt" . ("𝓽")) ("MCu" . ("𝓾")) ("MCv" . ("𝓿")) ("MCw" . ("𝔀")) ("MCx" . ("𝔁")) ("MCy" . ("𝔂")) ("MCz" . ("𝔃")) ("MfA" . ("𝔄")) ("MfB" . ("𝔅")) ("MfD" . ("𝔇")) ("MfE" . ("𝔈")) ("MfF" . ("𝔉")) ("MfG" . ("𝔊")) ("MfJ" . ("𝔍")) ("MfK" . ("𝔎")) ("MfL" . ("𝔏")) ("MfM" . ("𝔐")) ("MfN" . ("𝔑")) ("MfO" . ("𝔒")) ("MfP" . ("𝔓")) ("MfQ" . ("𝔔")) ("MfS" . ("𝔖")) ("MfT" . ("𝔗")) ("MfU" . ("𝔘")) ("MfV" . ("𝔙")) ("MfW" . ("𝔚")) ("MfX" . ("𝔛")) ("MfY" . ("𝔜")) ("Mfa" . ("𝔞")) ("Mfb" . ("𝔟")) ("Mfc" . ("𝔠")) ("Mfd" . ("𝔡")) ("Mfe" . ("𝔢")) ("Mff" . ("𝔣")) ("Mfg" . ("𝔤")) ("Mfh" . ("𝔥")) ("Mfi" . ("𝔦")) ("Mfj" . ("𝔧")) ("Mfk" . ("𝔨")) ("Mfl" . ("𝔩")) ("Mfm" . ("𝔪")) ("Mfn" . ("𝔫")) ("Mfo" . ("𝔬")) ("Mfp" . ("𝔭")) ("Mfq" . ("𝔮")) ("Mfr" . ("𝔯")) ("Mfs" . ("𝔰")) ("Mft" . ("𝔱")) ("Mfu" . ("𝔲")) ("Mfv" . ("𝔳")) ("Mfw" . ("𝔴")) ("Mfx" . ("𝔵")) ("Mfy" . ("𝔶")) ("Mfz" . ("𝔷")) ;; (Sub / Super) scripts ("_a" . ("ₐ")) ("_e" . ("ₑ")) ("_h" . ("ₕ")) ("_i" . ("ᵢ")) ("_j" . ("ⱼ")) ("_k" . ("ₖ")) ("_l" . ("ₗ")) ("_m" . ("ₘ")) ("_n" . ("ₙ")) ("_o" . ("ₒ")) ("_p" . ("ₚ")) ("_r" . ("ᵣ")) ("_s" . ("ₛ")) ("_t" . ("ₜ")) ("_u" . ("ᵤ")) ("_v" . ("ᵥ")) ("_x" . ("ₓ")) ("^a" . ("ᵃ")) ("^b" . ("ᵇ")) ("^c" . ("ᶜ")) ("^d" . ("ᵈ")) ("^e" . ("ᵉ")) ("^f" . ("ᶠ")) ("^g" . ("ᵍ")) ("^h" . ("ʰ")) ("^i" . ("ⁱ")) ("^j" . ("ʲ")) ("^k" . ("ᵏ")) ("^l" . ("ˡ")) ("^m" . ("ᵐ")) ("^n" . ("ⁿ")) ("^o" . ("ᵒ")) ("^p" . ("ᵖ")) ("^r" . ("ʳ")) ("^s" . ("ˢ")) ("^t" . ("ᵗ")) ("^u" . ("ᵘ")) ("^v" . ("ᵛ")) ("^w" . ("ʷ")) ("^x" . ("ˣ")) ("^y" . ("ʸ")) ("^z" . ("ᶻ")) ("^A" . ("ᴬ")) ("^B" . ("ᴮ")) ("^D" . ("ᴰ")) ("^E" . ("ᴱ")) ("^G" . ("ᴳ")) ("^H" . ("ᴴ")) ("^I" . ("ᴵ")) ("^J" . ("ᴶ")) ("^K" . ("ᴷ")) ("^L" . ("ᴸ")) ("^M" . ("ᴹ")) ("^N" . ("ᴺ")) ("^O" . ("ᴼ")) ("^P" . ("ᴾ")) ("^R" . ("ᴿ")) ("^T" . ("ᵀ")) ("^U" . ("ᵁ")) ("^V" . ("ⱽ")) ("^W" . ("ᵂ")) ;; Some ISO8859-1 characters. (" " . (" ")) ("!" . ("¡")) ("cent" . ("¢")) ("brokenbar" . ("¦")) ("degree" . ("°")) ("?" . ("¿")) ("^a_" . ("ª")) ("^o_" . ("º")) ;; Circled, parenthesised etc. numbers and letters. ( "(0)" . ,(agda-input-to-string-list " ⓪")) ( "(1)" . ,(agda-input-to-string-list "⑴①⒈❶➀➊")) ( "(2)" . ,(agda-input-to-string-list "⑵②⒉❷➁➋")) ( "(3)" . ,(agda-input-to-string-list "⑶③⒊❸➂➌")) ( "(4)" . ,(agda-input-to-string-list "⑷④⒋❹➃➍")) ( "(5)" . ,(agda-input-to-string-list "⑸⑤⒌❺➄➎")) ( "(6)" . ,(agda-input-to-string-list "⑹⑥⒍❻➅➏")) ( "(7)" . ,(agda-input-to-string-list "⑺⑦⒎❼➆➐")) ( "(8)" . ,(agda-input-to-string-list "⑻⑧⒏❽➇➑")) ( "(9)" . ,(agda-input-to-string-list "⑼⑨⒐❾➈➒")) ("(10)" . ,(agda-input-to-string-list "⑽⑩⒑❿➉➓")) ("(11)" . ,(agda-input-to-string-list "⑾⑪⒒")) ("(12)" . ,(agda-input-to-string-list "⑿⑫⒓")) ("(13)" . ,(agda-input-to-string-list "⒀⑬⒔")) ("(14)" . ,(agda-input-to-string-list "⒁⑭⒕")) ("(15)" . ,(agda-input-to-string-list "⒂⑮⒖")) ("(16)" . ,(agda-input-to-string-list "⒃⑯⒗")) ("(17)" . ,(agda-input-to-string-list "⒄⑰⒘")) ("(18)" . ,(agda-input-to-string-list "⒅⑱⒙")) ("(19)" . ,(agda-input-to-string-list "⒆⑲⒚")) ("(20)" . ,(agda-input-to-string-list "⒇⑳⒛")) ("(a)" . ,(agda-input-to-string-list "⒜Ⓐⓐ")) ("(b)" . ,(agda-input-to-string-list "⒝Ⓑⓑ")) ("(c)" . ,(agda-input-to-string-list "⒞Ⓒⓒ")) ("(d)" . ,(agda-input-to-string-list "⒟Ⓓⓓ")) ("(e)" . ,(agda-input-to-string-list "⒠Ⓔⓔ")) ("(f)" . ,(agda-input-to-string-list "⒡Ⓕⓕ")) ("(g)" . ,(agda-input-to-string-list "⒢Ⓖⓖ")) ("(h)" . ,(agda-input-to-string-list "⒣Ⓗⓗ")) ("(i)" . ,(agda-input-to-string-list "⒤Ⓘⓘ")) ("(j)" . ,(agda-input-to-string-list "⒥Ⓙⓙ")) ("(k)" . ,(agda-input-to-string-list "⒦Ⓚⓚ")) ("(l)" . ,(agda-input-to-string-list "⒧Ⓛⓛ")) ("(m)" . ,(agda-input-to-string-list "⒨Ⓜⓜ")) ("(n)" . ,(agda-input-to-string-list "⒩Ⓝⓝ")) ("(o)" . ,(agda-input-to-string-list "⒪Ⓞⓞ")) ("(p)" . ,(agda-input-to-string-list "⒫Ⓟⓟ")) ("(q)" . ,(agda-input-to-string-list "⒬Ⓠⓠ")) ("(r)" . ,(agda-input-to-string-list "⒭Ⓡⓡ")) ("(s)" . ,(agda-input-to-string-list "⒮Ⓢⓢ")) ("(t)" . ,(agda-input-to-string-list "⒯Ⓣⓣ")) ("(u)" . ,(agda-input-to-string-list "⒰Ⓤⓤ")) ("(v)" . ,(agda-input-to-string-list "⒱Ⓥⓥ")) ("(w)" . ,(agda-input-to-string-list "⒲Ⓦⓦ")) ("(x)" . ,(agda-input-to-string-list "⒳Ⓧⓧ")) ("(y)" . ,(agda-input-to-string-list "⒴Ⓨⓨ")) ("(z)" . ,(agda-input-to-string-list "⒵Ⓩⓩ")) )) "A list of translations specific to the Agda input method. Each element is a pair (KEY-SEQUENCE-STRING . LIST-OF-TRANSLATION-STRINGS). All the translation strings are possible translations of the given key sequence; if there is more than one you can choose between them using the arrow keys. Note that if you customize this setting you will not automatically benefit (or suffer) from modifications to its default value when the library is updated. If you just want to add some bindings it is probably a better idea to customize `agda-input-user-translations'. These translation pairs are included after those in `agda-input-user-translations', but before the ones inherited from other input methods (see `agda-input-inherit'). If you change this setting manually (without using the customization buffer) you need to call `agda-input-setup' in order for the change to take effect." :group 'agda-input :set 'agda-input-incorporate-changed-setting :initialize 'custom-initialize-default :type '(repeat (cons (string :tag "Key sequence") (repeat :tag "Translations" string)))) (defcustom agda-input-user-translations nil "Like `agda-input-translations', but more suitable for user customizations since by default it is empty. These translation pairs are included first, before those in `agda-input-translations' and the ones inherited from other input methods." :group 'agda-input :set 'agda-input-incorporate-changed-setting :initialize 'custom-initialize-default :type '(repeat (cons (string :tag "Key sequence") (repeat :tag "Translations" string)))) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Inspecting and modifying translation maps (defun agda-input-get-translations (qp) "Return a list containing all translations from the Quail package QP (except for those corresponding to ASCII). Each pair in the list has the form (KEY-SEQUENCE . TRANSLATION)." (with-temp-buffer (activate-input-method qp) ; To make sure that the package is loaded. (unless (quail-package qp) (error "%s is not a Quail package." qp)) (let ((decode-map (list 'decode-map))) (quail-build-decode-map (list (quail-map)) "" decode-map 0) (cdr decode-map)))) (defun agda-input-show-translations (qp) "Display all translations used by the Quail package QP (a string). \(Except for those corresponding to ASCII)." (interactive (list (read-input-method-name "Quail input method (default %s): " "Agda"))) (let ((buf (concat "*" qp " input method translations*"))) (with-output-to-temp-buffer buf (with-current-buffer buf (quail-insert-decode-map (cons 'decode-map (agda-input-get-translations qp))))))) (defun agda-input-add-translations (trans) "Add the given translations TRANS to the Agda input method. TRANS is a list of pairs (KEY-SEQUENCE . TRANSLATION). The translations are appended to the current translations." (with-temp-buffer (dolist (tr (agda-input-concat-map (eval agda-input-tweak-all) trans)) (quail-defrule (car tr) (cdr tr) "Agda" t)))) (defun agda-input-inherit-package (qp &optional fun) "Let the Agda input method inherit the translations from the Quail package QP (except for those corresponding to ASCII). The optional function FUN can be used to modify the translations. It is given a pair (KEY-SEQUENCE . TRANSLATION) and should return a list of such pairs." (let ((trans (agda-input-get-translations qp))) (agda-input-add-translations (if fun (agda-input-concat-map fun trans) trans)))) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Setting up the input method (defun agda-input-setup () "Set up the Agda input method based on the customisable variables and underlying input methods." ;; Create (or reset) the input method. (with-temp-buffer (quail-define-package "Agda" "UTF-8" "∏" t ; guidance "Agda input method. The purpose of this input method is to edit Agda programs, but since it is highly customisable it can be made useful for other tasks as well." nil nil nil nil nil nil t ; maximum-shortest )) (agda-input-add-translations (mapcar (lambda (tr) (cons (car tr) (vconcat (cdr tr)))) (append agda-input-user-translations agda-input-translations))) (dolist (def agda-input-inherit) (agda-input-inherit-package (car def) (eval (cdr def))))) (defun agda-input-incorporate-changed-setting (sym val) "Update the Agda input method based on the customisable variables and underlying input methods. Suitable for use in the :set field of `defcustom'." (set-default sym val) (agda-input-setup)) ;; Set up the input method. (agda-input-setup) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Administrative details (provide 'agda-input) ;;; agda-input.el ends here Agda-2.4.2.5/src/data/lib/0000755000000000000000000000000012635075266013166 5ustar0000000000000000Agda-2.4.2.5/src/data/lib/prim/0000755000000000000000000000000012635075266014135 5ustar0000000000000000Agda-2.4.2.5/src/data/lib/prim/Agda/0000755000000000000000000000000012635075266014771 5ustar0000000000000000Agda-2.4.2.5/src/data/lib/prim/Agda/Primitive.agda0000644000000000000000000000156512635075266017566 0ustar0000000000000000-- The Agda primitives (preloaded). module Agda.Primitive where ------------------------------------------------------------------------ -- Universe levels ------------------------------------------------------------------------ infixl 6 _⊔_ -- Level is the first thing we need to define. -- The other postulates can only be checked if built-in Level is known. postulate Level : Set -- MAlonzo compiles Level to (). This should be safe, because it is -- not possible to pattern match on levels. {-# COMPILED_TYPE Level () #-} {-# BUILTIN LEVEL Level #-} postulate lzero : Level lsuc : (ℓ : Level) → Level _⊔_ : (ℓ₁ ℓ₂ : Level) → Level {-# COMPILED lzero () #-} {-# COMPILED lsuc (\_ -> ()) #-} {-# COMPILED _⊔_ (\_ _ -> ()) #-} {-# BUILTIN LEVELZERO lzero #-} {-# BUILTIN LEVELSUC lsuc #-} {-# BUILTIN LEVELMAX _⊔_ #-}