summaryrefslogtreecommitdiff
path: root/src/theory/context.rs
blob: 241cd9a15b2f8074050c54cd76cb2f9c62886206 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
use std::collections::{HashMap, HashSet};

pub struct TheoryContext {
    name: String,
    stages: HashMap<String, StageContext>,
}

pub struct StageContext {
    domain: RecordContext,
    codomain: RecordContext,
}

pub enum TheoryMorphismKind {
    Term,
    Dependency,
}

pub type TheoryType = String;
pub type TheoryMorphism = String;

pub struct CheckedPath {
    domain_type: TheoryType,
    codomain_type: TheoryType,
    path: Vec<TheoryMorphism>,
    kind: TheoryMorphismKind,
}

pub struct RecordContext {
    /// The types at issue.
    types: HashSet<TheoryType>,
    /// The known terms/dependencies.
    terms: Vec<CheckedPath>,
    /// Equalities between parallel composites indexed by their paired (domain,
    /// codomain) types.
    equality: HashMap<(TheoryType, TheoryType), (CheckedPath, CheckedPath)>,
    /// TODO
    bindings: HashMap<String, CheckedStageReference>,
}

pub struct CheckedStageReference {
    stage: String,
    via: Box<RecordContext>,
}