Debian Codegraph @

texmf-dist/doc/latex/objectz/oztest.tex

raw
1 \documentclass[11pt]{article}
2 \usepackage{oz}
3 \def\Out#1{#1 \!\!\rightarrow}
4 \def\In#1{\rightarrow\!\! #1}
5 \begin{document}
6
7 Multi-letter identifiers have been changed to look
8 better than they do with vanilla \LaTeX: instead of
9 $\mathit{specifications}$, you get $specifications$.
10 The letters haven't been spread apart, and the
11 ligature $fi$ has been used.
12
13 {\tt This is in typewriter font}
14
15
16 \begin{schema}{BirthdayBook}
17 known: \pset NAME \\
18 birthday: NAME \pfun DATE
19 \ST
20 known = \dom birthday
21 \end{schema}
22
23 \begin{axdef}
24 limit : \nat
25 \ST
26 limit \leq 65536
27 \end{axdef}
28
29 \begin{class}{Shape}
30 \also
31 colour : Colour \\
32 \end{class}
33
34 \begin{axdef}
35 perim : \real
36 \ST
37 perim > 0
38 \end{axdef}
39
40 \begin{axdef}
41 ini:State \cross Occ \cross T \fun Bool
42 \where
43 \forall S:State, i: Occ, t:T \dot ini(S,i,t) \iff \\
44 \t1 \theta(\Out{S}, 1,0)\land\\
45 \t2 \exi t_{1}:T \dot \theta(\In{S},i,t_{1}) \land
46 t_{1}\leq t \land \forall t_{2}:T \dot t_{2} < t \imp \neg \theta(\Out{S},i+1,t_{2}
47 )\\
48 \t1 \lor \theta(\In{S}, 1,0)\land\\
49 \t2 \exi t_{1}:T \dot \theta(\In{S},i,t_{1}) \land
50 t_{1}\leq t \land \forall t_{2}:T \dot t_{2} < t \imp \neg
51 \theta(\Out{S},i,t_{2})
52 \end{axdef}
53
54 Let us see if \verb|zbreak| works:
55 \typeout{*************************************}
56 \typeout{If you get large overfull vboxes now, Oz is not working}
57 \typeout{*************************************}
58
59 \def \comm{\comment}
60
61 \begin{schema}{MakePlan}
62 c? : Company \comm{The company that is making the plan}\\
63 t? : Month \comm{Time period} \\
64 \Xi NFMM \\
65 \Xi AttrOfMarkets \comm{OpenMarkets} \\
66 \Xi Cost \\
67 \Xi AttrOfEconomy \comm{Buying and selling price of quota }\\
68 \Xi AttrOfQuota \\
69 \Xi AttrOfProduction \\
70 \Xi FishingLimitations \\
71 Plans! : Company \fun Plan \comm{The output is the plan for
72 the company} \\
73 \zbreak
74 \where
75 \forall v: Vessel; f: Fishery; s: QuotaStock; p: Product; \\
76 \t0 l: Landing; t: Month; i: Input @ \\
77 \t0 \exists plan: Plan; Months: \power Month; \\
78 \t0 vs : \power Vessel; fs: \power Fishery ; qs: \power QuotaStock; ls: \power Landing; \\
79 \t0 ps : \power Product; \\
80 \t0 catch: Vessel \cross Fishery \cross QuotaStock \pfun Tons; \\
81 \t0 MAXnet\_profit:Kronur; fishing\_cost:Kronur; \\
82 \t1 production\_earnings:Kronur; \\
83 \t1 production\_cost:Kronur; quota\_trading\_profit:Kronur; \\
84 \t0 fishing\_days: Vessel \cross Fishery \cross Month \pfun \nat; \\
85 \t0 value\_landing: Vessel \fun Kronur; \\
86 \t0 export: Vessel \cross Landing \cross Month \pfun Tons; \\
87 \t1 trade\_in, trade\_out: Landing \cross Month \pfun Tons; \\
88 \t1 prod: Product \cross Month \fun Tons; \\
89 \t0 quota\_rent\_in, quota\_rent\_out, quota\_next\_to, \\
90 \t1 quota\_next\_from, quota\_exch\_to, quota\_exch\_from,\\
91 \t1 quota\_trans\_from, quota\_trans\_to: Vessel \cross QuotaStock \pfun Tons; \\
92 \t0 ExchangeCharge: \num; \comm{charge for changing one species into another} \\
93 \t0 quota\_used: Vessel \cross QuotaStock \pfun Tons @ \\
94 \zbreak
95 \t0 Plans! = Plans! \oplus \{c? \mapsto plan \} \land \\
96 \t0 Months = t? \upto 12 \land \\
97 \t0 i \in Inputs \land \\
98 \t0 vs = Vessels ~ c? \land v \in vs \land\\
99 \t0 fs = \{f: Fishery | f \in \\
100 \t1 (\bigcup \{ v: Vessel | v \in vs @ Fisheries(v) \}) @ f \} \land f \in fs \land \\
101 \t0 qs = \{s: QuotaStock; f: Fishery | \\
102 \t1 f \in fs \land s \in QuotaStocks (f) @ s \} \land s \in qs \land \\
103 \t0 ls = \{s: QuotaStock; f: Fishery | f \in fs \land s \in qs @ \\
104 \t1 Landings~(f,s) \} \land l \in ls \land \\
105 \t0 ps = \{p: Product | \\
106 \t1 p \in \bigcup \{ fa: Factory | fa \in Factories~c? @ Products(fa) \} @ p \} \land \\
107 \t0 p \in ps \land \\
108 \comm{The overall goal is to maximize net profits} \\
109 \t0 MAXnet\_profit = -fishing\_cost+production\_earnings + \\
110 \t1 -production\_cost + quota\_trading\_profit \land \comm{A.1}\\
111 \t0 catch ~(v,f,s) = ExpCatch~(v,f,s)* \comm{A.4}\\
112 \t1 \sum_{t: Month | t \in Months} fishing\_days~(v,f,t) \land \\
113 \comm{One of the prices LandingPrice or ExportPrice is always zero for any l} \\
114 \t0 (\forall l | l \in ls @ LandingPrice (l) = 0 \lor ExportPrice(l) = 0 \land \\
115 \t1 LandingPrice(l) \neq ExportPrice(l) ) \land \\
116 \t0 value\_landing= \comm{A.3} \\
117 \t1 \{v: Vessel | v \in vs @ v \mapsto \\
118 \t1 \sum_{ l: Landing | l \in ls} LandingPrice (l)* ExportPriceConst(l) * \\
119 \t1 \sum_{f: Fishery | f \in fs} \sum_{s: QuotaStock | s \in qs} (SpeciesToLandings~(s,f,l) *(catch~(v,f,s)) \}\land \\
120 \t0 fishing\_cost = \sum_{v: Vessel | v \in vs} Share (v)*value\_landing(v) + \comm{A.2}\\
121 \t1 \sum_{ f: Fishery | f \in fs} CostFishDay ~ (v, f) * \\
122 \t1 \sum_{t: Month | t \in Months} fishing\_days~(v,f,t) \land \\
123 \zbreak
124 \t0 production\_earnings = \comm{A.5}\\
125 \t1 \sum_{l: Landing | l \in ls} \sum_{ t: Month | t \in Months} \\
126 \t3 (ExportPrice~(l,t))*(1-0.002)*t)* \\
127 \t3 \sum_{v: Vessel | v \in vs} export~(v,l,t) \\
128 \t1 -WetfishBuyingPrice(l) * (1-0.002)*t)*trade\_in~(l,t) \\
129 \t1 +WetfishSellingPrice(l) * (1-0.002)*t)*trade\_out~(l,t) \\
130 \t1 +\sum_{p: Product | p \in ps} ProductPrice~(p,t) *(1-0.002)*t)* \\
131 \t1 \sum_{t:Month | t \in Months} prod~ (p,t) \land \\
132 \t0 production\_cost = \sum_{i: Input | i \in Inputs} InputCost(i)* \comm{A.6}\\
133 \t1 \sum_{p: Product | p \in ps} InputForProduct(p,i) * \\
134 \t1 \sum_{ t: Month | t \in Months} prod(p,t) \land \\
135 \t0 ExchangeCharge = 0.005*NextPrice(s) \land \\
136 \t0 quota\_trading\_profit = -(\sum_{s: QuotaStock | s \in qs } QuotaRentInPrice(s) * \\
137 \t1 \sum_{v: Vessel | v \in vs } quota\_rent\_in~(v,s) ) \comm{A.7}\\
138 \t1 + \sum_{s: QuotaStock | s \in qs } QuotaRentOutPrice(s)* \\
139 \t1 \sum_{v: Vessel | v \in vs } quota\_rent\_out~(v,s) \\
140 \t1 + \sum_{s: QuotaStock | s \in qs } NextCharge *NextPrice(s)*(1-InterestRate)* \\
141 \t1 \sum_{v: Vessel | v \in vs } quota\_next\_to~(v,s) \\
142 \t1 + \sum_{s: QuotaStock | s \in qs } NextPrice(s)*(1-InterestRate) * \\
143 \t1 \sum_{v: Vessel | v \in vs } quota\_next\_from~(v,s) \\
144 \t1 -ExchangeCharge*\sum_{v: Vessel | v \in vs }\sum_{s: QuotaStock | s \in qs } quota\_exch\_to(v,s) \\
145 \t1 -TransferCharge*\sum_{v: Vessel | v \in vs }\sum_{s: QuotaStock | s \in qs } quota\_trans\_to~(v,s) \land \\
146 \t0 \sum_{ f: Fishery | f \in fs } fishing\_days~(v,f,t) \leq MaxTotFishingDays ~(v,t) \land \comm{A.9}\\
147 \comm{A.6.1 Constraints on fishing time } \\
148 \t0 l \in ExportLandings \implies \\
149 \t1 \sum_{f: Fishery | f \in fs } \sum_{s: QuotaStock | s \in qs } \comm{A.10} \\
150 \t2 SpeciesToLandings~(s,f,l) * ExpCatch (v,f,s)*fishing\_days(v,f,t) = \\
151 \t3 export~(v,l,t) \land \\
152 \comm{A.6.2 Processing and selling the catch } \\
153 \t0 l \notin ExportLandings \implies \\
154 \t1 \sum_{v: Vessel | v \in vs } \sum_{f: Fishery | f \in fs } \sum_{s: QuotaStock | s \in qs } \\
155 \t2 SpeciesToLandings~(s,f,l)*ExpCatch~(v,f,s)*fishing\_days~(v,f,t) \\
156 \t1 = (1 / LandingsToProducts~(p,l)) * prod~(p,t) - trade\_in~(l,t) + trade\_out(l,t) \land \comm{A.11}\\
157 \zbreak
158 \t0 \sum_{t: Month | t \in Months } \sum_{p:Product | p \in ps }InputForProduct(p,i)*prod(p,t) \\
159 \t1 \leq \sum_{i : Input | i \in Inputs } MaxInput~(i,t) \land \comm{A.13}\\
160 \t0 \sum_{t: Month | t \in Months } \sum_{p: Product | p \in ps } InputForProduct(p,i)*prod~(p,t) \\
161 \t1 \geq \sum_{i: Input | i \in Inputs } MinInput~(i,t) \land \comm{A.14}\\
162 \t0 \sum_{t: Month | t \in Months } export~(v,l,t) \leq MaxExport~(v,l) \land \comm{A.15}\\
163 \comm{A.6.3 Constraints because of quota restrictions } \\
164 \t0 quota\_used = \comm{A.17} \\
165 \t1 \{ v:Vessel; s: QuotaStock | v \in vs \land s \in qs @ \\
166 \t2 (v,s) \mapsto \sum_{f: Fishery | f \in fs } (1+QuotaSurcharge~(s,f))* \\
167 \t2 catch~(v,f,s) \} \land \\
168 \t0 \sum_{v: Vessel | v \in vs } quota\_trans\_to(v,s)- quota\_trans\_from(v,s) =0 \land \comm{A.18} \\
169 \t0 quota\_used(v,s) - quota\_rent\_in(v,s) + quota\_rent\_out(v,s) - \comm{A.16} \\
170 \t1 quota\_exch\_to(v,s) + quota\_exch\_from(v,s) - \\
171 \t1 quota\_trans\_to(v,s) + quota\_trans\_from(v,s) - \\
172 \t1 quota\_next\_to~(v,s) + quota\_next\_from~(v,s) \leq QuotaLeft~(v,s) \land \\
173 \t0 s = Cod \implies MaxQuotaInto(v,s) = 0 \land \comm{A.19}\\
174 \t0 s \neq Cod \implies MaxQuotaInto(v,s) = 0.05*QuotaAllocated(v,s) \land \\
175 \t1 QuotaValueInto(s)*quota\_exch\_to(v,s) \leq \\
176 \t2 \sum_{s: QuotaStock | s \in qs } MaxQuotaInto~(v,s) \land \\
177 \t0 \sum_{s: QuotaStock | s \in qs } QuotaValueInto (s)*quota\_exch\_to~(v,s) - \comm{A.20}\\
178 \t1 \sum_{s: QuotaStock | s \in qs } QuotaValueFrom(s)* quota\_exch\_from~(v,s) = 0 \land \\
179 \t0 quota\_next\_from(v,s) \leq (QuotaOver(v,s) / 100)*QuotaAllocated(v,s) \land \comm{A.21}\\
180 \t0 quota\_next\_to~(v,s) \leq (QuotaUnder(v,s) / 100)*QuotaAllocated(v,s) \land \comm{A.22} \\
181 \zbreak
182 \comm{Bounds} \\
183 \t0 fishing\_days~(v,f,t) \leq MaxFishingDays~(f,t) \land \comm{A.23}\\
184 \t0 QuotaAllocated~(v,s) = 0 \implies \\
185 \t1 (quota\_exch\_to~(v,s) = 0 \land \comm{A.24}\\
186 \t1 quota\_rent\_in~(v,s) = 0 \land \comm{A.25}\\
187 \t1 quota\_trans\_to~(v,s) = 0) \land \comm{A.26} \\
188 \t0 QuotaValueInto~s = 0 \implies quota\_exch\_to~(v,s) = 0 \land \comm{A.27}\\
189 \t0 QuotaValueFrom~s = 0 \implies quota\_exch\_from~(v,s) = 0 \comm{A.28}\\
190 \zbreak
191 \t0 plan.c = c? \
192 \t0 plan.fishing\_days = fishing\_days \land
193 \t0 plan.quota\_rent\_out = quota\_rent\_out \land \\
194 \t0 plan.quota\_rent\_in = quota\_rent\_in \land \\
195 \t0 plan.quota\_trans\_from = quota\_trans\_from \land \\
196 \t0 plan.quota\_trans\_to = quota\_trans\_to \land \\
197 \t0 plan.quota\_next\_from = quota\_next\_from \land \\
198 \t0 plan.quota\_next\_to = quota\_next\_to \land \\
199 \t0 plan.quota\_exch\_from = quota\_exch\_from \land \\
200 \t0 plan.quota\_exch\_to = quota\_exch\_to \land \\
201 \t0 plan.trade\_out = trade\_out \land \\
202 \t0 plan.trade\_in = trade\_in \land \\
203 \t0 plan.prod = prod \land \\
204 \t0 plan.export = export \\
205 \end{schema}
206 \end{document}