Compare commits

..

20 commits

Author SHA1 Message Date
19e29759d2
rewrite enum_morphisms & find_morphism_path
- introduce `MorphismInstantiation` which instantiates a
  morphism-template using a type-substitution and a halo type.
- find_morphism_path returns list of `MorphismInstatiation`.
2025-02-15 18:39:48 +01:00
b0ebf49d03
pretty format: use different colors for variables 2025-02-15 18:39:48 +01:00
62a80fcd2f
morphism base: store vec of seq-types 2025-02-15 18:39:48 +01:00
75aaf096eb
fix tests 2025-02-15 18:39:48 +01:00
804c688f4c
pretty: output escape character for \0 and \n 2025-02-15 18:39:48 +01:00
2a8f7e0759
steiner tree: eliminate identity loops 2025-02-15 18:39:47 +01:00
32ca645778
add Send+Sync trait bound to TypeDict 2025-02-15 18:39:47 +01:00
b869c5f59f
fix find_morphism_path
* also apply substitution from src-type match
* get this substitution as result from `enum_morphisms_with_subtyping`
2025-02-15 18:39:47 +01:00
bc1941d1bc
check if term is empty 2025-02-15 18:39:47 +01:00
27a0ca5e56
add Debug for Bimap & BimapTypeDict 2025-02-15 18:39:47 +01:00
a144521566
make TypeDict a trait & BimapTypeDict an impl 2025-02-15 18:39:47 +01:00
d795ba45e9
add steiner tree solver based on shortest path 2025-02-15 18:39:47 +01:00
8e6885197a
initial implementation of solver for steiner trees 2025-02-15 18:39:47 +01:00
81e87f111a
morphism base: find shortest path instead of just some path 2025-02-15 18:39:47 +01:00
802480d089
fix returned halo type in find_morphism_with_subtyping() 2025-02-15 18:39:46 +01:00
a0f71b1223
turn Morphism into trait and add find_morphism() function 2025-02-15 18:39:46 +01:00
2ddd4c4a61
add test for find_morphism_path() 2025-02-15 18:39:46 +01:00
e962dfb41a
initial MorphismBase with DFS to find morphism paths 2025-02-15 18:39:46 +01:00
b502b62479
unification: reject non-identity loops & add test cases 2025-02-15 18:35:38 +01:00
f05ef07589
subtype unification 2025-02-15 18:32:34 +01:00
2 changed files with 2 additions and 1 deletions

View file

@ -132,6 +132,7 @@ fn test_unification() {
#[test]
fn test_subtype_unification() {
let mut dict = BimapTypeDict::new();
dict.add_varname(String::from("T"));
dict.add_varname(String::from("U"));
dict.add_varname(String::from("V"));

View file

@ -42,7 +42,6 @@ impl UnificationProblem {
match (lhs.clone(), rhs.clone()) {
(TypeTerm::TypeID(TypeID::Var(varid)), t) |
(t, TypeTerm::TypeID(TypeID::Var(varid))) => {
if ! t.contains_var( varid ) {
self.σ.insert(TypeID::Var(varid), t.clone());
self.reapply_subst();
@ -253,6 +252,7 @@ impl UnificationProblem {
let mut halo_type = TypeTerm::Ladder(halo_rungs);
halo_type = halo_type.normalize();
halo_type = halo_type.apply_substitution(&|k| self.σ.get(k).cloned()).clone();
Ok((halo_type.param_normalize(), self.σ))
}
}