MCPcopy Create free account
hub / github.com/agenticsorg/lean-agentic / test_structural_unification

Function test_structural_unification

lean-agentic/src/unification.rs:371–391  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

369
370 #[test]
371 fn test_structural_unification() {
372 let mut arena = Arena::new();
373 let env = Environment::new();
374 let ctx = Context::new();
375 let mut unifier = Unifier::new();
376
377 // App(?0, x) = App(y, x) => ?0 = y
378 let mvar0 = arena.mk_mvar(MetaVarId::new(0));
379 let x = arena.mk_var(0);
380 let y = arena.mk_var(1);
381
382 let app1 = arena.mk_app(mvar0, x);
383 let app2 = arena.mk_app(y, x);
384
385 unifier.unify(app1, app2);
386
387 unifier.solve(&mut arena, &env, &ctx).unwrap();
388
389 let assignment = unifier.substitution().lookup(MetaVarId::new(0)).unwrap();
390 assert_eq!(assignment, y);
391 }
392}

Callers

nothing calls this directly

Calls 7

mk_mvarMethod · 0.80
mk_varMethod · 0.80
mk_appMethod · 0.80
unifyMethod · 0.80
solveMethod · 0.80
substitutionMethod · 0.80
lookupMethod · 0.45

Tested by

no test coverage detected