{-# OPTIONS -w -O0 #-}
{-# LANGUAGE CPP, StandaloneDeriving, DeriveDataTypeable, DeriveGeneric #-}
{- |
Module      :  Hybrid/ATC_Hybrid.der.hs
Description :  generated ShATermConvertible, Json instances
Copyright   :  (c) DFKI GmbH 2012
License     :  GPLv2 or higher, see LICENSE.txt

Maintainer  :  Christian.Maeder@dfki.de
Stability   :  provisional
Portability :  non-portable(derive Typeable instances)

Automatic derivation of instances via DrIFT-rule ShATermConvertible, Json
  for the type(s):
'Hybrid.AS_Hybrid.H_BASIC_ITEM'
'Hybrid.AS_Hybrid.RIGOR'
'Hybrid.AS_Hybrid.H_SIG_ITEM'
'Hybrid.AS_Hybrid.MODALITY'
'Hybrid.AS_Hybrid.NOMINAL'
'Hybrid.AS_Hybrid.H_FORMULA'
'Hybrid.HybridSign.HybridSign'
-}

{-
Generated by 'genRules' (automatic rule generation for DrIFT). Don't touch!!
  dependency files:
Hybrid/AS_Hybrid.hs
Hybrid/HybridSign.hs
-}

module Hybrid.ATC_Hybrid () where

import ATerm.Lib
import CASL.AS_Basic_CASL
import CASL.ATC_CASL
import CASL.Sign
import Common.AS_Annotation
import Common.Id
import Common.Json.Instances
import Data.Aeson(ToJSON, FromJSON)
import Data.Data
import GHC.Generics(Generic)
import Hybrid.AS_Hybrid
import Hybrid.HybridSign
import qualified Common.Lib.MapSet as MapSet
import qualified Data.List as List
import qualified Data.Map as Map

{-! for Hybrid.AS_Hybrid.H_BASIC_ITEM derive : ShATermConvertible !-}
{-! for Hybrid.AS_Hybrid.RIGOR derive : ShATermConvertible !-}
{-! for Hybrid.AS_Hybrid.H_SIG_ITEM derive : ShATermConvertible !-}
{-! for Hybrid.AS_Hybrid.MODALITY derive : ShATermConvertible !-}
{-! for Hybrid.AS_Hybrid.NOMINAL derive : ShATermConvertible !-}
{-! for Hybrid.AS_Hybrid.H_FORMULA derive : ShATermConvertible !-}
{-! for Hybrid.HybridSign.HybridSign derive : ShATermConvertible !-}

{-! for Hybrid.AS_Hybrid.H_BASIC_ITEM derive : Json !-}
{-! for Hybrid.AS_Hybrid.RIGOR derive : Json !-}
{-! for Hybrid.AS_Hybrid.H_SIG_ITEM derive : Json !-}
{-! for Hybrid.AS_Hybrid.MODALITY derive : Json !-}
{-! for Hybrid.AS_Hybrid.NOMINAL derive : Json !-}
{-! for Hybrid.AS_Hybrid.H_FORMULA derive : Json !-}
{-! for Hybrid.HybridSign.HybridSign derive : Json !-}

-- Generated by DrIFT, look but don't touch!

instance ShATermConvertible Hybrid.AS_Hybrid.H_BASIC_ITEM where
  toShATermAux :: ATermTable -> H_BASIC_ITEM -> IO (ATermTable, Int)
toShATermAux att0 :: ATermTable
att0 xv :: H_BASIC_ITEM
xv = case H_BASIC_ITEM
xv of
    Simple_mod_decl a :: [Annoted SIMPLE_ID]
a b :: [AnHybFORM]
b c :: Range
c -> do
      (att1 :: ATermTable
att1, a' :: Int
a') <- ATermTable -> [Annoted SIMPLE_ID] -> IO (ATermTable, Int)
forall t.
ShATermConvertible t =>
ATermTable -> t -> IO (ATermTable, Int)
toShATerm' ATermTable
att0 [Annoted SIMPLE_ID]
a
      (att2 :: ATermTable
att2, b' :: Int
b') <- ATermTable -> [AnHybFORM] -> IO (ATermTable, Int)
forall t.
ShATermConvertible t =>
ATermTable -> t -> IO (ATermTable, Int)
toShATerm' ATermTable
att1 [AnHybFORM]
b
      (att3 :: ATermTable
att3, c' :: Int
c') <- ATermTable -> Range -> IO (ATermTable, Int)
forall t.
ShATermConvertible t =>
ATermTable -> t -> IO (ATermTable, Int)
toShATerm' ATermTable
att2 Range
c
      (ATermTable, Int) -> IO (ATermTable, Int)
forall (m :: * -> *) a. Monad m => a -> m a
return ((ATermTable, Int) -> IO (ATermTable, Int))
-> (ATermTable, Int) -> IO (ATermTable, Int)
forall a b. (a -> b) -> a -> b
$ ShATerm -> ATermTable -> (ATermTable, Int)
addATerm (String -> [Int] -> [Int] -> ShATerm
ShAAppl "Simple_mod_decl" [Int
a', Int
b', Int
c'] []) ATermTable
att3
    Term_mod_decl a :: [Annoted SORT]
a b :: [AnHybFORM]
b c :: Range
c -> do
      (att1 :: ATermTable
att1, a' :: Int
a') <- ATermTable -> [Annoted SORT] -> IO (ATermTable, Int)
forall t.
ShATermConvertible t =>
ATermTable -> t -> IO (ATermTable, Int)
toShATerm' ATermTable
att0 [Annoted SORT]
a
      (att2 :: ATermTable
att2, b' :: Int
b') <- ATermTable -> [AnHybFORM] -> IO (ATermTable, Int)
forall t.
ShATermConvertible t =>
ATermTable -> t -> IO (ATermTable, Int)
toShATerm' ATermTable
att1 [AnHybFORM]
b
      (att3 :: ATermTable
att3, c' :: Int
c') <- ATermTable -> Range -> IO (ATermTable, Int)
forall t.
ShATermConvertible t =>
ATermTable -> t -> IO (ATermTable, Int)
toShATerm' ATermTable
att2 Range
c
      (ATermTable, Int) -> IO (ATermTable, Int)
forall (m :: * -> *) a. Monad m => a -> m a
return ((ATermTable, Int) -> IO (ATermTable, Int))
-> (ATermTable, Int) -> IO (ATermTable, Int)
forall a b. (a -> b) -> a -> b
$ ShATerm -> ATermTable -> (ATermTable, Int)
addATerm (String -> [Int] -> [Int] -> ShATerm
ShAAppl "Term_mod_decl" [Int
a', Int
b', Int
c'] []) ATermTable
att3
    Simple_nom_decl a :: [Annoted SIMPLE_ID]
a b :: [AnHybFORM]
b c :: Range
c -> do
      (att1 :: ATermTable
att1, a' :: Int
a') <- ATermTable -> [Annoted SIMPLE_ID] -> IO (ATermTable, Int)
forall t.
ShATermConvertible t =>
ATermTable -> t -> IO (ATermTable, Int)
toShATerm' ATermTable
att0 [Annoted SIMPLE_ID]
a
      (att2 :: ATermTable
att2, b' :: Int
b') <- ATermTable -> [AnHybFORM] -> IO (ATermTable, Int)
forall t.
ShATermConvertible t =>
ATermTable -> t -> IO (ATermTable, Int)
toShATerm' ATermTable
att1 [AnHybFORM]
b
      (att3 :: ATermTable
att3, c' :: Int
c') <- ATermTable -> Range -> IO (ATermTable, Int)
forall t.
ShATermConvertible t =>
ATermTable -> t -> IO (ATermTable, Int)
toShATerm' ATermTable
att2 Range
c
      (ATermTable, Int) -> IO (ATermTable, Int)
forall (m :: * -> *) a. Monad m => a -> m a
return ((ATermTable, Int) -> IO (ATermTable, Int))
-> (ATermTable, Int) -> IO (ATermTable, Int)
forall a b. (a -> b) -> a -> b
$ ShATerm -> ATermTable -> (ATermTable, Int)
addATerm (String -> [Int] -> [Int] -> ShATerm
ShAAppl "Simple_nom_decl" [Int
a', Int
b', Int
c'] []) ATermTable
att3
  fromShATermAux :: Int -> ATermTable -> (ATermTable, H_BASIC_ITEM)
fromShATermAux ix :: Int
ix att0 :: ATermTable
att0 = case Int -> ATermTable -> ShATerm
getShATerm Int
ix ATermTable
att0 of
    ShAAppl "Simple_mod_decl" [a :: Int
a, b :: Int
b, c :: Int
c] _ ->
      case Int -> ATermTable -> (ATermTable, [Annoted SIMPLE_ID])
forall t.
ShATermConvertible t =>
Int -> ATermTable -> (ATermTable, t)
fromShATerm' Int
a ATermTable
att0 of
      { (att1 :: ATermTable
att1, a' :: [Annoted SIMPLE_ID]
a') ->
      case Int -> ATermTable -> (ATermTable, [AnHybFORM])
forall t.
ShATermConvertible t =>
Int -> ATermTable -> (ATermTable, t)
fromShATerm' Int
b ATermTable
att1 of
      { (att2 :: ATermTable
att2, b' :: [AnHybFORM]
b') ->
      case Int -> ATermTable -> (ATermTable, Range)
forall t.
ShATermConvertible t =>
Int -> ATermTable -> (ATermTable, t)
fromShATerm' Int
c ATermTable
att2 of
      { (att3 :: ATermTable
att3, c' :: Range
c') ->
      (ATermTable
att3, [Annoted SIMPLE_ID] -> [AnHybFORM] -> Range -> H_BASIC_ITEM
Simple_mod_decl [Annoted SIMPLE_ID]
a' [AnHybFORM]
b' Range
c') }}}
    ShAAppl "Term_mod_decl" [a :: Int
a, b :: Int
b, c :: Int
c] _ ->
      case Int -> ATermTable -> (ATermTable, [Annoted SORT])
forall t.
ShATermConvertible t =>
Int -> ATermTable -> (ATermTable, t)
fromShATerm' Int
a ATermTable
att0 of
      { (att1 :: ATermTable
att1, a' :: [Annoted SORT]
a') ->
      case Int -> ATermTable -> (ATermTable, [AnHybFORM])
forall t.
ShATermConvertible t =>
Int -> ATermTable -> (ATermTable, t)
fromShATerm' Int
b ATermTable
att1 of
      { (att2 :: ATermTable
att2, b' :: [AnHybFORM]
b') ->
      case Int -> ATermTable -> (ATermTable, Range)
forall t.
ShATermConvertible t =>
Int -> ATermTable -> (ATermTable, t)
fromShATerm' Int
c ATermTable
att2 of
      { (att3 :: ATermTable
att3, c' :: Range
c') ->
      (ATermTable
att3, [Annoted SORT] -> [AnHybFORM] -> Range -> H_BASIC_ITEM
Term_mod_decl [Annoted SORT]
a' [AnHybFORM]
b' Range
c') }}}
    ShAAppl "Simple_nom_decl" [a :: Int
a, b :: Int
b, c :: Int
c] _ ->
      case Int -> ATermTable -> (ATermTable, [Annoted SIMPLE_ID])
forall t.
ShATermConvertible t =>
Int -> ATermTable -> (ATermTable, t)
fromShATerm' Int
a ATermTable
att0 of
      { (att1 :: ATermTable
att1, a' :: [Annoted SIMPLE_ID]
a') ->
      case Int -> ATermTable -> (ATermTable, [AnHybFORM])
forall t.
ShATermConvertible t =>
Int -> ATermTable -> (ATermTable, t)
fromShATerm' Int
b ATermTable
att1 of
      { (att2 :: ATermTable
att2, b' :: [AnHybFORM]
b') ->
      case Int -> ATermTable -> (ATermTable, Range)
forall t.
ShATermConvertible t =>
Int -> ATermTable -> (ATermTable, t)
fromShATerm' Int
c ATermTable
att2 of
      { (att3 :: ATermTable
att3, c' :: Range
c') ->
      (ATermTable
att3, [Annoted SIMPLE_ID] -> [AnHybFORM] -> Range -> H_BASIC_ITEM
Simple_nom_decl [Annoted SIMPLE_ID]
a' [AnHybFORM]
b' Range
c') }}}
    u :: ShATerm
u -> String -> ShATerm -> (ATermTable, H_BASIC_ITEM)
forall a. String -> ShATerm -> a
fromShATermError "Hybrid.AS_Hybrid.H_BASIC_ITEM" ShATerm
u

instance ShATermConvertible Hybrid.AS_Hybrid.RIGOR where
  toShATermAux :: ATermTable -> RIGOR -> IO (ATermTable, Int)
toShATermAux att0 :: ATermTable
att0 xv :: RIGOR
xv = case RIGOR
xv of
    Rigid -> (ATermTable, Int) -> IO (ATermTable, Int)
forall (m :: * -> *) a. Monad m => a -> m a
return ((ATermTable, Int) -> IO (ATermTable, Int))
-> (ATermTable, Int) -> IO (ATermTable, Int)
forall a b. (a -> b) -> a -> b
$ ShATerm -> ATermTable -> (ATermTable, Int)
addATerm (String -> [Int] -> [Int] -> ShATerm
ShAAppl "Rigid" [] []) ATermTable
att0
    Flexible -> (ATermTable, Int) -> IO (ATermTable, Int)
forall (m :: * -> *) a. Monad m => a -> m a
return ((ATermTable, Int) -> IO (ATermTable, Int))
-> (ATermTable, Int) -> IO (ATermTable, Int)
forall a b. (a -> b) -> a -> b
$ ShATerm -> ATermTable -> (ATermTable, Int)
addATerm (String -> [Int] -> [Int] -> ShATerm
ShAAppl "Flexible" [] []) ATermTable
att0
  fromShATermAux :: Int -> ATermTable -> (ATermTable, RIGOR)
fromShATermAux ix :: Int
ix att0 :: ATermTable
att0 = case Int -> ATermTable -> ShATerm
getShATerm Int
ix ATermTable
att0 of
    ShAAppl "Rigid" [] _ -> (ATermTable
att0, RIGOR
Rigid)
    ShAAppl "Flexible" [] _ -> (ATermTable
att0, RIGOR
Flexible)
    u :: ShATerm
u -> String -> ShATerm -> (ATermTable, RIGOR)
forall a. String -> ShATerm -> a
fromShATermError "Hybrid.AS_Hybrid.RIGOR" ShATerm
u

instance ShATermConvertible Hybrid.AS_Hybrid.H_SIG_ITEM where
  toShATermAux :: ATermTable -> H_SIG_ITEM -> IO (ATermTable, Int)
toShATermAux att0 :: ATermTable
att0 xv :: H_SIG_ITEM
xv = case H_SIG_ITEM
xv of
    Rigid_op_items a :: RIGOR
a b :: [Annoted (OP_ITEM H_FORMULA)]
b c :: Range
c -> do
      (att1 :: ATermTable
att1, a' :: Int
a') <- ATermTable -> RIGOR -> IO (ATermTable, Int)
forall t.
ShATermConvertible t =>
ATermTable -> t -> IO (ATermTable, Int)
toShATerm' ATermTable
att0 RIGOR
a
      (att2 :: ATermTable
att2, b' :: Int
b') <- ATermTable -> [Annoted (OP_ITEM H_FORMULA)] -> IO (ATermTable, Int)
forall t.
ShATermConvertible t =>
ATermTable -> t -> IO (ATermTable, Int)
toShATerm' ATermTable
att1 [Annoted (OP_ITEM H_FORMULA)]
b
      (att3 :: ATermTable
att3, c' :: Int
c') <- ATermTable -> Range -> IO (ATermTable, Int)
forall t.
ShATermConvertible t =>
ATermTable -> t -> IO (ATermTable, Int)
toShATerm' ATermTable
att2 Range
c
      (ATermTable, Int) -> IO (ATermTable, Int)
forall (m :: * -> *) a. Monad m => a -> m a
return ((ATermTable, Int) -> IO (ATermTable, Int))
-> (ATermTable, Int) -> IO (ATermTable, Int)
forall a b. (a -> b) -> a -> b
$ ShATerm -> ATermTable -> (ATermTable, Int)
addATerm (String -> [Int] -> [Int] -> ShATerm
ShAAppl "Rigid_op_items" [Int
a', Int
b', Int
c'] []) ATermTable
att3
    Rigid_pred_items a :: RIGOR
a b :: [Annoted (PRED_ITEM H_FORMULA)]
b c :: Range
c -> do
      (att1 :: ATermTable
att1, a' :: Int
a') <- ATermTable -> RIGOR -> IO (ATermTable, Int)
forall t.
ShATermConvertible t =>
ATermTable -> t -> IO (ATermTable, Int)
toShATerm' ATermTable
att0 RIGOR
a
      (att2 :: ATermTable
att2, b' :: Int
b') <- ATermTable
-> [Annoted (PRED_ITEM H_FORMULA)] -> IO (ATermTable, Int)
forall t.
ShATermConvertible t =>
ATermTable -> t -> IO (ATermTable, Int)
toShATerm' ATermTable
att1 [Annoted (PRED_ITEM H_FORMULA)]
b
      (att3 :: ATermTable
att3, c' :: Int
c') <- ATermTable -> Range -> IO (ATermTable, Int)
forall t.
ShATermConvertible t =>
ATermTable -> t -> IO (ATermTable, Int)
toShATerm' ATermTable
att2 Range
c
      (ATermTable, Int) -> IO (ATermTable, Int)
forall (m :: * -> *) a. Monad m => a -> m a
return ((ATermTable, Int) -> IO (ATermTable, Int))
-> (ATermTable, Int) -> IO (ATermTable, Int)
forall a b. (a -> b) -> a -> b
$ ShATerm -> ATermTable -> (ATermTable, Int)
addATerm (String -> [Int] -> [Int] -> ShATerm
ShAAppl "Rigid_pred_items" [Int
a', Int
b', Int
c'] []) ATermTable
att3
  fromShATermAux :: Int -> ATermTable -> (ATermTable, H_SIG_ITEM)
fromShATermAux ix :: Int
ix att0 :: ATermTable
att0 = case Int -> ATermTable -> ShATerm
getShATerm Int
ix ATermTable
att0 of
    ShAAppl "Rigid_op_items" [a :: Int
a, b :: Int
b, c :: Int
c] _ ->
      case Int -> ATermTable -> (ATermTable, RIGOR)
forall t.
ShATermConvertible t =>
Int -> ATermTable -> (ATermTable, t)
fromShATerm' Int
a ATermTable
att0 of
      { (att1 :: ATermTable
att1, a' :: RIGOR
a') ->
      case Int -> ATermTable -> (ATermTable, [Annoted (OP_ITEM H_FORMULA)])
forall t.
ShATermConvertible t =>
Int -> ATermTable -> (ATermTable, t)
fromShATerm' Int
b ATermTable
att1 of
      { (att2 :: ATermTable
att2, b' :: [Annoted (OP_ITEM H_FORMULA)]
b') ->
      case Int -> ATermTable -> (ATermTable, Range)
forall t.
ShATermConvertible t =>
Int -> ATermTable -> (ATermTable, t)
fromShATerm' Int
c ATermTable
att2 of
      { (att3 :: ATermTable
att3, c' :: Range
c') ->
      (ATermTable
att3, RIGOR -> [Annoted (OP_ITEM H_FORMULA)] -> Range -> H_SIG_ITEM
Rigid_op_items RIGOR
a' [Annoted (OP_ITEM H_FORMULA)]
b' Range
c') }}}
    ShAAppl "Rigid_pred_items" [a :: Int
a, b :: Int
b, c :: Int
c] _ ->
      case Int -> ATermTable -> (ATermTable, RIGOR)
forall t.
ShATermConvertible t =>
Int -> ATermTable -> (ATermTable, t)
fromShATerm' Int
a ATermTable
att0 of
      { (att1 :: ATermTable
att1, a' :: RIGOR
a') ->
      case Int -> ATermTable -> (ATermTable, [Annoted (PRED_ITEM H_FORMULA)])
forall t.
ShATermConvertible t =>
Int -> ATermTable -> (ATermTable, t)
fromShATerm' Int
b ATermTable
att1 of
      { (att2 :: ATermTable
att2, b' :: [Annoted (PRED_ITEM H_FORMULA)]
b') ->
      case Int -> ATermTable -> (ATermTable, Range)
forall t.
ShATermConvertible t =>
Int -> ATermTable -> (ATermTable, t)
fromShATerm' Int
c ATermTable
att2 of
      { (att3 :: ATermTable
att3, c' :: Range
c') ->
      (ATermTable
att3, RIGOR -> [Annoted (PRED_ITEM H_FORMULA)] -> Range -> H_SIG_ITEM
Rigid_pred_items RIGOR
a' [Annoted (PRED_ITEM H_FORMULA)]
b' Range
c') }}}
    u :: ShATerm
u -> String -> ShATerm -> (ATermTable, H_SIG_ITEM)
forall a. String -> ShATerm -> a
fromShATermError "Hybrid.AS_Hybrid.H_SIG_ITEM" ShATerm
u

instance ShATermConvertible Hybrid.AS_Hybrid.MODALITY where
  toShATermAux :: ATermTable -> MODALITY -> IO (ATermTable, Int)
toShATermAux att0 :: ATermTable
att0 xv :: MODALITY
xv = case MODALITY
xv of
    Simple_mod a :: SIMPLE_ID
a -> do
      (att1 :: ATermTable
att1, a' :: Int
a') <- ATermTable -> SIMPLE_ID -> IO (ATermTable, Int)
forall t.
ShATermConvertible t =>
ATermTable -> t -> IO (ATermTable, Int)
toShATerm' ATermTable
att0 SIMPLE_ID
a
      (ATermTable, Int) -> IO (ATermTable, Int)
forall (m :: * -> *) a. Monad m => a -> m a
return ((ATermTable, Int) -> IO (ATermTable, Int))
-> (ATermTable, Int) -> IO (ATermTable, Int)
forall a b. (a -> b) -> a -> b
$ ShATerm -> ATermTable -> (ATermTable, Int)
addATerm (String -> [Int] -> [Int] -> ShATerm
ShAAppl "Simple_mod" [Int
a'] []) ATermTable
att1
    Term_mod a :: TERM H_FORMULA
a -> do
      (att1 :: ATermTable
att1, a' :: Int
a') <- ATermTable -> TERM H_FORMULA -> IO (ATermTable, Int)
forall t.
ShATermConvertible t =>
ATermTable -> t -> IO (ATermTable, Int)
toShATerm' ATermTable
att0 TERM H_FORMULA
a
      (ATermTable, Int) -> IO (ATermTable, Int)
forall (m :: * -> *) a. Monad m => a -> m a
return ((ATermTable, Int) -> IO (ATermTable, Int))
-> (ATermTable, Int) -> IO (ATermTable, Int)
forall a b. (a -> b) -> a -> b
$ ShATerm -> ATermTable -> (ATermTable, Int)
addATerm (String -> [Int] -> [Int] -> ShATerm
ShAAppl "Term_mod" [Int
a'] []) ATermTable
att1
  fromShATermAux :: Int -> ATermTable -> (ATermTable, MODALITY)
fromShATermAux ix :: Int
ix att0 :: ATermTable
att0 = case Int -> ATermTable -> ShATerm
getShATerm Int
ix ATermTable
att0 of
    ShAAppl "Simple_mod" [a :: Int
a] _ ->
      case Int -> ATermTable -> (ATermTable, SIMPLE_ID)
forall t.
ShATermConvertible t =>
Int -> ATermTable -> (ATermTable, t)
fromShATerm' Int
a ATermTable
att0 of
      { (att1 :: ATermTable
att1, a' :: SIMPLE_ID
a') ->
      (ATermTable
att1, SIMPLE_ID -> MODALITY
Simple_mod SIMPLE_ID
a') }
    ShAAppl "Term_mod" [a :: Int
a] _ ->
      case Int -> ATermTable -> (ATermTable, TERM H_FORMULA)
forall t.
ShATermConvertible t =>
Int -> ATermTable -> (ATermTable, t)
fromShATerm' Int
a ATermTable
att0 of
      { (att1 :: ATermTable
att1, a' :: TERM H_FORMULA
a') ->
      (ATermTable
att1, TERM H_FORMULA -> MODALITY
Term_mod TERM H_FORMULA
a') }
    u :: ShATerm
u -> String -> ShATerm -> (ATermTable, MODALITY)
forall a. String -> ShATerm -> a
fromShATermError "Hybrid.AS_Hybrid.MODALITY" ShATerm
u

instance ShATermConvertible Hybrid.AS_Hybrid.NOMINAL where
  toShATermAux :: ATermTable -> NOMINAL -> IO (ATermTable, Int)
toShATermAux att0 :: ATermTable
att0 xv :: NOMINAL
xv = case NOMINAL
xv of
    Simple_nom a :: SIMPLE_ID
a -> do
      (att1 :: ATermTable
att1, a' :: Int
a') <- ATermTable -> SIMPLE_ID -> IO (ATermTable, Int)
forall t.
ShATermConvertible t =>
ATermTable -> t -> IO (ATermTable, Int)
toShATerm' ATermTable
att0 SIMPLE_ID
a
      (ATermTable, Int) -> IO (ATermTable, Int)
forall (m :: * -> *) a. Monad m => a -> m a
return ((ATermTable, Int) -> IO (ATermTable, Int))
-> (ATermTable, Int) -> IO (ATermTable, Int)
forall a b. (a -> b) -> a -> b
$ ShATerm -> ATermTable -> (ATermTable, Int)
addATerm (String -> [Int] -> [Int] -> ShATerm
ShAAppl "Simple_nom" [Int
a'] []) ATermTable
att1
  fromShATermAux :: Int -> ATermTable -> (ATermTable, NOMINAL)
fromShATermAux ix :: Int
ix att0 :: ATermTable
att0 = case Int -> ATermTable -> ShATerm
getShATerm Int
ix ATermTable
att0 of
    ShAAppl "Simple_nom" [a :: Int
a] _ ->
      case Int -> ATermTable -> (ATermTable, SIMPLE_ID)
forall t.
ShATermConvertible t =>
Int -> ATermTable -> (ATermTable, t)
fromShATerm' Int
a ATermTable
att0 of
      { (att1 :: ATermTable
att1, a' :: SIMPLE_ID
a') ->
      (ATermTable
att1, SIMPLE_ID -> NOMINAL
Simple_nom SIMPLE_ID
a') }
    u :: ShATerm
u -> String -> ShATerm -> (ATermTable, NOMINAL)
forall a. String -> ShATerm -> a
fromShATermError "Hybrid.AS_Hybrid.NOMINAL" ShATerm
u

instance ShATermConvertible Hybrid.AS_Hybrid.H_FORMULA where
  toShATermAux :: ATermTable -> H_FORMULA -> IO (ATermTable, Int)
toShATermAux att0 :: ATermTable
att0 xv :: H_FORMULA
xv = case H_FORMULA
xv of
    At a :: NOMINAL
a b :: FORMULA H_FORMULA
b c :: Range
c -> do
      (att1 :: ATermTable
att1, a' :: Int
a') <- ATermTable -> NOMINAL -> IO (ATermTable, Int)
forall t.
ShATermConvertible t =>
ATermTable -> t -> IO (ATermTable, Int)
toShATerm' ATermTable
att0 NOMINAL
a
      (att2 :: ATermTable
att2, b' :: Int
b') <- ATermTable -> FORMULA H_FORMULA -> IO (ATermTable, Int)
forall t.
ShATermConvertible t =>
ATermTable -> t -> IO (ATermTable, Int)
toShATerm' ATermTable
att1 FORMULA H_FORMULA
b
      (att3 :: ATermTable
att3, c' :: Int
c') <- ATermTable -> Range -> IO (ATermTable, Int)
forall t.
ShATermConvertible t =>
ATermTable -> t -> IO (ATermTable, Int)
toShATerm' ATermTable
att2 Range
c
      (ATermTable, Int) -> IO (ATermTable, Int)
forall (m :: * -> *) a. Monad m => a -> m a
return ((ATermTable, Int) -> IO (ATermTable, Int))
-> (ATermTable, Int) -> IO (ATermTable, Int)
forall a b. (a -> b) -> a -> b
$ ShATerm -> ATermTable -> (ATermTable, Int)
addATerm (String -> [Int] -> [Int] -> ShATerm
ShAAppl "At" [Int
a', Int
b', Int
c'] []) ATermTable
att3
    BoxOrDiamond a :: Bool
a b :: MODALITY
b c :: FORMULA H_FORMULA
c d :: Range
d -> do
      (att1 :: ATermTable
att1, a' :: Int
a') <- ATermTable -> Bool -> IO (ATermTable, Int)
forall t.
ShATermConvertible t =>
ATermTable -> t -> IO (ATermTable, Int)
toShATerm' ATermTable
att0 Bool
a
      (att2 :: ATermTable
att2, b' :: Int
b') <- ATermTable -> MODALITY -> IO (ATermTable, Int)
forall t.
ShATermConvertible t =>
ATermTable -> t -> IO (ATermTable, Int)
toShATerm' ATermTable
att1 MODALITY
b
      (att3 :: ATermTable
att3, c' :: Int
c') <- ATermTable -> FORMULA H_FORMULA -> IO (ATermTable, Int)
forall t.
ShATermConvertible t =>
ATermTable -> t -> IO (ATermTable, Int)
toShATerm' ATermTable
att2 FORMULA H_FORMULA
c
      (att4 :: ATermTable
att4, d' :: Int
d') <- ATermTable -> Range -> IO (ATermTable, Int)
forall t.
ShATermConvertible t =>
ATermTable -> t -> IO (ATermTable, Int)
toShATerm' ATermTable
att3 Range
d
      (ATermTable, Int) -> IO (ATermTable, Int)
forall (m :: * -> *) a. Monad m => a -> m a
return ((ATermTable, Int) -> IO (ATermTable, Int))
-> (ATermTable, Int) -> IO (ATermTable, Int)
forall a b. (a -> b) -> a -> b
$ ShATerm -> ATermTable -> (ATermTable, Int)
addATerm (String -> [Int] -> [Int] -> ShATerm
ShAAppl "BoxOrDiamond" [Int
a', Int
b', Int
c', Int
d'] []) ATermTable
att4
    Here a :: NOMINAL
a b :: Range
b -> do
      (att1 :: ATermTable
att1, a' :: Int
a') <- ATermTable -> NOMINAL -> IO (ATermTable, Int)
forall t.
ShATermConvertible t =>
ATermTable -> t -> IO (ATermTable, Int)
toShATerm' ATermTable
att0 NOMINAL
a
      (att2 :: ATermTable
att2, b' :: Int
b') <- ATermTable -> Range -> IO (ATermTable, Int)
forall t.
ShATermConvertible t =>
ATermTable -> t -> IO (ATermTable, Int)
toShATerm' ATermTable
att1 Range
b
      (ATermTable, Int) -> IO (ATermTable, Int)
forall (m :: * -> *) a. Monad m => a -> m a
return ((ATermTable, Int) -> IO (ATermTable, Int))
-> (ATermTable, Int) -> IO (ATermTable, Int)
forall a b. (a -> b) -> a -> b
$ ShATerm -> ATermTable -> (ATermTable, Int)
addATerm (String -> [Int] -> [Int] -> ShATerm
ShAAppl "Here" [Int
a', Int
b'] []) ATermTable
att2
    Univ a :: NOMINAL
a b :: FORMULA H_FORMULA
b c :: Range
c -> do
      (att1 :: ATermTable
att1, a' :: Int
a') <- ATermTable -> NOMINAL -> IO (ATermTable, Int)
forall t.
ShATermConvertible t =>
ATermTable -> t -> IO (ATermTable, Int)
toShATerm' ATermTable
att0 NOMINAL
a
      (att2 :: ATermTable
att2, b' :: Int
b') <- ATermTable -> FORMULA H_FORMULA -> IO (ATermTable, Int)
forall t.
ShATermConvertible t =>
ATermTable -> t -> IO (ATermTable, Int)
toShATerm' ATermTable
att1 FORMULA H_FORMULA
b
      (att3 :: ATermTable
att3, c' :: Int
c') <- ATermTable -> Range -> IO (ATermTable, Int)
forall t.
ShATermConvertible t =>
ATermTable -> t -> IO (ATermTable, Int)
toShATerm' ATermTable
att2 Range
c
      (ATermTable, Int) -> IO (ATermTable, Int)
forall (m :: * -> *) a. Monad m => a -> m a
return ((ATermTable, Int) -> IO (ATermTable, Int))
-> (ATermTable, Int) -> IO (ATermTable, Int)
forall a b. (a -> b) -> a -> b
$ ShATerm -> ATermTable -> (ATermTable, Int)
addATerm (String -> [Int] -> [Int] -> ShATerm
ShAAppl "Univ" [Int
a', Int
b', Int
c'] []) ATermTable
att3
    Exist a :: NOMINAL
a b :: FORMULA H_FORMULA
b c :: Range
c -> do
      (att1 :: ATermTable
att1, a' :: Int
a') <- ATermTable -> NOMINAL -> IO (ATermTable, Int)
forall t.
ShATermConvertible t =>
ATermTable -> t -> IO (ATermTable, Int)
toShATerm' ATermTable
att0 NOMINAL
a
      (att2 :: ATermTable
att2, b' :: Int
b') <- ATermTable -> FORMULA H_FORMULA -> IO (ATermTable, Int)
forall t.
ShATermConvertible t =>
ATermTable -> t -> IO (ATermTable, Int)
toShATerm' ATermTable
att1 FORMULA H_FORMULA
b
      (att3 :: ATermTable
att3, c' :: Int
c') <- ATermTable -> Range -> IO (ATermTable, Int)
forall t.
ShATermConvertible t =>
ATermTable -> t -> IO (ATermTable, Int)
toShATerm' ATermTable
att2 Range
c
      (ATermTable, Int) -> IO (ATermTable, Int)
forall (m :: * -> *) a. Monad m => a -> m a
return ((ATermTable, Int) -> IO (ATermTable, Int))
-> (ATermTable, Int) -> IO (ATermTable, Int)
forall a b. (a -> b) -> a -> b
$ ShATerm -> ATermTable -> (ATermTable, Int)
addATerm (String -> [Int] -> [Int] -> ShATerm
ShAAppl "Exist" [Int
a', Int
b', Int
c'] []) ATermTable
att3
  fromShATermAux :: Int -> ATermTable -> (ATermTable, H_FORMULA)
fromShATermAux ix :: Int
ix att0 :: ATermTable
att0 = case Int -> ATermTable -> ShATerm
getShATerm Int
ix ATermTable
att0 of
    ShAAppl "At" [a :: Int
a, b :: Int
b, c :: Int
c] _ ->
      case Int -> ATermTable -> (ATermTable, NOMINAL)
forall t.
ShATermConvertible t =>
Int -> ATermTable -> (ATermTable, t)
fromShATerm' Int
a ATermTable
att0 of
      { (att1 :: ATermTable
att1, a' :: NOMINAL
a') ->
      case Int -> ATermTable -> (ATermTable, FORMULA H_FORMULA)
forall t.
ShATermConvertible t =>
Int -> ATermTable -> (ATermTable, t)
fromShATerm' Int
b ATermTable
att1 of
      { (att2 :: ATermTable
att2, b' :: FORMULA H_FORMULA
b') ->
      case Int -> ATermTable -> (ATermTable, Range)
forall t.
ShATermConvertible t =>
Int -> ATermTable -> (ATermTable, t)
fromShATerm' Int
c ATermTable
att2 of
      { (att3 :: ATermTable
att3, c' :: Range
c') ->
      (ATermTable
att3, NOMINAL -> FORMULA H_FORMULA -> Range -> H_FORMULA
At NOMINAL
a' FORMULA H_FORMULA
b' Range
c') }}}
    ShAAppl "BoxOrDiamond" [a :: Int
a, b :: Int
b, c :: Int
c, d :: Int
d] _ ->
      case Int -> ATermTable -> (ATermTable, Bool)
forall t.
ShATermConvertible t =>
Int -> ATermTable -> (ATermTable, t)
fromShATerm' Int
a ATermTable
att0 of
      { (att1 :: ATermTable
att1, a' :: Bool
a') ->
      case Int -> ATermTable -> (ATermTable, MODALITY)
forall t.
ShATermConvertible t =>
Int -> ATermTable -> (ATermTable, t)
fromShATerm' Int
b ATermTable
att1 of
      { (att2 :: ATermTable
att2, b' :: MODALITY
b') ->
      case Int -> ATermTable -> (ATermTable, FORMULA H_FORMULA)
forall t.
ShATermConvertible t =>
Int -> ATermTable -> (ATermTable, t)
fromShATerm' Int
c ATermTable
att2 of
      { (att3 :: ATermTable
att3, c' :: FORMULA H_FORMULA
c') ->
      case Int -> ATermTable -> (ATermTable, Range)
forall t.
ShATermConvertible t =>
Int -> ATermTable -> (ATermTable, t)
fromShATerm' Int
d ATermTable
att3 of
      { (att4 :: ATermTable
att4, d' :: Range
d') ->
      (ATermTable
att4, Bool -> MODALITY -> FORMULA H_FORMULA -> Range -> H_FORMULA
BoxOrDiamond Bool
a' MODALITY
b' FORMULA H_FORMULA
c' Range
d') }}}}
    ShAAppl "Here" [a :: Int
a, b :: Int
b] _ ->
      case Int -> ATermTable -> (ATermTable, NOMINAL)
forall t.
ShATermConvertible t =>
Int -> ATermTable -> (ATermTable, t)
fromShATerm' Int
a ATermTable
att0 of
      { (att1 :: ATermTable
att1, a' :: NOMINAL
a') ->
      case Int -> ATermTable -> (ATermTable, Range)
forall t.
ShATermConvertible t =>
Int -> ATermTable -> (ATermTable, t)
fromShATerm' Int
b ATermTable
att1 of
      { (att2 :: ATermTable
att2, b' :: Range
b') ->
      (ATermTable
att2, NOMINAL -> Range -> H_FORMULA
Here NOMINAL
a' Range
b') }}
    ShAAppl "Univ" [a :: Int
a, b :: Int
b, c :: Int
c] _ ->
      case Int -> ATermTable -> (ATermTable, NOMINAL)
forall t.
ShATermConvertible t =>
Int -> ATermTable -> (ATermTable, t)
fromShATerm' Int
a ATermTable
att0 of
      { (att1 :: ATermTable
att1, a' :: NOMINAL
a') ->
      case Int -> ATermTable -> (ATermTable, FORMULA H_FORMULA)
forall t.
ShATermConvertible t =>
Int -> ATermTable -> (ATermTable, t)
fromShATerm' Int
b ATermTable
att1 of
      { (att2 :: ATermTable
att2, b' :: FORMULA H_FORMULA
b') ->
      case Int -> ATermTable -> (ATermTable, Range)
forall t.
ShATermConvertible t =>
Int -> ATermTable -> (ATermTable, t)
fromShATerm' Int
c ATermTable
att2 of
      { (att3 :: ATermTable
att3, c' :: Range
c') ->
      (ATermTable
att3, NOMINAL -> FORMULA H_FORMULA -> Range -> H_FORMULA
Univ NOMINAL
a' FORMULA H_FORMULA
b' Range
c') }}}
    ShAAppl "Exist" [a :: Int
a, b :: Int
b, c :: Int
c] _ ->
      case Int -> ATermTable -> (ATermTable, NOMINAL)
forall t.
ShATermConvertible t =>
Int -> ATermTable -> (ATermTable, t)
fromShATerm' Int
a ATermTable
att0 of
      { (att1 :: ATermTable
att1, a' :: NOMINAL
a') ->
      case Int -> ATermTable -> (ATermTable, FORMULA H_FORMULA)
forall t.
ShATermConvertible t =>
Int -> ATermTable -> (ATermTable, t)
fromShATerm' Int
b ATermTable
att1 of
      { (att2 :: ATermTable
att2, b' :: FORMULA H_FORMULA
b') ->
      case Int -> ATermTable -> (ATermTable, Range)
forall t.
ShATermConvertible t =>
Int -> ATermTable -> (ATermTable, t)
fromShATerm' Int
c ATermTable
att2 of
      { (att3 :: ATermTable
att3, c' :: Range
c') ->
      (ATermTable
att3, NOMINAL -> FORMULA H_FORMULA -> Range -> H_FORMULA
Exist NOMINAL
a' FORMULA H_FORMULA
b' Range
c') }}}
    u :: ShATerm
u -> String -> ShATerm -> (ATermTable, H_FORMULA)
forall a. String -> ShATerm -> a
fromShATermError "Hybrid.AS_Hybrid.H_FORMULA" ShATerm
u

deriving instance GHC.Generics.Generic Hybrid.AS_Hybrid.H_BASIC_ITEM
instance Data.Aeson.ToJSON Hybrid.AS_Hybrid.H_BASIC_ITEM where
instance Data.Aeson.FromJSON Hybrid.AS_Hybrid.H_BASIC_ITEM where

deriving instance GHC.Generics.Generic Hybrid.AS_Hybrid.RIGOR
instance Data.Aeson.ToJSON Hybrid.AS_Hybrid.RIGOR where
instance Data.Aeson.FromJSON Hybrid.AS_Hybrid.RIGOR where

deriving instance GHC.Generics.Generic Hybrid.AS_Hybrid.H_SIG_ITEM
instance Data.Aeson.ToJSON Hybrid.AS_Hybrid.H_SIG_ITEM where
instance Data.Aeson.FromJSON Hybrid.AS_Hybrid.H_SIG_ITEM where

deriving instance GHC.Generics.Generic Hybrid.AS_Hybrid.MODALITY
instance Data.Aeson.ToJSON Hybrid.AS_Hybrid.MODALITY where
instance Data.Aeson.FromJSON Hybrid.AS_Hybrid.MODALITY where

deriving instance GHC.Generics.Generic Hybrid.AS_Hybrid.NOMINAL
instance Data.Aeson.ToJSON Hybrid.AS_Hybrid.NOMINAL where
instance Data.Aeson.FromJSON Hybrid.AS_Hybrid.NOMINAL where

deriving instance GHC.Generics.Generic Hybrid.AS_Hybrid.H_FORMULA
instance Data.Aeson.ToJSON Hybrid.AS_Hybrid.H_FORMULA where
instance Data.Aeson.FromJSON Hybrid.AS_Hybrid.H_FORMULA where

deriving instance GHC.Generics.Generic Hybrid.HybridSign.HybridSign
instance Data.Aeson.ToJSON Hybrid.HybridSign.HybridSign where
instance Data.Aeson.FromJSON Hybrid.HybridSign.HybridSign where

instance ShATermConvertible Hybrid.HybridSign.HybridSign where
  toShATermAux :: ATermTable -> HybridSign -> IO (ATermTable, Int)
toShATermAux att0 :: ATermTable
att0 xv :: HybridSign
xv = case HybridSign
xv of
    HybridSign a :: OpMap
a b :: PredMap
b c :: Map SIMPLE_ID [AnHybFORM]
c d :: Map SIMPLE_ID [AnHybFORM]
d e :: Map SORT [AnHybFORM]
e -> do
      (att1 :: ATermTable
att1, a' :: Int
a') <- ATermTable -> OpMap -> IO (ATermTable, Int)
forall t.
ShATermConvertible t =>
ATermTable -> t -> IO (ATermTable, Int)
toShATerm' ATermTable
att0 OpMap
a
      (att2 :: ATermTable
att2, b' :: Int
b') <- ATermTable -> PredMap -> IO (ATermTable, Int)
forall t.
ShATermConvertible t =>
ATermTable -> t -> IO (ATermTable, Int)
toShATerm' ATermTable
att1 PredMap
b
      (att3 :: ATermTable
att3, c' :: Int
c') <- ATermTable -> Map SIMPLE_ID [AnHybFORM] -> IO (ATermTable, Int)
forall t.
ShATermConvertible t =>
ATermTable -> t -> IO (ATermTable, Int)
toShATerm' ATermTable
att2 Map SIMPLE_ID [AnHybFORM]
c
      (att4 :: ATermTable
att4, d' :: Int
d') <- ATermTable -> Map SIMPLE_ID [AnHybFORM] -> IO (ATermTable, Int)
forall t.
ShATermConvertible t =>
ATermTable -> t -> IO (ATermTable, Int)
toShATerm' ATermTable
att3 Map SIMPLE_ID [AnHybFORM]
d
      (att5 :: ATermTable
att5, e' :: Int
e') <- ATermTable -> Map SORT [AnHybFORM] -> IO (ATermTable, Int)
forall t.
ShATermConvertible t =>
ATermTable -> t -> IO (ATermTable, Int)
toShATerm' ATermTable
att4 Map SORT [AnHybFORM]
e
      (ATermTable, Int) -> IO (ATermTable, Int)
forall (m :: * -> *) a. Monad m => a -> m a
return ((ATermTable, Int) -> IO (ATermTable, Int))
-> (ATermTable, Int) -> IO (ATermTable, Int)
forall a b. (a -> b) -> a -> b
$ ShATerm -> ATermTable -> (ATermTable, Int)
addATerm (String -> [Int] -> [Int] -> ShATerm
ShAAppl "HybridSign" [Int
a', Int
b', Int
c', Int
d',
                                               Int
e'] []) ATermTable
att5
  fromShATermAux :: Int -> ATermTable -> (ATermTable, HybridSign)
fromShATermAux ix :: Int
ix att0 :: ATermTable
att0 = case Int -> ATermTable -> ShATerm
getShATerm Int
ix ATermTable
att0 of
    ShAAppl "HybridSign" [a :: Int
a, b :: Int
b, c :: Int
c, d :: Int
d, e :: Int
e] _ ->
      case Int -> ATermTable -> (ATermTable, OpMap)
forall t.
ShATermConvertible t =>
Int -> ATermTable -> (ATermTable, t)
fromShATerm' Int
a ATermTable
att0 of
      { (att1 :: ATermTable
att1, a' :: OpMap
a') ->
      case Int -> ATermTable -> (ATermTable, PredMap)
forall t.
ShATermConvertible t =>
Int -> ATermTable -> (ATermTable, t)
fromShATerm' Int
b ATermTable
att1 of
      { (att2 :: ATermTable
att2, b' :: PredMap
b') ->
      case Int -> ATermTable -> (ATermTable, Map SIMPLE_ID [AnHybFORM])
forall t.
ShATermConvertible t =>
Int -> ATermTable -> (ATermTable, t)
fromShATerm' Int
c ATermTable
att2 of
      { (att3 :: ATermTable
att3, c' :: Map SIMPLE_ID [AnHybFORM]
c') ->
      case Int -> ATermTable -> (ATermTable, Map SIMPLE_ID [AnHybFORM])
forall t.
ShATermConvertible t =>
Int -> ATermTable -> (ATermTable, t)
fromShATerm' Int
d ATermTable
att3 of
      { (att4 :: ATermTable
att4, d' :: Map SIMPLE_ID [AnHybFORM]
d') ->
      case Int -> ATermTable -> (ATermTable, Map SORT [AnHybFORM])
forall t.
ShATermConvertible t =>
Int -> ATermTable -> (ATermTable, t)
fromShATerm' Int
e ATermTable
att4 of
      { (att5 :: ATermTable
att5, e' :: Map SORT [AnHybFORM]
e') ->
      (ATermTable
att5, OpMap
-> PredMap
-> Map SIMPLE_ID [AnHybFORM]
-> Map SIMPLE_ID [AnHybFORM]
-> Map SORT [AnHybFORM]
-> HybridSign
HybridSign OpMap
a' PredMap
b' Map SIMPLE_ID [AnHybFORM]
c' Map SIMPLE_ID [AnHybFORM]
d' Map SORT [AnHybFORM]
e') }}}}}
    u :: ShATerm
u -> String -> ShATerm -> (ATermTable, HybridSign)
forall a. String -> ShATerm -> a
fromShATermError "Hybrid.HybridSign.HybridSign" ShATerm
u