MIR Formality Walkthrough -- coherence overlap check (2022-08-17)

A walkthrough of MIR formalities, exploring coherence overlap checks through trait impulse filtering, environment quantification, and solution validation.

Key takeaways
  • To check for coherence overlap, iterate over all crate items and filter for trait impulses.
  • The overlap check refuses to accept two exactly equal impulses.
  • The algorithm starts by making an environment for the program, which is then flattened and filtered to only include trait impulses.
  • The trait solver then checks for overlap using the definition of an impulse as a pair of a thing in parameters.
  • Impulse declarations are checked against each other, and if they are exactly equal, they are assumed to be the same impulse being compared.
  • Negative impulses are also handled by checking the parameters of each impulse declaration.
  • If two impulses are exactly equal, they must be considered separate impulses and reported as an error.
  • The environment is then quantified, and the algorithm checks if there is a solution to the problem.
  • A solution is considered valid if it can be proven using the given environment and rules. *ornment with parameters is then used to instantiate and unify all the variables in the environment, and the result is returned.
  • Impulse declarations are defined as a list of crates, where each crate is defined by a list of items, which can be either impulses or trait declarations.
  • To check for coherence overlap, the algorithm starts by extracting all the items from any crate, and then filters them to only include trait impulses.