use crate::term::{IndId, Level, Term};
use std::collections::HashMap;
#[derive(Debug, Clone)]
pub struct IndDesc {
pub arity: u64,
pub sort: Level,
pub param_tel: Term,
pub constructors: Vec<Term>,
}
#[derive(Debug, Clone)]
pub struct ConstDecl {
pub ty: Term,
pub body: Option<Term>,
}
#[derive(Debug, Default, Clone)]
pub struct Env {
inds: HashMap<IndId, IndDesc>,
consts: HashMap<u64, ConstDecl>,
}
impl Env {
pub fn new() -> Self { Self::default() }
pub fn insert(&mut self, id: IndId, desc: IndDesc) {
self.inds.insert(id, desc);
}
pub fn lookup(&self, id: IndId) -> Option<&IndDesc> {
self.inds.get(&id)
}
pub fn insert_const(&mut self, id: u64, decl: ConstDecl) {
self.consts.insert(id, decl);
}
pub fn lookup_const(&self, id: u64) -> Option<&ConstDecl> {
self.consts.get(&id)
}
}