-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpatterns.h
118 lines (108 loc) · 4.6 KB
/
patterns.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
107
108
109
110
111
112
113
114
115
116
117
118
/***************************************************************************************
* The Patterns of Resemblance Arithmetic Library *
* *
* (By Samuel Alexander) *
* (Department of Mathematics) *
* (The Ohio State University) *
***************************************************************************************
* As seen in the Online Patterns of Resemblance Ordinal Calculator *
* For documentation, see http://www.semitrivial.com/patterns *
***************************************************************************************
* This library implements basic arithmetic for Timothy J. Carlson's Patterns of *
* Resemblance ordinal notation system. Patterns of resemblance are a combinatorial *
* way of notating very large ordinals (up to the ordinal of Pi^1_1-CA_0, to be *
* precise). The PORAL (Patterns of Resemblance Arithmetic Library) is a patterns *
* implementation in C. *
***************************************************************************************
* patterns.h *
***************************************************************************************
* Header file for the basic UI commands of the library. *
* In order to use functions from patterns.c in your own .c file, this header file is *
* the only header file that needs to be #included there. This arrangement minimizes *
* risk of library users running into naming conflicts between library functions and *
* functions in their own projects. *
**************************************************************************************/
#ifndef PATTERNS_H_INCLUDED
#define PATTERNS_H_INCLUDED
/*
* Typedefs
*/
typedef struct PATTERN pattern;
typedef struct NODE node;
/*
* Structures
*/
/*
* Pattern data structure --- the main data structure the library is concerned with
* Contains a linked list of nodes and a counter for that list; an id (autogenerated);
* and a designated node which is its "point". (Thus this is really a "pointed pattern",
* to be pedantic.)
*/
struct PATTERN
{
pattern *next;
pattern *prev;
node *first_node;
node *last_node;
int nodes;
int type;
char *id;
node *point;
};
/*
* Data structure for a single node in a pattern.
*
* The fields in most need of explanation are as follows.
* p: the pattern in which the node lives
* position: the number N such that this node is the Nth node in p
* decomposition: a NULL-terminated string of node *'s. The intended
* interpretation is that if the node has decomposition n_1 ... n_k,
* then it is a decomposable node, equal to the sum n_1 + ... + n_k.
* less1: the biggest node x such that this node is less1 x.
* (Cultural note: "less1" is how pattern theorists pronounce the
* symbol whose LaTeX code is \leq_1 or \preceq_1. Not to be confused
* with the symbol whose LaTeX is <_1 or \prec_1, which would be
* pronounced as "strictly less1".)
*/
struct NODE
{
node *next;
node *prev;
pattern *p;
char *id;
int position;
node **decomposition;
node *less1;
unsigned long natural;
int isnatural;
int simplify_data;
};
/*
* Simple error reporting.
*/
#define PATTERN_ERROR_BUFSIZE 8192
extern char global_pattern_error[PATTERN_ERROR_BUFSIZE+1];
extern pattern *pattern_too_large;
/*
* Function prototypes from patterns.c,
* not used anywhere else in the patterns library
* (these are mainly just "UI" functions, to give
* the library the barest standalone usability,
* the actual Patterns of Resemblance Calculator
* uses much more sophisticated functions.)
*/
pattern *new_pattern( int nodes );
pattern *pattern_sum( pattern *p, pattern *q );
pattern *pattern_product( pattern *p, pattern *q );
pattern *pattern_exponential( pattern *p );
pattern *pattern_logarithm( pattern *p );
int pattern_compare( pattern *p, pattern *q );
pattern *pattern_simplify( pattern *p );
pattern *pattern_amalgamate( pattern *p, pattern *q );
void patterns_initialize( void );
/*
* Function prototypes from patterns.c
* that are used elsewhere in the patterns library.
*/
pattern *copy_pattern( pattern *p );
#endif //Ends "#ifndef PATTERNS_H_INCLUDED"