Download data/lean/OAI/NumberTheory/TwoPoint/Circuits/CircuitQueryWalk.lean from introvoyz045/math: direct link, hf CLI and curl.
- Browser
- Download file 3.19 kB
-
https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/NumberTheory/TwoPoint/Circuits/CircuitQueryWalk.lean
- Command line
-
hf download hf://datasets/introvoyz045/math/data/lean/OAI/NumberTheory/TwoPoint/Circuits/CircuitQueryWalk.lean
-
curl -L -o CircuitQueryWalk.lean https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/NumberTheory/TwoPoint/Circuits/CircuitQueryWalk.lean
3.19 kB
| import OAI.NumberTheory.TwoPoint.Circuits.CircuitAssignmentUpdates | |
| namespace OAI | |
| /-! Complete query blocks along a canonical DNF path. A prefix of a path is | |
| enough for the switching encoding; the final Boolean answer is irrelevant. -/ | |
| namespace TwoPointCorrelations | |
| open Finset | |
| open scoped Classical | |
| structure DNFQueryBlock (n : β) where | |
| term : CubeTerm n | |
| queried : Finset (Fin n) | |
| answer : BooleanCube n | |
| namespace DNFQueryBlock | |
| def support {n : β} : List (DNFQueryBlock n) β Finset (Fin n) | |
| | [] => β | |
| | b :: bs => b.queried βͺ support bs | |
| def length {n : β} : List (DNFQueryBlock n) β β | |
| | [] => 0 | |
| | b :: bs => b.queried.card + length bs | |
| def image {n : β} : PartialAssignment n β List (DNFQueryBlock n) β PartialAssignment n | |
| | Ο, [] => Ο | |
| | Ο, b :: bs => image (Ο.assign b.queried b.term.value) bs | |
| end DNFQueryBlock | |
| inductive CanonicalDNFWalk {n : β} : | |
| List (CubeTerm n) β PartialAssignment n β List (DNFQueryBlock n) β Prop | |
| | nil (F Ο) : CanonicalDNFWalk F Ο [] | |
| | skip {C F Ο bs} (hC : Β¬ C.Compatible Ο) (h : CanonicalDNFWalk F Ο bs) : | |
| CanonicalDNFWalk (C :: F) Ο bs | |
| | step {C F Ο bs} (x : BooleanCube n) (hC : C.Compatible Ο) | |
| (hne : (C.live Ο).Nonempty) (h : CanonicalDNFWalk F (Ο.assign (C.live Ο) x) bs) : | |
| CanonicalDNFWalk (C :: F) Ο (β¨C, C.live Ο, xβ© :: bs) | |
| namespace CanonicalDNFWalk | |
| lemma support_subset_free {n : β} {F : List (CubeTerm n)} {Ο : PartialAssignment n} | |
| {bs : List (DNFQueryBlock n)} (h : CanonicalDNFWalk F Ο bs) : | |
| DNFQueryBlock.support bs β Ο.free := by | |
| induction h with | |
| | nil => simp [DNFQueryBlock.support] | |
| | skip _ _ ih => exact ih | |
| | @step C F Ο bs x _ _ _ ih => | |
| intro i hi | |
| rcases mem_union.mp hi with hi | hi | |
| Β· exact C.live_subset_free Ο hi | |
| Β· have hh := ih hi | |
| rw [PartialAssignment.free_assign] at hh | |
| exact (mem_sdiff.mp hh).1 | |
| lemma head_disjoint_tail {n : β} {C : CubeTerm n} {F : List (CubeTerm n)} | |
| {Ο : PartialAssignment n} {bs : List (DNFQueryBlock n)} (x : BooleanCube n) | |
| (h : CanonicalDNFWalk F (Ο.assign (C.live Ο) x) bs) : | |
| Disjoint (C.live Ο) (DNFQueryBlock.support bs) := by | |
| apply Finset.disjoint_left.mpr | |
| intro i hi htail | |
| have hh := h.support_subset_free htail | |
| rw [PartialAssignment.free_assign] at hh | |
| exact (mem_sdiff.mp hh).2 hi | |
| lemma length_eq_card_support {n : β} {F : List (CubeTerm n)} | |
| {Ο : PartialAssignment n} {bs : List (DNFQueryBlock n)} | |
| (h : CanonicalDNFWalk F Ο bs) : | |
| DNFQueryBlock.length bs = (DNFQueryBlock.support bs).card := by | |
| induction h with | |
| | nil => simp [DNFQueryBlock.length, DNFQueryBlock.support] | |
| | skip _ _ ih => exact ih | |
| | @step C F Ο bs x _ _ h ih => | |
| simp only [DNFQueryBlock.length, DNFQueryBlock.support] | |
| rw [card_union_of_disjoint (head_disjoint_tail x h), ih] | |
| lemma length_le_dimension {n : β} {F : List (CubeTerm n)} | |
| {Ο : PartialAssignment n} {bs : List (DNFQueryBlock n)} | |
| (h : CanonicalDNFWalk F Ο bs) : DNFQueryBlock.length bs β€ n := by | |
| rw [h.length_eq_card_support] | |
| exact (card_le_card (subset_univ _)).trans_eq (by simp) | |
| end CanonicalDNFWalk | |
| end TwoPointCorrelations | |
| end OAI | |