query foreign_keys

typeside t
schema s : t
----------------------------------
query (foreign_keys s {
	f : A -> B where a = b
}) : s -> literal : typesideOf s {
	imports
		s
	foreign_keys
		f : A -> B}
	
Foreign keys from attributes. Given a schema with attributes only, such as an import gives, and declarations f : A -> B where a1 = b1 ... an = bn, a query from that schema to the same schema with the foreign keys added. A row of A is joined with the rows of B whose columns b1 ... bn equal its columns a1 ... an, and with the rows those reach in turn: a block has a variable for each path of foreign keys from its entity. Without path equations no two paths are equal, so declarations that branch and meet again multiply the variables of a block (a chain of k diamonds gives 2^k), and a cycle, which would give infinitely many, is refused. Path equations, written after the declarations as in a schema (path_equations A.ab.bd = A.ac.cd), are taken up to the target's prover, as the schema counts its own paths and as the query viewer's Neo4j tab walks them: a block has one variable for each path up to the equations, a row whose paths break an equation is left out, and a loop that an equation makes finite unfolds to its finitely many paths. When the paths up to the equations are infinitely many, the query runs until the timeout. The schema may not have foreign keys or equations of its own. The columns on the right should be a key of B: a row with no match is left out, and a row with two matches gives two rows. To check the keys first, state them as constraints and check them; to rename tables and columns after, use delta along a mapping into the schema of the result (schemaOf). Up to the columns it keeps, this is Pi along the mapping that sends each column on the left to the path through its foreign key to the column on the right (David Spivak's construction).

Appears in:


Options:

allow_empty_sorts_unsafe
always_reload
completion_compose
completion_filter_subsumed
completion_precedence
completion_sort
completion_syntactic_ac
completion_unfailing
dont_validate_unsafe
dont_verify_is_appropriate_for_prover_unsafe
e_path
e_use_auto
egglog_bound
egglog_path
maedmax_path
num_threads
program_allow_nonconfluence_unsafe
program_allow_nontermination_unsafe
prover
prover_simplify_max
second_prover
talg_reduction
timeout
triviality_check_best_effort
use_egglog_for_chase
vampire_path