-
Notifications
You must be signed in to change notification settings - Fork 1
/
data.h
106 lines (82 loc) · 1.68 KB
/
data.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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
#include <stdbool.h>
#include <string.h>
typedef struct term
{
char* varorfunc;
bool isvar;
struct lst_term* liste;
} term;
typedef struct atom
{
char* praedikat;
struct lst_term* liste;
} atom;
typedef struct formel
{
atom* kopf;
struct lst_atom* liste;
} formel;
typedef struct unification
{
term* from;
term* to;
} unification;
/*Listen Verkettete Listen von:
Termen
Atomen
Formeln*/
typedef struct lst_term
{
term *data;
struct lst_term *next;
} lst_term;
typedef struct lst_atom
{
atom *data;
struct lst_atom *next;
} lst_atom;
typedef struct lst_formel
{
formel *data;
struct lst_formel *next;
} lst_formel;
typedef struct liste
{
lst_term *terme;
lst_atom *atome;
lst_formel *formeln;
} liste;
typedef struct lst_unification
{
unification* data;
struct lst_unification* next;
} lst_unification;
//#Term
lst_term* create_lst_term(term*);
lst_term* append_lst_term(lst_term*, term*);
//#Atom
atom* create_atom(char*, lst_term*);
lst_atom* create_lst_atom(atom*);
lst_atom* append_lst_atom(lst_atom*, atom*);
//#Formel
formel* create_formel(atom*, lst_atom*);
lst_formel* append_lst_formel(lst_formel*, formel*);
//#Print
void print_lst_formel(lst_formel*);
void print_formel(formel*);
void print_atom(atom*);
void print_lst_atom(lst_atom*);
void print_lst_term(lst_term*);
void print_term(term*);
void print_unification();
//#resulution
bool satisfiable(lst_formel*,lst_formel*);
bool resulution(lst_atom*,lst_formel*);
bool compare_atom(atom*, atom*);
int compare_term(term*, term*);
bool compare_lst_term(lst_term*, lst_term*);
//helper
void append_char(char*, char);
void add_unification(term*, term*);
term* has_unification(term*);
bool isVarInTerm(char*, lst_term*);