[Question]
  [
## Background
An \$n\$-bit [Gray code](https://en.wikipedia.org/wiki/Gray_code) is an ordering of \$2^n\$ binary sequences so that adjacent sequences always differ by exactly one bit.
A **[Beckett-Gray code](https://en.wikipedia.org/wiki/Gray_code#Beckett%E2%80%93Gray_code)** is a special kind of Gray code. In addition to being a Gray code, it has the following characteristics:
* It is cyclic: the last bit pattern has one bit difference with the first pattern. (*Your input is guaranteed to be cyclic*)
* The first pattern is all zeros. (*Your input is guaranteed to start with 0*)
* Whenever a bit turns from 1 to 0, that bit is the one which has been 1 for the longest time (consecutively). (*You need to verify this*)
It is known that a Beckett-Gray code exists for \$n=2, 5, 6, 7, 8\$, but does not exist for \$n=3\$ and \$4\$. It is not known if any such code exists for \$n \ge 9\$, and no constructive methods to build such a code are known.
One example for \$n=5\$ is as follows (copied from [this paper](https://www.sciencedirect.com/science/article/pii/S1571065307001709?via%3Dihub), 1-0 transition marked):
```
00000, 00001, 00011, 00010, 00110, 00111, 00101, 01101,
                         ^                   ^
01001, 01000, 01010, 01011, 11011, 10011, 10111, 10101,
  ^        ^                        ^               ^
10100, 00100, 01100, 11100, 11000, 11010, 10010, 10110,
    ^  ^                      ^            ^
11110, 01110, 01111, 11111, 11101, 11001, 10001, 10000
       ^                       ^     ^     ^         ^
```
## Task
Given a cyclic Gray code starting with an all-zero pattern, determine if it is a Beckett-Gray code.
You may take input as a sequence of boolean arrays (possibly transposed), a sequence of strings, or a sequence of equivalent integers. Also, you may optionally take the value of \$n\$ as the second input.
For output, you can choose to
1. output truthy/falsy using your language's convention (swapping is allowed), or
2. use two distinct values to represent true (affirmative) or false (negative) respectively.
Standard [code-golf](/questions/tagged/code-golf "show questions tagged 'code-golf'") rules apply. Shortest code in bytes wins.
## Test cases
Each test case is separated with an empty line.
### Truthy (Beckett)
```
0, 1
00, 01, 11, 10
00, 10, 11, 01
00000, 00001, 00011, 00010, 00110, 00111, 00101, 01101,
01001, 01000, 01010, 01011, 11011, 10011, 10111, 10101,
10100, 00100, 01100, 11100, 11000, 11010, 10010, 10110,
11110, 01110, 01111, 11111, 11101, 11001, 10001, 10000
00000, 01000, 01001, 00001, 00011, 01011, 01010, 11010,
11000, 10000, 10001, 11001, 11101, 01101, 01111, 01110,
00110, 00010, 10010, 10110, 10100, 10101, 00101, 00111,
10111, 10011, 11011, 11111, 11110, 11100, 01100, 00100
```
### Falsy (Not Beckett)
```
000, 001, 011, 010, 110, 111, 101, 100
0000, 1000, 1100, 1110, 1111, 1101, 0101, 0001,
1001, 1011, 1010, 0010, 0011, 0111, 0110, 0100
00000, 00001, 00011, 00010, 00110, 00111, 00101, 00100,
01100, 01101, 01111, 01110, 01010, 01011, 01001, 01000,
11000, 11001, 11011, 11010, 11110, 11111, 11101, 11100,
10100, 10101, 10111, 10110, 10010, 10011, 10001, 10000
```
  
[Answer]
# [Husk](https://github.com/barbuz/Husk), 9 bytes
```
Λ≡½hÖ▼Ẋz-
```
[Try it online!](https://tio.run/##Zc@7DYNAEATQhrA0Uw@6HIkQOXEHdgEkRLSBIIHcPZhGFiHdrXdAm7xg9tc8u9bsO@zvcV2ard/7@Td9Xg8zq2tUuVLlppvikuHFdJdeinEx3BSfGYohphhihBsQbkCeGQ0xsyGmm@HfuxkyDLsYdv1/USOlAw "Husk – Try It Online") (Version with formatting header to allow pasting testcases: [Try it online!](https://tio.run/##PY8xCgIxEEX7nCJso0KEvGvsFUSwkgWxUUSw004PsI2VR7AVbdbeO5iLRDJ/1xR54c/8mZ9mt13ldDpuFnU1m1f1KKzH/@eyu0/2@XNN51v3at5tap/fx@UwzTnHcoIvNwZ6mMgAE4k9YnClVGpIRC3IQBxgokZTFjkMHomoBRmQHQ1Do7FFDlvrUQgUCQVEcVF49JWC@AM "Husk – Try It Online"))
### Explanation
If we compute differences from each binary sequence to the next with an element-by-element subtraction, we will get a series of results each containing a single -1/+1 on the flipped bit and a 0 on all other bits. In order for this Gray code to be Beckett, the subsequence of -1 lists must be identical to the subsequence of +1 lists (except for the sign).
[As noted by Unrelated String](https://codegolf.stackexchange.com/a/220488/62393) we don't need to check the last element against the first, since it will always consist of a single 1 turning into a 0.
```
 Λ≡½hÖ▼Ẋz-    Input: list of binary sequences
       Ẋ      For each pair of adjacent sequences:
        z-       subtract the first from the second element by element
     Ö▼       Sort by the minimum (in place): all the -1 sequences move to the beginning
    h         Discard the last (would match the final sequence turning into the first)
   ½          Group the sequences into two lists of equal length 
                (the first will contain the -1s, the second the +1s)
 Λ            Check that the two elements
  ≡           Have the same distribution of zeros/nonzeros
```
[Answer]
# [APL (Dyalog Classic)](https://www.dyalog.com/), 35 bytes
```
{(∊⍸¨↓b)≡(∨/b←2>⌿⍵)/¯1↓⊣/⍒⍤1⊥⍨¨,⍀⍵}
```
-27 from Bubbler, -13 for pointing out the input is a Gray code, -3 for removing an excess variable, and another -11 for just being an all round golfing god.
```
{(∊⍸¨↓b)≡(∨/b←2>⌿⍵)/¯1↓⊣/⍒⍤1⊥⍨¨,⍀⍵}
                            ⊥⍨¨,⍀⍵ ⍝ cumulative sums (time a 1 has been there)
                    ¯1↓⊣/⍋⍤1       ⍝ index of maxima (without last element)
         (∨⌿b←2>/⍵)/               ⍝ filter where 1s change to 0s
 (∊⍸¨↓b)≡                          ⍝ does that equal the locations of 1s?
```
[Try it online!](https://tio.run/##bVHNSsQwEL7vU@RWF1ya2briyYsgenX3BborVaGgWD0sIghCcYtZ/MEHEBV6EPai4E3Io8yL1LSdpElrAslkvm8mX76EZ/HgcB7Gp0eDWRwmycmsKK7W8C5D8SNzTJ@nfVy8qkTuTzF9GG7j/S@K774vV6BQzN58FE8o3gGzDxS5zNdR3CjGdREpPoolZrcoPlF8yVWA6SMuX8YHO2qd7O2PC29yfnlxPPd6EYoFsCFTPMYZ9CK2YU7lBJq8hQBhVY3qMWJBDaqbZc48bg0oB21gjg0EJnQS3I2quMN32oEDOy3batTLS8WjrmagRe9lJ6DFxA6sbzIwANdyaxZwq5pinSe2Hep3uE2UZm83jJPy19gWCzrSG3lUzatnwqb6uRYXGoe0pySK0jViOUANqef/1lmNrQDMU5uUY5M2ozHF0IxAqwBsy2xrSaPlrHHP@wM "APL (Dyalog Classic) – Try It Online")
[Answer]
# [J](http://jsoftware.com/), 32 25 bytes
```
[:-:/[:(|/.~/:~"1)2-/\,&0
```
[Try it online!](https://tio.run/##pVLBSsQwEL3nK4YezBbadGaPkQVB2JMn8baKiOyyiCC49SBIf70m85K03fVmIbxmyEzee3lvY@XsgTaeLDXE5MNqHd3e323HnW99t/Orn84NnR8qqddt99hc8Vibfn/qN452nvavx4@bQ/yrXMXX7nlNK0u2iSPqMGugJxPPkH34/OqP3845a7SfLDckjc2bsGMJlbh4URZGmcvpwJQNxy9UwycKkkCLkkGLokckggkb7NAuaBBtlwScQBLEvgiYiT4FycAJlCwniCSMCLhMoBdlgGilJFwg9NV/aC2ck@S5cilQmJjMiwvMbpOZK5kXWJri36UeSj5IMrWAwKO5f9nUInlyLPkHN4PWlJLty/sJIcnvj0PaoOp0rI5RDnpZkzNVzIJYaMWdIABSsAn6ImlOjw1VYAVNcAR0YbyS/U8KMYQnG87dP8vkIq9mShrPHeYskC@zpfctX21K9uJ9c/jnKRx/AQ "J – Try It Online")
Based on [Leo's excellent idea](https://codegolf.stackexchange.com/a/220491/15469)
* `2-/\,&0` Adjacent elementwise row deltas, with an extra row of zeros appended first.
* `(|/.~/:~"1)` Group by sorted rows and take absolute value. This puts all rows with a single 1 into one bucket, and all rows with a single -1 into another.
* `[:-:/` Are those buckets equal?
[Answer]
# [Python 2](https://docs.python.org/2/), 62 bytes
Output is via exit code: `0` if it is a Beckett-Gray Codex and `1` otherwise.
```
a=p,=[1]
for x in input():0<p-x!=a.pop(0)<_;a+=[x-p]*(x>p);p=x
```
[Try it online!](https://tio.run/##dZDLboMwEEX3@YrpCmidCju88qC7bvsDKKpQ5ChIKVguVcnX07k2JOkiUkQ8r3vPjLn0p65V4@@pOWuSmwX19sJf0oM@UBAEY10aUVZyvzh2lgZqWv6Znz6MNvHOLIensn41nQnjaPe5rV/Kalia/XM4vJloa8phJIgsWO6gTU8f9Zd@t7azsDC2aXuKuXj@1reEHKtYEBu6P0ErQcoHygX/K4IyQbmglDMcrwUV/EKdGxQXJKcUOhFzPuEUTyluU/xWPC7xhjjGUGexFdoxCmHIZN62cB7eHBawgga0ZOZ7MYNZAEELmpljnZ0AAqDUsQPPYebeFxzgA2fyaNvkyoO2GRuWqWtf3/G54dwNP9abhO6Y5zP6o7prpZ4SG4PyeqXitpM79rQrtpqu9wc "Python 2 – Try It Online")
[Answer]
# [JavaScript (Node.js)](https://nodejs.org), 55 bytes
```
a=>a.every(n=>(n-=a[++i]|0)>0?m<(m=a[-n]):a[n]=i,i=m=0)
```
[Try it online!](https://tio.run/##nVPBboMwDL3nK7g1qC21d9wWdtph39AiNWK0YyoBQVRp0v6dETsJtL2tUvUSx47fezHf@qqHsq87uzXtZzWe1KhVrrPqWvU/0qhcmq3S@/W6Ln4hzeGteZXNFNiaIn3We1OoelOrRkE62mqwpR6qIVHJUcAmQSFgAsBp6f7AewTeA50DpUw/JEAPFMQAFERKQQdi2vCOy5ELkMrRA3hAD67OAd/JdQQYADwQQ/DgSAhE5jIDNQrAEokSQgSY9UWeXuZSLUaI3UXgAhEWHXDhRODCzET07FFD4rWjNzICsi9Lz4KRUebskveMHCR9tKY4iaBqyqZWdCf7wDpYBl/Hd3M/doCpOz7g344Jc0Omy2KZCXv6nzkiMwTMou69vJuqm4kT86zA0i8ImuBxOqjf7RvMs3nzWmF85zk6ZravG5lmQ3eprVwdzMGs0qzRnbSJyhM7LW35JXd7wGK9O/NR6Y463Q/Vh7Gy3CRPaZq@iPidZqe2f9dTWYi4/LI1Q3upskt7lqd44grHPw "JavaScript (Node.js) – Try It Online")
Input an array of equivalent integers, output true / false.
```
a=>a.every(n=>
  (
    n-=a[++i]|0 // compare current one with next one
                // if current one is the last one, we compare with 0
  )>0?
    // > 0 means some digit changed 1->0
    m<(m=a[-n]) // We use a[-n] to remember when 0->1 happened
                // We use m to remember where the related 0->1
                //    happened for last 1->0 change
                // If we find out related 1->0 changing earlier
                //    than m, it is not Beckett
                //    and we return false
                // Remember the where the related 0->1 mutation for current
                //    1->0 happened by assigning m
    // < 0 means some digit changed 0->1
    a[n]=i // Remember where 0->1 mutation happened for digit -n
           // This is always truthy too
 ,i=m=0)
```
[Answer]
# [Jelly](https://github.com/DennisMitchell/jelly), 10 bytes
```
_ƝµṂƇNṖ⁼ṬƇ
```
[Try it online!](https://tio.run/##tZQ9bsMwDIUv5OG9i3QvjKBTlyIX6JgsvkG23iBrBwOdWsD3cC6i/FgUSYlOshQChA@SbD3ykfp4324/U3qbvn6/53E/DS/zeDjtfubxOA3pbzjtj68p9T02Xc/NZerRXRkdryt5htlhnplP5Z1l3NaWwcJ0LGdYMQvLt3SMilGYjrNuw3BMx3AMowFGQ47YMRxLVuCYhWnibZnmDM1dNHdpLJ4ROMCGedcZNtxGZiNGw61SrjpJcxdXKuJxRmHcsFVTc@x8XCmtG7XzcCwaigOyKiclo3KT/E0UiRrroWZVc6oqVJuqV980exqnRq@5UvWaJ3VE49QK@sc@x0p2n6mauP/X3gsGHFUBgr691591JSJ8X3wlRtXt36ymz88 "Jelly – Try It Online")
Semi-translation of [Leo's excellent Husk answer](https://codegolf.stackexchange.com/a/220491/85334).
```
_Ɲ            Take the vectorized differences between adjacent elements.
              (The deltas builtin, I, vectorizes itself instead.)
   ṂƇ         Filter by minimum, keeping elements containing -1.
     N        Negate.
      Ṗ       Remove the last element.
       ⁼      Is this list equal to
  µ           the differences
        ṬƇ    filtered to only elements containing 1?
```
`Ṭ` was originally `Ṁ` (maximum), but this produced a false negative on the first test case, as the largest element of `[-1]` is -1 rather than 0. `Ṭ` produces an array with ones at the provided indices and zeros elsewhere, but ignores non-positive indices, producing an empty array (which is falsy) if there are no positive indices.
# [Jelly](https://github.com/DennisMitchell/jelly), ~~15~~ 13 bytes
```
ṛa+ɗ\>TẇM{ʋƝP
```
[Try it online!](https://tio.run/##tZQ9bgIxEIUPlC3eu0BuECkFDVooUtBEXCCio6HgABQoN@ACSRspErkFXMThx@OZsWchTWTJ@mR712/mzfh1Np@/pXT42L487DeTx9Hhc/W0@Fl/vz@nr9VxuRun1PeYdj2np6lHd2Z0PK/kGWaHeWY@lXeu47J2HSxMx3KGFbOwfEvHqBiF6TjrNgzHdAzHMBpgNOSIHcOxZAWOWZgm3pZpztDcRXOXxuIZgQNsmDedYcNtZDZiNNwq5aCTNHdxoCLuZxTGDVs1NcfOx5XSulE7D8eioTggq3JSMio3yd9EkaixHmpWNaeqQrWpevVNs6dxavSaK1WveVJHNE6toH/scwxk9y9VE/f/0HvBgKMqQNC3t/qzrkSE74uvxKi6/ZvV9Pkv "Jelly – Try It Online")
*-2 removing `ṙ1` because the all-zeros pattern can essentially be ignored--if you flip the last bit off, you already know it's the one that's been on the longest*
Takes input as an array of Boolean arrays, and outputs 0 or 1.
```
   ɗ\            Cumulatively reduce the input by:
ṛ                right argument
 a               vectorizing-logical-AND
  +              the vectorized sum of the arguments.
ṛa+ɗ\            This turns each 1 into how "long" it's been a 1, consecutively.
          ʋƝ     For each pair of adjacent elements from that result:
      T          are the indices at which
     >           the right is less than the left
       ẇ         a sublist of
        M{       the maximal indices of the left?
            P    Take the product of the results.
```
[Answer]
# [Python 3](https://docs.python.org/3/), ~~138~~ \$\cdots\$ ~~102~~ 95 bytes
Saved 13 bytes thanks to [rak1507](https://codegolf.stackexchange.com/users/95516/rak1507)!!!  
Saved 7 bytes thanks to [dingledooper](https://codegolf.stackexchange.com/users/88546/dingledooper)!!!
```
def f(b):
 r,*u=1,
 for x,y in zip(b,b[1:]):
  if x<y:u+=x^y,
  else:r&=u.pop(0)==x^y
 return r
```
[Try it online!](https://tio.run/##zVXBTsMwDL33K6wdaAsB2YCENBF@ZIxDRyomoKvaVNqY9u2j6ewktMCBE61UvdaO8/xsN/XOvmyqm@Px2ZRQZkU@T6BR550mlUC5aWCrdrCu4GNdZ4UqFjRfOhdYl7C93827C7192vWuYN5aM2/OdHdVb@oMc@0MfSxju6aC5mhNa1vQkPW@ixnOFMxotlSnt@EVafh4emJvg39xCT3CQA/pX9FDFrC/iAF5wCYKgE3EzuQBBsAVkeXEAckD9IA8QA9kL4nDgAJAD1hY9IBEauEcAxKTAGkblN0jgKHDQkoB0A@qUQRGLD1vjMCIAU2VFdGJJvX4OX@RzyuLEZioP6lQLNZX9X09ThUKGvE39mEJOCpH4F15z1hfUUPEkC2Fg7ATZSV9oS/5SMpCUBIWASUDqeK0xn@bg0m3/la/yWRMpyfucRzXBkc9/l1HR@XH8YSF8o@7JwzoaA7yxGxrs7Lm2f2GScmN7s6T1YtZvZrG2dLH7vrudpUqGBDdpHnizgKrjJwFw@9cgUQczgSAQi/Wlc3Mm3k3lVXXuVvFb26lXQ5urXYnzQDrxi0o031xgMsH2LcH2DOThdG6XR7S/PgJ "Python 3 – Try It Online")
Inputs a Gray-cyclic code starting with \$0\$ as list of integers and returns `1` is it's a Beckett-Gray code or `0` otherwise.
[Answer]
# [JavaScript (V8)](https://v8.dev/), 106 bytes
```
a=>!a.some((c,i)=>c.map((x,j)=>n+=x<(y=(a[i+1]||a[0])[j])?!!o.push(j):x>y?1<<o.shift()-j:0,n=0)&&n-1,o=[])
```
[Try it online!](https://tio.run/##nVNNb@MgEL3zK8ilAcVxZm6rbkhv@wv25loq8sYbW61tBVolUv97FmbwR9rbWrKfBxjmvcfQ2g/rqnMz@O3Hj1ttbtYcVjZ3/dtRqSprtDlU@ZsdlLpkbQi6jbns1dUoWzQbLD8/bQGlLtpSP61WfT68u5Nq9ePlcH3C/b7P3ampvdLb9hGyzoB@eOi2mPWmKPWt6jvnZWXd0UkjX8RuJ3@f3/3pKiCTKAQEAAy/8QWOETgGmgdaEh4kwAQ0iCPQINISjCBCwBGnIycgpWMCSIAJYl4E3pPzCHAESEAMIUEkIRCZywxUaASWSJQQJoBZ38QzyVyqxQmm6mLkAhMsKuDCiZELMxOTZ981yKQdk5ETIPuy9Gw0cpI5u5Q8IwdFPO9f9tVdRTpGZkJqaBtKo5q0ORvCglgP78tFuDBbwRoiMUiHyMy5MvNm1UyJzf2fhiJXBMzqvpr6pb3uWk/MTQNL42DUBN/bhOrdH8bcpHfHNvbx3FAvuRteG6/Wz91zt9Z0rb00B@nDr69OalcAlpvdX56q4lSR53lVUvwnxuFjjFzjWmv9U9T9WSq@xv4YPn3N11nL4dx0XtUqDoeVt38 "JavaScript (V8) – Try It Online")
Accepts input as a 2-dimensional array of booleans.
[Answer]
# [Charcoal](https://github.com/somebody1234/Charcoal), 34 bytes
```
¹≔⁰ζＦＩ⮌Ａ«¿›ζιＦ¬⁼⁻ζι⊟υ⎚≔⁺⟦⁻ιζ⟧υυ≔ιζ
```
[Try it online!](https://tio.run/##Tc5Na8MwDAbgc/srTE4KuCCddxpljB5Wwq4hB1PczWCSzh89dOy3e04iOzUYnlhS9F6@lbtMyqbUOTMGoPZl/@q9@RoBpXjkr@vkBByVD/Cp79p5DafxFgO0@Yjf/c5cBbw7rYJ28JDC5Ndl5DwFePuJynr4MGP0a1GKbrpBXIaPVisHecVOW68Fr@1s7u3XETNHGKSI7XxzI/eYNdpfSn3f4HwaKRYQgyq4RBu4RNxMFbgBGVSxlKgCK6gCK8qu8h8GbcCKdQVhBUclKpmfQaVUgCVY2f4EbIYhHe72Hw "Charcoal – Try It Online") Link is to verbose version of code. Takes input as strings and outputs a Charcoal boolean, i.e. `-` for a Beckett-Gray code, nothing if not. Explanation:
```
¹
```
Start by assuming that the input is a Beckett-Gray code.
```
≔⁰ζ
```
Initialise the previous value to 0.
```
ＦＩ⮌Ａ«
```
Convert the input to decimal (leading zeros aren't allowed as numeric input, but the cast operator is fine with them) and loop through it in reverse order. (I hope this works, as it saves a byte over skipping the leading string of all zeros.)
```
¿›ζι
```
If the previous value is greater than this value, ...
```
Ｆ¬⁼⁻ζι⊟υ⎚
```
... then if the oldest saved value is not the same as a difference then clear the canvas, as this is not a Beckett-Gray code.
```
≔⁺⟦⁻ιζ⟧υυ
```
Otherwise prepend the difference to the queue.
```
≔ιζ
```
Save the current value.
[Answer]
# [C (gcc)](https://gcc.gnu.org/), 95 bytes
```
t;r;b;e;f(a,n)int*a;{int l[n];for(b=e=r=1;--n;)t=*a^a[1],r&=*a++<*a?l[e++]=t,1:l[b++]==t;r=r;};
```
[Try it online!](https://tio.run/##fVTbjpswEH3nK0ZIqbg4argn66X7UPUrErYixNmipuwKkBo14tebztiGsE61iGTsOTNnjsdoquVLVV2vPW/5ngt@dErWuHXTeyW/oIHTtin48bV19rnI2zzgy2XD3T73yudyGxSs/YRL33/0yqfTVvh@kfcseDht97TMkTZv@cCvby2SOcQLJQMibly4WIAPkgMhUEMOK47mERoOvl@7EqdHph8de9EtDjarn2wG9oNts3JbFy63Bsv6VdaN41qKkth60fXfV9sCSS8rBsHA30PBDWIQMQjNgHAKCGXAHUNkMjBIGWQMEvTgfsNgjSvCMSBEIEBXSJG0R3@MLswKMSzEdYjpAa2pIKURjmQRhVMqERNNakqJJylrWVcJorJUnniJP0hVPvEQH4kkfqqTSv1jdRJHIhN5HpIspWdKC2kjzaQ9NqUkH3TlLjid6ya68cgkLZEUm9k5JGEmCe@oso/qavLZecdrUZcku5@oE1K36IRT19e3fsjL032ijpi34UktnZKivkCmPzdtQ20jbWNtE21TbTPzfI0i7eo/4vXoKG73s956es9gjgcGHhh4aOChgUcGHhl4bOCxgScGnhh4auCpgWcGnrmzpojzm6h6cVBtCeS1T@9KvTq8@lG2Hv6L6qdoVby9O38Ld@fNV/wlNE1m@8jWebfJ1BzEWU8nuXwcdY4qbkonjxxhFD0OuukbKZFKfScSL/gchkajeOP/gzuE1ZR@7xfon3piJo7z82K7hhOZoHHvIwdYfoHFARbdrsH@dGzqX5fnotAZgzVc/1bHU/nSXZe//wE "C (gcc) – Try It Online")
Port of my [Python answer](https://codegolf.stackexchange.com/a/220487/9481).
Inputs an array of integers and its length (since length of arrays passed into functions as pointers are undefined in C) and returns `1` is it's a Beckett-Gray code or `0` otherwise.
[Answer]
# [R](https://www.r-project.org/), ~~73~~ 64 bytes
```
function(m,d=diff(rbind(m,0)),`-`=rowSums)any(d[-d>0,]+d[-d<0,])
```
[Try it online!](https://tio.run/##1ZNBT4NAEIXv8yuQExtpM@/uevQPeFSTYhciB2gDVOuvRwQ6zNJqTDkZsslHNjuz773Zqs1smx3KbZPvyqiInXV5lkXVa1667peNiTerja12H4@HojZJ@Rm5p5W75/jl9hvuOjBtYZN6XSRNlR@jKk3celu/R2/2IQ7qdG/DIIyDJj02NuTnEqExdJNFhSH68znigLsFQr@Yri6CfqEvdm2R4RPCSFA07MIjjDScgCL2iEeCol65ECuCIlbE0o2lWy9dESsajGFFGAmiY06QXUhlSOXTTTUNyS1zHTPCD0lgRr7SST3PyFeAi4lBKuNC2r@5yeL/NAs@nSd7PgFz/3WyrOjUbYHrNE3n6CWpjjRN3cJsyZ9HUURa6/ROJGvS06beAs1eIrGXmszPv791@wU "R – Try It Online")
Based on the idea in [Leo's Husk answer](https://codegolf.stackexchange.com/a/220491/78274).
Takes input as a matrix `m` of 1s and 0s with each pattern corresponding to a row. Outputs a swapped T/F value (in the footer, the results are swapped back).
]