1379 dummyT :: Typ |
1379 dummyT :: Typ |
1380 dummyT = Type (\<open>\<^type_name>\<open>dummy\<close>\<close>, []) |
1380 dummyT = Type (\<open>\<^type_name>\<open>dummy\<close>\<close>, []) |
1381 |
1381 |
1382 |
1382 |
1383 data Term = |
1383 data Term = |
1384 Const (String, Typ) |
1384 Const (String, [Typ]) |
1385 | Free (String, Typ) |
1385 | Free (String, Typ) |
1386 | Var (Indexname, Typ) |
1386 | Var (Indexname, Typ) |
1387 | Bound Int |
1387 | Bound Int |
1388 | Abs (String, Typ, Term) |
1388 | Abs (String, Typ, Term) |
1389 | App (Term, Term) |
1389 | App (Term, Term) |
1422 \case { TVar ((a, b), c) -> Just ([a, int_atom b], sort c); _ -> Nothing }] |
1422 \case { TVar ((a, b), c) -> Just ([a, int_atom b], sort c); _ -> Nothing }] |
1423 |
1423 |
1424 term :: T Term |
1424 term :: T Term |
1425 term t = |
1425 term t = |
1426 t |> variant |
1426 t |> variant |
1427 [\case { Const (a, b) -> Just ([a], typ b); _ -> Nothing }, |
1427 [\case { Const (a, b) -> Just ([a], list typ b); _ -> Nothing }, |
1428 \case { Free (a, b) -> Just ([a], typ b); _ -> Nothing }, |
1428 \case { Free (a, b) -> Just ([a], typ b); _ -> Nothing }, |
1429 \case { Var ((a, b), c) -> Just ([a, int_atom b], typ c); _ -> Nothing }, |
1429 \case { Var ((a, b), c) -> Just ([a, int_atom b], typ c); _ -> Nothing }, |
1430 \case { Bound a -> Just ([int_atom a], []); _ -> Nothing }, |
1430 \case { Bound a -> Just ([int_atom a], []); _ -> Nothing }, |
1431 \case { Abs (a, b, c) -> Just ([a], pair typ term (b, c)); _ -> Nothing }, |
1431 \case { Abs (a, b, c) -> Just ([a], pair typ term (b, c)); _ -> Nothing }, |
1432 \case { App a -> Just ([], pair term term a); _ -> Nothing }] |
1432 \case { App a -> Just ([], pair term term a); _ -> Nothing }] |
1462 \([a, b], c) -> TVar ((a, int_atom b), sort c)] |
1462 \([a, b], c) -> TVar ((a, int_atom b), sort c)] |
1463 |
1463 |
1464 term :: T Term |
1464 term :: T Term |
1465 term t = |
1465 term t = |
1466 t |> variant |
1466 t |> variant |
1467 [\([a], b) -> Const (a, typ b), |
1467 [\([a], b) -> Const (a, list typ b), |
1468 \([a], b) -> Free (a, typ b), |
1468 \([a], b) -> Free (a, typ b), |
1469 \([a, b], c) -> Var ((a, int_atom b), typ c), |
1469 \([a, b], c) -> Var ((a, int_atom b), typ c), |
1470 \([a], []) -> Bound (int_atom a), |
1470 \([a], []) -> Bound (int_atom a), |
1471 \([a], b) -> let (c, d) = pair typ term b in Abs (a, c, d), |
1471 \([a], b) -> let (c, d) = pair typ term b in Abs (a, c, d), |
1472 \([], a) -> App (pair term term a)] |
1472 \([], a) -> App (pair term term a)] |