Commit ·
7e1c831
1
Parent(s): dbb292c
Replace the interpreter sections with the two-head machine and translating organism proved in Rocq, prove the hosted constructor in full, compute the restoration bound in C, add independent reproductions of the paper's constructions and measurements, and cut the paper to 36 pages
Browse filesThis view is limited to 50 files because it contains too many changes. See raw diff
- .gitignore +16 -0
- README.md +30 -13
- paper/README.md +13 -10
- paper/runs/independent_host_family.json +1682 -0
- paper/runs/independent_interpreter.json +40 -0
- paper/runs/independent_levelize.json +38 -0
- paper/runs/independent_neuromorphic.json +34 -0
- paper/runs/independent_noise.json +419 -0
- paper/runs/independent_weight_error.json +80 -0
- paper/runs/paper_environment.json +6 -6
- paper/runs/paper_fanin2.json +1 -1
- paper/runs/paper_host_family.json +10 -10
- paper/runs/paper_host_fold.json +135 -0
- paper/runs/paper_interp.json +1 -16
- paper/runs/paper_neuromorphic.json +2 -3
- paper/runs/paper_redundant_bound_r3.json +85 -93
- paper/runs/paper_redundant_r3.json +1 -1
- paper/runs/paper_rocq.json +22 -0
- paper/runs/paper_twohead.json +38 -0
- paper/runs/paper_twohead_net.json +51 -0
- paper/runs/paper_verify_times.json +28 -28
- paper/universal_construction_ternary.pdf +2 -2
- paper/universal_construction_ternary.tex +0 -0
- rocq/Abstract.v +371 -0
- rocq/Assumptions.v +17 -0
- rocq/Complete.v +103 -0
- rocq/Decoder.v +579 -0
- rocq/Extract.v +5 -0
- rocq/Gates.v +82 -0
- rocq/Indep.v +141 -0
- rocq/Iter.v +72 -0
- rocq/Main.v +100 -0
- rocq/Net.v +281 -0
- rocq/NetMain.v +57 -0
- rocq/Organism.v +151 -0
- rocq/PassCheck.v +62 -0
- rocq/PassLemma.v +161 -0
- rocq/Phys.v +102 -0
- rocq/PhysFacts.v +65 -0
- rocq/PhysMain.v +91 -0
- rocq/PhysSem.v +655 -0
- rocq/PhysWF.v +64 -0
- rocq/Run.v +93 -0
- rocq/SelfRep.v +115 -0
- rocq/Smoke.v +27 -0
- rocq/SmokeData.v +0 -0
- rocq/Spec.v +78 -0
- rocq/Tapes.v +152 -0
- rocq/TwoHead.v +178 -0
- rocq/_CoqProject +26 -0
.gitignore
CHANGED
|
@@ -6,3 +6,19 @@ paper/*.log
|
|
| 6 |
paper/*.aux
|
| 7 |
paper/*.out
|
| 8 |
paper/runs/datapath_layers.npz
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 6 |
paper/*.aux
|
| 7 |
paper/*.out
|
| 8 |
paper/runs/datapath_layers.npz
|
| 9 |
+
rocq/Makefile
|
| 10 |
+
rocq/Makefile.conf
|
| 11 |
+
rocq/.Makefile.d
|
| 12 |
+
rocq/*.vo
|
| 13 |
+
rocq/*.vok
|
| 14 |
+
rocq/*.vos
|
| 15 |
+
rocq/*.glob
|
| 16 |
+
rocq/.*.aux
|
| 17 |
+
rocq/.lia.cache
|
| 18 |
+
rocq/extract/physnet.ml
|
| 19 |
+
rocq/extract/physnet.mli
|
| 20 |
+
rocq/.nia.cache
|
| 21 |
+
rocq/extract/dump
|
| 22 |
+
rocq/extract/*.cm*
|
| 23 |
+
rocq/extract/*.o
|
| 24 |
+
src/independent/.work/
|
README.md
CHANGED
|
@@ -574,12 +574,14 @@ host, its initial memory and its own description tape; each generation is
|
|
| 574 |
instantiated from the bytes the last one emitted, by parsing that output,
|
| 575 |
rebuilding the netlist from its first field, and building the evaluator from
|
| 576 |
that netlist. It also shows where the restriction to {-1, 0, 1} is paid for,
|
| 577 |
-
that
|
| 578 |
-
|
| 579 |
-
|
| 580 |
-
|
| 581 |
-
|
| 582 |
-
|
|
|
|
|
|
|
| 583 |
against perturbation, a certificate of the leakage an orbit tolerates from the
|
| 584 |
inputs active along it, and the amplified host of `src/redundant.py`: every row
|
| 585 |
of the levelized host replaced by r rows reading all r copies of its inputs,
|
|
@@ -596,10 +598,11 @@ generation is 1,664,939 steps of a map of 41,967 units, and the amplified host
|
|
| 596 |
reproduces itself in 33,796,449 steps of 125,901 units. The scripts that produce
|
| 597 |
every figure are `src/selfrep.py`, `src/netlist_io.py`, `src/host_family.py`,
|
| 598 |
`src/paper_stats.py`, `src/paper_verify.py`, `src/paper_runs.py`,
|
| 599 |
-
`src/
|
| 600 |
-
`src/
|
| 601 |
-
`src/
|
| 602 |
-
`paper/runs/`
|
|
|
|
| 603 |
|
| 604 |
---
|
| 605 |
|
|
@@ -994,13 +997,24 @@ src/ the library (run scripts as `python src/<nam
|
|
| 994 |
├── paper_stats.py unit counts, levelization sizes, effective fan-in
|
| 995 |
├── paper_verify.py codec, framing, serialization, datapath, interpreter
|
| 996 |
├── paper_runs.py self-description, three generations, lockstep
|
| 997 |
-
├── organism.py
|
| 998 |
-
│ copies it and hands over
|
| 999 |
├── host_family.py the host family H_A: a constant-depth SUBLEQ step for
|
| 1000 |
│ every word width, and its serialization in build order
|
| 1001 |
├── netlist_eval.c an evaluator of the host family, the amplified host and the
|
| 1002 |
│ interpreter in C, the levels of a large netlist in parallel
|
| 1003 |
-
├── check_c.py the host
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1004 |
├── redundant.py the amplified host N_r: r-fold redundancy with the restoring
|
| 1005 |
│ organ inside every unit, its self-reproduction, its runs
|
| 1006 |
│ under read noise
|
|
@@ -1018,6 +1032,9 @@ src/ the library (run scripts as `python src/<nam
|
|
| 1018 |
host family, levelization, framing, settling, dependence,
|
| 1019 |
serialization, all 29 machines
|
| 1020 |
paper/ the manuscript, and the record of every run it reports
|
|
|
|
|
|
|
|
|
|
| 1021 |
tools/ build_all.py (build + quantize + verify every profile),
|
| 1022 |
cpu_programs.py (assembler + CPU program suite), test_cpu.py
|
| 1023 |
(program suite vs a variant), play.py (interactive demo),
|
|
|
|
| 574 |
instantiated from the bytes the last one emitted, by parsing that output,
|
| 575 |
rebuilding the netlist from its first field, and building the evaluator from
|
| 576 |
that netlist. It also shows where the restriction to {-1, 0, 1} is paid for,
|
| 577 |
+
that a fixed ternary network of 45,891 units, the two-head machine of
|
| 578 |
+
`src/twohead_net.py`, holds a stored network in its state and evaluates one
|
| 579 |
+
record per step, that an organism of 133 records on it translates a description
|
| 580 |
+
of 2930 bits into the idle bank, copies the description and hands over, so that
|
| 581 |
+
started on its own description it reproduces in every generation, the proofs of
|
| 582 |
+
which are checked in Rocq in `rocq/`, that a larger record interpreter of
|
| 583 |
+
`neural_reflect` runs a netlist realizing a smaller one, and that the
|
| 584 |
+
constructor itself runs as a netlist stored in that interpreter's state. Its robustness section gives the margin every orbit has
|
| 585 |
against perturbation, a certificate of the leakage an orbit tolerates from the
|
| 586 |
inputs active along it, and the amplified host of `src/redundant.py`: every row
|
| 587 |
of the levelized host replaced by r rows reading all r copies of its inputs,
|
|
|
|
| 598 |
reproduces itself in 33,796,449 steps of 125,901 units. The scripts that produce
|
| 599 |
every figure are `src/selfrep.py`, `src/netlist_io.py`, `src/host_family.py`,
|
| 600 |
`src/paper_stats.py`, `src/paper_verify.py`, `src/paper_runs.py`,
|
| 601 |
+
`src/twohead.py`, `src/twohead_net.py`, `src/check_c.py`, `src/hierarchy.py`,
|
| 602 |
+
`src/hosted_constructor.py`, `src/throughput.py`, `src/noise.py`,
|
| 603 |
+
`src/redundant.py`, `src/fanin2.py`, `src/neuromorphic.py` and the
|
| 604 |
+
`src/check_*.py` set, and their records are in `paper/runs/`; `rocq/` holds the
|
| 605 |
+
Rocq development, which `src/check_rocq.py` builds.
|
| 606 |
|
| 607 |
---
|
| 608 |
|
|
|
|
| 997 |
├── paper_stats.py unit counts, levelization sizes, effective fan-in
|
| 998 |
├── paper_verify.py codec, framing, serialization, datapath, interpreter
|
| 999 |
├── paper_runs.py self-description, three generations, lockstep
|
| 1000 |
+
├── organism.py an organism on neural_reflect: decodes a description into
|
| 1001 |
+
│ the idle bank, copies it and hands over
|
| 1002 |
├── host_family.py the host family H_A: a constant-depth SUBLEQ step for
|
| 1003 |
│ every word width, and its serialization in build order
|
| 1004 |
├── netlist_eval.c an evaluator of the host family, the amplified host and the
|
| 1005 |
│ interpreter in C, the levels of a large netlist in parallel
|
| 1006 |
+
├── check_c.py the host on the evaluator in C
|
| 1007 |
+
├── twohead.py the two-head machine, transcribed, the description code
|
| 1008 |
+
│ and the translating organism; writes rocq/Organism.v
|
| 1009 |
+
├── twohead_net.py the two-head machine as a ternary netlist N_{G,L}: its
|
| 1010 |
+
│ check, its file, the organism on it in C, and the
|
| 1011 |
+
│ comparison with the netlist extracted from rocq/
|
| 1012 |
+
├── twohead_lockstep.c the organism on N_{G,L} beside the transcription, in C
|
| 1013 |
+
├── restore_bound.c the restoration bound of the amplified host along the orbit
|
| 1014 |
+
├── check_rocq.py builds rocq/ and prints the assumptions of its theorems
|
| 1015 |
+
├── independent/ separate code written from the paper's definitions: the host
|
| 1016 |
+
│ family, the levelization, the record interpreter, a noise
|
| 1017 |
+
│ simulator in C, weight error, and the neuromorphic datapath
|
| 1018 |
├── redundant.py the amplified host N_r: r-fold redundancy with the restoring
|
| 1019 |
│ organ inside every unit, its self-reproduction, its runs
|
| 1020 |
│ under read noise
|
|
|
|
| 1032 |
host family, levelization, framing, settling, dependence,
|
| 1033 |
serialization, all 29 machines
|
| 1034 |
paper/ the manuscript, and the record of every run it reports
|
| 1035 |
+
rocq/ Rocq proofs: the netlist of the two-head machine computes its
|
| 1036 |
+
step, the organism builds every image from any description
|
| 1037 |
+
of it and reproduces in every generation
|
| 1038 |
tools/ build_all.py (build + quantize + verify every profile),
|
| 1039 |
cpu_programs.py (assembler + CPU program suite), test_cpu.py
|
| 1040 |
(program suite vs a variant), play.py (interactive demo),
|
paper/README.md
CHANGED
|
@@ -22,9 +22,11 @@ proposition and theorem, and none of its checks runs the full instance. Tier two
|
|
| 22 |
executes every construction end to end: the self-describing instance and three
|
| 23 |
generations of the self-reproducing instance on the integer reference, the
|
| 24 |
constructor on four machines of the family through the netlist that
|
| 25 |
-
`variants/neural_subleq8io_netlist.safetensors` denotes,
|
| 26 |
-
|
| 27 |
-
|
|
|
|
|
|
|
| 28 |
|
| 29 |
Tier three runs the self-reproducing instance itself on the threshold
|
| 30 |
evaluators, runs the constructor on all twenty-nine machines of the artifact,
|
|
@@ -52,7 +54,6 @@ the cost of any one run is a multiplication.
|
|
| 52 |
| `src/check_codec.py` | `paper_codec.json` | the recipe codec at every boundary of the token format |
|
| 53 |
| `src/check_optimal.py` | `paper_optimal.json` | the length bound is optimal on run-free strings |
|
| 54 |
| `src/check_steps.py` | `paper_steps.json` | the closed forms for the step counts |
|
| 55 |
-
| `src/check_total.py` | `paper_total.json` | behaviour on tapes that are not recipes, and the total program |
|
| 56 |
| `src/check_device.py` | `paper_device.json` | the device against its definition |
|
| 57 |
| `src/check_host.py` | `paper_host.json` | the reference machine against its definition |
|
| 58 |
| `src/check_lev.py` | `paper_lev.json` | the levelization against gate-by-gate evaluation |
|
|
@@ -60,20 +61,22 @@ the cost of any one run is a multiplication.
|
|
| 60 |
| `src/check_ternarity.py` | `paper_ternarity.json` | no ternary unit computes the branch predicate |
|
| 61 |
| `src/check_environment.py` | `paper_environment.json` | the cost of the environment against the cost of the network |
|
| 62 |
| `src/check_sigma.py` | — | sigma is a function, injective, and inverted by the parser |
|
| 63 |
-
| `src/check_settle.py` | `paper_settle.json` | order-independent settling, the full adder under all 9! record orders |
|
| 64 |
| `src/fanin2.py` | `paper_fanin2.json` | the fan-in-two rewriting, on the host, the interpreter and every small ternary unit |
|
| 65 |
-
| `src/check_dependence.py` | — | the dependence hypothesis of the size proposition |
|
| 66 |
| `src/check_family.py` | `paper_runs_family.json` | the constructor emits all 29 machines |
|
| 67 |
| `src/check_family_gate.py` | `paper_runs_family_gate.json` | four of them on the netlist of sigma |
|
| 68 |
-
| `src/
|
| 69 |
-
| `src/
|
| 70 |
-
| `src/
|
|
|
|
|
|
|
|
|
|
| 71 |
| `src/hierarchy.py` | `paper_hierarchy.json` | a larger interpreter runs a smaller one transition by transition |
|
| 72 |
| `src/hosted_constructor.py` | `paper_hosted.json` | the constructor as a netlist stored in the interpreter |
|
| 73 |
| `src/throughput.py` | `paper_throughput.json` | the rate of each evaluator |
|
| 74 |
| `src/noise.py` | `paper_noise_*.json` | read noise, the deviation curve, weight error with leakage, the active-input counts of the orbit certificate |
|
| 75 |
-
| `src/redundant.py` | `paper_redundant_*.json` | the amplified host N_3: one step against SUBLEQ on replicated states, the margin 3/2, exact self-reproduction in C, the run under noise, the deviation curve and its bound by layer, the failure rate of the state read by majority and the restoration bound |
|
| 76 |
| `src/neuromorphic.py` | `paper_neuromorphic.json` | the datapath on the Loihi and Akida neuron models |
|
|
|
|
| 77 |
|
| 78 |
`src/neuromorphic.py run` needs Lava, which requires Python 3.10; everything
|
| 79 |
else runs in the environment of the repository.
|
|
|
|
| 22 |
executes every construction end to end: the self-describing instance and three
|
| 23 |
generations of the self-reproducing instance on the integer reference, the
|
| 24 |
constructor on four machines of the family through the netlist that
|
| 25 |
+
`variants/neural_subleq8io_netlist.safetensors` denotes, the record interpreters
|
| 26 |
+
of Section 9, the translating organism on the two-head machine and on its
|
| 27 |
+
netlist in C, and the Rocq development of Sections 7 and 8, which needs Rocq 9.1
|
| 28 |
+
and ocamlfind on the PATH. The two together take about forty minutes and cover
|
| 29 |
+
every claim the paper makes.
|
| 30 |
|
| 31 |
Tier three runs the self-reproducing instance itself on the threshold
|
| 32 |
evaluators, runs the constructor on all twenty-nine machines of the artifact,
|
|
|
|
| 54 |
| `src/check_codec.py` | `paper_codec.json` | the recipe codec at every boundary of the token format |
|
| 55 |
| `src/check_optimal.py` | `paper_optimal.json` | the length bound is optimal on run-free strings |
|
| 56 |
| `src/check_steps.py` | `paper_steps.json` | the closed forms for the step counts |
|
|
|
|
| 57 |
| `src/check_device.py` | `paper_device.json` | the device against its definition |
|
| 58 |
| `src/check_host.py` | `paper_host.json` | the reference machine against its definition |
|
| 59 |
| `src/check_lev.py` | `paper_lev.json` | the levelization against gate-by-gate evaluation |
|
|
|
|
| 61 |
| `src/check_ternarity.py` | `paper_ternarity.json` | no ternary unit computes the branch predicate |
|
| 62 |
| `src/check_environment.py` | `paper_environment.json` | the cost of the environment against the cost of the network |
|
| 63 |
| `src/check_sigma.py` | — | sigma is a function, injective, and inverted by the parser |
|
|
|
|
| 64 |
| `src/fanin2.py` | `paper_fanin2.json` | the fan-in-two rewriting, on the host, the interpreter and every small ternary unit |
|
|
|
|
| 65 |
| `src/check_family.py` | `paper_runs_family.json` | the constructor emits all 29 machines |
|
| 66 |
| `src/check_family_gate.py` | `paper_runs_family_gate.json` | four of them on the netlist of sigma |
|
| 67 |
+
| `src/check_interp.py` | `paper_interp.json` | the record interpreter's netlist against its definition |
|
| 68 |
+
| `src/check_c.py` | `paper_c_evaluator.json` | the host on the evaluator in C, `src/netlist_eval.c` |
|
| 69 |
+
| `src/check_host_fold.py` | `paper_host_fold.json` | the folded host family, depth 11, against SUBLEQ_A for A = 3 to 12 |
|
| 70 |
+
| `src/twohead.py` | `paper_twohead.json` | the translating organism on the two-head machine, three generations |
|
| 71 |
+
| `src/twohead_net.py` | `paper_twohead_net.json` | the netlist N_{G,L} against the machine, its file, the organism on it in C, and the netlist extracted from Rocq |
|
| 72 |
+
| `src/check_rocq.py` | `paper_rocq.json` | the Rocq development of `rocq/`: the netlist computes the step, construction and self-reproduction by the dynamics |
|
| 73 |
| `src/hierarchy.py` | `paper_hierarchy.json` | a larger interpreter runs a smaller one transition by transition |
|
| 74 |
| `src/hosted_constructor.py` | `paper_hosted.json` | the constructor as a netlist stored in the interpreter |
|
| 75 |
| `src/throughput.py` | `paper_throughput.json` | the rate of each evaluator |
|
| 76 |
| `src/noise.py` | `paper_noise_*.json` | read noise, the deviation curve, weight error with leakage, the active-input counts of the orbit certificate |
|
| 77 |
+
| `src/redundant.py` | `paper_redundant_*.json` | the amplified host N_3: one step against SUBLEQ on replicated states, the margin 3/2, exact self-reproduction in C, the run under noise, the deviation curve and its bound by layer, the failure rate of the state read by majority and the restoration bound, computed by `src/restore_bound.c` |
|
| 78 |
| `src/neuromorphic.py` | `paper_neuromorphic.json` | the datapath on the Loihi and Akida neuron models |
|
| 79 |
+
| `src/independent/*.py`, `nsim.c` | `independent_*.json` | separate code written from the paper's definitions: H_A rebuilt from Construction 3.8 for A = 3 to 12, Lev(N_host) from sigma, Definition 9.1 with the hierarchy and the hosted constructor, Tables 4 to 7 with a separate noise simulator, and the datapath on Loihi and Akida |
|
| 80 |
|
| 81 |
`src/neuromorphic.py run` needs Lava, which requires Python 3.10; everything
|
| 82 |
else runs in the environment of the repository.
|
paper/runs/independent_host_family.json
ADDED
|
@@ -0,0 +1,1682 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
[
|
| 2 |
+
{
|
| 3 |
+
"A": 3,
|
| 4 |
+
"fold": false,
|
| 5 |
+
"states": 65536,
|
| 6 |
+
"disagree": 0,
|
| 7 |
+
"halted_not_fixed": 0,
|
| 8 |
+
"formula_units": 289,
|
| 9 |
+
"units": 289,
|
| 10 |
+
"edges": 723,
|
| 11 |
+
"depth": 13,
|
| 12 |
+
"bias_range": [
|
| 13 |
+
-3,
|
| 14 |
+
1
|
| 15 |
+
],
|
| 16 |
+
"block_layers": {
|
| 17 |
+
"P": [
|
| 18 |
+
1,
|
| 19 |
+
1
|
| 20 |
+
],
|
| 21 |
+
"HP": [
|
| 22 |
+
1,
|
| 23 |
+
1
|
| 24 |
+
],
|
| 25 |
+
"FA": [
|
| 26 |
+
2,
|
| 27 |
+
2
|
| 28 |
+
],
|
| 29 |
+
"Q": [
|
| 30 |
+
2,
|
| 31 |
+
2
|
| 32 |
+
],
|
| 33 |
+
"F": [
|
| 34 |
+
3,
|
| 35 |
+
3
|
| 36 |
+
],
|
| 37 |
+
"PAB": [
|
| 38 |
+
4,
|
| 39 |
+
4
|
| 40 |
+
],
|
| 41 |
+
"AC": [
|
| 42 |
+
4,
|
| 43 |
+
4
|
| 44 |
+
],
|
| 45 |
+
"W": [
|
| 46 |
+
5,
|
| 47 |
+
5
|
| 48 |
+
],
|
| 49 |
+
"RXY": [
|
| 50 |
+
5,
|
| 51 |
+
5
|
| 52 |
+
],
|
| 53 |
+
"KP": [
|
| 54 |
+
6,
|
| 55 |
+
6
|
| 56 |
+
],
|
| 57 |
+
"XY": [
|
| 58 |
+
6,
|
| 59 |
+
6
|
| 60 |
+
],
|
| 61 |
+
"sub": [
|
| 62 |
+
7,
|
| 63 |
+
11
|
| 64 |
+
],
|
| 65 |
+
"eq": [
|
| 66 |
+
7,
|
| 67 |
+
9
|
| 68 |
+
],
|
| 69 |
+
"LEQ": [
|
| 70 |
+
11,
|
| 71 |
+
11
|
| 72 |
+
],
|
| 73 |
+
"NP": [
|
| 74 |
+
12,
|
| 75 |
+
13
|
| 76 |
+
],
|
| 77 |
+
"NH": [
|
| 78 |
+
12,
|
| 79 |
+
13
|
| 80 |
+
],
|
| 81 |
+
"NM": [
|
| 82 |
+
9,
|
| 83 |
+
13
|
| 84 |
+
]
|
| 85 |
+
},
|
| 86 |
+
"seconds": 0.1
|
| 87 |
+
},
|
| 88 |
+
{
|
| 89 |
+
"A": 3,
|
| 90 |
+
"fold": true,
|
| 91 |
+
"states": 65536,
|
| 92 |
+
"disagree": 0,
|
| 93 |
+
"halted_not_fixed": 0,
|
| 94 |
+
"formula_units": null,
|
| 95 |
+
"units": 273,
|
| 96 |
+
"edges": 931,
|
| 97 |
+
"depth": 11,
|
| 98 |
+
"bias_range": [
|
| 99 |
+
-4,
|
| 100 |
+
1
|
| 101 |
+
],
|
| 102 |
+
"block_layers": {
|
| 103 |
+
"P": [
|
| 104 |
+
1,
|
| 105 |
+
1
|
| 106 |
+
],
|
| 107 |
+
"HP": [
|
| 108 |
+
1,
|
| 109 |
+
1
|
| 110 |
+
],
|
| 111 |
+
"FA": [
|
| 112 |
+
1,
|
| 113 |
+
1
|
| 114 |
+
],
|
| 115 |
+
"Q": [
|
| 116 |
+
2,
|
| 117 |
+
2
|
| 118 |
+
],
|
| 119 |
+
"F": [
|
| 120 |
+
2,
|
| 121 |
+
2
|
| 122 |
+
],
|
| 123 |
+
"AC": [
|
| 124 |
+
3,
|
| 125 |
+
3
|
| 126 |
+
],
|
| 127 |
+
"W": [
|
| 128 |
+
3,
|
| 129 |
+
3
|
| 130 |
+
],
|
| 131 |
+
"RXY": [
|
| 132 |
+
3,
|
| 133 |
+
3
|
| 134 |
+
],
|
| 135 |
+
"KP": [
|
| 136 |
+
4,
|
| 137 |
+
4
|
| 138 |
+
],
|
| 139 |
+
"XY": [
|
| 140 |
+
4,
|
| 141 |
+
4
|
| 142 |
+
],
|
| 143 |
+
"sub": [
|
| 144 |
+
5,
|
| 145 |
+
9
|
| 146 |
+
],
|
| 147 |
+
"eq": [
|
| 148 |
+
5,
|
| 149 |
+
7
|
| 150 |
+
],
|
| 151 |
+
"LEQ": [
|
| 152 |
+
9,
|
| 153 |
+
9
|
| 154 |
+
],
|
| 155 |
+
"NP": [
|
| 156 |
+
10,
|
| 157 |
+
11
|
| 158 |
+
],
|
| 159 |
+
"NH": [
|
| 160 |
+
10,
|
| 161 |
+
11
|
| 162 |
+
],
|
| 163 |
+
"NM": [
|
| 164 |
+
7,
|
| 165 |
+
11
|
| 166 |
+
]
|
| 167 |
+
},
|
| 168 |
+
"seconds": 0.1
|
| 169 |
+
},
|
| 170 |
+
{
|
| 171 |
+
"A": 4,
|
| 172 |
+
"fold": false,
|
| 173 |
+
"states": 65536,
|
| 174 |
+
"disagree": 0,
|
| 175 |
+
"halted_not_fixed": 0,
|
| 176 |
+
"formula_units": 664,
|
| 177 |
+
"units": 664,
|
| 178 |
+
"edges": 1768,
|
| 179 |
+
"depth": 13,
|
| 180 |
+
"bias_range": [
|
| 181 |
+
-4,
|
| 182 |
+
1
|
| 183 |
+
],
|
| 184 |
+
"block_layers": {
|
| 185 |
+
"P": [
|
| 186 |
+
1,
|
| 187 |
+
1
|
| 188 |
+
],
|
| 189 |
+
"HP": [
|
| 190 |
+
1,
|
| 191 |
+
1
|
| 192 |
+
],
|
| 193 |
+
"FA": [
|
| 194 |
+
2,
|
| 195 |
+
2
|
| 196 |
+
],
|
| 197 |
+
"Q": [
|
| 198 |
+
2,
|
| 199 |
+
2
|
| 200 |
+
],
|
| 201 |
+
"F": [
|
| 202 |
+
3,
|
| 203 |
+
3
|
| 204 |
+
],
|
| 205 |
+
"PAB": [
|
| 206 |
+
4,
|
| 207 |
+
4
|
| 208 |
+
],
|
| 209 |
+
"AC": [
|
| 210 |
+
4,
|
| 211 |
+
4
|
| 212 |
+
],
|
| 213 |
+
"W": [
|
| 214 |
+
5,
|
| 215 |
+
5
|
| 216 |
+
],
|
| 217 |
+
"RXY": [
|
| 218 |
+
5,
|
| 219 |
+
5
|
| 220 |
+
],
|
| 221 |
+
"KP": [
|
| 222 |
+
6,
|
| 223 |
+
6
|
| 224 |
+
],
|
| 225 |
+
"XY": [
|
| 226 |
+
6,
|
| 227 |
+
6
|
| 228 |
+
],
|
| 229 |
+
"sub": [
|
| 230 |
+
7,
|
| 231 |
+
11
|
| 232 |
+
],
|
| 233 |
+
"eq": [
|
| 234 |
+
7,
|
| 235 |
+
9
|
| 236 |
+
],
|
| 237 |
+
"LEQ": [
|
| 238 |
+
11,
|
| 239 |
+
11
|
| 240 |
+
],
|
| 241 |
+
"NP": [
|
| 242 |
+
12,
|
| 243 |
+
13
|
| 244 |
+
],
|
| 245 |
+
"NH": [
|
| 246 |
+
12,
|
| 247 |
+
13
|
| 248 |
+
],
|
| 249 |
+
"NM": [
|
| 250 |
+
9,
|
| 251 |
+
13
|
| 252 |
+
]
|
| 253 |
+
},
|
| 254 |
+
"seconds": 0.3
|
| 255 |
+
},
|
| 256 |
+
{
|
| 257 |
+
"A": 4,
|
| 258 |
+
"fold": true,
|
| 259 |
+
"states": 65536,
|
| 260 |
+
"disagree": 0,
|
| 261 |
+
"halted_not_fixed": 0,
|
| 262 |
+
"formula_units": null,
|
| 263 |
+
"units": 632,
|
| 264 |
+
"edges": 2648,
|
| 265 |
+
"depth": 11,
|
| 266 |
+
"bias_range": [
|
| 267 |
+
-5,
|
| 268 |
+
1
|
| 269 |
+
],
|
| 270 |
+
"block_layers": {
|
| 271 |
+
"P": [
|
| 272 |
+
1,
|
| 273 |
+
1
|
| 274 |
+
],
|
| 275 |
+
"HP": [
|
| 276 |
+
1,
|
| 277 |
+
1
|
| 278 |
+
],
|
| 279 |
+
"FA": [
|
| 280 |
+
1,
|
| 281 |
+
1
|
| 282 |
+
],
|
| 283 |
+
"Q": [
|
| 284 |
+
2,
|
| 285 |
+
2
|
| 286 |
+
],
|
| 287 |
+
"F": [
|
| 288 |
+
2,
|
| 289 |
+
2
|
| 290 |
+
],
|
| 291 |
+
"AC": [
|
| 292 |
+
3,
|
| 293 |
+
3
|
| 294 |
+
],
|
| 295 |
+
"W": [
|
| 296 |
+
3,
|
| 297 |
+
3
|
| 298 |
+
],
|
| 299 |
+
"RXY": [
|
| 300 |
+
3,
|
| 301 |
+
3
|
| 302 |
+
],
|
| 303 |
+
"KP": [
|
| 304 |
+
4,
|
| 305 |
+
4
|
| 306 |
+
],
|
| 307 |
+
"XY": [
|
| 308 |
+
4,
|
| 309 |
+
4
|
| 310 |
+
],
|
| 311 |
+
"sub": [
|
| 312 |
+
5,
|
| 313 |
+
9
|
| 314 |
+
],
|
| 315 |
+
"eq": [
|
| 316 |
+
5,
|
| 317 |
+
7
|
| 318 |
+
],
|
| 319 |
+
"LEQ": [
|
| 320 |
+
9,
|
| 321 |
+
9
|
| 322 |
+
],
|
| 323 |
+
"NP": [
|
| 324 |
+
10,
|
| 325 |
+
11
|
| 326 |
+
],
|
| 327 |
+
"NH": [
|
| 328 |
+
10,
|
| 329 |
+
11
|
| 330 |
+
],
|
| 331 |
+
"NM": [
|
| 332 |
+
7,
|
| 333 |
+
11
|
| 334 |
+
]
|
| 335 |
+
},
|
| 336 |
+
"seconds": 0.3
|
| 337 |
+
},
|
| 338 |
+
{
|
| 339 |
+
"A": 5,
|
| 340 |
+
"fold": false,
|
| 341 |
+
"states": 65536,
|
| 342 |
+
"disagree": 0,
|
| 343 |
+
"halted_not_fixed": 0,
|
| 344 |
+
"formula_units": 1520,
|
| 345 |
+
"units": 1520,
|
| 346 |
+
"edges": 4208,
|
| 347 |
+
"depth": 13,
|
| 348 |
+
"bias_range": [
|
| 349 |
+
-5,
|
| 350 |
+
1
|
| 351 |
+
],
|
| 352 |
+
"block_layers": {
|
| 353 |
+
"P": [
|
| 354 |
+
1,
|
| 355 |
+
1
|
| 356 |
+
],
|
| 357 |
+
"HP": [
|
| 358 |
+
1,
|
| 359 |
+
1
|
| 360 |
+
],
|
| 361 |
+
"FA": [
|
| 362 |
+
2,
|
| 363 |
+
2
|
| 364 |
+
],
|
| 365 |
+
"Q": [
|
| 366 |
+
2,
|
| 367 |
+
2
|
| 368 |
+
],
|
| 369 |
+
"F": [
|
| 370 |
+
3,
|
| 371 |
+
3
|
| 372 |
+
],
|
| 373 |
+
"PAB": [
|
| 374 |
+
4,
|
| 375 |
+
4
|
| 376 |
+
],
|
| 377 |
+
"AC": [
|
| 378 |
+
4,
|
| 379 |
+
4
|
| 380 |
+
],
|
| 381 |
+
"W": [
|
| 382 |
+
5,
|
| 383 |
+
5
|
| 384 |
+
],
|
| 385 |
+
"RXY": [
|
| 386 |
+
5,
|
| 387 |
+
5
|
| 388 |
+
],
|
| 389 |
+
"KP": [
|
| 390 |
+
6,
|
| 391 |
+
6
|
| 392 |
+
],
|
| 393 |
+
"XY": [
|
| 394 |
+
6,
|
| 395 |
+
6
|
| 396 |
+
],
|
| 397 |
+
"sub": [
|
| 398 |
+
7,
|
| 399 |
+
11
|
| 400 |
+
],
|
| 401 |
+
"eq": [
|
| 402 |
+
7,
|
| 403 |
+
9
|
| 404 |
+
],
|
| 405 |
+
"LEQ": [
|
| 406 |
+
11,
|
| 407 |
+
11
|
| 408 |
+
],
|
| 409 |
+
"NP": [
|
| 410 |
+
12,
|
| 411 |
+
13
|
| 412 |
+
],
|
| 413 |
+
"NH": [
|
| 414 |
+
12,
|
| 415 |
+
13
|
| 416 |
+
],
|
| 417 |
+
"NM": [
|
| 418 |
+
9,
|
| 419 |
+
13
|
| 420 |
+
]
|
| 421 |
+
},
|
| 422 |
+
"seconds": 0.7
|
| 423 |
+
},
|
| 424 |
+
{
|
| 425 |
+
"A": 5,
|
| 426 |
+
"fold": true,
|
| 427 |
+
"states": 65536,
|
| 428 |
+
"disagree": 0,
|
| 429 |
+
"halted_not_fixed": 0,
|
| 430 |
+
"formula_units": null,
|
| 431 |
+
"units": 1456,
|
| 432 |
+
"edges": 7216,
|
| 433 |
+
"depth": 11,
|
| 434 |
+
"bias_range": [
|
| 435 |
+
-6,
|
| 436 |
+
1
|
| 437 |
+
],
|
| 438 |
+
"block_layers": {
|
| 439 |
+
"P": [
|
| 440 |
+
1,
|
| 441 |
+
1
|
| 442 |
+
],
|
| 443 |
+
"HP": [
|
| 444 |
+
1,
|
| 445 |
+
1
|
| 446 |
+
],
|
| 447 |
+
"FA": [
|
| 448 |
+
1,
|
| 449 |
+
1
|
| 450 |
+
],
|
| 451 |
+
"Q": [
|
| 452 |
+
2,
|
| 453 |
+
2
|
| 454 |
+
],
|
| 455 |
+
"F": [
|
| 456 |
+
2,
|
| 457 |
+
2
|
| 458 |
+
],
|
| 459 |
+
"AC": [
|
| 460 |
+
3,
|
| 461 |
+
3
|
| 462 |
+
],
|
| 463 |
+
"W": [
|
| 464 |
+
3,
|
| 465 |
+
3
|
| 466 |
+
],
|
| 467 |
+
"RXY": [
|
| 468 |
+
3,
|
| 469 |
+
3
|
| 470 |
+
],
|
| 471 |
+
"KP": [
|
| 472 |
+
4,
|
| 473 |
+
4
|
| 474 |
+
],
|
| 475 |
+
"XY": [
|
| 476 |
+
4,
|
| 477 |
+
4
|
| 478 |
+
],
|
| 479 |
+
"sub": [
|
| 480 |
+
5,
|
| 481 |
+
9
|
| 482 |
+
],
|
| 483 |
+
"eq": [
|
| 484 |
+
5,
|
| 485 |
+
7
|
| 486 |
+
],
|
| 487 |
+
"LEQ": [
|
| 488 |
+
9,
|
| 489 |
+
9
|
| 490 |
+
],
|
| 491 |
+
"NP": [
|
| 492 |
+
10,
|
| 493 |
+
11
|
| 494 |
+
],
|
| 495 |
+
"NH": [
|
| 496 |
+
10,
|
| 497 |
+
11
|
| 498 |
+
],
|
| 499 |
+
"NM": [
|
| 500 |
+
7,
|
| 501 |
+
11
|
| 502 |
+
]
|
| 503 |
+
},
|
| 504 |
+
"seconds": 0.8
|
| 505 |
+
},
|
| 506 |
+
{
|
| 507 |
+
"A": 6,
|
| 508 |
+
"fold": false,
|
| 509 |
+
"states": 65536,
|
| 510 |
+
"disagree": 0,
|
| 511 |
+
"halted_not_fixed": 0,
|
| 512 |
+
"formula_units": 3465,
|
| 513 |
+
"units": 3465,
|
| 514 |
+
"edges": 9824,
|
| 515 |
+
"depth": 13,
|
| 516 |
+
"bias_range": [
|
| 517 |
+
-6,
|
| 518 |
+
1
|
| 519 |
+
],
|
| 520 |
+
"block_layers": {
|
| 521 |
+
"P": [
|
| 522 |
+
1,
|
| 523 |
+
1
|
| 524 |
+
],
|
| 525 |
+
"HP": [
|
| 526 |
+
1,
|
| 527 |
+
1
|
| 528 |
+
],
|
| 529 |
+
"FA": [
|
| 530 |
+
2,
|
| 531 |
+
2
|
| 532 |
+
],
|
| 533 |
+
"Q": [
|
| 534 |
+
2,
|
| 535 |
+
2
|
| 536 |
+
],
|
| 537 |
+
"F": [
|
| 538 |
+
3,
|
| 539 |
+
3
|
| 540 |
+
],
|
| 541 |
+
"PAB": [
|
| 542 |
+
4,
|
| 543 |
+
4
|
| 544 |
+
],
|
| 545 |
+
"AC": [
|
| 546 |
+
4,
|
| 547 |
+
4
|
| 548 |
+
],
|
| 549 |
+
"W": [
|
| 550 |
+
5,
|
| 551 |
+
5
|
| 552 |
+
],
|
| 553 |
+
"RXY": [
|
| 554 |
+
5,
|
| 555 |
+
5
|
| 556 |
+
],
|
| 557 |
+
"KP": [
|
| 558 |
+
6,
|
| 559 |
+
6
|
| 560 |
+
],
|
| 561 |
+
"XY": [
|
| 562 |
+
6,
|
| 563 |
+
6
|
| 564 |
+
],
|
| 565 |
+
"sub": [
|
| 566 |
+
7,
|
| 567 |
+
11
|
| 568 |
+
],
|
| 569 |
+
"eq": [
|
| 570 |
+
7,
|
| 571 |
+
9
|
| 572 |
+
],
|
| 573 |
+
"LEQ": [
|
| 574 |
+
11,
|
| 575 |
+
11
|
| 576 |
+
],
|
| 577 |
+
"NP": [
|
| 578 |
+
12,
|
| 579 |
+
13
|
| 580 |
+
],
|
| 581 |
+
"NH": [
|
| 582 |
+
12,
|
| 583 |
+
13
|
| 584 |
+
],
|
| 585 |
+
"NM": [
|
| 586 |
+
9,
|
| 587 |
+
13
|
| 588 |
+
]
|
| 589 |
+
},
|
| 590 |
+
"seconds": 1.7
|
| 591 |
+
},
|
| 592 |
+
{
|
| 593 |
+
"A": 6,
|
| 594 |
+
"fold": true,
|
| 595 |
+
"states": 65536,
|
| 596 |
+
"disagree": 0,
|
| 597 |
+
"halted_not_fixed": 0,
|
| 598 |
+
"formula_units": null,
|
| 599 |
+
"units": 3337,
|
| 600 |
+
"edges": 18976,
|
| 601 |
+
"depth": 11,
|
| 602 |
+
"bias_range": [
|
| 603 |
+
-7,
|
| 604 |
+
1
|
| 605 |
+
],
|
| 606 |
+
"block_layers": {
|
| 607 |
+
"P": [
|
| 608 |
+
1,
|
| 609 |
+
1
|
| 610 |
+
],
|
| 611 |
+
"HP": [
|
| 612 |
+
1,
|
| 613 |
+
1
|
| 614 |
+
],
|
| 615 |
+
"FA": [
|
| 616 |
+
1,
|
| 617 |
+
1
|
| 618 |
+
],
|
| 619 |
+
"Q": [
|
| 620 |
+
2,
|
| 621 |
+
2
|
| 622 |
+
],
|
| 623 |
+
"F": [
|
| 624 |
+
2,
|
| 625 |
+
2
|
| 626 |
+
],
|
| 627 |
+
"AC": [
|
| 628 |
+
3,
|
| 629 |
+
3
|
| 630 |
+
],
|
| 631 |
+
"W": [
|
| 632 |
+
3,
|
| 633 |
+
3
|
| 634 |
+
],
|
| 635 |
+
"RXY": [
|
| 636 |
+
3,
|
| 637 |
+
3
|
| 638 |
+
],
|
| 639 |
+
"KP": [
|
| 640 |
+
4,
|
| 641 |
+
4
|
| 642 |
+
],
|
| 643 |
+
"XY": [
|
| 644 |
+
4,
|
| 645 |
+
4
|
| 646 |
+
],
|
| 647 |
+
"sub": [
|
| 648 |
+
5,
|
| 649 |
+
9
|
| 650 |
+
],
|
| 651 |
+
"eq": [
|
| 652 |
+
5,
|
| 653 |
+
7
|
| 654 |
+
],
|
| 655 |
+
"LEQ": [
|
| 656 |
+
9,
|
| 657 |
+
9
|
| 658 |
+
],
|
| 659 |
+
"NP": [
|
| 660 |
+
10,
|
| 661 |
+
11
|
| 662 |
+
],
|
| 663 |
+
"NH": [
|
| 664 |
+
10,
|
| 665 |
+
11
|
| 666 |
+
],
|
| 667 |
+
"NM": [
|
| 668 |
+
7,
|
| 669 |
+
11
|
| 670 |
+
]
|
| 671 |
+
},
|
| 672 |
+
"seconds": 2.0
|
| 673 |
+
},
|
| 674 |
+
{
|
| 675 |
+
"A": 7,
|
| 676 |
+
"fold": false,
|
| 677 |
+
"states": 65536,
|
| 678 |
+
"disagree": 0,
|
| 679 |
+
"halted_not_fixed": 0,
|
| 680 |
+
"formula_units": 7843,
|
| 681 |
+
"units": 7843,
|
| 682 |
+
"edges": 22569,
|
| 683 |
+
"depth": 13,
|
| 684 |
+
"bias_range": [
|
| 685 |
+
-7,
|
| 686 |
+
1
|
| 687 |
+
],
|
| 688 |
+
"block_layers": {
|
| 689 |
+
"P": [
|
| 690 |
+
1,
|
| 691 |
+
1
|
| 692 |
+
],
|
| 693 |
+
"HP": [
|
| 694 |
+
1,
|
| 695 |
+
1
|
| 696 |
+
],
|
| 697 |
+
"FA": [
|
| 698 |
+
2,
|
| 699 |
+
2
|
| 700 |
+
],
|
| 701 |
+
"Q": [
|
| 702 |
+
2,
|
| 703 |
+
2
|
| 704 |
+
],
|
| 705 |
+
"F": [
|
| 706 |
+
3,
|
| 707 |
+
3
|
| 708 |
+
],
|
| 709 |
+
"PAB": [
|
| 710 |
+
4,
|
| 711 |
+
4
|
| 712 |
+
],
|
| 713 |
+
"AC": [
|
| 714 |
+
4,
|
| 715 |
+
4
|
| 716 |
+
],
|
| 717 |
+
"W": [
|
| 718 |
+
5,
|
| 719 |
+
5
|
| 720 |
+
],
|
| 721 |
+
"RXY": [
|
| 722 |
+
5,
|
| 723 |
+
5
|
| 724 |
+
],
|
| 725 |
+
"KP": [
|
| 726 |
+
6,
|
| 727 |
+
6
|
| 728 |
+
],
|
| 729 |
+
"XY": [
|
| 730 |
+
6,
|
| 731 |
+
6
|
| 732 |
+
],
|
| 733 |
+
"sub": [
|
| 734 |
+
7,
|
| 735 |
+
11
|
| 736 |
+
],
|
| 737 |
+
"eq": [
|
| 738 |
+
7,
|
| 739 |
+
9
|
| 740 |
+
],
|
| 741 |
+
"LEQ": [
|
| 742 |
+
11,
|
| 743 |
+
11
|
| 744 |
+
],
|
| 745 |
+
"NP": [
|
| 746 |
+
12,
|
| 747 |
+
13
|
| 748 |
+
],
|
| 749 |
+
"NH": [
|
| 750 |
+
12,
|
| 751 |
+
13
|
| 752 |
+
],
|
| 753 |
+
"NM": [
|
| 754 |
+
9,
|
| 755 |
+
13
|
| 756 |
+
]
|
| 757 |
+
},
|
| 758 |
+
"seconds": 5.5
|
| 759 |
+
},
|
| 760 |
+
{
|
| 761 |
+
"A": 7,
|
| 762 |
+
"fold": true,
|
| 763 |
+
"states": 65536,
|
| 764 |
+
"disagree": 0,
|
| 765 |
+
"halted_not_fixed": 0,
|
| 766 |
+
"formula_units": null,
|
| 767 |
+
"units": 7587,
|
| 768 |
+
"edges": 48425,
|
| 769 |
+
"depth": 11,
|
| 770 |
+
"bias_range": [
|
| 771 |
+
-8,
|
| 772 |
+
1
|
| 773 |
+
],
|
| 774 |
+
"block_layers": {
|
| 775 |
+
"P": [
|
| 776 |
+
1,
|
| 777 |
+
1
|
| 778 |
+
],
|
| 779 |
+
"HP": [
|
| 780 |
+
1,
|
| 781 |
+
1
|
| 782 |
+
],
|
| 783 |
+
"FA": [
|
| 784 |
+
1,
|
| 785 |
+
1
|
| 786 |
+
],
|
| 787 |
+
"Q": [
|
| 788 |
+
2,
|
| 789 |
+
2
|
| 790 |
+
],
|
| 791 |
+
"F": [
|
| 792 |
+
2,
|
| 793 |
+
2
|
| 794 |
+
],
|
| 795 |
+
"AC": [
|
| 796 |
+
3,
|
| 797 |
+
3
|
| 798 |
+
],
|
| 799 |
+
"W": [
|
| 800 |
+
3,
|
| 801 |
+
3
|
| 802 |
+
],
|
| 803 |
+
"RXY": [
|
| 804 |
+
3,
|
| 805 |
+
3
|
| 806 |
+
],
|
| 807 |
+
"KP": [
|
| 808 |
+
4,
|
| 809 |
+
4
|
| 810 |
+
],
|
| 811 |
+
"XY": [
|
| 812 |
+
4,
|
| 813 |
+
4
|
| 814 |
+
],
|
| 815 |
+
"sub": [
|
| 816 |
+
5,
|
| 817 |
+
9
|
| 818 |
+
],
|
| 819 |
+
"eq": [
|
| 820 |
+
5,
|
| 821 |
+
7
|
| 822 |
+
],
|
| 823 |
+
"LEQ": [
|
| 824 |
+
9,
|
| 825 |
+
9
|
| 826 |
+
],
|
| 827 |
+
"NP": [
|
| 828 |
+
10,
|
| 829 |
+
11
|
| 830 |
+
],
|
| 831 |
+
"NH": [
|
| 832 |
+
10,
|
| 833 |
+
11
|
| 834 |
+
],
|
| 835 |
+
"NM": [
|
| 836 |
+
7,
|
| 837 |
+
11
|
| 838 |
+
]
|
| 839 |
+
},
|
| 840 |
+
"seconds": 6.3
|
| 841 |
+
},
|
| 842 |
+
{
|
| 843 |
+
"A": 8,
|
| 844 |
+
"fold": false,
|
| 845 |
+
"states": 65536,
|
| 846 |
+
"disagree": 0,
|
| 847 |
+
"halted_not_fixed": 0,
|
| 848 |
+
"formula_units": 17598,
|
| 849 |
+
"units": 17598,
|
| 850 |
+
"edges": 51132,
|
| 851 |
+
"depth": 13,
|
| 852 |
+
"bias_range": [
|
| 853 |
+
-8,
|
| 854 |
+
1
|
| 855 |
+
],
|
| 856 |
+
"block_layers": {
|
| 857 |
+
"P": [
|
| 858 |
+
1,
|
| 859 |
+
1
|
| 860 |
+
],
|
| 861 |
+
"HP": [
|
| 862 |
+
1,
|
| 863 |
+
1
|
| 864 |
+
],
|
| 865 |
+
"FA": [
|
| 866 |
+
2,
|
| 867 |
+
2
|
| 868 |
+
],
|
| 869 |
+
"Q": [
|
| 870 |
+
2,
|
| 871 |
+
2
|
| 872 |
+
],
|
| 873 |
+
"F": [
|
| 874 |
+
3,
|
| 875 |
+
3
|
| 876 |
+
],
|
| 877 |
+
"PAB": [
|
| 878 |
+
4,
|
| 879 |
+
4
|
| 880 |
+
],
|
| 881 |
+
"AC": [
|
| 882 |
+
4,
|
| 883 |
+
4
|
| 884 |
+
],
|
| 885 |
+
"W": [
|
| 886 |
+
5,
|
| 887 |
+
5
|
| 888 |
+
],
|
| 889 |
+
"RXY": [
|
| 890 |
+
5,
|
| 891 |
+
5
|
| 892 |
+
],
|
| 893 |
+
"KP": [
|
| 894 |
+
6,
|
| 895 |
+
6
|
| 896 |
+
],
|
| 897 |
+
"XY": [
|
| 898 |
+
6,
|
| 899 |
+
6
|
| 900 |
+
],
|
| 901 |
+
"sub": [
|
| 902 |
+
7,
|
| 903 |
+
11
|
| 904 |
+
],
|
| 905 |
+
"eq": [
|
| 906 |
+
7,
|
| 907 |
+
9
|
| 908 |
+
],
|
| 909 |
+
"LEQ": [
|
| 910 |
+
11,
|
| 911 |
+
11
|
| 912 |
+
],
|
| 913 |
+
"NP": [
|
| 914 |
+
12,
|
| 915 |
+
13
|
| 916 |
+
],
|
| 917 |
+
"NH": [
|
| 918 |
+
12,
|
| 919 |
+
13
|
| 920 |
+
],
|
| 921 |
+
"NM": [
|
| 922 |
+
9,
|
| 923 |
+
13
|
| 924 |
+
]
|
| 925 |
+
},
|
| 926 |
+
"seconds": 23.3
|
| 927 |
+
},
|
| 928 |
+
{
|
| 929 |
+
"A": 8,
|
| 930 |
+
"fold": true,
|
| 931 |
+
"states": 65536,
|
| 932 |
+
"disagree": 0,
|
| 933 |
+
"halted_not_fixed": 0,
|
| 934 |
+
"formula_units": null,
|
| 935 |
+
"units": 17086,
|
| 936 |
+
"edges": 120508,
|
| 937 |
+
"depth": 11,
|
| 938 |
+
"bias_range": [
|
| 939 |
+
-9,
|
| 940 |
+
1
|
| 941 |
+
],
|
| 942 |
+
"block_layers": {
|
| 943 |
+
"P": [
|
| 944 |
+
1,
|
| 945 |
+
1
|
| 946 |
+
],
|
| 947 |
+
"HP": [
|
| 948 |
+
1,
|
| 949 |
+
1
|
| 950 |
+
],
|
| 951 |
+
"FA": [
|
| 952 |
+
1,
|
| 953 |
+
1
|
| 954 |
+
],
|
| 955 |
+
"Q": [
|
| 956 |
+
2,
|
| 957 |
+
2
|
| 958 |
+
],
|
| 959 |
+
"F": [
|
| 960 |
+
2,
|
| 961 |
+
2
|
| 962 |
+
],
|
| 963 |
+
"AC": [
|
| 964 |
+
3,
|
| 965 |
+
3
|
| 966 |
+
],
|
| 967 |
+
"W": [
|
| 968 |
+
3,
|
| 969 |
+
3
|
| 970 |
+
],
|
| 971 |
+
"RXY": [
|
| 972 |
+
3,
|
| 973 |
+
3
|
| 974 |
+
],
|
| 975 |
+
"KP": [
|
| 976 |
+
4,
|
| 977 |
+
4
|
| 978 |
+
],
|
| 979 |
+
"XY": [
|
| 980 |
+
4,
|
| 981 |
+
4
|
| 982 |
+
],
|
| 983 |
+
"sub": [
|
| 984 |
+
5,
|
| 985 |
+
9
|
| 986 |
+
],
|
| 987 |
+
"eq": [
|
| 988 |
+
5,
|
| 989 |
+
7
|
| 990 |
+
],
|
| 991 |
+
"LEQ": [
|
| 992 |
+
9,
|
| 993 |
+
9
|
| 994 |
+
],
|
| 995 |
+
"NP": [
|
| 996 |
+
10,
|
| 997 |
+
11
|
| 998 |
+
],
|
| 999 |
+
"NH": [
|
| 1000 |
+
10,
|
| 1001 |
+
11
|
| 1002 |
+
],
|
| 1003 |
+
"NM": [
|
| 1004 |
+
7,
|
| 1005 |
+
11
|
| 1006 |
+
]
|
| 1007 |
+
},
|
| 1008 |
+
"seconds": 29.3
|
| 1009 |
+
},
|
| 1010 |
+
{
|
| 1011 |
+
"A": 9,
|
| 1012 |
+
"fold": false,
|
| 1013 |
+
"states": 65536,
|
| 1014 |
+
"disagree": 0,
|
| 1015 |
+
"halted_not_fixed": 0,
|
| 1016 |
+
"formula_units": 39130,
|
| 1017 |
+
"units": 39130,
|
| 1018 |
+
"edges": 114458,
|
| 1019 |
+
"depth": 13,
|
| 1020 |
+
"bias_range": [
|
| 1021 |
+
-9,
|
| 1022 |
+
1
|
| 1023 |
+
],
|
| 1024 |
+
"block_layers": {
|
| 1025 |
+
"P": [
|
| 1026 |
+
1,
|
| 1027 |
+
1
|
| 1028 |
+
],
|
| 1029 |
+
"HP": [
|
| 1030 |
+
1,
|
| 1031 |
+
1
|
| 1032 |
+
],
|
| 1033 |
+
"FA": [
|
| 1034 |
+
2,
|
| 1035 |
+
2
|
| 1036 |
+
],
|
| 1037 |
+
"Q": [
|
| 1038 |
+
2,
|
| 1039 |
+
2
|
| 1040 |
+
],
|
| 1041 |
+
"F": [
|
| 1042 |
+
3,
|
| 1043 |
+
3
|
| 1044 |
+
],
|
| 1045 |
+
"PAB": [
|
| 1046 |
+
4,
|
| 1047 |
+
4
|
| 1048 |
+
],
|
| 1049 |
+
"AC": [
|
| 1050 |
+
4,
|
| 1051 |
+
4
|
| 1052 |
+
],
|
| 1053 |
+
"W": [
|
| 1054 |
+
5,
|
| 1055 |
+
5
|
| 1056 |
+
],
|
| 1057 |
+
"RXY": [
|
| 1058 |
+
5,
|
| 1059 |
+
5
|
| 1060 |
+
],
|
| 1061 |
+
"KP": [
|
| 1062 |
+
6,
|
| 1063 |
+
6
|
| 1064 |
+
],
|
| 1065 |
+
"XY": [
|
| 1066 |
+
6,
|
| 1067 |
+
6
|
| 1068 |
+
],
|
| 1069 |
+
"sub": [
|
| 1070 |
+
7,
|
| 1071 |
+
11
|
| 1072 |
+
],
|
| 1073 |
+
"eq": [
|
| 1074 |
+
7,
|
| 1075 |
+
9
|
| 1076 |
+
],
|
| 1077 |
+
"LEQ": [
|
| 1078 |
+
11,
|
| 1079 |
+
11
|
| 1080 |
+
],
|
| 1081 |
+
"NP": [
|
| 1082 |
+
12,
|
| 1083 |
+
13
|
| 1084 |
+
],
|
| 1085 |
+
"NH": [
|
| 1086 |
+
12,
|
| 1087 |
+
13
|
| 1088 |
+
],
|
| 1089 |
+
"NM": [
|
| 1090 |
+
9,
|
| 1091 |
+
13
|
| 1092 |
+
]
|
| 1093 |
+
},
|
| 1094 |
+
"seconds": 55.3
|
| 1095 |
+
},
|
| 1096 |
+
{
|
| 1097 |
+
"A": 9,
|
| 1098 |
+
"fold": true,
|
| 1099 |
+
"states": 65536,
|
| 1100 |
+
"disagree": 0,
|
| 1101 |
+
"halted_not_fixed": 0,
|
| 1102 |
+
"formula_units": null,
|
| 1103 |
+
"units": 38106,
|
| 1104 |
+
"edges": 293658,
|
| 1105 |
+
"depth": 11,
|
| 1106 |
+
"bias_range": [
|
| 1107 |
+
-10,
|
| 1108 |
+
1
|
| 1109 |
+
],
|
| 1110 |
+
"block_layers": {
|
| 1111 |
+
"P": [
|
| 1112 |
+
1,
|
| 1113 |
+
1
|
| 1114 |
+
],
|
| 1115 |
+
"HP": [
|
| 1116 |
+
1,
|
| 1117 |
+
1
|
| 1118 |
+
],
|
| 1119 |
+
"FA": [
|
| 1120 |
+
1,
|
| 1121 |
+
1
|
| 1122 |
+
],
|
| 1123 |
+
"Q": [
|
| 1124 |
+
2,
|
| 1125 |
+
2
|
| 1126 |
+
],
|
| 1127 |
+
"F": [
|
| 1128 |
+
2,
|
| 1129 |
+
2
|
| 1130 |
+
],
|
| 1131 |
+
"AC": [
|
| 1132 |
+
3,
|
| 1133 |
+
3
|
| 1134 |
+
],
|
| 1135 |
+
"W": [
|
| 1136 |
+
3,
|
| 1137 |
+
3
|
| 1138 |
+
],
|
| 1139 |
+
"RXY": [
|
| 1140 |
+
3,
|
| 1141 |
+
3
|
| 1142 |
+
],
|
| 1143 |
+
"KP": [
|
| 1144 |
+
4,
|
| 1145 |
+
4
|
| 1146 |
+
],
|
| 1147 |
+
"XY": [
|
| 1148 |
+
4,
|
| 1149 |
+
4
|
| 1150 |
+
],
|
| 1151 |
+
"sub": [
|
| 1152 |
+
5,
|
| 1153 |
+
9
|
| 1154 |
+
],
|
| 1155 |
+
"eq": [
|
| 1156 |
+
5,
|
| 1157 |
+
7
|
| 1158 |
+
],
|
| 1159 |
+
"LEQ": [
|
| 1160 |
+
9,
|
| 1161 |
+
9
|
| 1162 |
+
],
|
| 1163 |
+
"NP": [
|
| 1164 |
+
10,
|
| 1165 |
+
11
|
| 1166 |
+
],
|
| 1167 |
+
"NH": [
|
| 1168 |
+
10,
|
| 1169 |
+
11
|
| 1170 |
+
],
|
| 1171 |
+
"NM": [
|
| 1172 |
+
7,
|
| 1173 |
+
11
|
| 1174 |
+
]
|
| 1175 |
+
},
|
| 1176 |
+
"seconds": 66.7
|
| 1177 |
+
},
|
| 1178 |
+
{
|
| 1179 |
+
"A": 10,
|
| 1180 |
+
"fold": false,
|
| 1181 |
+
"states": 65536,
|
| 1182 |
+
"disagree": 0,
|
| 1183 |
+
"halted_not_fixed": 0,
|
| 1184 |
+
"formula_units": 86263,
|
| 1185 |
+
"units": 86263,
|
| 1186 |
+
"edges": 253572,
|
| 1187 |
+
"depth": 13,
|
| 1188 |
+
"bias_range": [
|
| 1189 |
+
-10,
|
| 1190 |
+
1
|
| 1191 |
+
],
|
| 1192 |
+
"block_layers": {
|
| 1193 |
+
"P": [
|
| 1194 |
+
1,
|
| 1195 |
+
1
|
| 1196 |
+
],
|
| 1197 |
+
"HP": [
|
| 1198 |
+
1,
|
| 1199 |
+
1
|
| 1200 |
+
],
|
| 1201 |
+
"FA": [
|
| 1202 |
+
2,
|
| 1203 |
+
2
|
| 1204 |
+
],
|
| 1205 |
+
"Q": [
|
| 1206 |
+
2,
|
| 1207 |
+
2
|
| 1208 |
+
],
|
| 1209 |
+
"F": [
|
| 1210 |
+
3,
|
| 1211 |
+
3
|
| 1212 |
+
],
|
| 1213 |
+
"PAB": [
|
| 1214 |
+
4,
|
| 1215 |
+
4
|
| 1216 |
+
],
|
| 1217 |
+
"AC": [
|
| 1218 |
+
4,
|
| 1219 |
+
4
|
| 1220 |
+
],
|
| 1221 |
+
"W": [
|
| 1222 |
+
5,
|
| 1223 |
+
5
|
| 1224 |
+
],
|
| 1225 |
+
"RXY": [
|
| 1226 |
+
5,
|
| 1227 |
+
5
|
| 1228 |
+
],
|
| 1229 |
+
"KP": [
|
| 1230 |
+
6,
|
| 1231 |
+
6
|
| 1232 |
+
],
|
| 1233 |
+
"XY": [
|
| 1234 |
+
6,
|
| 1235 |
+
6
|
| 1236 |
+
],
|
| 1237 |
+
"sub": [
|
| 1238 |
+
7,
|
| 1239 |
+
11
|
| 1240 |
+
],
|
| 1241 |
+
"eq": [
|
| 1242 |
+
7,
|
| 1243 |
+
9
|
| 1244 |
+
],
|
| 1245 |
+
"LEQ": [
|
| 1246 |
+
11,
|
| 1247 |
+
11
|
| 1248 |
+
],
|
| 1249 |
+
"NP": [
|
| 1250 |
+
12,
|
| 1251 |
+
13
|
| 1252 |
+
],
|
| 1253 |
+
"NH": [
|
| 1254 |
+
12,
|
| 1255 |
+
13
|
| 1256 |
+
],
|
| 1257 |
+
"NM": [
|
| 1258 |
+
9,
|
| 1259 |
+
13
|
| 1260 |
+
]
|
| 1261 |
+
},
|
| 1262 |
+
"seconds": 127.2
|
| 1263 |
+
},
|
| 1264 |
+
{
|
| 1265 |
+
"A": 10,
|
| 1266 |
+
"fold": true,
|
| 1267 |
+
"states": 65536,
|
| 1268 |
+
"disagree": 0,
|
| 1269 |
+
"halted_not_fixed": 0,
|
| 1270 |
+
"formula_units": null,
|
| 1271 |
+
"units": 84215,
|
| 1272 |
+
"edges": 703108,
|
| 1273 |
+
"depth": 11,
|
| 1274 |
+
"bias_range": [
|
| 1275 |
+
-11,
|
| 1276 |
+
1
|
| 1277 |
+
],
|
| 1278 |
+
"block_layers": {
|
| 1279 |
+
"P": [
|
| 1280 |
+
1,
|
| 1281 |
+
1
|
| 1282 |
+
],
|
| 1283 |
+
"HP": [
|
| 1284 |
+
1,
|
| 1285 |
+
1
|
| 1286 |
+
],
|
| 1287 |
+
"FA": [
|
| 1288 |
+
1,
|
| 1289 |
+
1
|
| 1290 |
+
],
|
| 1291 |
+
"Q": [
|
| 1292 |
+
2,
|
| 1293 |
+
2
|
| 1294 |
+
],
|
| 1295 |
+
"F": [
|
| 1296 |
+
2,
|
| 1297 |
+
2
|
| 1298 |
+
],
|
| 1299 |
+
"AC": [
|
| 1300 |
+
3,
|
| 1301 |
+
3
|
| 1302 |
+
],
|
| 1303 |
+
"W": [
|
| 1304 |
+
3,
|
| 1305 |
+
3
|
| 1306 |
+
],
|
| 1307 |
+
"RXY": [
|
| 1308 |
+
3,
|
| 1309 |
+
3
|
| 1310 |
+
],
|
| 1311 |
+
"KP": [
|
| 1312 |
+
4,
|
| 1313 |
+
4
|
| 1314 |
+
],
|
| 1315 |
+
"XY": [
|
| 1316 |
+
4,
|
| 1317 |
+
4
|
| 1318 |
+
],
|
| 1319 |
+
"sub": [
|
| 1320 |
+
5,
|
| 1321 |
+
9
|
| 1322 |
+
],
|
| 1323 |
+
"eq": [
|
| 1324 |
+
5,
|
| 1325 |
+
7
|
| 1326 |
+
],
|
| 1327 |
+
"LEQ": [
|
| 1328 |
+
9,
|
| 1329 |
+
9
|
| 1330 |
+
],
|
| 1331 |
+
"NP": [
|
| 1332 |
+
10,
|
| 1333 |
+
11
|
| 1334 |
+
],
|
| 1335 |
+
"NH": [
|
| 1336 |
+
10,
|
| 1337 |
+
11
|
| 1338 |
+
],
|
| 1339 |
+
"NM": [
|
| 1340 |
+
7,
|
| 1341 |
+
11
|
| 1342 |
+
]
|
| 1343 |
+
},
|
| 1344 |
+
"seconds": 124.7
|
| 1345 |
+
},
|
| 1346 |
+
{
|
| 1347 |
+
"A": 11,
|
| 1348 |
+
"fold": false,
|
| 1349 |
+
"states": 32768,
|
| 1350 |
+
"disagree": 0,
|
| 1351 |
+
"halted_not_fixed": 0,
|
| 1352 |
+
"formula_units": 188693,
|
| 1353 |
+
"units": 188693,
|
| 1354 |
+
"edges": 556795,
|
| 1355 |
+
"depth": 13,
|
| 1356 |
+
"bias_range": [
|
| 1357 |
+
-11,
|
| 1358 |
+
1
|
| 1359 |
+
],
|
| 1360 |
+
"block_layers": {
|
| 1361 |
+
"P": [
|
| 1362 |
+
1,
|
| 1363 |
+
1
|
| 1364 |
+
],
|
| 1365 |
+
"HP": [
|
| 1366 |
+
1,
|
| 1367 |
+
1
|
| 1368 |
+
],
|
| 1369 |
+
"FA": [
|
| 1370 |
+
2,
|
| 1371 |
+
2
|
| 1372 |
+
],
|
| 1373 |
+
"Q": [
|
| 1374 |
+
2,
|
| 1375 |
+
2
|
| 1376 |
+
],
|
| 1377 |
+
"F": [
|
| 1378 |
+
3,
|
| 1379 |
+
3
|
| 1380 |
+
],
|
| 1381 |
+
"PAB": [
|
| 1382 |
+
4,
|
| 1383 |
+
4
|
| 1384 |
+
],
|
| 1385 |
+
"AC": [
|
| 1386 |
+
4,
|
| 1387 |
+
4
|
| 1388 |
+
],
|
| 1389 |
+
"W": [
|
| 1390 |
+
5,
|
| 1391 |
+
5
|
| 1392 |
+
],
|
| 1393 |
+
"RXY": [
|
| 1394 |
+
5,
|
| 1395 |
+
5
|
| 1396 |
+
],
|
| 1397 |
+
"KP": [
|
| 1398 |
+
6,
|
| 1399 |
+
6
|
| 1400 |
+
],
|
| 1401 |
+
"XY": [
|
| 1402 |
+
6,
|
| 1403 |
+
6
|
| 1404 |
+
],
|
| 1405 |
+
"sub": [
|
| 1406 |
+
7,
|
| 1407 |
+
11
|
| 1408 |
+
],
|
| 1409 |
+
"eq": [
|
| 1410 |
+
7,
|
| 1411 |
+
9
|
| 1412 |
+
],
|
| 1413 |
+
"LEQ": [
|
| 1414 |
+
11,
|
| 1415 |
+
11
|
| 1416 |
+
],
|
| 1417 |
+
"NP": [
|
| 1418 |
+
12,
|
| 1419 |
+
13
|
| 1420 |
+
],
|
| 1421 |
+
"NH": [
|
| 1422 |
+
12,
|
| 1423 |
+
13
|
| 1424 |
+
],
|
| 1425 |
+
"NM": [
|
| 1426 |
+
9,
|
| 1427 |
+
13
|
| 1428 |
+
]
|
| 1429 |
+
},
|
| 1430 |
+
"seconds": 473.5
|
| 1431 |
+
},
|
| 1432 |
+
{
|
| 1433 |
+
"A": 11,
|
| 1434 |
+
"fold": true,
|
| 1435 |
+
"states": 32768,
|
| 1436 |
+
"disagree": 0,
|
| 1437 |
+
"halted_not_fixed": 0,
|
| 1438 |
+
"formula_units": null,
|
| 1439 |
+
"units": 184597,
|
| 1440 |
+
"edges": 1658619,
|
| 1441 |
+
"depth": 11,
|
| 1442 |
+
"bias_range": [
|
| 1443 |
+
-12,
|
| 1444 |
+
1
|
| 1445 |
+
],
|
| 1446 |
+
"block_layers": {
|
| 1447 |
+
"P": [
|
| 1448 |
+
1,
|
| 1449 |
+
1
|
| 1450 |
+
],
|
| 1451 |
+
"HP": [
|
| 1452 |
+
1,
|
| 1453 |
+
1
|
| 1454 |
+
],
|
| 1455 |
+
"FA": [
|
| 1456 |
+
1,
|
| 1457 |
+
1
|
| 1458 |
+
],
|
| 1459 |
+
"Q": [
|
| 1460 |
+
2,
|
| 1461 |
+
2
|
| 1462 |
+
],
|
| 1463 |
+
"F": [
|
| 1464 |
+
2,
|
| 1465 |
+
2
|
| 1466 |
+
],
|
| 1467 |
+
"AC": [
|
| 1468 |
+
3,
|
| 1469 |
+
3
|
| 1470 |
+
],
|
| 1471 |
+
"W": [
|
| 1472 |
+
3,
|
| 1473 |
+
3
|
| 1474 |
+
],
|
| 1475 |
+
"RXY": [
|
| 1476 |
+
3,
|
| 1477 |
+
3
|
| 1478 |
+
],
|
| 1479 |
+
"KP": [
|
| 1480 |
+
4,
|
| 1481 |
+
4
|
| 1482 |
+
],
|
| 1483 |
+
"XY": [
|
| 1484 |
+
4,
|
| 1485 |
+
4
|
| 1486 |
+
],
|
| 1487 |
+
"sub": [
|
| 1488 |
+
5,
|
| 1489 |
+
9
|
| 1490 |
+
],
|
| 1491 |
+
"eq": [
|
| 1492 |
+
5,
|
| 1493 |
+
7
|
| 1494 |
+
],
|
| 1495 |
+
"LEQ": [
|
| 1496 |
+
9,
|
| 1497 |
+
9
|
| 1498 |
+
],
|
| 1499 |
+
"NP": [
|
| 1500 |
+
10,
|
| 1501 |
+
11
|
| 1502 |
+
],
|
| 1503 |
+
"NH": [
|
| 1504 |
+
10,
|
| 1505 |
+
11
|
| 1506 |
+
],
|
| 1507 |
+
"NM": [
|
| 1508 |
+
7,
|
| 1509 |
+
11
|
| 1510 |
+
]
|
| 1511 |
+
},
|
| 1512 |
+
"seconds": 629.0
|
| 1513 |
+
},
|
| 1514 |
+
{
|
| 1515 |
+
"A": 12,
|
| 1516 |
+
"fold": false,
|
| 1517 |
+
"states": 16384,
|
| 1518 |
+
"disagree": 0,
|
| 1519 |
+
"halted_not_fixed": 0,
|
| 1520 |
+
"formula_units": 409908,
|
| 1521 |
+
"units": 409908,
|
| 1522 |
+
"edges": 1213312,
|
| 1523 |
+
"depth": 13,
|
| 1524 |
+
"bias_range": [
|
| 1525 |
+
-12,
|
| 1526 |
+
1
|
| 1527 |
+
],
|
| 1528 |
+
"block_layers": {
|
| 1529 |
+
"P": [
|
| 1530 |
+
1,
|
| 1531 |
+
1
|
| 1532 |
+
],
|
| 1533 |
+
"HP": [
|
| 1534 |
+
1,
|
| 1535 |
+
1
|
| 1536 |
+
],
|
| 1537 |
+
"FA": [
|
| 1538 |
+
2,
|
| 1539 |
+
2
|
| 1540 |
+
],
|
| 1541 |
+
"Q": [
|
| 1542 |
+
2,
|
| 1543 |
+
2
|
| 1544 |
+
],
|
| 1545 |
+
"F": [
|
| 1546 |
+
3,
|
| 1547 |
+
3
|
| 1548 |
+
],
|
| 1549 |
+
"PAB": [
|
| 1550 |
+
4,
|
| 1551 |
+
4
|
| 1552 |
+
],
|
| 1553 |
+
"AC": [
|
| 1554 |
+
4,
|
| 1555 |
+
4
|
| 1556 |
+
],
|
| 1557 |
+
"W": [
|
| 1558 |
+
5,
|
| 1559 |
+
5
|
| 1560 |
+
],
|
| 1561 |
+
"RXY": [
|
| 1562 |
+
5,
|
| 1563 |
+
5
|
| 1564 |
+
],
|
| 1565 |
+
"KP": [
|
| 1566 |
+
6,
|
| 1567 |
+
6
|
| 1568 |
+
],
|
| 1569 |
+
"XY": [
|
| 1570 |
+
6,
|
| 1571 |
+
6
|
| 1572 |
+
],
|
| 1573 |
+
"sub": [
|
| 1574 |
+
7,
|
| 1575 |
+
11
|
| 1576 |
+
],
|
| 1577 |
+
"eq": [
|
| 1578 |
+
7,
|
| 1579 |
+
9
|
| 1580 |
+
],
|
| 1581 |
+
"LEQ": [
|
| 1582 |
+
11,
|
| 1583 |
+
11
|
| 1584 |
+
],
|
| 1585 |
+
"NP": [
|
| 1586 |
+
12,
|
| 1587 |
+
13
|
| 1588 |
+
],
|
| 1589 |
+
"NH": [
|
| 1590 |
+
12,
|
| 1591 |
+
13
|
| 1592 |
+
],
|
| 1593 |
+
"NM": [
|
| 1594 |
+
9,
|
| 1595 |
+
13
|
| 1596 |
+
]
|
| 1597 |
+
},
|
| 1598 |
+
"seconds": 316.1
|
| 1599 |
+
},
|
| 1600 |
+
{
|
| 1601 |
+
"A": 12,
|
| 1602 |
+
"fold": true,
|
| 1603 |
+
"states": 16384,
|
| 1604 |
+
"disagree": 0,
|
| 1605 |
+
"halted_not_fixed": 0,
|
| 1606 |
+
"formula_units": null,
|
| 1607 |
+
"units": 401716,
|
| 1608 |
+
"edges": 3863424,
|
| 1609 |
+
"depth": 11,
|
| 1610 |
+
"bias_range": [
|
| 1611 |
+
-13,
|
| 1612 |
+
1
|
| 1613 |
+
],
|
| 1614 |
+
"block_layers": {
|
| 1615 |
+
"P": [
|
| 1616 |
+
1,
|
| 1617 |
+
1
|
| 1618 |
+
],
|
| 1619 |
+
"HP": [
|
| 1620 |
+
1,
|
| 1621 |
+
1
|
| 1622 |
+
],
|
| 1623 |
+
"FA": [
|
| 1624 |
+
1,
|
| 1625 |
+
1
|
| 1626 |
+
],
|
| 1627 |
+
"Q": [
|
| 1628 |
+
2,
|
| 1629 |
+
2
|
| 1630 |
+
],
|
| 1631 |
+
"F": [
|
| 1632 |
+
2,
|
| 1633 |
+
2
|
| 1634 |
+
],
|
| 1635 |
+
"AC": [
|
| 1636 |
+
3,
|
| 1637 |
+
3
|
| 1638 |
+
],
|
| 1639 |
+
"W": [
|
| 1640 |
+
3,
|
| 1641 |
+
3
|
| 1642 |
+
],
|
| 1643 |
+
"RXY": [
|
| 1644 |
+
3,
|
| 1645 |
+
3
|
| 1646 |
+
],
|
| 1647 |
+
"KP": [
|
| 1648 |
+
4,
|
| 1649 |
+
4
|
| 1650 |
+
],
|
| 1651 |
+
"XY": [
|
| 1652 |
+
4,
|
| 1653 |
+
4
|
| 1654 |
+
],
|
| 1655 |
+
"sub": [
|
| 1656 |
+
5,
|
| 1657 |
+
9
|
| 1658 |
+
],
|
| 1659 |
+
"eq": [
|
| 1660 |
+
5,
|
| 1661 |
+
7
|
| 1662 |
+
],
|
| 1663 |
+
"LEQ": [
|
| 1664 |
+
9,
|
| 1665 |
+
9
|
| 1666 |
+
],
|
| 1667 |
+
"NP": [
|
| 1668 |
+
10,
|
| 1669 |
+
11
|
| 1670 |
+
],
|
| 1671 |
+
"NH": [
|
| 1672 |
+
10,
|
| 1673 |
+
11
|
| 1674 |
+
],
|
| 1675 |
+
"NM": [
|
| 1676 |
+
7,
|
| 1677 |
+
11
|
| 1678 |
+
]
|
| 1679 |
+
},
|
| 1680 |
+
"seconds": 375.0
|
| 1681 |
+
}
|
| 1682 |
+
]
|
paper/runs/independent_interpreter.json
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"hierarchy": {
|
| 3 |
+
"small_units": 816,
|
| 4 |
+
"small_state_bits": 131,
|
| 5 |
+
"fanin2_units": 1403,
|
| 6 |
+
"signals": 1534,
|
| 7 |
+
"changed": 35,
|
| 8 |
+
"records": 1438,
|
| 9 |
+
"big": {
|
| 10 |
+
"A": 17,
|
| 11 |
+
"G": 2088,
|
| 12 |
+
"b": 62,
|
| 13 |
+
"span": 1616
|
| 14 |
+
},
|
| 15 |
+
"states": 48,
|
| 16 |
+
"passes": 4,
|
| 17 |
+
"disagree": 0,
|
| 18 |
+
"seconds": 5.6
|
| 19 |
+
},
|
| 20 |
+
"hosted": {
|
| 21 |
+
"records": 494,
|
| 22 |
+
"noops": 41,
|
| 23 |
+
"tail_noops": true,
|
| 24 |
+
"decode_matches": true,
|
| 25 |
+
"recipes": 41,
|
| 26 |
+
"recipes_ok": 41,
|
| 27 |
+
"first": {
|
| 28 |
+
"recipe_len": 9,
|
| 29 |
+
"out_len": 12,
|
| 30 |
+
"steps": 83,
|
| 31 |
+
"passes": 83,
|
| 32 |
+
"applications": 44358,
|
| 33 |
+
"ok": true
|
| 34 |
+
},
|
| 35 |
+
"random_states": 2000,
|
| 36 |
+
"random_halting_steps": 297,
|
| 37 |
+
"random_disagree": 0,
|
| 38 |
+
"seconds": 20.4
|
| 39 |
+
}
|
| 40 |
+
}
|
paper/runs/independent_levelize.json
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"depth": 13,
|
| 3 |
+
"state_bits": 2057,
|
| 4 |
+
"M": 41967,
|
| 5 |
+
"nnz": 75501,
|
| 6 |
+
"max_width": 8210,
|
| 7 |
+
"identity_like": 24370,
|
| 8 |
+
"dense_entries": 124165940,
|
| 9 |
+
"r_H": 144891,
|
| 10 |
+
"tau": 144996,
|
| 11 |
+
"ser": 305508,
|
| 12 |
+
"ser_sha": "c5950d3fec6bcf70e8111586a030d21b2dfa55bd69a1c7fe5f016cb06e7fb523",
|
| 13 |
+
"sigma_sha": "55c555bd64302190d5bde57ee0cd41b36dac5cf65066d0ed3468567a57e85fa3",
|
| 14 |
+
"registry": {
|
| 15 |
+
"halt": [
|
| 16 |
+
8,
|
| 17 |
+
1
|
| 18 |
+
],
|
| 19 |
+
"mem": [
|
| 20 |
+
9,
|
| 21 |
+
256,
|
| 22 |
+
8
|
| 23 |
+
],
|
| 24 |
+
"pc": [
|
| 25 |
+
0,
|
| 26 |
+
8
|
| 27 |
+
]
|
| 28 |
+
},
|
| 29 |
+
"io": {
|
| 30 |
+
"c_eot": 250,
|
| 31 |
+
"c_rd": 252,
|
| 32 |
+
"c_rw": 251,
|
| 33 |
+
"c_wr": 249,
|
| 34 |
+
"halt_pc": 255,
|
| 35 |
+
"r_in": 253,
|
| 36 |
+
"r_out": 254
|
| 37 |
+
}
|
| 38 |
+
}
|
paper/runs/independent_neuromorphic.json
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"datapath": {
|
| 3 |
+
"units": 106,
|
| 4 |
+
"depth": 5,
|
| 5 |
+
"widths": [
|
| 6 |
+
48,
|
| 7 |
+
58,
|
| 8 |
+
23,
|
| 9 |
+
23,
|
| 10 |
+
9
|
| 11 |
+
]
|
| 12 |
+
},
|
| 13 |
+
"akida": {
|
| 14 |
+
"backend": "akida 2.19.3",
|
| 15 |
+
"patterns": 65536,
|
| 16 |
+
"failures": 0
|
| 17 |
+
},
|
| 18 |
+
"lava_vth_16": {
|
| 19 |
+
"backend": "lava fixed_pt",
|
| 20 |
+
"vth": 16,
|
| 21 |
+
"patterns": 4096,
|
| 22 |
+
"failures": 0,
|
| 23 |
+
"margin_firing_side": 128,
|
| 24 |
+
"margin_quiet_side": 0
|
| 25 |
+
},
|
| 26 |
+
"lava_vth_17": {
|
| 27 |
+
"backend": "lava fixed_pt",
|
| 28 |
+
"vth": 17,
|
| 29 |
+
"patterns": 4096,
|
| 30 |
+
"failures": 0,
|
| 31 |
+
"margin_firing_side": 64,
|
| 32 |
+
"margin_quiet_side": 64
|
| 33 |
+
}
|
| 34 |
+
}
|
paper/runs/independent_noise.json
ADDED
|
@@ -0,0 +1,419 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"exact_self_describing": {
|
| 3 |
+
"steps": 10000,
|
| 4 |
+
"halted": 0,
|
| 5 |
+
"bytes": 1971,
|
| 6 |
+
"wrong_bytes": 0,
|
| 7 |
+
"Kstar_first": 8,
|
| 8 |
+
"Astar_first": 349,
|
| 9 |
+
"Kstar": 8,
|
| 10 |
+
"Astar": 349,
|
| 11 |
+
"head": 1981
|
| 12 |
+
},
|
| 13 |
+
"exact_self_reproducing": {
|
| 14 |
+
"steps": 1664939,
|
| 15 |
+
"halted": 1,
|
| 16 |
+
"bytes": 305508,
|
| 17 |
+
"wrong_bytes": 0,
|
| 18 |
+
"Kstar_first": 0,
|
| 19 |
+
"Astar_first": 0,
|
| 20 |
+
"Kstar": 8,
|
| 21 |
+
"Astar": 441,
|
| 22 |
+
"head": 144996
|
| 23 |
+
},
|
| 24 |
+
"profile": {
|
| 25 |
+
"at_one_half": 30890.76275,
|
| 26 |
+
"at_three_halves": 10399.84975,
|
| 27 |
+
"at_five_halves": 176.70375,
|
| 28 |
+
"beyond": 499.68375,
|
| 29 |
+
"fraction_at_one_half": 0.7360726940214931
|
| 30 |
+
},
|
| 31 |
+
"curve": [
|
| 32 |
+
{
|
| 33 |
+
"s": 0.02,
|
| 34 |
+
"r": 1,
|
| 35 |
+
"deviated": 0,
|
| 36 |
+
"copies": 256,
|
| 37 |
+
"T": 3000,
|
| 38 |
+
"median": null,
|
| 39 |
+
"exposure": 768000,
|
| 40 |
+
"rate": 0.0,
|
| 41 |
+
"profile_bound": 9.442771918931676e-134,
|
| 42 |
+
"bound_on_count": 7.252048833739527e-128,
|
| 43 |
+
"rMp": 2.5656078135354018e-133
|
| 44 |
+
},
|
| 45 |
+
{
|
| 46 |
+
"s": 0.04,
|
| 47 |
+
"r": 1,
|
| 48 |
+
"deviated": 0,
|
| 49 |
+
"copies": 256,
|
| 50 |
+
"T": 3000,
|
| 51 |
+
"median": null,
|
| 52 |
+
"exposure": 768000,
|
| 53 |
+
"rate": 0.0,
|
| 54 |
+
"profile_bound": 1.1530667492607755e-31,
|
| 55 |
+
"bound_on_count": 8.855552634322756e-26,
|
| 56 |
+
"rMp": 3.132890518620101e-31
|
| 57 |
+
},
|
| 58 |
+
{
|
| 59 |
+
"s": 0.06,
|
| 60 |
+
"r": 1,
|
| 61 |
+
"deviated": 0,
|
| 62 |
+
"copies": 256,
|
| 63 |
+
"T": 3000,
|
| 64 |
+
"median": null,
|
| 65 |
+
"exposure": 768000,
|
| 66 |
+
"rate": 0.0,
|
| 67 |
+
"profile_bound": 1.2140196453929234e-12,
|
| 68 |
+
"bound_on_count": 9.323670876617651e-07,
|
| 69 |
+
"rMp": 3.298499968807918e-12
|
| 70 |
+
},
|
| 71 |
+
{
|
| 72 |
+
"s": 0.08,
|
| 73 |
+
"r": 1,
|
| 74 |
+
"deviated": 13,
|
| 75 |
+
"copies": 256,
|
| 76 |
+
"T": 4000,
|
| 77 |
+
"median": 793.0,
|
| 78 |
+
"exposure": 985633,
|
| 79 |
+
"rate": 1.3189493452431077e-05,
|
| 80 |
+
"profile_bound": 6.33959690544171e-06,
|
| 81 |
+
"bound_on_count": 6.248515916701229,
|
| 82 |
+
"rMp": 1.7225467833232754e-05
|
| 83 |
+
},
|
| 84 |
+
{
|
| 85 |
+
"s": 0.09,
|
| 86 |
+
"r": 1,
|
| 87 |
+
"deviated": 197,
|
| 88 |
+
"copies": 256,
|
| 89 |
+
"T": 4000,
|
| 90 |
+
"median": 1522.0,
|
| 91 |
+
"exposure": 547019,
|
| 92 |
+
"rate": 0.00036013374306925354,
|
| 93 |
+
"profile_bound": 0.00042742505876279367,
|
| 94 |
+
"bound_on_count": 233.80962821936464,
|
| 95 |
+
"rMp": 0.001161353542861366
|
| 96 |
+
},
|
| 97 |
+
{
|
| 98 |
+
"s": 0.1,
|
| 99 |
+
"r": 1,
|
| 100 |
+
"deviated": 256,
|
| 101 |
+
"copies": 256,
|
| 102 |
+
"T": 4000,
|
| 103 |
+
"median": 93.0,
|
| 104 |
+
"exposure": 30676,
|
| 105 |
+
"rate": 0.008345286217238231,
|
| 106 |
+
"profile_bound": 0.008847495682648844,
|
| 107 |
+
"bound_on_count": 271.4057775609359,
|
| 108 |
+
"rMp": 0.024059813034108396
|
| 109 |
+
},
|
| 110 |
+
{
|
| 111 |
+
"s": 0.11,
|
| 112 |
+
"r": 1,
|
| 113 |
+
"deviated": 256,
|
| 114 |
+
"copies": 256,
|
| 115 |
+
"T": 4000,
|
| 116 |
+
"median": 10.0,
|
| 117 |
+
"exposure": 3411,
|
| 118 |
+
"rate": 0.07505130460275579,
|
| 119 |
+
"profile_bound": 0.08418094216915373,
|
| 120 |
+
"bound_on_count": 287.14119373898336,
|
| 121 |
+
"rMp": 0.2300497758854446
|
| 122 |
+
},
|
| 123 |
+
{
|
| 124 |
+
"s": 0.12,
|
| 125 |
+
"r": 1,
|
| 126 |
+
"deviated": 256,
|
| 127 |
+
"copies": 256,
|
| 128 |
+
"T": 4000,
|
| 129 |
+
"median": 2.0,
|
| 130 |
+
"exposure": 719,
|
| 131 |
+
"rate": 0.3560500695410292,
|
| 132 |
+
"profile_bound": 0.47334746680411344,
|
| 133 |
+
"bound_on_count": 340.33682863215756,
|
| 134 |
+
"rMp": 1.2971409545186365
|
| 135 |
+
},
|
| 136 |
+
{
|
| 137 |
+
"s": 0.15,
|
| 138 |
+
"r": 1,
|
| 139 |
+
"deviated": 256,
|
| 140 |
+
"copies": 256,
|
| 141 |
+
"T": 4000,
|
| 142 |
+
"median": 1.0,
|
| 143 |
+
"exposure": 256,
|
| 144 |
+
"rate": 1.0,
|
| 145 |
+
"profile_bound": 13.037856344852248,
|
| 146 |
+
"bound_on_count": 3337.6912242821754,
|
| 147 |
+
"rMp": 36.01275000654335
|
| 148 |
+
},
|
| 149 |
+
{
|
| 150 |
+
"s": 0.2,
|
| 151 |
+
"r": 1,
|
| 152 |
+
"deviated": 256,
|
| 153 |
+
"copies": 256,
|
| 154 |
+
"T": 4000,
|
| 155 |
+
"median": 1.0,
|
| 156 |
+
"exposure": 256,
|
| 157 |
+
"rate": 1.0,
|
| 158 |
+
"profile_bound": 188.69310025470685,
|
| 159 |
+
"bound_on_count": 48305.43366520495,
|
| 160 |
+
"rMp": 521.2020494536948
|
| 161 |
+
}
|
| 162 |
+
],
|
| 163 |
+
"curve_s008_seeds": [
|
| 164 |
+
{
|
| 165 |
+
"s": 0.08,
|
| 166 |
+
"r": 1,
|
| 167 |
+
"deviated": 2,
|
| 168 |
+
"copies": 256,
|
| 169 |
+
"T": 4000,
|
| 170 |
+
"median": 2085.5,
|
| 171 |
+
"exposure": 1020171,
|
| 172 |
+
"rate": 1.960455649101964e-06,
|
| 173 |
+
"profile_bound": 6.339599062688867e-06,
|
| 174 |
+
"bound_on_count": 6.467475115382364,
|
| 175 |
+
"rMp": 1.7225467833232754e-05
|
| 176 |
+
},
|
| 177 |
+
{
|
| 178 |
+
"s": 0.08,
|
| 179 |
+
"r": 1,
|
| 180 |
+
"deviated": 8,
|
| 181 |
+
"copies": 256,
|
| 182 |
+
"T": 4000,
|
| 183 |
+
"median": 908.5,
|
| 184 |
+
"exposure": 1001668,
|
| 185 |
+
"rate": 7.986678220727825e-06,
|
| 186 |
+
"profile_bound": 6.339598785236791e-06,
|
| 187 |
+
"bound_on_count": 6.350173236010566,
|
| 188 |
+
"rMp": 1.7225467833232754e-05
|
| 189 |
+
},
|
| 190 |
+
{
|
| 191 |
+
"s": 0.08,
|
| 192 |
+
"r": 1,
|
| 193 |
+
"deviated": 8,
|
| 194 |
+
"copies": 256,
|
| 195 |
+
"T": 4000,
|
| 196 |
+
"median": 1954.5,
|
| 197 |
+
"exposure": 1008387,
|
| 198 |
+
"rate": 7.933462053755156e-06,
|
| 199 |
+
"profile_bound": 6.339601330610503e-06,
|
| 200 |
+
"bound_on_count": 6.3927715669703336,
|
| 201 |
+
"rMp": 1.7225467833232754e-05
|
| 202 |
+
},
|
| 203 |
+
{
|
| 204 |
+
"s": 0.08,
|
| 205 |
+
"r": 1,
|
| 206 |
+
"deviated": 3,
|
| 207 |
+
"copies": 256,
|
| 208 |
+
"T": 4000,
|
| 209 |
+
"median": 3281.0,
|
| 210 |
+
"exposure": 1021724,
|
| 211 |
+
"rate": 2.936213693717677e-06,
|
| 212 |
+
"profile_bound": 6.339598076523146e-06,
|
| 213 |
+
"bound_on_count": 6.477319505137535,
|
| 214 |
+
"rMp": 1.7225467833232754e-05
|
| 215 |
+
},
|
| 216 |
+
{
|
| 217 |
+
"s": 0.08,
|
| 218 |
+
"r": 1,
|
| 219 |
+
"deviated": 8,
|
| 220 |
+
"copies": 256,
|
| 221 |
+
"T": 4000,
|
| 222 |
+
"median": 2604.0,
|
| 223 |
+
"exposure": 1009754,
|
| 224 |
+
"rate": 7.922721771837498e-06,
|
| 225 |
+
"profile_bound": 6.339601364521121e-06,
|
| 226 |
+
"bound_on_count": 6.401437836230659,
|
| 227 |
+
"rMp": 1.7225467833232754e-05
|
| 228 |
+
},
|
| 229 |
+
{
|
| 230 |
+
"s": 0.08,
|
| 231 |
+
"r": 1,
|
| 232 |
+
"deviated": 5,
|
| 233 |
+
"copies": 256,
|
| 234 |
+
"T": 4000,
|
| 235 |
+
"median": 2655.0,
|
| 236 |
+
"exposure": 1017231,
|
| 237 |
+
"rate": 4.915304390054963e-06,
|
| 238 |
+
"profile_bound": 6.339598359797664e-06,
|
| 239 |
+
"bound_on_count": 6.448835979135338,
|
| 240 |
+
"rMp": 1.7225467833232754e-05
|
| 241 |
+
},
|
| 242 |
+
{
|
| 243 |
+
"s": 0.08,
|
| 244 |
+
"r": 1,
|
| 245 |
+
"deviated": 3,
|
| 246 |
+
"copies": 256,
|
| 247 |
+
"T": 4000,
|
| 248 |
+
"median": 242.0,
|
| 249 |
+
"exposure": 1016202,
|
| 250 |
+
"rate": 2.9521689585338346e-06,
|
| 251 |
+
"profile_bound": 6.339597357778424e-06,
|
| 252 |
+
"bound_on_count": 6.44231151416915,
|
| 253 |
+
"rMp": 1.7225467833232754e-05
|
| 254 |
+
},
|
| 255 |
+
{
|
| 256 |
+
"s": 0.08,
|
| 257 |
+
"r": 1,
|
| 258 |
+
"deviated": 5,
|
| 259 |
+
"copies": 256,
|
| 260 |
+
"T": 4000,
|
| 261 |
+
"median": 1338.0,
|
| 262 |
+
"exposure": 1010974,
|
| 263 |
+
"rate": 4.945725607186733e-06,
|
| 264 |
+
"profile_bound": 6.339595356770662e-06,
|
| 265 |
+
"bound_on_count": 6.409166076215863,
|
| 266 |
+
"rMp": 1.7225467833232754e-05
|
| 267 |
+
}
|
| 268 |
+
],
|
| 269 |
+
"deviation_N3": [
|
| 270 |
+
{
|
| 271 |
+
"s": 0.24,
|
| 272 |
+
"r": 3,
|
| 273 |
+
"deviated": 1,
|
| 274 |
+
"copies": 256,
|
| 275 |
+
"T": 4000,
|
| 276 |
+
"median": 1881.0,
|
| 277 |
+
"exposure": 1021881,
|
| 278 |
+
"rate": 9.785875263362368e-07,
|
| 279 |
+
"profile_bound": 1.901879314530951e-05,
|
| 280 |
+
"bound_on_count": 19.434943358122027,
|
| 281 |
+
"rMp": 5.167640349969784e-05
|
| 282 |
+
},
|
| 283 |
+
{
|
| 284 |
+
"s": 0.27,
|
| 285 |
+
"r": 3,
|
| 286 |
+
"deviated": 71,
|
| 287 |
+
"copies": 256,
|
| 288 |
+
"T": 4000,
|
| 289 |
+
"median": 1985.0,
|
| 290 |
+
"exposure": 882963,
|
| 291 |
+
"rate": 8.041107045255578e-05,
|
| 292 |
+
"profile_bound": 0.0012822653962512223,
|
| 293 |
+
"bound_on_count": 1132.1929010701679,
|
| 294 |
+
"rMp": 0.00348406062858411
|
| 295 |
+
},
|
| 296 |
+
{
|
| 297 |
+
"s": 0.3,
|
| 298 |
+
"r": 3,
|
| 299 |
+
"deviated": 256,
|
| 300 |
+
"copies": 256,
|
| 301 |
+
"T": 4000,
|
| 302 |
+
"median": 349.0,
|
| 303 |
+
"exposure": 122498,
|
| 304 |
+
"rate": 0.0020898300380414376,
|
| 305 |
+
"profile_bound": 0.02656427119623429,
|
| 306 |
+
"bound_on_count": 3254.070092996308,
|
| 307 |
+
"rMp": 0.07217943910232472
|
| 308 |
+
},
|
| 309 |
+
{
|
| 310 |
+
"s": 0.33,
|
| 311 |
+
"r": 3,
|
| 312 |
+
"deviated": 256,
|
| 313 |
+
"copies": 256,
|
| 314 |
+
"T": 4000,
|
| 315 |
+
"median": 28.0,
|
| 316 |
+
"exposure": 10512,
|
| 317 |
+
"rate": 0.0243531202435312,
|
| 318 |
+
"profile_bound": 0.2530678549145467,
|
| 319 |
+
"bound_on_count": 2660.2492908617146,
|
| 320 |
+
"rMp": 0.6901493276563357
|
| 321 |
+
}
|
| 322 |
+
],
|
| 323 |
+
"failure_N3": [
|
| 324 |
+
{
|
| 325 |
+
"s": 0.27,
|
| 326 |
+
"failed": 4,
|
| 327 |
+
"copies": 64,
|
| 328 |
+
"exposure": 1219247,
|
| 329 |
+
"rate": 3.2807134239411704e-06
|
| 330 |
+
},
|
| 331 |
+
{
|
| 332 |
+
"s": 0.3,
|
| 333 |
+
"failed": 63,
|
| 334 |
+
"copies": 64,
|
| 335 |
+
"exposure": 296746,
|
| 336 |
+
"rate": 0.00021230277745951082
|
| 337 |
+
},
|
| 338 |
+
{
|
| 339 |
+
"s": 0.33,
|
| 340 |
+
"failed": 64,
|
| 341 |
+
"copies": 64,
|
| 342 |
+
"exposure": 20935,
|
| 343 |
+
"rate": 0.003057081442560306
|
| 344 |
+
},
|
| 345 |
+
{
|
| 346 |
+
"s": 0.36,
|
| 347 |
+
"failed": 64,
|
| 348 |
+
"copies": 64,
|
| 349 |
+
"exposure": 2034,
|
| 350 |
+
"rate": 0.03146509341199607
|
| 351 |
+
}
|
| 352 |
+
],
|
| 353 |
+
"complete_runs": [
|
| 354 |
+
{
|
| 355 |
+
"s": 0.05,
|
| 356 |
+
"r": 1,
|
| 357 |
+
"seed": 906,
|
| 358 |
+
"steps": 1664939,
|
| 359 |
+
"bytes": 305508,
|
| 360 |
+
"outcome": "the whole instance"
|
| 361 |
+
},
|
| 362 |
+
{
|
| 363 |
+
"s": 0.1,
|
| 364 |
+
"r": 1,
|
| 365 |
+
"seed": 911,
|
| 366 |
+
"steps": 756,
|
| 367 |
+
"bytes": 143,
|
| 368 |
+
"outcome": "a wrong byte"
|
| 369 |
+
},
|
| 370 |
+
{
|
| 371 |
+
"s": 0.15,
|
| 372 |
+
"r": 1,
|
| 373 |
+
"seed": 916,
|
| 374 |
+
"steps": 157,
|
| 375 |
+
"bytes": 0,
|
| 376 |
+
"outcome": "the halt bit set"
|
| 377 |
+
},
|
| 378 |
+
{
|
| 379 |
+
"s": 0.2,
|
| 380 |
+
"r": 1,
|
| 381 |
+
"seed": 921,
|
| 382 |
+
"steps": 1,
|
| 383 |
+
"bytes": 0,
|
| 384 |
+
"outcome": "the halt bit set"
|
| 385 |
+
},
|
| 386 |
+
{
|
| 387 |
+
"s": 0.1,
|
| 388 |
+
"r": 3,
|
| 389 |
+
"seed": 913,
|
| 390 |
+
"steps": 1664939,
|
| 391 |
+
"bytes": 305508,
|
| 392 |
+
"outcome": "the whole instance"
|
| 393 |
+
},
|
| 394 |
+
{
|
| 395 |
+
"s": 0.15,
|
| 396 |
+
"r": 3,
|
| 397 |
+
"seed": 918,
|
| 398 |
+
"steps": 1664939,
|
| 399 |
+
"bytes": 305508,
|
| 400 |
+
"outcome": "the whole instance"
|
| 401 |
+
},
|
| 402 |
+
{
|
| 403 |
+
"s": 0.2,
|
| 404 |
+
"r": 3,
|
| 405 |
+
"seed": 923,
|
| 406 |
+
"steps": 1664939,
|
| 407 |
+
"bytes": 305508,
|
| 408 |
+
"outcome": "the whole instance"
|
| 409 |
+
},
|
| 410 |
+
{
|
| 411 |
+
"s": 0.25,
|
| 412 |
+
"r": 3,
|
| 413 |
+
"seed": 928,
|
| 414 |
+
"steps": 1664939,
|
| 415 |
+
"bytes": 305508,
|
| 416 |
+
"outcome": "the whole instance"
|
| 417 |
+
}
|
| 418 |
+
]
|
| 419 |
+
}
|
paper/runs/independent_weight_error.json
ADDED
|
@@ -0,0 +1,80 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
[
|
| 2 |
+
{
|
| 3 |
+
"eps": 0,
|
| 4 |
+
"gamma": 3.0454379339749056e-05,
|
| 5 |
+
"outcome": "exact for 10000 steps",
|
| 6 |
+
"seconds": 141.5
|
| 7 |
+
},
|
| 8 |
+
{
|
| 9 |
+
"eps": 0,
|
| 10 |
+
"gamma": 5.4817882811548304e-05,
|
| 11 |
+
"outcome": "exact for 10000 steps",
|
| 12 |
+
"seconds": 97.5
|
| 13 |
+
},
|
| 14 |
+
{
|
| 15 |
+
"eps": 0,
|
| 16 |
+
"gamma": 9.136313801924717e-05,
|
| 17 |
+
"outcome": "exact for 10000 steps",
|
| 18 |
+
"seconds": 88.2
|
| 19 |
+
},
|
| 20 |
+
{
|
| 21 |
+
"eps": 0,
|
| 22 |
+
"gamma": 0.00024363503471799245,
|
| 23 |
+
"outcome": "exact for 10000 steps",
|
| 24 |
+
"seconds": 62.7
|
| 25 |
+
},
|
| 26 |
+
{
|
| 27 |
+
"eps": 0,
|
| 28 |
+
"gamma": 0.0009745401388719698,
|
| 29 |
+
"outcome": "exact for 10000 steps",
|
| 30 |
+
"seconds": 55.4
|
| 31 |
+
},
|
| 32 |
+
{
|
| 33 |
+
"eps": 0,
|
| 34 |
+
"gamma": 0.003898160555487879,
|
| 35 |
+
"outcome": "exact for 10000 steps",
|
| 36 |
+
"seconds": 38.1
|
| 37 |
+
},
|
| 38 |
+
{
|
| 39 |
+
"eps": 0,
|
| 40 |
+
"gamma": 0.015592642221951517,
|
| 41 |
+
"outcome": "deviates at step 1",
|
| 42 |
+
"seconds": 0.0
|
| 43 |
+
},
|
| 44 |
+
{
|
| 45 |
+
"eps": 0.0009765625,
|
| 46 |
+
"gamma": 1.5227189669874528e-05,
|
| 47 |
+
"outcome": "exact for 10000 steps",
|
| 48 |
+
"seconds": 36.9
|
| 49 |
+
},
|
| 50 |
+
{
|
| 51 |
+
"eps": 0.001953125,
|
| 52 |
+
"gamma": 0,
|
| 53 |
+
"outcome": "exact for 10000 steps",
|
| 54 |
+
"seconds": 40.9
|
| 55 |
+
},
|
| 56 |
+
{
|
| 57 |
+
"eps": 0.00390625,
|
| 58 |
+
"gamma": 0,
|
| 59 |
+
"outcome": "exact for 10000 steps",
|
| 60 |
+
"seconds": 42.8
|
| 61 |
+
},
|
| 62 |
+
{
|
| 63 |
+
"eps": 0.015625,
|
| 64 |
+
"gamma": 0,
|
| 65 |
+
"outcome": "exact for 10000 steps",
|
| 66 |
+
"seconds": 39.1
|
| 67 |
+
},
|
| 68 |
+
{
|
| 69 |
+
"eps": 0.0625,
|
| 70 |
+
"gamma": 0,
|
| 71 |
+
"outcome": "exact for 10000 steps",
|
| 72 |
+
"seconds": 31.0
|
| 73 |
+
},
|
| 74 |
+
{
|
| 75 |
+
"eps": 0.25,
|
| 76 |
+
"gamma": 0,
|
| 77 |
+
"outcome": "deviates at step 1",
|
| 78 |
+
"seconds": 0.0
|
| 79 |
+
}
|
| 80 |
+
]
|
paper/runs/paper_environment.json
CHANGED
|
@@ -1,20 +1,20 @@
|
|
| 1 |
{
|
| 2 |
"sigma_entries": 88385,
|
| 3 |
"sigma_bytes": 160240,
|
| 4 |
-
"sigma_seconds": 0.
|
| 5 |
-
"build_seconds": 0.
|
| 6 |
"inst_bytes": 305508,
|
| 7 |
-
"inst_seconds":
|
| 8 |
-
"sigma_inverse_seconds": 0.
|
| 9 |
"lev_units_in": 17598,
|
| 10 |
"lev_units_out": 41967,
|
| 11 |
"lev_nonzero": 75501,
|
| 12 |
"lev_layers": 13,
|
| 13 |
-
"lev_seconds":
|
| 14 |
"lev_entries": 124165940,
|
| 15 |
"steps": 1664939,
|
| 16 |
"emitted_bytes": 305508,
|
| 17 |
-
"reference_seconds": 0.
|
| 18 |
"environment_ops": 2248155,
|
| 19 |
"network_ops": 69872495013,
|
| 20 |
"ratio": 3.217510695133648e-05
|
|
|
|
| 1 |
{
|
| 2 |
"sigma_entries": 88385,
|
| 3 |
"sigma_bytes": 160240,
|
| 4 |
+
"sigma_seconds": 0.27736951599945314,
|
| 5 |
+
"build_seconds": 0.25672924499667715,
|
| 6 |
"inst_bytes": 305508,
|
| 7 |
+
"inst_seconds": 3.054764005355537e-05,
|
| 8 |
+
"sigma_inverse_seconds": 0.1788786249991972,
|
| 9 |
"lev_units_in": 17598,
|
| 10 |
"lev_units_out": 41967,
|
| 11 |
"lev_nonzero": 75501,
|
| 12 |
"lev_layers": 13,
|
| 13 |
+
"lev_seconds": 3.347311844001524,
|
| 14 |
"lev_entries": 124165940,
|
| 15 |
"steps": 1664939,
|
| 16 |
"emitted_bytes": 305508,
|
| 17 |
+
"reference_seconds": 0.912805063999258,
|
| 18 |
"environment_ops": 2248155,
|
| 19 |
"network_ops": 69872495013,
|
| 20 |
"ratio": 3.217510695133648e-05
|
paper/runs/paper_fanin2.json
CHANGED
|
@@ -22,6 +22,6 @@
|
|
| 22 |
"agrees_on_random_inputs": true
|
| 23 |
}
|
| 24 |
},
|
| 25 |
-
"seconds":
|
| 26 |
"ok": true
|
| 27 |
}
|
|
|
|
| 22 |
"agrees_on_random_inputs": true
|
| 23 |
}
|
| 24 |
},
|
| 25 |
+
"seconds": 7.610988596003153,
|
| 26 |
"ok": true
|
| 27 |
}
|
paper/runs/paper_host_family.json
CHANGED
|
@@ -8,7 +8,7 @@
|
|
| 8 |
"states": 65536,
|
| 9 |
"result": "random states: 65536 tested, 0 disagree with SUBLEQ, 0 halt-latch mismatches, 0 halted batches not fixed",
|
| 10 |
"ok": true,
|
| 11 |
-
"seconds": 0.
|
| 12 |
},
|
| 13 |
{
|
| 14 |
"A": 4,
|
|
@@ -18,7 +18,7 @@
|
|
| 18 |
"states": 65536,
|
| 19 |
"result": "random states: 65536 tested, 0 disagree with SUBLEQ, 0 halt-latch mismatches, 0 halted batches not fixed",
|
| 20 |
"ok": true,
|
| 21 |
-
"seconds": 0.
|
| 22 |
},
|
| 23 |
{
|
| 24 |
"A": 5,
|
|
@@ -28,7 +28,7 @@
|
|
| 28 |
"states": 65536,
|
| 29 |
"result": "random states: 65536 tested, 0 disagree with SUBLEQ, 0 halt-latch mismatches, 0 halted batches not fixed",
|
| 30 |
"ok": true,
|
| 31 |
-
"seconds": 0.
|
| 32 |
},
|
| 33 |
{
|
| 34 |
"A": 6,
|
|
@@ -38,7 +38,7 @@
|
|
| 38 |
"states": 65536,
|
| 39 |
"result": "random states: 65536 tested, 0 disagree with SUBLEQ, 0 halt-latch mismatches, 0 halted batches not fixed",
|
| 40 |
"ok": true,
|
| 41 |
-
"seconds": 0.
|
| 42 |
},
|
| 43 |
{
|
| 44 |
"A": 7,
|
|
@@ -48,7 +48,7 @@
|
|
| 48 |
"states": 65536,
|
| 49 |
"result": "random states: 65536 tested, 0 disagree with SUBLEQ, 0 halt-latch mismatches, 0 halted batches not fixed",
|
| 50 |
"ok": true,
|
| 51 |
-
"seconds": 0.
|
| 52 |
},
|
| 53 |
{
|
| 54 |
"A": 8,
|
|
@@ -58,7 +58,7 @@
|
|
| 58 |
"states": 65536,
|
| 59 |
"result": "random states: 65536 tested, 0 disagree with SUBLEQ, 0 halt-latch mismatches, 0 halted batches not fixed",
|
| 60 |
"ok": true,
|
| 61 |
-
"seconds": 0.
|
| 62 |
},
|
| 63 |
{
|
| 64 |
"A": 9,
|
|
@@ -68,7 +68,7 @@
|
|
| 68 |
"states": 65536,
|
| 69 |
"result": "random states: 65536 tested, 0 disagree with SUBLEQ, 0 halt-latch mismatches, 0 halted batches not fixed",
|
| 70 |
"ok": true,
|
| 71 |
-
"seconds":
|
| 72 |
},
|
| 73 |
{
|
| 74 |
"A": 10,
|
|
@@ -78,7 +78,7 @@
|
|
| 78 |
"states": 65536,
|
| 79 |
"result": "random states: 65536 tested, 0 disagree with SUBLEQ, 0 halt-latch mismatches, 0 halted batches not fixed",
|
| 80 |
"ok": true,
|
| 81 |
-
"seconds":
|
| 82 |
},
|
| 83 |
{
|
| 84 |
"A": 11,
|
|
@@ -88,7 +88,7 @@
|
|
| 88 |
"states": 32768,
|
| 89 |
"result": "random states: 32768 tested, 0 disagree with SUBLEQ, 0 halt-latch mismatches, 0 halted batches not fixed",
|
| 90 |
"ok": true,
|
| 91 |
-
"seconds":
|
| 92 |
},
|
| 93 |
{
|
| 94 |
"A": 12,
|
|
@@ -98,7 +98,7 @@
|
|
| 98 |
"states": 16384,
|
| 99 |
"result": "random states: 16384 tested, 0 disagree with SUBLEQ, 0 halt-latch mismatches, 0 halted batches not fixed",
|
| 100 |
"ok": true,
|
| 101 |
-
"seconds":
|
| 102 |
}
|
| 103 |
],
|
| 104 |
"ok": true
|
|
|
|
| 8 |
"states": 65536,
|
| 9 |
"result": "random states: 65536 tested, 0 disagree with SUBLEQ, 0 halt-latch mismatches, 0 halted batches not fixed",
|
| 10 |
"ok": true,
|
| 11 |
+
"seconds": 0.042346542002633214
|
| 12 |
},
|
| 13 |
{
|
| 14 |
"A": 4,
|
|
|
|
| 18 |
"states": 65536,
|
| 19 |
"result": "random states: 65536 tested, 0 disagree with SUBLEQ, 0 halt-latch mismatches, 0 halted batches not fixed",
|
| 20 |
"ok": true,
|
| 21 |
+
"seconds": 0.05908905100659467
|
| 22 |
},
|
| 23 |
{
|
| 24 |
"A": 5,
|
|
|
|
| 28 |
"states": 65536,
|
| 29 |
"result": "random states: 65536 tested, 0 disagree with SUBLEQ, 0 halt-latch mismatches, 0 halted batches not fixed",
|
| 30 |
"ok": true,
|
| 31 |
+
"seconds": 0.08752579499559943
|
| 32 |
},
|
| 33 |
{
|
| 34 |
"A": 6,
|
|
|
|
| 38 |
"states": 65536,
|
| 39 |
"result": "random states: 65536 tested, 0 disagree with SUBLEQ, 0 halt-latch mismatches, 0 halted batches not fixed",
|
| 40 |
"ok": true,
|
| 41 |
+
"seconds": 0.15457569500722457
|
| 42 |
},
|
| 43 |
{
|
| 44 |
"A": 7,
|
|
|
|
| 48 |
"states": 65536,
|
| 49 |
"result": "random states: 65536 tested, 0 disagree with SUBLEQ, 0 halt-latch mismatches, 0 halted batches not fixed",
|
| 50 |
"ok": true,
|
| 51 |
+
"seconds": 0.4722272030048771
|
| 52 |
},
|
| 53 |
{
|
| 54 |
"A": 8,
|
|
|
|
| 58 |
"states": 65536,
|
| 59 |
"result": "random states: 65536 tested, 0 disagree with SUBLEQ, 0 halt-latch mismatches, 0 halted batches not fixed",
|
| 60 |
"ok": true,
|
| 61 |
+
"seconds": 0.9474435150041245
|
| 62 |
},
|
| 63 |
{
|
| 64 |
"A": 9,
|
|
|
|
| 68 |
"states": 65536,
|
| 69 |
"result": "random states: 65536 tested, 0 disagree with SUBLEQ, 0 halt-latch mismatches, 0 halted batches not fixed",
|
| 70 |
"ok": true,
|
| 71 |
+
"seconds": 2.029002010007389
|
| 72 |
},
|
| 73 |
{
|
| 74 |
"A": 10,
|
|
|
|
| 78 |
"states": 65536,
|
| 79 |
"result": "random states: 65536 tested, 0 disagree with SUBLEQ, 0 halt-latch mismatches, 0 halted batches not fixed",
|
| 80 |
"ok": true,
|
| 81 |
+
"seconds": 3.9046387170092203
|
| 82 |
},
|
| 83 |
{
|
| 84 |
"A": 11,
|
|
|
|
| 88 |
"states": 32768,
|
| 89 |
"result": "random states: 32768 tested, 0 disagree with SUBLEQ, 0 halt-latch mismatches, 0 halted batches not fixed",
|
| 90 |
"ok": true,
|
| 91 |
+
"seconds": 4.922111371997744
|
| 92 |
},
|
| 93 |
{
|
| 94 |
"A": 12,
|
|
|
|
| 98 |
"states": 16384,
|
| 99 |
"result": "random states: 16384 tested, 0 disagree with SUBLEQ, 0 halt-latch mismatches, 0 halted batches not fixed",
|
| 100 |
"ok": true,
|
| 101 |
+
"seconds": 6.758391187002417
|
| 102 |
}
|
| 103 |
],
|
| 104 |
"ok": true
|
paper/runs/paper_host_fold.json
ADDED
|
@@ -0,0 +1,135 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"rows": [
|
| 3 |
+
{
|
| 4 |
+
"A": 3,
|
| 5 |
+
"units": 273,
|
| 6 |
+
"edges": 931,
|
| 7 |
+
"depth": 11,
|
| 8 |
+
"depth_unfolded": 13,
|
| 9 |
+
"units_unfolded": 289,
|
| 10 |
+
"edges_unfolded": 723,
|
| 11 |
+
"states": 65536,
|
| 12 |
+
"result": "random states: 65536 tested, 0 disagree with SUBLEQ, 0 halt-latch mismatches, 0 halted batches not fixed",
|
| 13 |
+
"agrees": true,
|
| 14 |
+
"seconds": 0.0
|
| 15 |
+
},
|
| 16 |
+
{
|
| 17 |
+
"A": 4,
|
| 18 |
+
"units": 632,
|
| 19 |
+
"edges": 2648,
|
| 20 |
+
"depth": 11,
|
| 21 |
+
"depth_unfolded": 13,
|
| 22 |
+
"units_unfolded": 664,
|
| 23 |
+
"edges_unfolded": 1768,
|
| 24 |
+
"states": 65536,
|
| 25 |
+
"result": "random states: 65536 tested, 0 disagree with SUBLEQ, 0 halt-latch mismatches, 0 halted batches not fixed",
|
| 26 |
+
"agrees": true,
|
| 27 |
+
"seconds": 0.1
|
| 28 |
+
},
|
| 29 |
+
{
|
| 30 |
+
"A": 5,
|
| 31 |
+
"units": 1456,
|
| 32 |
+
"edges": 7216,
|
| 33 |
+
"depth": 11,
|
| 34 |
+
"depth_unfolded": 13,
|
| 35 |
+
"units_unfolded": 1520,
|
| 36 |
+
"edges_unfolded": 4208,
|
| 37 |
+
"states": 65536,
|
| 38 |
+
"result": "random states: 65536 tested, 0 disagree with SUBLEQ, 0 halt-latch mismatches, 0 halted batches not fixed",
|
| 39 |
+
"agrees": true,
|
| 40 |
+
"seconds": 0.2
|
| 41 |
+
},
|
| 42 |
+
{
|
| 43 |
+
"A": 6,
|
| 44 |
+
"units": 3337,
|
| 45 |
+
"edges": 18976,
|
| 46 |
+
"depth": 11,
|
| 47 |
+
"depth_unfolded": 13,
|
| 48 |
+
"units_unfolded": 3465,
|
| 49 |
+
"edges_unfolded": 9824,
|
| 50 |
+
"states": 65536,
|
| 51 |
+
"result": "random states: 65536 tested, 0 disagree with SUBLEQ, 0 halt-latch mismatches, 0 halted batches not fixed",
|
| 52 |
+
"agrees": true,
|
| 53 |
+
"seconds": 0.3
|
| 54 |
+
},
|
| 55 |
+
{
|
| 56 |
+
"A": 7,
|
| 57 |
+
"units": 7587,
|
| 58 |
+
"edges": 48425,
|
| 59 |
+
"depth": 11,
|
| 60 |
+
"depth_unfolded": 13,
|
| 61 |
+
"units_unfolded": 7843,
|
| 62 |
+
"edges_unfolded": 22569,
|
| 63 |
+
"states": 65536,
|
| 64 |
+
"result": "random states: 65536 tested, 0 disagree with SUBLEQ, 0 halt-latch mismatches, 0 halted batches not fixed",
|
| 65 |
+
"agrees": true,
|
| 66 |
+
"seconds": 0.6
|
| 67 |
+
},
|
| 68 |
+
{
|
| 69 |
+
"A": 8,
|
| 70 |
+
"units": 17086,
|
| 71 |
+
"edges": 120508,
|
| 72 |
+
"depth": 11,
|
| 73 |
+
"depth_unfolded": 13,
|
| 74 |
+
"units_unfolded": 17598,
|
| 75 |
+
"edges_unfolded": 51132,
|
| 76 |
+
"states": 65536,
|
| 77 |
+
"result": "random states: 65536 tested, 0 disagree with SUBLEQ, 0 halt-latch mismatches, 0 halted batches not fixed",
|
| 78 |
+
"agrees": true,
|
| 79 |
+
"seconds": 1.6
|
| 80 |
+
},
|
| 81 |
+
{
|
| 82 |
+
"A": 9,
|
| 83 |
+
"units": 38106,
|
| 84 |
+
"edges": 293658,
|
| 85 |
+
"depth": 11,
|
| 86 |
+
"depth_unfolded": 13,
|
| 87 |
+
"units_unfolded": 39130,
|
| 88 |
+
"edges_unfolded": 114458,
|
| 89 |
+
"states": 65536,
|
| 90 |
+
"result": "random states: 65536 tested, 0 disagree with SUBLEQ, 0 halt-latch mismatches, 0 halted batches not fixed",
|
| 91 |
+
"agrees": true,
|
| 92 |
+
"seconds": 3.6
|
| 93 |
+
},
|
| 94 |
+
{
|
| 95 |
+
"A": 10,
|
| 96 |
+
"units": 84215,
|
| 97 |
+
"edges": 703108,
|
| 98 |
+
"depth": 11,
|
| 99 |
+
"depth_unfolded": 13,
|
| 100 |
+
"units_unfolded": 86263,
|
| 101 |
+
"edges_unfolded": 253572,
|
| 102 |
+
"states": 65536,
|
| 103 |
+
"result": "random states: 65536 tested, 0 disagree with SUBLEQ, 0 halt-latch mismatches, 0 halted batches not fixed",
|
| 104 |
+
"agrees": true,
|
| 105 |
+
"seconds": 7.9
|
| 106 |
+
},
|
| 107 |
+
{
|
| 108 |
+
"A": 11,
|
| 109 |
+
"units": 184597,
|
| 110 |
+
"edges": 1658619,
|
| 111 |
+
"depth": 11,
|
| 112 |
+
"depth_unfolded": 13,
|
| 113 |
+
"units_unfolded": 188693,
|
| 114 |
+
"edges_unfolded": 556795,
|
| 115 |
+
"states": 32768,
|
| 116 |
+
"result": "random states: 32768 tested, 0 disagree with SUBLEQ, 0 halt-latch mismatches, 0 halted batches not fixed",
|
| 117 |
+
"agrees": true,
|
| 118 |
+
"seconds": 12.5
|
| 119 |
+
},
|
| 120 |
+
{
|
| 121 |
+
"A": 12,
|
| 122 |
+
"units": 401716,
|
| 123 |
+
"edges": 3863424,
|
| 124 |
+
"depth": 11,
|
| 125 |
+
"depth_unfolded": 13,
|
| 126 |
+
"units_unfolded": 409908,
|
| 127 |
+
"edges_unfolded": 1213312,
|
| 128 |
+
"states": 16384,
|
| 129 |
+
"result": "random states: 16384 tested, 0 disagree with SUBLEQ, 0 halt-latch mismatches, 0 halted batches not fixed",
|
| 130 |
+
"agrees": true,
|
| 131 |
+
"seconds": 19.4
|
| 132 |
+
}
|
| 133 |
+
],
|
| 134 |
+
"all_agree": true
|
| 135 |
+
}
|
paper/runs/paper_interp.json
CHANGED
|
@@ -13,22 +13,7 @@
|
|
| 13 |
"halted_not_fixed": 0,
|
| 14 |
"counter_wrong": 0,
|
| 15 |
"ok": true,
|
| 16 |
-
"seconds":
|
| 17 |
-
},
|
| 18 |
-
{
|
| 19 |
-
"A": 13,
|
| 20 |
-
"S": 8192,
|
| 21 |
-
"G": 33,
|
| 22 |
-
"banks": 2,
|
| 23 |
-
"units": 90862,
|
| 24 |
-
"fields": 576,
|
| 25 |
-
"fields_wrong": 0,
|
| 26 |
-
"random": 1024,
|
| 27 |
-
"random_wrong": 0,
|
| 28 |
-
"halted_not_fixed": 0,
|
| 29 |
-
"counter_wrong": 0,
|
| 30 |
-
"ok": true,
|
| 31 |
-
"seconds": 9.55269223099458
|
| 32 |
}
|
| 33 |
],
|
| 34 |
"ok": true
|
|
|
|
| 13 |
"halted_not_fixed": 0,
|
| 14 |
"counter_wrong": 0,
|
| 15 |
"ok": true,
|
| 16 |
+
"seconds": 7.045043751000776
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 17 |
}
|
| 18 |
],
|
| 19 |
"ok": true
|
paper/runs/paper_neuromorphic.json
CHANGED
|
@@ -1,13 +1,12 @@
|
|
| 1 |
{
|
| 2 |
"backend": "Lava 0.10.0, fixed_pt tag (Loihi neuron model)",
|
| 3 |
"units": 106,
|
| 4 |
-
"layers":
|
| 5 |
"widths": [
|
| 6 |
48,
|
| 7 |
58,
|
| 8 |
23,
|
| 9 |
23,
|
| 10 |
-
9,
|
| 11 |
9
|
| 12 |
],
|
| 13 |
"worst_accumulation": 16,
|
|
@@ -20,7 +19,7 @@
|
|
| 20 |
"ok": true,
|
| 21 |
"akida": {
|
| 22 |
"backend": "akida 2.19.3, software backend",
|
| 23 |
-
"layers":
|
| 24 |
"patterns": 65536,
|
| 25 |
"failures": 0,
|
| 26 |
"weights_bits": 2,
|
|
|
|
| 1 |
{
|
| 2 |
"backend": "Lava 0.10.0, fixed_pt tag (Loihi neuron model)",
|
| 3 |
"units": 106,
|
| 4 |
+
"layers": 5,
|
| 5 |
"widths": [
|
| 6 |
48,
|
| 7 |
58,
|
| 8 |
23,
|
| 9 |
23,
|
|
|
|
| 10 |
9
|
| 11 |
],
|
| 12 |
"worst_accumulation": 16,
|
|
|
|
| 19 |
"ok": true,
|
| 20 |
"akida": {
|
| 21 |
"backend": "akida 2.19.3, software backend",
|
| 22 |
+
"layers": 5,
|
| 23 |
"patterns": 65536,
|
| 24 |
"failures": 0,
|
| 25 |
"weights_bits": 2,
|
paper/runs/paper_redundant_bound_r3.json
CHANGED
|
@@ -1,134 +1,126 @@
|
|
| 1 |
{
|
| 2 |
"r": 3,
|
|
|
|
|
|
|
|
|
|
| 3 |
"rows": [
|
| 4 |
{
|
| 5 |
"sigma": 0.1,
|
| 6 |
-
"
|
| 7 |
-
"
|
| 8 |
-
"
|
| 9 |
-
"second_term_uncapped": 2.13025075311841e-57,
|
| 10 |
-
"a_max": 3.671774358064498e-51,
|
| 11 |
-
"a_state_max": 3.670975669925945e-51,
|
| 12 |
-
"first_term": 1.657595730962774e-94,
|
| 13 |
-
"second_term": 2.130250753116143e-57,
|
| 14 |
-
"per_step": 2.130250753116143e-57,
|
| 15 |
-
"one_step_map_norm": 1.1207102716990636e-69,
|
| 16 |
-
"G_max": 2.177572163092903e-08,
|
| 17 |
"first_order_per_step": 9.243566309193767e-46,
|
| 18 |
-
"seconds":
|
| 19 |
},
|
| 20 |
{
|
| 21 |
"sigma": 0.15,
|
| 22 |
-
"
|
| 23 |
-
"
|
| 24 |
-
"
|
| 25 |
-
"second_term_uncapped": 9.96281774740883e-24,
|
| 26 |
-
"a_max": 1.0137246671296701e-23,
|
| 27 |
-
"a_state_max": 7.649365999909047e-24,
|
| 28 |
-
"first_term": 7.1820241657899036e-40,
|
| 29 |
-
"second_term": 9.962793936252263e-24,
|
| 30 |
-
"per_step": 9.962793936252263e-24,
|
| 31 |
-
"one_step_map_norm": 2.121416036030206e-28,
|
| 32 |
-
"G_max": 0.048788884933895625,
|
| 33 |
"first_order_per_step": 1.9186942311896616e-18,
|
| 34 |
-
"seconds":
|
| 35 |
},
|
| 36 |
{
|
| 37 |
"sigma": 0.2,
|
| 38 |
-
"
|
| 39 |
-
"
|
| 40 |
-
"
|
| 41 |
-
"second_term_uncapped": 9.84392269671024e-12,
|
| 42 |
-
"a_max": 1.9232583156861574e-13,
|
| 43 |
-
"a_state_max": 3.3772509678220235e-14,
|
| 44 |
-
"first_term": 1.3839563909399713e-20,
|
| 45 |
-
"second_term": 2.284341310002908e-12,
|
| 46 |
-
"per_step": 2.284341323842472e-12,
|
| 47 |
-
"one_step_map_norm": 2.5928274635601137e-13,
|
| 48 |
-
"G_max": 10.318938219834262,
|
| 49 |
"first_order_per_step": 8.034729050223154e-09,
|
| 50 |
-
"seconds":
|
| 51 |
},
|
| 52 |
{
|
| 53 |
"sigma": 0.22,
|
| 54 |
-
"
|
| 55 |
-
"
|
| 56 |
-
"
|
| 57 |
-
"second_term_uncapped": 6.1655968721159675e-09,
|
| 58 |
-
"a_max": 5.2390139649676e-11,
|
| 59 |
-
"a_state_max": 5.1292274254447534e-12,
|
| 60 |
-
"first_term": 3.3417127781326887e-16,
|
| 61 |
-
"second_term": 1.7924312135933292e-09,
|
| 62 |
-
"per_step": 1.7924315477646071e-09,
|
| 63 |
-
"one_step_map_norm": 8.005921428622896e-10,
|
| 64 |
-
"G_max": 36.378198953846095,
|
| 65 |
"first_order_per_step": 1.1608060917499123e-06,
|
| 66 |
-
"seconds":
|
| 67 |
},
|
| 68 |
{
|
| 69 |
"sigma": 0.25,
|
| 70 |
-
"
|
| 71 |
-
"
|
| 72 |
-
"
|
| 73 |
-
"second_term_uncapped": 1.2221903683727557e-05,
|
| 74 |
-
"a_max": 3.464062637574069e-08,
|
| 75 |
-
"a_state_max": 1.2256411202374905e-09,
|
| 76 |
-
"first_term": 2.955875675535229e-11,
|
| 77 |
-
"second_term": 2.101305150682518e-06,
|
| 78 |
-
"per_step": 2.101334709439273e-06,
|
| 79 |
-
"one_step_map_norm": 5.554923106754895e-06,
|
| 80 |
-
"G_max": 160.96107083907205,
|
| 81 |
"first_order_per_step": 0.00024842474219578326,
|
| 82 |
-
"seconds":
|
| 83 |
},
|
| 84 |
{
|
| 85 |
"sigma": 0.27,
|
| 86 |
-
"
|
| 87 |
-
"
|
| 88 |
-
"
|
| 89 |
-
"second_term_uncapped": 0.0008325628286829023,
|
| 90 |
-
"a_max": 1.2542660971875762e-06,
|
| 91 |
-
"a_state_max": 1.896662835974905e-08,
|
| 92 |
-
"first_term": 1.5422649474591534e-08,
|
| 93 |
-
"second_term": 9.280154361716902e-05,
|
| 94 |
-
"per_step": 9.28169662666436e-05,
|
| 95 |
-
"one_step_map_norm": 0.0004731405980891133,
|
| 96 |
-
"G_max": 502.241185749977,
|
| 97 |
"first_order_per_step": 0.00348406062858411,
|
| 98 |
-
"
|
|
|
|
|
|
|
|
|
|
| 99 |
},
|
| 100 |
{
|
| 101 |
"sigma": 0.3,
|
| 102 |
-
"
|
| 103 |
-
"
|
| 104 |
-
"
|
| 105 |
-
"second_term_uncapped": 0.26158463232188245,
|
| 106 |
-
"a_max": 0.00011903221609335197,
|
| 107 |
-
"a_state_max": 5.40858095381371e-07,
|
| 108 |
-
"first_term": 5.502587076206081e-05,
|
| 109 |
-
"second_term": 0.01129871498942794,
|
| 110 |
-
"per_step": 0.011353740860190002,
|
| 111 |
-
"one_step_map_norm": 0.08616087624087705,
|
| 112 |
-
"G_max": 9637.91625882214,
|
| 113 |
"first_order_per_step": 0.07217943910232472,
|
| 114 |
-
"
|
|
|
|
|
|
|
|
|
|
| 115 |
},
|
| 116 |
{
|
| 117 |
"sigma": 0.33,
|
| 118 |
-
"
|
| 119 |
-
"
|
| 120 |
-
"
|
| 121 |
"first_order_per_step": 0.6901493276563357,
|
| 122 |
-
"
|
|
|
|
|
|
|
|
|
|
| 123 |
},
|
| 124 |
{
|
| 125 |
"sigma": 0.36,
|
| 126 |
-
"
|
| 127 |
-
"
|
| 128 |
-
"
|
| 129 |
-
"one_step_map_norm": 103.09080918475902,
|
| 130 |
"first_order_per_step": 3.8914228635558983,
|
| 131 |
-
"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 132 |
}
|
| 133 |
]
|
| 134 |
}
|
|
|
|
| 1 |
{
|
| 2 |
"r": 3,
|
| 3 |
+
"eps_rel": 1e-20,
|
| 4 |
+
"warm": 20,
|
| 5 |
+
"steps": 20000,
|
| 6 |
"rows": [
|
| 7 |
{
|
| 8 |
"sigma": 0.1,
|
| 9 |
+
"mean_per_step": 8.62378451004601e-59,
|
| 10 |
+
"copy_fails_within": 1.724756902009202e-54,
|
| 11 |
+
"max_per_step": 9.775048270320726e-59,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 12 |
"first_order_per_step": 9.243566309193767e-46,
|
| 13 |
+
"seconds": 11.711842716002138
|
| 14 |
},
|
| 15 |
{
|
| 16 |
"sigma": 0.15,
|
| 17 |
+
"mean_per_step": 4.0163365923558445e-25,
|
| 18 |
+
"copy_fails_within": 8.032673184711689e-21,
|
| 19 |
+
"max_per_step": 4.552440693343307e-25,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 20 |
"first_order_per_step": 1.9186942311896616e-18,
|
| 21 |
+
"seconds": 6.760910181008512
|
| 22 |
},
|
| 23 |
{
|
| 24 |
"sigma": 0.2,
|
| 25 |
+
"mean_per_step": 3.594224435004788e-13,
|
| 26 |
+
"copy_fails_within": 7.188448870009576e-09,
|
| 27 |
+
"max_per_step": 4.073045627177968e-13,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 28 |
"first_order_per_step": 8.034729050223154e-09,
|
| 29 |
+
"seconds": 7.53932050599542
|
| 30 |
},
|
| 31 |
{
|
| 32 |
"sigma": 0.22,
|
| 33 |
+
"mean_per_step": 1.8216161263773102e-10,
|
| 34 |
+
"copy_fails_within": 3.64323225275462e-06,
|
| 35 |
+
"max_per_step": 2.0637830182951588e-10,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 36 |
"first_order_per_step": 1.1608060917499123e-06,
|
| 37 |
+
"seconds": 8.331472831996507
|
| 38 |
},
|
| 39 |
{
|
| 40 |
"sigma": 0.25,
|
| 41 |
+
"mean_per_step": 1.5844223950469426e-07,
|
| 42 |
+
"copy_fails_within": 0.0031688447900938854,
|
| 43 |
+
"max_per_step": 1.793891680047805e-07,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 44 |
"first_order_per_step": 0.00024842474219578326,
|
| 45 |
+
"seconds": 10.571515559990075
|
| 46 |
},
|
| 47 |
{
|
| 48 |
"sigma": 0.27,
|
| 49 |
+
"mean_per_step": 4.564830837465998e-06,
|
| 50 |
+
"copy_fails_within": 0.09129661674931996,
|
| 51 |
+
"max_per_step": 5.164752301158859e-06,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 52 |
"first_order_per_step": 0.00348406062858411,
|
| 53 |
+
"weighted_per_step": 4.565395070557826e-06,
|
| 54 |
+
"measured_per_step": 4.04038771560519e-06,
|
| 55 |
+
"bound_over_measured": 1.1299398453581324,
|
| 56 |
+
"seconds": 9.429403156012995
|
| 57 |
},
|
| 58 |
{
|
| 59 |
"sigma": 0.3,
|
| 60 |
+
"mean_per_step": 0.00022503609474087795,
|
| 61 |
+
"copy_fails_within": 4.500721894817559,
|
| 62 |
+
"max_per_step": 0.00025420950016006276,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 63 |
"first_order_per_step": 0.07217943910232472,
|
| 64 |
+
"weighted_per_step": 0.00022623484530688985,
|
| 65 |
+
"measured_per_step": 0.00021344138662366218,
|
| 66 |
+
"bound_over_measured": 1.0599389784971036,
|
| 67 |
+
"seconds": 11.259821197003475
|
| 68 |
},
|
| 69 |
{
|
| 70 |
"sigma": 0.33,
|
| 71 |
+
"mean_per_step": 0.0042965643210881085,
|
| 72 |
+
"copy_fails_within": 85.93128642176217,
|
| 73 |
+
"max_per_step": 0.004841570236397044,
|
| 74 |
"first_order_per_step": 0.6901493276563357,
|
| 75 |
+
"weighted_per_step": 0.004338162717970295,
|
| 76 |
+
"measured_per_step": 0.003663003663003663,
|
| 77 |
+
"bound_over_measured": 1.1843184220058904,
|
| 78 |
+
"seconds": 13.271249087993056
|
| 79 |
},
|
| 80 |
{
|
| 81 |
"sigma": 0.36,
|
| 82 |
+
"mean_per_step": 0.04307517775881877,
|
| 83 |
+
"copy_fails_within": 861.5035551763755,
|
| 84 |
+
"max_per_step": 0.04851092063154471,
|
|
|
|
| 85 |
"first_order_per_step": 3.8914228635558983,
|
| 86 |
+
"weighted_per_step": 0.043002531462667054,
|
| 87 |
+
"measured_per_step": 0.029250457038391225,
|
| 88 |
+
"bound_over_measured": 1.4701490443799299,
|
| 89 |
+
"seconds": 14.450505137006985
|
| 90 |
+
}
|
| 91 |
+
],
|
| 92 |
+
"whole_run": [
|
| 93 |
+
{
|
| 94 |
+
"sigma": 0.2,
|
| 95 |
+
"steps": 1664939,
|
| 96 |
+
"halted": true,
|
| 97 |
+
"sum": 6.13298895984149e-07,
|
| 98 |
+
"first_order": 0.013377333750149488,
|
| 99 |
+
"seconds": 1009.8898845410004
|
| 100 |
+
},
|
| 101 |
+
{
|
| 102 |
+
"sigma": 0.22,
|
| 103 |
+
"steps": 1664939,
|
| 104 |
+
"halted": true,
|
| 105 |
+
"sum": 0.00031088108794885024,
|
| 106 |
+
"first_order": 1.9326713335920072,
|
| 107 |
+
"seconds": 718.5945065489941
|
| 108 |
+
},
|
| 109 |
+
{
|
| 110 |
+
"sigma": 0.25,
|
| 111 |
+
"steps": 1664939,
|
| 112 |
+
"halted": true,
|
| 113 |
+
"sum": 0.2705024543907856,
|
| 114 |
+
"first_order": 413.61204184670515,
|
| 115 |
+
"seconds": 895.1203591780068
|
| 116 |
+
},
|
| 117 |
+
{
|
| 118 |
+
"sigma": 0.27,
|
| 119 |
+
"steps": 1664939,
|
| 120 |
+
"halted": true,
|
| 121 |
+
"sum": 7.796025562214103,
|
| 122 |
+
"first_order": 5800.7484188942,
|
| 123 |
+
"seconds": 800.8464757290058
|
| 124 |
}
|
| 125 |
]
|
| 126 |
}
|
paper/runs/paper_redundant_r3.json
CHANGED
|
@@ -25,7 +25,7 @@
|
|
| 25 |
"bias_min": -23,
|
| 26 |
"bias_max": 4,
|
| 27 |
"max_fanin": 768,
|
| 28 |
-
"build_seconds":
|
| 29 |
"sigma_roundtrip": true,
|
| 30 |
"c_random": "random states: 65536 tested, 0 disagree with SUBLEQ, 0 halt-latch mismatches, 0 halted batches not fixed",
|
| 31 |
"c_random_ok": true,
|
|
|
|
| 25 |
"bias_min": -23,
|
| 26 |
"bias_max": 4,
|
| 27 |
"max_fanin": 768,
|
| 28 |
+
"build_seconds": 1.416611548003857,
|
| 29 |
"sigma_roundtrip": true,
|
| 30 |
"c_random": "random states: 65536 tested, 0 disagree with SUBLEQ, 0 halt-latch mismatches, 0 halted batches not fixed",
|
| 31 |
"c_random_ok": true,
|
paper/runs/paper_rocq.json
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"rocq": "The Rocq Prover, version 9.1.1",
|
| 3 |
+
"files": 25,
|
| 4 |
+
"build_seconds": 220.6,
|
| 5 |
+
"theorems": {
|
| 6 |
+
"PhysMain.netlist_step": "closed",
|
| 7 |
+
"PhysFacts.phys_size": "closed",
|
| 8 |
+
"PhysFacts.phys_ternary": "closed",
|
| 9 |
+
"NetMain.network_orbit": "closed",
|
| 10 |
+
"NetMain.network_reproduces": "closed",
|
| 11 |
+
"Complete.describe_complete": "closed",
|
| 12 |
+
"PassLemma.machine_pass": "closed",
|
| 13 |
+
"Run.universal_construction": "closed",
|
| 14 |
+
"Main.builds_every_image": "closed",
|
| 15 |
+
"Main.reproduces_forever": "closed",
|
| 16 |
+
"Main.every_generation": "closed",
|
| 17 |
+
"SelfRep.self_reproduction": "closed",
|
| 18 |
+
"SelfRep.second_generation": "closed",
|
| 19 |
+
"SelfRep.periodic": "closed"
|
| 20 |
+
},
|
| 21 |
+
"extraction_identical": true
|
| 22 |
+
}
|
paper/runs/paper_twohead.json
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"records": 133,
|
| 3 |
+
"bank_bits": 3458,
|
| 4 |
+
"description_bits": 2930,
|
| 5 |
+
"description_over_bank": 0.847,
|
| 6 |
+
"escaped_records": 0,
|
| 7 |
+
"window_cells_used": 36,
|
| 8 |
+
"generations": [
|
| 9 |
+
{
|
| 10 |
+
"generation": 1,
|
| 11 |
+
"steps": 920892,
|
| 12 |
+
"passes": 6924,
|
| 13 |
+
"kappa": 1,
|
| 14 |
+
"banks_hold_organism": true,
|
| 15 |
+
"tapes_hold_description": true
|
| 16 |
+
},
|
| 17 |
+
{
|
| 18 |
+
"generation": 2,
|
| 19 |
+
"steps": 920892,
|
| 20 |
+
"passes": 6924,
|
| 21 |
+
"kappa": 0,
|
| 22 |
+
"banks_hold_organism": true,
|
| 23 |
+
"tapes_hold_description": true
|
| 24 |
+
},
|
| 25 |
+
{
|
| 26 |
+
"generation": 3,
|
| 27 |
+
"steps": 920892,
|
| 28 |
+
"passes": 6924,
|
| 29 |
+
"kappa": 1,
|
| 30 |
+
"banks_hold_organism": true,
|
| 31 |
+
"tapes_hold_description": true
|
| 32 |
+
}
|
| 33 |
+
],
|
| 34 |
+
"state_after_generation_3_equals_after_1": true,
|
| 35 |
+
"sha256_organism": "e798ce81da252d6717b0f99321aa401924637b48fe09558a6590006de2e2ffe1",
|
| 36 |
+
"sha256_description": "59c917d4b2602b253bbae19d9866869587abea197730197fee8054acc8781d54",
|
| 37 |
+
"seconds": 23.9
|
| 38 |
+
}
|
paper/runs/paper_twohead_net.json
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"random_states": {
|
| 3 |
+
"small": {
|
| 4 |
+
"G": 5,
|
| 5 |
+
"L": 40,
|
| 6 |
+
"states": 300,
|
| 7 |
+
"disagreements": 0
|
| 8 |
+
},
|
| 9 |
+
"full": {
|
| 10 |
+
"G": 133,
|
| 11 |
+
"L": 2930,
|
| 12 |
+
"states": 20,
|
| 13 |
+
"disagreements": 0
|
| 14 |
+
},
|
| 15 |
+
"netlist": {
|
| 16 |
+
"units": 45891,
|
| 17 |
+
"edges": 99602,
|
| 18 |
+
"depth": 15,
|
| 19 |
+
"state_bits": 12837
|
| 20 |
+
},
|
| 21 |
+
"seconds": 4.9
|
| 22 |
+
},
|
| 23 |
+
"netlist": {
|
| 24 |
+
"path": "variants/twohead_physics.bin",
|
| 25 |
+
"bytes": 816896,
|
| 26 |
+
"sha256": "0b86fbe2da1d67beafb252a445738794f4eb35ad4aa8987030c65d3612aa50fe",
|
| 27 |
+
"G": 133,
|
| 28 |
+
"L": 2930,
|
| 29 |
+
"units": 45891,
|
| 30 |
+
"edges": 99602,
|
| 31 |
+
"depth": 15,
|
| 32 |
+
"state_bits": 12837
|
| 33 |
+
},
|
| 34 |
+
"lockstep": {
|
| 35 |
+
"generations": 3,
|
| 36 |
+
"output": [
|
| 37 |
+
"generation 1: 920892 steps; netlist child bank == rho: 1, child description == description: 1",
|
| 38 |
+
"generation 2: 920892 steps; netlist child bank == rho: 1, child description == description: 1",
|
| 39 |
+
"generation 3: 920892 steps; netlist child bank == rho: 1, child description == description: 1",
|
| 40 |
+
"2762676 steps in lockstep, 0 state mismatches"
|
| 41 |
+
],
|
| 42 |
+
"seconds": 322.4
|
| 43 |
+
},
|
| 44 |
+
"extraction": {
|
| 45 |
+
"N": 3458,
|
| 46 |
+
"L": 2930,
|
| 47 |
+
"identical": true,
|
| 48 |
+
"sha256_generator": "0b86fbe2da1d67beafb252a445738794f4eb35ad4aa8987030c65d3612aa50fe",
|
| 49 |
+
"sha256_rocq": "0b86fbe2da1d67beafb252a445738794f4eb35ad4aa8987030c65d3612aa50fe"
|
| 50 |
+
}
|
| 51 |
+
}
|
paper/runs/paper_verify_times.json
CHANGED
|
@@ -1,75 +1,75 @@
|
|
| 1 |
{
|
| 2 |
"tier": 1,
|
| 3 |
-
"total_seconds":
|
| 4 |
"failures": 0,
|
| 5 |
"checks": {
|
| 6 |
"check_device.py": {
|
| 7 |
"ok": true,
|
| 8 |
-
"seconds": 0.
|
| 9 |
},
|
| 10 |
"check_framing.py": {
|
| 11 |
"ok": true,
|
| 12 |
-
"seconds": 0.
|
|
|
|
|
|
|
|
|
|
|
|
|
| 13 |
},
|
| 14 |
"check_steps.py": {
|
| 15 |
"ok": true,
|
| 16 |
-
"seconds":
|
| 17 |
},
|
| 18 |
"check_optimal.py": {
|
| 19 |
"ok": true,
|
| 20 |
-
"seconds":
|
| 21 |
},
|
| 22 |
"check_codec.py": {
|
| 23 |
"ok": true,
|
| 24 |
-
"seconds":
|
| 25 |
},
|
| 26 |
-
"
|
| 27 |
"ok": true,
|
| 28 |
-
"seconds":
|
| 29 |
},
|
| 30 |
-
"
|
| 31 |
"ok": true,
|
| 32 |
-
"seconds":
|
| 33 |
},
|
| 34 |
"check_environment.py": {
|
| 35 |
"ok": true,
|
| 36 |
-
"seconds":
|
|
|
|
|
|
|
|
|
|
|
|
|
| 37 |
},
|
| 38 |
"check_host.py": {
|
| 39 |
"ok": true,
|
| 40 |
-
"seconds":
|
| 41 |
},
|
| 42 |
"check_ternarity.py": {
|
| 43 |
"ok": true,
|
| 44 |
-
"seconds":
|
| 45 |
},
|
| 46 |
"check_host_family.py": {
|
| 47 |
"ok": true,
|
| 48 |
-
"seconds":
|
| 49 |
},
|
| 50 |
-
"
|
| 51 |
"ok": true,
|
| 52 |
-
"seconds":
|
| 53 |
},
|
| 54 |
-
"
|
| 55 |
"ok": true,
|
| 56 |
-
"seconds":
|
| 57 |
},
|
| 58 |
"check_total.py": {
|
| 59 |
"ok": true,
|
| 60 |
-
"seconds":
|
| 61 |
},
|
| 62 |
"redundant.py build": {
|
| 63 |
"ok": true,
|
| 64 |
-
"seconds":
|
| 65 |
-
},
|
| 66 |
-
"check_dependence.py": {
|
| 67 |
-
"ok": true,
|
| 68 |
-
"seconds": 194.36693952101632
|
| 69 |
-
},
|
| 70 |
-
"check_settle.py": {
|
| 71 |
-
"ok": true,
|
| 72 |
-
"seconds": 216.78103429600014
|
| 73 |
}
|
| 74 |
}
|
| 75 |
}
|
|
|
|
| 1 |
{
|
| 2 |
"tier": 1,
|
| 3 |
+
"total_seconds": 214.8219217349979,
|
| 4 |
"failures": 0,
|
| 5 |
"checks": {
|
| 6 |
"check_device.py": {
|
| 7 |
"ok": true,
|
| 8 |
+
"seconds": 0.14191210998978931
|
| 9 |
},
|
| 10 |
"check_framing.py": {
|
| 11 |
"ok": true,
|
| 12 |
+
"seconds": 0.5073039440030698
|
| 13 |
+
},
|
| 14 |
+
"twohead_net.py check": {
|
| 15 |
+
"ok": true,
|
| 16 |
+
"seconds": 5.247474653995596
|
| 17 |
},
|
| 18 |
"check_steps.py": {
|
| 19 |
"ok": true,
|
| 20 |
+
"seconds": 5.269182780990377
|
| 21 |
},
|
| 22 |
"check_optimal.py": {
|
| 23 |
"ok": true,
|
| 24 |
+
"seconds": 7.710004391003167
|
| 25 |
},
|
| 26 |
"check_codec.py": {
|
| 27 |
"ok": true,
|
| 28 |
+
"seconds": 7.851285790995462
|
| 29 |
},
|
| 30 |
+
"check_sigma.py": {
|
| 31 |
"ok": true,
|
| 32 |
+
"seconds": 11.03636751799786
|
| 33 |
},
|
| 34 |
+
"fanin2.py": {
|
| 35 |
"ok": true,
|
| 36 |
+
"seconds": 12.635428726993268
|
| 37 |
},
|
| 38 |
"check_environment.py": {
|
| 39 |
"ok": true,
|
| 40 |
+
"seconds": 12.856029444010346
|
| 41 |
+
},
|
| 42 |
+
"check_interp.py": {
|
| 43 |
+
"ok": true,
|
| 44 |
+
"seconds": 13.257643950011698
|
| 45 |
},
|
| 46 |
"check_host.py": {
|
| 47 |
"ok": true,
|
| 48 |
+
"seconds": 14.019029688002774
|
| 49 |
},
|
| 50 |
"check_ternarity.py": {
|
| 51 |
"ok": true,
|
| 52 |
+
"seconds": 15.632652968997718
|
| 53 |
},
|
| 54 |
"check_host_family.py": {
|
| 55 |
"ok": true,
|
| 56 |
+
"seconds": 26.31405289299437
|
| 57 |
},
|
| 58 |
+
"check_lev.py": {
|
| 59 |
"ok": true,
|
| 60 |
+
"seconds": 32.38079876700067
|
| 61 |
},
|
| 62 |
+
"check_host_fold.py": {
|
| 63 |
"ok": true,
|
| 64 |
+
"seconds": 51.92139666900039
|
| 65 |
},
|
| 66 |
"check_total.py": {
|
| 67 |
"ok": true,
|
| 68 |
+
"seconds": 205.5435071989923
|
| 69 |
},
|
| 70 |
"redundant.py build": {
|
| 71 |
"ok": true,
|
| 72 |
+
"seconds": 214.77837346300657
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 73 |
}
|
| 74 |
}
|
| 75 |
}
|
paper/universal_construction_ternary.pdf
CHANGED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:
|
| 3 |
-
size
|
|
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:d05a260a7e12935b1e20bb7bc6e5690f2f29d9c04de210aaa7eb3618ab4280e1
|
| 3 |
+
size 356867
|
paper/universal_construction_ternary.tex
CHANGED
|
The diff for this file is too large to render.
See raw diff
|
|
|
rocq/Abstract.v
ADDED
|
@@ -0,0 +1,371 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
(* Within one pass, a tape is seen through the cells from its head that the pass may touch
|
| 2 |
+
and the number of cells it has moved; the program bank through the index of the record
|
| 3 |
+
in front of it. One step of the physics refines one step of this abstract machine. *)
|
| 4 |
+
From Stdlib Require Import List Bool Arith ZArith Lia.
|
| 5 |
+
Import ListNotations.
|
| 6 |
+
From TH Require Import TwoHead Tapes Iter.
|
| 7 |
+
|
| 8 |
+
Record atape := mkA { pre : list bool; mv : nat }.
|
| 9 |
+
|
| 10 |
+
Definition ahd (t : atape) : bool := nth (mv t) (pre t) false.
|
| 11 |
+
Definition awr (t : atape) (v : bool) : atape := mkA (upd (pre t) (mv t) v) (mv t).
|
| 12 |
+
Definition aturn (t : atape) : atape := mkA (pre t) (S (mv t)).
|
| 13 |
+
Definition aok (t : atape) : bool := Nat.ltb (mv t) (length (pre t)).
|
| 14 |
+
|
| 15 |
+
Record ast := mkAS { aw : list bool; aR : atape; aA : atape; aK : atape; ai : nat; bad : bool }.
|
| 16 |
+
|
| 17 |
+
Definition acell (t : ast) (x : nat) : bool :=
|
| 18 |
+
if Nat.eqb x RD then ahd (aR t)
|
| 19 |
+
else if Nat.eqb x ARM then ahd (aA t)
|
| 20 |
+
else if Nat.eqb x CPY then ahd (aK t)
|
| 21 |
+
else wget (aw t) x.
|
| 22 |
+
|
| 23 |
+
(* an operand with a nonzero weight on a tape cell must lie inside the touched cells *)
|
| 24 |
+
Definition opok (t : ast) (x : nat) (w : Z) : bool :=
|
| 25 |
+
if Z.eqb w 0 then true
|
| 26 |
+
else if Nat.eqb x RD then aok (aR t)
|
| 27 |
+
else if Nat.eqb x ARM then aok (aA t)
|
| 28 |
+
else if Nat.eqb x CPY then aok (aK t)
|
| 29 |
+
else true.
|
| 30 |
+
|
| 31 |
+
Definition astep (rs : list rec) (t : ast) : ast :=
|
| 32 |
+
match nth_error rs (ai t) with
|
| 33 |
+
| None => mkAS (aw t) (aR t) (aA t) (aK t) (ai t) true
|
| 34 |
+
| Some (Rec a0 w0 a1 w1 beta ao) =>
|
| 35 |
+
let v := Z.leb 0 (w0 * b2z (acell t a0) + w1 * b2z (acell t a1) + beta)%Z in
|
| 36 |
+
let wn := if Nat.eqb ao RD || Nat.eqb ao ARM || Nat.eqb ao CPY then aw t
|
| 37 |
+
else upd (aw t) ao v in
|
| 38 |
+
let A1 := if Nat.eqb ao ARM then awr (aA t) v else aA t in
|
| 39 |
+
let K1 := if Nat.eqb ao CPY then awr (aK t) v else aK t in
|
| 40 |
+
let okw := (if Nat.eqb ao ARM then aok (aA t) else true)
|
| 41 |
+
&& (if Nat.eqb ao CPY then aok (aK t) else true) in
|
| 42 |
+
let okk := negb (Nat.eqb ao KAPPA) || Nat.eqb (S (ai t)) (length rs) in
|
| 43 |
+
let A2 := if wget wn AA then aturn A1 else A1 in
|
| 44 |
+
let R2 := if wget wn AR then aturn (aR t) else aR t in
|
| 45 |
+
let K2 := if wget wn AC then aturn K1 else K1 in
|
| 46 |
+
let w2 := upd (upd (upd wn AA false) AR false) AC false in
|
| 47 |
+
mkAS w2 R2 A2 K2 (S (ai t))
|
| 48 |
+
(bad t || negb (opok t a0 w0 && opok t a1 w1 && okw && okk))
|
| 49 |
+
end.
|
| 50 |
+
|
| 51 |
+
Fixpoint aiter (n : nat) (rs : list rec) (t : ast) : ast :=
|
| 52 |
+
match n with O => t | S m => aiter m rs (astep rs t) end.
|
| 53 |
+
|
| 54 |
+
Definition enc (rs : list rec) : list bool := concat (map enc_rec rs).
|
| 55 |
+
|
| 56 |
+
(* the concrete state s and the abstract state t agree, the roles of the tapes being those
|
| 57 |
+
of the bank bit k0 *)
|
| 58 |
+
Definition rel (k0 : bool) (rs : list rec) (restR restA restK : list bool) (s : st) (t : ast) : Prop :=
|
| 59 |
+
(forall x, x <> RD -> x <> ARM -> x <> CPY -> wget (win s) x = wget (aw t) x)
|
| 60 |
+
/\ length (win s) = 64 /\ length (aw t) = 64
|
| 61 |
+
/\ contents (if k0 then d1 s else d0 s) = rotn (mv (aR t)) (pre (aR t) ++ restR)
|
| 62 |
+
/\ contents (if k0 then q0 s else q1 s) = rotn (mv (aA t)) (pre (aA t) ++ restA)
|
| 63 |
+
/\ contents (if k0 then d0 s else d1 s) = rotn (mv (aK t)) (pre (aK t) ++ restK)
|
| 64 |
+
/\ contents (if k0 then q1 s else q0 s) = rotn (26 * ai t) (enc rs).
|
| 65 |
+
|
| 66 |
+
(* ---- facts about the record layout -------------------------------------- *)
|
| 67 |
+
Lemma enc_rec_length : forall r, length (enc_rec r) = 26.
|
| 68 |
+
Proof.
|
| 69 |
+
intros [a0 w0 a1 w1 beta ao]; unfold enc_rec.
|
| 70 |
+
assert (Hw : forall w, length (enc_w w) = 2) by
|
| 71 |
+
(intro w; unfold enc_w; destruct (Z.eqb w 1); [reflexivity|destruct (Z.eqb w (-1)); reflexivity]).
|
| 72 |
+
assert (Hn : forall k v, length (nat2bits k v) = k) by
|
| 73 |
+
(induction k as [|k IH]; intro v; simpl; auto).
|
| 74 |
+
rewrite !length_app, !Hw, !Hn. reflexivity.
|
| 75 |
+
Qed.
|
| 76 |
+
|
| 77 |
+
Lemma enc_length : forall rs, length (enc rs) = 26 * length rs.
|
| 78 |
+
Proof.
|
| 79 |
+
induction rs as [|r rs IH]; unfold enc in *; simpl; auto.
|
| 80 |
+
rewrite length_app, enc_rec_length, IH. lia.
|
| 81 |
+
Qed.
|
| 82 |
+
|
| 83 |
+
Lemma enc_app : forall a b, enc (a ++ b) = enc a ++ enc b.
|
| 84 |
+
Proof. intros a b; unfold enc. rewrite map_app, concat_app. reflexivity. Qed.
|
| 85 |
+
|
| 86 |
+
Lemma rotn_plus : forall a b l, rotn (a + b) l = rotn b (rotn a l).
|
| 87 |
+
Proof. induction a as [|a IH]; intros b l; simpl; auto. Qed.
|
| 88 |
+
|
| 89 |
+
Lemma rotn_rec : forall rs i r, nth_error rs i = Some r ->
|
| 90 |
+
firstn 26 (rotn (26 * i) (enc rs)) = enc_rec r.
|
| 91 |
+
Proof.
|
| 92 |
+
intros rs i r H.
|
| 93 |
+
destruct (nth_error_split rs i H) as (l1 & l2 & -> & Hl).
|
| 94 |
+
rewrite enc_app.
|
| 95 |
+
assert (E : enc (r :: l2) = enc_rec r ++ enc l2) by reflexivity.
|
| 96 |
+
rewrite E.
|
| 97 |
+
replace (26 * i) with (length (enc l1)) by (rewrite enc_length; lia).
|
| 98 |
+
rewrite rotn_app, <- app_assoc.
|
| 99 |
+
rewrite firstn_app, enc_rec_length, Nat.sub_diag, firstn_O, app_nil_r.
|
| 100 |
+
apply firstn_all2. rewrite enc_rec_length. lia.
|
| 101 |
+
Qed.
|
| 102 |
+
|
| 103 |
+
(* ---- one step of the physics, unfolded ----------------------------------- *)
|
| 104 |
+
Definition cellof (s : st) (k : bool) (a : nat) : bool :=
|
| 105 |
+
if Nat.eqb a RD then hd_t (if k then d1 s else d0 s)
|
| 106 |
+
else if Nat.eqb a ARM then hd_t (if k then q0 s else q1 s)
|
| 107 |
+
else if Nat.eqb a CPY then hd_t (if k then d0 s else d1 s)
|
| 108 |
+
else wget (win s) a.
|
| 109 |
+
|
| 110 |
+
Definition wnext (w : list bool) (ao : nat) (v : bool) : list bool :=
|
| 111 |
+
if Nat.eqb ao RD || Nat.eqb ao ARM || Nat.eqb ao CPY then w else upd w ao v.
|
| 112 |
+
|
| 113 |
+
Definition clearq (w : list bool) : list bool := upd (upd (upd w AA false) AR false) AC false.
|
| 114 |
+
|
| 115 |
+
Definition stepres (s : st) (k : bool) (qa' : tape) (ao : nat) (v : bool) : st :=
|
| 116 |
+
let qi := if k then q0 s else q1 s in
|
| 117 |
+
let da := if k then d1 s else d0 s in
|
| 118 |
+
let di := if k then d0 s else d1 s in
|
| 119 |
+
let wn := wnext (win s) ao v in
|
| 120 |
+
let qi1 := if Nat.eqb ao ARM then wr_t qi v else qi in
|
| 121 |
+
let di1 := if Nat.eqb ao CPY then wr_t di v else di in
|
| 122 |
+
let qi2 := if wget wn AA then turn1 qi1 else qi1 in
|
| 123 |
+
let da2 := if wget wn AR then turn1 da else da in
|
| 124 |
+
let di2 := if wget wn AC then turn1 di1 else di1 in
|
| 125 |
+
if k then mkS (clearq wn) qi2 qa' di2 da2 else mkS (clearq wn) qa' qi2 da2 di2.
|
| 126 |
+
|
| 127 |
+
Lemma step_char : forall s k bits qa' a0 w0 a1 w1 beta ao v,
|
| 128 |
+
wget (win s) KAPPA = k ->
|
| 129 |
+
popn 26 (if k then q1 s else q0 s) = (bits, qa') ->
|
| 130 |
+
decode bits = Rec a0 w0 a1 w1 beta ao ->
|
| 131 |
+
v = Z.leb 0 (w0 * b2z (cellof s k a0) + w1 * b2z (cellof s k a1) + beta)%Z ->
|
| 132 |
+
step s = stepres s k qa' ao v.
|
| 133 |
+
Proof.
|
| 134 |
+
intros s k bits qa' a0 w0 a1 w1 beta ao v Hk Hp Hd Hv.
|
| 135 |
+
unfold step, stepres, cellof, wnext, clearq. cbv zeta. rewrite Hk, Hp, Hd. subst v. reflexivity.
|
| 136 |
+
Qed.
|
| 137 |
+
|
| 138 |
+
Definition astepres (rs : list rec) (t : ast) (a0 : nat) (w0 : Z) (a1 : nat) (w1 : Z) (ao : nat) (v : bool) : ast :=
|
| 139 |
+
let wn := wnext (aw t) ao v in
|
| 140 |
+
let A1 := if Nat.eqb ao ARM then awr (aA t) v else aA t in
|
| 141 |
+
let K1 := if Nat.eqb ao CPY then awr (aK t) v else aK t in
|
| 142 |
+
let okw := (if Nat.eqb ao ARM then aok (aA t) else true)
|
| 143 |
+
&& (if Nat.eqb ao CPY then aok (aK t) else true) in
|
| 144 |
+
let okk := negb (Nat.eqb ao KAPPA) || Nat.eqb (S (ai t)) (length rs) in
|
| 145 |
+
let A2 := if wget wn AA then aturn A1 else A1 in
|
| 146 |
+
let R2 := if wget wn AR then aturn (aR t) else aR t in
|
| 147 |
+
let K2 := if wget wn AC then aturn K1 else K1 in
|
| 148 |
+
mkAS (clearq wn) R2 A2 K2 (S (ai t))
|
| 149 |
+
(bad t || negb (opok t a0 w0 && opok t a1 w1 && okw && okk)).
|
| 150 |
+
|
| 151 |
+
Lemma astep_char : forall rs t a0 w0 a1 w1 beta ao,
|
| 152 |
+
nth_error rs (ai t) = Some (Rec a0 w0 a1 w1 beta ao) ->
|
| 153 |
+
astep rs t = astepres rs t a0 w0 a1 w1 ao
|
| 154 |
+
(Z.leb 0 (w0 * b2z (acell t a0) + w1 * b2z (acell t a1) + beta)%Z).
|
| 155 |
+
Proof. intros rs t a0 w0 a1 w1 beta ao H. unfold astep, astepres, wnext, clearq. rewrite H. reflexivity. Qed.
|
| 156 |
+
|
| 157 |
+
(* ---- windows -------------------------------------------------------------- *)
|
| 158 |
+
Lemma wget_upd : forall w i v x,
|
| 159 |
+
wget (upd w i v) x = if Nat.eqb x i && Nat.ltb i (length w) then v else wget w x.
|
| 160 |
+
Proof.
|
| 161 |
+
unfold wget. induction w as [|y w IH]; intros i v x.
|
| 162 |
+
- simpl. rewrite andb_false_r. destruct x; reflexivity.
|
| 163 |
+
- destruct i as [|i], x as [|x]; simpl; try reflexivity; rewrite IH; reflexivity.
|
| 164 |
+
Qed.
|
| 165 |
+
|
| 166 |
+
Definition agree (w w' : list bool) : Prop :=
|
| 167 |
+
forall x, x <> RD -> x <> ARM -> x <> CPY -> wget w x = wget w' x.
|
| 168 |
+
|
| 169 |
+
Lemma agree_upd : forall w w' i v, agree w w' -> length w = length w' ->
|
| 170 |
+
agree (upd w i v) (upd w' i v).
|
| 171 |
+
Proof.
|
| 172 |
+
intros w w' i v H Hl x H1 H2 H3. rewrite !wget_upd, Hl.
|
| 173 |
+
destruct (Nat.eqb x i && Nat.ltb i (length w')); auto.
|
| 174 |
+
Qed.
|
| 175 |
+
|
| 176 |
+
Lemma b2z_mul0 : forall b, (0 * b2z b = 0)%Z.
|
| 177 |
+
Proof. intros [|]; reflexivity. Qed.
|
| 178 |
+
|
| 179 |
+
Lemma rotn_length : forall n l, length (rotn n l) = length l.
|
| 180 |
+
Proof. induction n as [|n IH]; intro l; simpl; auto. rewrite IH, rot1_length. reflexivity. Qed.
|
| 181 |
+
|
| 182 |
+
(* reading the head of a related tape *)
|
| 183 |
+
Lemma hd_rel : forall tc ta rest, contents tc = rotn (mv ta) (pre ta ++ rest) ->
|
| 184 |
+
aok ta = true -> hd_t tc = ahd ta.
|
| 185 |
+
Proof.
|
| 186 |
+
intros tc ta rest H Hok. unfold aok in Hok. apply Nat.ltb_lt in Hok.
|
| 187 |
+
rewrite hd_t_contents, H. apply hd_rotn_prefix. exact Hok.
|
| 188 |
+
Qed.
|
| 189 |
+
|
| 190 |
+
(* writing then turning a related tape *)
|
| 191 |
+
Lemma wr_rel : forall tc ta rest v, contents tc = rotn (mv ta) (pre ta ++ rest) ->
|
| 192 |
+
aok ta = true -> contents (wr_t tc v) = rotn (mv (awr ta v)) (pre (awr ta v) ++ rest).
|
| 193 |
+
Proof.
|
| 194 |
+
intros tc ta rest v H Hok. unfold aok in Hok. apply Nat.ltb_lt in Hok.
|
| 195 |
+
rewrite wr_t_contents, H. simpl. apply wr_rotn_prefix. exact Hok.
|
| 196 |
+
Qed.
|
| 197 |
+
|
| 198 |
+
Lemma turn_rel : forall tc ta rest, contents tc = rotn (mv ta) (pre ta ++ rest) ->
|
| 199 |
+
contents (turn1 tc) = rotn (mv (aturn ta)) (pre (aturn ta) ++ rest).
|
| 200 |
+
Proof. intros tc ta rest H. rewrite turn1_contents, H. simpl. apply rotn_S. Qed.
|
| 201 |
+
|
| 202 |
+
Lemma operand_eq : forall (cc : nat -> bool) t a w,
|
| 203 |
+
opok t a w = true ->
|
| 204 |
+
(forall x, x <> RD -> x <> ARM -> x <> CPY -> cc x = wget (aw t) x) ->
|
| 205 |
+
(aok (aR t) = true -> cc RD = ahd (aR t)) ->
|
| 206 |
+
(aok (aA t) = true -> cc ARM = ahd (aA t)) ->
|
| 207 |
+
(aok (aK t) = true -> cc CPY = ahd (aK t)) ->
|
| 208 |
+
(w * b2z (cc a) = w * b2z (acell t a))%Z.
|
| 209 |
+
Proof.
|
| 210 |
+
intros cc t a w Hok Hw HR HA HK. unfold opok in Hok. unfold acell.
|
| 211 |
+
destruct (Z.eqb w 0) eqn:Ew; [apply Z.eqb_eq in Ew; subst; reflexivity|].
|
| 212 |
+
destruct (Nat.eqb a RD) eqn:E1; [apply Nat.eqb_eq in E1; subst; rewrite HR; auto|].
|
| 213 |
+
destruct (Nat.eqb a ARM) eqn:E2; [apply Nat.eqb_eq in E2; subst; rewrite HA; auto|].
|
| 214 |
+
destruct (Nat.eqb a CPY) eqn:E3; [apply Nat.eqb_eq in E3; subst; rewrite HK; auto|].
|
| 215 |
+
apply Nat.eqb_neq in E1, E2, E3. rewrite Hw; auto.
|
| 216 |
+
Qed.
|
| 217 |
+
|
| 218 |
+
Lemma length_wnext : forall w ao v, length (wnext w ao v) = length w.
|
| 219 |
+
Proof. intros w ao v; unfold wnext. destruct (_ || _ || _); auto using upd_length. Qed.
|
| 220 |
+
|
| 221 |
+
Lemma length_clearq : forall w, length (clearq w) = length w.
|
| 222 |
+
Proof. intro w; unfold clearq. rewrite !upd_length. reflexivity. Qed.
|
| 223 |
+
|
| 224 |
+
Lemma agree_wnext : forall w w' ao v, agree w w' -> length w = length w' ->
|
| 225 |
+
agree (wnext w ao v) (wnext w' ao v).
|
| 226 |
+
Proof. intros w w' ao v H Hl; unfold wnext. destruct (_ || _ || _); auto using agree_upd. Qed.
|
| 227 |
+
|
| 228 |
+
Lemma agree_clearq : forall w w', agree w w' -> length w = length w' -> agree (clearq w) (clearq w').
|
| 229 |
+
Proof.
|
| 230 |
+
intros w w' H Hl; unfold clearq.
|
| 231 |
+
repeat (apply agree_upd; [|rewrite ?upd_length; auto]). exact H.
|
| 232 |
+
Qed.
|
| 233 |
+
|
| 234 |
+
Lemma wget_clearq_other : forall w x, x <> AA -> x <> AR -> x <> AC -> wget (clearq w) x = wget w x.
|
| 235 |
+
Proof.
|
| 236 |
+
intros w x H1 H2 H3; unfold clearq. rewrite !wget_upd.
|
| 237 |
+
rewrite (proj2 (Nat.eqb_neq _ _) H1), (proj2 (Nat.eqb_neq _ _) H2), (proj2 (Nat.eqb_neq _ _) H3).
|
| 238 |
+
reflexivity.
|
| 239 |
+
Qed.
|
| 240 |
+
|
| 241 |
+
Lemma wget_wnext_other : forall w ao v x, x <> ao -> wget (wnext w ao v) x = wget w x.
|
| 242 |
+
Proof.
|
| 243 |
+
intros w ao v x H; unfold wnext. destruct (_ || _ || _); auto.
|
| 244 |
+
rewrite wget_upd, (proj2 (Nat.eqb_neq _ _) H). reflexivity.
|
| 245 |
+
Qed.
|
| 246 |
+
|
| 247 |
+
Lemma tape_after : forall tc ta rest (wr tn : bool) v,
|
| 248 |
+
contents tc = rotn (mv ta) (pre ta ++ rest) ->
|
| 249 |
+
(wr = true -> aok ta = true) ->
|
| 250 |
+
contents (if tn then turn1 (if wr then wr_t tc v else tc) else (if wr then wr_t tc v else tc))
|
| 251 |
+
= rotn (mv (if tn then aturn (if wr then awr ta v else ta) else (if wr then awr ta v else ta)))
|
| 252 |
+
(pre (if tn then aturn (if wr then awr ta v else ta) else (if wr then awr ta v else ta)) ++ rest).
|
| 253 |
+
Proof.
|
| 254 |
+
intros tc ta rest wr tn v H Hok.
|
| 255 |
+
destruct wr, tn; try apply turn_rel; try apply wr_rel; auto.
|
| 256 |
+
Qed.
|
| 257 |
+
|
| 258 |
+
Lemma tape_turn : forall tc ta rest (tn : bool),
|
| 259 |
+
contents tc = rotn (mv ta) (pre ta ++ rest) ->
|
| 260 |
+
contents (if tn then turn1 tc else tc)
|
| 261 |
+
= rotn (mv (if tn then aturn ta else ta)) (pre (if tn then aturn ta else ta) ++ rest).
|
| 262 |
+
Proof. intros tc ta rest tn H; destruct tn; [apply turn_rel|]; exact H. Qed.
|
| 263 |
+
|
| 264 |
+
Lemma step_refines : forall k0 rs restR restA restK s t,
|
| 265 |
+
Forall (fun r => decode (enc_rec r) = r) rs ->
|
| 266 |
+
rel k0 rs restR restA restK s t ->
|
| 267 |
+
wget (win s) KAPPA = k0 ->
|
| 268 |
+
ai t < length rs ->
|
| 269 |
+
bad (astep rs t) = false ->
|
| 270 |
+
rel k0 rs restR restA restK (step s) (astep rs t)
|
| 271 |
+
/\ (S (ai t) < length rs -> wget (win (step s)) KAPPA = k0).
|
| 272 |
+
Proof.
|
| 273 |
+
intros k0 rs restR restA restK s t Hdec Hrel Hk Hi Hbad.
|
| 274 |
+
destruct Hrel as (Hw & Hls & Hlt & HR & HA & HK & HQ).
|
| 275 |
+
destruct (nth_error rs (ai t)) as [r|] eqn:Er.
|
| 276 |
+
2:{ apply nth_error_None in Er. lia. }
|
| 277 |
+
assert (Hdr : decode (enc_rec r) = r).
|
| 278 |
+
{ rewrite Forall_forall in Hdec. apply Hdec. eapply nth_error_In. exact Er. }
|
| 279 |
+
destruct (popn 26 (if k0 then q1 s else q0 s)) as [bits qa'] eqn:Ep.
|
| 280 |
+
assert (Hlq : length (contents (if k0 then q1 s else q0 s)) = 26 * length rs)
|
| 281 |
+
by (rewrite HQ, rotn_length, enc_length; reflexivity).
|
| 282 |
+
assert (Hbits : bits = enc_rec r).
|
| 283 |
+
{ pose proof (popn_reads 26 (if k0 then q1 s else q0 s)) as P. rewrite Ep in P. cbn [fst snd] in P.
|
| 284 |
+
rewrite P by lia. rewrite HQ. apply rotn_rec. exact Er. }
|
| 285 |
+
assert (Hqa' : contents qa' = rotn (26 * S (ai t)) (enc rs)).
|
| 286 |
+
{ pose proof (popn_turns 26 (if k0 then q1 s else q0 s)) as P. rewrite Ep in P. cbn [fst snd] in P.
|
| 287 |
+
rewrite P, HQ, <- rotn_plus. f_equal. lia. }
|
| 288 |
+
subst bits. destruct r as [a0 w0 a1 w1 beta ao].
|
| 289 |
+
set (va := Z.leb 0 (w0 * b2z (acell t a0) + w1 * b2z (acell t a1) + beta)%Z).
|
| 290 |
+
rewrite (astep_char rs t a0 w0 a1 w1 beta ao Er) in *.
|
| 291 |
+
unfold astepres in Hbad. cbv zeta in Hbad. cbn [bad] in Hbad.
|
| 292 |
+
apply orb_false_iff in Hbad as [Hb0 Hb]. apply negb_false_iff in Hb.
|
| 293 |
+
apply andb_prop in Hb as [Hb Hokk]. apply andb_prop in Hb as [Hb Hokw].
|
| 294 |
+
apply andb_prop in Hb as [Hop0 Hop1].
|
| 295 |
+
assert (Hc : forall x w, opok t x w = true -> (w * b2z (cellof s k0 x) = w * b2z (acell t x))%Z).
|
| 296 |
+
{ intros x w Hx. apply operand_eq; auto.
|
| 297 |
+
- intros y H1 H2 H3. unfold cellof.
|
| 298 |
+
rewrite (proj2 (Nat.eqb_neq _ _) H1), (proj2 (Nat.eqb_neq _ _) H2), (proj2 (Nat.eqb_neq _ _) H3).
|
| 299 |
+
apply Hw; auto.
|
| 300 |
+
- intro H. unfold cellof. simpl. eapply hd_rel; eauto.
|
| 301 |
+
- intro H. unfold cellof. simpl. eapply hd_rel; eauto.
|
| 302 |
+
- intro H. unfold cellof. simpl. eapply hd_rel; eauto. }
|
| 303 |
+
assert (Hvc : va = Z.leb 0 (w0 * b2z (cellof s k0 a0) + w1 * b2z (cellof s k0 a1) + beta)%Z).
|
| 304 |
+
{ unfold va. rewrite (Hc a0 w0 Hop0), (Hc a1 w1 Hop1). reflexivity. }
|
| 305 |
+
rewrite (step_char s k0 _ qa' a0 w0 a1 w1 beta ao va Hk Ep Hdr Hvc).
|
| 306 |
+
assert (Hl2 : length (win s) = length (aw t)) by congruence.
|
| 307 |
+
assert (Hag : agree (wnext (win s) ao va) (wnext (aw t) ao va)) by (apply agree_wnext; auto).
|
| 308 |
+
assert (HAA : wget (wnext (win s) ao va) AA = wget (wnext (aw t) ao va) AA) by (apply Hag; discriminate).
|
| 309 |
+
assert (HAR : wget (wnext (win s) ao va) AR = wget (wnext (aw t) ao va) AR) by (apply Hag; discriminate).
|
| 310 |
+
assert (HAC : wget (wnext (win s) ao va) AC = wget (wnext (aw t) ao va) AC) by (apply Hag; discriminate).
|
| 311 |
+
assert (OkA : Nat.eqb ao ARM = true -> aok (aA t) = true).
|
| 312 |
+
{ intro E. rewrite E in Hokw. apply andb_prop in Hokw as [H _]. exact H. }
|
| 313 |
+
assert (OkK : Nat.eqb ao CPY = true -> aok (aK t) = true).
|
| 314 |
+
{ intro E. rewrite E in Hokw. apply andb_prop in Hokw as [_ H]. exact H. }
|
| 315 |
+
unfold stepres, astepres. cbv zeta. rewrite HAA, HAR, HAC.
|
| 316 |
+
split.
|
| 317 |
+
- unfold rel. destruct k0; cbn [d0 d1 q0 q1 win aw aR aA aK ai];
|
| 318 |
+
refine (conj _ (conj _ (conj _ (conj _ (conj _ (conj _ _)))))).
|
| 319 |
+
all: first
|
| 320 |
+
[ exact Hqa'
|
| 321 |
+
| rewrite length_clearq, length_wnext; assumption
|
| 322 |
+
| apply tape_turn; assumption
|
| 323 |
+
| apply tape_after; assumption
|
| 324 |
+
| change (agree (clearq (wnext (win s) ao va)) (clearq (wnext (aw t) ao va)));
|
| 325 |
+
apply agree_clearq; [exact Hag | rewrite !length_wnext; exact Hl2] ].
|
| 326 |
+
- intro Hlt'. destruct (Nat.eqb ao KAPPA) eqn:Eao.
|
| 327 |
+
+ rewrite ?Eao in Hokk. cbn [negb orb] in Hokk. apply Nat.eqb_eq in Hokk. lia.
|
| 328 |
+
+ apply Nat.eqb_neq in Eao.
|
| 329 |
+
destruct k0; cbn [win]; rewrite wget_clearq_other by discriminate;
|
| 330 |
+
rewrite wget_wnext_other by congruence; exact Hk.
|
| 331 |
+
Qed.
|
| 332 |
+
|
| 333 |
+
Lemma bad_mono : forall n rs t, bad t = true -> bad (aiter n rs t) = true.
|
| 334 |
+
Proof.
|
| 335 |
+
induction n as [|n IH]; intros rs t H; cbn [aiter]; auto.
|
| 336 |
+
apply IH. unfold astep. destruct (nth_error rs (ai t)) as [[a0 w0 a1 w1 beta ao]|].
|
| 337 |
+
- cbn [bad]. rewrite H. reflexivity.
|
| 338 |
+
- reflexivity.
|
| 339 |
+
Qed.
|
| 340 |
+
|
| 341 |
+
Lemma astep_ai : forall rs t, ai t < length rs -> ai (astep rs t) = S (ai t).
|
| 342 |
+
Proof.
|
| 343 |
+
intros rs t H. unfold astep. destruct (nth_error rs (ai t)) as [[a0 w0 a1 w1 beta ao]|] eqn:E.
|
| 344 |
+
- reflexivity.
|
| 345 |
+
- apply nth_error_None in E. lia.
|
| 346 |
+
Qed.
|
| 347 |
+
|
| 348 |
+
Lemma pass_refines : forall n k0 rs restR restA restK s t,
|
| 349 |
+
Forall (fun r => decode (enc_rec r) = r) rs ->
|
| 350 |
+
rel k0 rs restR restA restK s t ->
|
| 351 |
+
wget (win s) KAPPA = k0 ->
|
| 352 |
+
ai t + n <= length rs ->
|
| 353 |
+
bad (aiter n rs t) = false ->
|
| 354 |
+
rel k0 rs restR restA restK (itern n s) (aiter n rs t).
|
| 355 |
+
Proof.
|
| 356 |
+
induction n as [|n IH]; intros k0 rs restR restA restK s t Hdec Hrel Hk Hn Hbad.
|
| 357 |
+
- exact Hrel.
|
| 358 |
+
- cbn [itern aiter] in *.
|
| 359 |
+
assert (Hb1 : bad (astep rs t) = false).
|
| 360 |
+
{ destruct (bad (astep rs t)) eqn:E; auto. rewrite (bad_mono n rs _ E) in Hbad. discriminate. }
|
| 361 |
+
destruct (step_refines k0 rs restR restA restK s t Hdec Hrel Hk ltac:(lia) Hb1) as [Hr Hk'].
|
| 362 |
+
destruct n as [|n'].
|
| 363 |
+
+ exact Hr.
|
| 364 |
+
+ apply IH; auto.
|
| 365 |
+
* apply Hk'. lia.
|
| 366 |
+
* rewrite astep_ai by lia. lia.
|
| 367 |
+
Qed.
|
| 368 |
+
|
| 369 |
+
(* after a whole pass the program bank is back where it started *)
|
| 370 |
+
Lemma bank_full : forall rs, rotn (26 * length rs) (enc rs) = enc rs.
|
| 371 |
+
Proof. intro rs. rewrite <- enc_length. apply rotn_full. Qed.
|
rocq/Assumptions.v
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
(* The assumptions of the main theorems, printed by src/check_rocq.py after the build. *)
|
| 2 |
+
From TH Require Import PhysMain PhysFacts NetMain Complete Run PassLemma Main SelfRep.
|
| 3 |
+
|
| 4 |
+
Print Assumptions PhysMain.netlist_step.
|
| 5 |
+
Print Assumptions PhysFacts.phys_size.
|
| 6 |
+
Print Assumptions PhysFacts.phys_ternary.
|
| 7 |
+
Print Assumptions NetMain.network_orbit.
|
| 8 |
+
Print Assumptions NetMain.network_reproduces.
|
| 9 |
+
Print Assumptions Complete.describe_complete.
|
| 10 |
+
Print Assumptions PassLemma.machine_pass.
|
| 11 |
+
Print Assumptions Run.universal_construction.
|
| 12 |
+
Print Assumptions Main.builds_every_image.
|
| 13 |
+
Print Assumptions Main.reproduces_forever.
|
| 14 |
+
Print Assumptions Main.every_generation.
|
| 15 |
+
Print Assumptions SelfRep.self_reproduction.
|
| 16 |
+
Print Assumptions SelfRep.second_generation.
|
| 17 |
+
Print Assumptions SelfRep.periodic.
|
rocq/Complete.v
ADDED
|
@@ -0,0 +1,103 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
(* Every record image has a description: translate inverts describe. *)
|
| 2 |
+
From Stdlib Require Import List Bool Arith Lia.
|
| 3 |
+
Import ListNotations.
|
| 4 |
+
From TH Require Import TwoHead Decoder.
|
| 5 |
+
|
| 6 |
+
Definition seg (r : list bool) : list bool :=
|
| 7 |
+
match find_codon candidates (firstn 8 r) with
|
| 8 |
+
| Some c => c ++ skipn 8 r
|
| 9 |
+
| None => ESC ++ r
|
| 10 |
+
end.
|
| 11 |
+
|
| 12 |
+
Lemma describe_eq : forall X, describe X = concat (map seg (chunks (length X) X)) ++ ENDC.
|
| 13 |
+
Proof. reflexivity. Qed.
|
| 14 |
+
|
| 15 |
+
Lemma find_codon_some : forall cs g c, find_codon cs g = Some c ->
|
| 16 |
+
exists k a b, In (k, a, b) cs /\ gate_bits k a b = g /\ c = codon_bits k a b.
|
| 17 |
+
Proof.
|
| 18 |
+
induction cs as [|[[k a] b] cs IH]; intros g c H; cbn [find_codon] in H; [discriminate|].
|
| 19 |
+
destruct (lbeq (gate_bits k a b) g) eqn:E.
|
| 20 |
+
- apply some_inj in H. subst c. exists k, a, b.
|
| 21 |
+
split; [left; reflexivity|]. split; [apply lbeq_true; exact E | reflexivity].
|
| 22 |
+
- destruct (IH g c H) as (k' & a' & b' & Hin & Hg & Hc).
|
| 23 |
+
exists k', a', b'. split; [right; exact Hin|]. split; assumption.
|
| 24 |
+
Qed.
|
| 25 |
+
|
| 26 |
+
Lemma candidates_kind : forall k a b, In (k, a, b) candidates -> k <= 2.
|
| 27 |
+
Proof.
|
| 28 |
+
intros k a b H. unfold candidates in H.
|
| 29 |
+
repeat (destruct H as [H|H]; [injection H as <- <- <-; lia|]). destruct H.
|
| 30 |
+
Qed.
|
| 31 |
+
|
| 32 |
+
Lemma translate_codon : forall f k a b X, k <= 2 ->
|
| 33 |
+
translate_aux (S f) (codon_bits k a b ++ X)
|
| 34 |
+
= option_map (fun t => gate_bits k a b ++ firstn 18 X ++ t) (translate_aux f (skipn 18 X)).
|
| 35 |
+
Proof.
|
| 36 |
+
intros f k a b X Hk. unfold codon_bits. cbn [app]. rewrite translate_aux_S.
|
| 37 |
+
destruct k as [|[|[|k]]]; [| | | lia]; cbn [Nat.eqb orb andb]; reflexivity.
|
| 38 |
+
Qed.
|
| 39 |
+
|
| 40 |
+
Lemma translate_esc : forall f r rest, length r = 26 ->
|
| 41 |
+
translate_aux (S f) (ESC ++ r ++ rest) = option_map (fun t => r ++ t) (translate_aux f rest).
|
| 42 |
+
Proof.
|
| 43 |
+
intros f r rest Hr. unfold ESC. cbn [app]. rewrite translate_aux_S. cbn [andb].
|
| 44 |
+
replace (Nat.eqb (length (r ++ rest)) 0) with false
|
| 45 |
+
by (symmetry; apply Nat.eqb_neq; rewrite length_app; lia).
|
| 46 |
+
rewrite (firstn_app_exact r rest 26 Hr), (skipn_app_exact r rest 26 Hr). reflexivity.
|
| 47 |
+
Qed.
|
| 48 |
+
|
| 49 |
+
Lemma seg_translate : forall f r rest, length r = 26 ->
|
| 50 |
+
translate_aux (S f) (seg r ++ rest) = option_map (fun t => r ++ t) (translate_aux f rest).
|
| 51 |
+
Proof.
|
| 52 |
+
intros f r rest Hr. unfold seg.
|
| 53 |
+
destruct (find_codon candidates (firstn 8 r)) as [c|] eqn:Ef.
|
| 54 |
+
- destruct (find_codon_some _ _ _ Ef) as (k & a & b & Hin & Hg & ->).
|
| 55 |
+
assert (H18 : length (skipn 8 r) = 18) by (rewrite length_skipn; lia).
|
| 56 |
+
rewrite <- app_assoc, translate_codon by exact (candidates_kind k a b Hin).
|
| 57 |
+
rewrite (firstn_app_exact _ rest 18 H18), (skipn_app_exact _ rest 18 H18), Hg.
|
| 58 |
+
destruct (translate_aux f rest) as [t|]; cbn [option_map]; [|reflexivity].
|
| 59 |
+
rewrite app_assoc, firstn_skipn. reflexivity.
|
| 60 |
+
- rewrite <- app_assoc. apply translate_esc. exact Hr.
|
| 61 |
+
Qed.
|
| 62 |
+
|
| 63 |
+
Lemma seg_long : forall r, 1 <= length (seg r).
|
| 64 |
+
Proof.
|
| 65 |
+
intro r. unfold seg. destruct (find_codon candidates (firstn 8 r)) as [c|] eqn:Ef.
|
| 66 |
+
- destruct (find_codon_some _ _ _ Ef) as (k & a & b & _ & _ & ->).
|
| 67 |
+
rewrite length_app. unfold codon_bits. cbn [length]. lia.
|
| 68 |
+
- unfold ESC. rewrite length_app. cbn [length]. lia.
|
| 69 |
+
Qed.
|
| 70 |
+
|
| 71 |
+
Lemma chunks_S : forall f l, l <> [] -> chunks (S f) l = firstn 26 l :: chunks f (skipn 26 l).
|
| 72 |
+
Proof. intros f [|x l] H; [congruence|reflexivity]. Qed.
|
| 73 |
+
|
| 74 |
+
Lemma chunks_nil : forall f, chunks f [] = [].
|
| 75 |
+
Proof. intros [|f]; reflexivity. Qed.
|
| 76 |
+
|
| 77 |
+
Lemma describe_aux : forall n X f f', length X = 26 * n -> n <= f ->
|
| 78 |
+
length (concat (map seg (chunks f X)) ++ ENDC) <= f' ->
|
| 79 |
+
translate_aux f' (concat (map seg (chunks f X)) ++ ENDC) = Some X.
|
| 80 |
+
Proof.
|
| 81 |
+
induction n as [|n IH]; intros X f f' HX Hf Hf'.
|
| 82 |
+
- destruct X; [|discriminate]. rewrite chunks_nil in *. cbn [map concat app] in *.
|
| 83 |
+
destruct f' as [|f']; [cbn [length ENDC] in Hf'; lia|].
|
| 84 |
+
unfold ENDC. rewrite translate_aux_S. reflexivity.
|
| 85 |
+
- destruct f as [|f]; [lia|].
|
| 86 |
+
destruct (split_at X 26 ltac:(lia)) as (r & X' & -> & Hr).
|
| 87 |
+
rewrite length_app, Hr in HX.
|
| 88 |
+
assert (Hne : r ++ X' <> []) by (destruct r; [discriminate | intro H; discriminate]).
|
| 89 |
+
rewrite chunks_S in Hf' |- * by exact Hne.
|
| 90 |
+
rewrite (firstn_app_exact r X' 26 Hr), (skipn_app_exact r X' 26 Hr) in Hf' |- *.
|
| 91 |
+
cbn [map concat] in Hf' |- *. rewrite <- app_assoc in Hf' |- *.
|
| 92 |
+
rewrite length_app in Hf'. pose proof (seg_long r).
|
| 93 |
+
destruct f' as [|f']; [lia|].
|
| 94 |
+
rewrite seg_translate by exact Hr.
|
| 95 |
+
rewrite (IH X' f f') by lia. reflexivity.
|
| 96 |
+
Qed.
|
| 97 |
+
|
| 98 |
+
(* Every image of n records has the description describe X, which translate reads back. *)
|
| 99 |
+
Theorem describe_complete : forall X n, length X = 26 * n -> translate (describe X) = Some X.
|
| 100 |
+
Proof.
|
| 101 |
+
intros X n HX. unfold translate. rewrite describe_eq.
|
| 102 |
+
apply describe_aux with (n := n); [exact HX | lia | lia].
|
| 103 |
+
Qed.
|
rocq/Decoder.v
ADDED
|
@@ -0,0 +1,579 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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and the copy
|
| 2 |
+
tape K, each listed from its head. *)
|
| 3 |
+
From Stdlib Require Import List Bool Arith Lia.
|
| 4 |
+
Import ListNotations.
|
| 5 |
+
From TH Require Import TwoHead Tapes Spec.
|
| 6 |
+
|
| 7 |
+
Record dst := mkD { dc : cfg; dk : bool; dR : list bool; dA : list bool; dK : list bool }.
|
| 8 |
+
|
| 9 |
+
Definition dstep (t : dst) : dst :=
|
| 10 |
+
let r := hd false (dR t) in
|
| 11 |
+
let o := dpass (dc t) (dk t) r in
|
| 12 |
+
mkD (ncf o) (nk o)
|
| 13 |
+
(if cons o then rot1 (dR t) else dR t)
|
| 14 |
+
(if emit o then rot1 (av o :: tl (dA t)) else dA t)
|
| 15 |
+
(if cw o then rot1 (r :: tl (dK t)) else dK t).
|
| 16 |
+
|
| 17 |
+
Fixpoint dsteps (n : nat) (t : dst) : dst :=
|
| 18 |
+
match n with O => t | S m => dsteps m (dstep t) end.
|
| 19 |
+
|
| 20 |
+
Lemma dsteps_S : forall n t, dsteps (S n) t = dsteps n (dstep t).
|
| 21 |
+
Proof. reflexivity. Qed.
|
| 22 |
+
|
| 23 |
+
Lemma dsteps_add : forall a b t, dsteps (a + b) t = dsteps b (dsteps a t).
|
| 24 |
+
Proof. induction a as [|a IH]; intros b t; cbn [dsteps Nat.add]; auto. Qed.
|
| 25 |
+
|
| 26 |
+
Lemma rot1_cons_app : forall (b : bool) l1 l2, rot1 (b :: l1 ++ l2) = l1 ++ (l2 ++ [b]).
|
| 27 |
+
Proof. intros. cbn [rot1]. rewrite app_assoc. reflexivity. Qed.
|
| 28 |
+
|
| 29 |
+
Lemma tl_app_ne : forall (U W : list bool), U <> [] -> tl (U ++ W) = tl U ++ W.
|
| 30 |
+
Proof. intros [|u U] W H; [congruence|reflexivity]. Qed.
|
| 31 |
+
|
| 32 |
+
(* one pass, the tapes written as what lies ahead of the head and what lies behind it *)
|
| 33 |
+
Lemma dstep_eq : forall cf k b rest done U W V C o,
|
| 34 |
+
o = dpass cf k b ->
|
| 35 |
+
(emit o = true -> U <> []) -> (cw o = true -> V <> []) ->
|
| 36 |
+
dstep (mkD cf k ((b :: rest) ++ done) (U ++ W) (V ++ C))
|
| 37 |
+
= mkD (ncf o) (nk o)
|
| 38 |
+
(if cons o then rest ++ (done ++ [b]) else (b :: rest) ++ done)
|
| 39 |
+
(if emit o then tl U ++ (W ++ [av o]) else U ++ W)
|
| 40 |
+
(if cw o then tl V ++ (C ++ [b]) else V ++ C).
|
| 41 |
+
Proof.
|
| 42 |
+
intros cf k b rest done U W V C o Eo HU HV.
|
| 43 |
+
unfold dstep. cbn [dc dk dR dA dK]. change (hd false ((b :: rest) ++ done)) with b.
|
| 44 |
+
rewrite <- Eo. f_equal.
|
| 45 |
+
- destruct (cons o); [|reflexivity]. cbn [app]. apply rot1_cons_app.
|
| 46 |
+
- destruct (emit o); [|reflexivity]. rewrite tl_app_ne by (apply HU; reflexivity).
|
| 47 |
+
apply rot1_cons_app.
|
| 48 |
+
- destruct (cw o); [|reflexivity]. rewrite tl_app_ne by (apply HV; reflexivity).
|
| 49 |
+
apply rot1_cons_app.
|
| 50 |
+
Qed.
|
| 51 |
+
|
| 52 |
+
(* ---- one pass in each phase ---------------------------------------------- *)
|
| 53 |
+
Lemma pass_PA : forall n e3 e2 e1 e0 m k b R A K,
|
| 54 |
+
dstep (mkD (mkC PA n e3 e2 e1 e0 m) k (b :: R) A K)
|
| 55 |
+
= mkD (if Nat.eqb n 0 then mkC PC 3 e3 e2 e1 e0 m else mkC PA (n - 1) e3 e2 e1 e0 m) k
|
| 56 |
+
(R ++ [b])
|
| 57 |
+
(if m then A else rot1 (b :: tl A))
|
| 58 |
+
(if m then rot1 (b :: tl K) else K).
|
| 59 |
+
Proof.
|
| 60 |
+
intros. unfold dstep. cbn [dc dk dR dA dK hd].
|
| 61 |
+
unfold dpass. cbn [ph Spec.z Spec.c3 Spec.c2 Spec.c1 Spec.c0 mo ncf nk cons emit av cw rot1].
|
| 62 |
+
destruct (Nat.eqb n 0); destruct m; reflexivity.
|
| 63 |
+
Qed.
|
| 64 |
+
|
| 65 |
+
Lemma pass_PG : forall n e3 e2 e1 e0 m k R A K,
|
| 66 |
+
dstep (mkD (mkC PG n e3 e2 e1 e0 m) k R A K)
|
| 67 |
+
= let e := is_esc e3 e2 e1 e0 in
|
| 68 |
+
let a := if e then hd false R else table e3 e2 e1 e0 n in
|
| 69 |
+
mkD (if Nat.eqb n 0 then mkC PA 17 e3 e2 e1 e0 m else mkC PG (n - 1) e3 e2 e1 e0 m) k
|
| 70 |
+
(if e then rot1 R else R)
|
| 71 |
+
(if m then A else rot1 (a :: tl A))
|
| 72 |
+
(if m && e then rot1 (hd false R :: tl K) else K).
|
| 73 |
+
Proof.
|
| 74 |
+
intros. unfold dstep. cbn [dc dk dR dA dK].
|
| 75 |
+
unfold dpass. cbn [ph Spec.z Spec.c3 Spec.c2 Spec.c1 Spec.c0 mo ncf nk cons emit av cw].
|
| 76 |
+
destruct (Nat.eqb n 0); destruct m; reflexivity.
|
| 77 |
+
Qed.
|
| 78 |
+
|
| 79 |
+
Lemma pass_PC : forall n e3 e2 e1 e0 m k b R A K,
|
| 80 |
+
dstep (mkD (mkC PC n e3 e2 e1 e0 m) k (b :: R) A K)
|
| 81 |
+
= mkD (if Nat.eqb n 0 then
|
| 82 |
+
(if is_end e2 e1 e0 b then mkC PC 3 e2 e1 e0 b (negb m)
|
| 83 |
+
else if negb m || is_esc e2 e1 e0 b then mkC PG 7 e2 e1 e0 b m
|
| 84 |
+
else mkC PA 17 e2 e1 e0 b m)
|
| 85 |
+
else mkC PC (n - 1) e2 e1 e0 b m)
|
| 86 |
+
(if Nat.eqb n 0 then (if is_end e2 e1 e0 b then xorb k m else k) else k)
|
| 87 |
+
(R ++ [b]) A
|
| 88 |
+
(if m then rot1 (b :: tl K) else K).
|
| 89 |
+
Proof.
|
| 90 |
+
intros. unfold dstep. cbn [dc dk dR dA dK hd].
|
| 91 |
+
unfold dpass. cbn [ph Spec.z Spec.c3 Spec.c2 Spec.c1 Spec.c0 mo ncf nk cons emit av cw rot1].
|
| 92 |
+
destruct (Nat.eqb n 0); [|destruct m; reflexivity].
|
| 93 |
+
destruct (is_end e2 e1 e0 b); [destruct m; reflexivity|].
|
| 94 |
+
destruct (negb m || is_esc e2 e1 e0 b); destruct m; reflexivity.
|
| 95 |
+
Qed.
|
| 96 |
+
|
| 97 |
+
(* ---- the phases ---------------------------------------------------------- *)
|
| 98 |
+
Fixpoint down (n : nat) : list nat := match n with O => [0] | S m => n :: down m end.
|
| 99 |
+
|
| 100 |
+
Lemma pa_construct : forall n e3 e2 e1 e0 k bs rest done U W K,
|
| 101 |
+
length bs = S n -> S n <= length U ->
|
| 102 |
+
dsteps (S n) (mkD (mkC PA n e3 e2 e1 e0 false) k (bs ++ rest ++ done) (U ++ W) K)
|
| 103 |
+
= mkD (mkC PC 3 e3 e2 e1 e0 false) k (rest ++ done ++ bs) (skipn (S n) U ++ W ++ bs) K.
|
| 104 |
+
Proof.
|
| 105 |
+
induction n as [|n IH]; intros e3 e2 e1 e0 k bs rest done U W K Hb HU;
|
| 106 |
+
(destruct bs as [|b bs]; [discriminate|]);
|
| 107 |
+
(destruct U as [|u U]; [cbn in HU; lia|]);
|
| 108 |
+
rewrite dsteps_S; cbn [app]; rewrite pass_PA; cbn [Nat.eqb tl rot1].
|
| 109 |
+
- destruct bs; [|discriminate]. cbn [dsteps skipn app]. rewrite <- !app_assoc. reflexivity.
|
| 110 |
+
- replace (S n - 1) with n by lia. rewrite <- !app_assoc.
|
| 111 |
+
rewrite IH by (cbn in Hb, HU; lia).
|
| 112 |
+
cbn [skipn]. rewrite <- !app_assoc. reflexivity.
|
| 113 |
+
Qed.
|
| 114 |
+
|
| 115 |
+
Lemma pa_copy : forall n e3 e2 e1 e0 k bs rest done A V C,
|
| 116 |
+
length bs = S n -> S n <= length V ->
|
| 117 |
+
dsteps (S n) (mkD (mkC PA n e3 e2 e1 e0 true) k (bs ++ rest ++ done) A (V ++ C))
|
| 118 |
+
= mkD (mkC PC 3 e3 e2 e1 e0 true) k (rest ++ done ++ bs) A (skipn (S n) V ++ C ++ bs).
|
| 119 |
+
Proof.
|
| 120 |
+
induction n as [|n IH]; intros e3 e2 e1 e0 k bs rest done A V C Hb HV;
|
| 121 |
+
(destruct bs as [|b bs]; [discriminate|]);
|
| 122 |
+
(destruct V as [|v V]; [cbn in HV; lia|]);
|
| 123 |
+
rewrite dsteps_S; cbn [app]; rewrite pass_PA; cbn [Nat.eqb tl rot1].
|
| 124 |
+
- destruct bs; [|discriminate]. cbn [dsteps skipn app]. rewrite <- !app_assoc. reflexivity.
|
| 125 |
+
- replace (S n - 1) with n by lia. rewrite <- !app_assoc.
|
| 126 |
+
rewrite IH by (cbn in Hb, HV; lia).
|
| 127 |
+
cbn [skipn]. rewrite <- !app_assoc. reflexivity.
|
| 128 |
+
Qed.
|
| 129 |
+
|
| 130 |
+
Lemma pg_gate : forall n e3 e2 e1 e0 k R U W K,
|
| 131 |
+
is_esc e3 e2 e1 e0 = false -> S n <= length U ->
|
| 132 |
+
dsteps (S n) (mkD (mkC PG n e3 e2 e1 e0 false) k R (U ++ W) K)
|
| 133 |
+
= mkD (mkC PA 17 e3 e2 e1 e0 false) k R
|
| 134 |
+
(skipn (S n) U ++ W ++ map (table e3 e2 e1 e0) (down n)) K.
|
| 135 |
+
Proof.
|
| 136 |
+
induction n as [|n IH]; intros e3 e2 e1 e0 k R U W K He HU;
|
| 137 |
+
(destruct U as [|u U]; [cbn in HU; lia|]);
|
| 138 |
+
rewrite dsteps_S; rewrite pass_PG; cbv zeta; rewrite He; cbn [Nat.eqb andb app tl rot1].
|
| 139 |
+
- cbn [dsteps skipn down map]. rewrite <- !app_assoc. reflexivity.
|
| 140 |
+
- replace (S n - 1) with n by lia. rewrite <- !app_assoc.
|
| 141 |
+
rewrite IH by (auto; cbn in HU; lia).
|
| 142 |
+
cbn [skipn down map]. rewrite <- !app_assoc. reflexivity.
|
| 143 |
+
Qed.
|
| 144 |
+
|
| 145 |
+
Lemma pg_esc_construct : forall n e3 e2 e1 e0 k bs rest done U W K,
|
| 146 |
+
is_esc e3 e2 e1 e0 = true -> length bs = S n -> S n <= length U ->
|
| 147 |
+
dsteps (S n) (mkD (mkC PG n e3 e2 e1 e0 false) k (bs ++ rest ++ done) (U ++ W) K)
|
| 148 |
+
= mkD (mkC PA 17 e3 e2 e1 e0 false) k (rest ++ done ++ bs) (skipn (S n) U ++ W ++ bs) K.
|
| 149 |
+
Proof.
|
| 150 |
+
induction n as [|n IH]; intros e3 e2 e1 e0 k bs rest done U W K He Hb HU;
|
| 151 |
+
(destruct bs as [|b bs]; [discriminate|]);
|
| 152 |
+
(destruct U as [|u U]; [cbn in HU; lia|]);
|
| 153 |
+
rewrite dsteps_S; rewrite pass_PG; cbv zeta; rewrite He; cbn [Nat.eqb andb app tl hd rot1].
|
| 154 |
+
- destruct bs; [|discriminate]. cbn [dsteps skipn app]. rewrite <- !app_assoc. reflexivity.
|
| 155 |
+
- replace (S n - 1) with n by lia. rewrite <- !app_assoc.
|
| 156 |
+
rewrite IH by (auto; cbn in Hb, HU; lia).
|
| 157 |
+
cbn [skipn]. rewrite <- !app_assoc. reflexivity.
|
| 158 |
+
Qed.
|
| 159 |
+
|
| 160 |
+
Lemma pg_esc_copy : forall n e3 e2 e1 e0 k bs rest done A V C,
|
| 161 |
+
is_esc e3 e2 e1 e0 = true -> length bs = S n -> S n <= length V ->
|
| 162 |
+
dsteps (S n) (mkD (mkC PG n e3 e2 e1 e0 true) k (bs ++ rest ++ done) A (V ++ C))
|
| 163 |
+
= mkD (mkC PA 17 e3 e2 e1 e0 true) k (rest ++ done ++ bs) A (skipn (S n) V ++ C ++ bs).
|
| 164 |
+
Proof.
|
| 165 |
+
induction n as [|n IH]; intros e3 e2 e1 e0 k bs rest done A V C He Hb HV;
|
| 166 |
+
(destruct bs as [|b bs]; [discriminate|]);
|
| 167 |
+
(destruct V as [|v V]; [cbn in HV; lia|]);
|
| 168 |
+
rewrite dsteps_S; rewrite pass_PG; cbv zeta; rewrite He; cbn [Nat.eqb andb app tl hd rot1].
|
| 169 |
+
- destruct bs; [|discriminate]. cbn [dsteps skipn app]. rewrite <- !app_assoc. reflexivity.
|
| 170 |
+
- replace (S n - 1) with n by lia. rewrite <- !app_assoc.
|
| 171 |
+
rewrite IH by (auto; cbn in Hb, HV; lia).
|
| 172 |
+
cbn [skipn]. rewrite <- !app_assoc. reflexivity.
|
| 173 |
+
Qed.
|
| 174 |
+
|
| 175 |
+
Definition dispatch (e3 e2 e1 e0 m : bool) : cfg :=
|
| 176 |
+
if is_end e3 e2 e1 e0 then mkC PC 3 e3 e2 e1 e0 (negb m)
|
| 177 |
+
else if negb m || is_esc e3 e2 e1 e0 then mkC PG 7 e3 e2 e1 e0 m
|
| 178 |
+
else mkC PA 17 e3 e2 e1 e0 m.
|
| 179 |
+
|
| 180 |
+
Lemma pc_construct : forall b3 b2 b1 b0 k e3 e2 e1 e0 rest done A K,
|
| 181 |
+
dsteps 4 (mkD (mkC PC 3 b3 b2 b1 b0 false) k ([e3; e2; e1; e0] ++ rest ++ done) A K)
|
| 182 |
+
= mkD (dispatch e3 e2 e1 e0 false) k (rest ++ done ++ [e3; e2; e1; e0]) A K.
|
| 183 |
+
Proof.
|
| 184 |
+
intros. cbn [dsteps app].
|
| 185 |
+
rewrite pass_PC. cbn [Nat.eqb Nat.sub app]. rewrite pass_PC. cbn [Nat.eqb Nat.sub app].
|
| 186 |
+
rewrite pass_PC. cbn [Nat.eqb Nat.sub app]. rewrite pass_PC. cbn [Nat.eqb Nat.sub app].
|
| 187 |
+
rewrite <- !app_assoc. cbn [app]. unfold dispatch.
|
| 188 |
+
destruct (is_end e3 e2 e1 e0); [rewrite xorb_false_r|]; reflexivity.
|
| 189 |
+
Qed.
|
| 190 |
+
|
| 191 |
+
Lemma pc_copy : forall b3 b2 b1 b0 k e3 e2 e1 e0 rest done A V C,
|
| 192 |
+
4 <= length V ->
|
| 193 |
+
dsteps 4 (mkD (mkC PC 3 b3 b2 b1 b0 true) k ([e3; e2; e1; e0] ++ rest ++ done) A (V ++ C))
|
| 194 |
+
= mkD (dispatch e3 e2 e1 e0 true) (if is_end e3 e2 e1 e0 then negb k else k)
|
| 195 |
+
(rest ++ done ++ [e3; e2; e1; e0]) A (skipn 4 V ++ C ++ [e3; e2; e1; e0]).
|
| 196 |
+
Proof.
|
| 197 |
+
intros b3 b2 b1 b0 k e3 e2 e1 e0 rest done A V C HV.
|
| 198 |
+
destruct V as [|v1 [|v2 [|v3 [|v4 V]]]]; cbn in HV; try lia.
|
| 199 |
+
cbn [dsteps app].
|
| 200 |
+
rewrite pass_PC. cbn [Nat.eqb Nat.sub app tl rot1]. rewrite pass_PC. cbn [Nat.eqb Nat.sub app tl rot1].
|
| 201 |
+
rewrite pass_PC. cbn [Nat.eqb Nat.sub app tl rot1]. rewrite pass_PC. cbn [Nat.eqb Nat.sub app tl rot1].
|
| 202 |
+
rewrite <- !app_assoc. cbn [app skipn]. unfold dispatch.
|
| 203 |
+
destruct (is_end e3 e2 e1 e0); [rewrite xorb_true_r|]; reflexivity.
|
| 204 |
+
Qed.
|
| 205 |
+
|
| 206 |
+
(* ---- the bank bit changes only on a pass from PC with z = 0 ---------------- *)
|
| 207 |
+
Definition stable (k : bool) (n : nat) (t : dst) : Prop := forall j, j < n -> dk (dsteps j t) = k.
|
| 208 |
+
|
| 209 |
+
Lemma stable_add : forall k a b t, stable k a t -> stable k b (dsteps a t) -> stable k (a + b) t.
|
| 210 |
+
Proof.
|
| 211 |
+
intros k a b t Ha Hb j Hj. destruct (Nat.lt_ge_cases j a) as [H|H]; [apply Ha; exact H|].
|
| 212 |
+
replace j with (a + (j - a)) by lia. rewrite dsteps_add. apply Hb. lia.
|
| 213 |
+
Qed.
|
| 214 |
+
|
| 215 |
+
Lemma stable_eq : forall k n t t', t = t' -> stable k n t' -> stable k n t.
|
| 216 |
+
Proof. intros; subst; assumption. Qed.
|
| 217 |
+
|
| 218 |
+
Lemma step_loop : forall p n e3 e2 e1 e0 m k R A K,
|
| 219 |
+
p <> PC ->
|
| 220 |
+
dk (dstep (mkD (mkC p (S n) e3 e2 e1 e0 m) k R A K)) = k
|
| 221 |
+
/\ dc (dstep (mkD (mkC p (S n) e3 e2 e1 e0 m) k R A K)) = mkC p n e3 e2 e1 e0 m.
|
| 222 |
+
Proof.
|
| 223 |
+
intros p n e3 e2 e1 e0 m k R A K Hp. unfold dstep, dpass.
|
| 224 |
+
cbn [dc dk ph Spec.z Spec.c3 Spec.c2 Spec.c1 Spec.c0 mo ncf nk Nat.eqb].
|
| 225 |
+
destruct p; [congruence| |]; cbn [ncf nk]; replace (S n - 1) with n by lia; split; reflexivity.
|
| 226 |
+
Qed.
|
| 227 |
+
|
| 228 |
+
Lemma stable_loop : forall n p e3 e2 e1 e0 m k R A K,
|
| 229 |
+
p <> PC -> stable k (S n) (mkD (mkC p n e3 e2 e1 e0 m) k R A K).
|
| 230 |
+
Proof.
|
| 231 |
+
induction n as [|n IH]; intros p e3 e2 e1 e0 m k R A K Hp j Hj.
|
| 232 |
+
- replace j with 0 by lia. reflexivity.
|
| 233 |
+
- destruct j as [|j]; [reflexivity|]. rewrite dsteps_S.
|
| 234 |
+
destruct (step_loop p n e3 e2 e1 e0 m k R A K Hp) as [Hk Hc].
|
| 235 |
+
destruct (dstep (mkD (mkC p (S n) e3 e2 e1 e0 m) k R A K)) as [c k' R' A' K'].
|
| 236 |
+
cbn [dk dc] in Hk, Hc. subst c k'. apply IH; [exact Hp | lia].
|
| 237 |
+
Qed.
|
| 238 |
+
|
| 239 |
+
Lemma step_pc : forall n e3 e2 e1 e0 m k R A K,
|
| 240 |
+
dk (dstep (mkD (mkC PC (S n) e3 e2 e1 e0 m) k R A K)) = k
|
| 241 |
+
/\ dc (dstep (mkD (mkC PC (S n) e3 e2 e1 e0 m) k R A K)) = mkC PC n e2 e1 e0 (hd false R) m.
|
| 242 |
+
Proof.
|
| 243 |
+
intros. unfold dstep, dpass.
|
| 244 |
+
cbn [dc dk ph Spec.z Spec.c3 Spec.c2 Spec.c1 Spec.c0 mo ncf nk Nat.eqb].
|
| 245 |
+
replace (S n - 1) with n by lia. split; reflexivity.
|
| 246 |
+
Qed.
|
| 247 |
+
|
| 248 |
+
Lemma stable_pc : forall n e3 e2 e1 e0 m k R A K,
|
| 249 |
+
stable k (S n) (mkD (mkC PC n e3 e2 e1 e0 m) k R A K).
|
| 250 |
+
Proof.
|
| 251 |
+
induction n as [|n IH]; intros e3 e2 e1 e0 m k R A K j Hj.
|
| 252 |
+
- replace j with 0 by lia. reflexivity.
|
| 253 |
+
- destruct j as [|j]; [reflexivity|]. rewrite dsteps_S.
|
| 254 |
+
destruct (step_pc n e3 e2 e1 e0 m k R A K) as [Hk Hc].
|
| 255 |
+
destruct (dstep (mkD (mkC PC (S n) e3 e2 e1 e0 m) k R A K)) as [c k' R' A' K'].
|
| 256 |
+
cbn [dk dc] in Hk, Hc. subst c k'. apply IH. lia.
|
| 257 |
+
Qed.
|
| 258 |
+
|
| 259 |
+
(* ---- one record of the description, and its end ------------------------------ *)
|
| 260 |
+
Definition kind_of (e3 e2 : bool) : nat := if e3 then 2 else if e2 then 1 else 0.
|
| 261 |
+
|
| 262 |
+
Lemma table_gate : forall e3 e2 s0 s1, e3 && e2 = false ->
|
| 263 |
+
map (table e3 e2 s0 s1) (down 7) = gate_bits (kind_of e3 e2) s0 s1.
|
| 264 |
+
Proof. intros [] [] [] [] H; try discriminate; reflexivity. Qed.
|
| 265 |
+
|
| 266 |
+
Lemma app_assoc4 : forall (a b c d : list bool), (a ++ b) ++ c ++ d = a ++ b ++ c ++ d.
|
| 267 |
+
Proof. intros. rewrite <- app_assoc. reflexivity. Qed.
|
| 268 |
+
|
| 269 |
+
Lemma seg_gate : forall b3 b2 b1 b0 k e3 e2 s0 s1 addr rest done U W K,
|
| 270 |
+
e3 && e2 = false -> length addr = 18 -> 26 <= length U ->
|
| 271 |
+
stable k 30 (mkD (mkC PC 3 b3 b2 b1 b0 false) k ((e3 :: e2 :: s0 :: s1 :: addr ++ rest) ++ done) (U ++ W) K)
|
| 272 |
+
/\ dsteps 30 (mkD (mkC PC 3 b3 b2 b1 b0 false) k ((e3 :: e2 :: s0 :: s1 :: addr ++ rest) ++ done) (U ++ W) K)
|
| 273 |
+
= mkD (mkC PC 3 e3 e2 s0 s1 false) k (rest ++ done ++ [e3; e2; s0; s1] ++ addr)
|
| 274 |
+
(skipn 26 U ++ W ++ gate_bits (kind_of e3 e2) s0 s1 ++ addr) K.
|
| 275 |
+
Proof.
|
| 276 |
+
intros b3 b2 b1 b0 k e3 e2 s0 s1 addr rest done U W K H32 Ha HU.
|
| 277 |
+
change ((e3 :: e2 :: s0 :: s1 :: addr ++ rest) ++ done) with ([e3; e2; s0; s1] ++ (addr ++ rest) ++ done).
|
| 278 |
+
assert (Hd : dispatch e3 e2 s0 s1 false = mkC PG 7 e3 e2 s0 s1 false)
|
| 279 |
+
by (unfold dispatch, is_end, is_esc; rewrite H32; reflexivity).
|
| 280 |
+
assert (He : is_esc e3 e2 s0 s1 = false) by (unfold is_esc; rewrite H32; reflexivity).
|
| 281 |
+
pose proof (pc_construct b3 b2 b1 b0 k e3 e2 s0 s1 (addr ++ rest) done (U ++ W) K) as P1.
|
| 282 |
+
rewrite Hd in P1.
|
| 283 |
+
pose proof (pg_gate 7 e3 e2 s0 s1 k ((addr ++ rest) ++ done ++ [e3; e2; s0; s1]) U W K He
|
| 284 |
+
ltac:(lia)) as P2.
|
| 285 |
+
rewrite table_gate in P2 by exact H32.
|
| 286 |
+
pose proof (pa_construct 17 e3 e2 s0 s1 k addr rest (done ++ [e3; e2; s0; s1]) (skipn 8 U)
|
| 287 |
+
(W ++ gate_bits (kind_of e3 e2) s0 s1) K Ha ltac:(rewrite length_skipn; lia)) as P3.
|
| 288 |
+
replace 30 with (4 + (8 + 18)) by reflexivity.
|
| 289 |
+
split.
|
| 290 |
+
- apply stable_add; [apply stable_pc|]. rewrite P1.
|
| 291 |
+
apply stable_add; [apply stable_loop; discriminate|]. rewrite P2.
|
| 292 |
+
apply stable_loop; discriminate.
|
| 293 |
+
- rewrite !dsteps_add, P1, P2, app_assoc4, P3. rewrite skipn_skipn.
|
| 294 |
+
rewrite <- !app_assoc. reflexivity.
|
| 295 |
+
Qed.
|
| 296 |
+
|
| 297 |
+
Lemma seg_esc : forall b3 b2 b1 b0 k s0 s1 lit addr rest done U W K,
|
| 298 |
+
s0 && s1 = false -> length lit = 8 -> length addr = 18 -> 26 <= length U ->
|
| 299 |
+
stable k 30 (mkD (mkC PC 3 b3 b2 b1 b0 false) k
|
| 300 |
+
((true :: true :: s0 :: s1 :: lit ++ addr ++ rest) ++ done) (U ++ W) K)
|
| 301 |
+
/\ dsteps 30 (mkD (mkC PC 3 b3 b2 b1 b0 false) k
|
| 302 |
+
((true :: true :: s0 :: s1 :: lit ++ addr ++ rest) ++ done) (U ++ W) K)
|
| 303 |
+
= mkD (mkC PC 3 true true s0 s1 false) k (rest ++ done ++ [true; true; s0; s1] ++ lit ++ addr)
|
| 304 |
+
(skipn 26 U ++ W ++ lit ++ addr) K.
|
| 305 |
+
Proof.
|
| 306 |
+
intros b3 b2 b1 b0 k s0 s1 lit addr rest done U W K Hs Hl Ha HU.
|
| 307 |
+
change ((true :: true :: s0 :: s1 :: lit ++ addr ++ rest) ++ done)
|
| 308 |
+
with ([true; true; s0; s1] ++ (lit ++ addr ++ rest) ++ done).
|
| 309 |
+
assert (Hd : dispatch true true s0 s1 false = mkC PG 7 true true s0 s1 false)
|
| 310 |
+
by (unfold dispatch, is_end, is_esc; cbn [andb]; rewrite Hs; reflexivity).
|
| 311 |
+
assert (He : is_esc true true s0 s1 = true) by (unfold is_esc; cbn [andb]; rewrite Hs; reflexivity).
|
| 312 |
+
pose proof (pc_construct b3 b2 b1 b0 k true true s0 s1 (lit ++ addr ++ rest) done (U ++ W) K) as P1.
|
| 313 |
+
rewrite Hd in P1.
|
| 314 |
+
pose proof (pg_esc_construct 7 true true s0 s1 k lit (addr ++ rest) (done ++ [true; true; s0; s1])
|
| 315 |
+
U W K He Hl ltac:(lia)) as P2.
|
| 316 |
+
pose proof (pa_construct 17 true true s0 s1 k addr rest ((done ++ [true; true; s0; s1]) ++ lit)
|
| 317 |
+
(skipn 8 U) (W ++ lit) K Ha ltac:(rewrite length_skipn; lia)) as P3.
|
| 318 |
+
replace 30 with (4 + (8 + 18)) by reflexivity.
|
| 319 |
+
split.
|
| 320 |
+
- apply stable_add; [apply stable_pc|]. rewrite P1, app_assoc4.
|
| 321 |
+
apply stable_add; [apply stable_loop; discriminate|]. rewrite P2.
|
| 322 |
+
apply stable_loop; discriminate.
|
| 323 |
+
- rewrite !dsteps_add, P1, app_assoc4, P2, app_assoc4, P3. rewrite skipn_skipn.
|
| 324 |
+
rewrite <- !app_assoc. reflexivity.
|
| 325 |
+
Qed.
|
| 326 |
+
|
| 327 |
+
Lemma seg_end : forall b3 b2 b1 b0 k done A K,
|
| 328 |
+
stable k 4 (mkD (mkC PC 3 b3 b2 b1 b0 false) k ([true; true; true; true] ++ done) A K)
|
| 329 |
+
/\ dsteps 4 (mkD (mkC PC 3 b3 b2 b1 b0 false) k ([true; true; true; true] ++ done) A K)
|
| 330 |
+
= mkD (mkC PC 3 true true true true true) k (done ++ [true; true; true; true]) A K.
|
| 331 |
+
Proof.
|
| 332 |
+
intros. split; [apply stable_pc|].
|
| 333 |
+
change ([true; true; true; true] ++ done) with ([true; true; true; true] ++ [] ++ done).
|
| 334 |
+
rewrite pc_construct. reflexivity.
|
| 335 |
+
Qed.
|
| 336 |
+
|
| 337 |
+
Lemma seg_copy_gate : forall b3 b2 b1 b0 k e3 e2 s0 s1 addr rest done A V C,
|
| 338 |
+
e3 && e2 = false -> length addr = 18 -> 22 <= length V ->
|
| 339 |
+
stable k 22 (mkD (mkC PC 3 b3 b2 b1 b0 true) k ((e3 :: e2 :: s0 :: s1 :: addr ++ rest) ++ done) A (V ++ C))
|
| 340 |
+
/\ dsteps 22 (mkD (mkC PC 3 b3 b2 b1 b0 true) k ((e3 :: e2 :: s0 :: s1 :: addr ++ rest) ++ done) A (V ++ C))
|
| 341 |
+
= mkD (mkC PC 3 e3 e2 s0 s1 true) k (rest ++ done ++ [e3; e2; s0; s1] ++ addr)
|
| 342 |
+
A (skipn 22 V ++ C ++ [e3; e2; s0; s1] ++ addr).
|
| 343 |
+
Proof.
|
| 344 |
+
intros b3 b2 b1 b0 k e3 e2 s0 s1 addr rest done A V C H32 Ha HV.
|
| 345 |
+
change ((e3 :: e2 :: s0 :: s1 :: addr ++ rest) ++ done) with ([e3; e2; s0; s1] ++ (addr ++ rest) ++ done).
|
| 346 |
+
assert (Hd : dispatch e3 e2 s0 s1 true = mkC PA 17 e3 e2 s0 s1 true)
|
| 347 |
+
by (unfold dispatch, is_end, is_esc; rewrite H32; reflexivity).
|
| 348 |
+
assert (Hn : is_end e3 e2 s0 s1 = false) by (unfold is_end; rewrite H32; reflexivity).
|
| 349 |
+
pose proof (pc_copy b3 b2 b1 b0 k e3 e2 s0 s1 (addr ++ rest) done A V C ltac:(lia)) as P1.
|
| 350 |
+
rewrite Hd, Hn in P1.
|
| 351 |
+
pose proof (pa_copy 17 e3 e2 s0 s1 k addr rest (done ++ [e3; e2; s0; s1]) A (skipn 4 V)
|
| 352 |
+
(C ++ [e3; e2; s0; s1]) Ha ltac:(rewrite length_skipn; lia)) as P2.
|
| 353 |
+
replace 22 with (4 + 18) by reflexivity.
|
| 354 |
+
split.
|
| 355 |
+
- apply stable_add; [apply stable_pc|]. rewrite P1. apply stable_loop; discriminate.
|
| 356 |
+
- rewrite !dsteps_add, P1, app_assoc4, P2. rewrite skipn_skipn.
|
| 357 |
+
rewrite <- !app_assoc. reflexivity.
|
| 358 |
+
Qed.
|
| 359 |
+
|
| 360 |
+
Lemma seg_copy_esc : forall b3 b2 b1 b0 k s0 s1 lit addr rest done A V C,
|
| 361 |
+
s0 && s1 = false -> length lit = 8 -> length addr = 18 -> 30 <= length V ->
|
| 362 |
+
stable k 30 (mkD (mkC PC 3 b3 b2 b1 b0 true) k
|
| 363 |
+
((true :: true :: s0 :: s1 :: lit ++ addr ++ rest) ++ done) A (V ++ C))
|
| 364 |
+
/\ dsteps 30 (mkD (mkC PC 3 b3 b2 b1 b0 true) k
|
| 365 |
+
((true :: true :: s0 :: s1 :: lit ++ addr ++ rest) ++ done) A (V ++ C))
|
| 366 |
+
= mkD (mkC PC 3 true true s0 s1 true) k (rest ++ done ++ [true; true; s0; s1] ++ lit ++ addr)
|
| 367 |
+
A (skipn 30 V ++ C ++ [true; true; s0; s1] ++ lit ++ addr).
|
| 368 |
+
Proof.
|
| 369 |
+
intros b3 b2 b1 b0 k s0 s1 lit addr rest done A V C Hs Hl Ha HV.
|
| 370 |
+
change ((true :: true :: s0 :: s1 :: lit ++ addr ++ rest) ++ done)
|
| 371 |
+
with ([true; true; s0; s1] ++ (lit ++ addr ++ rest) ++ done).
|
| 372 |
+
assert (Hd : dispatch true true s0 s1 true = mkC PG 7 true true s0 s1 true)
|
| 373 |
+
by (unfold dispatch, is_end, is_esc; cbn [andb]; rewrite Hs; reflexivity).
|
| 374 |
+
assert (Hn : is_end true true s0 s1 = false) by (unfold is_end; cbn [andb]; exact Hs).
|
| 375 |
+
assert (He : is_esc true true s0 s1 = true) by (unfold is_esc; cbn [andb]; rewrite Hs; reflexivity).
|
| 376 |
+
pose proof (pc_copy b3 b2 b1 b0 k true true s0 s1 (lit ++ addr ++ rest) done A V C ltac:(lia)) as P1.
|
| 377 |
+
rewrite Hd, Hn in P1.
|
| 378 |
+
pose proof (pg_esc_copy 7 true true s0 s1 k lit (addr ++ rest) (done ++ [true; true; s0; s1])
|
| 379 |
+
A (skipn 4 V) (C ++ [true; true; s0; s1]) He Hl ltac:(rewrite length_skipn; lia)) as P2.
|
| 380 |
+
pose proof (pa_copy 17 true true s0 s1 k addr rest ((done ++ [true; true; s0; s1]) ++ lit) A
|
| 381 |
+
(skipn 8 (skipn 4 V)) ((C ++ [true; true; s0; s1]) ++ lit) Ha
|
| 382 |
+
ltac:(rewrite !length_skipn; lia)) as P3.
|
| 383 |
+
replace 30 with (4 + (8 + 18)) by reflexivity.
|
| 384 |
+
split.
|
| 385 |
+
- apply stable_add; [apply stable_pc|]. rewrite P1, app_assoc4.
|
| 386 |
+
apply stable_add; [apply stable_loop; discriminate|]. rewrite P2.
|
| 387 |
+
apply stable_loop; discriminate.
|
| 388 |
+
- rewrite !dsteps_add, P1, app_assoc4, P2, app_assoc4, P3. rewrite !skipn_skipn.
|
| 389 |
+
rewrite <- !app_assoc. reflexivity.
|
| 390 |
+
Qed.
|
| 391 |
+
|
| 392 |
+
Lemma seg_copy_end : forall b3 b2 b1 b0 k done A V C,
|
| 393 |
+
4 <= length V ->
|
| 394 |
+
stable k 4 (mkD (mkC PC 3 b3 b2 b1 b0 true) k ([true; true; true; true] ++ done) A (V ++ C))
|
| 395 |
+
/\ dsteps 4 (mkD (mkC PC 3 b3 b2 b1 b0 true) k ([true; true; true; true] ++ done) A (V ++ C))
|
| 396 |
+
= mkD (mkC PC 3 true true true true false) (negb k) (done ++ [true; true; true; true])
|
| 397 |
+
A (skipn 4 V ++ C ++ [true; true; true; true]).
|
| 398 |
+
Proof.
|
| 399 |
+
intros b3 b2 b1 b0 k done A V C HV. split; [apply stable_pc|].
|
| 400 |
+
change ([true; true; true; true] ++ done) with ([true; true; true; true] ++ [] ++ done).
|
| 401 |
+
rewrite pc_copy by exact HV. reflexivity.
|
| 402 |
+
Qed.
|
| 403 |
+
|
| 404 |
+
(* ---- the description read in construct mode ------------------------------------ *)
|
| 405 |
+
Lemma translate_aux_long : forall f l X, translate_aux f l = Some X -> 4 <= length l.
|
| 406 |
+
Proof.
|
| 407 |
+
intros [|f] l X H; [discriminate|]. cbn [translate_aux] in H.
|
| 408 |
+
destruct l as [|a [|b [|c [|d l]]]]; try discriminate. cbn [length]. lia.
|
| 409 |
+
Qed.
|
| 410 |
+
|
| 411 |
+
Lemma translate_aux_S : forall f c3 c2 s0 s1 rest,
|
| 412 |
+
translate_aux (S f) (c3 :: c2 :: s0 :: s1 :: rest) =
|
| 413 |
+
if c3 && c2 then
|
| 414 |
+
if s0 && s1 then match rest with [] => Some [] | _ => None end
|
| 415 |
+
else if Nat.eqb (length rest) 0 then None
|
| 416 |
+
else option_map (fun t => firstn 26 rest ++ t) (translate_aux f (skipn 26 rest))
|
| 417 |
+
else option_map (fun t => gate_bits (if c3 then 2 else if c2 then 1 else 0) s0 s1 ++ firstn 18 rest ++ t)
|
| 418 |
+
(translate_aux f (skipn 18 rest)).
|
| 419 |
+
Proof. reflexivity. Qed.
|
| 420 |
+
|
| 421 |
+
Lemma some_inj : forall (A : Type) (a b : A), Some a = Some b -> a = b.
|
| 422 |
+
Proof. intros A a b H. injection H. auto. Qed.
|
| 423 |
+
|
| 424 |
+
Lemma split_at : forall (l : list bool) n, n <= length l -> exists a c, l = a ++ c /\ length a = n.
|
| 425 |
+
Proof.
|
| 426 |
+
intros l n H. exists (firstn n l), (skipn n l). split; [symmetry; apply firstn_skipn|].
|
| 427 |
+
apply firstn_length_le. exact H.
|
| 428 |
+
Qed.
|
| 429 |
+
|
| 430 |
+
Lemma skipn_app_exact : forall (a b : list bool) n, length a = n -> skipn n (a ++ b) = b.
|
| 431 |
+
Proof. intros a b n <-. induction a as [|x a IH]; [reflexivity|]. exact IH. Qed.
|
| 432 |
+
|
| 433 |
+
Lemma firstn_app_exact : forall (a b : list bool) n, length a = n -> firstn n (a ++ b) = a.
|
| 434 |
+
Proof.
|
| 435 |
+
intros a b n <-. induction a as [|x a IH]; [reflexivity|]. cbn [length firstn app].
|
| 436 |
+
rewrite IH. reflexivity.
|
| 437 |
+
Qed.
|
| 438 |
+
|
| 439 |
+
Lemma construct_phase : forall f rest Xr done U W K k b3 b2 b1 b0,
|
| 440 |
+
translate_aux f rest = Some Xr -> length U = length Xr ->
|
| 441 |
+
exists nrec, length Xr = 26 * nrec
|
| 442 |
+
/\ stable k (30 * nrec + 4) (mkD (mkC PC 3 b3 b2 b1 b0 false) k (rest ++ done) (U ++ W) K)
|
| 443 |
+
/\ dsteps (30 * nrec + 4) (mkD (mkC PC 3 b3 b2 b1 b0 false) k (rest ++ done) (U ++ W) K)
|
| 444 |
+
= mkD (mkC PC 3 true true true true true) k (done ++ rest) (W ++ Xr) K.
|
| 445 |
+
Proof.
|
| 446 |
+
induction f as [|f IH]; intros rest Xr done U W K k b3 b2 b1 b0 Ht HU; [discriminate|].
|
| 447 |
+
destruct rest as [|e3 [|e2 [|s0 [|s1 rest1]]]]; try discriminate.
|
| 448 |
+
rewrite translate_aux_S in Ht.
|
| 449 |
+
destruct (e3 && e2) eqn:E32.
|
| 450 |
+
- apply andb_prop in E32 as [-> ->].
|
| 451 |
+
destruct (s0 && s1) eqn:Es.
|
| 452 |
+
+ (* the end codon *)
|
| 453 |
+
destruct rest1; [|discriminate]. apply some_inj in Ht. subst Xr.
|
| 454 |
+
apply andb_prop in Es as [-> ->].
|
| 455 |
+
destruct U; [|discriminate].
|
| 456 |
+
exists 0. replace (30 * 0 + 4) with 4 by reflexivity.
|
| 457 |
+
rewrite app_nil_l, app_nil_r. split; [reflexivity|].
|
| 458 |
+
exact (seg_end b3 b2 b1 b0 k done W K).
|
| 459 |
+
+ (* an escaped record *)
|
| 460 |
+
destruct (Nat.eqb (length rest1) 0) eqn:El; [discriminate|].
|
| 461 |
+
destruct (translate_aux f (skipn 26 rest1)) as [X'|] eqn:Ht'; [|discriminate].
|
| 462 |
+
cbn [option_map] in Ht. apply some_inj in Ht. subst Xr.
|
| 463 |
+
pose proof (translate_aux_long _ _ _ Ht') as Hlong. rewrite length_skipn in Hlong.
|
| 464 |
+
destruct (split_at rest1 8 ltac:(lia)) as (lit & r1 & -> & Hl).
|
| 465 |
+
destruct (split_at r1 18 ltac:(rewrite length_app in Hlong; lia)) as (addr & rest2 & -> & Ha).
|
| 466 |
+
assert (Hs26 : skipn 26 (lit ++ addr ++ rest2) = rest2)
|
| 467 |
+
by (rewrite app_assoc; apply skipn_app_exact; rewrite length_app; lia).
|
| 468 |
+
assert (Hf26 : firstn 26 (lit ++ addr ++ rest2) = lit ++ addr)
|
| 469 |
+
by (rewrite app_assoc; apply firstn_app_exact; rewrite length_app; lia).
|
| 470 |
+
rewrite Hs26 in Ht'. rewrite Hf26 in HU |- *.
|
| 471 |
+
rewrite !length_app in HU.
|
| 472 |
+
destruct (seg_esc b3 b2 b1 b0 k s0 s1 lit addr rest2 done U W K Es Hl Ha ltac:(lia)) as [S1 E1].
|
| 473 |
+
destruct (IH rest2 X' (done ++ [true; true; s0; s1] ++ lit ++ addr) (skipn 26 U)
|
| 474 |
+
(W ++ lit ++ addr) K k true true s0 s1 Ht' ltac:(rewrite length_skipn; lia))
|
| 475 |
+
as (nrec & Hn & S2 & E2).
|
| 476 |
+
exists (S nrec). replace (30 * S nrec + 4) with (30 + (30 * nrec + 4)) by lia.
|
| 477 |
+
split; [rewrite !length_app; lia|]. split.
|
| 478 |
+
* apply stable_add; [exact S1|]. rewrite E1. exact S2.
|
| 479 |
+
* rewrite dsteps_add, E1, E2. rewrite <- !app_assoc. reflexivity.
|
| 480 |
+
- (* a record named by its gate codon *)
|
| 481 |
+
destruct (translate_aux f (skipn 18 rest1)) as [X'|] eqn:Ht'; [|discriminate].
|
| 482 |
+
cbn [option_map] in Ht. apply some_inj in Ht. subst Xr.
|
| 483 |
+
pose proof (translate_aux_long _ _ _ Ht') as Hlong. rewrite length_skipn in Hlong.
|
| 484 |
+
destruct (split_at rest1 18 ltac:(lia)) as (addr & rest2 & -> & Ha).
|
| 485 |
+
rewrite (skipn_app_exact addr rest2 18 Ha) in Ht'.
|
| 486 |
+
rewrite (firstn_app_exact addr rest2 18 Ha) in HU |- *.
|
| 487 |
+
change (if e3 then 2 else if e2 then 1 else 0) with (kind_of e3 e2) in HU |- *.
|
| 488 |
+
assert (Hg : length (gate_bits (kind_of e3 e2) s0 s1) = 8)
|
| 489 |
+
by (unfold gate_bits, kind_of; destruct e3, e2; reflexivity).
|
| 490 |
+
rewrite !length_app, Hg in HU.
|
| 491 |
+
destruct (seg_gate b3 b2 b1 b0 k e3 e2 s0 s1 addr rest2 done U W K E32 Ha ltac:(lia)) as [S1 E1].
|
| 492 |
+
destruct (IH rest2 X' (done ++ [e3; e2; s0; s1] ++ addr) (skipn 26 U)
|
| 493 |
+
(W ++ gate_bits (kind_of e3 e2) s0 s1 ++ addr) K k e3 e2 s0 s1 Ht'
|
| 494 |
+
ltac:(rewrite length_skipn; lia))
|
| 495 |
+
as (nrec & Hn & S2 & E2).
|
| 496 |
+
exists (S nrec). replace (30 * S nrec + 4) with (30 + (30 * nrec + 4)) by lia.
|
| 497 |
+
split; [rewrite !length_app, Hg; lia|]. split.
|
| 498 |
+
+ apply stable_add; [exact S1|]. rewrite E1. exact S2.
|
| 499 |
+
+ rewrite dsteps_add, E1, E2. rewrite <- !app_assoc. reflexivity.
|
| 500 |
+
Qed.
|
| 501 |
+
|
| 502 |
+
(* ---- the description read again in copy mode ------------------------------------ *)
|
| 503 |
+
Lemma copy_phase : forall f rest Xr done A V C k b3 b2 b1 b0,
|
| 504 |
+
translate_aux f rest = Some Xr -> length V = length rest ->
|
| 505 |
+
stable k (length rest) (mkD (mkC PC 3 b3 b2 b1 b0 true) k (rest ++ done) A (V ++ C))
|
| 506 |
+
/\ dsteps (length rest) (mkD (mkC PC 3 b3 b2 b1 b0 true) k (rest ++ done) A (V ++ C))
|
| 507 |
+
= mkD (mkC PC 3 true true true true false) (negb k) (done ++ rest) A (C ++ rest).
|
| 508 |
+
Proof.
|
| 509 |
+
induction f as [|f IH]; intros rest Xr done A V C k b3 b2 b1 b0 Ht HV; [discriminate|].
|
| 510 |
+
destruct rest as [|e3 [|e2 [|s0 [|s1 rest1]]]]; try discriminate.
|
| 511 |
+
rewrite translate_aux_S in Ht.
|
| 512 |
+
destruct (e3 && e2) eqn:E32.
|
| 513 |
+
- apply andb_prop in E32 as [-> ->].
|
| 514 |
+
destruct (s0 && s1) eqn:Es.
|
| 515 |
+
+ (* the end codon *)
|
| 516 |
+
destruct rest1; [|discriminate]. apply andb_prop in Es as [-> ->].
|
| 517 |
+
destruct (seg_copy_end b3 b2 b1 b0 k done A V C ltac:(cbn [length] in HV; lia)) as [S1 E1].
|
| 518 |
+
replace (skipn 4 V) with (@nil bool) in E1
|
| 519 |
+
by (symmetry; apply length_zero_iff_nil; rewrite length_skipn; cbn [length] in HV; lia).
|
| 520 |
+
change (length [true; true; true; true]) with 4.
|
| 521 |
+
split; [exact S1|]. rewrite E1. reflexivity.
|
| 522 |
+
+ (* an escaped record *)
|
| 523 |
+
destruct (Nat.eqb (length rest1) 0) eqn:El; [discriminate|].
|
| 524 |
+
destruct (translate_aux f (skipn 26 rest1)) as [X'|] eqn:Ht'; [|discriminate].
|
| 525 |
+
pose proof (translate_aux_long _ _ _ Ht') as Hlong. rewrite length_skipn in Hlong.
|
| 526 |
+
destruct (split_at rest1 8 ltac:(lia)) as (lit & r1 & -> & Hl).
|
| 527 |
+
destruct (split_at r1 18 ltac:(rewrite length_app in Hlong; lia)) as (addr & rest2 & -> & Ha).
|
| 528 |
+
assert (Hs26 : skipn 26 (lit ++ addr ++ rest2) = rest2)
|
| 529 |
+
by (rewrite app_assoc; apply skipn_app_exact; rewrite length_app; lia).
|
| 530 |
+
rewrite Hs26 in Ht'.
|
| 531 |
+
assert (Hlen : length (true :: true :: s0 :: s1 :: lit ++ addr ++ rest2) = 30 + length rest2)
|
| 532 |
+
by (cbn [length]; rewrite !length_app; lia).
|
| 533 |
+
rewrite Hlen in HV |- *.
|
| 534 |
+
destruct (seg_copy_esc b3 b2 b1 b0 k s0 s1 lit addr rest2 done A V C Es Hl Ha ltac:(lia)) as [S1 E1].
|
| 535 |
+
destruct (IH rest2 X' (done ++ [true; true; s0; s1] ++ lit ++ addr) A (skipn 30 V)
|
| 536 |
+
(C ++ [true; true; s0; s1] ++ lit ++ addr) k true true s0 s1 Ht'
|
| 537 |
+
ltac:(rewrite length_skipn; lia)) as [S2 E2].
|
| 538 |
+
split.
|
| 539 |
+
* apply stable_add; [exact S1|]. rewrite E1. exact S2.
|
| 540 |
+
* rewrite dsteps_add, E1, E2. rewrite <- !app_assoc. reflexivity.
|
| 541 |
+
- (* a record named by its gate codon *)
|
| 542 |
+
destruct (translate_aux f (skipn 18 rest1)) as [X'|] eqn:Ht'; [|discriminate].
|
| 543 |
+
pose proof (translate_aux_long _ _ _ Ht') as Hlong. rewrite length_skipn in Hlong.
|
| 544 |
+
destruct (split_at rest1 18 ltac:(lia)) as (addr & rest2 & -> & Ha).
|
| 545 |
+
rewrite (skipn_app_exact addr rest2 18 Ha) in Ht'.
|
| 546 |
+
assert (Hlen : length (e3 :: e2 :: s0 :: s1 :: addr ++ rest2) = 22 + length rest2)
|
| 547 |
+
by (cbn [length]; rewrite !length_app; lia).
|
| 548 |
+
rewrite Hlen in HV |- *.
|
| 549 |
+
destruct (seg_copy_gate b3 b2 b1 b0 k e3 e2 s0 s1 addr rest2 done A V C E32 Ha ltac:(lia)) as [S1 E1].
|
| 550 |
+
destruct (IH rest2 X' (done ++ [e3; e2; s0; s1] ++ addr) A (skipn 22 V)
|
| 551 |
+
(C ++ [e3; e2; s0; s1] ++ addr) k e3 e2 s0 s1 Ht'
|
| 552 |
+
ltac:(rewrite length_skipn; lia)) as [S2 E2].
|
| 553 |
+
split.
|
| 554 |
+
+ apply stable_add; [exact S1|]. rewrite E1. exact S2.
|
| 555 |
+
+ rewrite dsteps_add, E1, E2. rewrite <- !app_assoc. reflexivity.
|
| 556 |
+
Qed.
|
| 557 |
+
|
| 558 |
+
(* ---- one generation ---------------------------------------------------------------- *)
|
| 559 |
+
(* From the start of a codon in construct mode, with the description d under the read head,
|
| 560 |
+
an arm as long as the record image X that d describes and a copy tape as long as d, the
|
| 561 |
+
pass is iterated 30 times per record of X, 4 times on the end codon and once per bit of d.
|
| 562 |
+
The bank bit holds its value until the last pass and flips there; the arm then holds X, the
|
| 563 |
+
copy tape d, the read tape d again, and the configuration is back at a codon start. *)
|
| 564 |
+
Theorem generation : forall d X k A0 K0 b3 b2 b1 b0,
|
| 565 |
+
translate d = Some X -> length A0 = length X -> length K0 = length d ->
|
| 566 |
+
exists nrec, length X = 26 * nrec
|
| 567 |
+
/\ stable k (30 * nrec + 4 + length d) (mkD (mkC PC 3 b3 b2 b1 b0 false) k d A0 K0)
|
| 568 |
+
/\ dsteps (30 * nrec + 4 + length d) (mkD (mkC PC 3 b3 b2 b1 b0 false) k d A0 K0)
|
| 569 |
+
= mkD (mkC PC 3 true true true true false) (negb k) d X d.
|
| 570 |
+
Proof.
|
| 571 |
+
intros d X k A0 K0 b3 b2 b1 b0 Ht HA HK. unfold translate in Ht.
|
| 572 |
+
destruct (construct_phase (length d) d X [] A0 [] K0 k b3 b2 b1 b0 Ht HA) as (nrec & Hn & S1 & E1).
|
| 573 |
+
rewrite !app_nil_r in S1, E1. rewrite !app_nil_l in E1.
|
| 574 |
+
destruct (copy_phase (length d) d X [] X K0 [] k true true true true Ht HK) as [S2 E2].
|
| 575 |
+
rewrite !app_nil_r in S2, E2. rewrite !app_nil_l in E2.
|
| 576 |
+
exists nrec. split; [exact Hn|]. split.
|
| 577 |
+
- apply stable_add; [exact S1|]. rewrite E1. exact S2.
|
| 578 |
+
- rewrite dsteps_add, E1, E2. reflexivity.
|
| 579 |
+
Qed.
|
rocq/Extract.v
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
From Stdlib Require Import Extraction ExtrOcamlBasic ExtrOcamlNatInt ExtrOcamlZInt.
|
| 2 |
+
From TH Require Import Net Phys.
|
| 3 |
+
Extraction Language OCaml.
|
| 4 |
+
Set Extraction Output Directory "extract".
|
| 5 |
+
Extraction "physnet.ml" phys_units phys_next nst.
|
rocq/Gates.v
ADDED
|
@@ -0,0 +1,82 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
(* Conjunctions and disjunctions of literals as ternary threshold units. *)
|
| 2 |
+
From Stdlib Require Import List Bool Arith ZArith Lia.
|
| 3 |
+
Import ListNotations.
|
| 4 |
+
From TH Require Import TwoHead Net.
|
| 5 |
+
|
| 6 |
+
(* a literal: a signal and its polarity *)
|
| 7 |
+
Definition lit := (sref * bool)%type.
|
| 8 |
+
|
| 9 |
+
Definition lw (l : lit) : sref * Z := (fst l, if snd l then 1%Z else (-1)%Z).
|
| 10 |
+
Definition npos (ls : list lit) : nat := length (filter snd ls).
|
| 11 |
+
Definition nneg (ls : list lit) : nat := length (filter (fun l => negb (snd l)) ls).
|
| 12 |
+
|
| 13 |
+
(* H(sum of the positive literals - sum of the negated ones - #positive) and
|
| 14 |
+
H(sum of the positive literals - sum of the negated ones + #negated - 1) *)
|
| 15 |
+
Definition sAND (ls : list lit) : su := SU (- Z.of_nat (npos ls)) (map lw ls).
|
| 16 |
+
Definition sOR (ls : list lit) : su := SU (Z.of_nat (nneg ls) - 1) (map lw ls).
|
| 17 |
+
|
| 18 |
+
(* a two-way choice placed at units r0, r0 + 1, r0 + 2 of member j of block b *)
|
| 19 |
+
Definition mux3 (b j r0 : nat) (sel a c : sref) : list su :=
|
| 20 |
+
[sAND [(sel, true); (a, true)]; sAND [(sel, false); (c, true)];
|
| 21 |
+
sOR [(SRef b j r0, true); (SRef b j (S r0), true)]].
|
| 22 |
+
|
| 23 |
+
Definition litv (V : sref -> bool) (l : lit) : bool := Bool.eqb (V (fst l)) (snd l).
|
| 24 |
+
|
| 25 |
+
Lemma swsum_lits : forall ls V,
|
| 26 |
+
swsum (map lw ls) V = (Z.of_nat (length (filter (litv V) ls)) - Z.of_nat (nneg ls))%Z.
|
| 27 |
+
Proof.
|
| 28 |
+
induction ls as [|[x p] t IH]; intro V; [reflexivity|].
|
| 29 |
+
unfold nneg in *. cbn [map swsum lw fst snd filter] in *. rewrite IH.
|
| 30 |
+
change (litv V (x, p)) with (Bool.eqb (V x) p).
|
| 31 |
+
destruct p, (V x); cbn [Bool.eqb negb length b2z]; rewrite ?Nat2Z.inj_succ; lia.
|
| 32 |
+
Qed.
|
| 33 |
+
|
| 34 |
+
Lemma filter_length_le : forall (A : Type) (f : A -> bool) l, length (filter f l) <= length l.
|
| 35 |
+
Proof. intros A f l. induction l as [|x t IH]; cbn [filter length]; [lia|]. destruct (f x); cbn [length]; lia. Qed.
|
| 36 |
+
|
| 37 |
+
Lemma filter_all : forall (A : Type) (f : A -> bool) l, length (filter f l) = length l <-> forallb f l = true.
|
| 38 |
+
Proof.
|
| 39 |
+
intros A f l. induction l as [|x t IH]; cbn [filter length forallb]; [tauto|].
|
| 40 |
+
pose proof (filter_length_le A f t). destruct (f x); cbn [length andb].
|
| 41 |
+
- rewrite <- IH. lia.
|
| 42 |
+
- split; [lia | discriminate].
|
| 43 |
+
Qed.
|
| 44 |
+
|
| 45 |
+
Lemma filter_some : forall (A : Type) (f : A -> bool) l, 1 <= length (filter f l) <-> existsb f l = true.
|
| 46 |
+
Proof.
|
| 47 |
+
intros A f l. induction l as [|x t IH]; cbn [filter length existsb]; [split; [lia|discriminate]|].
|
| 48 |
+
destruct (f x); cbn [length orb]; [split; [reflexivity|lia]|exact IH].
|
| 49 |
+
Qed.
|
| 50 |
+
|
| 51 |
+
Lemma npos_nneg : forall ls, npos ls + nneg ls = length ls.
|
| 52 |
+
Proof.
|
| 53 |
+
induction ls as [|[x p] t IH]; [reflexivity|]. unfold npos, nneg in *.
|
| 54 |
+
cbn [filter length snd negb]. destruct p; cbn [length negb]; lia.
|
| 55 |
+
Qed.
|
| 56 |
+
|
| 57 |
+
Lemma sAND_fire : forall ls V, sfire' (sAND ls) V = forallb (litv V) ls.
|
| 58 |
+
Proof.
|
| 59 |
+
intros ls V. unfold sfire', sAND. cbn [sb sin]. rewrite swsum_lits.
|
| 60 |
+
pose proof (npos_nneg ls). pose proof (filter_length_le _ (litv V) ls).
|
| 61 |
+
destruct (forallb (litv V) ls) eqn:E.
|
| 62 |
+
- apply filter_all in E. apply Z.leb_le. lia.
|
| 63 |
+
- apply Z.leb_gt. destruct (Nat.eq_dec (length (filter (litv V) ls)) (length ls)) as [H1|H1].
|
| 64 |
+
+ apply filter_all in H1. congruence.
|
| 65 |
+
+ lia.
|
| 66 |
+
Qed.
|
| 67 |
+
|
| 68 |
+
Lemma sOR_fire : forall ls V, sfire' (sOR ls) V = existsb (litv V) ls.
|
| 69 |
+
Proof.
|
| 70 |
+
intros ls V. unfold sfire', sOR. cbn [sb sin]. rewrite swsum_lits.
|
| 71 |
+
destruct (existsb (litv V) ls) eqn:E.
|
| 72 |
+
- apply filter_some in E. apply Z.leb_le. lia.
|
| 73 |
+
- apply Z.leb_gt. destruct (Nat.le_gt_cases 1 (length (filter (litv V) ls))) as [H1|H1].
|
| 74 |
+
+ apply filter_some in H1. congruence.
|
| 75 |
+
+ lia.
|
| 76 |
+
Qed.
|
| 77 |
+
|
| 78 |
+
Lemma litv_pos : forall V x, litv V (x, true) = V x.
|
| 79 |
+
Proof. intros V x. unfold litv. cbn [fst snd]. destruct (V x); reflexivity. Qed.
|
| 80 |
+
|
| 81 |
+
Lemma litv_neg : forall V x, litv V (x, false) = negb (V x).
|
| 82 |
+
Proof. intros V x. unfold litv. cbn [fst snd]. destruct (V x); reflexivity. Qed.
|
rocq/Indep.v
ADDED
|
@@ -0,0 +1,141 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
(* Cells a pass writes before it reads them carry nothing from one pass to the next. *)
|
| 2 |
+
From Stdlib Require Import List Bool Arith ZArith Lia.
|
| 3 |
+
Import ListNotations.
|
| 4 |
+
From TH Require Import TwoHead Tapes Iter Abstract.
|
| 5 |
+
|
| 6 |
+
Definition ao_of (r : rec) : nat := match r with Rec _ _ _ _ _ ao => ao end.
|
| 7 |
+
|
| 8 |
+
Definition reads_ok (istmp : nat -> bool) (written : list nat) (a : nat) (w : Z) : bool :=
|
| 9 |
+
Z.eqb w 0 || Nat.eqb a RD || Nat.eqb a ARM || Nat.eqb a CPY || negb (istmp a)
|
| 10 |
+
|| existsb (Nat.eqb a) written.
|
| 11 |
+
|
| 12 |
+
Fixpoint wbr_from (rs : list rec) (istmp : nat -> bool) (written : list nat) : bool :=
|
| 13 |
+
match rs with
|
| 14 |
+
| [] => true
|
| 15 |
+
| Rec a0 w0 a1 w1 _ ao :: t =>
|
| 16 |
+
reads_ok istmp written a0 w0 && reads_ok istmp written a1 w1
|
| 17 |
+
&& wbr_from t istmp (written ++ [ao])
|
| 18 |
+
end.
|
| 19 |
+
|
| 20 |
+
Definition wagree (istmp : nat -> bool) (written : list nat) (w1 w2 : list bool) : Prop :=
|
| 21 |
+
forall x, (istmp x = false \/ In x written) -> x <> RD -> x <> ARM -> x <> CPY ->
|
| 22 |
+
wget w1 x = wget w2 x.
|
| 23 |
+
|
| 24 |
+
Lemma acell_agree : forall istmp written t1 t2 a w,
|
| 25 |
+
aR t1 = aR t2 -> aA t1 = aA t2 -> aK t1 = aK t2 ->
|
| 26 |
+
wagree istmp written (aw t1) (aw t2) ->
|
| 27 |
+
reads_ok istmp written a w = true ->
|
| 28 |
+
(w * b2z (acell t1 a) = w * b2z (acell t2 a))%Z.
|
| 29 |
+
Proof.
|
| 30 |
+
intros istmp written t1 t2 a w HR HA HK Hw Hok. unfold reads_ok in Hok. unfold acell.
|
| 31 |
+
rewrite HR, HA, HK.
|
| 32 |
+
destruct (Z.eqb w 0) eqn:Ew; [apply Z.eqb_eq in Ew; subst; reflexivity|].
|
| 33 |
+
destruct (Nat.eqb a RD) eqn:E1; [reflexivity|].
|
| 34 |
+
destruct (Nat.eqb a ARM) eqn:E2; [reflexivity|].
|
| 35 |
+
destruct (Nat.eqb a CPY) eqn:E3; [reflexivity|].
|
| 36 |
+
rewrite ?Ew, ?E1, ?E2, ?E3 in Hok. cbn [orb] in Hok.
|
| 37 |
+
apply Nat.eqb_neq in E1, E2, E3.
|
| 38 |
+
rewrite Hw; auto.
|
| 39 |
+
destruct (istmp a) eqn:Et; [right | left; reflexivity].
|
| 40 |
+
cbn [negb orb] in Hok. apply existsb_exists in Hok as (y & Hy & Hey).
|
| 41 |
+
apply Nat.eqb_eq in Hey. subst. exact Hy.
|
| 42 |
+
Qed.
|
| 43 |
+
|
| 44 |
+
Lemma opok_tapes : forall t1 t2 a w,
|
| 45 |
+
aR t1 = aR t2 -> aA t1 = aA t2 -> aK t1 = aK t2 -> opok t1 a w = opok t2 a w.
|
| 46 |
+
Proof. intros t1 t2 a w HR HA HK. unfold opok. rewrite HR, HA, HK. reflexivity. Qed.
|
| 47 |
+
|
| 48 |
+
Lemma wagree_step : forall istmp written w1 w2 ao v,
|
| 49 |
+
wagree istmp written w1 w2 -> length w1 = length w2 ->
|
| 50 |
+
istmp AA = false -> istmp AR = false -> istmp AC = false ->
|
| 51 |
+
wagree istmp (written ++ [ao]) (clearq (wnext w1 ao v)) (clearq (wnext w2 ao v)).
|
| 52 |
+
Proof.
|
| 53 |
+
intros istmp written w1 w2 ao v H Hl HAA HAR HAC x Hx H1 H2 H3.
|
| 54 |
+
unfold clearq. rewrite !wget_upd, !upd_length, !length_wnext, Hl.
|
| 55 |
+
destruct (Nat.eqb x AC && Nat.ltb AC (length w2)); [reflexivity|].
|
| 56 |
+
destruct (Nat.eqb x AR && Nat.ltb AR (length w2)); [reflexivity|].
|
| 57 |
+
destruct (Nat.eqb x AA && Nat.ltb AA (length w2)); [reflexivity|].
|
| 58 |
+
unfold wnext.
|
| 59 |
+
destruct (Nat.eqb ao RD || Nat.eqb ao ARM || Nat.eqb ao CPY) eqn:Eao.
|
| 60 |
+
- apply H; auto. destruct Hx as [Hx|Hx]; [left; exact Hx|].
|
| 61 |
+
apply in_app_or in Hx as [Hx|Hx]; [right; exact Hx|].
|
| 62 |
+
destruct Hx as [Hx|[]]. subst x.
|
| 63 |
+
apply orb_true_iff in Eao as [Eao|Eao]; [apply orb_true_iff in Eao as [Eao|Eao]|];
|
| 64 |
+
apply Nat.eqb_eq in Eao; contradiction.
|
| 65 |
+
- rewrite !wget_upd, Hl.
|
| 66 |
+
destruct (Nat.eqb x ao && Nat.ltb ao (length w2)) eqn:Ex; [reflexivity|].
|
| 67 |
+
destruct Hx as [Hx|Hx]; [apply H; auto|].
|
| 68 |
+
apply in_app_or in Hx as [Hx|Hx]; [apply H; auto|].
|
| 69 |
+
destruct Hx as [Hx|[]]. subst x.
|
| 70 |
+
rewrite Nat.eqb_refl in Ex. cbn [andb] in Ex. apply Nat.ltb_ge in Ex.
|
| 71 |
+
(* ao lies beyond the window: neither list holds it *)
|
| 72 |
+
unfold wget. rewrite !nth_overflow by lia. reflexivity.
|
| 73 |
+
Qed.
|
| 74 |
+
|
| 75 |
+
Lemma firstn_S_nth : forall (rs : list rec) j r, nth_error rs j = Some r ->
|
| 76 |
+
firstn (S j) rs = firstn j rs ++ [r].
|
| 77 |
+
Proof.
|
| 78 |
+
induction rs as [|y rs IH]; intros [|j] r H; cbn in *; try discriminate.
|
| 79 |
+
- injection H as ->. reflexivity.
|
| 80 |
+
- rewrite (IH j r H). reflexivity.
|
| 81 |
+
Qed.
|
| 82 |
+
|
| 83 |
+
Lemma skipn_nth : forall (rs : list rec) j r, nth_error rs j = Some r ->
|
| 84 |
+
skipn j rs = r :: skipn (S j) rs.
|
| 85 |
+
Proof.
|
| 86 |
+
induction rs as [|y rs IH]; intros [|j] r H; cbn in *; try discriminate.
|
| 87 |
+
- injection H as ->. reflexivity.
|
| 88 |
+
- apply IH. exact H.
|
| 89 |
+
Qed.
|
| 90 |
+
|
| 91 |
+
Lemma aiter_indep : forall n rs istmp t1 t2,
|
| 92 |
+
istmp AA = false -> istmp AR = false -> istmp AC = false ->
|
| 93 |
+
wbr_from (skipn (ai t1) rs) istmp (map ao_of (firstn (ai t1) rs)) = true ->
|
| 94 |
+
ai t1 = ai t2 -> aR t1 = aR t2 -> aA t1 = aA t2 -> aK t1 = aK t2 -> bad t1 = bad t2 ->
|
| 95 |
+
length (aw t1) = length (aw t2) ->
|
| 96 |
+
wagree istmp (map ao_of (firstn (ai t1) rs)) (aw t1) (aw t2) ->
|
| 97 |
+
ai (aiter n rs t1) = ai (aiter n rs t2)
|
| 98 |
+
/\ aR (aiter n rs t1) = aR (aiter n rs t2)
|
| 99 |
+
/\ aA (aiter n rs t1) = aA (aiter n rs t2)
|
| 100 |
+
/\ aK (aiter n rs t1) = aK (aiter n rs t2)
|
| 101 |
+
/\ bad (aiter n rs t1) = bad (aiter n rs t2)
|
| 102 |
+
/\ (forall x, istmp x = false -> x <> RD -> x <> ARM -> x <> CPY ->
|
| 103 |
+
wget (aw (aiter n rs t1)) x = wget (aw (aiter n rs t2)) x).
|
| 104 |
+
Proof.
|
| 105 |
+
induction n as [|n IH]; intros rs istmp t1 t2 HAA HAR HAC Hwbr Hi HR HA HK Hb Hl Hw.
|
| 106 |
+
- cbn [aiter]. repeat split; auto; try (intros x Hx H1 H2 H3; apply Hw; auto).
|
| 107 |
+
- cbn [aiter].
|
| 108 |
+
destruct (nth_error rs (ai t1)) as [r|] eqn:Er.
|
| 109 |
+
+ assert (Er2 : nth_error rs (ai t2) = Some r) by (rewrite <- Hi; exact Er).
|
| 110 |
+
rewrite (skipn_nth rs _ r Er) in Hwbr.
|
| 111 |
+
destruct r as [a0 w0 a1 w1 beta ao]. cbn [wbr_from] in Hwbr.
|
| 112 |
+
apply andb_prop in Hwbr as [Hrd Hwbr]. apply andb_prop in Hrd as [Hr0 Hr1].
|
| 113 |
+
rewrite (astep_char rs t1 a0 w0 a1 w1 beta ao Er), (astep_char rs t2 a0 w0 a1 w1 beta ao Er2).
|
| 114 |
+
rewrite (acell_agree istmp _ t1 t2 a0 w0 HR HA HK Hw Hr0),
|
| 115 |
+
(acell_agree istmp _ t1 t2 a1 w1 HR HA HK Hw Hr1).
|
| 116 |
+
apply IH; auto; unfold astepres; cbv zeta; cbn [ai aR aA aK bad aw].
|
| 117 |
+
* rewrite (firstn_S_nth rs _ _ Er), map_app. exact Hwbr.
|
| 118 |
+
* rewrite Hi; reflexivity.
|
| 119 |
+
* assert (Hq : wget (wnext (aw t1) ao (Z.leb 0 (w0 * b2z (acell t2 a0) + w1 * b2z (acell t2 a1) + beta)%Z)) AR
|
| 120 |
+
= wget (wnext (aw t2) ao (Z.leb 0 (w0 * b2z (acell t2 a0) + w1 * b2z (acell t2 a1) + beta)%Z)) AR).
|
| 121 |
+
{ unfold wnext. destruct (_ || _ || _); [apply Hw; auto; discriminate|].
|
| 122 |
+
rewrite !wget_upd, Hl. destruct (_ && _); [reflexivity|]. apply Hw; auto; discriminate. }
|
| 123 |
+
rewrite Hq, HR. reflexivity.
|
| 124 |
+
* assert (Hq : wget (wnext (aw t1) ao (Z.leb 0 (w0 * b2z (acell t2 a0) + w1 * b2z (acell t2 a1) + beta)%Z)) AA
|
| 125 |
+
= wget (wnext (aw t2) ao (Z.leb 0 (w0 * b2z (acell t2 a0) + w1 * b2z (acell t2 a1) + beta)%Z)) AA).
|
| 126 |
+
{ unfold wnext. destruct (_ || _ || _); [apply Hw; auto; discriminate|].
|
| 127 |
+
rewrite !wget_upd, Hl. destruct (_ && _); [reflexivity|]. apply Hw; auto; discriminate. }
|
| 128 |
+
rewrite Hq, HA. reflexivity.
|
| 129 |
+
* assert (Hq : wget (wnext (aw t1) ao (Z.leb 0 (w0 * b2z (acell t2 a0) + w1 * b2z (acell t2 a1) + beta)%Z)) AC
|
| 130 |
+
= wget (wnext (aw t2) ao (Z.leb 0 (w0 * b2z (acell t2 a0) + w1 * b2z (acell t2 a1) + beta)%Z)) AC).
|
| 131 |
+
{ unfold wnext. destruct (_ || _ || _); [apply Hw; auto; discriminate|].
|
| 132 |
+
rewrite !wget_upd, Hl. destruct (_ && _); [reflexivity|]. apply Hw; auto; discriminate. }
|
| 133 |
+
rewrite Hq, HK. reflexivity.
|
| 134 |
+
* rewrite Hb, (opok_tapes t1 t2 a0 w0 HR HA HK), (opok_tapes t1 t2 a1 w1 HR HA HK), HA, HK, Hi.
|
| 135 |
+
reflexivity.
|
| 136 |
+
* rewrite !length_clearq, !length_wnext. exact Hl.
|
| 137 |
+
* rewrite (firstn_S_nth rs _ _ Er), map_app. apply wagree_step; auto.
|
| 138 |
+
+ assert (Er2 : nth_error rs (ai t2) = None) by (rewrite <- Hi; exact Er).
|
| 139 |
+
unfold astep. rewrite Er, Er2.
|
| 140 |
+
apply IH; cbn [ai aR aA aK bad aw]; auto.
|
| 141 |
+
Qed.
|
rocq/Iter.v
ADDED
|
@@ -0,0 +1,72 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
(* Iterating the step: one step at a time, and in binary for evaluation. *)
|
| 2 |
+
From Stdlib Require Import List Bool Arith ZArith Lia.
|
| 3 |
+
Import ListNotations.
|
| 4 |
+
From TH Require Import TwoHead.
|
| 5 |
+
|
| 6 |
+
Fixpoint itern (n : nat) (s : st) : st :=
|
| 7 |
+
match n with O => s | S m => itern m (step s) end.
|
| 8 |
+
|
| 9 |
+
Lemma itern_add : forall a b s, itern (a + b) s = itern b (itern a s).
|
| 10 |
+
Proof. induction a as [|a IH]; intros b s; simpl; auto. Qed.
|
| 11 |
+
|
| 12 |
+
Lemma iterp_itern : forall p s, iterp p s = itern (Pos.to_nat p) s.
|
| 13 |
+
Proof.
|
| 14 |
+
induction p as [p IH|p IH|]; intro s; simpl iterp.
|
| 15 |
+
- rewrite Pos2Nat.inj_xI.
|
| 16 |
+
replace (S (2 * Pos.to_nat p)) with (Pos.to_nat p + Pos.to_nat p + 1) by lia.
|
| 17 |
+
rewrite !itern_add, !IH. reflexivity.
|
| 18 |
+
- rewrite Pos2Nat.inj_xO.
|
| 19 |
+
replace (2 * Pos.to_nat p) with (Pos.to_nat p + Pos.to_nat p) by lia.
|
| 20 |
+
rewrite itern_add, !IH. reflexivity.
|
| 21 |
+
- reflexivity.
|
| 22 |
+
Qed.
|
| 23 |
+
|
| 24 |
+
(* kfp p s: the state after p steps, provided kappa is false at each of the p states left *)
|
| 25 |
+
Fixpoint kfp (p : positive) (s : st) : option st :=
|
| 26 |
+
match p with
|
| 27 |
+
| xH => if wget (win s) KAPPA then None else Some (step s)
|
| 28 |
+
| xO q => match kfp q s with None => None | Some s1 => kfp q s1 end
|
| 29 |
+
| xI q =>
|
| 30 |
+
match kfp q s with
|
| 31 |
+
| None => None
|
| 32 |
+
| Some s1 =>
|
| 33 |
+
match kfp q s1 with
|
| 34 |
+
| None => None
|
| 35 |
+
| Some s2 => if wget (win s2) KAPPA then None else Some (step s2)
|
| 36 |
+
end
|
| 37 |
+
end
|
| 38 |
+
end.
|
| 39 |
+
|
| 40 |
+
Lemma kfp_sound : forall p s t, kfp p s = Some t ->
|
| 41 |
+
t = itern (Pos.to_nat p) s
|
| 42 |
+
/\ (forall n, n < Pos.to_nat p -> wget (win (itern n s)) KAPPA = false).
|
| 43 |
+
Proof.
|
| 44 |
+
induction p as [q IH|q IH|]; intros s t H; simpl in H.
|
| 45 |
+
- destruct (kfp q s) as [s1|] eqn:E1; [|discriminate].
|
| 46 |
+
destruct (kfp q s1) as [s2|] eqn:E2; [|discriminate].
|
| 47 |
+
destruct (wget (win s2) KAPPA) eqn:Ek; [discriminate|].
|
| 48 |
+
injection H as <-.
|
| 49 |
+
destruct (IH _ _ E1) as [H1 K1]; destruct (IH _ _ E2) as [H2 K2]; subst s1 s2.
|
| 50 |
+
rewrite Pos2Nat.inj_xI. split.
|
| 51 |
+
+ replace (S (2 * Pos.to_nat q)) with (Pos.to_nat q + Pos.to_nat q + 1) by lia.
|
| 52 |
+
rewrite !itern_add. reflexivity.
|
| 53 |
+
+ intros n Hn.
|
| 54 |
+
destruct (Nat.lt_ge_cases n (Pos.to_nat q)) as [Hlt|Hge]; [auto|].
|
| 55 |
+
destruct (Nat.lt_ge_cases n (Pos.to_nat q + Pos.to_nat q)) as [Hlt2|Hge2].
|
| 56 |
+
* replace n with (Pos.to_nat q + (n - Pos.to_nat q)) by lia.
|
| 57 |
+
rewrite itern_add. apply K2. lia.
|
| 58 |
+
* replace n with (Pos.to_nat q + Pos.to_nat q) by lia.
|
| 59 |
+
rewrite itern_add. exact Ek.
|
| 60 |
+
- destruct (kfp q s) as [s1|] eqn:E1; [|discriminate].
|
| 61 |
+
destruct (IH _ _ E1) as [H1 K1]; destruct (IH _ _ H) as [H2 K2]; subst s1 t.
|
| 62 |
+
rewrite Pos2Nat.inj_xO. split.
|
| 63 |
+
+ replace (2 * Pos.to_nat q) with (Pos.to_nat q + Pos.to_nat q) by lia.
|
| 64 |
+
rewrite itern_add. reflexivity.
|
| 65 |
+
+ intros n Hn.
|
| 66 |
+
destruct (Nat.lt_ge_cases n (Pos.to_nat q)) as [Hlt|Hge]; [auto|].
|
| 67 |
+
replace n with (Pos.to_nat q + (n - Pos.to_nat q)) by lia.
|
| 68 |
+
rewrite itern_add. apply K2. lia.
|
| 69 |
+
- destruct (wget (win s) KAPPA) eqn:Ek; [discriminate|].
|
| 70 |
+
injection H as <-. split; [reflexivity|].
|
| 71 |
+
intros n Hn. replace n with 0 by lia. exact Ek.
|
| 72 |
+
Qed.
|
rocq/Main.v
ADDED
|
@@ -0,0 +1,100 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
(* Universal construction by the organism, and its self-reproduction in every generation. *)
|
| 2 |
+
From Stdlib Require Import List Bool Arith ZArith Lia.
|
| 3 |
+
Import ListNotations.
|
| 4 |
+
From TH Require Import TwoHead Tapes Iter Abstract Spec Organism PassCheck PassLemma Decoder Run Complete.
|
| 5 |
+
|
| 6 |
+
(* Every image X of n >= 1 records is built from its description describe X. *)
|
| 7 |
+
Theorem builds_every_image : forall X n k A0 K0 s b3 b2 b1 b0,
|
| 8 |
+
1 <= n -> length X = 26 * n -> length A0 = length X -> length K0 = length (describe X) ->
|
| 9 |
+
matches k (mkD (mkC PC 3 b3 b2 b1 b0 false) k (describe X) A0 K0) s ->
|
| 10 |
+
matches k (mkD (mkC PC 3 true true true true false) (negb k) (describe X) X (describe X))
|
| 11 |
+
(itern ((30 * n + 4 + length (describe X)) * G) s).
|
| 12 |
+
Proof.
|
| 13 |
+
intros X n k A0 K0 s b3 b2 b1 b0 Hn HX HA HK Hm.
|
| 14 |
+
assert (HXn : X <> []) by (intro E; subst X; cbn [length] in HX; lia).
|
| 15 |
+
destruct (universal_construction (describe X) X k A0 K0 s b3 b2 b1 b0
|
| 16 |
+
(describe_complete X n HX) HXn HA HK Hm) as (nrec & Hr & Hm').
|
| 17 |
+
replace nrec with n in Hm' by lia. exact Hm'.
|
| 18 |
+
Qed.
|
| 19 |
+
|
| 20 |
+
(* ---- the organism's own description ----------------------------------------- *)
|
| 21 |
+
Lemma rho_enc : rho = enc organism.
|
| 22 |
+
Proof. reflexivity. Qed.
|
| 23 |
+
|
| 24 |
+
Lemma length_rho : length rho = 26 * 133.
|
| 25 |
+
Proof. rewrite rho_enc, enc_length. reflexivity. Qed.
|
| 26 |
+
|
| 27 |
+
Lemma length_desc : length desc = 2930.
|
| 28 |
+
Proof. vm_compute. reflexivity. Qed.
|
| 29 |
+
|
| 30 |
+
Lemma translate_desc : translate desc = Some rho.
|
| 31 |
+
Proof. exact (describe_complete rho 133 length_rho). Qed.
|
| 32 |
+
|
| 33 |
+
(* one generation: 30 passes per record, 4 on the end codon and one per bit of the
|
| 34 |
+
description, each pass G = 133 steps *)
|
| 35 |
+
Definition gen_steps : nat := (30 * 133 + 4 + 2930) * G.
|
| 36 |
+
|
| 37 |
+
Definition c_start : cfg := mkC PC 3 false false false false false.
|
| 38 |
+
Definition c_gen : cfg := mkC PC 3 true true true true false.
|
| 39 |
+
|
| 40 |
+
Lemma s0_matches : matches false
|
| 41 |
+
(mkD c_start false desc (repeat false (length rho)) (repeat false (length desc))) s0.
|
| 42 |
+
Proof.
|
| 43 |
+
unfold matches, s0, tape_of, contents. cbn [win q0 q1 d0 d1 dc dk dR dA dK fr bk rev].
|
| 44 |
+
rewrite !app_nil_r.
|
| 45 |
+
refine (conj eq_refl (conj _ (conj eq_refl (conj eq_refl (conj eq_refl rho_enc))))).
|
| 46 |
+
intros i H. do 21 (destruct i as [|i]; [reflexivity|]).
|
| 47 |
+
exfalso. unfold relevant in H. cbn in H. discriminate.
|
| 48 |
+
Qed.
|
| 49 |
+
|
| 50 |
+
(* after a generation the bank just built holds the organism too, so the roles turn over *)
|
| 51 |
+
Lemma turn_over : forall k s,
|
| 52 |
+
matches k (mkD c_gen (negb k) desc rho desc) s ->
|
| 53 |
+
matches (negb k) (mkD c_gen (negb k) desc rho desc) s.
|
| 54 |
+
Proof.
|
| 55 |
+
intros k s (Hl & Hw & HR & HA & HK & HQ). unfold matches. cbn [dc dk dR dA dK] in *.
|
| 56 |
+
rewrite <- rho_enc in HQ |- *. destruct k; cbn [negb] in *; tauto.
|
| 57 |
+
Qed.
|
| 58 |
+
|
| 59 |
+
Lemma generation_step : forall k s,
|
| 60 |
+
matches k (mkD c_gen k desc rho desc) s ->
|
| 61 |
+
matches (negb k) (mkD c_gen (negb k) desc rho desc) (itern gen_steps s).
|
| 62 |
+
Proof.
|
| 63 |
+
intros k s Hm.
|
| 64 |
+
destruct (universal_construction desc rho k rho desc s true true true true translate_desc
|
| 65 |
+
ltac:(rewrite rho_enc; discriminate) eq_refl eq_refl Hm) as (nrec & Hr & Hm').
|
| 66 |
+
rewrite length_rho in Hr. rewrite length_desc in Hm'.
|
| 67 |
+
replace (30 * nrec + 4 + 2930) with (30 * 133 + 4 + 2930) in Hm' by lia.
|
| 68 |
+
apply turn_over. exact Hm'.
|
| 69 |
+
Qed.
|
| 70 |
+
|
| 71 |
+
(* After g + 1 generations the bank bit is even g, both
|
| 72 |
+
banks hold the organism and both tapes its description, and the window is at a codon start. *)
|
| 73 |
+
Theorem reproduces_forever : forall g,
|
| 74 |
+
matches (Nat.even g) (mkD c_gen (Nat.even g) desc rho desc) (itern (S g * gen_steps) s0).
|
| 75 |
+
Proof.
|
| 76 |
+
induction g as [|g IH].
|
| 77 |
+
- destruct (universal_construction desc rho false (repeat false (length rho))
|
| 78 |
+
(repeat false (length desc)) s0 false false false false translate_desc
|
| 79 |
+
ltac:(rewrite rho_enc; discriminate) (repeat_length _ _) (repeat_length _ _)
|
| 80 |
+
s0_matches) as (nrec & Hr & Hm).
|
| 81 |
+
rewrite length_rho in Hr. rewrite length_desc in Hm.
|
| 82 |
+
replace (30 * nrec + 4 + 2930) with (30 * 133 + 4 + 2930) in Hm by lia.
|
| 83 |
+
rewrite Nat.mul_1_l. exact (turn_over false _ Hm).
|
| 84 |
+
- rewrite Nat.even_succ, <- Nat.negb_even.
|
| 85 |
+
replace (S (S g) * gen_steps) with (S g * gen_steps + gen_steps) by lia.
|
| 86 |
+
rewrite itern_add. apply generation_step. exact IH.
|
| 87 |
+
Qed.
|
| 88 |
+
|
| 89 |
+
Corollary every_generation : forall g,
|
| 90 |
+
wget (win (itern (S g * gen_steps) s0)) KAPPA = Nat.even g
|
| 91 |
+
/\ contents (q0 (itern (S g * gen_steps) s0)) = rho
|
| 92 |
+
/\ contents (q1 (itern (S g * gen_steps) s0)) = rho
|
| 93 |
+
/\ contents (d0 (itern (S g * gen_steps) s0)) = desc
|
| 94 |
+
/\ contents (d1 (itern (S g * gen_steps) s0)) = desc.
|
| 95 |
+
Proof.
|
| 96 |
+
intro g. destruct (reproduces_forever g) as (Hl & Hw & HR & HA & HK & HQ).
|
| 97 |
+
cbn [dc dk dR dA dK] in *. rewrite <- rho_enc in HQ.
|
| 98 |
+
split; [change KAPPA with 0; rewrite (Hw 0 eq_refl); reflexivity|].
|
| 99 |
+
destruct (Nat.even g); tauto.
|
| 100 |
+
Qed.
|
rocq/Net.v
ADDED
|
@@ -0,0 +1,281 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
(* Netlists of ternary threshold units, flat and in blocks, and the valuations they compute. *)
|
| 2 |
+
From Stdlib Require Import List Bool Arith ZArith Lia.
|
| 3 |
+
Import ListNotations.
|
| 4 |
+
From TH Require Import TwoHead.
|
| 5 |
+
|
| 6 |
+
(* ---- flat netlists ------------------------------------------------------------- *)
|
| 7 |
+
(* a unit: its bias and its predecessors, each a signal index with a weight *)
|
| 8 |
+
Record tu := TU { tb : Z; tin : list (nat * Z) }.
|
| 9 |
+
|
| 10 |
+
Fixpoint wsum (ins : list (nat * Z)) (E : nat -> bool) : Z :=
|
| 11 |
+
match ins with [] => 0%Z | (i, w) :: t => (w * b2z (E i) + wsum t E)%Z end.
|
| 12 |
+
|
| 13 |
+
Definition fire (u : tu) (E : nat -> bool) : bool := Z.leb 0 (tb u + wsum (tin u) E).
|
| 14 |
+
|
| 15 |
+
Definition setv (E : nat -> bool) (m : nat) (b : bool) : nat -> bool :=
|
| 16 |
+
fun i => if Nat.eqb i m then b else E i.
|
| 17 |
+
|
| 18 |
+
(* the units evaluated in order, the first at signal m *)
|
| 19 |
+
Fixpoint run (us : list tu) (m : nat) (E : nat -> bool) : nat -> bool :=
|
| 20 |
+
match us with [] => E | u :: t => run t (S m) (setv E m (fire u E)) end.
|
| 21 |
+
|
| 22 |
+
(* one step of a clocked netlist on n state bits: next value i is signal nx_i *)
|
| 23 |
+
Definition netstep (n : nat) (us : list tu) (nx : list nat) (x : list bool) : list bool :=
|
| 24 |
+
let F := run us n (fun i => nth i x false) in map F nx.
|
| 25 |
+
|
| 26 |
+
Lemma run_prefix : forall us m E i, i < m -> run us m E i = E i.
|
| 27 |
+
Proof.
|
| 28 |
+
induction us as [|u t IH]; intros m E i H; cbn [run]; [reflexivity|].
|
| 29 |
+
rewrite IH by lia. unfold setv. destruct (Nat.eqb_spec i m); [lia|reflexivity].
|
| 30 |
+
Qed.
|
| 31 |
+
|
| 32 |
+
Lemma wsum_ext : forall ins E E', (forall i w, In (i, w) ins -> E i = E' i) -> wsum ins E = wsum ins E'.
|
| 33 |
+
Proof.
|
| 34 |
+
induction ins as [|[i w] t IH]; intros E E' H; cbn [wsum]; [reflexivity|].
|
| 35 |
+
rewrite (H i w (or_introl eq_refl)), (IH E E'); [reflexivity|].
|
| 36 |
+
intros i' w' Hin. apply (H i' w'). right. exact Hin.
|
| 37 |
+
Qed.
|
| 38 |
+
|
| 39 |
+
Lemma fire_ext : forall u E E', (forall i w, In (i, w) (tin u) -> E i = E' i) -> fire u E = fire u E'.
|
| 40 |
+
Proof. intros u E E' H. unfold fire. rewrite (wsum_ext _ E E' H). reflexivity. Qed.
|
| 41 |
+
|
| 42 |
+
Definition reads_below (u : tu) (m : nat) : Prop := forall i w, In (i, w) (tin u) -> i < m.
|
| 43 |
+
|
| 44 |
+
Definition tu0 : tu := TU 0 [].
|
| 45 |
+
|
| 46 |
+
Lemma run_at : forall us m E j, j < length us ->
|
| 47 |
+
(forall k, k < length us -> reads_below (nth k us tu0) (m + k)) ->
|
| 48 |
+
run us m E (m + j) = fire (nth j us tu0) (run us m E).
|
| 49 |
+
Proof.
|
| 50 |
+
induction us as [|u t IH]; intros m E j Hj Hwf; cbn [length] in Hj, Hwf; [lia|].
|
| 51 |
+
destruct j as [|j].
|
| 52 |
+
- cbn [nth run]. rewrite Nat.add_0_r, run_prefix by lia. unfold setv at 1. rewrite Nat.eqb_refl.
|
| 53 |
+
apply fire_ext. intros i w Hin. rewrite run_prefix by (specialize (Hwf 0 ltac:(lia) i w Hin); lia).
|
| 54 |
+
unfold setv. destruct (Nat.eqb_spec i m); [specialize (Hwf 0 ltac:(lia) i w Hin); lia|reflexivity].
|
| 55 |
+
- cbn [nth run]. replace (m + S j) with (S m + j) by lia. apply IH; [lia|].
|
| 56 |
+
intros k Hk i w Hin. specialize (Hwf (S k) ltac:(lia) i w Hin). lia.
|
| 57 |
+
Qed.
|
| 58 |
+
|
| 59 |
+
(* ---- netlists in blocks ---------------------------------------------------------- *)
|
| 60 |
+
(* a signal is a state bit, or unit r of member j of block b *)
|
| 61 |
+
Inductive sref := SIn (i : nat) | SRef (b j r : nat).
|
| 62 |
+
Record su := SU { sb : Z; sin : list (sref * Z) }.
|
| 63 |
+
(* a block: count members of size units each; shape j lists the units of member j *)
|
| 64 |
+
Record block := Blk { bcount : nat; bsize : nat; bshape : nat -> list su }.
|
| 65 |
+
|
| 66 |
+
Definition blk0 : block := Blk 0 0 (fun _ => []).
|
| 67 |
+
Definition su0 : su := SU 0 [].
|
| 68 |
+
|
| 69 |
+
Fixpoint boff (bs : list block) (b : nat) : nat :=
|
| 70 |
+
match bs, b with
|
| 71 |
+
| _, O => 0
|
| 72 |
+
| [], S _ => 0
|
| 73 |
+
| blk :: t, S b' => bcount blk * bsize blk + boff t b'
|
| 74 |
+
end.
|
| 75 |
+
|
| 76 |
+
Definition idx (n : nat) (bs : list block) (x : sref) : nat :=
|
| 77 |
+
match x with
|
| 78 |
+
| SIn i => i
|
| 79 |
+
| SRef b j r => n + boff bs b + bsize (nth b bs blk0) * j + r
|
| 80 |
+
end.
|
| 81 |
+
|
| 82 |
+
Definition flat_unit (n : nat) (bs : list block) (u : su) : tu :=
|
| 83 |
+
TU (sb u) (map (fun p => (idx n bs (fst p), snd p)) (sin u)).
|
| 84 |
+
|
| 85 |
+
Definition flat_block (n : nat) (bs : list block) (blk : block) : list tu :=
|
| 86 |
+
concat (map (fun j => map (flat_unit n bs) (bshape blk j)) (seq 0 (bcount blk))).
|
| 87 |
+
|
| 88 |
+
Definition compile (n : nat) (bs : list block) : list tu := concat (map (flat_block n bs) bs).
|
| 89 |
+
|
| 90 |
+
Definition shaped (blk : block) : Prop := forall j, j < bcount blk -> length (bshape blk j) = bsize blk.
|
| 91 |
+
|
| 92 |
+
Definition sunit (bs : list block) (b j r : nat) : su := nth r (bshape (nth b bs blk0) j) su0.
|
| 93 |
+
|
| 94 |
+
Definition valid (bs : list block) (n : nat) (x : sref) : Prop :=
|
| 95 |
+
match x with
|
| 96 |
+
| SIn i => i < n
|
| 97 |
+
| SRef b j r => b < length bs /\ j < bcount (nth b bs blk0) /\ r < bsize (nth b bs blk0)
|
| 98 |
+
end.
|
| 99 |
+
|
| 100 |
+
(* each unit reads state bits, units of earlier blocks, or earlier units of its own member *)
|
| 101 |
+
Definition reads_back (bs : list block) (n b j r : nat) (x : sref) : Prop :=
|
| 102 |
+
match x with
|
| 103 |
+
| SIn i => i < n
|
| 104 |
+
| SRef b' j' r' => (b' < b /\ j' < bcount (nth b' bs blk0) /\ r' < bsize (nth b' bs blk0))
|
| 105 |
+
\/ (b' = b /\ j' = j /\ r' < r)
|
| 106 |
+
end.
|
| 107 |
+
|
| 108 |
+
Definition wf (bs : list block) (n : nat) : Prop :=
|
| 109 |
+
Forall shaped bs
|
| 110 |
+
/\ forall b j r x w, b < length bs -> j < bcount (nth b bs blk0) -> r < bsize (nth b bs blk0) ->
|
| 111 |
+
In (x, w) (sin (sunit bs b j r)) -> reads_back bs n b j r x.
|
| 112 |
+
|
| 113 |
+
Lemma length_concat_const : forall (A : Type) (ls : list (list A)) sz,
|
| 114 |
+
Forall (fun l => length l = sz) ls -> length (concat ls) = length ls * sz.
|
| 115 |
+
Proof.
|
| 116 |
+
intros A ls sz H. induction H as [|l ls Hl H IH]; [reflexivity|].
|
| 117 |
+
cbn [concat length]. rewrite length_app, IH, Hl. lia.
|
| 118 |
+
Qed.
|
| 119 |
+
|
| 120 |
+
Lemma length_flat_block : forall n bs blk, shaped blk ->
|
| 121 |
+
length (flat_block n bs blk) = bcount blk * bsize blk.
|
| 122 |
+
Proof.
|
| 123 |
+
intros n bs blk Hs. unfold flat_block.
|
| 124 |
+
rewrite length_concat_const with (sz := bsize blk).
|
| 125 |
+
- rewrite length_map, length_seq. reflexivity.
|
| 126 |
+
- apply Forall_forall. intros l Hl. apply in_map_iff in Hl as (j & <- & Hj).
|
| 127 |
+
apply in_seq in Hj. rewrite length_map. apply Hs. lia.
|
| 128 |
+
Qed.
|
| 129 |
+
|
| 130 |
+
Lemma nth_concat_const : forall (A : Type) (d : A) (ls : list (list A)) sz j r,
|
| 131 |
+
Forall (fun l => length l = sz) ls -> j < length ls -> r < sz ->
|
| 132 |
+
nth (sz * j + r) (concat ls) d = nth r (nth j ls []) d.
|
| 133 |
+
Proof.
|
| 134 |
+
intros A d ls sz j r Hall. revert j. induction Hall as [|l ls Hl Hall IH]; intros j Hj Hr;
|
| 135 |
+
cbn [length] in Hj; [lia|].
|
| 136 |
+
cbn [concat]. destruct j as [|j].
|
| 137 |
+
- rewrite Nat.mul_0_r, Nat.add_0_l, app_nth1 by lia. reflexivity.
|
| 138 |
+
- rewrite app_nth2 by nia. rewrite Hl. replace (sz * S j + r - sz) with (sz * j + r) by nia.
|
| 139 |
+
apply IH; [lia | exact Hr].
|
| 140 |
+
Qed.
|
| 141 |
+
|
| 142 |
+
Lemma nth_map_seq : forall (A : Type) (f : nat -> A) c j d, j < c -> nth j (map f (seq 0 c)) d = f j.
|
| 143 |
+
Proof.
|
| 144 |
+
intros A f c j d Hj. rewrite (nth_indep _ d (f 0)) by (rewrite length_map, length_seq; exact Hj).
|
| 145 |
+
rewrite map_nth, seq_nth by exact Hj. reflexivity.
|
| 146 |
+
Qed.
|
| 147 |
+
|
| 148 |
+
Lemma nth_map_d : forall (A B : Type) (g : A -> B) l r d d', r < length l -> nth r (map g l) d = g (nth r l d').
|
| 149 |
+
Proof.
|
| 150 |
+
intros A B g l r d d' Hr. rewrite (nth_indep _ d (g d')) by (rewrite length_map; exact Hr).
|
| 151 |
+
apply map_nth.
|
| 152 |
+
Qed.
|
| 153 |
+
|
| 154 |
+
Lemma flat_block_nth : forall n bs blk j r, shaped blk -> j < bcount blk -> r < bsize blk ->
|
| 155 |
+
nth (bsize blk * j + r) (flat_block n bs blk) tu0 = flat_unit n bs (nth r (bshape blk j) su0).
|
| 156 |
+
Proof.
|
| 157 |
+
intros n bs blk j r Hs Hj Hr. unfold flat_block.
|
| 158 |
+
rewrite nth_concat_const with (sz := bsize blk); [| | rewrite length_map, length_seq; exact Hj | exact Hr].
|
| 159 |
+
- rewrite (nth_map_seq _ (fun j => map (flat_unit n bs) (bshape blk j)) (bcount blk) j [] Hj).
|
| 160 |
+
apply nth_map_d. rewrite Hs by exact Hj. exact Hr.
|
| 161 |
+
- apply Forall_forall. intros l Hl. apply in_map_iff in Hl as (j' & <- & Hj').
|
| 162 |
+
apply in_seq in Hj'. rewrite length_map. apply Hs. lia.
|
| 163 |
+
Qed.
|
| 164 |
+
|
| 165 |
+
Lemma compile_nth : forall n bs b j r, Forall shaped bs -> b < length bs ->
|
| 166 |
+
j < bcount (nth b bs blk0) -> r < bsize (nth b bs blk0) ->
|
| 167 |
+
nth (boff bs b + bsize (nth b bs blk0) * j + r) (compile n bs) tu0
|
| 168 |
+
= flat_unit n bs (sunit bs b j r).
|
| 169 |
+
Proof.
|
| 170 |
+
intros n bs. unfold compile, sunit.
|
| 171 |
+
assert (G : forall pre, Forall shaped pre ->
|
| 172 |
+
forall b j r, b < length pre -> j < bcount (nth b pre blk0) -> r < bsize (nth b pre blk0) ->
|
| 173 |
+
nth (boff pre b + bsize (nth b pre blk0) * j + r) (concat (map (flat_block n bs) pre)) tu0
|
| 174 |
+
= flat_unit n bs (nth r (bshape (nth b pre blk0) j) su0)).
|
| 175 |
+
{ induction pre as [|blk t IH]; intros Hsh b j r Hb Hj Hr; cbn [length] in Hb; [lia|].
|
| 176 |
+
inversion Hsh as [|? ? Hs1 Hst]; subst.
|
| 177 |
+
cbn [map concat]. destruct b as [|b].
|
| 178 |
+
- cbn [boff nth] in *. rewrite Nat.add_0_l, app_nth1.
|
| 179 |
+
+ apply flat_block_nth; assumption.
|
| 180 |
+
+ rewrite length_flat_block by exact Hs1. nia.
|
| 181 |
+
- cbn [boff nth] in *. rewrite app_nth2 by (rewrite length_flat_block by exact Hs1; lia).
|
| 182 |
+
rewrite length_flat_block by exact Hs1.
|
| 183 |
+
replace (bcount blk * bsize blk + boff t b + bsize (nth b t blk0) * j + r - bcount blk * bsize blk)
|
| 184 |
+
with (boff t b + bsize (nth b t blk0) * j + r) by lia.
|
| 185 |
+
apply IH; [exact Hst | lia | exact Hj | exact Hr]. }
|
| 186 |
+
intros b j r Hsh Hb Hj Hr. apply G; assumption.
|
| 187 |
+
Qed.
|
| 188 |
+
|
| 189 |
+
Lemma length_compile_gen : forall n bs0 bs, Forall shaped bs ->
|
| 190 |
+
length (concat (map (flat_block n bs0) bs)) = boff bs (length bs).
|
| 191 |
+
Proof.
|
| 192 |
+
intros n bs0 bs H. induction H as [|blk t Hs Ht IH]; [reflexivity|].
|
| 193 |
+
cbn [map concat length boff]. rewrite length_app, length_flat_block by exact Hs. rewrite IH. reflexivity.
|
| 194 |
+
Qed.
|
| 195 |
+
|
| 196 |
+
Lemma length_compile : forall n bs, Forall shaped bs -> length (compile n bs) = boff bs (length bs).
|
| 197 |
+
Proof. intros n bs H. apply length_compile_gen. exact H. Qed.
|
| 198 |
+
|
| 199 |
+
Lemma boff_mono : forall bs b b', b' < b -> b <= length bs ->
|
| 200 |
+
boff bs b' + bcount (nth b' bs blk0) * bsize (nth b' bs blk0) <= boff bs b.
|
| 201 |
+
Proof.
|
| 202 |
+
induction bs as [|blk t IH]; intros b b' Hb Hl; cbn [length] in Hl; [lia|].
|
| 203 |
+
destruct b as [|b]; [lia|]. destruct b' as [|b'].
|
| 204 |
+
- cbn [boff nth]. lia.
|
| 205 |
+
- cbn [boff nth]. specialize (IH b b' ltac:(lia) ltac:(lia)). lia.
|
| 206 |
+
Qed.
|
| 207 |
+
|
| 208 |
+
Lemma idx_lt : forall bs n b j r, b < length bs -> j < bcount (nth b bs blk0) -> r < bsize (nth b bs blk0) ->
|
| 209 |
+
idx n bs (SRef b j r) < n + boff bs (S b).
|
| 210 |
+
Proof.
|
| 211 |
+
intros bs n b j r Hb Hj Hr. cbn [idx].
|
| 212 |
+
pose proof (boff_mono bs (S b) b ltac:(lia) ltac:(lia)). nia.
|
| 213 |
+
Qed.
|
| 214 |
+
|
| 215 |
+
Lemma idx_lt_total : forall bs n x, valid bs n x -> idx n bs x < n + boff bs (length bs).
|
| 216 |
+
Proof.
|
| 217 |
+
intros bs n [i|b j r] Hv; cbn [valid] in Hv; [cbn [idx]; lia|].
|
| 218 |
+
destruct Hv as (Hb & Hj & Hr). pose proof (idx_lt bs n b j r Hb Hj Hr).
|
| 219 |
+
destruct (Nat.eq_dec (S b) (length bs)) as [E|E]; [rewrite <- E; exact H|].
|
| 220 |
+
pose proof (boff_mono bs (length bs) (S b) ltac:(lia) ltac:(lia)). lia.
|
| 221 |
+
Qed.
|
| 222 |
+
|
| 223 |
+
(* the structured unit fired on a valuation of its signals *)
|
| 224 |
+
Fixpoint swsum (ins : list (sref * Z)) (V : sref -> bool) : Z :=
|
| 225 |
+
match ins with [] => 0%Z | (x, w) :: t => (w * b2z (V x) + swsum t V)%Z end.
|
| 226 |
+
|
| 227 |
+
Definition sfire' (u : su) (V : sref -> bool) : bool := Z.leb 0 (sb u + swsum (sin u) V).
|
| 228 |
+
|
| 229 |
+
Lemma wsum_flat : forall n bs ins E,
|
| 230 |
+
wsum (map (fun p => (idx n bs (fst p), snd p)) ins) E = swsum ins (fun x => E (idx n bs x)).
|
| 231 |
+
Proof. intros n bs ins E. induction ins as [|[x w] t IH]; cbn [map wsum swsum fst snd]; [reflexivity|]. rewrite IH. reflexivity. Qed.
|
| 232 |
+
|
| 233 |
+
Lemma swsum_ext : forall ins V V', (forall x w, In (x, w) ins -> V x = V' x) -> swsum ins V = swsum ins V'.
|
| 234 |
+
Proof.
|
| 235 |
+
induction ins as [|[x w] t IH]; intros V V' H; cbn [swsum]; [reflexivity|].
|
| 236 |
+
rewrite (H x w (or_introl eq_refl)), (IH V V'); [reflexivity|].
|
| 237 |
+
intros x' w' Hin. apply (H x' w'). right. exact Hin.
|
| 238 |
+
Qed.
|
| 239 |
+
|
| 240 |
+
Lemma wf_reads_below : forall bs n, wf bs n ->
|
| 241 |
+
forall k, k < length (compile n bs) -> reads_below (nth k (compile n bs) tu0) (n + k).
|
| 242 |
+
Proof.
|
| 243 |
+
intros bs n [Hsh Hrd] k Hk. rewrite length_compile in Hk by exact Hsh.
|
| 244 |
+
assert (Hloc : exists b j r, b < length bs /\ j < bcount (nth b bs blk0) /\ r < bsize (nth b bs blk0)
|
| 245 |
+
/\ k = boff bs b + bsize (nth b bs blk0) * j + r).
|
| 246 |
+
{ clear -Hk Hsh. revert k Hk. induction Hsh as [|blk t Hs Ht IH]; intros k Hk; cbn [boff length] in Hk; [lia|].
|
| 247 |
+
destruct (Nat.lt_ge_cases k (bcount blk * bsize blk)) as [Hl|Hg].
|
| 248 |
+
- exists 0, (k / bsize blk), (k mod bsize blk).
|
| 249 |
+
assert (bsize blk <> 0) by (intro E; rewrite E in Hl; lia).
|
| 250 |
+
cbn [nth length boff]. split; [lia|]. split; [apply Nat.Div0.div_lt_upper_bound; nia|].
|
| 251 |
+
split; [apply Nat.mod_upper_bound; exact H|]. rewrite (Nat.div_mod k (bsize blk)) at 1 by exact H. lia.
|
| 252 |
+
- destruct (IH (k - bcount blk * bsize blk) ltac:(lia)) as (b & j & r & Hb & Hj & Hr & Hk').
|
| 253 |
+
exists (S b), j, r. cbn [nth length boff]. split; [lia|]. split; [exact Hj|]. split; [exact Hr|]. lia. }
|
| 254 |
+
destruct Hloc as (b & j & r & Hb & Hj & Hr & ->).
|
| 255 |
+
rewrite compile_nth by assumption.
|
| 256 |
+
intros i w Hin. unfold flat_unit in Hin. cbn [tin] in Hin.
|
| 257 |
+
apply in_map_iff in Hin as ([x w'] & Heq & Hin). cbn [fst snd] in Heq. injection Heq as <- <-.
|
| 258 |
+
specialize (Hrd b j r x w' Hb Hj Hr Hin).
|
| 259 |
+
destruct x as [i|b' j' r']; cbn [reads_back idx] in *; [lia|].
|
| 260 |
+
destruct Hrd as [(Hb' & Hj' & Hr')|(-> & -> & Hr')]; [|lia].
|
| 261 |
+
pose proof (boff_mono bs b b' Hb' ltac:(lia)). nia.
|
| 262 |
+
Qed.
|
| 263 |
+
|
| 264 |
+
(* the value of a state bit, and of a unit from the values of its predecessors *)
|
| 265 |
+
Lemma net_in : forall bs n X i, i < n -> run (compile n bs) n X (idx n bs (SIn i)) = X i.
|
| 266 |
+
Proof. intros bs n X i H. cbn [idx]. apply run_prefix. exact H. Qed.
|
| 267 |
+
|
| 268 |
+
Lemma net_unit : forall bs n X b j r, wf bs n ->
|
| 269 |
+
b < length bs -> j < bcount (nth b bs blk0) -> r < bsize (nth b bs blk0) ->
|
| 270 |
+
run (compile n bs) n X (idx n bs (SRef b j r))
|
| 271 |
+
= sfire' (sunit bs b j r) (fun x => run (compile n bs) n X (idx n bs x)).
|
| 272 |
+
Proof.
|
| 273 |
+
intros bs n X b j r Hwf Hb Hj Hr. cbn [idx].
|
| 274 |
+
replace (n + boff bs b + bsize (nth b bs blk0) * j + r) with (n + (boff bs b + bsize (nth b bs blk0) * j + r)) by lia.
|
| 275 |
+
rewrite run_at.
|
| 276 |
+
- rewrite compile_nth by (destruct Hwf; assumption). unfold fire, flat_unit, sfire'. cbn [tb tin].
|
| 277 |
+
rewrite wsum_flat. reflexivity.
|
| 278 |
+
- rewrite length_compile by (destruct Hwf; assumption).
|
| 279 |
+
pose proof (idx_lt_total bs n (SRef b j r) (conj Hb (conj Hj Hr))) as H. cbn [idx] in H. lia.
|
| 280 |
+
- apply wf_reads_below. exact Hwf.
|
| 281 |
+
Qed.
|
rocq/NetMain.v
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
(* The threshold network itself: its orbit is the machine's, and the organism it carries
|
| 2 |
+
reproduces in every generation. *)
|
| 3 |
+
From Stdlib Require Import List Bool Arith ZArith Lia.
|
| 4 |
+
Import ListNotations.
|
| 5 |
+
From TH Require Import TwoHead Tapes Iter Abstract Organism Net Phys PhysSem PhysMain Main.
|
| 6 |
+
|
| 7 |
+
(* the network iterated on its state bits *)
|
| 8 |
+
Fixpoint netiter (N L n : nat) (x : list bool) : list bool :=
|
| 9 |
+
match n with O => x | S m => netiter N L m (netstep (nst N L) (phys_units N L) (phys_next N L) x) end.
|
| 10 |
+
|
| 11 |
+
Definition shaped_st (N L : nat) (s : st) : Prop :=
|
| 12 |
+
length (win s) = 64 /\ length (contents (q0 s)) = N /\ length (contents (q1 s)) = N
|
| 13 |
+
/\ length (contents (d0 s)) = L /\ length (contents (d1 s)) = L.
|
| 14 |
+
|
| 15 |
+
Lemma step_shaped : forall N L s, 26 <= N -> 1 <= L -> shaped_st N L s -> shaped_st N L (step s).
|
| 16 |
+
Proof.
|
| 17 |
+
intros N L s HN HL (Hw & H0 & H1 & H2 & H3).
|
| 18 |
+
destruct (step_eq N L s HN HL H0 H1 H2 H3 Hw) as (qa' & Hqa & Hst).
|
| 19 |
+
pose proof (tapes_step N L s HN HL H0 H1 H2 H3 Hw qa' Hqa) as T. cbv zeta in T.
|
| 20 |
+
rewrite <- Hst in T. destruct T as (T0 & T1 & T2 & T3).
|
| 21 |
+
refine (conj _ (conj _ (conj _ (conj _ _)))).
|
| 22 |
+
- rewrite Hst, win_stepres. unfold clearq. rewrite !upd_length, length_wnext. exact Hw.
|
| 23 |
+
- rewrite T0. destruct (kk s), (advA s); rewrite ?rot1_length, ?length_wrote, ?rotn_length; assumption.
|
| 24 |
+
- rewrite T1. destruct (kk s), (advA s); rewrite ?rot1_length, ?length_wrote, ?rotn_length; assumption.
|
| 25 |
+
- rewrite T2. destruct (kk s), (advC s), (advR s); rewrite ?rot1_length, ?length_wrotec; assumption.
|
| 26 |
+
- rewrite T3. destruct (kk s), (advC s), (advR s); rewrite ?rot1_length, ?length_wrotec; assumption.
|
| 27 |
+
Qed.
|
| 28 |
+
|
| 29 |
+
(* every orbit of the network on encoded states is the encoding of the machine's orbit *)
|
| 30 |
+
Theorem network_orbit : forall N L n s, 26 <= N -> 1 <= L -> shaped_st N L s ->
|
| 31 |
+
netiter N L n (encode s) = encode (itern n s).
|
| 32 |
+
Proof.
|
| 33 |
+
intros N L n. induction n as [|n IH]; intros s HN HL Hs; [reflexivity|].
|
| 34 |
+
cbn [netiter itern]. pose proof Hs as (Hw & H0 & H1 & H2 & H3).
|
| 35 |
+
rewrite (netlist_step N L s HN HL Hw H0 H1 H2 H3).
|
| 36 |
+
apply IH; [exact HN | exact HL |]. apply step_shaped; [exact HN | exact HL | exact Hs].
|
| 37 |
+
Qed.
|
| 38 |
+
|
| 39 |
+
Lemma s0_shaped : shaped_st (26 * 133) 2930 s0.
|
| 40 |
+
Proof.
|
| 41 |
+
unfold shaped_st, s0, tape_of, contents. cbn [win q0 q1 d0 d1 fr bk rev]. rewrite !app_nil_r.
|
| 42 |
+
rewrite !repeat_length, length_rho, length_desc. repeat split; reflexivity.
|
| 43 |
+
Qed.
|
| 44 |
+
|
| 45 |
+
(* The network on 26 * 133 bank bits and 2930 description bits, started from the encoding of
|
| 46 |
+
s0, holds after g + 1 generations the encoding of a state in which the bank bit is even g,
|
| 47 |
+
both banks hold the organism and both description tapes its description. *)
|
| 48 |
+
Theorem network_reproduces : forall g,
|
| 49 |
+
exists t, netiter (26 * 133) 2930 (S g * gen_steps) (encode s0) = encode t
|
| 50 |
+
/\ wget (win t) KAPPA = Nat.even g
|
| 51 |
+
/\ contents (q0 t) = rho /\ contents (q1 t) = rho
|
| 52 |
+
/\ contents (d0 t) = desc /\ contents (d1 t) = desc.
|
| 53 |
+
Proof.
|
| 54 |
+
intro g. exists (itern (S g * gen_steps) s0). split.
|
| 55 |
+
- apply network_orbit; [lia | lia | exact s0_shaped].
|
| 56 |
+
- exact (every_generation g).
|
| 57 |
+
Qed.
|
rocq/Organism.v
ADDED
|
@@ -0,0 +1,151 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
(* The organism: 133 records, generated by src/twohead.py. *)
|
| 2 |
+
From Stdlib Require Import List Bool Arith ZArith.
|
| 3 |
+
Import ListNotations.
|
| 4 |
+
From TH Require Import TwoHead.
|
| 5 |
+
|
| 6 |
+
Definition organism : list rec := [
|
| 7 |
+
Rec 16 (-1)%Z 17 (-1)%Z 0%Z 21;
|
| 8 |
+
Rec 21 1%Z 18 (-1)%Z (-1)%Z 21;
|
| 9 |
+
Rec 21 1%Z 19 (-1)%Z (-1)%Z 21;
|
| 10 |
+
Rec 21 1%Z 20 (-1)%Z (-1)%Z 21;
|
| 11 |
+
Rec 14 1%Z 13 1%Z (-2)%Z 22;
|
| 12 |
+
Rec 12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. *)
|
| 143 |
+
Definition init_win : list bool :=
|
| 144 |
+
map (fun i => Nat.eqb i 9 || Nat.eqb i 16 || Nat.eqb i 17) (seq 0 64).
|
| 145 |
+
|
| 146 |
+
Definition rho : list bool := concat (map enc_rec organism).
|
| 147 |
+
Definition desc : list bool := describe rho.
|
| 148 |
+
|
| 149 |
+
Definition s0 : st :=
|
| 150 |
+
mkS init_win (tape_of rho) (tape_of (repeat false (length rho)))
|
| 151 |
+
(tape_of desc) (tape_of (repeat false (length desc))).
|
rocq/PassCheck.v
ADDED
|
@@ -0,0 +1,62 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
(* One pass of the organism, checked against the spec in every configuration a run can visit. *)
|
| 2 |
+
From Stdlib Require Import List Bool Arith ZArith Lia.
|
| 3 |
+
Import ListNotations.
|
| 4 |
+
From TH Require Import TwoHead Tapes Iter Abstract Indep Spec Organism.
|
| 5 |
+
|
| 6 |
+
Definition G := length organism.
|
| 7 |
+
|
| 8 |
+
Definition rec_eqb (r s : rec) : bool :=
|
| 9 |
+
match r, s with
|
| 10 |
+
| Rec a b c d e f, Rec a' b' c' d' e' f' =>
|
| 11 |
+
Nat.eqb a a' && Z.eqb b b' && Nat.eqb c c' && Z.eqb d d' && Z.eqb e e' && Nat.eqb f f'
|
| 12 |
+
end.
|
| 13 |
+
|
| 14 |
+
Lemma rec_eqb_true : forall r s, rec_eqb r s = true -> r = s.
|
| 15 |
+
Proof.
|
| 16 |
+
intros [a b c d e f] [a' b' c' d' e' f'] H. cbn in H.
|
| 17 |
+
repeat match goal with H : _ && _ = true |- _ => apply andb_prop in H as [? ?] end.
|
| 18 |
+
repeat match goal with
|
| 19 |
+
| H : Nat.eqb _ _ = true |- _ => apply Nat.eqb_eq in H
|
| 20 |
+
| H : Z.eqb _ _ = true |- _ => apply Z.eqb_eq in H
|
| 21 |
+
end.
|
| 22 |
+
subst. reflexivity.
|
| 23 |
+
Qed.
|
| 24 |
+
|
| 25 |
+
Lemma decode_organism : Forall (fun r => decode (enc_rec r) = r) organism.
|
| 26 |
+
Proof.
|
| 27 |
+
apply Forall_forall. intros r Hr.
|
| 28 |
+
assert (H : forallb (fun r => rec_eqb (decode (enc_rec r)) r) organism = true)
|
| 29 |
+
by (vm_compute; reflexivity).
|
| 30 |
+
rewrite forallb_forall in H. apply rec_eqb_true. apply H. exact Hr.
|
| 31 |
+
Qed.
|
| 32 |
+
|
| 33 |
+
Lemma wbr_organism : wbr_from organism istmp [] = true.
|
| 34 |
+
Proof. vm_compute. reflexivity. Qed.
|
| 35 |
+
|
| 36 |
+
(* what a pass must leave behind, judged on the abstract state t it reaches *)
|
| 37 |
+
Definition chk (o : out) (t : ast) (r x y : bool) : bool :=
|
| 38 |
+
negb (bad t)
|
| 39 |
+
&& forallb (fun i => Bool.eqb (wget (aw t) i) (wget (wcfg (ncf o) (nk o)) i))
|
| 40 |
+
(filter relevant (seq 0 64))
|
| 41 |
+
&& Nat.eqb (mv (aR t)) (if cons o then 1 else 0) && lbeq (pre (aR t)) [r]
|
| 42 |
+
&& Nat.eqb (mv (aA t)) (if emit o then 1 else 0) && lbeq (pre (aA t)) [if emit o then av o else x]
|
| 43 |
+
&& Nat.eqb (mv (aK t)) (if cw o then 1 else 0) && lbeq (pre (aK t)) [if cw o then r else y].
|
| 44 |
+
|
| 45 |
+
Definition all_cfgs : list cfg :=
|
| 46 |
+
flat_map (fun p =>
|
| 47 |
+
flat_map (fun zz =>
|
| 48 |
+
flat_map (fun b3 => flat_map (fun b2 => flat_map (fun b1 => flat_map (fun b0 =>
|
| 49 |
+
map (fun mm => mkC p zz b3 b2 b1 b0 mm) [false; true])
|
| 50 |
+
[false; true]) [false; true]) [false; true]) [false; true])
|
| 51 |
+
(seq 0 (match p with PC => 4 | PG => 8 | PA => 18 end)))
|
| 52 |
+
[PC; PG; PA].
|
| 53 |
+
|
| 54 |
+
Definition bools := [false; true].
|
| 55 |
+
|
| 56 |
+
(* the abstract pass from every configuration a run can visit, with one cell under each head *)
|
| 57 |
+
Lemma pass_check_ok :
|
| 58 |
+
forallb (fun cf => forallb (fun k => forallb (fun r => forallb (fun x => forallb (fun y =>
|
| 59 |
+
chk (dpass cf k r)
|
| 60 |
+
(aiter G organism (mkAS (wcfg cf k) (mkA [r] 0) (mkA [x] 0) (mkA [y] 0) 0 false)) r x y)
|
| 61 |
+
bools) bools) bools) bools) all_cfgs = true.
|
| 62 |
+
Proof. vm_compute. reflexivity. Qed.
|
rocq/PassLemma.v
ADDED
|
@@ -0,0 +1,161 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
(* One pass of the physics with the organism in the active bank does what the spec says. *)
|
| 2 |
+
From Stdlib Require Import List Bool Arith ZArith Lia.
|
| 3 |
+
Import ListNotations.
|
| 4 |
+
From TH Require Import TwoHead Tapes Iter Abstract Indep Spec Organism PassCheck.
|
| 5 |
+
|
| 6 |
+
Lemma aiter_ai : forall n rs t, ai t + n <= length rs -> ai (aiter n rs t) = ai t + n.
|
| 7 |
+
Proof.
|
| 8 |
+
induction n as [|n IH]; intros rs t H; cbn [aiter]; [lia|].
|
| 9 |
+
rewrite IH; rewrite ?astep_ai; lia.
|
| 10 |
+
Qed.
|
| 11 |
+
|
| 12 |
+
Lemma in_all_cfgs : forall cf, reachable cf = true -> In cf all_cfgs.
|
| 13 |
+
Proof.
|
| 14 |
+
intros [p zz b3 b2 b1 b0 mm] H. unfold all_cfgs.
|
| 15 |
+
apply in_flat_map. exists p. split; [destruct p; simpl; tauto|].
|
| 16 |
+
apply in_flat_map. exists zz. split.
|
| 17 |
+
- apply in_seq. unfold reachable in H. cbn [ph z] in H. destruct p; apply Nat.leb_le in H; lia.
|
| 18 |
+
- apply in_flat_map; exists b3; split; [destruct b3; simpl; tauto|].
|
| 19 |
+
apply in_flat_map; exists b2; split; [destruct b2; simpl; tauto|].
|
| 20 |
+
apply in_flat_map; exists b1; split; [destruct b1; simpl; tauto|].
|
| 21 |
+
apply in_flat_map; exists b0; split; [destruct b0; simpl; tauto|].
|
| 22 |
+
apply in_map. destruct mm; simpl; tauto.
|
| 23 |
+
Qed.
|
| 24 |
+
|
| 25 |
+
Lemma in_bools : forall b, In b bools.
|
| 26 |
+
Proof. intros [|]; simpl; tauto. Qed.
|
| 27 |
+
|
| 28 |
+
Lemma expect_from_check : forall cf k r x y, reachable cf = true ->
|
| 29 |
+
chk (dpass cf k r)
|
| 30 |
+
(aiter G organism (mkAS (wcfg cf k) (mkA [r] 0) (mkA [x] 0) (mkA [y] 0) 0 false)) r x y = true.
|
| 31 |
+
Proof.
|
| 32 |
+
intros cf k r x y H.
|
| 33 |
+
pose proof pass_check_ok as P.
|
| 34 |
+
rewrite forallb_forall in P. specialize (P cf (in_all_cfgs cf H)).
|
| 35 |
+
rewrite forallb_forall in P. specialize (P k (in_bools k)).
|
| 36 |
+
rewrite forallb_forall in P. specialize (P r (in_bools r)).
|
| 37 |
+
rewrite forallb_forall in P. specialize (P x (in_bools x)).
|
| 38 |
+
rewrite forallb_forall in P. specialize (P y (in_bools y)).
|
| 39 |
+
exact P.
|
| 40 |
+
Qed.
|
| 41 |
+
|
| 42 |
+
Lemma relevant_small : forall i, relevant i = true -> i < 21.
|
| 43 |
+
Proof.
|
| 44 |
+
intros i H. unfold relevant in H.
|
| 45 |
+
repeat (apply orb_true_iff in H as [H|H]);
|
| 46 |
+
try (apply andb_prop in H as [Ha Hb]; apply Nat.leb_le in Ha, Hb);
|
| 47 |
+
try apply Nat.eqb_eq in H; lia.
|
| 48 |
+
Qed.
|
| 49 |
+
|
| 50 |
+
Lemma relevant_not_tape : forall i, relevant i = true -> i <> RD /\ i <> ARM /\ i <> CPY.
|
| 51 |
+
Proof.
|
| 52 |
+
intros i H. unfold relevant in H. unfold RD, ARM, CPY.
|
| 53 |
+
repeat (apply orb_true_iff in H as [H|H]);
|
| 54 |
+
try (apply andb_prop in H as [Ha Hb]; apply Nat.leb_le in Ha, Hb);
|
| 55 |
+
try apply Nat.eqb_eq in H; lia.
|
| 56 |
+
Qed.
|
| 57 |
+
|
| 58 |
+
Lemma relevant_not_tmp : forall i, relevant i = true -> istmp i = false.
|
| 59 |
+
Proof. intros i H. unfold istmp. rewrite H. reflexivity. Qed.
|
| 60 |
+
|
| 61 |
+
Lemma relevant_of_not_tmp : forall i, istmp i = false -> i <> RD -> i <> ARM -> i <> CPY ->
|
| 62 |
+
relevant i = true.
|
| 63 |
+
Proof.
|
| 64 |
+
intros i H H1 H2 H3. unfold istmp in H. apply negb_false_iff in H.
|
| 65 |
+
apply orb_true_iff in H as [H|H]; [exact H|].
|
| 66 |
+
apply andb_prop in H as [Ha Hb]. apply Nat.leb_le in Ha, Hb.
|
| 67 |
+
unfold RD, ARM, CPY in *. lia.
|
| 68 |
+
Qed.
|
| 69 |
+
|
| 70 |
+
(* what the check says about the state a pass reaches *)
|
| 71 |
+
Lemma chk_spec : forall o t r x y, chk o t r x y = true ->
|
| 72 |
+
bad t = false
|
| 73 |
+
/\ (forall i, relevant i = true -> wget (aw t) i = wget (wcfg (ncf o) (nk o)) i)
|
| 74 |
+
/\ mv (aR t) = (if cons o then 1 else 0) /\ pre (aR t) = [r]
|
| 75 |
+
/\ mv (aA t) = (if emit o then 1 else 0) /\ pre (aA t) = [if emit o then av o else x]
|
| 76 |
+
/\ mv (aK t) = (if cw o then 1 else 0) /\ pre (aK t) = [if cw o then r else y].
|
| 77 |
+
Proof.
|
| 78 |
+
intros o t r x y E. unfold chk in E.
|
| 79 |
+
apply andb_prop in E as [E HpK]. apply andb_prop in E as [E HmK].
|
| 80 |
+
apply andb_prop in E as [E HpA]. apply andb_prop in E as [E HmA].
|
| 81 |
+
apply andb_prop in E as [E HpR]. apply andb_prop in E as [E HmR].
|
| 82 |
+
apply andb_prop in E as [Hnb Hcells].
|
| 83 |
+
apply negb_true_iff in Hnb. apply Nat.eqb_eq in HmR, HmA, HmK.
|
| 84 |
+
apply lbeq_true in HpR, HpA, HpK.
|
| 85 |
+
refine (conj Hnb (conj _ (conj HmR (conj HpR (conj HmA (conj HpA (conj HmK HpK))))))).
|
| 86 |
+
intros i Hi. rewrite forallb_forall in Hcells.
|
| 87 |
+
apply Bool.eqb_prop. apply Hcells. apply filter_In. split; [|exact Hi].
|
| 88 |
+
apply in_seq. pose proof (relevant_small i Hi). lia.
|
| 89 |
+
Qed.
|
| 90 |
+
|
| 91 |
+
Lemma length_wcfg : forall cf k, length (wcfg cf k) = 64.
|
| 92 |
+
Proof. intros. unfold wcfg. rewrite length_map, length_seq. reflexivity. Qed.
|
| 93 |
+
|
| 94 |
+
Lemma rotn_0 : forall l, rotn 0 l = l.
|
| 95 |
+
Proof. reflexivity. Qed.
|
| 96 |
+
|
| 97 |
+
Theorem machine_pass : forall cf k r x y restR restA restK s,
|
| 98 |
+
reachable cf = true ->
|
| 99 |
+
length (win s) = 64 ->
|
| 100 |
+
(forall i, relevant i = true -> wget (win s) i = wget (wcfg cf k) i) ->
|
| 101 |
+
contents (if k then d1 s else d0 s) = r :: restR ->
|
| 102 |
+
contents (if k then q0 s else q1 s) = x :: restA ->
|
| 103 |
+
contents (if k then d0 s else d1 s) = y :: restK ->
|
| 104 |
+
contents (if k then q1 s else q0 s) = enc organism ->
|
| 105 |
+
forall o s', o = dpass cf k r -> s' = itern G s ->
|
| 106 |
+
(forall i, relevant i = true -> wget (win s') i = wget (wcfg (ncf o) (nk o)) i)
|
| 107 |
+
/\ length (win s') = 64
|
| 108 |
+
/\ contents (if k then d1 s' else d0 s') = rotn (if cons o then 1 else 0) (r :: restR)
|
| 109 |
+
/\ contents (if k then q0 s' else q1 s') =
|
| 110 |
+
rotn (if emit o then 1 else 0) ((if emit o then av o else x) :: restA)
|
| 111 |
+
/\ contents (if k then d0 s' else d1 s') = rotn (if cw o then 1 else 0) ((if cw o then r else y) :: restK)
|
| 112 |
+
/\ contents (if k then q1 s' else q0 s') = enc organism.
|
| 113 |
+
Proof.
|
| 114 |
+
intros cf k r x y restR restA restK s Hreach Hlen Hw HR HA HK HQ o s' Eo Es'.
|
| 115 |
+
destruct (chk_spec _ _ _ _ _ (expect_from_check cf k r x y Hreach))
|
| 116 |
+
as (Hnb & Hcells & HmR & HpR & HmA & HpA & HmK & HpK).
|
| 117 |
+
rewrite <- Eo in Hcells, HmR, HmA, HpA, HmK, HpK.
|
| 118 |
+
remember (mkAS (wcfg cf k) (mkA [r] 0) (mkA [x] 0) (mkA [y] 0) 0 false) as te eqn:Ete in *.
|
| 119 |
+
remember (mkAS (win s) (mkA [r] 0) (mkA [x] 0) (mkA [y] 0) 0 false) as tr eqn:Etr in *.
|
| 120 |
+
(* the real and the enumerated abstract runs agree away from the temporaries *)
|
| 121 |
+
assert (Hwbr : wbr_from (skipn (ai tr) organism) istmp (map ao_of (firstn (ai tr) organism)) = true).
|
| 122 |
+
{ rewrite Etr. cbn [ai skipn firstn map]. exact wbr_organism. }
|
| 123 |
+
assert (Hagr : wagree istmp (map ao_of (firstn (ai tr) organism)) (aw tr) (aw te)).
|
| 124 |
+
{ rewrite Etr, Ete. cbn [ai aw firstn map].
|
| 125 |
+
intros i Hi H1 H2 H3. destruct Hi as [Hi|[]].
|
| 126 |
+
apply Hw. apply relevant_of_not_tmp; assumption. }
|
| 127 |
+
assert (Hlw : length (aw tr) = length (aw te)).
|
| 128 |
+
{ rewrite Etr, Ete. cbn [aw]. rewrite Hlen, length_wcfg. reflexivity. }
|
| 129 |
+
destruct (aiter_indep G organism istmp tr te eq_refl eq_refl eq_refl Hwbr
|
| 130 |
+
ltac:(rewrite Etr, Ete; reflexivity) ltac:(rewrite Etr, Ete; reflexivity)
|
| 131 |
+
ltac:(rewrite Etr, Ete; reflexivity) ltac:(rewrite Etr, Ete; reflexivity)
|
| 132 |
+
ltac:(rewrite Etr, Ete; reflexivity) Hlw Hagr)
|
| 133 |
+
as (_ & HaR & HaA & HaK & Hbd & Hwin).
|
| 134 |
+
(* the physics refines the real abstract run *)
|
| 135 |
+
assert (Hrel : rel k organism restR restA restK s tr).
|
| 136 |
+
{ unfold rel. rewrite Etr. cbn [aw aR aA aK ai pre mv].
|
| 137 |
+
refine (conj _ (conj Hlen (conj Hlen (conj _ (conj _ (conj _ _)))))).
|
| 138 |
+
- intros i _ _ _. reflexivity.
|
| 139 |
+
- rewrite rotn_0. exact HR.
|
| 140 |
+
- rewrite rotn_0. exact HA.
|
| 141 |
+
- rewrite rotn_0. exact HK.
|
| 142 |
+
- rewrite Nat.mul_0_r, rotn_0. exact HQ. }
|
| 143 |
+
assert (Hk : wget (win s) KAPPA = k).
|
| 144 |
+
{ change KAPPA with 0. rewrite (Hw 0 eq_refl). reflexivity. }
|
| 145 |
+
assert (Hn : ai tr + G <= length organism).
|
| 146 |
+
{ rewrite Etr. cbn [ai]. unfold G. lia. }
|
| 147 |
+
assert (Hb : bad (aiter G organism tr) = false).
|
| 148 |
+
{ rewrite Hbd. exact Hnb. }
|
| 149 |
+
pose proof (pass_refines G k organism restR restA restK s tr decode_organism Hrel Hk Hn Hb) as Hr.
|
| 150 |
+
rewrite <- Es' in Hr.
|
| 151 |
+
pose proof (aiter_ai G organism tr Hn) as Hai.
|
| 152 |
+
destruct Hr as (Hrw & Hrl & _ & HrR & HrA & HrK & HrQ).
|
| 153 |
+
refine (conj _ (conj Hrl (conj _ (conj _ (conj _ _))))).
|
| 154 |
+
- intros i Hi. destruct (relevant_not_tape i Hi) as (H1 & H2 & H3).
|
| 155 |
+
rewrite (Hrw i H1 H2 H3), (Hwin i (relevant_not_tmp i Hi) H1 H2 H3).
|
| 156 |
+
exact (Hcells i Hi).
|
| 157 |
+
- rewrite HrR, HaR, HmR, HpR. reflexivity.
|
| 158 |
+
- rewrite HrA, HaA, HmA, HpA. reflexivity.
|
| 159 |
+
- rewrite HrK, HaK, HmK, HpK. reflexivity.
|
| 160 |
+
- rewrite HrQ, Hai, Etr. cbn [ai]. unfold G. apply bank_full.
|
| 161 |
+
Qed.
|
rocq/Phys.v
ADDED
|
@@ -0,0 +1,102 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
(* The two-head physics as a netlist of ternary threshold units, unit for unit in the order of
|
| 2 |
+
the generator, for banks of N bits and description tapes of L bits. *)
|
| 3 |
+
From Stdlib Require Import List Bool Arith ZArith Lia.
|
| 4 |
+
Import ListNotations.
|
| 5 |
+
From TH Require Import TwoHead Tapes Net Gates.
|
| 6 |
+
|
| 7 |
+
Section Phys.
|
| 8 |
+
Variables N L : nat.
|
| 9 |
+
|
| 10 |
+
(* the state: the 61 window cells other than 1, 2 and 3, then Q0, Q1, D0, D1 *)
|
| 11 |
+
Definition realcell (j : nat) : nat := if Nat.eqb j 0 then 0 else j + 3.
|
| 12 |
+
Definition oq0 : nat := 61.
|
| 13 |
+
Definition oq1 : nat := 61 + N.
|
| 14 |
+
Definition od0 : nat := 61 + 2 * N.
|
| 15 |
+
Definition od1 : nat := 61 + 2 * N + L.
|
| 16 |
+
Definition nst : nat := 61 + 2 * N + 2 * L.
|
| 17 |
+
|
| 18 |
+
Definition kap : sref := SIn 0.
|
| 19 |
+
Definition fld (j : nat) : sref := SRef 0 j 2.
|
| 20 |
+
|
| 21 |
+
Definition head_src (j : nat) : nat * nat :=
|
| 22 |
+
match j with 0 => (od1, od0) | 1 => (oq0, oq1) | _ => (od0, od1) end.
|
| 23 |
+
|
| 24 |
+
Definition bitsof (a t : nat) : bool := Nat.testbit a (5 - t).
|
| 25 |
+
|
| 26 |
+
Definition cellref (a : nat) : sref :=
|
| 27 |
+
if Nat.eqb a 1 || Nat.eqb a 2 || Nat.eqb a 3 then SRef 1 (a - 1) 2
|
| 28 |
+
else SIn (if Nat.eqb a 0 then 0 else a - 3).
|
| 29 |
+
|
| 30 |
+
Definition xsref (i : nat) : sref := if Nat.eqb i 0 then SRef 6 0 0 else SRef 8 0 0.
|
| 31 |
+
|
| 32 |
+
Definition vand_bge (i : nat) : nat := match i with 0 => 2 | 1 => 1 | 2 => 0 | 3 => 3 | _ => 4 end.
|
| 33 |
+
|
| 34 |
+
Definition hatq (bh base m : nat) : sref := if Nat.eqb m 0 then SRef bh 0 5 else SIn (base + m).
|
| 35 |
+
Definition hatd (dh base m : nat) : sref := if Nat.eqb m 0 then SRef dh 0 6 else SIn (base + m).
|
| 36 |
+
|
| 37 |
+
(* 0: the record in front of the active bank *)
|
| 38 |
+
Definition blk_fld : block := Blk 26 3 (fun j => mux3 0 j 0 kap (SIn (oq1 + j)) (SIn (oq0 + j))).
|
| 39 |
+
(* 1: the cells under the read head, the arm and the copy head *)
|
| 40 |
+
Definition blk_head : block :=
|
| 41 |
+
Blk 3 3 (fun j => mux3 1 j 0 kap (SIn (fst (head_src j))) (SIn (snd (head_src j)))).
|
| 42 |
+
(* 2, 3, 4: the decode lines of the two operand addresses and the output address *)
|
| 43 |
+
Definition blk_dec (o : nat) : block :=
|
| 44 |
+
Blk 64 1 (fun a => [sAND (map (fun t => (fld (o + t), bitsof a t)) (seq 0 6))]).
|
| 45 |
+
(* 5 to 8: the two operands *)
|
| 46 |
+
Definition blk_term (bdec : nat) : block := Blk 64 1 (fun a => [sAND [(SRef bdec a 0, true); (cellref a, true)]]).
|
| 47 |
+
Definition blk_xs (bterm : nat) : block := Blk 1 1 (fun _ => [sOR (map (fun a => (SRef bterm a 0, true)) (seq 0 64))]).
|
| 48 |
+
(* 9 to 17: the weights, the bias and the threshold *)
|
| 49 |
+
Definition blk_pos : block := Blk 2 1 (fun i => [sAND [(fld (2 * i), false); (fld (2 * i + 1), true)]]).
|
| 50 |
+
Definition blk_neg : block := Blk 2 1 (fun i => [sAND [(fld (2 * i), true); (fld (2 * i + 1), false)]]).
|
| 51 |
+
Definition blk_mt : block := Blk 2 1 (fun i => [sAND [(SRef 9 i 0, true); (xsref i, true)]]).
|
| 52 |
+
Definition blk_nt : block := Blk 2 1 (fun i => [sAND [(SRef 10 i 0, true); (xsref i, true)]]).
|
| 53 |
+
Definition blk_pge : block :=
|
| 54 |
+
Blk 5 1 (fun i => [SU (2 - Z.of_nat i)
|
| 55 |
+
[(SRef 11 0 0, 1%Z); (SRef 11 1 0, 1%Z); (SRef 12 0 0, (-1)%Z); (SRef 12 1 0, (-1)%Z)]]).
|
| 56 |
+
Definition blk_b4 : block :=
|
| 57 |
+
Blk 1 4 (fun _ => [sOR [(fld 5, true); (fld 6, true); (fld 7, true)]; sOR [(fld 5, true); (fld 6, true)];
|
| 58 |
+
sAND [(fld 5, true); (fld 6, true); (fld 7, true)]; sAND [(fld 5, true); (fld 6, true)]]).
|
| 59 |
+
Definition blk_bge : block :=
|
| 60 |
+
Blk 1 5 (fun _ => [sAND [(fld 4, false)]; sAND [(fld 4, false); (SRef 14 0 0, true)];
|
| 61 |
+
sAND [(fld 4, false); (SRef 14 0 1, true)];
|
| 62 |
+
sOR [(fld 4, false); (SRef 14 0 2, true)]; sOR [(fld 4, false); (SRef 14 0 3, true)]]).
|
| 63 |
+
Definition blk_vand : block := Blk 5 1 (fun i => [sAND [(SRef 13 i 0, true); (SRef 15 0 (vand_bge i), true)]]).
|
| 64 |
+
Definition blk_v : block := Blk 1 1 (fun _ => [sOR (map (fun i => (SRef 16 i 0, true)) (seq 0 5))]).
|
| 65 |
+
(* 18, 19: the window after the write, and the cleared request cells *)
|
| 66 |
+
Definition blk_xhat : block := Blk 61 3 (fun j => mux3 18 j 0 (SRef 4 (realcell j) 0) (SRef 17 0 0) (SIn j)).
|
| 67 |
+
Definition blk_zero : block := Blk 1 1 (fun _ => [sOR []]).
|
| 68 |
+
(* 20 to 23: the banks; idlep is the value of kappa for which the bank is idle *)
|
| 69 |
+
Definition blk_bankh (bh : nat) (idlep : bool) (base : nat) : block :=
|
| 70 |
+
Blk 1 6 (fun _ => [sAND [(kap, idlep); (SRef 18 2 2, true)]; sAND [(kap, idlep); (SRef 18 2 2, false)];
|
| 71 |
+
sAND [(SRef 4 2 0, true); (kap, idlep)]] ++ mux3 bh 0 3 (SRef bh 0 2) (SRef 17 0 0) (SIn base)).
|
| 72 |
+
Definition blk_bank (bb bh : nat) (idlep : bool) (base : nat) : block :=
|
| 73 |
+
Blk N 4 (fun i => [sAND [(kap, negb idlep); (SIn (base + (i + 26) mod N), true)];
|
| 74 |
+
sAND [(SRef bh 0 0, true); (hatq bh base ((i + 1) mod N), true)];
|
| 75 |
+
sAND [(SRef bh 0 1, true); (hatq bh base i, true)];
|
| 76 |
+
sOR [(SRef bb i 0, true); (SRef bb i 1, true); (SRef bb i 2, true)]]).
|
| 77 |
+
(* 24 to 27: the description tapes *)
|
| 78 |
+
Definition blk_desch (dh : nat) (idlep : bool) (base : nat) : block :=
|
| 79 |
+
Blk 1 7 (fun _ => [sAND [(kap, negb idlep); (SRef 18 1 2, true)]; sAND [(kap, idlep); (SRef 18 3 2, true)];
|
| 80 |
+
sOR [(SRef dh 0 0, true); (SRef dh 0 1, true)];
|
| 81 |
+
sAND [(SRef 4 3 0, true); (kap, idlep)]] ++ mux3 dh 0 4 (SRef dh 0 3) (SRef 17 0 0) (SIn base)).
|
| 82 |
+
Definition blk_desc (db dh base : nat) : block :=
|
| 83 |
+
Blk L 3 (fun i => mux3 db i 0 (SRef dh 0 2) (hatd dh base ((i + 1) mod L)) (hatd dh base i)).
|
| 84 |
+
|
| 85 |
+
Definition phys_blocks : list block :=
|
| 86 |
+
[blk_fld; blk_head; blk_dec 8; blk_dec 14; blk_dec 20; blk_term 2; blk_xs 5; blk_term 3; blk_xs 7;
|
| 87 |
+
blk_pos; blk_neg; blk_mt; blk_nt; blk_pge; blk_b4; blk_bge; blk_vand; blk_v; blk_xhat; blk_zero;
|
| 88 |
+
blk_bankh 20 true oq0; blk_bank 21 20 true oq0; blk_bankh 22 false oq1; blk_bank 23 22 false oq1;
|
| 89 |
+
blk_desch 24 true od0; blk_desc 25 24 od0; blk_desch 26 false od1; blk_desc 27 26 od1].
|
| 90 |
+
|
| 91 |
+
(* the unit computing the next value of each state bit *)
|
| 92 |
+
Definition out_ref (i : nat) : sref :=
|
| 93 |
+
if i <? 61 then (if Nat.eqb i 1 || Nat.eqb i 2 || Nat.eqb i 3 then SRef 19 0 0 else SRef 18 i 2)
|
| 94 |
+
else if i <? oq1 then SRef 21 (i - oq0) 3
|
| 95 |
+
else if i <? od0 then SRef 23 (i - oq1) 3
|
| 96 |
+
else if i <? od1 then SRef 25 (i - od0) 2
|
| 97 |
+
else SRef 27 (i - od1) 2.
|
| 98 |
+
|
| 99 |
+
Definition phys_units : list tu := compile nst phys_blocks.
|
| 100 |
+
Definition phys_next : list nat := map (fun i => idx nst phys_blocks (out_ref i)) (seq 0 nst).
|
| 101 |
+
|
| 102 |
+
End Phys.
|
rocq/PhysFacts.v
ADDED
|
@@ -0,0 +1,65 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
(* The size of the physics netlist, and its weights, each +1 or -1. *)
|
| 2 |
+
From Stdlib Require Import List Bool Arith ZArith Lia.
|
| 3 |
+
Import ListNotations.
|
| 4 |
+
From TH Require Import TwoHead Net Gates Phys PhysWF.
|
| 5 |
+
|
| 6 |
+
Lemma phys_size : forall N L, length (phys_units N L) = 647 + 8 * N + 6 * L.
|
| 7 |
+
Proof.
|
| 8 |
+
intros N L. unfold phys_units. rewrite length_compile by apply phys_shaped.
|
| 9 |
+
rewrite phys_length. cbn [phys_blocks boff bcount bsize blk_fld blk_head blk_dec blk_term blk_xs blk_pos
|
| 10 |
+
blk_neg blk_mt blk_nt blk_pge blk_b4 blk_bge blk_vand blk_v blk_xhat blk_zero blk_bankh blk_bank
|
| 11 |
+
blk_desch blk_desc]. lia.
|
| 12 |
+
Qed.
|
| 13 |
+
|
| 14 |
+
Definition ter (u : su) : Prop := forall x w, In (x, w) (sin u) -> w = 1%Z \/ w = (-1)%Z.
|
| 15 |
+
|
| 16 |
+
Lemma ter_lits : forall b ls, ter (SU b (map lw ls)).
|
| 17 |
+
Proof.
|
| 18 |
+
intros b ls x w H. cbn [sin] in H. apply in_map_iff in H as ([y p] & E & _).
|
| 19 |
+
unfold lw in E. cbn [fst snd] in E. injection E as _ <-. destruct p; [left|right]; reflexivity.
|
| 20 |
+
Qed.
|
| 21 |
+
|
| 22 |
+
Lemma ter_and : forall ls, ter (sAND ls).
|
| 23 |
+
Proof. intro ls. apply ter_lits. Qed.
|
| 24 |
+
|
| 25 |
+
Lemma ter_or : forall ls, ter (sOR ls).
|
| 26 |
+
Proof. intro ls. apply ter_lits. Qed.
|
| 27 |
+
|
| 28 |
+
Lemma ter_mux : forall b j r0 sel a c, Forall ter (mux3 b j r0 sel a c).
|
| 29 |
+
Proof. intros. unfold mux3. repeat apply Forall_cons; try apply Forall_nil; apply ter_lits. Qed.
|
| 30 |
+
|
| 31 |
+
Lemma ter_nth : forall l r, Forall ter l -> ter (nth r l su0).
|
| 32 |
+
Proof.
|
| 33 |
+
intros l r H. revert r. induction H as [|u l Hu H IH]; intro r.
|
| 34 |
+
- destruct r; intros x w Hin; destruct Hin.
|
| 35 |
+
- destruct r; [exact Hu | apply IH].
|
| 36 |
+
Qed.
|
| 37 |
+
|
| 38 |
+
Lemma ter_shapes : forall N L b j, Forall ter (bshape (nth b (phys_blocks N L) blk0) j).
|
| 39 |
+
Proof.
|
| 40 |
+
intros N L b j.
|
| 41 |
+
do 28 (destruct b as [|b];
|
| 42 |
+
[ cbn [nth phys_blocks bshape blk_fld blk_head blk_dec blk_term blk_xs blk_pos blk_neg blk_mt blk_nt
|
| 43 |
+
blk_pge blk_b4 blk_bge blk_vand blk_v blk_xhat blk_zero blk_bankh blk_bank blk_desch blk_desc];
|
| 44 |
+
repeat first [ apply Forall_app; split | apply ter_mux | apply Forall_cons | apply Forall_nil
|
| 45 |
+
| apply ter_and | apply ter_or ];
|
| 46 |
+
try (intros x w Hin; cbn [sin] in Hin;
|
| 47 |
+
repeat (destruct Hin as [Hin|Hin]; [injection Hin as _ <-; lia|]); destruct Hin)
|
| 48 |
+
| ]).
|
| 49 |
+
destruct b; cbn [nth phys_blocks bshape blk0]; apply Forall_nil.
|
| 50 |
+
Qed.
|
| 51 |
+
|
| 52 |
+
(* every unit of the netlist reads its predecessors with weight +1 or -1 *)
|
| 53 |
+
Theorem phys_ternary : forall N L u, In u (phys_units N L) ->
|
| 54 |
+
forall i w, In (i, w) (tin u) -> w = 1%Z \/ w = (-1)%Z.
|
| 55 |
+
Proof.
|
| 56 |
+
intros N L u Hu i w Hin. unfold phys_units, compile in Hu.
|
| 57 |
+
apply in_concat in Hu as (us & Hus & Hu). apply in_map_iff in Hus as (blk & <- & Hblk).
|
| 58 |
+
unfold flat_block in Hu. apply in_concat in Hu as (us & Hus & Hu).
|
| 59 |
+
apply in_map_iff in Hus as (j & <- & Hj). apply in_map_iff in Hu as (v & <- & Hv).
|
| 60 |
+
unfold flat_unit in Hin. cbn [tin] in Hin. apply in_map_iff in Hin as ([x w'] & E & Hin).
|
| 61 |
+
cbn [fst snd] in E. injection E as _ <-.
|
| 62 |
+
apply In_nth with (d := blk0) in Hblk as (b & _ & <-).
|
| 63 |
+
apply In_nth with (d := su0) in Hv as (r & _ & <-).
|
| 64 |
+
exact (ter_nth _ r (ter_shapes N L b j) x w' Hin).
|
| 65 |
+
Qed.
|
rocq/PhysMain.v
ADDED
|
@@ -0,0 +1,91 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
(* The netlist of ternary threshold units computes one step of the two-head machine. *)
|
| 2 |
+
From Stdlib Require Import List Bool Arith ZArith Lia.
|
| 3 |
+
Import ListNotations.
|
| 4 |
+
From TH Require Import TwoHead Tapes Abstract Net Gates Phys PhysWF PhysSem.
|
| 5 |
+
|
| 6 |
+
Lemma F_unfold : forall N L s x,
|
| 7 |
+
run (phys_units N L) (nst N L) (fun i => nth i (encode s) false) (idx (nst N L) (phys_blocks N L) x) = F N L s x.
|
| 8 |
+
Proof. intros. unfold F, X. reflexivity. Qed.
|
| 9 |
+
|
| 10 |
+
Lemma wget_clearq_req : forall w a, length w = 64 -> a = 4 \/ a = 5 \/ a = 6 -> wget (clearq w) a = false.
|
| 11 |
+
Proof.
|
| 12 |
+
intros w a Hw Ha. unfold clearq, AA, AR, AC. rewrite !wget_upd, !upd_length, Hw.
|
| 13 |
+
destruct Ha as [-> | [-> | ->]]; reflexivity.
|
| 14 |
+
Qed.
|
| 15 |
+
|
| 16 |
+
Lemma win_stepres : forall s k qa' ao v, win (stepres s k qa' ao v) = clearq (wnext (win s) ao v).
|
| 17 |
+
Proof. intros s k qa' ao v. unfold stepres. cbv zeta. destruct k; reflexivity. Qed.
|
| 18 |
+
|
| 19 |
+
Lemma length_wrote : forall s l h, length (wrote s l h) = length l.
|
| 20 |
+
Proof. intros s l h. unfold wrote. destruct h; [apply wr0_length|reflexivity]. Qed.
|
| 21 |
+
|
| 22 |
+
Lemma length_wrotec : forall s l h, length (wrotec s l h) = length l.
|
| 23 |
+
Proof. intros s l h. unfold wrotec. destruct h; [apply wr0_length|reflexivity]. Qed.
|
| 24 |
+
|
| 25 |
+
(* From any state whose banks hold N >= 26 bits, whose description tapes hold L >= 1 bits and
|
| 26 |
+
whose window has 64 cells, the netlist, evaluated unit by unit on the encoded state, gives
|
| 27 |
+
the encoding of the next state. *)
|
| 28 |
+
Theorem netlist_step : forall N L s, 26 <= N -> 1 <= L -> length (win s) = 64 ->
|
| 29 |
+
length (contents (q0 s)) = N -> length (contents (q1 s)) = N ->
|
| 30 |
+
length (contents (d0 s)) = L -> length (contents (d1 s)) = L ->
|
| 31 |
+
netstep (nst N L) (phys_units N L) (phys_next N L) (encode s) = encode (step s).
|
| 32 |
+
Proof.
|
| 33 |
+
intros N L s HN HL Hw H0 H1 H2 H3.
|
| 34 |
+
destruct (step_eq N L s HN HL H0 H1 H2 H3 Hw) as (qa' & Hqa & Hst).
|
| 35 |
+
pose proof (tapes_step N L s HN HL H0 H1 H2 H3 Hw qa' Hqa) as T. cbv zeta in T.
|
| 36 |
+
rewrite <- Hst in T. destruct T as (T0 & T1 & T2 & T3).
|
| 37 |
+
assert (L0 : length (contents (q0 (step s))) = N)
|
| 38 |
+
by (rewrite T0; destruct (kk s), (advA s); rewrite ?rot1_length, ?length_wrote, ?rotn_length; assumption).
|
| 39 |
+
assert (L1 : length (contents (q1 (step s))) = N)
|
| 40 |
+
by (rewrite T1; destruct (kk s), (advA s); rewrite ?rot1_length, ?length_wrote, ?rotn_length; assumption).
|
| 41 |
+
assert (L2 : length (contents (d0 (step s))) = L)
|
| 42 |
+
by (rewrite T2; destruct (kk s), (advC s), (advR s); rewrite ?rot1_length, ?length_wrotec; assumption).
|
| 43 |
+
assert (L3 : length (contents (d1 (step s))) = L)
|
| 44 |
+
by (rewrite T3; destruct (kk s), (advC s), (advR s); rewrite ?rot1_length, ?length_wrotec; assumption).
|
| 45 |
+
unfold netstep, phys_next. rewrite map_map.
|
| 46 |
+
apply nth_ext with (d := false) (d' := false).
|
| 47 |
+
{ rewrite length_map, length_seq, (length_encode (step s) N L L0 L1 L2 L3). reflexivity. }
|
| 48 |
+
intros i Hi. rewrite length_map, length_seq in Hi.
|
| 49 |
+
rewrite (nth_map_seq _ (fun i => run (phys_units N L) (nst N L) (fun i0 => nth i0 (encode s) false)
|
| 50 |
+
(idx (nst N L) (phys_blocks N L) (out_ref N L i))) (nst N L) i false Hi).
|
| 51 |
+
rewrite F_unfold.
|
| 52 |
+
rewrite (nth_encode (step s) N L i L0 L1 L2 L3).
|
| 53 |
+
unfold out_ref, oq0, oq1, od0, od1, nst in *.
|
| 54 |
+
destruct (Nat.ltb_spec i 61) as [Hw61|Hw61].
|
| 55 |
+
- (* the window *)
|
| 56 |
+
rewrite Hst, win_stepres.
|
| 57 |
+
destruct (Nat.eqb i 1 || Nat.eqb i 2 || Nat.eqb i 3) eqn:E.
|
| 58 |
+
+ rewrite (F_zero N L s HN HL H0 H1 H2 H3). symmetry. apply wget_clearq_req; [rewrite length_wnext; exact Hw|].
|
| 59 |
+
unfold realcell. apply orb_true_iff in E as [E|E]; [apply orb_true_iff in E as [E|E]|];
|
| 60 |
+
apply Nat.eqb_eq in E; subst i; cbn; lia.
|
| 61 |
+
+ rewrite (F_xhat N L s HN HL H0 H1 H2 H3 i Hw61).
|
| 62 |
+
apply orb_false_iff in E as [E E3]. apply orb_false_iff in E as [E1 E2].
|
| 63 |
+
apply Nat.eqb_neq in E1, E2, E3.
|
| 64 |
+
assert (Hr : realcell i < 64 /\ realcell i <> 1 /\ realcell i <> 2 /\ realcell i <> 3
|
| 65 |
+
/\ realcell i <> AA /\ realcell i <> AR /\ realcell i <> AC)
|
| 66 |
+
by (unfold realcell, AA, AR, AC; destruct (Nat.eqb_spec i 0); lia).
|
| 67 |
+
destruct Hr as (R0 & R1 & R2 & R3 & R4 & R5 & R6).
|
| 68 |
+
rewrite wget_clearq_other by assumption. rewrite (wget_wn N L s) by assumption. reflexivity.
|
| 69 |
+
- destruct (Nat.ltb_spec i (61 + N)) as [Hq|Hq].
|
| 70 |
+
+ (* bank 0 *)
|
| 71 |
+
rewrite (F_bank N L s HN HL H0 H1 H2 H3 20 21 true 61 (q0 s)
|
| 72 |
+
ltac:(left; repeat split) (i - 61) ltac:(lia)).
|
| 73 |
+
rewrite T0. destruct (kk s); reflexivity.
|
| 74 |
+
+ destruct (Nat.ltb_spec i (61 + 2 * N)) as [Hq'|Hq'].
|
| 75 |
+
* (* bank 1 *)
|
| 76 |
+
replace (i - (61 + N)) with (i - 61 - N) by lia.
|
| 77 |
+
rewrite (F_bank N L s HN HL H0 H1 H2 H3 22 23 false (oq1 N) (q1 s)
|
| 78 |
+
ltac:(right; repeat split) (i - 61 - N) ltac:(lia)).
|
| 79 |
+
rewrite T1. destruct (kk s); reflexivity.
|
| 80 |
+
* destruct (Nat.ltb_spec i (61 + 2 * N + L)) as [Hd|Hd].
|
| 81 |
+
-- (* description tape 0 *)
|
| 82 |
+
replace (i - (61 + 2 * N)) with (i - 61 - 2 * N) by lia.
|
| 83 |
+
rewrite (F_desc N L s HN HL H0 H1 H2 H3 24 25 true (od0 N) (d0 s)
|
| 84 |
+
ltac:(left; repeat split) (i - 61 - 2 * N) ltac:(lia)).
|
| 85 |
+
rewrite T2. destruct (kk s); reflexivity.
|
| 86 |
+
-- (* description tape 1 *)
|
| 87 |
+
replace (i - (61 + 2 * N + L)) with (i - 61 - 2 * N - L) by lia.
|
| 88 |
+
rewrite (F_desc N L s HN HL H0 H1 H2 H3 26 27 false (od1 N L) (d1 s)
|
| 89 |
+
ltac:(right; repeat split) (i - 61 - 2 * N - L) ltac:(lia)).
|
| 90 |
+
rewrite T3. destruct (kk s); reflexivity.
|
| 91 |
+
Qed.
|
rocq/PhysSem.v
ADDED
|
@@ -0,0 +1,655 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
(* What each block of the physics netlist computes, from a state of the two-head machine. *)
|
| 2 |
+
From Stdlib Require Import List Bool Arith ZArith Lia.
|
| 3 |
+
Import ListNotations.
|
| 4 |
+
From TH Require Import TwoHead Tapes Abstract Net Gates Phys PhysWF.
|
| 5 |
+
|
| 6 |
+
(* the state bits of a machine state, in the order of the netlist *)
|
| 7 |
+
Definition encode (s : st) : list bool :=
|
| 8 |
+
map (fun j => wget (win s) (realcell j)) (seq 0 61)
|
| 9 |
+
++ contents (q0 s) ++ contents (q1 s) ++ contents (d0 s) ++ contents (d1 s).
|
| 10 |
+
|
| 11 |
+
Lemma length_encode : forall s N L,
|
| 12 |
+
length (contents (q0 s)) = N -> length (contents (q1 s)) = N ->
|
| 13 |
+
length (contents (d0 s)) = L -> length (contents (d1 s)) = L ->
|
| 14 |
+
length (encode s) = nst N L.
|
| 15 |
+
Proof.
|
| 16 |
+
intros s N L H1 H2 H3 H4. unfold encode, nst.
|
| 17 |
+
rewrite !length_app, length_map, length_seq, H1, H2, H3, H4. lia.
|
| 18 |
+
Qed.
|
| 19 |
+
|
| 20 |
+
Section Sem.
|
| 21 |
+
Variables (N L : nat) (s : st).
|
| 22 |
+
Hypotheses (HN : 26 <= N) (HL : 1 <= L)
|
| 23 |
+
(Hq0 : length (contents (q0 s)) = N) (Hq1 : length (contents (q1 s)) = N)
|
| 24 |
+
(Hd0 : length (contents (d0 s)) = L) (Hd1 : length (contents (d1 s)) = L).
|
| 25 |
+
|
| 26 |
+
Definition X (i : nat) : bool := nth i (encode s) false.
|
| 27 |
+
Definition F (x : sref) : bool := run (phys_units N L) (nst N L) X (idx (nst N L) (phys_blocks N L) x).
|
| 28 |
+
|
| 29 |
+
Lemma X_win : forall j, j < 61 -> X j = wget (win s) (realcell j).
|
| 30 |
+
Proof.
|
| 31 |
+
intros j Hj. unfold X, encode. rewrite app_nth1 by (rewrite length_map, length_seq; exact Hj).
|
| 32 |
+
exact (nth_map_seq _ (fun j => wget (win s) (realcell j)) 61 j false Hj).
|
| 33 |
+
Qed.
|
| 34 |
+
|
| 35 |
+
Lemma X_tape : forall i,
|
| 36 |
+
(i < N -> X (oq0 + i) = nth i (contents (q0 s)) false)
|
| 37 |
+
/\ (i < N -> X (oq1 N + i) = nth i (contents (q1 s)) false)
|
| 38 |
+
/\ (i < L -> X (od0 N + i) = nth i (contents (d0 s)) false)
|
| 39 |
+
/\ (i < L -> X (od1 N L + i) = nth i (contents (d1 s)) false).
|
| 40 |
+
Proof.
|
| 41 |
+
intro i. unfold X, encode, oq0, oq1, od0, od1.
|
| 42 |
+
repeat split; intro Hi; rewrite app_nth2 by (rewrite length_map, length_seq; lia);
|
| 43 |
+
rewrite length_map, length_seq.
|
| 44 |
+
- rewrite app_nth1 by lia. f_equal. lia.
|
| 45 |
+
- rewrite app_nth2 by lia. rewrite app_nth1 by lia. f_equal. lia.
|
| 46 |
+
- rewrite app_nth2 by lia. rewrite app_nth2 by lia. rewrite app_nth1 by lia. f_equal. lia.
|
| 47 |
+
- rewrite app_nth2 by lia. rewrite app_nth2 by lia. rewrite app_nth2 by lia. f_equal. lia.
|
| 48 |
+
Qed.
|
| 49 |
+
|
| 50 |
+
Lemma F_in : forall i, i < nst N L -> F (SIn i) = X i.
|
| 51 |
+
Proof. intros i H. unfold F, phys_units. apply net_in. exact H. Qed.
|
| 52 |
+
|
| 53 |
+
Lemma F_unit : forall b j r, b < 28 ->
|
| 54 |
+
j < bcount (nth b (phys_blocks N L) blk0) -> r < bsize (nth b (phys_blocks N L) blk0) ->
|
| 55 |
+
F (SRef b j r) = sfire' (sunit (phys_blocks N L) b j r) F.
|
| 56 |
+
Proof.
|
| 57 |
+
intros b j r Hb Hj Hr. unfold F, phys_units. apply net_unit; [apply phys_wf; assumption| |assumption|assumption].
|
| 58 |
+
rewrite phys_length. exact Hb.
|
| 59 |
+
Qed.
|
| 60 |
+
|
| 61 |
+
Lemma F_and : forall b j r ls, b < 28 ->
|
| 62 |
+
j < bcount (nth b (phys_blocks N L) blk0) -> r < bsize (nth b (phys_blocks N L) blk0) ->
|
| 63 |
+
sunit (phys_blocks N L) b j r = sAND ls -> F (SRef b j r) = forallb (litv F) ls.
|
| 64 |
+
Proof. intros b j r ls Hb Hj Hr E. rewrite F_unit, E by assumption. apply sAND_fire. Qed.
|
| 65 |
+
|
| 66 |
+
Lemma F_or : forall b j r ls, b < 28 ->
|
| 67 |
+
j < bcount (nth b (phys_blocks N L) blk0) -> r < bsize (nth b (phys_blocks N L) blk0) ->
|
| 68 |
+
sunit (phys_blocks N L) b j r = sOR ls -> F (SRef b j r) = existsb (litv F) ls.
|
| 69 |
+
Proof. intros b j r ls Hb Hj Hr E. rewrite F_unit, E by assumption. apply sOR_fire. Qed.
|
| 70 |
+
|
| 71 |
+
Lemma F_mux : forall b j r0 sel a c, b < 28 ->
|
| 72 |
+
j < bcount (nth b (phys_blocks N L) blk0) -> S (S r0) < bsize (nth b (phys_blocks N L) blk0) ->
|
| 73 |
+
sunit (phys_blocks N L) b j r0 = sAND [(sel, true); (a, true)] ->
|
| 74 |
+
sunit (phys_blocks N L) b j (S r0) = sAND [(sel, false); (c, true)] ->
|
| 75 |
+
sunit (phys_blocks N L) b j (S (S r0)) = sOR [(SRef b j r0, true); (SRef b j (S r0), true)] ->
|
| 76 |
+
F (SRef b j (S (S r0))) = if F sel then F a else F c.
|
| 77 |
+
Proof.
|
| 78 |
+
intros b j r0 sel a c Hb Hj Hr E0 E1 E2.
|
| 79 |
+
rewrite (F_or b j (S (S r0)) _ Hb Hj Hr E2). cbn [existsb]. rewrite !litv_pos.
|
| 80 |
+
rewrite (F_and b j r0 _ Hb Hj ltac:(lia) E0), (F_and b j (S r0) _ Hb Hj ltac:(lia) E1).
|
| 81 |
+
cbn [forallb]. rewrite !litv_pos, litv_neg. destruct (F sel), (F a), (F c); reflexivity.
|
| 82 |
+
Qed.
|
| 83 |
+
|
| 84 |
+
(* ---- the semantic quantities of one step ------------------------------------------ *)
|
| 85 |
+
Definition kk : bool := wget (win s) 0.
|
| 86 |
+
Definition qa : list bool := contents (if kk then q1 s else q0 s).
|
| 87 |
+
|
| 88 |
+
Lemma F_kap : F kap = kk.
|
| 89 |
+
Proof. unfold kap. rewrite F_in by (unfold nst; lia). rewrite X_win by lia. reflexivity. Qed.
|
| 90 |
+
|
| 91 |
+
Ltac blk_compute := cbn [nth phys_blocks bcount bsize bshape blk_fld blk_head blk_dec blk_term blk_xs blk_pos
|
| 92 |
+
blk_neg blk_mt blk_nt blk_pge blk_b4 blk_bge blk_vand blk_v blk_xhat blk_zero blk_bankh blk_bank
|
| 93 |
+
blk_desch blk_desc sunit mux3 app].
|
| 94 |
+
|
| 95 |
+
(* block 0: the record in front of the active bank *)
|
| 96 |
+
Lemma F_fld : forall j, j < 26 -> F (fld j) = nth j qa false.
|
| 97 |
+
Proof.
|
| 98 |
+
intros j Hj. unfold fld.
|
| 99 |
+
rewrite (F_mux 0 j 0 kap (SIn (oq1 N + j)) (SIn (oq0 + j))) by (blk_compute; first [lia | reflexivity]).
|
| 100 |
+
rewrite F_kap, !F_in by (unfold nst, oq0, oq1; lia).
|
| 101 |
+
destruct (X_tape j) as (T0 & T1 & _ & _). rewrite T0, T1 by lia.
|
| 102 |
+
unfold qa. destruct kk; reflexivity.
|
| 103 |
+
Qed.
|
| 104 |
+
|
| 105 |
+
(* block 1: the cells under the read head, the arm and the copy head *)
|
| 106 |
+
Definition rdv : bool := hd0 (contents (if kk then d1 s else d0 s)).
|
| 107 |
+
Definition armv : bool := hd0 (contents (if kk then q0 s else q1 s)).
|
| 108 |
+
Definition cpyv : bool := hd0 (contents (if kk then d0 s else d1 s)).
|
| 109 |
+
|
| 110 |
+
Lemma nth0_hd0 : forall l, nth 0 l false = hd0 l.
|
| 111 |
+
Proof. intros [|x l]; reflexivity. Qed.
|
| 112 |
+
|
| 113 |
+
Lemma F_heads : F (SRef 1 0 2) = rdv /\ F (SRef 1 1 2) = armv /\ F (SRef 1 2 2) = cpyv.
|
| 114 |
+
Proof.
|
| 115 |
+
destruct (X_tape 0) as (T0 & T1 & T2 & T3).
|
| 116 |
+
rewrite <- !plus_n_O in T0, T1, T2, T3.
|
| 117 |
+
repeat split;
|
| 118 |
+
(rewrite F_mux with (sel := kap)
|
| 119 |
+
(a := SIn (fst (head_src N L _))) (c := SIn (snd (head_src N L _))) by (blk_compute; first [lia | reflexivity]));
|
| 120 |
+
cbn [head_src fst snd]; rewrite F_kap, !F_in by (unfold nst, oq0, oq1, od0, od1; lia);
|
| 121 |
+
rewrite ?T0, ?T1, ?T2, ?T3 by lia; unfold rdv, armv, cpyv; rewrite <- ?nth0_hd0; destruct kk; reflexivity.
|
| 122 |
+
Qed.
|
| 123 |
+
|
| 124 |
+
(* ---- blocks 2 to 8: the three addresses and the two operands --------------------- *)
|
| 125 |
+
Lemma bits2nat_nat2bits : forall a, a < 64 -> bits2nat (nat2bits 6 a) = a.
|
| 126 |
+
Proof. intros a Ha. do 64 (destruct a as [|a]; [reflexivity|]). lia. Qed.
|
| 127 |
+
|
| 128 |
+
Lemma nat2bits_bits2nat : forall f, length f = 6 -> nat2bits 6 (bits2nat f) = f.
|
| 129 |
+
Proof.
|
| 130 |
+
intros f Hf. destruct f as [|b0 [|b1 [|b2 [|b3 [|b4 [|b5 [|? ?]]]]]]]; cbn [length] in Hf; try lia.
|
| 131 |
+
destruct b0, b1, b2, b3, b4, b5; reflexivity.
|
| 132 |
+
Qed.
|
| 133 |
+
|
| 134 |
+
Lemma lbeq_refl : forall l, lbeq l l = true.
|
| 135 |
+
Proof. induction l as [|x l IH]; [reflexivity|]. cbn [lbeq]. rewrite IH, eqb_reflx. reflexivity. Qed.
|
| 136 |
+
|
| 137 |
+
Lemma dec_ok : forall f a, length f = 6 -> a < 64 ->
|
| 138 |
+
forallb (fun t => Bool.eqb (nth t f false) (bitsof a t)) (seq 0 6) = Nat.eqb (bits2nat f) a.
|
| 139 |
+
Proof.
|
| 140 |
+
intros f a Hf Ha.
|
| 141 |
+
assert (E : forallb (fun t => Bool.eqb (nth t f false) (bitsof a t)) (seq 0 6) = lbeq f (nat2bits 6 a)).
|
| 142 |
+
{ destruct f as [|b0 [|b1 [|b2 [|b3 [|b4 [|b5 [|? ?]]]]]]]; cbn [length] in Hf; try lia.
|
| 143 |
+
unfold bitsof. cbn - [Nat.testbit Bool.eqb]. rewrite !andb_true_r. reflexivity. }
|
| 144 |
+
rewrite E. destruct (lbeq f (nat2bits 6 a)) eqn:El; destruct (Nat.eqb (bits2nat f) a) eqn:En; auto.
|
| 145 |
+
- apply lbeq_true in El. subst f. rewrite bits2nat_nat2bits in En by exact Ha.
|
| 146 |
+
rewrite Nat.eqb_refl in En. discriminate.
|
| 147 |
+
- apply Nat.eqb_eq in En. rewrite <- En, nat2bits_bits2nat, lbeq_refl in El by exact Hf. discriminate.
|
| 148 |
+
Qed.
|
| 149 |
+
|
| 150 |
+
Lemma length_qa : length qa = N.
|
| 151 |
+
Proof. unfold qa. destruct kk; assumption. Qed.
|
| 152 |
+
|
| 153 |
+
Definition field (o : nat) : list bool := firstn 6 (skipn o qa).
|
| 154 |
+
|
| 155 |
+
Lemma length_field : forall o, o + 6 <= 26 -> length (field o) = 6.
|
| 156 |
+
Proof. intros o Ho. unfold field. rewrite length_firstn, length_skipn, length_qa. lia. Qed.
|
| 157 |
+
|
| 158 |
+
Lemma nth_field : forall o t, t < 6 -> nth t (field o) false = nth (o + t) qa false.
|
| 159 |
+
Proof. intros o t Ht. unfold field. rewrite nth_firstn. destruct (Nat.ltb_spec t 6); [|lia]. apply nth_skipn. Qed.
|
| 160 |
+
|
| 161 |
+
Lemma forallb_map' : forall (A B : Type) (f : B -> bool) (g : A -> B) l, forallb f (map g l) = forallb (fun x => f (g x)) l.
|
| 162 |
+
Proof. intros A B f g l. induction l as [|x l IH]; [reflexivity|]. cbn [map forallb]. rewrite IH. reflexivity. Qed.
|
| 163 |
+
|
| 164 |
+
Lemma existsb_map' : forall (A B : Type) (f : B -> bool) (g : A -> B) l, existsb f (map g l) = existsb (fun x => f (g x)) l.
|
| 165 |
+
Proof. intros A B f g l. induction l as [|x l IH]; [reflexivity|]. cbn [map existsb]. rewrite IH. reflexivity. Qed.
|
| 166 |
+
|
| 167 |
+
Lemma forallb_ext_in : forall (A : Type) (f g : A -> bool) l, (forall x, In x l -> f x = g x) -> forallb f l = forallb g l.
|
| 168 |
+
Proof. intros A f g l H. induction l as [|x l IH]; [reflexivity|]. cbn [forallb]. rewrite H, IH; [reflexivity| |left; reflexivity]. intros y Hy. apply H. right. exact Hy. Qed.
|
| 169 |
+
|
| 170 |
+
Lemma existsb_ext_in : forall (A : Type) (f g : A -> bool) l, (forall x, In x l -> f x = g x) -> existsb f l = existsb g l.
|
| 171 |
+
Proof. intros A f g l H. induction l as [|x l IH]; [reflexivity|]. cbn [existsb]. rewrite H, IH; [reflexivity| |left; reflexivity]. intros y Hy. apply H. right. exact Hy. Qed.
|
| 172 |
+
|
| 173 |
+
Lemma F_dec : forall b o a, (b = 2 /\ o = 8) \/ (b = 3 /\ o = 14) \/ (b = 4 /\ o = 20) -> a < 64 ->
|
| 174 |
+
F (SRef b a 0) = Nat.eqb (bits2nat (field o)) a.
|
| 175 |
+
Proof.
|
| 176 |
+
intros b o a Hbo Ha.
|
| 177 |
+
assert (Hs : sunit (phys_blocks N L) b a 0 = sAND (map (fun t => (fld (o + t), bitsof a t)) (seq 0 6)))
|
| 178 |
+
by (destruct Hbo as [[-> ->]|[[-> ->]|[-> ->]]]; reflexivity).
|
| 179 |
+
rewrite (F_and b a 0 _ ltac:(lia) ltac:(destruct Hbo as [[-> ->]|[[-> ->]|[-> ->]]]; blk_compute; lia)
|
| 180 |
+
ltac:(destruct Hbo as [[-> ->]|[[-> ->]|[-> ->]]]; blk_compute; lia) Hs).
|
| 181 |
+
rewrite forallb_map'. rewrite <- dec_ok by (try apply length_field; lia).
|
| 182 |
+
apply forallb_ext_in. intros t Ht. apply in_seq in Ht.
|
| 183 |
+
unfold litv. cbn [fst snd]. rewrite F_fld by lia. rewrite nth_field by lia. reflexivity.
|
| 184 |
+
Qed.
|
| 185 |
+
|
| 186 |
+
Definition cellv (a : nat) : bool :=
|
| 187 |
+
if Nat.eqb a 1 then rdv else if Nat.eqb a 2 then armv else if Nat.eqb a 3 then cpyv else wget (win s) a.
|
| 188 |
+
|
| 189 |
+
Lemma F_cellref : forall a, a < 64 -> F (cellref a) = cellv a.
|
| 190 |
+
Proof.
|
| 191 |
+
intros a Ha. destruct F_heads as (H1 & H2 & H3). unfold cellref, cellv.
|
| 192 |
+
destruct (Nat.eqb_spec a 1) as [->|E1]; [exact H1|].
|
| 193 |
+
destruct (Nat.eqb_spec a 2) as [->|E2]; [exact H2|].
|
| 194 |
+
destruct (Nat.eqb_spec a 3) as [->|E3]; [exact H3|]. cbn [orb].
|
| 195 |
+
destruct (Nat.eqb_spec a 0) as [->|E0].
|
| 196 |
+
- rewrite F_in by (unfold nst; lia). rewrite X_win by lia. reflexivity.
|
| 197 |
+
- rewrite F_in by (unfold nst; lia). rewrite X_win by lia. unfold realcell.
|
| 198 |
+
destruct (Nat.eqb_spec (a - 3) 0); [lia|]. f_equal. lia.
|
| 199 |
+
Qed.
|
| 200 |
+
|
| 201 |
+
Lemma existsb_pick : forall (g : nat -> bool) c n m,
|
| 202 |
+
existsb (fun a => Nat.eqb c a && g a) (seq m n) = if (m <=? c) && (c <? m + n) then g c else false.
|
| 203 |
+
Proof.
|
| 204 |
+
intros g c n. induction n as [|n IH]; intro m; cbn [seq existsb].
|
| 205 |
+
- destruct (Nat.leb_spec m c), (Nat.ltb_spec c (m + 0)); cbn [andb]; try reflexivity; lia.
|
| 206 |
+
- rewrite IH. destruct (Nat.eqb_spec c m) as [E|E].
|
| 207 |
+
+ subst c. rewrite Nat.leb_refl.
|
| 208 |
+
replace (m <? m + S n) with true by (symmetry; apply Nat.ltb_lt; lia).
|
| 209 |
+
replace (S m <=? m) with false by (symmetry; apply Nat.leb_gt; lia).
|
| 210 |
+
cbn [andb orb]. destruct (g m); reflexivity.
|
| 211 |
+
+ cbn [andb orb].
|
| 212 |
+
destruct (Nat.leb_spec m c), (Nat.leb_spec (S m) c), (Nat.ltb_spec c (S m + n)), (Nat.ltb_spec c (m + S n));
|
| 213 |
+
cbn [andb]; try reflexivity; lia.
|
| 214 |
+
Qed.
|
| 215 |
+
|
| 216 |
+
Definition fa (o : nat) : nat := bits2nat (field o).
|
| 217 |
+
|
| 218 |
+
Lemma fa_lt : forall o, o + 6 <= 26 -> fa o < 64.
|
| 219 |
+
Proof.
|
| 220 |
+
intros o Ho. unfold fa. pose proof (length_field o Ho) as H.
|
| 221 |
+
rewrite <- (nat2bits_bits2nat (field o) H). remember (field o) as f eqn:Ef. clear Ef.
|
| 222 |
+
destruct f as [|b0 [|b1 [|b2 [|b3 [|b4 [|b5 [|? ?]]]]]]]; cbn [length] in H; try lia.
|
| 223 |
+
destruct b0, b1, b2, b3, b4, b5; cbn; lia.
|
| 224 |
+
Qed.
|
| 225 |
+
|
| 226 |
+
Lemma F_xs : forall i, i < 2 -> F (xsref i) = cellv (fa (8 + 6 * i)).
|
| 227 |
+
Proof.
|
| 228 |
+
intros i Hi. unfold xsref.
|
| 229 |
+
assert (Hlt := fa_lt (8 + 6 * i) ltac:(lia)).
|
| 230 |
+
destruct (Nat.eqb_spec i 0) as [->|E].
|
| 231 |
+
- rewrite (F_or 6 0 0 (map (fun a => (SRef 5 a 0, true)) (seq 0 64))) by (blk_compute; first [lia | reflexivity]).
|
| 232 |
+
rewrite existsb_map'.
|
| 233 |
+
rewrite (existsb_ext_in _ _ (fun a => Nat.eqb (fa 8) a && cellv a)).
|
| 234 |
+
+ rewrite existsb_pick. cbn [Nat.mul Nat.add] in Hlt.
|
| 235 |
+
replace (0 <=? fa 8) with true by (symmetry; apply Nat.leb_le; lia).
|
| 236 |
+
replace (fa 8 <? 0 + 64) with true by (symmetry; apply Nat.ltb_lt; lia).
|
| 237 |
+
reflexivity.
|
| 238 |
+
+ intros a Ha. apply in_seq in Ha. rewrite litv_pos.
|
| 239 |
+
rewrite (F_and 5 a 0 [(SRef 2 a 0, true); (cellref a, true)]) by (blk_compute; first [lia | reflexivity]).
|
| 240 |
+
cbn [forallb]. rewrite !litv_pos, andb_true_r.
|
| 241 |
+
rewrite F_dec with (o := 8) by (lia || (left; split; reflexivity)).
|
| 242 |
+
rewrite F_cellref by lia. reflexivity.
|
| 243 |
+
- replace i with 1 in * by lia.
|
| 244 |
+
rewrite (F_or 8 0 0 (map (fun a => (SRef 7 a 0, true)) (seq 0 64))) by (blk_compute; first [lia | reflexivity]).
|
| 245 |
+
rewrite existsb_map'.
|
| 246 |
+
rewrite (existsb_ext_in _ _ (fun a => Nat.eqb (fa 14) a && cellv a)).
|
| 247 |
+
+ rewrite existsb_pick. cbn [Nat.mul Nat.add] in Hlt.
|
| 248 |
+
replace (0 <=? fa 14) with true by (symmetry; apply Nat.leb_le; lia).
|
| 249 |
+
replace (fa 14 <? 0 + 64) with true by (symmetry; apply Nat.ltb_lt; lia).
|
| 250 |
+
reflexivity.
|
| 251 |
+
+ intros a Ha. apply in_seq in Ha. rewrite litv_pos.
|
| 252 |
+
rewrite (F_and 7 a 0 [(SRef 3 a 0, true); (cellref a, true)]) by (blk_compute; first [lia | reflexivity]).
|
| 253 |
+
cbn [forallb]. rewrite !litv_pos, andb_true_r.
|
| 254 |
+
rewrite F_dec with (o := 14) by (lia || (right; left; split; reflexivity)).
|
| 255 |
+
rewrite F_cellref by lia. reflexivity.
|
| 256 |
+
Qed.
|
| 257 |
+
|
| 258 |
+
(* ---- blocks 9 to 17: the weights, the bias and the threshold -------------------------- *)
|
| 259 |
+
Definition fb (j : nat) : bool := nth j qa false.
|
| 260 |
+
|
| 261 |
+
Definition beta4 (b3 b2 b1 b0 : bool) : Z :=
|
| 262 |
+
let braw := Z.of_nat (bits2nat [b3; b2; b1; b0]) in if Z.leb 8 braw then (braw - 16)%Z else braw.
|
| 263 |
+
|
| 264 |
+
(* the threshold as its units compute it, on the ten bits it reads *)
|
| 265 |
+
Definition vnet (f0 f1 f2 f3 f4 f5 f6 f7 y0 y1 : bool) : bool :=
|
| 266 |
+
let mt0 := negb f0 && f1 && y0 in let mt1 := negb f2 && f3 && y1 in
|
| 267 |
+
let nt0 := f0 && negb f1 && y0 in let nt1 := f2 && negb f3 && y1 in
|
| 268 |
+
let pge (c : Z) := Z.leb 0 (- c + b2z mt0 + b2z mt1 - b2z nt0 - b2z nt1)%Z in
|
| 269 |
+
let bge0 := negb f4 in let bge1 := negb f4 && (f5 || f6 || f7) in let bge2 := negb f4 && (f5 || f6) in
|
| 270 |
+
let bgem1 := negb f4 || (f5 && f6 && f7) in let bgem2 := negb f4 || (f5 && f6) in
|
| 271 |
+
(pge (-2)%Z && bge2) || (pge (-1)%Z && bge1) || (pge 0%Z && bge0) || (pge 1%Z && bgem1) || (pge 2%Z && bgem2).
|
| 272 |
+
|
| 273 |
+
Lemma vnet_ok : forall f0 f1 f2 f3 f4 f5 f6 f7 y0 y1,
|
| 274 |
+
vnet f0 f1 f2 f3 f4 f5 f6 f7 y0 y1
|
| 275 |
+
= Z.leb 0 (wcode f0 f1 * b2z y0 + wcode f2 f3 * b2z y1 + beta4 f4 f5 f6 f7)%Z.
|
| 276 |
+
Proof. intros. destruct f0, f1, f2, f3, f4, f5, f6, f7, y0, y1; reflexivity. Qed.
|
| 277 |
+
|
| 278 |
+
Lemma F_fb : forall j, j < 26 -> F (fld j) = fb j.
|
| 279 |
+
Proof. exact F_fld. Qed.
|
| 280 |
+
|
| 281 |
+
Lemma F_v : F (SRef 17 0 0) =
|
| 282 |
+
vnet (fb 0) (fb 1) (fb 2) (fb 3) (fb 4) (fb 5) (fb 6) (fb 7) (F (xsref 0)) (F (xsref 1)).
|
| 283 |
+
Proof.
|
| 284 |
+
rewrite (F_or 17 0 0 (map (fun i => (SRef 16 i 0, true)) (seq 0 5))) by (blk_compute; first [lia | reflexivity]).
|
| 285 |
+
cbn [map seq existsb]. rewrite !litv_pos, orb_false_r.
|
| 286 |
+
(* the five conjunctions of a lower bound on the weighted inputs with a lower bound on the bias *)
|
| 287 |
+
assert (Hvand : forall i, i < 5 -> F (SRef 16 i 0) = F (SRef 13 i 0) && F (SRef 15 0 (vand_bge i))).
|
| 288 |
+
{ intros i Hi. rewrite (F_and 16 i 0 [(SRef 13 i 0, true); (SRef 15 0 (vand_bge i), true)])
|
| 289 |
+
by (blk_compute; first [lia | reflexivity]).
|
| 290 |
+
cbn [forallb]. rewrite !litv_pos, andb_true_r. reflexivity. }
|
| 291 |
+
rewrite !Hvand by lia. cbn [vand_bge].
|
| 292 |
+
(* the bias bounds *)
|
| 293 |
+
assert (Hb4 : F (SRef 14 0 0) = fb 5 || fb 6 || fb 7 /\ F (SRef 14 0 1) = fb 5 || fb 6
|
| 294 |
+
/\ F (SRef 14 0 2) = fb 5 && fb 6 && fb 7 /\ F (SRef 14 0 3) = fb 5 && fb 6).
|
| 295 |
+
{ repeat split;
|
| 296 |
+
first [ rewrite F_or with (ls := [(fld 5, true); (fld 6, true); (fld 7, true)]) by (blk_compute; first [lia | reflexivity])
|
| 297 |
+
| rewrite F_or with (ls := [(fld 5, true); (fld 6, true)]) by (blk_compute; first [lia | reflexivity])
|
| 298 |
+
| rewrite F_and with (ls := [(fld 5, true); (fld 6, true); (fld 7, true)]) by (blk_compute; first [lia | reflexivity])
|
| 299 |
+
| rewrite F_and with (ls := [(fld 5, true); (fld 6, true)]) by (blk_compute; first [lia | reflexivity]) ];
|
| 300 |
+
cbn [forallb existsb]; rewrite !litv_pos, !F_fb by lia; rewrite ?orb_false_r, ?andb_true_r, ?orb_assoc, ?andb_assoc;
|
| 301 |
+
reflexivity. }
|
| 302 |
+
destruct Hb4 as (B0 & B1 & B2 & B3).
|
| 303 |
+
rewrite (F_and 15 0 0 [(fld 4, false)]) by (blk_compute; first [lia | reflexivity]).
|
| 304 |
+
rewrite (F_and 15 0 1 [(fld 4, false); (SRef 14 0 0, true)]) by (blk_compute; first [lia | reflexivity]).
|
| 305 |
+
rewrite (F_and 15 0 2 [(fld 4, false); (SRef 14 0 1, true)]) by (blk_compute; first [lia | reflexivity]).
|
| 306 |
+
rewrite (F_or 15 0 3 [(fld 4, false); (SRef 14 0 2, true)]) by (blk_compute; first [lia | reflexivity]).
|
| 307 |
+
rewrite (F_or 15 0 4 [(fld 4, false); (SRef 14 0 3, true)]) by (blk_compute; first [lia | reflexivity]).
|
| 308 |
+
cbn [forallb existsb]. rewrite ?litv_pos, ?litv_neg, B0, B1, B2, B3, !F_fb by lia.
|
| 309 |
+
(* the weighted-input bounds *)
|
| 310 |
+
assert (Hp : forall i, i < 5 -> F (SRef 13 i 0)
|
| 311 |
+
= Z.leb 0 (2 - Z.of_nat i + (1 * b2z (F (SRef 11 0 0)) + (1 * b2z (F (SRef 11 1 0))
|
| 312 |
+
+ (-1 * b2z (F (SRef 12 0 0)) + (-1 * b2z (F (SRef 12 1 0)) + 0)))))%Z).
|
| 313 |
+
{ intros i Hi. rewrite F_unit by (blk_compute; lia). reflexivity. }
|
| 314 |
+
rewrite !Hp by lia.
|
| 315 |
+
assert (Hm : forall i, i < 2 -> F (SRef 11 i 0) = negb (fb (2 * i)) && fb (2 * i + 1) && F (xsref i)
|
| 316 |
+
/\ F (SRef 12 i 0) = fb (2 * i) && negb (fb (2 * i + 1)) && F (xsref i)).
|
| 317 |
+
{ intros i Hi. split.
|
| 318 |
+
- rewrite (F_and 11 i 0 [(SRef 9 i 0, true); (xsref i, true)]) by (blk_compute; first [lia | reflexivity]).
|
| 319 |
+
cbn [forallb]. rewrite !litv_pos, andb_true_r.
|
| 320 |
+
rewrite (F_and 9 i 0 [(fld (2 * i), false); (fld (2 * i + 1), true)]) by (blk_compute; first [lia | reflexivity]).
|
| 321 |
+
cbn [forallb]. rewrite ?litv_pos, ?litv_neg, !F_fb by lia. rewrite !andb_true_r. reflexivity.
|
| 322 |
+
- rewrite (F_and 12 i 0 [(SRef 10 i 0, true); (xsref i, true)]) by (blk_compute; first [lia | reflexivity]).
|
| 323 |
+
cbn [forallb]. rewrite !litv_pos, andb_true_r.
|
| 324 |
+
rewrite (F_and 10 i 0 [(fld (2 * i), true); (fld (2 * i + 1), false)]) by (blk_compute; first [lia | reflexivity]).
|
| 325 |
+
cbn [forallb]. rewrite ?litv_pos, ?litv_neg, !F_fb by lia. rewrite !andb_true_r. reflexivity. }
|
| 326 |
+
destruct (Hm 0 ltac:(lia)) as [M0 N0]. destruct (Hm 1 ltac:(lia)) as [M1 N1].
|
| 327 |
+
cbn [Nat.mul Nat.add] in M0, N0, M1, N1. rewrite M0, N0, M1, N1.
|
| 328 |
+
unfold vnet. generalize (fb 0) (fb 1) (fb 2) (fb 3) (fb 4) (fb 5) (fb 6) (fb 7) (F (xsref 0)) (F (xsref 1)).
|
| 329 |
+
intros f0 f1 f2 f3 f4 f5 f6 f7 y0 y1.
|
| 330 |
+
destruct f0, f1, f2, f3, f4, f5, f6, f7, y0, y1; reflexivity.
|
| 331 |
+
Qed.
|
| 332 |
+
|
| 333 |
+
(* ---- blocks 18 and 19: the window after the write --------------------------------- *)
|
| 334 |
+
Definition vsem : bool := vnet (fb 0) (fb 1) (fb 2) (fb 3) (fb 4) (fb 5) (fb 6) (fb 7) (cellv (fa 8)) (cellv (fa 14)).
|
| 335 |
+
Definition aosem : nat := fa 20.
|
| 336 |
+
|
| 337 |
+
Lemma F_vsem : F (SRef 17 0 0) = vsem.
|
| 338 |
+
Proof. rewrite F_v, (F_xs 0), (F_xs 1) by lia. reflexivity. Qed.
|
| 339 |
+
|
| 340 |
+
Lemma F_lo : forall a, a < 64 -> F (SRef 4 a 0) = Nat.eqb aosem a.
|
| 341 |
+
Proof. intros a Ha. apply F_dec; [right; right; split; reflexivity | exact Ha]. Qed.
|
| 342 |
+
|
| 343 |
+
Lemma realcell_lt : forall j, j < 61 -> realcell j < 64.
|
| 344 |
+
Proof. intros j Hj. unfold realcell. destruct (Nat.eqb j 0); lia. Qed.
|
| 345 |
+
|
| 346 |
+
Lemma F_xhat : forall j, j < 61 ->
|
| 347 |
+
F (SRef 18 j 2) = if Nat.eqb aosem (realcell j) then vsem else wget (win s) (realcell j).
|
| 348 |
+
Proof.
|
| 349 |
+
intros j Hj.
|
| 350 |
+
rewrite (F_mux 18 j 0 (SRef 4 (realcell j) 0) (SRef 17 0 0) (SIn j)) by (blk_compute; first [lia | reflexivity]).
|
| 351 |
+
rewrite F_lo by (apply realcell_lt; exact Hj). rewrite F_vsem, F_in by (unfold nst; lia).
|
| 352 |
+
rewrite X_win by exact Hj. reflexivity.
|
| 353 |
+
Qed.
|
| 354 |
+
|
| 355 |
+
Lemma F_zero : F (SRef 19 0 0) = false.
|
| 356 |
+
Proof. rewrite (F_or 19 0 0 []) by (blk_compute; first [lia | reflexivity]). reflexivity. Qed.
|
| 357 |
+
|
| 358 |
+
(* the request cells after the write *)
|
| 359 |
+
Definition advR : bool := if Nat.eqb aosem 4 then vsem else wget (win s) 4.
|
| 360 |
+
Definition advA : bool := if Nat.eqb aosem 5 then vsem else wget (win s) 5.
|
| 361 |
+
Definition advC : bool := if Nat.eqb aosem 6 then vsem else wget (win s) 6.
|
| 362 |
+
|
| 363 |
+
Lemma F_adv : F (SRef 18 1 2) = advR /\ F (SRef 18 2 2) = advA /\ F (SRef 18 3 2) = advC.
|
| 364 |
+
Proof. repeat split; rewrite F_xhat by lia; reflexivity. Qed.
|
| 365 |
+
|
| 366 |
+
Lemma nth_rot1 : forall l i, i < length l -> nth i (rot1 l) false = nth ((i + 1) mod length l) l false.
|
| 367 |
+
Proof.
|
| 368 |
+
intros [|x t] i Hi; cbn [length] in Hi; [lia|]. cbn [rot1 length].
|
| 369 |
+
destruct (Nat.lt_ge_cases i (length t)) as [H|H].
|
| 370 |
+
- rewrite app_nth1 by exact H. rewrite Nat.mod_small by lia. rewrite Nat.add_1_r. reflexivity.
|
| 371 |
+
- assert (E : i = length t) by lia. subst i. rewrite app_nth2 by lia. rewrite Nat.sub_diag.
|
| 372 |
+
rewrite Nat.add_1_r, Nat.Div0.mod_same. reflexivity.
|
| 373 |
+
Qed.
|
| 374 |
+
|
| 375 |
+
Lemma nth_rotn : forall n l i, i < length l -> nth i (rotn n l) false = nth ((i + n) mod length l) l false.
|
| 376 |
+
Proof.
|
| 377 |
+
induction n as [|n IH]; intros l i Hi.
|
| 378 |
+
- cbn [rotn]. rewrite Nat.add_0_r, Nat.mod_small by exact Hi. reflexivity.
|
| 379 |
+
- cbn [rotn]. rewrite IH by (rewrite rot1_length; exact Hi). rewrite rot1_length.
|
| 380 |
+
rewrite nth_rot1 by (apply Nat.mod_upper_bound; lia).
|
| 381 |
+
rewrite Nat.Div0.add_mod_idemp_l. f_equal. f_equal. lia.
|
| 382 |
+
Qed.
|
| 383 |
+
|
| 384 |
+
(* ---- blocks 20 to 23: the banks --------------------------------------------------- *)
|
| 385 |
+
(* the idle bank after the arm's write, as a list *)
|
| 386 |
+
Definition wrote (l : list bool) (here : bool) : list bool := if here then wr0 l vsem else l.
|
| 387 |
+
|
| 388 |
+
Lemma nth_wrote : forall l here m, m < length l ->
|
| 389 |
+
nth m (wrote l here) false = if Nat.eqb m 0 then (if here then vsem else nth 0 l false) else nth m l false.
|
| 390 |
+
Proof.
|
| 391 |
+
intros l here m Hm. unfold wrote. destruct l as [|x l]; cbn [length] in Hm; [lia|].
|
| 392 |
+
destruct here; destruct m; reflexivity.
|
| 393 |
+
Qed.
|
| 394 |
+
|
| 395 |
+
Lemma F_bank : forall bh bb idlep base T, (bh = 20 /\ bb = 21 /\ idlep = true /\ base = oq0 /\ T = q0 s)
|
| 396 |
+
\/ (bh = 22 /\ bb = 23 /\ idlep = false /\ base = oq1 N /\ T = q1 s) ->
|
| 397 |
+
forall i, i < N ->
|
| 398 |
+
F (SRef bb i 3) =
|
| 399 |
+
if Bool.eqb kk idlep
|
| 400 |
+
then nth i (if advA then rot1 (wrote (contents T) (Nat.eqb aosem 2)) else wrote (contents T) (Nat.eqb aosem 2)) false
|
| 401 |
+
else nth i (rotn 26 (contents T)) false.
|
| 402 |
+
Proof.
|
| 403 |
+
intros bh bb idlep base T Hsel i Hi.
|
| 404 |
+
assert (HT : length (contents T) = N) by (destruct Hsel as [(_ & _ & _ & _ & ->)|(_ & _ & _ & _ & ->)]; assumption).
|
| 405 |
+
assert (Hx : forall m, m < N -> X (base + m) = nth m (contents T) false).
|
| 406 |
+
{ intros m Hm. destruct (X_tape m) as (T0 & T1 & _ & _).
|
| 407 |
+
destruct Hsel as [(_ & _ & _ & -> & ->)|(_ & _ & _ & -> & ->)]; [apply T0|apply T1]; exact Hm. }
|
| 408 |
+
assert (Hb : base + N <= nst N L) by (destruct Hsel as [(_ & _ & _ & -> & _)|(_ & _ & _ & -> & _)]; unfold nst, oq0, oq1; lia).
|
| 409 |
+
assert (Hc : forall j r, j < N -> r < 4 -> bb < 28 /\ j < bcount (nth bb (phys_blocks N L) blk0)
|
| 410 |
+
/\ r < bsize (nth bb (phys_blocks N L) blk0))
|
| 411 |
+
by (intros; destruct Hsel as [(_ & -> & _)|(_ & -> & _)]; blk_compute; lia).
|
| 412 |
+
assert (Hh : forall r, r < 6 -> bh < 28 /\ 0 < bcount (nth bh (phys_blocks N L) blk0)
|
| 413 |
+
/\ r < bsize (nth bh (phys_blocks N L) blk0))
|
| 414 |
+
by (intros; destruct Hsel as [(-> & _)|(-> & _)]; blk_compute; lia).
|
| 415 |
+
assert (Hsu : forall j, sunit (phys_blocks N L) bb j 3 = sOR [(SRef bb j 0, true); (SRef bb j 1, true); (SRef bb j 2, true)]
|
| 416 |
+
/\ sunit (phys_blocks N L) bb j 0 = sAND [(kap, negb idlep); (SIn (base + (j + 26) mod N), true)]
|
| 417 |
+
/\ sunit (phys_blocks N L) bb j 1 = sAND [(SRef bh 0 0, true); (hatq bh base ((j + 1) mod N), true)]
|
| 418 |
+
/\ sunit (phys_blocks N L) bb j 2 = sAND [(SRef bh 0 1, true); (hatq bh base j, true)])
|
| 419 |
+
by (intro j; destruct Hsel as [(-> & -> & -> & -> & _)|(-> & -> & -> & -> & _)]; repeat split; reflexivity).
|
| 420 |
+
destruct (Hsu i) as (S3 & S0 & S1 & S2).
|
| 421 |
+
destruct (Hc i 3 Hi ltac:(lia)) as (C1 & C2 & C3).
|
| 422 |
+
rewrite (F_or bb i 3 _ C1 C2 C3 S3). cbn [existsb]. rewrite !litv_pos, orb_false_r.
|
| 423 |
+
destruct (Hc i 0 Hi ltac:(lia)) as (D1 & D2 & D3). rewrite (F_and bb i 0 _ D1 D2 D3 S0).
|
| 424 |
+
destruct (Hc i 1 Hi ltac:(lia)) as (E1 & E2 & E3). rewrite (F_and bb i 1 _ E1 E2 E3 S1).
|
| 425 |
+
destruct (Hc i 2 Hi ltac:(lia)) as (G1 & G2 & G3). rewrite (F_and bb i 2 _ G1 G2 G3 S2).
|
| 426 |
+
cbn [forallb]. rewrite !litv_pos, !andb_true_r.
|
| 427 |
+
(* the header: ia, ih, wa and the head cell after the write *)
|
| 428 |
+
assert (Hhd : F (SRef bh 0 0) = Bool.eqb kk idlep && advA /\ F (SRef bh 0 1) = Bool.eqb kk idlep && negb advA
|
| 429 |
+
/\ F (SRef bh 0 5) = if Nat.eqb aosem 2 && Bool.eqb kk idlep then vsem else nth 0 (contents T) false).
|
| 430 |
+
{ destruct F_adv as (_ & HA & _).
|
| 431 |
+
destruct (Hh 0 ltac:(lia)) as (H01 & H02 & H03). destruct (Hh 1 ltac:(lia)) as (H11 & H12 & H13).
|
| 432 |
+
destruct (Hh 2 ltac:(lia)) as (H21 & H22 & H23). destruct (Hh 5 ltac:(lia)) as (H51 & H52 & H53).
|
| 433 |
+
assert (U : sunit (phys_blocks N L) bh 0 0 = sAND [(kap, idlep); (SRef 18 2 2, true)]
|
| 434 |
+
/\ sunit (phys_blocks N L) bh 0 1 = sAND [(kap, idlep); (SRef 18 2 2, false)]
|
| 435 |
+
/\ sunit (phys_blocks N L) bh 0 2 = sAND [(SRef 4 2 0, true); (kap, idlep)]
|
| 436 |
+
/\ sunit (phys_blocks N L) bh 0 3 = sAND [(SRef bh 0 2, true); (SRef 17 0 0, true)]
|
| 437 |
+
/\ sunit (phys_blocks N L) bh 0 4 = sAND [(SRef bh 0 2, false); (SIn base, true)]
|
| 438 |
+
/\ sunit (phys_blocks N L) bh 0 5 = sOR [(SRef bh 0 3, true); (SRef bh 0 4, true)])
|
| 439 |
+
by (destruct Hsel as [(-> & -> & -> & -> & _)|(-> & -> & -> & -> & _)]; repeat split; reflexivity).
|
| 440 |
+
destruct U as (U0 & U1 & U2 & U3 & U4 & U5).
|
| 441 |
+
split; [|split].
|
| 442 |
+
- rewrite (F_and bh 0 0 _ H01 H02 H03 U0). cbn [forallb]. unfold litv. cbn [fst snd].
|
| 443 |
+
rewrite F_kap, HA. destruct kk, idlep, advA; reflexivity.
|
| 444 |
+
- rewrite (F_and bh 0 1 _ H11 H12 H13 U1). cbn [forallb]. unfold litv. cbn [fst snd].
|
| 445 |
+
rewrite F_kap, HA. destruct kk, idlep, advA; reflexivity.
|
| 446 |
+
- rewrite (F_mux bh 0 3 (SRef bh 0 2) (SRef 17 0 0) (SIn base) H51 H52 H53 U3 U4 U5).
|
| 447 |
+
rewrite (F_and bh 0 2 _ H21 H22 H23 U2). cbn [forallb]. unfold litv. cbn [fst snd].
|
| 448 |
+
rewrite F_lo, F_kap, F_vsem, F_in by (lia || (pose proof (Hx 0 ltac:(lia)); lia)).
|
| 449 |
+
rewrite <- (Nat.add_0_r base), Hx by lia.
|
| 450 |
+
destruct (Nat.eqb aosem 2), kk, idlep; reflexivity. }
|
| 451 |
+
destruct Hhd as (Hia & Hih & Hh0).
|
| 452 |
+
assert (Hhat : forall m, m < N -> F (hatq bh base m)
|
| 453 |
+
= nth m (wrote (contents T) (Nat.eqb aosem 2 && Bool.eqb kk idlep)) false).
|
| 454 |
+
{ intros m Hm. rewrite nth_wrote by lia. unfold hatq. destruct (Nat.eqb_spec m 0) as [->|E].
|
| 455 |
+
- rewrite Hh0. reflexivity.
|
| 456 |
+
- rewrite F_in by lia. apply Hx. exact Hm. }
|
| 457 |
+
pose proof (Nat.mod_upper_bound (i + 1) N ltac:(lia)). pose proof (Nat.mod_upper_bound (i + 26) N ltac:(lia)).
|
| 458 |
+
rewrite Hia, Hih, !Hhat by lia. unfold litv. cbn [fst snd]. rewrite F_kap, F_in by lia. rewrite Hx by lia.
|
| 459 |
+
destruct (Bool.eqb kk idlep) eqn:Ek.
|
| 460 |
+
- apply Bool.eqb_prop in Ek. subst idlep. rewrite ?eqb_reflx, ?andb_true_r.
|
| 461 |
+
replace (Bool.eqb kk (negb kk)) with false by (destruct kk; reflexivity). cbn [andb orb].
|
| 462 |
+
destruct advA; cbn [andb orb negb]; rewrite ?orb_false_r.
|
| 463 |
+
+ rewrite nth_rot1 by (unfold wrote; destruct (Nat.eqb aosem 2); rewrite ?wr0_length; lia).
|
| 464 |
+
unfold wrote at 2. destruct (Nat.eqb aosem 2); rewrite ?wr0_length, HT; reflexivity.
|
| 465 |
+
+ reflexivity.
|
| 466 |
+
- replace (Bool.eqb kk (negb idlep)) with true
|
| 467 |
+
by (revert Ek; clear; generalize kk; intros b Ek; destruct b, idlep; cbn in Ek |- *; try reflexivity; discriminate).
|
| 468 |
+
cbn [andb orb]. rewrite ?orb_false_r, ?andb_false_r. cbn [orb]. rewrite ?orb_false_r.
|
| 469 |
+
rewrite nth_rotn by lia. rewrite HT. reflexivity.
|
| 470 |
+
Qed.
|
| 471 |
+
|
| 472 |
+
(* ---- blocks 24 to 27: the description tapes -------------------------------------- *)
|
| 473 |
+
Definition wrotec (l : list bool) (here : bool) : list bool := if here then wr0 l vsem else l.
|
| 474 |
+
|
| 475 |
+
Lemma F_desc : forall dh db idlep base T, (dh = 24 /\ db = 25 /\ idlep = true /\ base = od0 N /\ T = d0 s)
|
| 476 |
+
\/ (dh = 26 /\ db = 27 /\ idlep = false /\ base = od1 N L /\ T = d1 s) ->
|
| 477 |
+
forall i, i < L ->
|
| 478 |
+
F (SRef db i 2) =
|
| 479 |
+
if Bool.eqb kk idlep
|
| 480 |
+
then nth i (if advC then rot1 (wrotec (contents T) (Nat.eqb aosem 3)) else wrotec (contents T) (Nat.eqb aosem 3)) false
|
| 481 |
+
else nth i (if advR then rot1 (contents T) else contents T) false.
|
| 482 |
+
Proof.
|
| 483 |
+
intros dh db idlep base T Hsel i Hi.
|
| 484 |
+
assert (HT : length (contents T) = L) by (destruct Hsel as [(_ & _ & _ & _ & ->)|(_ & _ & _ & _ & ->)]; assumption).
|
| 485 |
+
assert (Hx : forall m, m < L -> X (base + m) = nth m (contents T) false).
|
| 486 |
+
{ intros m Hm. destruct (X_tape m) as (_ & _ & T2 & T3).
|
| 487 |
+
destruct Hsel as [(_ & _ & _ & -> & ->)|(_ & _ & _ & -> & ->)]; [apply T2|apply T3]; exact Hm. }
|
| 488 |
+
assert (Hb : base + L <= nst N L)
|
| 489 |
+
by (destruct Hsel as [(_ & _ & _ & -> & _)|(_ & _ & _ & -> & _)]; unfold nst, od0, od1; lia).
|
| 490 |
+
assert (Hh : forall r, r < 7 -> dh < 28 /\ 0 < bcount (nth dh (phys_blocks N L) blk0)
|
| 491 |
+
/\ r < bsize (nth dh (phys_blocks N L) blk0))
|
| 492 |
+
by (intros; destruct Hsel as [(-> & _)|(-> & _)]; blk_compute; lia).
|
| 493 |
+
assert (U : sunit (phys_blocks N L) dh 0 0 = sAND [(kap, negb idlep); (SRef 18 1 2, true)]
|
| 494 |
+
/\ sunit (phys_blocks N L) dh 0 1 = sAND [(kap, idlep); (SRef 18 3 2, true)]
|
| 495 |
+
/\ sunit (phys_blocks N L) dh 0 2 = sOR [(SRef dh 0 0, true); (SRef dh 0 1, true)]
|
| 496 |
+
/\ sunit (phys_blocks N L) dh 0 3 = sAND [(SRef 4 3 0, true); (kap, idlep)]
|
| 497 |
+
/\ sunit (phys_blocks N L) dh 0 4 = sAND [(SRef dh 0 3, true); (SRef 17 0 0, true)]
|
| 498 |
+
/\ sunit (phys_blocks N L) dh 0 5 = sAND [(SRef dh 0 3, false); (SIn base, true)]
|
| 499 |
+
/\ sunit (phys_blocks N L) dh 0 6 = sOR [(SRef dh 0 4, true); (SRef dh 0 5, true)])
|
| 500 |
+
by (destruct Hsel as [(-> & -> & -> & -> & _)|(-> & -> & -> & -> & _)]; repeat split; reflexivity).
|
| 501 |
+
destruct U as (U0 & U1 & U2 & U3 & U4 & U5 & U6).
|
| 502 |
+
destruct F_adv as (HR & _ & HC).
|
| 503 |
+
(* the rotation request and the head cell after the copy head's write *)
|
| 504 |
+
assert (Hrot : F (SRef dh 0 2) = if Bool.eqb kk idlep then advC else advR).
|
| 505 |
+
{ destruct (Hh 2 ltac:(lia)) as (A1 & A2 & A3). rewrite (F_or dh 0 2 _ A1 A2 A3 U2). cbn [existsb].
|
| 506 |
+
destruct (Hh 0 ltac:(lia)) as (B1 & B2 & B3). destruct (Hh 1 ltac:(lia)) as (C1 & C2 & C3).
|
| 507 |
+
rewrite !litv_pos, (F_and dh 0 0 _ B1 B2 B3 U0), (F_and dh 0 1 _ C1 C2 C3 U1).
|
| 508 |
+
cbn [forallb]. unfold litv. cbn [fst snd]. rewrite F_kap, HR, HC.
|
| 509 |
+
destruct kk, idlep, advR, advC; reflexivity. }
|
| 510 |
+
assert (Hh0 : F (SRef dh 0 6) = if Nat.eqb aosem 3 && Bool.eqb kk idlep then vsem else nth 0 (contents T) false).
|
| 511 |
+
{ destruct (Hh 6 ltac:(lia)) as (A1 & A2 & A3).
|
| 512 |
+
rewrite (F_mux dh 0 4 (SRef dh 0 3) (SRef 17 0 0) (SIn base) A1 A2 A3 U4 U5 U6).
|
| 513 |
+
destruct (Hh 3 ltac:(lia)) as (B1 & B2 & B3). rewrite (F_and dh 0 3 _ B1 B2 B3 U3).
|
| 514 |
+
cbn [forallb]. unfold litv. cbn [fst snd].
|
| 515 |
+
rewrite F_lo, F_kap, F_vsem, F_in by (lia || (pose proof (Hx 0 ltac:(lia)); lia)).
|
| 516 |
+
rewrite <- (Nat.add_0_r base), Hx by lia.
|
| 517 |
+
destruct (Nat.eqb aosem 3), kk, idlep; reflexivity. }
|
| 518 |
+
assert (Hhat : forall m, m < L -> F (hatd dh base m)
|
| 519 |
+
= nth m (wrotec (contents T) (Nat.eqb aosem 3 && Bool.eqb kk idlep)) false).
|
| 520 |
+
{ intros m Hm. unfold wrotec. destruct (contents T) as [|x t] eqn:Ec; [cbn [length] in HT; lia|].
|
| 521 |
+
unfold hatd. destruct (Nat.eqb_spec m 0) as [->|E].
|
| 522 |
+
- rewrite Hh0. destruct (Nat.eqb aosem 3 && Bool.eqb kk idlep); reflexivity.
|
| 523 |
+
- rewrite F_in by lia. rewrite Hx by exact Hm.
|
| 524 |
+
destruct (Nat.eqb aosem 3 && Bool.eqb kk idlep); [destruct m; [lia|]|]; reflexivity. }
|
| 525 |
+
assert (Hm3 : sunit (phys_blocks N L) db i 0 = sAND [(SRef dh 0 2, true); (hatd dh base ((i + 1) mod L), true)]
|
| 526 |
+
/\ sunit (phys_blocks N L) db i 1 = sAND [(SRef dh 0 2, false); (hatd dh base i, true)]
|
| 527 |
+
/\ sunit (phys_blocks N L) db i 2 = sOR [(SRef db i 0, true); (SRef db i 1, true)])
|
| 528 |
+
by (destruct Hsel as [(-> & -> & _ & -> & _)|(-> & -> & _ & -> & _)]; repeat split; reflexivity).
|
| 529 |
+
destruct Hm3 as (M0 & M1 & M2).
|
| 530 |
+
assert (Hc : db < 28 /\ i < bcount (nth db (phys_blocks N L) blk0) /\ 2 < bsize (nth db (phys_blocks N L) blk0))
|
| 531 |
+
by (destruct Hsel as [(_ & -> & _)|(_ & -> & _)]; blk_compute; lia).
|
| 532 |
+
destruct Hc as (C1 & C2 & C3).
|
| 533 |
+
rewrite (F_mux db i 0 (SRef dh 0 2) (hatd dh base ((i + 1) mod L)) (hatd dh base i) C1 C2 C3 M0 M1 M2).
|
| 534 |
+
pose proof (Nat.mod_upper_bound (i + 1) L ltac:(lia)).
|
| 535 |
+
rewrite Hrot, !Hhat by lia.
|
| 536 |
+
assert (Hlw : forall here, length (wrotec (contents T) here) = L)
|
| 537 |
+
by (intro here; unfold wrotec; destruct here; rewrite ?wr0_length; exact HT).
|
| 538 |
+
destruct (Bool.eqb kk idlep); rewrite ?andb_true_r, ?andb_false_r.
|
| 539 |
+
- destruct advC; [|reflexivity]. rewrite nth_rot1 by (rewrite Hlw; exact Hi). rewrite Hlw. reflexivity.
|
| 540 |
+
- destruct advR; [|reflexivity]. rewrite nth_rot1 by (rewrite HT; exact Hi). rewrite HT. reflexivity.
|
| 541 |
+
Qed.
|
| 542 |
+
|
| 543 |
+
(* ---- one step of the machine in the same terms ------------------------------------ *)
|
| 544 |
+
Hypothesis Hw : length (win s) = 64.
|
| 545 |
+
|
| 546 |
+
Lemma firstn_skipn_firstn : forall (l : list bool) a b c, a + b <= c ->
|
| 547 |
+
firstn b (skipn a (firstn c l)) = firstn b (skipn a l).
|
| 548 |
+
Proof. intros l a b c H. rewrite skipn_firstn_comm, firstn_firstn. f_equal. lia. Qed.
|
| 549 |
+
|
| 550 |
+
Lemma firstn4_skipn4 : forall (l : list bool), 8 <= length l ->
|
| 551 |
+
firstn 4 (skipn 4 l) = [nth 4 l false; nth 5 l false; nth 6 l false; nth 7 l false].
|
| 552 |
+
Proof.
|
| 553 |
+
intros l H. destruct l as [|x0 [|x1 [|x2 [|x3 [|x4 [|x5 [|x6 [|x7 l]]]]]]]]; cbn [length] in H; try lia.
|
| 554 |
+
reflexivity.
|
| 555 |
+
Qed.
|
| 556 |
+
|
| 557 |
+
Lemma decode_qa : decode (firstn 26 qa) =
|
| 558 |
+
Rec (fa 8) (wcode (fb 0) (fb 1)) (fa 14) (wcode (fb 2) (fb 3)) (beta4 (fb 4) (fb 5) (fb 6) (fb 7)) (fa 20).
|
| 559 |
+
Proof.
|
| 560 |
+
unfold decode. cbv zeta. unfold fa, field, fb, beta4.
|
| 561 |
+
rewrite !firstn_skipn_firstn by lia. rewrite !nth_firstn. cbn [Nat.ltb Nat.leb].
|
| 562 |
+
rewrite firstn4_skipn4 by (rewrite length_qa; lia). reflexivity.
|
| 563 |
+
Qed.
|
| 564 |
+
|
| 565 |
+
Lemma cellof_cellv : forall a, cellof s kk a = cellv a.
|
| 566 |
+
Proof. intro a. unfold cellof, cellv, rdv, armv, cpyv. rewrite !hd_t_contents. reflexivity. Qed.
|
| 567 |
+
|
| 568 |
+
Lemma step_eq : exists qa', contents qa' = rotn 26 qa /\ step s = stepres s kk qa' aosem vsem.
|
| 569 |
+
Proof.
|
| 570 |
+
destruct (popn 26 (if kk then q1 s else q0 s)) as [bits qa'] eqn:Ep.
|
| 571 |
+
exists qa'. split.
|
| 572 |
+
- pose proof (popn_turns 26 (if kk then q1 s else q0 s)) as P. rewrite Ep in P. exact P.
|
| 573 |
+
- assert (Hbits : bits = firstn 26 qa).
|
| 574 |
+
{ pose proof (popn_reads 26 (if kk then q1 s else q0 s)) as P. rewrite Ep in P. apply P.
|
| 575 |
+
fold qa. rewrite length_qa. lia. }
|
| 576 |
+
apply (step_char s kk bits qa' (fa 8) (wcode (fb 0) (fb 1)) (fa 14) (wcode (fb 2) (fb 3))
|
| 577 |
+
(beta4 (fb 4) (fb 5) (fb 6) (fb 7)) (fa 20) vsem eq_refl Ep).
|
| 578 |
+
+ rewrite Hbits. apply decode_qa.
|
| 579 |
+
+ unfold vsem. rewrite vnet_ok, !cellof_cellv. reflexivity.
|
| 580 |
+
Qed.
|
| 581 |
+
|
| 582 |
+
Lemma aosem_lt : aosem < 64.
|
| 583 |
+
Proof. apply fa_lt. lia. Qed.
|
| 584 |
+
|
| 585 |
+
Lemma wget_wn : forall a, a < 64 -> a <> 1 -> a <> 2 -> a <> 3 ->
|
| 586 |
+
wget (wnext (win s) aosem vsem) a = if Nat.eqb aosem a then vsem else wget (win s) a.
|
| 587 |
+
Proof.
|
| 588 |
+
intros a Ha H1 H2 H3. unfold wnext.
|
| 589 |
+
destruct (Nat.eqb aosem RD || Nat.eqb aosem ARM || Nat.eqb aosem CPY) eqn:E.
|
| 590 |
+
- destruct (Nat.eqb_spec aosem a) as [E2|E2]; [|reflexivity].
|
| 591 |
+
exfalso. rewrite E2 in E. unfold RD, ARM, CPY in E.
|
| 592 |
+
apply orb_true_iff in E as [E|E]; [apply orb_true_iff in E as [E|E]|]; apply Nat.eqb_eq in E; lia.
|
| 593 |
+
- rewrite wget_upd, Hw. pose proof aosem_lt.
|
| 594 |
+
destruct (Nat.eqb_spec aosem a) as [E2|E2].
|
| 595 |
+
+ rewrite E2, Nat.eqb_refl. replace (a <? 64) with true by (symmetry; apply Nat.ltb_lt; lia). reflexivity.
|
| 596 |
+
+ replace (Nat.eqb a aosem) with false by (symmetry; apply Nat.eqb_neq; lia). reflexivity.
|
| 597 |
+
Qed.
|
| 598 |
+
|
| 599 |
+
Lemma adv_wn : wget (wnext (win s) aosem vsem) AA = advA /\ wget (wnext (win s) aosem vsem) AR = advR
|
| 600 |
+
/\ wget (wnext (win s) aosem vsem) AC = advC.
|
| 601 |
+
Proof. unfold AA, AR, AC, advA, advR, advC. repeat split; apply wget_wn; lia. Qed.
|
| 602 |
+
|
| 603 |
+
Lemma tapes_step : forall qa', contents qa' = rotn 26 qa ->
|
| 604 |
+
let t := stepres s kk qa' aosem vsem in
|
| 605 |
+
contents (q0 t) = (if kk then (if advA then rot1 (wrote (contents (q0 s)) (Nat.eqb aosem 2))
|
| 606 |
+
else wrote (contents (q0 s)) (Nat.eqb aosem 2))
|
| 607 |
+
else rotn 26 (contents (q0 s)))
|
| 608 |
+
/\ contents (q1 t) = (if kk then rotn 26 (contents (q1 s))
|
| 609 |
+
else (if advA then rot1 (wrote (contents (q1 s)) (Nat.eqb aosem 2))
|
| 610 |
+
else wrote (contents (q1 s)) (Nat.eqb aosem 2)))
|
| 611 |
+
/\ contents (d0 t) = (if kk then (if advC then rot1 (wrotec (contents (d0 s)) (Nat.eqb aosem 3))
|
| 612 |
+
else wrotec (contents (d0 s)) (Nat.eqb aosem 3))
|
| 613 |
+
else (if advR then rot1 (contents (d0 s)) else contents (d0 s)))
|
| 614 |
+
/\ contents (d1 t) = (if kk then (if advR then rot1 (contents (d1 s)) else contents (d1 s))
|
| 615 |
+
else (if advC then rot1 (wrotec (contents (d1 s)) (Nat.eqb aosem 3))
|
| 616 |
+
else wrotec (contents (d1 s)) (Nat.eqb aosem 3))).
|
| 617 |
+
Proof.
|
| 618 |
+
intros qa' Hqa t. unfold t, stepres. cbv zeta.
|
| 619 |
+
destruct adv_wn as (EA & ER & EC). rewrite EA, ER, EC.
|
| 620 |
+
unfold qa in Hqa. unfold wrote, wrotec, ARM, CPY.
|
| 621 |
+
destruct kk; cbn [q0 q1 d0 d1];
|
| 622 |
+
repeat split;
|
| 623 |
+
repeat match goal with |- context [if ?b then _ else _] => destruct b end;
|
| 624 |
+
rewrite ?turn1_contents, ?wr_t_contents; try exact Hqa; reflexivity.
|
| 625 |
+
Qed.
|
| 626 |
+
|
| 627 |
+
End Sem.
|
| 628 |
+
|
| 629 |
+
(* ---- the netlist computes the step -------------------------------------------------- *)
|
| 630 |
+
Lemma nth_encode : forall s N L i,
|
| 631 |
+
length (contents (q0 s)) = N -> length (contents (q1 s)) = N ->
|
| 632 |
+
length (contents (d0 s)) = L -> length (contents (d1 s)) = L ->
|
| 633 |
+
nth i (encode s) false =
|
| 634 |
+
if i <? 61 then wget (win s) (realcell i)
|
| 635 |
+
else if i <? 61 + N then nth (i - 61) (contents (q0 s)) false
|
| 636 |
+
else if i <? 61 + 2 * N then nth (i - 61 - N) (contents (q1 s)) false
|
| 637 |
+
else if i <? 61 + 2 * N + L then nth (i - 61 - 2 * N) (contents (d0 s)) false
|
| 638 |
+
else nth (i - 61 - 2 * N - L) (contents (d1 s)) false.
|
| 639 |
+
Proof.
|
| 640 |
+
intros s N L i H0 H1 H2 H3. unfold encode.
|
| 641 |
+
destruct (Nat.ltb_spec i 61).
|
| 642 |
+
{ rewrite app_nth1 by (rewrite length_map, length_seq; lia).
|
| 643 |
+
exact (nth_map_seq _ (fun j => wget (win s) (realcell j)) 61 i false H). }
|
| 644 |
+
rewrite app_nth2 by (rewrite length_map, length_seq; lia). rewrite length_map, length_seq.
|
| 645 |
+
destruct (Nat.ltb_spec i (61 + N)).
|
| 646 |
+
{ rewrite app_nth1 by lia. reflexivity. }
|
| 647 |
+
rewrite app_nth2 by lia. rewrite H0.
|
| 648 |
+
destruct (Nat.ltb_spec i (61 + 2 * N)).
|
| 649 |
+
{ rewrite app_nth1 by lia. f_equal; lia. }
|
| 650 |
+
rewrite app_nth2 by lia. rewrite H1.
|
| 651 |
+
destruct (Nat.ltb_spec i (61 + 2 * N + L)).
|
| 652 |
+
{ rewrite app_nth1 by lia. f_equal; lia. }
|
| 653 |
+
rewrite app_nth2 by lia. rewrite H2. f_equal; lia.
|
| 654 |
+
Qed.
|
| 655 |
+
|
rocq/PhysWF.v
ADDED
|
@@ -0,0 +1,64 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
(* The physics netlist reads, at every unit, only state bits and earlier units. *)
|
| 2 |
+
From Stdlib Require Import List Bool Arith ZArith Lia.
|
| 3 |
+
Import ListNotations.
|
| 4 |
+
From TH Require Import TwoHead Net Gates Phys.
|
| 5 |
+
|
| 6 |
+
Lemma phys_shaped : forall N L, Forall shaped (phys_blocks N L).
|
| 7 |
+
Proof.
|
| 8 |
+
intros N L. unfold phys_blocks.
|
| 9 |
+
repeat apply Forall_cons; try apply Forall_nil; intros j Hj; reflexivity.
|
| 10 |
+
Qed.
|
| 11 |
+
|
| 12 |
+
Lemma phys_length : forall N L, length (phys_blocks N L) = 28.
|
| 13 |
+
Proof. reflexivity. Qed.
|
| 14 |
+
|
| 15 |
+
Ltac unfold_layout := unfold nst, oq0, oq1, od0, od1 in *.
|
| 16 |
+
|
| 17 |
+
(* a reference to an earlier block, or to an earlier unit of the same member, or a state bit *)
|
| 18 |
+
Ltac rb_solve :=
|
| 19 |
+
cbn [reads_back];
|
| 20 |
+
first
|
| 21 |
+
[ unfold_layout; lia
|
| 22 |
+
| right; split; [reflexivity|]; split; [reflexivity|]; lia
|
| 23 |
+
| left; split; [lia|];
|
| 24 |
+
cbn [nth phys_blocks bcount bsize blk_fld blk_head blk_dec blk_term blk_xs blk_pos blk_neg blk_mt
|
| 25 |
+
blk_nt blk_pge blk_b4 blk_bge blk_vand blk_v blk_xhat blk_zero blk_bankh blk_bank blk_desch blk_desc];
|
| 26 |
+
split; lia ].
|
| 27 |
+
|
| 28 |
+
Ltac crush_in Hin :=
|
| 29 |
+
cbn [nth mux3 sin sAND sOR map lw fst snd seq app kap fld xsref vand_bge] in Hin;
|
| 30 |
+
repeat (destruct Hin as [Hin|Hin]; [injection Hin as <- <-|]); try destruct Hin.
|
| 31 |
+
|
| 32 |
+
(* open the helpers that name signals, splitting on the cases they distinguish *)
|
| 33 |
+
Ltac open_refs :=
|
| 34 |
+
unfold kap, hatq, hatd, cellref, xsref, realcell in *;
|
| 35 |
+
try match goal with |- context [vand_bge ?j] => destruct j as [|[|[|[|j]]]]; cbn [vand_bge] end;
|
| 36 |
+
try match goal with |- context [head_src _ _ ?j] => destruct j as [|[|j]]; cbn [head_src fst snd] end;
|
| 37 |
+
repeat match goal with |- context [if ?c then _ else _] => destruct c eqn:? end;
|
| 38 |
+
repeat match goal with
|
| 39 |
+
| H : (_ =? _) = true |- _ => apply Nat.eqb_eq in H
|
| 40 |
+
| H : (_ =? _) = false |- _ => apply Nat.eqb_neq in H
|
| 41 |
+
| H : (_ || _) = true |- _ => apply orb_true_iff in H as [H|H]
|
| 42 |
+
| H : (_ || _) = false |- _ => apply orb_false_iff in H as [? H]
|
| 43 |
+
end.
|
| 44 |
+
|
| 45 |
+
Ltac split_blocks b :=
|
| 46 |
+
destruct b as [|b];
|
| 47 |
+
[ cbn [nth phys_blocks bcount bsize bshape blk_fld blk_head blk_dec blk_term blk_xs blk_pos blk_neg
|
| 48 |
+
blk_mt blk_nt blk_pge blk_b4 blk_bge blk_vand blk_v blk_xhat blk_zero blk_bankh blk_bank
|
| 49 |
+
blk_desch blk_desc] in *
|
| 50 |
+
| first [lia | split_blocks b] ].
|
| 51 |
+
|
| 52 |
+
Lemma phys_wf : forall N L, 26 <= N -> 1 <= L -> wf (phys_blocks N L) (nst N L).
|
| 53 |
+
Proof.
|
| 54 |
+
intros N L HN HL. split; [apply phys_shaped|].
|
| 55 |
+
intros b j r x w Hb Hj Hr Hin. unfold sunit in Hin. rewrite phys_length in Hb.
|
| 56 |
+
assert (M1 : forall i, (i + 26) mod N < N) by (intro i; apply Nat.mod_upper_bound; lia).
|
| 57 |
+
assert (M2 : forall i, (i + 1) mod N < N) by (intro i; apply Nat.mod_upper_bound; lia).
|
| 58 |
+
assert (M3 : forall i, (i + 1) mod L < L) by (intro i; apply Nat.mod_upper_bound; lia).
|
| 59 |
+
split_blocks b.
|
| 60 |
+
all: repeat (destruct r as [|r]; [crush_in Hin | try (exfalso; lia)]).
|
| 61 |
+
all: try lia.
|
| 62 |
+
all: try rb_solve.
|
| 63 |
+
all: try (pose proof (M1 j); pose proof (M2 j); pose proof (M3 j)); open_refs; try rb_solve.
|
| 64 |
+
Qed.
|
rocq/Run.v
ADDED
|
@@ -0,0 +1,93 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
(* The decoder's passes carried out by the two-head physics, and the theorems they give. *)
|
| 2 |
+
From Stdlib Require Import List Bool Arith ZArith Lia.
|
| 3 |
+
Import ListNotations.
|
| 4 |
+
From TH Require Import TwoHead Tapes Iter Abstract Spec Organism PassCheck PassLemma Decoder.
|
| 5 |
+
|
| 6 |
+
(* the physical state s carries the decoder state t, the tapes in the roles of the bank bit k0 *)
|
| 7 |
+
Definition matches (k0 : bool) (t : dst) (s : st) : Prop :=
|
| 8 |
+
length (win s) = 64
|
| 9 |
+
/\ (forall i, relevant i = true -> wget (win s) i = wget (wcfg (dc t) (dk t)) i)
|
| 10 |
+
/\ contents (if k0 then d1 s else d0 s) = dR t
|
| 11 |
+
/\ contents (if k0 then q0 s else q1 s) = dA t
|
| 12 |
+
/\ contents (if k0 then d0 s else d1 s) = dK t
|
| 13 |
+
/\ contents (if k0 then q1 s else q0 s) = enc organism.
|
| 14 |
+
|
| 15 |
+
Lemma reach_step : forall cf k r, reachable cf = true -> reachable (ncf (dpass cf k r)) = true.
|
| 16 |
+
Proof.
|
| 17 |
+
intros [p n e3 e2 e1 e0 m] k r H. unfold reachable in H. cbn [ph Spec.z] in H.
|
| 18 |
+
unfold dpass. cbn [ph Spec.z Spec.c3 Spec.c2 Spec.c1 Spec.c0 mo].
|
| 19 |
+
destruct p; apply Nat.leb_le in H; destruct (Nat.eqb n 0) eqn:E;
|
| 20 |
+
repeat match goal with |- context [if ?b then _ else _] => destruct b end;
|
| 21 |
+
cbn [ncf reachable ph Spec.z]; apply Nat.leb_le; lia.
|
| 22 |
+
Qed.
|
| 23 |
+
|
| 24 |
+
Lemma dstep_ne : forall t, dR t <> [] -> dA t <> [] -> dK t <> [] ->
|
| 25 |
+
dR (dstep t) <> [] /\ dA (dstep t) <> [] /\ dK (dstep t) <> [].
|
| 26 |
+
Proof.
|
| 27 |
+
intros [c k R A K] HR HA HK. cbn [dR dA dK] in *.
|
| 28 |
+
destruct R as [|r R]; [congruence|]. destruct A as [|a A]; [congruence|].
|
| 29 |
+
destruct K as [|y K]; [congruence|].
|
| 30 |
+
unfold dstep. cbn [dR dA dK dc dk hd tl].
|
| 31 |
+
repeat split;
|
| 32 |
+
match goal with |- (if ?b then _ else _) <> [] => destruct b end;
|
| 33 |
+
cbn [rot1]; try discriminate;
|
| 34 |
+
intro Hn; apply app_eq_nil in Hn as [_ Hn]; discriminate.
|
| 35 |
+
Qed.
|
| 36 |
+
|
| 37 |
+
Lemma pass_matches : forall k0 t s, matches k0 t s -> dk t = k0 -> reachable (dc t) = true ->
|
| 38 |
+
dR t <> [] -> dA t <> [] -> dK t <> [] ->
|
| 39 |
+
matches k0 (dstep t) (itern G s).
|
| 40 |
+
Proof.
|
| 41 |
+
intros k0 [c k R A K] s (Hl & Hw & HR & HA & HK & HQ) Hk Hreach HRn HAn HKn.
|
| 42 |
+
cbn [dc dk dR dA dK] in *. subst k.
|
| 43 |
+
destruct R as [|r restR]; [congruence|]. destruct A as [|x restA]; [congruence|].
|
| 44 |
+
destruct K as [|y restK]; [congruence|].
|
| 45 |
+
destruct (machine_pass c k0 r x y restR restA restK s Hreach Hl Hw HR HA HK HQ
|
| 46 |
+
(dpass c k0 r) (itern G s) eq_refl eq_refl) as (Hw' & Hl' & HR' & HA' & HK' & HQ').
|
| 47 |
+
unfold matches, dstep. cbn [dc dk dR dA dK hd tl].
|
| 48 |
+
refine (conj Hl' (conj Hw' (conj _ (conj _ (conj _ HQ'))))).
|
| 49 |
+
- rewrite HR'. destruct (cons (dpass c k0 r)); reflexivity.
|
| 50 |
+
- rewrite HA'. destruct (emit (dpass c k0 r)); reflexivity.
|
| 51 |
+
- rewrite HK'. destruct (cw (dpass c k0 r)); reflexivity.
|
| 52 |
+
Qed.
|
| 53 |
+
|
| 54 |
+
Lemma stable_tail : forall k n t, stable k (S n) t -> stable k n (dstep t).
|
| 55 |
+
Proof. intros k n t H j Hj. rewrite <- dsteps_S. apply H. lia. Qed.
|
| 56 |
+
|
| 57 |
+
Lemma run_matches : forall n k0 t s, matches k0 t s -> stable k0 n t -> reachable (dc t) = true ->
|
| 58 |
+
dR t <> [] -> dA t <> [] -> dK t <> [] ->
|
| 59 |
+
matches k0 (dsteps n t) (itern (n * G) s).
|
| 60 |
+
Proof.
|
| 61 |
+
induction n as [|n IH]; intros k0 t s Hm Hs Hr HR HA HK; [exact Hm|].
|
| 62 |
+
rewrite dsteps_S. change (S n * G) with (G + n * G). rewrite itern_add.
|
| 63 |
+
destruct (dstep_ne t HR HA HK) as (HR' & HA' & HK').
|
| 64 |
+
apply IH; auto.
|
| 65 |
+
- apply pass_matches; auto. apply (Hs 0). lia.
|
| 66 |
+
- apply stable_tail. exact Hs.
|
| 67 |
+
- unfold dstep. cbn [dc]. apply reach_step. exact Hr.
|
| 68 |
+
Qed.
|
| 69 |
+
|
| 70 |
+
(* ---- universal construction ----------------------------------------------------- *)
|
| 71 |
+
(* Let the active bank hold the organism, the window a codon start in construct mode, the read
|
| 72 |
+
tape a description d of a nonempty record image X, the arm a tape as long as X and the copy
|
| 73 |
+
tape one as long as d. After 30 passes per record of X, 4 on the end codon and one per bit
|
| 74 |
+
of d, each pass G = 133 steps, the arm holds X, the copy tape and the read tape hold d, the
|
| 75 |
+
bank still holding the organism, and the bank bit has flipped, so that from the next step
|
| 76 |
+
on the physics executes the records of X. *)
|
| 77 |
+
Theorem universal_construction : forall d X k A0 K0 s b3 b2 b1 b0,
|
| 78 |
+
translate d = Some X -> X <> [] -> length A0 = length X -> length K0 = length d ->
|
| 79 |
+
matches k (mkD (mkC PC 3 b3 b2 b1 b0 false) k d A0 K0) s ->
|
| 80 |
+
exists nrec, length X = 26 * nrec
|
| 81 |
+
/\ matches k (mkD (mkC PC 3 true true true true false) (negb k) d X d)
|
| 82 |
+
(itern ((30 * nrec + 4 + length d) * G) s).
|
| 83 |
+
Proof.
|
| 84 |
+
intros d X k A0 K0 s b3 b2 b1 b0 Ht HX HA HK Hm.
|
| 85 |
+
destruct (generation d X k A0 K0 b3 b2 b1 b0 Ht HA HK) as (nrec & Hn & Hs & He).
|
| 86 |
+
exists nrec. split; [exact Hn|]. rewrite <- He.
|
| 87 |
+
apply run_matches; auto.
|
| 88 |
+
- cbn [dR]. unfold translate in Ht. pose proof (translate_aux_long _ _ _ Ht).
|
| 89 |
+
destruct d; [cbn [length] in *; lia | discriminate].
|
| 90 |
+
- cbn [dA]. destruct A0; [destruct X; [congruence | discriminate] | discriminate].
|
| 91 |
+
- cbn [dK]. unfold translate in Ht. pose proof (translate_aux_long _ _ _ Ht).
|
| 92 |
+
destruct K0; [cbn [length] in *; lia | discriminate].
|
| 93 |
+
Qed.
|
rocq/SelfRep.v
ADDED
|
@@ -0,0 +1,115 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
(* Exact self-reproduction of the translating organism on the two-head physics,
|
| 2 |
+
checked by evaluating the run in the kernel. *)
|
| 3 |
+
From Stdlib Require Import List Bool Arith ZArith Lia.
|
| 4 |
+
Import ListNotations.
|
| 5 |
+
From TH Require Import TwoHead Organism Iter.
|
| 6 |
+
|
| 7 |
+
Definition T1 : positive := 920892%positive.
|
| 8 |
+
|
| 9 |
+
Definition holds_two_copies (s : st) : bool :=
|
| 10 |
+
lbeq (contents (q0 s)) rho && lbeq (contents (q1 s)) rho
|
| 11 |
+
&& lbeq (contents (d0 s)) desc && lbeq (contents (d1 s)) desc.
|
| 12 |
+
|
| 13 |
+
Definition same_state (s t : st) : bool :=
|
| 14 |
+
lbeq (win s) (win t)
|
| 15 |
+
&& lbeq (contents (q0 s)) (contents (q0 t)) && lbeq (contents (q1 s)) (contents (q1 t))
|
| 16 |
+
&& lbeq (contents (d0 s)) (contents (d0 t)) && lbeq (contents (d1 s)) (contents (d1 t)).
|
| 17 |
+
|
| 18 |
+
(* the first hand-over: kappa is 0 before it, then 1, with both copies in place *)
|
| 19 |
+
Definition judge (x : option st) : bool :=
|
| 20 |
+
match x with None => false | Some t => wget (win t) KAPPA && holds_two_copies t end.
|
| 21 |
+
|
| 22 |
+
(* the second hand-over: kappa back at 0, with both copies in place *)
|
| 23 |
+
Definition judge2 (t : st) : bool := negb (wget (win t) KAPPA) && holds_two_copies t.
|
| 24 |
+
|
| 25 |
+
(* ---- what the run is checked to do, in the form the theorems consume ---- *)
|
| 26 |
+
Lemma translate_desc : translate desc = Some rho.
|
| 27 |
+
Proof. vm_compute. reflexivity. Qed.
|
| 28 |
+
|
| 29 |
+
Lemma lengths : length rho = 3458 /\ length desc = 2930.
|
| 30 |
+
Proof. split; vm_compute; reflexivity. Qed.
|
| 31 |
+
|
| 32 |
+
Lemma first_generation_ok : judge (kfp T1 s0) = true.
|
| 33 |
+
Proof. vm_compute. reflexivity. Qed.
|
| 34 |
+
|
| 35 |
+
Lemma second_generation_ok : judge2 (iterp (2 * T1) s0) = true.
|
| 36 |
+
Proof. vm_compute. reflexivity. Qed.
|
| 37 |
+
|
| 38 |
+
Lemma period_ok : same_state (iterp (3 * T1) s0) (iterp T1 s0) = true.
|
| 39 |
+
Proof. vm_compute. reflexivity. Qed.
|
| 40 |
+
|
| 41 |
+
(* ---- what the checks mean, for any run ---------------------------------- *)
|
| 42 |
+
Lemma judge_sound : forall p s, judge (kfp p s) = true ->
|
| 43 |
+
(forall n, n < Pos.to_nat p -> wget (win (itern n s)) KAPPA = false)
|
| 44 |
+
/\ wget (win (itern (Pos.to_nat p) s)) KAPPA = true
|
| 45 |
+
/\ contents (q0 (itern (Pos.to_nat p) s)) = rho
|
| 46 |
+
/\ contents (q1 (itern (Pos.to_nat p) s)) = rho
|
| 47 |
+
/\ contents (d0 (itern (Pos.to_nat p) s)) = desc
|
| 48 |
+
/\ contents (d1 (itern (Pos.to_nat p) s)) = desc.
|
| 49 |
+
Proof.
|
| 50 |
+
intros p s H. unfold judge in H.
|
| 51 |
+
destruct (kfp p s) as [t|] eqn:E; [|discriminate].
|
| 52 |
+
destruct (kfp_sound _ _ _ E) as [Ht Hk]. subst t.
|
| 53 |
+
unfold holds_two_copies in H.
|
| 54 |
+
apply andb_prop in H as [Hkap H].
|
| 55 |
+
apply andb_prop in H as [H H4]. apply andb_prop in H as [H H3]. apply andb_prop in H as [H1 H2].
|
| 56 |
+
exact (conj Hk (conj Hkap (conj (lbeq_true _ _ H1) (conj (lbeq_true _ _ H2)
|
| 57 |
+
(conj (lbeq_true _ _ H3) (lbeq_true _ _ H4)))))).
|
| 58 |
+
Qed.
|
| 59 |
+
|
| 60 |
+
Lemma judge2_sound : forall p s, judge2 (iterp p s) = true ->
|
| 61 |
+
wget (win (itern (Pos.to_nat p) s)) KAPPA = false
|
| 62 |
+
/\ contents (q0 (itern (Pos.to_nat p) s)) = rho
|
| 63 |
+
/\ contents (q1 (itern (Pos.to_nat p) s)) = rho
|
| 64 |
+
/\ contents (d0 (itern (Pos.to_nat p) s)) = desc
|
| 65 |
+
/\ contents (d1 (itern (Pos.to_nat p) s)) = desc.
|
| 66 |
+
Proof.
|
| 67 |
+
intros p s H. rewrite iterp_itern in H. unfold judge2, holds_two_copies in H.
|
| 68 |
+
apply andb_prop in H as [Hkap H].
|
| 69 |
+
apply andb_prop in H as [H H4]. apply andb_prop in H as [H H3]. apply andb_prop in H as [H1 H2].
|
| 70 |
+
exact (conj (proj1 (negb_true_iff _) Hkap) (conj (lbeq_true _ _ H1) (conj (lbeq_true _ _ H2)
|
| 71 |
+
(conj (lbeq_true _ _ H3) (lbeq_true _ _ H4))))).
|
| 72 |
+
Qed.
|
| 73 |
+
|
| 74 |
+
Lemma same_state_sound : forall p q s, same_state (iterp p s) (iterp q s) = true ->
|
| 75 |
+
win (itern (Pos.to_nat p) s) = win (itern (Pos.to_nat q) s)
|
| 76 |
+
/\ contents (q0 (itern (Pos.to_nat p) s)) = contents (q0 (itern (Pos.to_nat q) s))
|
| 77 |
+
/\ contents (q1 (itern (Pos.to_nat p) s)) = contents (q1 (itern (Pos.to_nat q) s))
|
| 78 |
+
/\ contents (d0 (itern (Pos.to_nat p) s)) = contents (d0 (itern (Pos.to_nat q) s))
|
| 79 |
+
/\ contents (d1 (itern (Pos.to_nat p) s)) = contents (d1 (itern (Pos.to_nat q) s)).
|
| 80 |
+
Proof.
|
| 81 |
+
intros p q s H. rewrite !iterp_itern in H. unfold same_state in H.
|
| 82 |
+
apply andb_prop in H as [H H5]. apply andb_prop in H as [H H4].
|
| 83 |
+
apply andb_prop in H as [H H3]. apply andb_prop in H as [H1 H2].
|
| 84 |
+
exact (conj (lbeq_true _ _ H1) (conj (lbeq_true _ _ H2) (conj (lbeq_true _ _ H3)
|
| 85 |
+
(conj (lbeq_true _ _ H4) (lbeq_true _ _ H5))))).
|
| 86 |
+
Qed.
|
| 87 |
+
|
| 88 |
+
(* The bank bit stays 0 for the first 920,892 states and is 1 after them; both banks then
|
| 89 |
+
hold the organism and both tapes its description. *)
|
| 90 |
+
Theorem self_reproduction :
|
| 91 |
+
(forall n, n < Pos.to_nat T1 -> wget (win (itern n s0)) KAPPA = false)
|
| 92 |
+
/\ wget (win (itern (Pos.to_nat T1) s0)) KAPPA = true
|
| 93 |
+
/\ contents (q0 (itern (Pos.to_nat T1) s0)) = rho
|
| 94 |
+
/\ contents (q1 (itern (Pos.to_nat T1) s0)) = rho
|
| 95 |
+
/\ contents (d0 (itern (Pos.to_nat T1) s0)) = desc
|
| 96 |
+
/\ contents (d1 (itern (Pos.to_nat T1) s0)) = desc.
|
| 97 |
+
Proof. exact (judge_sound T1 s0 first_generation_ok). Qed.
|
| 98 |
+
|
| 99 |
+
(* Two generations return every bank and tape to the organism and its description. *)
|
| 100 |
+
Theorem second_generation :
|
| 101 |
+
wget (win (itern (Pos.to_nat (2 * T1)) s0)) KAPPA = false
|
| 102 |
+
/\ contents (q0 (itern (Pos.to_nat (2 * T1)) s0)) = rho
|
| 103 |
+
/\ contents (q1 (itern (Pos.to_nat (2 * T1)) s0)) = rho
|
| 104 |
+
/\ contents (d0 (itern (Pos.to_nat (2 * T1)) s0)) = desc
|
| 105 |
+
/\ contents (d1 (itern (Pos.to_nat (2 * T1)) s0)) = desc.
|
| 106 |
+
Proof. exact (judge2_sound (2 * T1) s0 second_generation_ok). Qed.
|
| 107 |
+
|
| 108 |
+
(* From the first hand-over on, the orbit is periodic with a period of two generations. *)
|
| 109 |
+
Theorem periodic :
|
| 110 |
+
win (itern (Pos.to_nat (3 * T1)) s0) = win (itern (Pos.to_nat T1) s0)
|
| 111 |
+
/\ contents (q0 (itern (Pos.to_nat (3 * T1)) s0)) = contents (q0 (itern (Pos.to_nat T1) s0))
|
| 112 |
+
/\ contents (q1 (itern (Pos.to_nat (3 * T1)) s0)) = contents (q1 (itern (Pos.to_nat T1) s0))
|
| 113 |
+
/\ contents (d0 (itern (Pos.to_nat (3 * T1)) s0)) = contents (d0 (itern (Pos.to_nat T1) s0))
|
| 114 |
+
/\ contents (d1 (itern (Pos.to_nat (3 * T1)) s0)) = contents (d1 (itern (Pos.to_nat T1) s0)).
|
| 115 |
+
Proof. exact (same_state_sound (3 * T1) T1 s0 period_ok). Qed.
|
rocq/Smoke.v
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
(* The Rocq physics and organism against the Python transcription in src/twohead.py: the
|
| 2 |
+
organism, its description, and the full state from s0 after 1000 and 20000 steps. *)
|
| 3 |
+
From Stdlib Require Import List Bool Arith ZArith.
|
| 4 |
+
Import ListNotations.
|
| 5 |
+
From TH Require Import TwoHead Organism SmokeData.
|
| 6 |
+
|
| 7 |
+
Definition same_at (s : st) (w a b c d : list bool) : bool :=
|
| 8 |
+
lbeq (win s) w && lbeq (contents (q0 s)) a && lbeq (contents (q1 s)) b
|
| 9 |
+
&& lbeq (contents (d0 s)) c && lbeq (contents (d1 s)) d.
|
| 10 |
+
|
| 11 |
+
Lemma rho_matches_python : lbeq rho py_rho = true.
|
| 12 |
+
Proof. vm_compute. reflexivity. Qed.
|
| 13 |
+
|
| 14 |
+
Lemma desc_matches_python : lbeq desc py_desc = true.
|
| 15 |
+
Proof. vm_compute. reflexivity. Qed.
|
| 16 |
+
|
| 17 |
+
Lemma decode_encode : forallb (fun r => match r, decode (enc_rec r) with
|
| 18 |
+
| Rec a b c d e f, Rec a' b' c' d' e' f' =>
|
| 19 |
+
Nat.eqb a a' && Z.eqb b b' && Nat.eqb c c' && Z.eqb d d' && Z.eqb e e' && Nat.eqb f f' end)
|
| 20 |
+
organism = true.
|
| 21 |
+
Proof. vm_compute. reflexivity. Qed.
|
| 22 |
+
|
| 23 |
+
Lemma run_1000 : same_at (iterp 1000 s0) py_win_1000 py_q0_1000 py_q1_1000 py_d0_1000 py_d1_1000 = true.
|
| 24 |
+
Proof. vm_compute. reflexivity. Qed.
|
| 25 |
+
|
| 26 |
+
Lemma run_20000 : same_at (iterp 20000 s0) py_win_20000 py_q0_20000 py_q1_20000 py_d0_20000 py_d1_20000 = true.
|
| 27 |
+
Proof. vm_compute. reflexivity. Qed.
|
rocq/SmokeData.v
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
rocq/Spec.v
ADDED
|
@@ -0,0 +1,78 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
(* What one pass of the organism is meant to do, written without reference to its records. *)
|
| 2 |
+
From Stdlib Require Import List Bool Arith ZArith Lia.
|
| 3 |
+
Import ListNotations.
|
| 4 |
+
From TH Require Import TwoHead.
|
| 5 |
+
|
| 6 |
+
Inductive phase := PC | PG | PA.
|
| 7 |
+
|
| 8 |
+
(* the codon register holds c3 c2 c1 c0, c3 the first bit read; z counts down *)
|
| 9 |
+
Record cfg := mkC { ph : phase; z : nat; c3 : bool; c2 : bool; c1 : bool; c0 : bool; mo : bool }.
|
| 10 |
+
|
| 11 |
+
(* the gate bit at position 7 - z of a gate codon *)
|
| 12 |
+
Definition table (a3 a2 s0 s1 : bool) (k : nat) : bool :=
|
| 13 |
+
let cpy := a3 && negb a2 in
|
| 14 |
+
let sign := if a3 then s0 else if a2 then s0 && s1 else s0 || s1 in
|
| 15 |
+
let odd := if a3 then s0 else xorb a2 (xorb s0 s1) in
|
| 16 |
+
match k with
|
| 17 |
+
| 7 => negb s0
|
| 18 |
+
| 6 => s0
|
| 19 |
+
| 5 => negb cpy && negb s1
|
| 20 |
+
| 4 => negb cpy && s1
|
| 21 |
+
| 3 | 2 | 1 => sign
|
| 22 |
+
| 0 => odd
|
| 23 |
+
| _ => false
|
| 24 |
+
end.
|
| 25 |
+
|
| 26 |
+
Definition is_esc (a3 a2 a1 a0 : bool) : bool := a3 && a2 && negb (a1 && a0).
|
| 27 |
+
Definition is_end (a3 a2 a1 a0 : bool) : bool := a3 && a2 && a1 && a0.
|
| 28 |
+
|
| 29 |
+
(* one pass, from the bit r under the read head: the next configuration and bank bit, whether
|
| 30 |
+
the read head moves, whether the arm writes (and what), whether the copy head writes r *)
|
| 31 |
+
Record out := mkO { ncf : cfg; nk : bool; cons : bool; emit : bool; av : bool; cw : bool }.
|
| 32 |
+
|
| 33 |
+
Definition dpass (cf : cfg) (k r : bool) : out :=
|
| 34 |
+
let m := mo cf in
|
| 35 |
+
let zero := Nat.eqb (z cf) 0 in
|
| 36 |
+
match ph cf with
|
| 37 |
+
| PC =>
|
| 38 |
+
let n3 := c2 cf in let n2 := c1 cf in let n1 := c0 cf in let n0 := r in
|
| 39 |
+
if zero then
|
| 40 |
+
if is_end n3 n2 n1 n0 then mkO (mkC PC 3 n3 n2 n1 n0 (negb m)) (xorb k m) true false false m
|
| 41 |
+
else if negb m || is_esc n3 n2 n1 n0 then mkO (mkC PG 7 n3 n2 n1 n0 m) k true false false m
|
| 42 |
+
else mkO (mkC PA 17 n3 n2 n1 n0 m) k true false false m
|
| 43 |
+
else mkO (mkC PC (z cf - 1) n3 n2 n1 n0 m) k true false false m
|
| 44 |
+
| PG =>
|
| 45 |
+
let e := is_esc (c3 cf) (c2 cf) (c1 cf) (c0 cf) in
|
| 46 |
+
let a := if e then r else table (c3 cf) (c2 cf) (c1 cf) (c0 cf) (z cf) in
|
| 47 |
+
let nx := if zero then mkC PA 17 (c3 cf) (c2 cf) (c1 cf) (c0 cf) m
|
| 48 |
+
else mkC PG (z cf - 1) (c3 cf) (c2 cf) (c1 cf) (c0 cf) m in
|
| 49 |
+
mkO nx k e (negb m) a (m && e)
|
| 50 |
+
| PA =>
|
| 51 |
+
let nx := if zero then mkC PC 3 (c3 cf) (c2 cf) (c1 cf) (c0 cf) m
|
| 52 |
+
else mkC PA (z cf - 1) (c3 cf) (c2 cf) (c1 cf) (c0 cf) m in
|
| 53 |
+
mkO nx k true (negb m) r m
|
| 54 |
+
end.
|
| 55 |
+
|
| 56 |
+
(* the configurations a run visits *)
|
| 57 |
+
Definition reachable (cf : cfg) : bool :=
|
| 58 |
+
match ph cf with PC => Nat.leb (z cf) 3 | PG => Nat.leb (z cf) 7 | PA => Nat.leb (z cf) 17 end.
|
| 59 |
+
|
| 60 |
+
(* the window cells that hold the configuration: m 8, C 9, G 10, Ad 11, c0..c3 12..15, z 16..20 *)
|
| 61 |
+
Definition cell_of_cfg (cf : cfg) (k : bool) (i : nat) : bool :=
|
| 62 |
+
match i with
|
| 63 |
+
| 0 => k
|
| 64 |
+
| 8 => mo cf
|
| 65 |
+
| 9 => match ph cf with PC => true | _ => false end
|
| 66 |
+
| 10 => match ph cf with PG => true | _ => false end
|
| 67 |
+
| 11 => match ph cf with PA => true | _ => false end
|
| 68 |
+
| 12 => c0 cf | 13 => c1 cf | 14 => c2 cf | 15 => c3 cf
|
| 69 |
+
| 16 => Nat.testbit (z cf) 0 | 17 => Nat.testbit (z cf) 1 | 18 => Nat.testbit (z cf) 2
|
| 70 |
+
| 19 => Nat.testbit (z cf) 3 | 20 => Nat.testbit (z cf) 4
|
| 71 |
+
| _ => false
|
| 72 |
+
end.
|
| 73 |
+
|
| 74 |
+
Definition wcfg (cf : cfg) (k : bool) : list bool := map (cell_of_cfg cf k) (seq 0 64).
|
| 75 |
+
|
| 76 |
+
(* the cells a pass carries over: the bank bit, the requests and the configuration *)
|
| 77 |
+
Definition relevant (i : nat) : bool := Nat.eqb i 0 || (Nat.leb 4 i && Nat.leb i 6) || (Nat.leb 8 i && Nat.leb i 20).
|
| 78 |
+
Definition istmp (i : nat) : bool := negb (relevant i || (Nat.leb 1 i && Nat.leb i 3)).
|
rocq/Tapes.v
ADDED
|
@@ -0,0 +1,152 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
(* The tape operations, read as operations on contents. *)
|
| 2 |
+
From Stdlib Require Import List Bool Arith Lia.
|
| 3 |
+
Import ListNotations.
|
| 4 |
+
From TH Require Import TwoHead.
|
| 5 |
+
|
| 6 |
+
Definition rot1 (l : list bool) : list bool :=
|
| 7 |
+
match l with [] => [] | x :: t => t ++ [x] end.
|
| 8 |
+
|
| 9 |
+
Definition hd0 (l : list bool) : bool := match l with [] => false | x :: _ => x end.
|
| 10 |
+
|
| 11 |
+
Definition wr0 (l : list bool) (v : bool) : list bool :=
|
| 12 |
+
match l with [] => [] | _ :: t => v :: t end.
|
| 13 |
+
|
| 14 |
+
Lemma contents_norm : forall t, contents (norm t) = contents t.
|
| 15 |
+
Proof.
|
| 16 |
+
intros [f b]; unfold norm, contents; simpl.
|
| 17 |
+
destruct f as [|x f]; simpl; [rewrite rev_append_rev, !app_nil_r|]; reflexivity.
|
| 18 |
+
Qed.
|
| 19 |
+
|
| 20 |
+
Lemma norm_cases : forall t,
|
| 21 |
+
(fr (norm t) = [] /\ contents t = [])
|
| 22 |
+
\/ (exists x f, fr (norm t) = x :: f /\ contents t = x :: f ++ rev (bk (norm t))).
|
| 23 |
+
Proof.
|
| 24 |
+
intros [f b]; unfold norm, contents; simpl.
|
| 25 |
+
destruct f as [|x f]; simpl.
|
| 26 |
+
- rewrite rev_append_rev, app_nil_r.
|
| 27 |
+
destruct (rev b) as [|y r] eqn:E.
|
| 28 |
+
+ left; split; reflexivity.
|
| 29 |
+
+ right; exists y, r; split; [reflexivity|]. simpl. rewrite app_nil_r. reflexivity.
|
| 30 |
+
- right; exists x, f; split; reflexivity.
|
| 31 |
+
Qed.
|
| 32 |
+
|
| 33 |
+
Lemma hd_t_contents : forall t, hd_t t = hd0 (contents t).
|
| 34 |
+
Proof.
|
| 35 |
+
intro t; unfold hd_t.
|
| 36 |
+
destruct (norm_cases t) as [[H1 H2] | (x & f & H1 & H2)]; rewrite H1, H2; reflexivity.
|
| 37 |
+
Qed.
|
| 38 |
+
|
| 39 |
+
Lemma turn1_contents : forall t, contents (turn1 t) = rot1 (contents t).
|
| 40 |
+
Proof.
|
| 41 |
+
intro t; unfold turn1; cbv zeta.
|
| 42 |
+
destruct (norm_cases t) as [[H1 H2] | (x & f & H1 & H2)]; rewrite H1.
|
| 43 |
+
- rewrite contents_norm, H2. reflexivity.
|
| 44 |
+
- rewrite H2. unfold contents; simpl. rewrite app_assoc. reflexivity.
|
| 45 |
+
Qed.
|
| 46 |
+
|
| 47 |
+
Lemma wr_t_contents : forall t v, contents (wr_t t v) = wr0 (contents t) v.
|
| 48 |
+
Proof.
|
| 49 |
+
intros t v; unfold wr_t; cbv zeta.
|
| 50 |
+
destruct (norm_cases t) as [[H1 H2] | (x & f & H1 & H2)]; rewrite H1.
|
| 51 |
+
- rewrite contents_norm, H2. reflexivity.
|
| 52 |
+
- rewrite H2. unfold contents; simpl. reflexivity.
|
| 53 |
+
Qed.
|
| 54 |
+
|
| 55 |
+
Lemma rot1_length : forall l, length (rot1 l) = length l.
|
| 56 |
+
Proof. intros [|x t]; simpl; auto. rewrite length_app; simpl; lia. Qed.
|
| 57 |
+
|
| 58 |
+
Lemma wr0_length : forall l v, length (wr0 l v) = length l.
|
| 59 |
+
Proof. intros [|x t] v; simpl; auto. Qed.
|
| 60 |
+
|
| 61 |
+
Fixpoint rotn (n : nat) (l : list bool) : list bool :=
|
| 62 |
+
match n with O => l | S m => rotn m (rot1 l) end.
|
| 63 |
+
|
| 64 |
+
Lemma rotn_app : forall a b, rotn (length a) (a ++ b) = b ++ a.
|
| 65 |
+
Proof.
|
| 66 |
+
induction a as [|x a IH]; intro b; simpl.
|
| 67 |
+
- rewrite app_nil_r; reflexivity.
|
| 68 |
+
- rewrite <- app_assoc, IH, <- app_assoc. reflexivity.
|
| 69 |
+
Qed.
|
| 70 |
+
|
| 71 |
+
Lemma rotn_full : forall l, rotn (length l) l = l.
|
| 72 |
+
Proof. intro l. pose proof (rotn_app l []) as H. rewrite !app_nil_r in H. exact H. Qed.
|
| 73 |
+
|
| 74 |
+
(* popn reads the first n cells and turns the tape by n *)
|
| 75 |
+
Lemma popn_turns : forall n t, contents (snd (popn n t)) = rotn n (contents t).
|
| 76 |
+
Proof.
|
| 77 |
+
induction n as [|n IH]; intro t; simpl; auto.
|
| 78 |
+
destruct (popn n (turn1 t)) as [xs t'] eqn:E. simpl.
|
| 79 |
+
specialize (IH (turn1 t)). rewrite E in IH. simpl in IH.
|
| 80 |
+
rewrite IH, turn1_contents. reflexivity.
|
| 81 |
+
Qed.
|
| 82 |
+
|
| 83 |
+
Lemma popn_reads : forall n t, n <= length (contents t) ->
|
| 84 |
+
fst (popn n t) = firstn n (contents t).
|
| 85 |
+
Proof.
|
| 86 |
+
induction n as [|n IH]; intros t Hn; simpl; auto.
|
| 87 |
+
destruct (popn n (turn1 t)) as [xs t'] eqn:E. simpl.
|
| 88 |
+
assert (Hx : xs = firstn n (rot1 (contents t))).
|
| 89 |
+
{ specialize (IH (turn1 t)). rewrite E, turn1_contents in IH. simpl in IH. apply IH.
|
| 90 |
+
rewrite rot1_length. lia. }
|
| 91 |
+
rewrite Hx, hd_t_contents.
|
| 92 |
+
destruct (contents t) as [|x c] eqn:Ec; simpl in Hn; [lia|]. simpl.
|
| 93 |
+
rewrite firstn_app. replace (n - length c) with 0 by lia. simpl. rewrite app_nil_r. reflexivity.
|
| 94 |
+
Qed.
|
| 95 |
+
|
| 96 |
+
(* rotating a prefix-split list, and reading or writing at the head inside the prefix *)
|
| 97 |
+
Lemma rotn_rot1 : forall n l, rotn n (rot1 l) = rot1 (rotn n l).
|
| 98 |
+
Proof. induction n as [|n IH]; intro l; simpl; auto. Qed.
|
| 99 |
+
|
| 100 |
+
Lemma rotn_S : forall n l, rot1 (rotn n l) = rotn (S n) l.
|
| 101 |
+
Proof. intros n l. simpl. rewrite rotn_rot1. reflexivity. Qed.
|
| 102 |
+
|
| 103 |
+
Lemma rotn_split : forall k a b, k <= length a ->
|
| 104 |
+
rotn k (a ++ b) = skipn k a ++ b ++ firstn k a.
|
| 105 |
+
Proof.
|
| 106 |
+
induction k as [|k IH]; intros a b Hk; simpl.
|
| 107 |
+
- rewrite app_nil_r. reflexivity.
|
| 108 |
+
- destruct a as [|x a]; simpl in Hk; [lia|].
|
| 109 |
+
simpl. rewrite <- app_assoc. rewrite IH by lia.
|
| 110 |
+
rewrite <- !app_assoc. reflexivity.
|
| 111 |
+
Qed.
|
| 112 |
+
|
| 113 |
+
Lemma hd_skipn : forall k a t, k < length a -> hd0 (skipn k a ++ t) = nth k a false.
|
| 114 |
+
Proof. induction k as [|k IH]; intros [|x a] t Hk; simpl in *; try lia; auto. apply IH; lia. Qed.
|
| 115 |
+
|
| 116 |
+
Lemma hd_rotn_prefix : forall k a b, k < length a ->
|
| 117 |
+
hd0 (rotn k (a ++ b)) = nth k a false.
|
| 118 |
+
Proof. intros k a b Hk. rewrite rotn_split by lia. apply hd_skipn; lia. Qed.
|
| 119 |
+
|
| 120 |
+
Lemma upd_length : forall l i v, length (upd l i v) = length l.
|
| 121 |
+
Proof. induction l as [|x l IH]; intros [|i] v; simpl; auto. Qed.
|
| 122 |
+
|
| 123 |
+
Lemma firstn_upd : forall k l v, firstn k (upd l k v) = firstn k l.
|
| 124 |
+
Proof. induction k as [|k IH]; intros [|x l] v; simpl; auto. f_equal; apply IH. Qed.
|
| 125 |
+
|
| 126 |
+
Lemma skipn_upd : forall k l v, k < length l ->
|
| 127 |
+
skipn k (upd l k v) = wr0 (skipn k l) v.
|
| 128 |
+
Proof.
|
| 129 |
+
induction k as [|k IH]; intros [|x l] v Hk; simpl in *; try lia; auto.
|
| 130 |
+
apply IH; lia.
|
| 131 |
+
Qed.
|
| 132 |
+
|
| 133 |
+
Lemma wr_rotn_prefix : forall k a b v, k < length a ->
|
| 134 |
+
wr0 (rotn k (a ++ b)) v = rotn k (upd a k v ++ b).
|
| 135 |
+
Proof.
|
| 136 |
+
intros k a b v Hk.
|
| 137 |
+
rewrite !rotn_split by (try rewrite upd_length; lia).
|
| 138 |
+
rewrite skipn_upd, firstn_upd by lia.
|
| 139 |
+
destruct (skipn k a) as [|y s] eqn:E.
|
| 140 |
+
- exfalso. apply (f_equal (@length bool)) in E. rewrite length_skipn in E. simpl in E. lia.
|
| 141 |
+
- reflexivity.
|
| 142 |
+
Qed.
|
| 143 |
+
|
| 144 |
+
Lemma nth_upd_same : forall l i v, i < length l -> nth i (upd l i v) false = v.
|
| 145 |
+
Proof. induction l as [|x l IH]; intros [|i] v Hi; simpl in *; try lia; auto. apply IH; lia. Qed.
|
| 146 |
+
|
| 147 |
+
Lemma nth_upd_other : forall l i j v, i <> j -> nth j (upd l i v) false = nth j l false.
|
| 148 |
+
Proof.
|
| 149 |
+
induction l as [|x l IH]; intros i j v Hij; [reflexivity|].
|
| 150 |
+
destruct i as [|i], j as [|j]; simpl; try reflexivity; [lia|].
|
| 151 |
+
apply IH. lia.
|
| 152 |
+
Qed.
|
rocq/TwoHead.v
ADDED
|
@@ -0,0 +1,178 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
+
(* The two-head physics, its record format, the code of descriptions. *)
|
| 2 |
+
From Stdlib Require Import List Bool Arith ZArith Lia.
|
| 3 |
+
Import ListNotations.
|
| 4 |
+
|
| 5 |
+
(* ---- window cells ---------------------------------------------------- *)
|
| 6 |
+
Definition KAPPA := 0%nat.
|
| 7 |
+
Definition RD := 1%nat.
|
| 8 |
+
Definition ARM := 2%nat.
|
| 9 |
+
Definition CPY := 3%nat.
|
| 10 |
+
Definition AR := 4%nat.
|
| 11 |
+
Definition AA := 5%nat.
|
| 12 |
+
Definition AC := 6%nat.
|
| 13 |
+
Definition SINK := 7%nat.
|
| 14 |
+
|
| 15 |
+
Fixpoint upd (l : list bool) (i : nat) (v : bool) : list bool :=
|
| 16 |
+
match l with
|
| 17 |
+
| [] => []
|
| 18 |
+
| x :: t => match i with O => v :: t | S j => x :: upd t j v end
|
| 19 |
+
end.
|
| 20 |
+
|
| 21 |
+
Definition wget (l : list bool) (i : nat) : bool := nth i l false.
|
| 22 |
+
|
| 23 |
+
Fixpoint lbeq (a b : list bool) : bool :=
|
| 24 |
+
match a, b with
|
| 25 |
+
| [], [] => true
|
| 26 |
+
| x :: s, y :: t => Bool.eqb x y && lbeq s t
|
| 27 |
+
| _, _ => false
|
| 28 |
+
end.
|
| 29 |
+
|
| 30 |
+
Lemma lbeq_true : forall a b, lbeq a b = true -> a = b.
|
| 31 |
+
Proof.
|
| 32 |
+
induction a as [|x s IH]; intros [|y t] H; simpl in H; try discriminate; auto.
|
| 33 |
+
apply andb_prop in H as [Hxy Hst].
|
| 34 |
+
apply Bool.eqb_prop in Hxy; subst; f_equal; auto.
|
| 35 |
+
Qed.
|
| 36 |
+
|
| 37 |
+
(* ---- circular tapes: the contents read from the head are fr ++ rev bk -- *)
|
| 38 |
+
Record tape := mkT { fr : list bool; bk : list bool }.
|
| 39 |
+
|
| 40 |
+
Definition contents (t : tape) : list bool := fr t ++ rev (bk t).
|
| 41 |
+
Definition norm (t : tape) : tape :=
|
| 42 |
+
match fr t with [] => mkT (rev_append (bk t) []) [] | _ => t end.
|
| 43 |
+
Definition hd_t (t : tape) : bool :=
|
| 44 |
+
match fr (norm t) with x :: _ => x | [] => false end.
|
| 45 |
+
Definition wr_t (t : tape) (v : bool) : tape :=
|
| 46 |
+
let n := norm t in match fr n with _ :: f => mkT (v :: f) (bk n) | [] => n end.
|
| 47 |
+
Definition turn1 (t : tape) : tape :=
|
| 48 |
+
let n := norm t in match fr n with x :: f => mkT f (x :: bk n) | [] => n end.
|
| 49 |
+
Fixpoint popn (n : nat) (t : tape) : list bool * tape :=
|
| 50 |
+
match n with
|
| 51 |
+
| O => ([], t)
|
| 52 |
+
| S m => let x := hd_t t in let '(xs, t') := popn m (turn1 t) in (x :: xs, t')
|
| 53 |
+
end.
|
| 54 |
+
Definition tape_of (l : list bool) : tape := mkT l [].
|
| 55 |
+
|
| 56 |
+
(* ---- records, gate first: w0 code, w1 code, beta, a0, a1, ao ----------- *)
|
| 57 |
+
Inductive rec := Rec (a0 : nat) (w0 : Z) (a1 : nat) (w1 : Z) (beta : Z) (ao : nat).
|
| 58 |
+
|
| 59 |
+
Fixpoint bits2nat_acc (acc : nat) (l : list bool) : nat :=
|
| 60 |
+
match l with [] => acc | b :: t => bits2nat_acc (2 * acc + (if b then 1 else 0)) t end.
|
| 61 |
+
Definition bits2nat (l : list bool) : nat := bits2nat_acc 0 l.
|
| 62 |
+
|
| 63 |
+
Fixpoint nat2bits (w v : nat) : list bool :=
|
| 64 |
+
match w with O => [] | S w' => Nat.testbit v w' :: nat2bits w' v end.
|
| 65 |
+
|
| 66 |
+
Definition wcode (h l : bool) : Z :=
|
| 67 |
+
match h, l with false, true => 1%Z | true, false => (-1)%Z | _, _ => 0%Z end.
|
| 68 |
+
Definition enc_w (w : Z) : list bool :=
|
| 69 |
+
if Z.eqb w 1 then [false; true] else if Z.eqb w (-1) then [true; false] else [false; false].
|
| 70 |
+
|
| 71 |
+
Definition decode (bs : list bool) : rec :=
|
| 72 |
+
let g i := nth i bs false in
|
| 73 |
+
let braw := Z.of_nat (bits2nat (firstn 4 (skipn 4 bs))) in
|
| 74 |
+
Rec (bits2nat (firstn 6 (skipn 8 bs))) (wcode (g 0%nat) (g 1%nat))
|
| 75 |
+
(bits2nat (firstn 6 (skipn 14 bs))) (wcode (g 2%nat) (g 3%nat))
|
| 76 |
+
(if Z.leb 8 braw then braw - 16 else braw)%Z
|
| 77 |
+
(bits2nat (firstn 6 (skipn 20 bs))).
|
| 78 |
+
|
| 79 |
+
Definition enc_rec (r : rec) : list bool :=
|
| 80 |
+
match r with
|
| 81 |
+
| Rec a0 w0 a1 w1 beta ao =>
|
| 82 |
+
enc_w w0 ++ enc_w w1 ++ nat2bits 4 (Z.to_nat (Z.modulo beta 16))
|
| 83 |
+
++ nat2bits 6 a0 ++ nat2bits 6 a1 ++ nat2bits 6 ao
|
| 84 |
+
end.
|
| 85 |
+
|
| 86 |
+
(* ---- one step of the physics ------------------------------------------ *)
|
| 87 |
+
Record st := mkS { win : list bool; q0 : tape; q1 : tape; d0 : tape; d1 : tape }.
|
| 88 |
+
|
| 89 |
+
Definition b2z (b : bool) : Z := if b then 1%Z else 0%Z.
|
| 90 |
+
|
| 91 |
+
Definition step (s : st) : st :=
|
| 92 |
+
let k := wget (win s) KAPPA in
|
| 93 |
+
let qa := if k then q1 s else q0 s in
|
| 94 |
+
let qi := if k then q0 s else q1 s in
|
| 95 |
+
let da := if k then d1 s else d0 s in
|
| 96 |
+
let di := if k then d0 s else d1 s in
|
| 97 |
+
let (bits, qa') := popn 26 qa in
|
| 98 |
+
match decode bits with
|
| 99 |
+
| Rec a0 w0 a1 w1 beta ao =>
|
| 100 |
+
let cell a :=
|
| 101 |
+
if Nat.eqb a RD then hd_t da
|
| 102 |
+
else if Nat.eqb a ARM then hd_t qi
|
| 103 |
+
else if Nat.eqb a CPY then hd_t di
|
| 104 |
+
else wget (win s) a in
|
| 105 |
+
let v := Z.leb 0 (w0 * b2z (cell a0) + w1 * b2z (cell a1) + beta)%Z in
|
| 106 |
+
let wn := if Nat.eqb ao RD || Nat.eqb ao ARM || Nat.eqb ao CPY then win s
|
| 107 |
+
else upd (win s) ao v in
|
| 108 |
+
let qi1 := if Nat.eqb ao ARM then wr_t qi v else qi in
|
| 109 |
+
let di1 := if Nat.eqb ao CPY then wr_t di v else di in
|
| 110 |
+
let qi2 := if wget wn AA then turn1 qi1 else qi1 in
|
| 111 |
+
let da2 := if wget wn AR then turn1 da else da in
|
| 112 |
+
let di2 := if wget wn AC then turn1 di1 else di1 in
|
| 113 |
+
let w2 := upd (upd (upd wn AA false) AR false) AC false in
|
| 114 |
+
if k then mkS w2 qi2 qa' di2 da2 else mkS w2 qa' qi2 da2 di2
|
| 115 |
+
end.
|
| 116 |
+
|
| 117 |
+
Fixpoint iterp (p : positive) (s : st) : st :=
|
| 118 |
+
match p with
|
| 119 |
+
| xH => step s
|
| 120 |
+
| xO q => iterp q (iterp q s)
|
| 121 |
+
| xI q => step (iterp q (iterp q s))
|
| 122 |
+
end.
|
| 123 |
+
|
| 124 |
+
(* ---- the code of descriptions ----------------------------------------- *)
|
| 125 |
+
(* kind 0 AND, 1 OR, 2 COPY; s0, s1 the polarities of the two literals. *)
|
| 126 |
+
Definition gate_bits (kind : nat) (s0 s1 : bool) : list bool :=
|
| 127 |
+
let sgn := match kind with 0 => s0 || s1 | 1 => s0 && s1 | _ => s0 end in
|
| 128 |
+
let odd := match kind with 0 => xorb s0 s1 | 1 => negb (xorb s0 s1) | _ => s0 end in
|
| 129 |
+
let w1 := match kind with 2 => [false; false] | _ => [negb s1; s1] end in
|
| 130 |
+
[negb s0; s0] ++ w1 ++ [sgn; sgn; sgn; odd].
|
| 131 |
+
|
| 132 |
+
Definition codon_bits (kind : nat) (s0 s1 : bool) : list bool :=
|
| 133 |
+
[Nat.eqb kind 2 || Nat.eqb kind 3; Nat.eqb kind 1 || Nat.eqb kind 3; s0; s1].
|
| 134 |
+
|
| 135 |
+
Definition candidates : list (nat * bool * bool) :=
|
| 136 |
+
[(0, false, false); (0, false, true); (0, true, false); (0, true, true);
|
| 137 |
+
(1, false, false); (1, false, true); (1, true, false); (1, true, true);
|
| 138 |
+
(2, false, false); (2, true, false)]%nat.
|
| 139 |
+
|
| 140 |
+
Fixpoint find_codon (cs : list (nat * bool * bool)) (gb : list bool) : option (list bool) :=
|
| 141 |
+
match cs with
|
| 142 |
+
| [] => None
|
| 143 |
+
| (k, a, b) :: t => if lbeq (gate_bits k a b) gb then Some (codon_bits k a b) else find_codon t gb
|
| 144 |
+
end.
|
| 145 |
+
|
| 146 |
+
Definition ESC : list bool := [true; true; false; false].
|
| 147 |
+
Definition ENDC : list bool := [true; true; true; true].
|
| 148 |
+
|
| 149 |
+
Fixpoint chunks (fuel : nat) (l : list bool) : list (list bool) :=
|
| 150 |
+
match fuel with
|
| 151 |
+
| O => []
|
| 152 |
+
| S f => match l with [] => [] | _ => firstn 26 l :: chunks f (skipn 26 l) end
|
| 153 |
+
end.
|
| 154 |
+
|
| 155 |
+
Definition describe (img : list bool) : list bool :=
|
| 156 |
+
concat (map (fun r => match find_codon candidates (firstn 8 r) with
|
| 157 |
+
| Some c => c ++ skipn 8 r
|
| 158 |
+
| None => ESC ++ r
|
| 159 |
+
end) (chunks (length img) img)) ++ ENDC.
|
| 160 |
+
|
| 161 |
+
(* The decoding the organism is meant to carry out. *)
|
| 162 |
+
Fixpoint translate_aux (fuel : nat) (d : list bool) : option (list bool) :=
|
| 163 |
+
match fuel with
|
| 164 |
+
| O => None
|
| 165 |
+
| S f =>
|
| 166 |
+
match d with
|
| 167 |
+
| c3 :: c2 :: s0 :: s1 :: rest =>
|
| 168 |
+
if c3 && c2 then
|
| 169 |
+
if s0 && s1 then match rest with [] => Some [] | _ => None end
|
| 170 |
+
else if Nat.eqb (length rest) 0 then None
|
| 171 |
+
else option_map (fun t => firstn 26 rest ++ t) (translate_aux f (skipn 26 rest))
|
| 172 |
+
else
|
| 173 |
+
option_map (fun t => gate_bits (if c3 then 2 else if c2 then 1 else 0) s0 s1 ++ firstn 18 rest ++ t)
|
| 174 |
+
(translate_aux f (skipn 18 rest))
|
| 175 |
+
| _ => None
|
| 176 |
+
end
|
| 177 |
+
end.
|
| 178 |
+
Definition translate (d : list bool) : option (list bool) := translate_aux (length d) d.
|
rocq/_CoqProject
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
-R . TH
|
| 2 |
+
TwoHead.v
|
| 3 |
+
Organism.v
|
| 4 |
+
Iter.v
|
| 5 |
+
Tapes.v
|
| 6 |
+
Abstract.v
|
| 7 |
+
Indep.v
|
| 8 |
+
Spec.v
|
| 9 |
+
PassCheck.v
|
| 10 |
+
PassLemma.v
|
| 11 |
+
Decoder.v
|
| 12 |
+
Run.v
|
| 13 |
+
Complete.v
|
| 14 |
+
Main.v
|
| 15 |
+
SelfRep.v
|
| 16 |
+
SmokeData.v
|
| 17 |
+
Smoke.v
|
| 18 |
+
Net.v
|
| 19 |
+
Gates.v
|
| 20 |
+
Phys.v
|
| 21 |
+
PhysWF.v
|
| 22 |
+
PhysSem.v
|
| 23 |
+
PhysMain.v
|
| 24 |
+
PhysFacts.v
|
| 25 |
+
NetMain.v
|
| 26 |
+
Extract.v
|