-
Notifications
You must be signed in to change notification settings - Fork 3
/
alma_fif.h
62 lines (53 loc) · 2.04 KB
/
alma_fif.h
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
#ifndef alma_fif_h
#define alma_fif_h
#include "tommy.h"
#include "alma_formula.h"
#include "alma_kb.h"
#include "alma_clause.h"
#include "alma_proc.h"
#include "alma_print.h"
typedef struct fif_info {
int premise_count;
int *ordering; // Records the interleaving order of positive and negative literals
int num_conclusions; // Number of distinct clauses in fif conclusion
clause **conclusions; // List of clauses forming the conclusion(s)
alma_function *indexing_conc; // Predicate out of the conclusions that's used to index fif
} fif_info;
// Used to map set of fif clauses
typedef struct fif_mapping {
char *indexing_conc_name; // Key for hashing
int num_clauses;
clause **clauses;
tommy_node node;
} fif_mapping;
// Used to hold partial fif tasks in fif_tasks
typedef struct fif_task_mapping {
char *predname; // Key for hashing -- name/arity of next literal to unify
tommy_list tasks; // List of specific tasks per predname
tommy_node node;
} fif_task_mapping;
// Tasks contained in an fif_mapping's list
typedef struct fif_task {
clause *fif;
binding_list *bindings;
int premises_done;
int num_unified;
clause **unified_clauses;
int num_to_unify;
clause **to_unify;
int proc_next; // Boolean indicating next as a proc instead of unifiable
tommy_node node; // For storage in fif_mapping's list
} fif_task;
void fif_task_map_init(kb *collection, alma_proc *procs, tommy_hashlin *fif_tasks, clause *c, int init_to_unify);
void fif_tasks_from_clause(tommy_hashlin *fif_tasks, clause *c);
void process_fif_tasks(kb *collection, alma_proc *procs, kb_logger *logger);
void fif_to_front(tommy_array *clauses);
void free_fif_mapping(void *arg);
void free_fif_task(fif_task *task);
void free_fif_task_mapping(void *arg);
alma_function* fif_access(clause *c, int i);
void remove_fif_tasks(tommy_hashlin *fif_tasks, clause *c);
void remove_fif_singleton_tasks(tommy_hashlin *fif_tasks, tommy_hashlin *fif_map, clause *c);
int fifm_compare(const void *arg, const void *obj);
int fif_taskm_compare(const void *arg, const void *obj);
#endif